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

Log Message:
-----------
Move save/load_options() to options.[ch].

Modified Paths:
--------------
    trunk/src/main.c
    trunk/src/options.c
    trunk/src/options.h
    trunk/src/rcfile.c
    trunk/src/rcfile.h

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c    2008-08-31 08:59:39 UTC (rev 1113)
+++ trunk/src/main.c    2008-08-31 09:13:42 UTC (rev 1114)
@@ -22,7 +22,7 @@
 #include "image-overlay.h"
 #include "layout.h"
 #include "layout_image.h"
-#include "rcfile.h"
+#include "options.h"
 #include "remote.h"
 #include "similar.h"
 #include "ui_fileops.h"

Modified: trunk/src/options.c
===================================================================
--- trunk/src/options.c 2008-08-31 08:59:39 UTC (rev 1113)
+++ trunk/src/options.c 2008-08-31 09:13:42 UTC (rev 1114)
@@ -20,6 +20,7 @@
 #include "info.h"
 #include "layout.h"
 #include "layout_image.h"
+#include "rcfile.h"
 #include "ui_bookmark.h"
 #include "ui_fileops.h"
 #include "window.h"
@@ -209,7 +210,7 @@
                ExifUIList[i].current = ExifUIList[i].default_value;
 }
 
-void sync_options_with_current_state(ConfOptions *options)
+static void sync_options_with_current_state(ConfOptions *options)
 {
        LayoutWindow *lw = NULL;
 
@@ -251,3 +252,33 @@
                options->startup.path = g_strdup(layout_get_path(NULL));
                }
 }
+
+void save_options(ConfOptions *options)
+{
+       gchar *rc_path;
+
+       sync_options_with_current_state(options);
+
+       rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL);
+       save_options_to(rc_path, options);
+       g_free(rc_path);
+}
+
+void load_options(ConfOptions *options)
+{
+       gboolean success;
+       gchar *rc_path;
+
+       if (isdir(GQ_SYSTEM_WIDE_DIR))
+               {
+               rc_path = g_build_filename(GQ_SYSTEM_WIDE_DIR, RC_FILE_NAME, 
NULL);
+               success = load_options_from(rc_path, options);
+               DEBUG_1("Loading options from %s ... %s", rc_path, success ? 
"done" : "failed");
+               g_free(rc_path);
+               }
+       
+       rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL);
+       success = load_options_from(rc_path, options);
+       DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : 
"failed");
+       g_free(rc_path);
+}

Modified: trunk/src/options.h
===================================================================
--- trunk/src/options.h 2008-08-31 08:59:39 UTC (rev 1113)
+++ trunk/src/options.h 2008-08-31 09:13:42 UTC (rev 1114)
@@ -258,6 +258,8 @@
 
 ConfOptions *init_options(ConfOptions *options);
 void setup_default_options(ConfOptions *options);
-void sync_options_with_current_state(ConfOptions *options);
+void save_options(ConfOptions *options);
+void load_options(ConfOptions *options);
 
+
 #endif /* OPTIONS_H */

Modified: trunk/src/rcfile.c
===================================================================
--- trunk/src/rcfile.c  2008-08-31 08:59:39 UTC (rev 1113)
+++ trunk/src/rcfile.c  2008-08-31 09:13:42 UTC (rev 1114)
@@ -305,7 +305,7 @@
  *-----------------------------------------------------------------------------
  */
 
-static gboolean save_options_to(const gchar *utf8_path, ConfOptions *options)
+gboolean save_options_to(const gchar *utf8_path, ConfOptions *options)
 {
        SecureSaveInfo *ssi;
        gchar *rc_pathl;
@@ -639,19 +639,9 @@
        return TRUE;
 }
 
-void save_options(ConfOptions *options)
-{
-       gchar *rc_path;
 
-       sync_options_with_current_state(options);
 
-       rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL);
-       save_options_to(rc_path, options);
-       g_free(rc_path);
-}
 
-
-
 /*
  *-----------------------------------------------------------------------------
  * load configuration (public)
@@ -677,7 +667,7 @@
 
 #define OPTION_READ_BUFFER_SIZE 1024
 
-static gboolean load_options_from(const gchar *utf8_path, ConfOptions *options)
+gboolean load_options_from(const gchar *utf8_path, ConfOptions *options)
 {
        FILE *f;
        gchar *rc_pathl;
@@ -996,22 +986,3 @@
        fclose(f);
        return TRUE;
 }
-
-void load_options(ConfOptions *options)
-{
-       gboolean success;
-       gchar *rc_path;
-
-       if (isdir(GQ_SYSTEM_WIDE_DIR))
-               {
-               rc_path = g_build_filename(GQ_SYSTEM_WIDE_DIR, RC_FILE_NAME, 
NULL);
-               success = load_options_from(rc_path, options);
-               DEBUG_1("Loading options from %s ... %s", rc_path, success ? 
"done" : "failed");
-               g_free(rc_path);
-               }
-       
-       rc_path = g_build_filename(homedir(), GQ_RC_DIR, RC_FILE_NAME, NULL);
-       success = load_options_from(rc_path, options);
-       DEBUG_1("Loading options from %s ... %s", rc_path, success ? "done" : 
"failed");
-       g_free(rc_path);
-}

Modified: trunk/src/rcfile.h
===================================================================
--- trunk/src/rcfile.h  2008-08-31 08:59:39 UTC (rev 1113)
+++ trunk/src/rcfile.h  2008-08-31 09:13:42 UTC (rev 1114)
@@ -17,8 +17,7 @@
 gchar *quoted_value(const gchar *text, const gchar **tail);
 gchar *escquote_value(const gchar *text);
 
-void save_options(ConfOptions *options);
-void load_options(ConfOptions *options);
+gboolean save_options_to(const gchar *utf8_path, ConfOptions *options);
+gboolean load_options_from(const gchar *utf8_path, ConfOptions *options);
 
-
 #endif


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