[gnome-commander] GnomeCmdData: more C++ rework



commit 088bc9fe85c2c9ba7b4b4bdfdb09040aea4949e9
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Mon Nov 7 23:49:45 2011 +0100

    GnomeCmdData: more C++ rework

 src/gnome-cmd-data.cc           |   14 --------------
 src/gnome-cmd-data.h            |    9 ++++++---
 src/gnome-cmd-file.cc           |    2 +-
 src/gnome-cmd-options-dialog.cc |    4 ++--
 src/gnome-cmd-xfer.cc           |    2 +-
 5 files changed, 10 insertions(+), 21 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 7bbaa41..55f8616 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1737,20 +1737,6 @@ void gnome_cmd_data_set_fav_apps (GList *apps)
 }
 
 
-GnomeCmdDateFormat gnome_cmd_data_get_date_format ()
-{
-    return gnome_cmd_data.options.date_format;
-}
-
-
-void gnome_cmd_data_set_date_format (GnomeCmdDateFormat format)
-{
-    g_free (gnome_cmd_data.options.date_format);
-
-    gnome_cmd_data.options.date_format = g_strdup (format);
-}
-
-
 GnomeCmdColorTheme *gnome_cmd_data_get_current_color_theme ()
 {
     return &gnome_cmd_data.priv->color_themes[gnome_cmd_data.color_mode];
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index b810855..d8511dd 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -107,6 +107,12 @@ struct GnomeCmdData
         {
             g_free (date_format);
         }
+
+        void set_date_format (const GnomeCmdDateFormat format)
+        {
+            g_free (date_format);
+            date_format = g_strdup (format);
+        }
     };
 
     struct Selection
@@ -334,9 +340,6 @@ void gnome_cmd_data_set_fav_apps (GList *apps);
 const gchar *gnome_cmd_data_get_ftp_anonymous_password ();
 void gnome_cmd_data_set_ftp_anonymous_password (const gchar *pw);
 
-GnomeCmdDateFormat gnome_cmd_data_get_date_format ();
-void gnome_cmd_data_set_date_format (GnomeCmdDateFormat format);
-
 GnomeCmdColorTheme *gnome_cmd_data_get_custom_color_theme ();
 GnomeCmdColorTheme *gnome_cmd_data_get_current_color_theme ();
 
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index c2c7a68..ff78ae3 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -488,7 +488,7 @@ const gchar *GnomeCmdFile::get_group()
 
 inline const gchar *date2string (time_t date, gboolean overide_disp_setting)
 {
-    return time2string (date, overide_disp_setting?"%c":gnome_cmd_data_get_date_format ());
+    return time2string (date, overide_disp_setting?"%c":gnome_cmd_data.options.date_format);
 }
 
 
diff --git a/src/gnome-cmd-options-dialog.cc b/src/gnome-cmd-options-dialog.cc
index 25cd79b..9c1d193 100644
--- a/src/gnome-cmd-options-dialog.cc
+++ b/src/gnome-cmd-options-dialog.cc
@@ -304,7 +304,7 @@ inline GtkWidget *create_format_tab (GtkWidget *parent, GnomeCmdData &cfg)
     label = create_label (parent, _("Format:"));
     table_add (table, label, 0, 0, GTK_FILL);
 
-    gchar *utf8_date_format = g_locale_to_utf8 (gnome_cmd_data_get_date_format (), -1, NULL, NULL, NULL);
+    gchar *utf8_date_format = g_locale_to_utf8 (gnome_cmd_data.options.date_format, -1, NULL, NULL, NULL);
     entry = create_entry (parent, "date_format_entry", utf8_date_format);
     g_free (utf8_date_format);
     gtk_widget_grab_focus (entry);
@@ -350,7 +350,7 @@ inline void store_format_options (GtkWidget *dialog, GnomeCmdData &cfg)
     else
         cfg.options.perm_disp_mode = GNOME_CMD_PERM_DISP_MODE_NUMBER;
 
-    gnome_cmd_data_set_date_format (g_locale_from_utf8 (format, -1, NULL, NULL, NULL));
+    gnome_cmd_data.options.set_date_format(g_locale_from_utf8 (format, -1, NULL, NULL, NULL));
 }
 
 
diff --git a/src/gnome-cmd-xfer.cc b/src/gnome-cmd-xfer.cc
index 2bee0fb..05934ad 100644
--- a/src/gnome-cmd-xfer.cc
+++ b/src/gnome-cmd-xfer.cc
@@ -132,7 +132,7 @@ inline gchar *file_details(const gchar *text_uri)
     GnomeVFSFileInfo *info = gnome_vfs_file_info_new ();
     GnomeVFSResult result = gnome_vfs_get_file_info (text_uri, info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
     gchar *size = create_nice_size_str (info->size);
-    gchar *details = result==GNOME_VFS_OK ? g_strdup_printf ("%s, %s", size, time2string (info->mtime, gnome_cmd_data_get_date_format ())) : g_strdup ("");
+    gchar *details = result==GNOME_VFS_OK ? g_strdup_printf ("%s, %s", size, time2string (info->mtime, gnome_cmd_data.options.date_format)) : g_strdup ("");
     gnome_vfs_file_info_unref (info);
     g_free (size);
 



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