[Xfce4-commits] r30207 - terminal/trunk/terminal
Nick Schermer
nick at xfce.org
Mon Jul 6 20:32:36 CEST 2009
Author: nick
Date: 2009-07-06 18:32:36 +0000 (Mon, 06 Jul 2009)
New Revision: 30207
Modified:
terminal/trunk/terminal/terminal-app.c
terminal/trunk/terminal/terminal-screen.c
terminal/trunk/terminal/terminal-screen.h
terminal/trunk/terminal/terminal-widget.c
terminal/trunk/terminal/terminal-window.c
terminal/trunk/terminal/terminal-window.h
Log:
Misc changes.
Change the way the geometry is handled a bit (again).
Remove some unused class signal pointer.
Hookup some window signals in the class.
Hide the tab border around the notebook and add some
border around the labels to make everything look the same.
Modified: terminal/trunk/terminal/terminal-app.c
===================================================================
--- terminal/trunk/terminal/terminal-app.c 2009-07-06 16:46:35 UTC (rev 30206)
+++ terminal/trunk/terminal/terminal-app.c 2009-07-06 18:32:36 UTC (rev 30207)
@@ -532,31 +532,26 @@
terminal_window_add (TERMINAL_WINDOW (window), TERMINAL_SCREEN (terminal));
- /* if this was the first tab, we set the geometry string now
- * and show the window. This is required to work around a hang
- * in Gdk, which I failed to figure the cause til now.
- */
- if (lp == attr->tabs)
- {
- /* determine the window geometry */
- if (G_LIKELY (attr->geometry == NULL))
- g_object_get (G_OBJECT (app->preferences), "misc-default-geometry", &geometry, NULL);
- else
- geometry = g_strdup (attr->geometry);
+ terminal_screen_launch_child (TERMINAL_SCREEN (terminal));
+ }
- /* try to apply the geometry to the window */
- if (!gtk_window_parse_geometry (GTK_WINDOW (window), geometry))
- g_printerr (_("Invalid geometry string \"%s\"\n"), geometry);
+ /* set the window geometry, this can only be set after one of the tabs
+ * has been added, because vte is the geometry widget, so atleast one
+ * call should have been made to terminal_screen_set_window_geometry_hints */
+ if (G_LIKELY (attr->geometry == NULL))
+ g_object_get (G_OBJECT (app->preferences), "misc-default-geometry", &geometry, NULL);
+ else
+ geometry = g_strdup (attr->geometry);
- /* cleanup */
- g_free (geometry);
+ /* try to apply the geometry to the window */
+ if (!gtk_window_parse_geometry (GTK_WINDOW (window), geometry))
+ g_printerr (_("Invalid geometry string \"%s\"\n"), geometry);
- /* show the window */
- gtk_widget_show (window);
- }
+ /* cleanup */
+ g_free (geometry);
- terminal_screen_launch_child (TERMINAL_SCREEN (terminal));
- }
+ /* show the window */
+ gtk_widget_show (window);
/* register with session manager on first display
* opened by Terminal. This is to ensure that we
@@ -572,7 +567,3 @@
G_CALLBACK (terminal_app_save_yourself), app);
}
}
-
-
-
-
Modified: terminal/trunk/terminal/terminal-screen.c
===================================================================
--- terminal/trunk/terminal/terminal-screen.c 2009-07-06 16:46:35 UTC (rev 30206)
+++ terminal/trunk/terminal/terminal-screen.c 2009-07-06 18:32:36 UTC (rev 30207)
@@ -115,8 +115,6 @@
TerminalScreen *screen);
static gboolean terminal_screen_timer_background (gpointer user_data);
static void terminal_screen_timer_background_destroy (gpointer user_data);
-static void terminal_screen_set_window_geometry_hints (TerminalScreen *screen,
- GtkWindow *window);
static void terminal_screen_update_label_orientation (TerminalScreen *screen);
@@ -124,10 +122,6 @@
struct _TerminalScreenClass
{
GtkHBoxClass __parent__;
-
- /* signals */
- GtkWidget* (*get_context_menu) (TerminalScreen *screen);
- void (*selection_changed) (TerminalScreen *screen);
};
struct _TerminalScreen
@@ -207,8 +201,7 @@
g_signal_new (I_("get-context-menu"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (TerminalScreenClass, get_context_menu),
- NULL, NULL,
+ 0, NULL, NULL,
_terminal_marshal_OBJECT__VOID,
GTK_TYPE_MENU, 0);
@@ -219,8 +212,7 @@
g_signal_new (I_("selection-changed"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (TerminalScreenClass, selection_changed),
- NULL, NULL,
+ 0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
@@ -1051,43 +1043,7 @@
-/**
- * terminal_screen_set_window_geometry_hints:
- *
- * I don't like this way, but its required to work-around a Gtk+
- * bug (maybe also caused by a Vte bug, not sure).
- **/
static void
-terminal_screen_set_window_geometry_hints (TerminalScreen *screen,
- GtkWindow *window)
-{
- GdkGeometry hints;
- gint xpad;
- gint ypad;
-
- terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
- terminal_return_if_fail (VTE_IS_TERMINAL (screen->terminal));
-
- vte_terminal_get_padding (VTE_TERMINAL (screen->terminal), &xpad, &ypad);
-
- hints.base_width = xpad;
- hints.base_height = ypad;
- hints.width_inc = VTE_TERMINAL (screen->terminal)->char_width;
- hints.height_inc = VTE_TERMINAL (screen->terminal)->char_height;
- hints.min_width = hints.base_width + hints.width_inc * 4;
- hints.min_height = hints.base_height + hints.height_inc * 2;
-
- gtk_window_set_geometry_hints (GTK_WINDOW (window),
- screen->terminal,
- &hints,
- GDK_HINT_RESIZE_INC
- | GDK_HINT_MIN_SIZE
- | GDK_HINT_BASE_SIZE);
-}
-
-
-
-static void
terminal_screen_update_label_orientation (TerminalScreen *screen)
{
GtkPositionType position;
@@ -1251,6 +1207,9 @@
if (G_LIKELY (screen != NULL))
{
+ if (!GTK_WIDGET_REALIZED (screen->terminal))
+ gtk_widget_realize (screen->terminal);
+
*width_chars = VTE_TERMINAL (screen->terminal)->column_count;
*height_chars = VTE_TERMINAL (screen->terminal)->row_count;
}
@@ -1274,6 +1233,44 @@
/**
+ * terminal_screen_set_window_geometry_hints:
+ *
+ * I don't like this way, but its required to work-around a Gtk+
+ * bug (maybe also caused by a Vte bug, not sure).
+ **/
+void
+terminal_screen_set_window_geometry_hints (TerminalScreen *screen,
+ GtkWindow *window)
+{
+ GdkGeometry hints;
+ gint xpad;
+ gint ypad;
+
+ terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
+ terminal_return_if_fail (VTE_IS_TERMINAL (screen->terminal));
+ terminal_return_if_fail (GTK_WIDGET_REALIZED (screen));
+ terminal_return_if_fail (GTK_WIDGET_REALIZED (window));
+
+ vte_terminal_get_padding (VTE_TERMINAL (screen->terminal), &xpad, &ypad);
+
+ hints.base_width = xpad;
+ hints.base_height = ypad;
+ hints.width_inc = VTE_TERMINAL (screen->terminal)->char_width;
+ hints.height_inc = VTE_TERMINAL (screen->terminal)->char_height;
+ hints.min_width = hints.base_width + hints.width_inc * 4;
+ hints.min_height = hints.base_height + hints.height_inc * 2;
+
+ gtk_window_set_geometry_hints (GTK_WINDOW (window),
+ screen->terminal,
+ &hints,
+ GDK_HINT_RESIZE_INC
+ | GDK_HINT_MIN_SIZE
+ | GDK_HINT_BASE_SIZE);
+}
+
+
+
+/**
* terminal_screen_force_resize_window:
*
* I don't like this way, but its required to work-around a Gtk+
@@ -1710,6 +1707,7 @@
/* create the box */
hbox = gtk_hbox_new (FALSE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 3);
gtk_widget_show (hbox);
screen->tab_label = gtk_label_new (NULL);
Modified: terminal/trunk/terminal/terminal-screen.h
===================================================================
--- terminal/trunk/terminal/terminal-screen.h 2009-07-06 16:46:35 UTC (rev 30206)
+++ terminal/trunk/terminal/terminal-screen.h 2009-07-06 18:32:36 UTC (rev 30207)
@@ -54,6 +54,9 @@
gint width_chars,
gint height_chars);
+void terminal_screen_set_window_geometry_hints (TerminalScreen *screen,
+ GtkWindow *window);
+
void terminal_screen_force_resize_window (TerminalScreen *screen,
GtkWindow *window,
gint force_columns,
Modified: terminal/trunk/terminal/terminal-widget.c
===================================================================
--- terminal/trunk/terminal/terminal-widget.c 2009-07-06 16:46:35 UTC (rev 30206)
+++ terminal/trunk/terminal/terminal-widget.c 2009-07-06 18:32:36 UTC (rev 30207)
@@ -168,8 +168,7 @@
g_signal_new (I_("context-menu"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (TerminalWidgetClass, get_context_menu),
- NULL, NULL,
+ 0, NULL, NULL,
_terminal_marshal_OBJECT__VOID,
GTK_TYPE_MENU, 0);
}
Modified: terminal/trunk/terminal/terminal-window.c
===================================================================
--- terminal/trunk/terminal/terminal-window.c 2009-07-06 16:46:35 UTC (rev 30206)
+++ terminal/trunk/terminal/terminal-window.c 2009-07-06 18:32:36 UTC (rev 30207)
@@ -68,7 +68,7 @@
PROP_0,
PROP_SHOW_MENUBAR,
PROP_SHOW_BORDERS,
- PROP_SHOW_TOOLBARS,
+ PROP_SHOW_TOOLBARS
};
/* Signal identifiers */
@@ -76,7 +76,7 @@
{
NEW_WINDOW,
NEW_WINDOW_WITH_SCREEN,
- LAST_SIGNAL,
+ LAST_SIGNAL
};
@@ -85,10 +85,14 @@
static void terminal_window_finalize (GObject *object);
static void terminal_window_show (GtkWidget *widget);
static void terminal_window_realize (GtkWidget *widget);
+static gboolean terminal_window_delete_event (GtkWidget *widget,
+ GdkEventAny *event);
+static gboolean terminal_window_state_event (GtkWidget *widget,
+ GdkEventWindowState *event);
+static void terminal_window_style_set (GtkWidget *widget,
+ GtkStyle *previous_style);
static gboolean terminal_window_confirm_close (TerminalWindow *window);
-static void terminal_window_queue_reset_size (TerminalWindow *window);
-static gboolean terminal_window_reset_size (gpointer user_data);
-static void terminal_window_reset_size_destroy (gpointer user_data);
+static void terminal_window_set_size (TerminalWindow *window);
static void terminal_window_set_size_force_grid (TerminalWindow *window,
TerminalScreen *screen,
gint force_grid_width,
@@ -96,9 +100,6 @@
static void terminal_window_update_actions (TerminalWindow *window);
static void terminal_window_update_mnemonics (TerminalWindow *window);
static void terminal_window_rebuild_gomenu (TerminalWindow *window);
-static gboolean terminal_window_delete_event (TerminalWindow *window);
-static void terminal_window_state_event (TerminalWindow *window,
- GdkEventWindowState *event);
static void terminal_window_notebook_page_switched (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num,
@@ -107,6 +108,7 @@
GtkNotebookPage *page,
guint page_num,
TerminalWindow *window);
+static void terminal_window_notebook_show_tabs (TerminalWindow *window);
static void terminal_window_notebook_page_added (GtkNotebook *notebook,
GtkWidget *child,
guint page_num,
@@ -207,8 +209,6 @@
TerminalScreen *active;
- guint reset_size_idle_id;
-
/* whether this window has an rgba colormap */
guint is_composited : 1;
};
@@ -277,6 +277,9 @@
gtkwidget_class = GTK_WIDGET_CLASS (klass);
gtkwidget_class->show = terminal_window_show;
gtkwidget_class->realize = terminal_window_realize;
+ gtkwidget_class->window_state_event = terminal_window_state_event;
+ gtkwidget_class->delete_event = terminal_window_delete_event;
+ gtkwidget_class->style_set = terminal_window_style_set;
/**
* TerminalWindow::new-window
@@ -285,8 +288,7 @@
g_signal_new (I_("new-window"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (TerminalWindowClass, new_window),
- NULL, NULL,
+ 0, NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1,
G_TYPE_STRING);
@@ -298,8 +300,7 @@
g_signal_new (I_("new-window-with-screen"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (TerminalWindowClass, new_window_with_screen),
- NULL, NULL,
+ 0, NULL, NULL,
_terminal_marshal_VOID__OBJECT_INT_INT,
G_TYPE_NONE, 3,
G_TYPE_OBJECT,
@@ -317,8 +318,9 @@
GtkAccelGroup *accel_group;
GtkAction *action;
GtkWidget *vbox;
- gboolean bval;
+ gboolean no_mnemonics, always_show_tabs;
gchar *role;
+ GtkRcStyle *style;
window->preferences = terminal_preferences_get ();
window->active = NULL;
@@ -327,9 +329,9 @@
* visibility is changed.
*/
g_signal_connect_swapped (G_OBJECT (window->preferences), "notify::font-name",
- G_CALLBACK (terminal_window_queue_reset_size), window);
+ G_CALLBACK (terminal_window_set_size), window);
g_signal_connect_swapped (G_OBJECT (window->preferences), "notify::scrolling-bar",
- G_CALLBACK (terminal_window_queue_reset_size), window);
+ G_CALLBACK (terminal_window_set_size), window);
g_signal_connect_swapped (G_OBJECT (window->preferences), "notify::shortcuts-no-mnemonics",
G_CALLBACK (terminal_window_update_mnemonics), window);
@@ -364,9 +366,13 @@
gtk_widget_show (window->menubar);
}
+ /* get some preferences */
+ g_object_get (G_OBJECT (window->preferences),
+ "shortcuts-no-mnemonics", &no_mnemonics,
+ "misc-always-show-tabs", &always_show_tabs, NULL);
+
/* setup mnemonics */
- g_object_get (G_OBJECT (window->preferences), "shortcuts-no-mnemonics", &bval, NULL);
- if (G_UNLIKELY (bval))
+ if (G_UNLIKELY (no_mnemonics))
terminal_window_update_mnemonics (window);
#if defined(GDK_WINDOWING_X11)
@@ -383,12 +389,19 @@
"homogeneous", TRUE,
"scrollable", TRUE,
"show-border", FALSE,
+ "show-tabs", always_show_tabs,
"tab-hborder", 0,
"tab-vborder", 0,
NULL);
exo_binding_new (G_OBJECT (window->preferences), "misc-tab-position",
G_OBJECT (window->notebook), "tab-pos");
+ /* hide the ugly terminal border when tabs are shown */
+ style = gtk_rc_style_new ();
+ style->xthickness = style->ythickness = 0;
+ gtk_widget_modify_style (window->notebook, style);
+ g_object_unref (G_OBJECT (style));
+
/* set the notebook group id */
gtk_notebook_set_group (GTK_NOTEBOOK (window->notebook),
(gpointer) window_notebook_group);
@@ -412,12 +425,6 @@
gtk_box_pack_start (GTK_BOX (vbox), window->notebook, TRUE, TRUE, 0);
gtk_widget_show (window->notebook);
- g_object_connect (G_OBJECT (window),
- "signal::delete-event", G_CALLBACK (terminal_window_delete_event), NULL,
- "signal-after::style-set", G_CALLBACK (terminal_window_queue_reset_size), NULL,
- "signal::window-state-event", G_CALLBACK (terminal_window_state_event), NULL,
- NULL);
-
/* set a unique role on each window (for session management) */
role = g_strdup_printf ("Terminal-%p-%d-%d", window, (gint) getpid (), (gint) time (NULL));
gtk_window_set_role (GTK_WINDOW (window), role);
@@ -431,9 +438,6 @@
{
TerminalWindow *window = TERMINAL_WINDOW (object);
- if (window->reset_size_idle_id != 0)
- g_source_remove (window->reset_size_idle_id);
-
g_signal_handlers_disconnect_matched (G_OBJECT (window->preferences),
G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, window);
@@ -529,6 +533,73 @@
static gboolean
+terminal_window_delete_event (GtkWidget *widget,
+ GdkEventAny *event)
+{
+ TerminalWindow *window = TERMINAL_WINDOW (widget);
+
+ /* disconnect remove signal if we're closing the window */
+ if (terminal_window_confirm_close (window))
+ {
+ /* avoid a lot of page remove calls */
+ g_signal_handlers_disconnect_by_func (G_OBJECT (window->notebook),
+ G_CALLBACK (terminal_window_notebook_page_removed), window);
+
+ /* let gtk close the window */
+ if (GTK_WIDGET_CLASS (terminal_window_parent_class)->delete_event != NULL)
+ return (*GTK_WIDGET_CLASS (terminal_window_parent_class)->delete_event) (widget, event);
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+
+static gboolean
+terminal_window_state_event (GtkWidget *widget,
+ GdkEventWindowState *event)
+{
+ TerminalWindow *window = TERMINAL_WINDOW (widget);
+ GtkAction *action;
+ gboolean fullscreen;
+
+ terminal_return_val_if_fail (TERMINAL_IS_WINDOW (window), FALSE);
+
+ /* update the fullscreen action if the fullscreen state changed by the wm */
+ if ((event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) != 0)
+ {
+ fullscreen = (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
+ action = gtk_action_group_get_action (window->action_group, "fullscreen");
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != fullscreen)
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fullscreen);
+ }
+
+ if (GTK_WIDGET_CLASS (terminal_window_parent_class)->window_state_event != NULL)
+ return (*GTK_WIDGET_CLASS (terminal_window_parent_class)->window_state_event) (widget, event);
+
+ return FALSE;
+}
+
+
+
+static void
+terminal_window_style_set (GtkWidget *widget,
+ GtkStyle *previous_style)
+{
+ TerminalWindow *window = TERMINAL_WINDOW (widget);
+
+ (*GTK_WIDGET_CLASS (terminal_window_parent_class)->style_set) (widget, previous_style);
+
+ /* schedule a resize if the theme changed */
+ if (G_UNLIKELY (previous_style != NULL))
+ terminal_window_set_size (window);
+}
+
+
+
+static gboolean
terminal_window_confirm_close (TerminalWindow *window)
{
GtkWidget *dialog;
@@ -621,65 +692,28 @@
static void
-terminal_window_queue_reset_size (TerminalWindow *window)
+terminal_window_set_size (TerminalWindow *window)
{
- if (GTK_WIDGET_REALIZED (window) && window->reset_size_idle_id == 0)
- {
- /* Gtk+ uses a priority of G_PRIORITY_HIGH_IDLE + 10 for resizing operations, so we
- * use a slightly higher priority for the reset size operation.
- */
- window->reset_size_idle_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 5,
- terminal_window_reset_size, window,
- terminal_window_reset_size_destroy);
- }
-}
+ gint grid_width, grid_height;
+ terminal_return_if_fail (TERMINAL_IS_WINDOW (window));
-
-static gboolean
-terminal_window_reset_size (gpointer user_data)
-{
- TerminalWindow *window = TERMINAL_WINDOW (user_data);
- gint grid_width, grid_height;
-
- GDK_THREADS_ENTER ();
-
- /* The trick is rather simple here. This is called before any Gtk+ resizing operation takes
- * place, so the columns/rows on the active terminal screen are still set to their old values.
- * We simply query these values and force them to be set with the new style.
- */
if (G_LIKELY (window->active != NULL))
{
- if (!GTK_WIDGET_REALIZED (GTK_WIDGET (window->active)))
- gtk_widget_realize (GTK_WIDGET (window->active));
-
terminal_screen_get_size (window->active, &grid_width, &grid_height);
- terminal_window_set_size_force_grid (window, window->active,
- grid_width, grid_height);
+ terminal_window_set_size_force_grid (window, window->active, grid_width, grid_height);
}
-
- GDK_THREADS_LEAVE ();
-
- return FALSE;
}
static void
-terminal_window_reset_size_destroy (gpointer user_data)
-{
- TERMINAL_WINDOW (user_data)->reset_size_idle_id = 0;
-}
-
-
-
-static void
terminal_window_set_size_force_grid (TerminalWindow *window,
TerminalScreen *screen,
gint force_grid_width,
gint force_grid_height)
{
- /* Required to get the char height/width right */
+ /* required to get the char height/width right */
if (!GTK_WIDGET_REALIZED (GTK_WIDGET (screen)))
gtk_widget_realize (GTK_WIDGET (screen));
@@ -845,52 +879,14 @@
-static gboolean
-terminal_window_delete_event (TerminalWindow *window)
-{
- gboolean result;
-
- /* get close confirmation from the user */
- result = terminal_window_confirm_close (window);
-
- /* disconnect remove signal if we're closing the window */
- if (result)
- g_signal_handlers_disconnect_by_func (G_OBJECT (window->notebook),
- G_CALLBACK (terminal_window_notebook_page_removed), window);
-
- return !result;
-}
-
-
-
static void
-terminal_window_state_event (TerminalWindow *window,
- GdkEventWindowState *event)
-{
- GtkAction *action;
- gboolean fullscreen;
-
- terminal_return_if_fail (TERMINAL_IS_WINDOW (window));
-
- /* update the fullscreen action if the fullscreen state changed by the wm */
- if ((event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) != 0)
- {
- fullscreen = (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
- action = gtk_action_group_get_action (window->action_group, "fullscreen");
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) != fullscreen)
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fullscreen);
- }
-}
-
-
-
-static void
terminal_window_notebook_page_switched (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num,
TerminalWindow *window)
{
TerminalScreen *active;
+ gboolean was_null;
/* get the new active page */
active = TERMINAL_SCREEN (gtk_notebook_get_nth_page (notebook, page_num));
@@ -899,6 +895,10 @@
/* only update when really changed */
if (G_LIKELY (window->active != active))
{
+ /* check if we need to set the size or if this was already done
+ * in the page add function */
+ was_null = (window->active == NULL);
+
/* set new active tab */
window->active = active;
@@ -911,8 +911,9 @@
/* reset the activity counter */
terminal_screen_reset_activity (active);
- /* update geometry size */
- terminal_window_queue_reset_size (window);
+ /* set the new geometry widget */
+ if (G_LIKELY (!was_null))
+ terminal_screen_set_window_geometry_hints (active, GTK_WINDOW (window));
}
}
@@ -932,15 +933,43 @@
static void
+terminal_window_notebook_show_tabs (TerminalWindow *window)
+{
+ GtkNotebook *notebook = GTK_NOTEBOOK (window->notebook);
+ gboolean show_tabs = TRUE;
+ gint npages;
+ gint width_chars, height_chars;
+
+ /* set the visibility of the tabs */
+ npages = gtk_notebook_get_n_pages (notebook);
+ if (npages < 2)
+ g_object_get (G_OBJECT (window->preferences),
+ "misc-always-show-tabs", &show_tabs, NULL);
+
+ if (gtk_notebook_get_show_tabs (notebook) != show_tabs)
+ {
+ /* get the screen size before we change the tabs */
+ terminal_screen_get_size (window->active, &width_chars, &height_chars);
+
+ /* show or hdie the tabs */
+ gtk_notebook_set_show_tabs (notebook, show_tabs);
+
+ /* update the window geometry */
+ terminal_window_set_size_force_grid (window, window->active,
+ width_chars, height_chars);
+ }
+}
+
+
+
+static void
terminal_window_notebook_page_added (GtkNotebook *notebook,
GtkWidget *child,
guint page_num,
TerminalWindow *window)
{
TerminalScreen *screen = TERMINAL_SCREEN (child);
- gboolean show_tabs = TRUE;
- gint npages;
- gint width_chars, height_chars;
+ gint w, h;
terminal_return_if_fail (TERMINAL_IS_SCREEN (child));
terminal_return_if_fail (TERMINAL_IS_WINDOW (window));
@@ -957,30 +986,24 @@
g_signal_connect (G_OBJECT (screen), "drag-data-received",
G_CALLBACK (terminal_window_notebook_drag_data_received), window);
- /* set the visibility of the tabs */
- npages = gtk_notebook_get_n_pages (notebook);
- if (npages < 2)
- g_object_get (G_OBJECT (window->preferences), "misc-always-show-tabs", &show_tabs, NULL);
- gtk_notebook_set_show_tabs (notebook, show_tabs);
-
if (G_LIKELY (window->active != NULL))
{
/* match the size of the active screen */
- terminal_screen_get_size (window->active, &width_chars, &height_chars);
- terminal_screen_set_size (screen, width_chars, height_chars);
+ terminal_screen_get_size (window->active, &w, &h);
+ terminal_screen_set_size (screen, w, h);
+
+ /* show the tabs when needed */
+ terminal_window_notebook_show_tabs (window);
}
else
{
/* force a screen size, needed for misc-default-geometry */
- terminal_screen_get_size (screen, &width_chars, &height_chars);
- terminal_window_set_size_force_grid (window, screen, width_chars, height_chars);
+ terminal_screen_get_size (screen, &w, &h);
+ terminal_window_set_size_force_grid (window, screen, w, h);
}
/* regenerate the "Go" menu */
terminal_window_rebuild_gomenu (window);
-
- /* update all screen sensitive actions (Copy, Prev Tab, ...) */
- terminal_window_update_actions (window);
}
@@ -991,8 +1014,7 @@
guint page_num,
TerminalWindow *window)
{
- gint npages;
- gboolean show_tabs = TRUE;
+ gint npages;
terminal_return_if_fail (TERMINAL_IS_SCREEN (child));
terminal_return_if_fail (TERMINAL_IS_WINDOW (window));
@@ -1019,19 +1041,11 @@
}
else
{
- /* set the visibility of the tabs */
- if (npages < 2)
- g_object_get (G_OBJECT (window->preferences), "misc-always-show-tabs", &show_tabs, NULL);
- gtk_notebook_set_show_tabs (notebook, show_tabs);
+ /* show the tabs when needed */
+ terminal_window_notebook_show_tabs (window);
- /* update geometry size */
- terminal_window_queue_reset_size (window);
-
/* regenerate the "Go" menu */
terminal_window_rebuild_gomenu (window);
-
- /* update all screen sensitive actions (Copy, Prev Tab, ...) */
- terminal_window_update_actions (window);
}
}
@@ -1446,7 +1460,7 @@
else
gtk_widget_hide (window->menubar);
- terminal_window_queue_reset_size (window);
+ terminal_window_set_size (window);
}
@@ -1486,7 +1500,7 @@
gtk_action_set_sensitive (action_edit, FALSE);
}
- terminal_window_queue_reset_size (window);
+ terminal_window_set_size (window);
}
Modified: terminal/trunk/terminal/terminal-window.h
===================================================================
--- terminal/trunk/terminal/terminal-window.h 2009-07-06 16:46:35 UTC (rev 30206)
+++ terminal/trunk/terminal/terminal-window.h 2009-07-06 18:32:36 UTC (rev 30207)
@@ -40,14 +40,6 @@
struct _TerminalWindowClass
{
GtkWindowClass __parent__;
-
- /* signals */
- void (*new_window) (TerminalWindow *window,
- const gchar *working_directory);
- void (*new_window_with_screen) (TerminalWindow *window,
- TerminalScreen *screen,
- gint x,
- gint y);
};
GType terminal_window_get_type (void) G_GNUC_CONST;
More information about the Xfce4-commits
mailing list