forwarded 361114 http://bugzilla.gnome.org/show_bug.cgi?id=324426 tag 361114 patch thanks
This bug has already been reported upstream as 361114. I verified that the patch attached to the upstream bug report fixes this bug, so I'm attaching the patch here and tagging the bug appropriately. -- Matt
diff -ru gnome-terminal-2.14.0-orig/ChangeLog gnome-terminal-2.14.0/ChangeLog --- gnome-terminal-2.14.0-orig/ChangeLog 2006-04-10 15:06:09.000000000 -0700 +++ gnome-terminal-2.14.0/ChangeLog 2006-04-10 15:07:08.000000000 -0700 @@ -1,3 +1,8 @@ +2006-02-20 Tony Tsui <[EMAIL PROTECTED]> + + * src/terminal-window.c: Resize the terminal window after a tab is + removed. Closes bug #324426. + 2006-03-12 Guilherme de S. Pastore <[EMAIL PROTECTED]> * NEWS: updated. diff -ru gnome-terminal-2.14.0-orig/src/terminal-notebook.c gnome-terminal-2.14.0/src/terminal-notebook.c --- gnome-terminal-2.14.0-orig/src/terminal-notebook.c 2006-04-10 15:06:09.000000000 -0700 +++ gnome-terminal-2.14.0/src/terminal-notebook.c 2006-04-10 15:06:45.000000000 -0700 @@ -120,6 +120,16 @@ G_TYPE_NONE, 1, TERMINAL_TYPE_SCREEN); + signals[TAB_DELETE] = + g_signal_new ("tab_delete", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (TerminalNotebookClass, tab_delete), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + TERMINAL_TYPE_SCREEN); signals[TAB_REMOVED] = g_signal_new ("tab_removed", G_OBJECT_CLASS_TYPE (object_class), @@ -837,6 +847,8 @@ */ g_object_ref (screen); + g_signal_emit (G_OBJECT (nb), signals[TAB_DELETE], 0, screen); + gtk_notebook_remove_page (GTK_NOTEBOOK (nb), position); update_tabs_visibility (nb, FALSE); diff -ru gnome-terminal-2.14.0-orig/src/terminal-window.c gnome-terminal-2.14.0/src/terminal-window.c --- gnome-terminal-2.14.0-orig/src/terminal-window.c 2006-04-10 15:06:09.000000000 -0700 +++ gnome-terminal-2.14.0/src/terminal-window.c 2006-04-10 15:06:45.000000000 -0700 @@ -71,6 +71,8 @@ GtkClipboard *clipboard; int old_char_width; int old_char_height; + int old_grid_width; + int old_grid_height; void *old_geometry_widget; /* only used for pointer value as it may be freed */ GConfClient *conf; guint notify_id; @@ -124,6 +126,10 @@ TerminalScreen *screen, TerminalWindow *window); +static void notebook_tab_delete_callback (GtkWidget *notebook, + TerminalScreen *screen, + TerminalWindow *window); + static void notebook_tab_removed_callback (GtkWidget *notebook, TerminalScreen *screen, TerminalWindow *window); @@ -820,6 +826,11 @@ window); g_signal_connect_after (G_OBJECT (window->priv->notebook), + "tab_delete", + G_CALLBACK (notebook_tab_delete_callback), + window); + + g_signal_connect_after (G_OBJECT (window->priv->notebook), "tab_removed", G_CALLBACK (notebook_tab_removed_callback), window); @@ -1433,10 +1444,6 @@ { g_return_if_fail (terminal_screen_get_window (screen) == window); - window->priv->terms = g_list_remove (window->priv->terms, screen); - - terminal_screen_set_window (screen, NULL); - terminal_notebook_remove_tab (TERMINAL_NOTEBOOK (window->priv->notebook), screen); } @@ -1811,17 +1818,40 @@ } static void +notebook_tab_delete_callback (GtkWidget *notebook, + TerminalScreen *screen, + TerminalWindow *window) +{ + /* If we are going to delete the active tab we need to record its grid width + * and height so the terminal window will be resized correctly after the tab + * has been removed. The cases when this is important is when the window + * size will change because: + * - tabs will be hidden because only one terminal remain + * - the tab being deleted has been zoomed in/out + */ + if (window->priv->active_term == screen) + { + GtkWidget *old_active_widget; + + old_active_widget = terminal_screen_get_widget (screen); + terminal_widget_get_size (old_active_widget, + &window->priv->old_grid_width, + &window->priv->old_grid_height); + } + else + { + window->priv->old_grid_width = -1; + window->priv->old_grid_width = -1; + } +} + +static void notebook_tab_removed_callback (GtkWidget *notebook, TerminalScreen *screen, TerminalWindow *window) { - /* Called from terminal_notebook_move_tab() */ - if (find_screen (window, screen) != NULL) { - g_assert (terminal_screen_get_window (screen) == window); - - window->priv->terms = g_list_remove (window->priv->terms, screen); - terminal_screen_set_window (screen, NULL); - } + window->priv->terms = g_list_remove (window->priv->terms, screen); + terminal_screen_set_window (screen, NULL); g_signal_handlers_disconnect_by_func (G_OBJECT (screen), G_CALLBACK (profile_set_callback), @@ -1848,7 +1878,17 @@ /* Close window if no more terminals */ if (window->priv->terms == NULL) - gtk_widget_destroy (GTK_WIDGET (window)); + { + gtk_widget_destroy (GTK_WIDGET (window)); + return; + } + +#ifdef DEBUG_GEOMETRY + g_print ("setting size with forced grid after removing a terminal\n"); +#endif + terminal_window_set_size_force_grid (window, window->priv->active_term, + TRUE, window->priv->old_grid_width, + window->priv->old_grid_height); } static void
signature.asc
Description: Digital signature