diff options
author | Søren Sandmann Pedersen <sandmann@redhat.com> | 2009-01-20 08:19:03 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <sandmann@redhat.com> | 2009-01-20 08:19:03 -0500 |
commit | cbaac2c0bc737911c7facadfa58e57309e938b95 (patch) | |
tree | 1f352418ee6d90a575b77a211d29014de3f86332 | |
parent | bf58edef4002559768bf4859886385b216bc8633 (diff) | |
parent | cb7c1d886e39bad3e39931d9690e125ef5cec101 (diff) |
TODO
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | TODO | 3 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | siv.c | 55 |
4 files changed, 35 insertions, 33 deletions
diff --git a/Makefile.am b/Makefile.am index 45a9dfb..b2253ea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,8 +20,8 @@ bin_PROGRAMS = siv -AM_CFLAGS = $(DEP_CFLAGS) -DDATADIR=\"$(pkgdatadir)\" -siv_LDADD = $(DEP_LIBS) +AM_CFLAGS = $(DEPENDENCIES_CFLAGS) -DDATADIR=\"$(pkgdatadir)\" +siv_LDADD = $(DEPENDENCIES_LIBS) siv_SOURCES = \ siv.c \ @@ -1,6 +1,9 @@ - When failing from the command line, print failure on stdout rather than displaying an alert. +- Icon + - Set the image as icon when one is loaded + - Recent files - Statusbar diff --git a/configure.ac b/configure.ac index 0106d06..79fbad7 100644 --- a/configure.ac +++ b/configure.ac @@ -33,8 +33,8 @@ AC_PROG_INSTALL CFLAGS="-Wall $CFLAGS" # Checks for pkg-config packages -PKG_CHECK_MODULES(DEP, gtk+-2.0 libglade-2.0) -AC_SUBST(DEP_CFLAGS) -AC_SUBST(DEP_LIBS) +PKG_CHECK_MODULES(DEPENDENCIES, gtk+-2.0 libglade-2.0 libnul) +AC_SUBST(DEPENDENCIES_CFLAGS) +AC_SUBST(DEPENDENCIES_LIBS) AC_OUTPUT([Makefile]) @@ -321,15 +321,11 @@ app_set_meta_data (App *app, g_hash_table_destroy (table); } - -static void -app_new (int argc, char **argv) +static char ** +process_options (int argc, char **argv) { - GList *filenames = NULL; - GList *list; - App *app; int i; - GPtrArray *err_files = g_ptr_array_new (); + GPtrArray *result = g_ptr_array_new (); for (i = 1; i < argc; ++i) { @@ -342,24 +338,33 @@ app_new (int argc, char **argv) g_print ("%s %s\n", APPLICATION_NAME, PACKAGE_VERSION); exit (1); - return; + return NULL; } if (g_path_is_absolute (option)) - { name = g_strdup (option); - } else - { name = g_build_filename (g_get_current_dir(), option, NULL); - } - filenames = g_list_prepend (filenames, name); + g_ptr_array_add (result, name); } + g_ptr_array_add (result, NULL); + + return (char **)g_ptr_array_free (result, FALSE); +} + +static void +app_new (int argc, char **argv) +{ + GPtrArray *err_files = g_ptr_array_new (); + char **filenames; + App *app; + int i; + + filenames = process_options (argc, argv); + app = g_new0 (App, 1); - - filenames = g_list_reverse (filenames); /* When a window is created, it increases the app->n_windows counter; * when it is destroyed it decreases it. The problem is if the first @@ -370,17 +375,14 @@ app_new (int argc, char **argv) * prevent that from happening. */ app->n_windows = 1; - - if (filenames) - { - int i; - i = 0; - for (list = filenames; list != NULL; list = list->next) + if (filenames[0]) + { + for (i = 0; filenames[i] != NULL; ++i) { SivWindow *window; GError *err = NULL; - char *filename = list->data; + char *filename = filenames[i]; /* Don't open more than 32 windows */ if (++i > 32) @@ -388,7 +390,7 @@ app_new (int argc, char **argv) window = window_new (app); - if (!window_load_file (window, list->data, &err)) + if (!window_load_file (window, filename, &err)) { g_ptr_array_add (err_files, g_strdup (filename)); g_error_free (err); @@ -400,17 +402,14 @@ app_new (int argc, char **argv) window_show (window, GDK_CURRENT_TIME); } } - - for (list = filenames; list != NULL; list = list->next) - g_free (list->data); - - g_list_free (filenames); } else { window_show (window_new (app), GDK_CURRENT_TIME); } + g_strfreev (filenames); + app_show_could_not_open (NULL, err_files->len, (char **)err_files->pdata); g_ptr_array_foreach (err_files, (GFunc)g_free, NULL); |