summaryrefslogtreecommitdiffhomepage
path: root/mixgtk
diff options
context:
space:
mode:
Diffstat (limited to 'mixgtk')
-rw-r--r--mixgtk/mixgtk_wm.c84
-rw-r--r--mixgtk/mixgtk_wm.h5
2 files changed, 43 insertions, 46 deletions
diff --git a/mixgtk/mixgtk_wm.c b/mixgtk/mixgtk_wm.c
index ec7c247..4ee3193 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.9 2004/06/30 22:46:15 jao Exp $
+ * $Id: mixgtk_wm.c,v 1.10 2004/07/02 00:13:15 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
*
@@ -43,7 +43,6 @@ typedef struct window_info_t_
const gchar *menu_name;
const gchar *config_key;
gboolean detached;
- const gchar *toolbar_name;
void (*detach) (void);
void (*attach) (void);
} window_info_t_;
@@ -73,6 +72,7 @@ static void init_visibility_ (void);
static void init_tb_ (void);
static void init_about_ (void);
static void init_autosave_ (void);
+static void show_toolbars_ (gboolean show);
static void add_page_ (GtkWidget *w, mixgtk_window_id_t id);
static void mixvm_attach_ (void);
static void mixvm_detach_ (void);
@@ -85,11 +85,11 @@ static void on_nb_switch_ (GtkNotebook *notebook, GtkWidget *page,
static window_info_t_ infos_[] = {
{MIXGTK_MIXVM_DIALOG, NULL, NULL, "detach_vm", "MIX.detach",
- FALSE, "mixvm_toolbar", mixvm_detach_, mixvm_attach_},
+ FALSE, mixvm_detach_, mixvm_attach_},
{MIXGTK_MIXAL_DIALOG, NULL, NULL, "detach_source", "MIXAL.detach",
- FALSE, "mixal_toolbar", mixal_detach_, mixal_attach_},
+ FALSE, mixal_detach_, mixal_attach_},
{MIXGTK_DEVICES_DIALOG, NULL, NULL, "detach_dev", "Devices.detach",
- FALSE, "devices_toolbar", dev_detach_, dev_attach_}
+ FALSE, dev_detach_, dev_attach_}
};
static size_t INF_NO_ = sizeof (infos_) / sizeof (infos_[0]);
@@ -160,36 +160,6 @@ mixgtk_wm_attach_window (mixgtk_window_id_t w)
}
}
-void
-mixgtk_wm_show_toolbars (gboolean show)
-{
- static const gchar *MAIN_TB_NAME = "main_toolbar";
- int k;
-
- GtkWidget *toolbar =
- mixgtk_widget_factory_get_child_by_name (MIXGTK_MAIN, MAIN_TB_NAME);
-
- if (toolbar != NULL)
- {
- if (show) gtk_widget_show (toolbar);
- else gtk_widget_hide (toolbar);
- }
-
- for (k = 0; k < INF_NO_; ++k)
- {
- if (infos_[k].toolbar_name != NULL)
- {
- GtkWidget *tb = mixgtk_widget_factory_get_child_by_name
- (infos_[k].dialog, infos_[k].toolbar_name);
- if (tb)
- {
- if (show) gtk_widget_show (tb); else gtk_widget_hide (tb);
- }
- }
- }
-
- mixgtk_config_set_show_toolbars (show);
-}
/* callbacks */
@@ -208,6 +178,14 @@ on_detach_clicked (GtkWidget *ignored)
}
void
+on_attach_all_clicked ()
+{
+ gint k;
+ for (k = INF_NO_; k > 0; --k)
+ if (infos_[k - 1].detached) mixgtk_wm_attach_window (k - 1);
+}
+
+void
on_attach_toggled (GtkCheckMenuItem *item)
{
gint k;
@@ -234,7 +212,7 @@ void
on_show_toolbars_toggled (GtkCheckMenuItem *item)
{
if (item->active != mixgtk_config_show_toolbars ())
- mixgtk_wm_show_toolbars (item->active);
+ show_toolbars_ (item->active);
}
void
@@ -278,11 +256,6 @@ init_notebook_ (void)
GTK_NOTEBOOK (mixgtk_widget_factory_get (MIXGTK_MAIN,
MIXGTK_WIDGET_NOTEBOOK));
g_assert (notebook_ != NULL);
-
- gtk_notebook_set_tab_pos (notebook_, GTK_POS_TOP);
- gtk_notebook_popup_disable (notebook_);
- gtk_notebook_remove_page (notebook_, 0);
-
gtk_widget_show (GTK_WIDGET (notebook_));
}
@@ -451,13 +424,38 @@ init_tb_ (void)
g_assert (tb_menu_ != NULL);
gtk_check_menu_item_set_active (tb_menu_, mixgtk_config_show_toolbars ());
- mixgtk_wm_show_toolbars (mixgtk_config_show_toolbars ());
+ show_toolbars_ (mixgtk_config_show_toolbars ());
g_signal_connect (G_OBJECT (tb_menu_), "toggled",
G_CALLBACK (on_show_toolbars_toggled), NULL);
}
static void
+show_toolbars_ (gboolean show)
+{
+ static const gchar *HANDLE_NAME = "tb_handle";
+
+ int k;
+
+ GtkWidget *handle =
+ mixgtk_widget_factory_get_child_by_name (MIXGTK_MAIN, HANDLE_NAME);
+
+ if (show)
+ gtk_widget_show (handle);
+ else
+ gtk_widget_hide (handle);
+
+ for (k = 0; k < INF_NO_; ++k)
+ {
+ GtkWidget *hd =
+ mixgtk_widget_factory_get_child_by_name (infos_[k].dialog, HANDLE_NAME);
+ if (show) gtk_widget_show (hd); else gtk_widget_hide (hd);
+ }
+
+ mixgtk_config_set_show_toolbars (show);
+}
+
+static void
init_autosave_ (void)
{
#define AUTOSAVE_ITEM_ "save_on_exit"
@@ -562,3 +560,5 @@ on_nb_switch_ (GtkNotebook *notebook, GtkWidget *page,
&& (page != infos_[MIXGTK_MIXAL_WINDOW].widget))
mixgtk_mixal_pop_status ();
}
+
+
diff --git a/mixgtk/mixgtk_wm.h b/mixgtk/mixgtk_wm.h
index c186b33..b6faf6e 100644
--- a/mixgtk/mixgtk_wm.h
+++ b/mixgtk/mixgtk_wm.h
@@ -1,7 +1,7 @@
/* -*-c-*- ---------------- mixgtk_wm.h :
* Functions for window management
* ------------------------------------------------------------------
- * $Id: mixgtk_wm.h,v 1.3 2004/06/30 14:07:51 jao Exp $
+ * $Id: mixgtk_wm.h,v 1.4 2004/07/02 00:13:16 jao Exp $
* ------------------------------------------------------------------
* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
*
@@ -42,8 +42,5 @@ mixgtk_wm_attach_window (mixgtk_window_id_t w);
extern void
mixgtk_wm_detach_window (mixgtk_window_id_t w);
-extern void
-mixgtk_wm_show_toolbars (gboolean show);
-
#endif /* MIXGTK_WM_H */