After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 106286 - [PATCH] Add "Move Tab Left", "Move Tab Right" menu and keybindings
[PATCH] Add "Move Tab Left", "Move Tab Right" menu and keybindings
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
unspecified
Other Linux
: High enhancement
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
: 113428 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-02-17 06:45 UTC by fafhrd
Modified: 2006-01-06 12:58 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
The patch in attachment form (7.33 KB, patch)
2004-04-30 21:25 UTC, Mariano Suárez-Alvarez
committed Details | Review

Description fafhrd 2003-02-17 06:45:16 UTC
add tab moving capcability "Move Tab Left" "Move Tab Right"

here path:

diff -urN gnome-terminal.orig/src/gnome-terminal.schemas
gnome-terminal/src/gnome-terminal.schemas
--- gnome-terminal.orig/src/gnome-terminal.schemas	2002-12-03
09:49:37.000000000 +0600
+++ gnome-terminal/src/gnome-terminal.schemas	2003-02-04 09:35:02.000000000
+0600
@@ -847,6 +847,40 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnome-terminal/keybindings/move_tab_left</key>
+      <applyto>/apps/gnome-terminal/keybindings/move_tab_left</applyto>
+      <owner>gnome-terminal</owner>
+      <type>string</type>
+      <default>&lt;Ctrl&gt;&lt;Shift&gt;Page_Up</default>
+      <locale name="C">
+         <short>Accelerator to move current tab left.</short>
+         <long>
+          Accelerator key to move current tab left. Expressed as a string
+          in the same format used for GTK+ resource files.
+          If you set the option to the special string "disabled", then there 
+          will be no keybinding for this action.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
+      <key>/schemas/apps/gnome-terminal/keybindings/move_tab_right</key>
+      <applyto>/apps/gnome-terminal/keybindings/move_tab_right</applyto>
+      <owner>gnome-terminal</owner>
+      <type>string</type>
+      <default>&lt;Ctrl&gt;&lt;Shift&gt;Page_Down</default>
+      <locale name="C">
+         <short>Accelerator to move current tab right.</short>
+         <long>
+          Accelerator key to move current tab right. Expressed as a string
+          in the same format used for GTK+ resource files.
+          If you set the option to the special string "disabled", then there 
+          will be no keybinding for this action.
+         </long>
+      </locale>
+    </schema>
+    
+    <schema>
       <key>/schemas/apps/gnome-terminal/keybindings/switch_to_tab_1</key>
       <applyto>/apps/gnome-terminal/keybindings/switch_to_tab_1</applyto>
       <owner>gnome-terminal</owner>
diff -urN gnome-terminal.orig/src/terminal-accels.c
gnome-terminal/src/terminal-accels.c
--- gnome-terminal.orig/src/terminal-accels.c	2003-01-05 14:31:50.000000000
+0600
+++ gnome-terminal/src/terminal-accels.c	2003-02-04 06:48:50.000000000 +0600
@@ -43,6 +43,8 @@
 #define KEY_RESET_AND_CLEAR CONF_KEYS_PREFIX"/reset_and_clear"
 #define KEY_PREV_TAB CONF_KEYS_PREFIX"/prev_tab"
 #define KEY_NEXT_TAB CONF_KEYS_PREFIX"/next_tab"
+#define KEY_MOVE_TAB_LEFT CONF_KEYS_PREFIX"/move_tab_left"
+#define KEY_MOVE_TAB_RIGHT CONF_KEYS_PREFIX"/move_tab_right"
 #define KEY_SET_TERMINAL_TITLE CONF_KEYS_PREFIX"/set_window_title"
 #define PREFIX_KEY_SWITCH_TO_TAB CONF_KEYS_PREFIX"/switch_to_tab_"
 #define KEY_HELP CONF_KEYS_PREFIX"/help"
@@ -122,6 +124,10 @@
     KEY_PREV_TAB, ACCEL_PATH_PREV_TAB, 0, 0, NULL, FALSE },
   { N_("Switch to Next Tab"),
     KEY_NEXT_TAB, ACCEL_PATH_NEXT_TAB, 0, 0, NULL, FALSE },
+  { N_("Move Tab Left"),
+    KEY_MOVE_TAB_LEFT, ACCEL_PATH_MOVE_TAB_LEFT, 0, 0, NULL, FALSE },
+  { N_("Move Tab Right"),
+    KEY_MOVE_TAB_RIGHT, ACCEL_PATH_MOVE_TAB_RIGHT, 0, 0, NULL, FALSE },
   { N_("Switch to Tab 1"),
     PREFIX_KEY_SWITCH_TO_TAB"1",
     PREFIX_ACCEL_PATH_SWITCH_TO_TAB"1", 0, 0, NULL, FALSE },
diff -urN gnome-terminal.orig/src/terminal-accels.h
gnome-terminal/src/terminal-accels.h
--- gnome-terminal.orig/src/terminal-accels.h	2002-10-05 05:55:41.000000000
+0700
+++ gnome-terminal/src/terminal-accels.h	2003-02-04 06:15:58.000000000 +0600
@@ -47,6 +47,8 @@
 #define ACCEL_PATH_ZOOM_IN ACCEL_PATH_ROOT"/zoom_in"
 #define ACCEL_PATH_ZOOM_OUT ACCEL_PATH_ROOT"/zoom_out"
 #define ACCEL_PATH_ZOOM_NORMAL ACCEL_PATH_ROOT"/zoom_normal"
+#define ACCEL_PATH_MOVE_TAB_LEFT ACCEL_PATH_ROOT"/move_tab_left"
+#define ACCEL_PATH_MOVE_TAB_RIGHT ACCEL_PATH_ROOT"/move_tab_right"
 
 #define FORMAT_ACCEL_PATH_SWITCH_TO_TAB ACCEL_PATH_ROOT"/switch_to_tab_%d"
 #define PREFIX_ACCEL_PATH_SWITCH_TO_TAB ACCEL_PATH_ROOT"/switch_to_tab_"
diff -urN gnome-terminal.orig/src/terminal-window.c
gnome-terminal/src/terminal-window.c
--- gnome-terminal.orig/src/terminal-window.c	2003-01-05 11:32:29.000000000
+0600
+++ gnome-terminal/src/terminal-window.c	2003-02-17 12:43:40.000000000 +0600
@@ -62,6 +62,8 @@
   GtkWidget *choose_config_menuitem;
   GtkWidget *next_tab_menuitem;
   GtkWidget *previous_tab_menuitem;
+  GtkWidget *moveleft_tab_menuitem;
+  GtkWidget *moveright_tab_menuitem;
   GtkWidget *go_menu;
   GtkWidget *encoding_menuitem;
   GList *tab_menuitems;
@@ -171,6 +173,10 @@
                                            TerminalWindow *window);
 static void previous_tab_callback         (GtkWidget      *menuitem,
                                            TerminalWindow *window);
+static void moveleft_tab_callback         (GtkWidget      *menuitem,
+                                           TerminalWindow *window);
+static void moveright_tab_callback         (GtkWidget      *menuitem,
+                                           TerminalWindow *window);
 static void change_tab_callback           (GtkWidget      *menuitem,
                                            TerminalWindow *window);
 static void help_callback                 (GtkWidget      *menuitem,
@@ -842,6 +848,14 @@
                         G_CALLBACK (next_tab_callback), window);
   window->priv->next_tab_menuitem = mi;
 
+  mi = append_menuitem (menu, _("Move Tab _Left"), ACCEL_PATH_MOVE_TAB_LEFT,
+                        G_CALLBACK (moveleft_tab_callback), window);
+  window->priv->moveleft_tab_menuitem = mi;
+  
+  mi = append_menuitem (menu, _("Move Tab _Right"), ACCEL_PATH_MOVE_TAB_RIGHT,
+                        G_CALLBACK (moveright_tab_callback), window);
+  window->priv->moveright_tab_menuitem = mi;
+
   mi = gtk_separator_menu_item_new ();
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
   
@@ -1128,7 +1142,7 @@
   notebook = window->priv->notebook;
   page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
   
-  gtk_widget_set_sensitive (window->priv->previous_tab_menuitem,
+  gtk_widget_set_sensitive (window->priv->moveleft_tab_menuitem,
                             page_num > 0);
 
 
@@ -1144,7 +1158,7 @@
   else
     gtk_widget_set_sensitive (window->priv->close_tab_menuitem, TRUE);
   
-  gtk_widget_set_sensitive (window->priv->next_tab_menuitem,
+  gtk_widget_set_sensitive (window->priv->moveright_tab_menuitem,
                             !on_last_page);
 }
 
@@ -2474,6 +2488,40 @@
 }
 
 static void
+moveleft_tab_callback(GtkWidget      *menuitem,
+            	      TerminalWindow *window)
+{
+  gint page_num;
+  GtkWidget *page;
+
+  page_num = gtk_notebook_get_current_page(GTK_NOTEBOOK
(window->priv->notebook));
+  page = gtk_notebook_get_nth_page(GTK_NOTEBOOK (window->priv->notebook),
page_num);
+  
+  gtk_notebook_reorder_child(GTK_NOTEBOOK (window->priv->notebook), 
+			     page,
+			     page_num-1);
+  update_tab_sensitivity (window);
+  reset_tab_menuitems (window);
+}
+
+static void
+moveright_tab_callback(GtkWidget      *menuitem,
+            	       TerminalWindow *window)
+{
+  gint page_num;
+  GtkWidget *page;
+  
+  page_num = gtk_notebook_get_current_page(GTK_NOTEBOOK
(window->priv->notebook));
+  page = gtk_notebook_get_nth_page(GTK_NOTEBOOK (window->priv->notebook),
page_num);
+  
+  gtk_notebook_reorder_child(GTK_NOTEBOOK (window->priv->notebook),
+			     page,
+	        	     page_num+1);
+  update_tab_sensitivity (window);
+  reset_tab_menuitems (window);
+}
+
+static void
 change_tab_callback (GtkWidget      *menuitem,
                      TerminalWindow *window)
 {
Comment 1 Havoc Pennington 2003-02-17 06:49:26 UTC
Thanks. 

Should this line be deleted?

-  gtk_widget_set_sensitive (window->priv->next_tab_menuitem,
+  gtk_widget_set_sensitive (window->priv->moveright_tab_menuitem,

We probably need a Tabs menu, matching Epiphany
(and presumably the HIG) instead of current Go menu.

Comment 2 fafhrd 2003-02-17 07:40:53 UTC
1) I use it because of aditional "bug" 106289 

2) i think Tabs menu is right
Comment 3 Olav Vitters 2003-06-21 23:00:55 UTC
Has patch: prio->High, keyword +PATCH, changing summary
Comment 4 Matthias Warkus 2003-10-12 16:37:11 UTC
If we do this, we should also be able to move tabs by dragging, we
should have tab context menus and close buttons on the tabs.
Perhaps we can just steal the code for this from Epiphany.
Perhaps I can do it. Well, strike the latter. I can't. :)
Comment 5 Mariano Suárez-Alvarez 2004-04-30 21:25:21 UTC
Created attachment 27242 [details] [review]
The patch in attachment form
Comment 6 Mark McLoughlin 2004-07-09 06:53:31 UTC
*** Bug 113428 has been marked as a duplicate of this bug. ***
Comment 7 Glynn Foster 2004-09-02 23:41:11 UTC
So, gedit has this cool thing that's somewhat connected with this feature. It
basically allows you to couple and de-couple tabs from the window into their own
window. ie. open up 2 docs in gedit, click and drag [creates 4-arrowed pointer]
out of the window - it moves your doc from the tab into its own window. Neato,
it would be absolutely awesome if gnome-terminal could do this.
Comment 8 Kjartan Maraas 2005-08-19 20:42:31 UTC
isn't this related to bug #86938 ?
Comment 9 Guilherme de Siqueira Pastore 2006-01-06 12:58:37 UTC
It seems this patch was applied and nobody closed the bug. This feature is present in HEAD and probably a lot of older versions, resolving. Thanks!