[gnome-commander] tabs: execute view.close_tab on clicked fs (previously: on active fs)



commit 67aafbc3fc55f519c9c04c525fed26070a595137
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Tue Jan 4 23:54:09 2011 +0100

    tabs: execute view.close_tab on clicked fs (previously: on active fs)

 src/gnome-cmd-file-selector.cc |    2 +-
 src/gnome-cmd-user-actions.cc  |   11 ++++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index 0f1c701..1eb443e 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -636,7 +636,7 @@ static gboolean on_notebook_button_pressed (GtkWidget *widget, GdkEventButton *e
                         gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_separator_menu_item_new ());
 
                         menuitem = gtk_menu_item_new_with_mnemonic (_("_Close Tab"));
-                        g_signal_connect (menuitem, "activate", G_CALLBACK (view_close_tab), GINT_TO_POINTER (tab_clicked));
+                        g_signal_connect (menuitem, "activate", G_CALLBACK (view_close_tab), fl);
                         gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
 
                         menuitem = gtk_menu_item_new_with_mnemonic (_("Close _All Tabs"));
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index f726d2d..25d2cb1 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1506,10 +1506,15 @@ void view_new_tab (GtkMenuItem *menuitem, gpointer file_list)
 }
 
 
-void view_close_tab (GtkMenuItem *menuitem, gpointer page)
+void view_close_tab (GtkMenuItem *menuitem, gpointer file_list)
 {
-    if (page)
-        get_fs (ACTIVE)->close_tab(GPOINTER_TO_INT(page));
+    if (file_list)
+    {
+        GnomeCmdFileList *fl = GNOME_CMD_FILE_LIST (file_list);
+        GnomeCmdFileSelector *fs = GNOME_CMD_FILE_SELECTOR (gtk_widget_get_ancestor (*fl, GNOME_CMD_TYPE_FILE_SELECTOR));
+
+        fs->close_tab(gtk_notebook_page_num (*fs->notebook, gtk_widget_get_parent (*fl)));
+    }
     else
         get_fs (ACTIVE)->close_tab();
 }



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