[gnome-commander/GSettings] Adds list_font filter option to GSettings (now known as list-font)



commit b22416e620459a1e668a978d4f3f635d9e3d963d
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Fri May 20 22:31:32 2016 +0200

    Adds list_font filter option to GSettings (now known as list-font)

 data/org.gnome.gnome-commander.gschema.xml |    4 ++--
 src/gnome-cmd-data.cc                      |   22 ++++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 0ef5eff..6103417 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -93,8 +93,8 @@
     </key>
     <key name="list-font" type="s">
       <default l10n="messages">'DejaVu Sans Mono 8'</default>
-      <summary></summary>
-      <description></description>
+      <summary>List font</summary>
+      <description>The font in the file panes.</description>
     </key>
     <key name="ext-disp-mode" type="i">
       <default l10n="messages">2</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 4cec90e..5d181e9 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -165,6 +165,16 @@ void on_filter_changed ()
     main_win->update_view();
 }
 
+void on_list_font_changed ()
+{
+    char *list_font;
+
+    list_font = g_settings_get_string (gnome_cmd_data.options.gcmd_settings->general, 
GCMD_SETTINGS_LIST_FONT);
+    gnome_cmd_data.options.list_font = list_font;
+
+    main_win->update_view();
+}
+
 static void gcmd_settings_class_init (GcmdSettingsClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -206,6 +216,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_date_disp_format_changed),
                       NULL);
 
+    g_signal_connect (gs->general,
+                      "changed::list-font",
+                      G_CALLBACK (on_list_font_changed),
+                      NULL);
+
     g_signal_connect (gs->filter,
                       "changed::hide-unknown",
                       G_CALLBACK (on_filter_changed),
@@ -1633,6 +1648,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //hidden_filter
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/backup_filter", FALSE) ? 1 
: 0,
                                                         options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_BACKUP);
+        //list_font
+        migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string ("/options/list_font", 
"-misc-fixed-medium-r-normal-*-10-*-*-*-c-*-iso8859-1"),
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_LIST_FONT);
         // 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
@@ -1805,7 +1823,7 @@ void GnomeCmdData::load()
     options.ls_colors_palette.white_fg = gdk_color_new (0xffff, 0xffff, 0xffff);
     options.ls_colors_palette.white_bg = gdk_color_new (0xffff, 0xffff, 0xffff);
 
-    options.list_font = gnome_cmd_data_get_string ("/options/list_font", 
"-misc-fixed-medium-r-normal-*-10-*-*-*-c-*-iso8859-1");
+    options.list_font = g_settings_get_string (options.gcmd_settings->general, GCMD_SETTINGS_LIST_FONT);
 
     options.ext_disp_mode = (GnomeCmdExtDispMode) gnome_cmd_data_get_int ("/options/ext_disp_mode", 
GNOME_CMD_EXT_DISP_BOTH);
     options.left_mouse_button_mode = (LeftMouseButtonMode) gnome_cmd_data_get_int 
("/options/left_mouse_button_mode", LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK);
@@ -2339,7 +2357,7 @@ void GnomeCmdData::save()
     gnome_cmd_data_set_color ("/colors/ls_colors_white_fg", options.ls_colors_palette.white_fg);
     gnome_cmd_data_set_color ("/colors/ls_colors_white_bg", options.ls_colors_palette.white_bg);
 
-    gnome_cmd_data_set_string ("/options/list_font", options.list_font);
+    set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_LIST_FONT, 
options.list_font);
 
     gnome_cmd_data_set_int    ("/options/ext_disp_mode", options.ext_disp_mode);
     gnome_cmd_data_set_int    ("/options/left_mouse_button_mode", options.left_mouse_button_mode);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index ad124a8..9d84181 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -62,6 +62,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_GRAPHICAL_LAYOUT_MODE           "graphical-layout-mode"
 #define GCMD_SETTINGS_LIST_ROW_HEIGHT                 "list-row-height"
 #define GCMD_SETTINGS_DATE_DISP_FORMAT                "date-disp-format"
+#define GCMD_SETTINGS_LIST_FONT                       "list-font"
 
 #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]