[gnome-commander] tabs: migration of con_open_... signals



commit 6fd760984e51947c5473d50691727ea7cd7fbbe0
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Sat Jun 5 12:46:10 2010 +0200

    tabs: migration of con_open_... signals

 src/gnome-cmd-file-list.cc     |  112 +++++++++++++++++++++++++++++++++++++++
 src/gnome-cmd-file-selector.cc |  113 ----------------------------------------
 2 files changed, 112 insertions(+), 113 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 93488c5..cd13782 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -55,6 +55,9 @@ using namespace std;
 #define POPUP_TIMEOUT 750
 
 
+#define FL_PBAR_MAX 50
+
+
 enum
 {
     FILE_CLICKED,        // A file in the list was clicked
@@ -149,6 +152,11 @@ class GnomeCmdFileList::Private
     GtkWidget *quicksearch_popup;
     gchar *focus_later;
 
+    GnomeCmdCon *con_opening;
+    GtkWidget *con_open_dialog;
+    GtkWidget *con_open_dialog_label;
+    GtkWidget *con_open_dialog_pbar;
+
     Private(GnomeCmdFileList *fl);
     ~Private();
 };
@@ -172,6 +180,11 @@ GnomeCmdFileList::Private::Private(GnomeCmdFileList *fl)
     right_mb_down_file = NULL;
     right_mb_timeout_id = 0;
 
+    con_opening = NULL;
+    con_open_dialog = NULL;
+    con_open_dialog_label = NULL;
+    con_open_dialog_pbar = NULL;
+
     memset(sort_raising, FALSE, sizeof(sort_raising));
 
     gint col = COLUMN_NAME;             // defaults,
@@ -1415,6 +1428,105 @@ static void on_dir_list_failed (GnomeCmdDir *dir, GnomeVFSResult result, GnomeCm
 }
 
 
+static void on_con_open_done (GnomeCmdCon *con, GnomeCmdFileList *fl)
+{
+    DEBUG('m', "on_con_open_done\n");
+
+    g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
+    g_return_if_fail (fl->priv->con_opening != NULL);
+    g_return_if_fail (fl->priv->con_opening == con);
+    g_return_if_fail (fl->priv->con_open_dialog != NULL);
+
+    g_signal_handlers_disconnect_matched (con, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, fl);
+
+    fl->set_connection (con);
+
+    gtk_widget_destroy (fl->priv->con_open_dialog);
+    fl->priv->con_open_dialog = NULL;
+    fl->priv->con_opening = NULL;
+}
+
+
+static void on_con_open_failed (GnomeCmdCon *con, const gchar *msg, GnomeVFSResult result, GnomeCmdFileList *fl)
+{
+    DEBUG('m', "on_con_open_failed\n");
+
+    g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
+    g_return_if_fail (fl->priv->con_opening != NULL);
+    g_return_if_fail (fl->priv->con_opening == con);
+    g_return_if_fail (fl->priv->con_open_dialog != NULL);
+
+    g_signal_handlers_disconnect_matched (con, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, fl);
+
+    if (msg)
+        gnome_cmd_show_message (NULL, msg);
+    else
+        gnome_cmd_show_message (NULL, _("Failed to open connection."), gnome_vfs_result_to_string (result));
+
+    fl->priv->con_open_dialog = NULL;
+    fl->priv->con_opening = NULL;
+}
+
+
+static void on_con_open_cancel (GtkButton *button, GnomeCmdFileList *fl)
+{
+    DEBUG('m', "on_con_open_cancel\n");
+
+    g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
+    g_return_if_fail (fl->priv->con_opening != NULL);
+    g_return_if_fail (fl->priv->con_opening->state == CON_STATE_OPENING);
+
+    gnome_cmd_con_cancel_open (fl->priv->con_opening);
+
+    gtk_widget_destroy (fl->priv->con_open_dialog);
+    fl->priv->con_open_dialog = NULL;
+    fl->priv->con_opening = NULL;
+}
+
+
+static gboolean update_con_open_progress (GnomeCmdFileList *fl)
+{
+    if (!fl->priv->con_open_dialog)
+        return FALSE;
+
+    const gchar *msg = gnome_cmd_con_get_open_msg (fl->priv->con_opening);
+    gtk_label_set_text (GTK_LABEL (fl->priv->con_open_dialog_label), msg);
+    progress_bar_update (fl->priv->con_open_dialog_pbar, FL_PBAR_MAX);
+
+    return TRUE;
+}
+
+
+static void create_con_open_progress_dialog (GnomeCmdFileList *fl)
+{
+    g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
+
+    fl->priv->con_open_dialog = gnome_cmd_dialog_new (NULL);
+    gtk_widget_ref (fl->priv->con_open_dialog);
+
+    gnome_cmd_dialog_add_button (GNOME_CMD_DIALOG (fl->priv->con_open_dialog),
+                                 GTK_STOCK_CANCEL,
+                                 GTK_SIGNAL_FUNC (on_con_open_cancel), fl);
+
+    GtkWidget *vbox = create_vbox (fl->priv->con_open_dialog, FALSE, 0);
+
+    fl->priv->con_open_dialog_label = create_label (fl->priv->con_open_dialog, "");
+
+    fl->priv->con_open_dialog_pbar = create_progress_bar (fl->priv->con_open_dialog);
+    gtk_progress_set_show_text (GTK_PROGRESS (fl->priv->con_open_dialog_pbar), FALSE);
+    gtk_progress_set_activity_mode (GTK_PROGRESS (fl->priv->con_open_dialog_pbar), TRUE);
+    gtk_progress_configure (GTK_PROGRESS (fl->priv->con_open_dialog_pbar), 0, 0, FL_PBAR_MAX);
+
+    gtk_box_pack_start (GTK_BOX (vbox), fl->priv->con_open_dialog_label, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), fl->priv->con_open_dialog_pbar, FALSE, TRUE, 0);
+
+    gnome_cmd_dialog_add_category (GNOME_CMD_DIALOG (fl->priv->con_open_dialog), vbox);
+
+    gnome_cmd_dialog_set_transient_for (GNOME_CMD_DIALOG (fl->priv->con_open_dialog), GTK_WINDOW (fl));
+    gtk_widget_show_all (fl->priv->con_open_dialog);
+}
+
+
 /*******************************
  * Gtk class implementation
  *******************************/
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index 1ad1429..28dbb8c 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -51,9 +51,6 @@ struct GnomeCmdFileSelectorClass
 };
 
 
-#define FS_PBAR_MAX 50
-
-
 GtkTargetEntry drop_types [] = {
     { TARGET_URI_LIST_TYPE, 0, TARGET_URI_LIST },
     { TARGET_URL_TYPE, 0, TARGET_URL }
@@ -81,11 +78,6 @@ class GnomeCmdFileSelector::Private
 
     gboolean sel_first_file;
 
-    GtkWidget *con_open_dialog;
-    GtkWidget *con_open_dialog_label;
-    GtkWidget *con_open_dialog_pbar;
-    GnomeCmdCon *con_opening;
-
     gboolean autoscroll_dir;
     guint autoscroll_timeout;
     gint autoscroll_y;
@@ -102,11 +94,6 @@ inline GnomeCmdFileSelector::Private::Private()
     dir_history = NULL;
     sym_file = NULL;
 
-    con_open_dialog = NULL;
-    con_open_dialog_label = NULL;
-    con_open_dialog_pbar = NULL;
-    con_opening = NULL;
-
     autoscroll_dir = FALSE;
     autoscroll_timeout = 0;
     autoscroll_y = 0;
@@ -1131,106 +1118,6 @@ void GnomeCmdFileSelector::set_active(gboolean value)
 }
 
 
-static void on_con_open_cancel (GtkButton *button, GnomeCmdFileSelector *fs)
-{
-    DEBUG('m', "on_con_open_cancel\n");
-
-    g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-    g_return_if_fail (fs->priv->con_opening != NULL);
-    g_return_if_fail (fs->priv->con_opening->state == CON_STATE_OPENING);
-
-    gnome_cmd_con_cancel_open (fs->priv->con_opening);
-
-    gtk_widget_destroy (fs->priv->con_open_dialog);
-    fs->priv->con_open_dialog = NULL;
-    fs->priv->con_opening = NULL;
-}
-
-
-static gboolean update_con_open_progress (GnomeCmdFileSelector *fs)
-{
-    if (!fs->priv->con_open_dialog)
-        return FALSE;
-
-    const gchar *msg = gnome_cmd_con_get_open_msg (fs->priv->con_opening);
-    gtk_label_set_text (GTK_LABEL (fs->priv->con_open_dialog_label), msg);
-    progress_bar_update (fs->priv->con_open_dialog_pbar, FS_PBAR_MAX);
-
-    return TRUE;
-}
-
-
-static void on_con_open_done (GnomeCmdCon *con, GnomeCmdFileSelector *fs)
-{
-    DEBUG('m', "on_con_open_done\n");
-
-    g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-    g_return_if_fail (fs->priv->con_opening != NULL);
-    g_return_if_fail (fs->priv->con_opening == con);
-    g_return_if_fail (fs->priv->con_open_dialog != NULL);
-
-    gtk_signal_disconnect_by_data (GTK_OBJECT (con), fs);
-
-    set_connection (fs, con);
-
-    gtk_widget_destroy (fs->priv->con_open_dialog);
-    fs->priv->con_open_dialog = NULL;
-    fs->priv->con_opening = NULL;
-}
-
-
-static void on_con_open_failed (GnomeCmdCon *con, const gchar *msg, GnomeVFSResult result, GnomeCmdFileSelector *fs)
-{
-    DEBUG('m', "on_con_open_failed\n");
-
-    g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-    g_return_if_fail (fs->priv->con_opening != NULL);
-    g_return_if_fail (fs->priv->con_opening == con);
-    g_return_if_fail (fs->priv->con_open_dialog != NULL);
-
-    gtk_signal_disconnect_by_data (GTK_OBJECT (con), fs);
-
-    if (msg)
-        gnome_cmd_show_message (NULL, msg);
-    else
-        gnome_cmd_show_message (NULL, _("Failed to open connection."), gnome_vfs_result_to_string (result));
-
-    fs->priv->con_open_dialog = NULL;
-    fs->priv->con_opening = NULL;
-}
-
-
-static void create_con_open_progress_dialog (GnomeCmdFileSelector *fs)
-{
-    g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
-
-    fs->priv->con_open_dialog = gnome_cmd_dialog_new (NULL);
-    gtk_widget_ref (fs->priv->con_open_dialog);
-
-    gnome_cmd_dialog_add_button (GNOME_CMD_DIALOG (fs->priv->con_open_dialog),
-                                 GTK_STOCK_CANCEL,
-                                 GTK_SIGNAL_FUNC (on_con_open_cancel), fs);
-
-    GtkWidget *vbox = create_vbox (fs->priv->con_open_dialog, FALSE, 0);
-
-    fs->priv->con_open_dialog_label = create_label (fs->priv->con_open_dialog, "");
-
-    fs->priv->con_open_dialog_pbar = create_progress_bar (fs->priv->con_open_dialog);
-    gtk_progress_set_show_text (GTK_PROGRESS (fs->priv->con_open_dialog_pbar), FALSE);
-    gtk_progress_set_activity_mode (GTK_PROGRESS (fs->priv->con_open_dialog_pbar), TRUE);
-    gtk_progress_configure (GTK_PROGRESS (fs->priv->con_open_dialog_pbar), 0, 0, FS_PBAR_MAX);
-
-    gtk_box_pack_start (GTK_BOX (vbox), fs->priv->con_open_dialog_label, TRUE, TRUE, 0);
-    gtk_box_pack_start (GTK_BOX (vbox), fs->priv->con_open_dialog_pbar, FALSE, TRUE, 0);
-
-    gnome_cmd_dialog_add_category (GNOME_CMD_DIALOG (fs->priv->con_open_dialog), vbox);
-
-    gnome_cmd_dialog_set_transient_for (GNOME_CMD_DIALOG (fs->priv->con_open_dialog), GTK_WINDOW (main_win));
-
-    gtk_widget_show_all (fs->priv->con_open_dialog);
-}
-
-
 void gnome_cmd_file_selector_set_directory_to_opposite (GnomeCmdMainWin *mw, FileSelectorID fsID)
 {
     g_return_if_fail (mw!=NULL);



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