Revision: 1112
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1112&view=rev
Author:   zas_
Date:     2008-08-31 08:41:42 +0000 (Sun, 31 Aug 2008)

Log Message:
-----------
Move some code to new functions, to simplify main().

Modified Paths:
--------------
    trunk/src/main.c

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c    2008-08-31 08:13:36 UTC (rev 1111)
+++ trunk/src/main.c    2008-08-31 08:41:42 UTC (rev 1112)
@@ -565,11 +565,47 @@
        g_free(buf);
 }
 
+static void accel_map_save(void)
+{
+       gchar *path;
+       gchar *pathl;
 
-static void exit_program_final(void)
+       path = g_build_filename(homedir(), GQ_RC_DIR, "accels", NULL);
+       pathl = path_from_utf8(path);
+       gtk_accel_map_save(pathl);
+       g_free(pathl);
+       g_free(path);
+}
+
+static void accel_map_load(void)
 {
        gchar *path;
        gchar *pathl;
+
+       path = g_build_filename(homedir(), GQ_RC_DIR, "accels", NULL);
+       pathl = path_from_utf8(path);
+       gtk_accel_map_load(pathl);
+       g_free(pathl);
+       g_free(path);
+}
+
+static void gtkrc_load(void)
+{
+       gchar *path;
+       gchar *pathl;
+
+       /* If a gtkrc file exists in the rc directory, add it to the
+        * list of files to be parsed at the end of gtk_init() */
+       path = g_build_filename(homedir(), GQ_RC_DIR, "gtkrc", NULL);
+       pathl = path_from_utf8(path);
+       if (access(pathl, R_OK) == 0)
+               gtk_rc_add_default_file(pathl);
+       g_free(pathl);
+       g_free(path);
+}
+
+static void exit_program_final(void)
+{
        LayoutWindow *lw = NULL;
 
        remote_close(remote_connection);
@@ -579,13 +615,8 @@
        sync_options_with_current_state(options);
        save_options(options);
        keys_save();
+       accel_map_save();
 
-       path = g_build_filename(homedir(), GQ_RC_DIR, "accels", NULL);
-       pathl = path_from_utf8(path);
-       gtk_accel_map_save(pathl);
-       g_free(pathl);
-       g_free(path);
-
        if (layout_valid(&lw))
                {
                layout_free(lw);
@@ -666,7 +697,6 @@
        CollectionData *first_collection = NULL;
        gchar *geometry = NULL;
        gchar *buf;
-       gchar *bufl;
        CollectionData *cd = NULL;
 
 #ifdef HAVE_GTHREAD
@@ -705,15 +735,7 @@
 
        parse_command_line(argc, argv, &cmd_path, &cmd_file, &cmd_list, 
&collection_list, &geometry);
 
-       /* If a gtkrc file exists in the rc directory, add it to the
-        * list of files to be parsed at the end of gtk_init() */
-       buf = g_build_filename(homedir(), GQ_RC_DIR, "gtkrc", NULL);
-       bufl = path_from_utf8(buf);
-       if (access(bufl, R_OK) == 0)
-               gtk_rc_add_default_file(bufl);
-       g_free(bufl);
-       g_free(buf);
-
+       gtkrc_load();
        gtk_init(&argc, &argv);
 
        if (gtk_major_version < GTK_MAJOR_VERSION ||
@@ -735,11 +757,7 @@
        filter_add_defaults();
        filter_rebuild();
 
-       buf = g_build_filename(homedir(), GQ_RC_DIR, "accels", NULL);
-       bufl = path_from_utf8(buf);
-       gtk_accel_map_load(bufl);
-       g_free(bufl);
-       g_free(buf);
+       accel_map_load();
 
        if (startup_blank)
                {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to