[gnome-commander/GSettings] Adds tab_lock_indicator to GSettings (now known as tab-lock-indicator)



commit 08b45b4f830f170c067d0a0c5bc62ad47b240b09
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Thu Jun 16 22:23:56 2016 +0200

    Adds tab_lock_indicator to GSettings (now known as tab-lock-indicator)

 data/org.gnome.gnome-commander.gschema.xml |   16 ++++++++++++----
 src/gnome-cmd-data.cc                      |   22 ++++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index d2f5045..9a0b51a 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -67,6 +67,12 @@
     <value nick="GDK_INTERP_HYPER" value="3"/>
   </enum>
 
+  <enum id="org.gnome.gnome-commander.preferences.general.tab-lock-indicator-enum">
+    <value nick="icon" value="0"/>
+    <value nick="asterisk" value="1"/>
+    <value nick="styled text" value="2"/>
+  </enum>
+
   <schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.general" 
path="/org/gnome/gnome-commander/preferences/general/">
     <key name="use-default-font" type="b">
       <default>true</default>
@@ -308,10 +314,12 @@
           Defines if the tab bar is always shown.
       </description>
     </key>
-    <key name="tab-lock-indicator" type="i">
-      <default l10n="messages">2</default>
-      <summary></summary>
-      <description></description>
+    <key name="tab-lock-indicator" 
enum='org.gnome.gnome-commander.preferences.general.tab-lock-indicator-enum'>
+      <default l10n="messages">'icon'</default>
+      <summary>Tab lock indicator</summary>
+      <description>
+          Defines the style of the tab lock indicator.
+      </description>
     </key>
   </schema>
   <schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.quick-connect" 
path="/org/gnome/gnome-commander/preferences/quick-connect/">
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index a1efe4b..0a2a065 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -264,6 +264,16 @@ void on_always_show_tabs_changed ()
     main_win->update_style();
 }
 
+void on_tab_lock_indicator_changed ()
+{
+    gint tab_lock_indicator;
+
+    tab_lock_indicator = g_settings_get_enum (gnome_cmd_data.options.gcmd_settings->general, 
GCMD_SETTINGS_TAB_LOCK_INDICATOR);
+    gnome_cmd_data.options.tab_lock_indicator = tab_lock_indicator;
+
+    main_win->update_style();
+}
+
 void on_symlink_string_changed ()
 {
     gnome_cmd_data.options.symlink_prefix = g_settings_get_string 
(gnome_cmd_data.options.gcmd_settings->general, GCMD_SETTINGS_SYMLINK_PREFIX);
@@ -415,6 +425,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_always_show_tabs_changed),
                       NULL);
 
+    g_signal_connect (gs->general,
+                      "changed::tab-lock-indicator",
+                      G_CALLBACK (on_tab_lock_indicator_changed),
+                      NULL);
+
 }
 
 
@@ -1915,6 +1930,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //always_show_tabs
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/always_show_tabs", FALSE) ? 
1 : 0,
                                                         options.gcmd_settings->general, 
GCMD_SETTINGS_ALWAYS_SHOW_TABS);
+        //tab_lock_indicator
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/tab_lock_indicator", 
TAB_LOCK_ICON),
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_TAB_LOCK_INDICATOR);
         // ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
         //       à la save_devices_old ("devices.backup");
         //       and move .gnome2/gnome-commander to .gnome2/gnome-commander.backup
@@ -2155,7 +2173,7 @@ void GnomeCmdData::load()
     options.save_dir_history_on_exit = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_SAVE_DIR_HISTORY_ON_EXIT);
 
     options.always_show_tabs = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_ALWAYS_SHOW_TABS);
-    options.tab_lock_indicator = (TabLockIndicator) gnome_cmd_data_get_int ("/options/tab_lock_indicator", 
TAB_LOCK_ICON);
+    options.tab_lock_indicator = (TabLockIndicator) g_settings_get_enum (options.gcmd_settings->general, 
GCMD_SETTINGS_TAB_LOCK_INDICATOR);
 
     options.backup_pattern = gnome_cmd_data_get_string ("/defaults/backup_pattern", "*~;*.bak");
     options.backup_pattern_list = patlist_new (options.backup_pattern);
@@ -2687,7 +2705,7 @@ void GnomeCmdData::save()
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SAVE_DIR_HISTORY_ON_EXIT, 
&(options.save_dir_history_on_exit));
 
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_ALWAYS_SHOW_TABS, 
&(options.always_show_tabs));
-    gnome_cmd_data_set_int ("/options/tab_lock_indicator", (int) options.tab_lock_indicator);
+    set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_TAB_LOCK_INDICATOR, 
options.tab_lock_indicator);
 
     gnome_cmd_data_set_string ("/defaults/backup_pattern", options.backup_pattern);
 
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index abb7e88..b6ed74a 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -87,6 +87,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_SAVE_TABS_ON_EXIT               "save-tabs-on-exit"
 #define GCMD_SETTINGS_SAVE_DIR_HISTORY_ON_EXIT        "save-dir-history-on-exit"
 #define GCMD_SETTINGS_ALWAYS_SHOW_TABS                "always-show-tabs"
+#define GCMD_SETTINGS_TAB_LOCK_INDICATOR              "tab-lock-indicator"
 
 #define GCMD_PREF_FILTER                              "org.gnome.gnome-commander.preferences.filter"
 #define GCMD_SETTINGS_FILTER_HIDE_UNKNOWN             "hide-unknown"


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