From bf5600ecd5ad0db87b1fddcbd4a5860903d9aa51 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Mon, 5 Jul 2004 21:31:24 +0000 Subject: preserve order of detachable windows when reatached. --- mixgtk/mixgtk_wm.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/mixgtk/mixgtk_wm.c b/mixgtk/mixgtk_wm.c index 4ee3193..2b0691d 100644 --- a/mixgtk/mixgtk_wm.c +++ b/mixgtk/mixgtk_wm.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mixgtk_wm.c : * Implementation of the functions declared in mixgtk_wm.h * ------------------------------------------------------------------ - * $Id: mixgtk_wm.c,v 1.10 2004/07/02 00:13:15 jao Exp $ + * $Id: mixgtk_wm.c,v 1.11 2004/07/05 21:31:24 jao Exp $ * ------------------------------------------------------------------ * Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. * @@ -156,7 +156,6 @@ mixgtk_wm_attach_window (mixgtk_window_id_t w) mixgtk_config_update (infos_[w].config_key, DETACH_NO_); if (gtk_notebook_get_n_pages (notebook_) == 1) gtk_widget_show (GTK_WIDGET (notebook_)); - gtk_notebook_set_current_page (notebook_, -1); } } @@ -266,14 +265,24 @@ add_page_ (GtkWidget *page, mixgtk_window_id_t id) N_("_Virtual machine"), N_("_Source"), N_("_Devices") }; + gint p = 0; + g_assert (page != NULL); g_assert (id < INF_NO_); g_assert (notebook_ != NULL); - gtk_notebook_append_page (notebook_, page, - gtk_label_new_with_mnemonic (LABELS[id])); - gtk_notebook_set_show_tabs (notebook_, - gtk_notebook_get_n_pages (notebook_) > 1); + if (id > MIXGTK_MIXVM_WINDOW) + { + if (id == MIXGTK_DEVICES_WINDOW) + p = gtk_notebook_get_n_pages (notebook_); + else + p = infos_[MIXGTK_MIXVM_WINDOW].detached ? 0 : 1; + } + + gtk_notebook_insert_page (notebook_, page, + gtk_label_new_with_mnemonic (LABELS[id]), + p); + gtk_notebook_set_current_page (notebook_, p); gtk_widget_show (page); gtk_widget_show (GTK_WIDGET (notebook_)); } @@ -383,6 +392,7 @@ init_mixal_ (void) gtk_widget_show (mixal); gtk_widget_show (page); + gtk_widget_show (GTK_WIDGET (mixal_container_)); } static void @@ -531,11 +541,10 @@ mixal_detach_ (void) MIXGTK_WIDGET_MIXAL_STATUSBAR)); g_assert (stat); } - else - gtk_widget_reparent (infos_[MIXGTK_MIXAL_WINDOW].widget, - GTK_WIDGET (mixal_container_)); mixgtk_mixal_reparent (stat); + gtk_widget_reparent (infos_[MIXGTK_MIXAL_WINDOW].widget, + GTK_WIDGET (mixal_container_)); } static void -- cgit v1.2.3