[gnome-commander/GSettings] Adds main_win_state to GSettings (now known as main-win-state)



commit 20b8a98694f5c39c2c4bbb1faf359670eef841d9
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sat Jun 18 16:30:33 2016 +0200

    Adds main_win_state to GSettings (now known as main-win-state)

 data/org.gnome.gnome-commander.gschema.xml |    9 ++++++---
 src/gnome-cmd-data.cc                      |    7 +++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 7c065ec..3832862 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -274,10 +274,13 @@
       <summary></summary>
       <description></description>
     </key>
-    <key name="main-win-state" type="i">
+    <!-- https://developer.gimp.org/api/2.0/gdk/gdk-Event-Structures.html#GdkWindowState -->
+    <key name="main-win-state" type="u">
       <default l10n="messages">4</default>
-      <summary></summary>
-      <description></description>
+      <summary>Main window state</summary>
+      <description>
+          The number represents the main window state, e.g. 'maximized', 'fullscreen', etc. and is 
calculated internally.
+      </description>
     </key>
     <key name="middle-mouse-btn-mode" 
enum="org.gnome.gnome-commander.preferences.general.middle-mouse-btn-mode-enum">
       <default l10n="messages">'parent directory'</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 0a2a065..1dd2e16 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1933,6 +1933,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //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);
+        //main_win_state
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/main_win_state", (gint) 
GDK_WINDOW_STATE_MAXIMIZED),
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_MAIN_WIN_STATE);
         // 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
@@ -2178,7 +2181,7 @@ void GnomeCmdData::load()
     options.backup_pattern = gnome_cmd_data_get_string ("/defaults/backup_pattern", "*~;*.bak");
     options.backup_pattern_list = patlist_new (options.backup_pattern);
 
-    main_win_state = (GdkWindowState) gnome_cmd_data_get_int ("/options/main_win_state", (gint) 
GDK_WINDOW_STATE_MAXIMIZED);
+    main_win_state = (GdkWindowState) g_settings_get_uint (options.gcmd_settings->general, 
GCMD_SETTINGS_MAIN_WIN_STATE);
 
     priv->ftp_anonymous_password = gnome_cmd_data_get_string ("/network/ftp_anonymous_password", "you 
provider com");
 
@@ -2709,7 +2712,7 @@ void GnomeCmdData::save()
 
     gnome_cmd_data_set_string ("/defaults/backup_pattern", options.backup_pattern);
 
-    gnome_cmd_data_set_int ("/options/main_win_state", (gint) main_win_state);
+    set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_MAIN_WIN_STATE, 
&(main_win_state));
 
     gnome_cmd_data_set_string ("/network/ftp_anonymous_password", priv->ftp_anonymous_password);
     gnome_config_clean_section (G_DIR_SEPARATOR_S PACKAGE "/ftp");
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index b6ed74a..a6582a2 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -88,6 +88,7 @@ GcmdSettings *gcmd_settings_new (void);
 #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_SETTINGS_MAIN_WIN_STATE                  "main-win-state"
 
 #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]