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



commit 74064cefb75e2ee5c81c0e86f5a10d4bca760e9b
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Mon Sep 5 22:20:20 2011 +0200

    GnomeCmdConList: more C++ rework

 src/gnome-cmd-con-list.cc   |   26 +++++++++++---------------
 src/gnome-cmd-con-list.h    |   10 +++++-----
 src/gnome-cmd-data.cc       |    8 ++++----
 src/gnome-cmd-xml-config.cc |    4 ++--
 4 files changed, 22 insertions(+), 26 deletions(-)
---
diff --git a/src/gnome-cmd-con-list.cc b/src/gnome-cmd-con-list.cc
index 7ee3e83..dabd64c 100755
--- a/src/gnome-cmd-con-list.cc
+++ b/src/gnome-cmd-con-list.cc
@@ -67,12 +67,12 @@ static void on_con_updated (GnomeCmdCon *con, GnomeCmdConList *con_list)
     g_return_if_fail (GNOME_CMD_IS_CON_LIST (con_list));
 
     if (GNOME_CMD_IS_CON_FTP (con))
-        gtk_signal_emit (GTK_OBJECT (con_list), signals[FTP_LIST_CHANGED]);
+        gtk_signal_emit (*con_list, signals[FTP_LIST_CHANGED]);
     else
         if (GNOME_CMD_IS_CON_DEVICE (con))
-            gtk_signal_emit (GTK_OBJECT (con_list), signals[DEVICE_LIST_CHANGED]);
+            gtk_signal_emit (*con_list, signals[DEVICE_LIST_CHANGED]);
 
-    gtk_signal_emit (GTK_OBJECT (con_list), signals[LIST_CHANGED]);
+    gtk_signal_emit (*con_list, signals[LIST_CHANGED]);
 }
 
 
@@ -270,8 +270,8 @@ void gnome_cmd_con_list_add_quick_ftp (GnomeCmdConList *con_list, GnomeCmdConFtp
     }
     else
     {
-        gtk_signal_emit (GTK_OBJECT (con_list), signals[LIST_CHANGED]);
-        gtk_signal_emit (GTK_OBJECT (con_list), signals[QUICK_FTP_LIST_CHANGED]);
+        gtk_signal_emit (*con_list, signals[LIST_CHANGED]);
+        gtk_signal_emit (*con_list, signals[QUICK_FTP_LIST_CHANGED]);
     }
 }
 
@@ -294,8 +294,8 @@ void gnome_cmd_con_list_remove_quick_ftp (GnomeCmdConList *con_list, GnomeCmdCon
     }
     else
     {
-        gtk_signal_emit (GTK_OBJECT (con_list), signals[LIST_CHANGED]);
-        gtk_signal_emit (GTK_OBJECT (con_list), signals[QUICK_FTP_LIST_CHANGED]);
+        gtk_signal_emit (*con_list, signals[LIST_CHANGED]);
+        gtk_signal_emit (*con_list, signals[QUICK_FTP_LIST_CHANGED]);
     }
 }
 
@@ -389,17 +389,13 @@ GnomeCmdCon *GnomeCmdConList::find_alias(const gchar *alias) const
 }
 
 
-GnomeCmdCon *gnome_cmd_con_list_get_home (GnomeCmdConList *list)
+GnomeCmdCon *GnomeCmdConList::get_home()
 {
-    g_return_val_if_fail (GNOME_CMD_IS_CON_LIST (list), NULL);
-
-    return list->priv->home_con;
+    return priv->home_con;
 }
 
 
-GnomeCmdCon *gnome_cmd_con_list_get_smb (GnomeCmdConList *list)
+GnomeCmdCon *GnomeCmdConList::get_smb()
 {
-    g_return_val_if_fail (GNOME_CMD_IS_CON_LIST (list), NULL);
-
-    return list->priv->smb_con;
+    return priv->smb_con;
 }
diff --git a/src/gnome-cmd-con-list.h b/src/gnome-cmd-con-list.h
index 714c0fa..bcefc5e 100755
--- a/src/gnome-cmd-con-list.h
+++ b/src/gnome-cmd-con-list.h
@@ -59,6 +59,9 @@ struct GnomeCmdConList
 
     GnomeCmdCon *find_alias(const gchar *alias) const;
     gboolean has_alias(const gchar *alias) const            {  return find_alias(alias)!=NULL;  }
+
+    GnomeCmdCon *get_home();
+    GnomeCmdCon *get_smb();
 };
 
 struct GnomeCmdConListClass
@@ -93,17 +96,14 @@ GList *gnome_cmd_con_list_get_all_quick_ftp (GnomeCmdConList *list);
 GList *gnome_cmd_con_list_get_all_dev (GnomeCmdConList *list);
 void gnome_cmd_con_list_set_all_dev (GnomeCmdConList *list, GList *dev_cons);
 
-GnomeCmdCon *gnome_cmd_con_list_get_home (GnomeCmdConList *list);
-GnomeCmdCon *gnome_cmd_con_list_get_smb (GnomeCmdConList *list);
-
 inline GnomeCmdCon *get_home_con ()
 {
-    return gnome_cmd_con_list_get_home (gnome_cmd_con_list_get ());
+    return gnome_cmd_con_list_get()->get_home();
 }
 
 inline GnomeCmdCon *get_smb_con ()
 {
-    return gnome_cmd_con_list_get_smb (gnome_cmd_con_list_get ());
+    return gnome_cmd_con_list_get()->get_smb();
 }
 
 inline GList *get_ftp_cons ()
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 05f2190..6b884db 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -837,7 +837,7 @@ inline void GnomeCmdData::load_local_bookmarks()
     GList *names = load_string_history ("/local_bookmarks/name%d", size);
     GList *paths = load_string_history ("/local_bookmarks/path%d", size);
 
-    GnomeCmdCon *con = gnome_cmd_con_list_get_home (priv->con_list);
+    GnomeCmdCon *con = priv->con_list->get_home();
 
     for (gint i=0; i<size; i++)
         gnome_cmd_con_add_bookmark (con, (gchar *) g_list_nth_data (names, i), (gchar *) g_list_nth_data (paths, i));
@@ -850,7 +850,7 @@ inline void GnomeCmdData::load_smb_bookmarks()
     GList *names = load_string_history ("/smb_bookmarks/name%d", size);
     GList *paths = load_string_history ("/smb_bookmarks/path%d", size);
 
-    GnomeCmdCon *con = gnome_cmd_con_list_get_smb (priv->con_list);
+    GnomeCmdCon *con = priv->con_list->get_smb();
 
     for (gint i=0; i<size; i++)
         gnome_cmd_con_add_bookmark (con, (gchar *) g_list_nth_data (names, i), (gchar *) g_list_nth_data (paths, i));
@@ -1688,8 +1688,8 @@ void GnomeCmdData::save()
 
         xml << XML::tag("Bookmarks");
 
-        write (xml, gnome_cmd_con_list_get_home (priv->con_list), "Home");
-        write (xml, gnome_cmd_con_list_get_smb (priv->con_list), "SMB");
+        write (xml, priv->con_list->get_home(), "Home");
+        write (xml, priv->con_list->get_smb(), "SMB");
 
         for (GList *i=gnome_cmd_con_list_get_all_ftp (gnome_cmd_data.priv->con_list); i; i=i->next)
         {
diff --git a/src/gnome-cmd-xml-config.cc b/src/gnome-cmd-xml-config.cc
index b976ca1..05a1844 100644
--- a/src/gnome-cmd-xml-config.cc
+++ b/src/gnome-cmd-xml-config.cc
@@ -535,10 +535,10 @@ static void xml_start(GMarkupParseContext *context,
                     xml_con = gnome_cmd_con_list_get()->find_alias(param1);
                 else
                     if (strcmp(param1,"Home")==0)
-                        xml_con = gnome_cmd_con_list_get_home (gnome_cmd_con_list_get ());
+                        xml_con = gnome_cmd_con_list_get()->get_home();
                     else
                         if (strcmp(param1,"SMB")==0)
-                            xml_con = gnome_cmd_con_list_get_smb (gnome_cmd_con_list_get ());
+                            xml_con = gnome_cmd_con_list_get()->get_smb();
                         else
                             xml_con = NULL;
 



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