[Xfce4-commits] <xfce4-terminal:nick/dropdown> Hold ref on vbox in case a viewport is added.

Nick Schermer noreply at xfce.org
Sat Dec 29 22:20:02 CET 2012


Updating branch refs/heads/nick/dropdown
         to 031a1b3fe862382ce338bed65639d4fa451e6036 (commit)
       from 3304d3899c28e056a0c6a83e4db78f949fe84295 (commit)

commit 031a1b3fe862382ce338bed65639d4fa451e6036
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Dec 29 21:30:30 2012 +0100

    Hold ref on vbox in case a viewport is added.

 terminal/terminal-window.c |   16 +++++-----------
 terminal/terminal-window.h |    1 +
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index ed5f5c1..5062b69 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -329,7 +329,7 @@ terminal_window_init (TerminalWindow *window)
   g_signal_connect_after (G_OBJECT (accel_group), "accel-activate",
       G_CALLBACK (terminal_window_accel_activate), window);
 
-  vbox = gtk_vbox_new (FALSE, 0);
+  window->vbox = vbox = gtk_vbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (window), vbox);
   gtk_widget_show (vbox);
 
@@ -1408,8 +1408,6 @@ static void
 terminal_window_action_show_menubar (GtkToggleAction *action,
                                      TerminalWindow  *window)
 {
-  GtkWidget *vbox;
-
   terminal_return_if_fail (GTK_IS_UI_MANAGER (window->ui_manager));
 
   terminal_window_size_push (window);
@@ -1418,10 +1416,9 @@ terminal_window_action_show_menubar (GtkToggleAction *action,
     {
       if (G_LIKELY (window->menubar == NULL))
         {
-          vbox = gtk_bin_get_child (GTK_BIN (window));
           window->menubar = gtk_ui_manager_get_widget (window->ui_manager, "/main-menu");
-          gtk_box_pack_start (GTK_BOX (vbox), window->menubar, FALSE, FALSE, 0);
-          gtk_box_reorder_child (GTK_BOX (vbox), window->menubar, 0);
+          gtk_box_pack_start (GTK_BOX (window->vbox), window->menubar, FALSE, FALSE, 0);
+          gtk_box_reorder_child (GTK_BOX (window->vbox), window->menubar, 0);
         }
 
       gtk_widget_show (window->menubar);
@@ -1440,8 +1437,6 @@ static void
 terminal_window_action_show_toolbar (GtkToggleAction *action,
                                      TerminalWindow  *window)
 {
-  GtkWidget *vbox;
-
   terminal_return_if_fail (GTK_IS_UI_MANAGER (window->ui_manager));
   terminal_return_if_fail (GTK_IS_ACTION_GROUP (window->action_group));
 
@@ -1451,10 +1446,9 @@ terminal_window_action_show_toolbar (GtkToggleAction *action,
     {
       if (window->toolbar == NULL)
         {
-          vbox = gtk_bin_get_child (GTK_BIN (window));
           window->toolbar = gtk_ui_manager_get_widget (window->ui_manager, "/main-toolbar");
-          gtk_box_pack_start (GTK_BOX (vbox), window->toolbar, FALSE, FALSE, 0);
-          gtk_box_reorder_child (GTK_BOX (vbox), window->toolbar, window->menubar != NULL ? 1 : 0);
+          gtk_box_pack_start (GTK_BOX (window->vbox), window->toolbar, FALSE, FALSE, 0);
+          gtk_box_reorder_child (GTK_BOX (window->vbox), window->toolbar, window->menubar != NULL ? 1 : 0);
         }
 
       gtk_widget_show (window->toolbar);
diff --git a/terminal/terminal-window.h b/terminal/terminal-window.h
index ed804f5..bce7e5c 100644
--- a/terminal/terminal-window.h
+++ b/terminal/terminal-window.h
@@ -61,6 +61,7 @@ struct _TerminalWindow
   guint                tabs_menu_merge_id;
   GSList              *tabs_menu_actions;
 
+  GtkWidget           *vbox;
   GtkWidget           *menubar;
   GtkWidget           *toolbar;
   GtkWidget           *notebook;


More information about the Xfce4-commits mailing list