[easytag/wip/gsettings: 2/2] Use GSettings instead of custom settings parsing



commit 3a1ccc191d66d6d6cb6dc7684f447b0d3fdf04d7
Author: David King <amigadave amigadave com>
Date:   Sun Feb 17 16:07:20 2013 +0000

    Use GSettings instead of custom settings parsing

 src/browser.c |    2 +-
 src/prefs.c   |    3 ++-
 src/setting.c |    1 +
 src/setting.h |    4 +++-
 4 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index 8aa7152..f2a7f9f 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -798,7 +798,7 @@ Browser_Tree_Node_Selected (GtkTreeSelection *selection, gpointer user_data)
     /* Start to read the directory */
     /* The first time, 'counter' is equal to zero. And if we don't want to load
      * directory on startup, we skip the 'reading', but newt we must read it each time */
-    if (LOAD_ON_STARTUP || counter)
+    if (g_settings_get_boolean (ETSettings, "load-on-startup") || counter)
     {
         gboolean dir_loaded;
         GtkTreeIter parentIter;
diff --git a/src/prefs.c b/src/prefs.c
index 154ae26..63ade0f 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -195,7 +195,8 @@ void Open_OptionsWindow (void)
     /* Load directory on startup */
     LoadOnStartup = gtk_check_button_new_with_label(_("Load on startup the default directory or the 
directory passed as argument"));
     gtk_box_pack_start(GTK_BOX(vbox),LoadOnStartup,FALSE,FALSE,0);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LoadOnStartup),LOAD_ON_STARTUP);
+    g_settings_bind (ETSettings, "load-on-startup", LoadOnStartup, "active",
+                     G_SETTINGS_BIND_DEFAULT);
     gtk_widget_set_tooltip_text(LoadOnStartup,_("Automatically search files, when EasyTAG starts, "
         "into the default directory. Note that this path may be overridden by the parameter "
         "passed to easytag (easytag /path_to/mp3_files)."));
diff --git a/src/setting.c b/src/setting.c
index e67d856..d144a37 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -353,6 +353,7 @@ void Init_Config_Variables (void)
 {
     const gchar *music_dir;
 
+    ETSettings = g_settings_new ("org.gnome.EasyTAG");
     /*
      * Common
      */
diff --git a/src/setting.h b/src/setting.h
index 59d606a..820b37d 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -46,8 +46,10 @@ struct _tConfigVariable
 
 
 /*
- * Config varariables
+ * Config variables
  */
+GSettings *ETSettings;
+
 /* Common */
 gint    LOAD_ON_STARTUP;
 gchar  *DEFAULT_PATH_TO_MP3;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]