[gnome-commander/GSettings] Adds save_dirs_on_exit to GSettings (now known as save-dirs-on-exit)



commit aa927d358ed8bd06aa074a582ed8606af3cd7745
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Wed Jun 8 21:24:02 2016 +0200

    Adds save_dirs_on_exit to GSettings (now known as save-dirs-on-exit)

 data/org.gnome.gnome-commander.gschema.xml |    6 ++++--
 src/gnome-cmd-data.cc                      |    7 +++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index bb7770e..1973064 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -282,8 +282,10 @@
     </key>
     <key name="save-dirs-on-exit" type="b">
       <default l10n="messages">true</default>
-      <summary></summary>
-      <description></description>
+      <summary>Save directories on exit</summary>
+      <description>
+          Defines if the current directories are opened again when Gnome Commander is restarted.
+      </description>
     </key>
     <key name="save-tabs-on-exit" type="b">
       <default l10n="messages">true</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index f0ff71a..0a950bb 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1888,6 +1888,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //main_win_pos_y
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/main_win_pos_y", 25),
                                                         options.gcmd_settings->general, 
GCMD_SETTINGS_MAIN_WIN_POS_Y);
+        //save-dirs-on-exit
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/save_dirs_on_exit", TRUE) ? 
1 : 0,
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_SAVE_DIRS_ON_EXIT);
         // 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
@@ -2123,7 +2126,7 @@ void GnomeCmdData::load()
     gnome_cmd_data_get_color ("/colors/ls_colors_white_fg", options.ls_colors_palette.white_fg);
     gnome_cmd_data_get_color ("/colors/ls_colors_white_bg", options.ls_colors_palette.white_bg);
 
-    options.save_dirs_on_exit = gnome_cmd_data_get_bool ("/options/save_dirs_on_exit", TRUE);
+    options.save_dirs_on_exit = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_SAVE_DIRS_ON_EXIT);
     options.save_tabs_on_exit = gnome_cmd_data_get_bool ("/options/save_tabs_on_exit", TRUE);
     options.save_dir_history_on_exit = gnome_cmd_data_get_bool ("/options/save_dir_history_on_exit", TRUE);
 
@@ -2655,7 +2658,7 @@ void GnomeCmdData::save()
         g_free (tmp);
     }
 
-    gnome_cmd_data_set_bool ("/options/save_dirs_on_exit", options.save_dirs_on_exit);
+    set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SAVE_DIRS_ON_EXIT, 
&(options.save_dirs_on_exit));
     gnome_cmd_data_set_bool ("/options/save_tabs_on_exit", options.save_tabs_on_exit);
     gnome_cmd_data_set_bool ("/options/save_dir_history_on_exit", options.save_dir_history_on_exit);
 
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index b09518e..63fd7db 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -83,6 +83,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_SYMLINK_PREFIX                  "symlink-string"
 #define GCMD_SETTINGS_MAIN_WIN_POS_X                  "main-win-pos-x"
 #define GCMD_SETTINGS_MAIN_WIN_POS_Y                  "main-win-pos-y"
+#define GCMD_SETTINGS_SAVE_DIRS_ON_EXIT               "save-dirs-on-exit"
 
 #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]