[gnome-commander/GSettings] Moves get_string and gnome_cmd_data_get_string methods into GnomeCmdData class



commit b6669b7b4571b99a0cb10357385ed48080ca61d8
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Mon May 16 16:33:27 2016 +0200

    Moves get_string and gnome_cmd_data_get_string methods into GnomeCmdData class

 libgcmd/libgcmd-data.cc |   12 ------------
 libgcmd/libgcmd-data.h  |    2 --
 src/gnome-cmd-data.cc   |   23 ++++++++++++++++++++++-
 src/gnome-cmd-data.h    |    3 +++
 4 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/libgcmd/libgcmd-data.cc b/libgcmd/libgcmd-data.cc
index 6ea531b..61e1591 100644
--- a/libgcmd/libgcmd-data.cc
+++ b/libgcmd/libgcmd-data.cc
@@ -112,18 +112,6 @@ void gnome_cmd_data_set_color (const gchar *path, GdkColor *color)
 }
 
 
-gchar *gnome_cmd_data_get_string (const gchar *path, const gchar *def)
-{
-    gchar *s = g_build_path (G_DIR_SEPARATOR_S, PACKAGE, path, NULL);
-
-    gchar *v = get_string (s, def);
-
-    g_free (s);
-
-    return v;
-}
-
-
 gboolean gnome_cmd_data_get_bool (const gchar *path, gboolean def)
 {
     gchar *s = g_build_path (G_DIR_SEPARATOR_S, PACKAGE, path, NULL);
diff --git a/libgcmd/libgcmd-data.h b/libgcmd/libgcmd-data.h
index bb5239c..fb3c695 100644
--- a/libgcmd/libgcmd-data.h
+++ b/libgcmd/libgcmd-data.h
@@ -28,8 +28,6 @@ void gnome_cmd_data_set_bool (const gchar *path, gboolean value);
 
 void gnome_cmd_data_set_color (const gchar *path, GdkColor *color);
 
-gchar *gnome_cmd_data_get_string (const gchar *path, const gchar *def);
-
 gboolean gnome_cmd_data_get_bool (const gchar *path, gboolean def);
 
 void gnome_cmd_data_get_color (const gchar *path, GdkColor *color);
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 3411e1f..bd427a4 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -371,6 +371,16 @@ inline void GnomeCmdData::set_int (const gchar *path, int value)
 }
 
 
+inline gchar* GnomeCmdData::get_string (const gchar *path, const gchar *def)
+{
+    gboolean b = FALSE;
+    gchar *value = gnome_config_get_string_with_default (path, &b);
+    if (b)
+        return g_strdup (def);
+    return value;
+}
+
+
 inline XML::xstream &operator << (XML::xstream &xml, GnomeCmdBookmark &bookmark)
 {
     xml << XML::tag("Bookmark") << XML::attr("name") << XML::escape(bookmark.name);
@@ -1271,7 +1281,7 @@ inline void GnomeCmdData::save_auto_load_plugins()
 }
 
 
-inline GList *load_string_history (const gchar *format, gint size)
+inline GList* GnomeCmdData::load_string_history (const gchar *format, gint size)
 {
     GList *list = NULL;
 
@@ -2369,6 +2379,17 @@ void GnomeCmdData::gnome_cmd_data_set_int (const gchar *path, int value)
     g_free (s);
 }
 
+gchar* GnomeCmdData::gnome_cmd_data_get_string (const gchar *path, const gchar *def)
+{
+    gchar *s = g_build_path (G_DIR_SEPARATOR_S, PACKAGE, path, NULL);
+
+    gchar *v = get_string (s, def);
+
+    g_free (s);
+
+    return v;
+}
+
 
 /**
  * As GSettings enum-type is of GVARIANT_CLASS String, we need a seperate function for
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 261de22..a796bdb 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -455,6 +455,7 @@ struct GnomeCmdData
     void save_intviewer_defaults();
     inline gint get_int (const gchar *path, int def);
     inline void set_int (const gchar *path, int value);
+    inline gchar* get_string (const gchar *path, const gchar *def);
 
   public:
 
@@ -506,9 +507,11 @@ struct GnomeCmdData
     gint migrate_data_int_value_into_gsettings(gint user_value, GSettings *settings, const char *key);
     gboolean migrate_data_string_value_into_gsettings(const char* user_value, GSettings *settings, const 
char *key);
     void load_more();
+    inline GList* load_string_history (const gchar *format, gint size);
     void save();
     gint gnome_cmd_data_get_int (const gchar *path, int def);
     void gnome_cmd_data_set_int (const gchar *path, int value);
+    gchar* gnome_cmd_data_get_string (const gchar *path, const gchar *def);
     gboolean set_gsettings_when_changed (GSettings *settings, const char *key, gpointer value);
     gboolean set_gsettings_enum_when_changed (GSettings *settings, const char *key, gint value);
 


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