[gnome-commander] GnomeCmdConList: more C++ rework
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] GnomeCmdConList: more C++ rework
- Date: Mon, 5 Sep 2011 20:05:18 +0000 (UTC)
commit 6e67b9b7dc08e5db36a1feb40d189a25cee0acac
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Mon Sep 5 22:02:49 2011 +0200
GnomeCmdConList: more C++ rework
src/gnome-cmd-con-list.cc | 46 ++++++++++++++++++--------------------
src/gnome-cmd-con-list.h | 5 +--
src/gnome-cmd-data.cc | 10 +++-----
src/gnome-cmd-options-dialog.cc | 6 ++--
4 files changed, 31 insertions(+), 36 deletions(-)
---
diff --git a/src/gnome-cmd-con-list.cc b/src/gnome-cmd-con-list.cc
index ff0f080..7ee3e83 100755
--- a/src/gnome-cmd-con-list.cc
+++ b/src/gnome-cmd-con-list.cc
@@ -300,48 +300,46 @@ void gnome_cmd_con_list_remove_quick_ftp (GnomeCmdConList *con_list, GnomeCmdCon
}
-void gnome_cmd_con_list_add_device (GnomeCmdConList *con_list, GnomeCmdConDevice *device_con)
+void GnomeCmdConList::add(GnomeCmdConDevice *con)
{
- g_return_if_fail (GNOME_CMD_IS_CON_LIST (con_list));
- g_return_if_fail (g_list_index (con_list->priv->all_cons, device_con) == -1);
- g_return_if_fail (g_list_index (con_list->priv->device_cons, device_con) == -1);
+ g_return_if_fail (g_list_index (priv->all_cons, con) == -1);
+ g_return_if_fail (g_list_index (priv->device_cons, con) == -1);
- con_list->priv->all_cons = g_list_append (con_list->priv->all_cons, device_con);
- con_list->priv->device_cons = g_list_append (con_list->priv->device_cons, device_con);
- g_signal_connect (device_con, "updated", G_CALLBACK (on_con_updated), con_list);
+ priv->all_cons = g_list_append (priv->all_cons, con);
+ priv->device_cons = g_list_append (priv->device_cons, con);
+ g_signal_connect (con, "updated", G_CALLBACK (on_con_updated), this);
- if (con_list->priv->update_lock)
+ if (priv->update_lock)
{
- con_list->priv->changed = TRUE;
- con_list->priv->device_cons_changed = TRUE;
+ priv->changed = TRUE;
+ priv->device_cons_changed = TRUE;
}
else
{
- gtk_signal_emit (GTK_OBJECT (con_list), signals[LIST_CHANGED]);
- gtk_signal_emit (GTK_OBJECT (con_list), signals[DEVICE_LIST_CHANGED]);
+ gtk_signal_emit (*this, signals[LIST_CHANGED]);
+ gtk_signal_emit (*this, signals[DEVICE_LIST_CHANGED]);
}
}
-void gnome_cmd_con_list_remove_device (GnomeCmdConList *con_list, GnomeCmdConDevice *device_con)
+void GnomeCmdConList::remove(GnomeCmdConDevice *con)
{
- g_return_if_fail (GNOME_CMD_IS_CON_LIST (con_list));
- g_return_if_fail (g_list_index (con_list->priv->all_cons, device_con) != -1);
- g_return_if_fail (g_list_index (con_list->priv->device_cons, device_con) != -1);
+ g_return_if_fail (g_list_index (priv->all_cons, con) != -1);
+ g_return_if_fail (g_list_index (priv->device_cons, con) != -1);
- con_list->priv->all_cons = g_list_remove (con_list->priv->all_cons, device_con);
- con_list->priv->device_cons = g_list_remove (con_list->priv->device_cons, device_con);
- g_signal_handlers_disconnect_by_func (device_con, (gpointer) on_con_updated, con_list);
+ priv->all_cons = g_list_remove (priv->all_cons, con);
+ priv->device_cons = g_list_remove (priv->device_cons, con);
+ g_signal_handlers_disconnect_by_func (con, (gpointer) on_con_updated, this);
- if (con_list->priv->update_lock)
+ if (priv->update_lock)
{
- con_list->priv->changed = TRUE;
- con_list->priv->device_cons_changed = TRUE;
+ priv->changed = TRUE;
+ priv->device_cons_changed = TRUE;
}
else
{
- gtk_signal_emit (GTK_OBJECT (con_list), signals[LIST_CHANGED]);
- gtk_signal_emit (GTK_OBJECT (con_list), signals[DEVICE_LIST_CHANGED]);
+ gtk_signal_emit (*this, signals[LIST_CHANGED]);
+ gtk_signal_emit (*this, signals[DEVICE_LIST_CHANGED]);
}
}
diff --git a/src/gnome-cmd-con-list.h b/src/gnome-cmd-con-list.h
index 27a7e9b..714c0fa 100755
--- a/src/gnome-cmd-con-list.h
+++ b/src/gnome-cmd-con-list.h
@@ -52,8 +52,10 @@ struct GnomeCmdConList
void unlock();
void add(GnomeCmdConFtp *con);
+ void add(GnomeCmdConDevice *con);
void remove(GnomeCmdConFtp *con);
+ void remove(GnomeCmdConDevice *con);
GnomeCmdCon *find_alias(const gchar *alias) const;
gboolean has_alias(const gchar *alias) const { return find_alias(alias)!=NULL; }
@@ -84,9 +86,6 @@ inline GnomeCmdConList *gnome_cmd_con_list_get ()
void gnome_cmd_con_list_add_quick_ftp (GnomeCmdConList *list, GnomeCmdConFtp *ftp_con);
void gnome_cmd_con_list_remove_quick_ftp (GnomeCmdConList *list, GnomeCmdConFtp *ftp_con);
-void gnome_cmd_con_list_add_device (GnomeCmdConList *list, GnomeCmdConDevice *device_con);
-void gnome_cmd_con_list_remove_device (GnomeCmdConList *list, GnomeCmdConDevice *device_con);
-
GList *gnome_cmd_con_list_get_all (GnomeCmdConList *list);
GList *gnome_cmd_con_list_get_all_ftp (GnomeCmdConList *list);
GList *gnome_cmd_con_list_get_all_quick_ftp (GnomeCmdConList *list);
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index b490903..05f2190 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -403,7 +403,7 @@ inline void remove_vfs_volume (GnomeVFSVolume *volume)
{
DEBUG('m',"Remove Volume:\ndevice_fn = %s\tmountp = %s\n",
device_fn,mountp);
- gnome_cmd_con_list_remove_device (gnome_cmd_data.priv->con_list, device);
+ gnome_cmd_data.priv->con_list->remove(device);
break;
}
}
@@ -484,7 +484,7 @@ inline void add_vfs_volume (GnomeVFSVolume *volume)
GnomeCmdConDevice *ConDev = gnome_cmd_con_device_new (name, path?path:NULL, localpath, iconpath);
gnome_cmd_con_device_set_autovol (ConDev, TRUE);
gnome_cmd_con_device_set_vfs_volume (ConDev, volume);
- gnome_cmd_con_list_add_device (gnome_cmd_data.priv->con_list, ConDev);
+ gnome_cmd_data.priv->con_list->add(ConDev);
}
else
DEBUG('m', "Device for mountpoint(%s) already exists. AutoVolume not added\n", localpath);
@@ -525,7 +525,7 @@ inline void add_vfs_drive (GnomeVFSDrive *drive)
gnome_cmd_con_device_set_autovol (ConDev, TRUE);
- gnome_cmd_con_list_add_device (gnome_cmd_data.priv->con_list, ConDev);
+ gnome_cmd_data.priv->con_list->add(ConDev);
g_free (path);
g_free (uri);
@@ -623,9 +623,7 @@ inline void load_devices (const gchar *fname)
if (strcmp (icon_path, "x") != 0)
icon_path2 = gnome_vfs_unescape_string (icon_path, NULL);
- gnome_cmd_con_list_add_device (
- gnome_cmd_data.priv->con_list,
- gnome_cmd_con_device_new (alias2, device_fn2, mountp2, icon_path2));
+ gnome_cmd_data.priv->con_list->add (gnome_cmd_con_device_new (alias2, device_fn2, mountp2, icon_path2));
g_free (alias2);
g_free (device_fn2);
diff --git a/src/gnome-cmd-options-dialog.cc b/src/gnome-cmd-options-dialog.cc
index 0990169..ad4cbbf 100644
--- a/src/gnome-cmd-options-dialog.cc
+++ b/src/gnome-cmd-options-dialog.cc
@@ -1740,7 +1740,7 @@ static void on_add_device_dialog_ok (GtkButton *button, GtkWidget *dialog)
add_device_to_list (GTK_CLIST (clist), GNOME_CMD_CON_DEVICE (dev));
gtk_widget_destroy (dialog);
- gnome_cmd_con_list_add_device (gnome_cmd_con_list_get (), dev);
+ gnome_cmd_con_list_get()->add(dev);
g_free (icon_path);
}
@@ -1856,9 +1856,9 @@ static void on_device_remove (GtkWidget *button, GtkWidget *frame)
if (clist->focus_row >= 0)
{
GnomeCmdConDevice *dev = GNOME_CMD_CON_DEVICE (gtk_clist_get_row_data (clist, clist->focus_row));
- gnome_cmd_con_list_remove_device (gnome_cmd_con_list_get (), dev);
+ gnome_cmd_con_list_get()->remove(dev);
gtk_clist_remove (clist, clist->focus_row);
- gnome_cmd_con_list_remove_device (gnome_cmd_con_list_get (), dev);
+ gnome_cmd_con_list_get()->remove(dev);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]