From: Philip Chimento Date: Fri, 4 Feb 2011 17:29:25 +0000 (+0100) Subject: Re-added toolbar with menu item to show or hide it X-Git-Tag: v0.9~145 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=f95649aae72dacb4b65d5a987ce0a41b467a3909;p=projects%2Fchimara%2Fchimara.git Re-added toolbar with menu item to show or hide it --- diff --git a/player/callbacks.c b/player/callbacks.c index 38629fe..86e85b6 100644 --- a/player/callbacks.c +++ b/player/callbacks.c @@ -184,6 +184,17 @@ on_preferences_activate(GtkAction *action, ChimaraGlk *glk) gtk_window_present(GTK_WINDOW(prefswindow)); } +void +on_toolbar_toggled(GtkToggleAction *action, ChimaraGlk *glk) +{ + extern GtkWidget *toolbar; + + if(gtk_toggle_action_get_active(action)) + gtk_widget_show(toolbar); + else + gtk_widget_hide(toolbar); +} + void on_undo_activate(GtkAction *action, ChimaraGlk *glk) { diff --git a/player/chimara.menus b/player/chimara.menus index 927bc82..7f28fd5 100644 --- a/player/chimara.menus +++ b/player/chimara.menus @@ -14,6 +14,9 @@ + + + diff --git a/player/chimara.ui b/player/chimara.ui index 8bb7fc6..d9d219c 100644 --- a/player/chimara.ui +++ b/player/chimara.ui @@ -3,6 +3,18 @@ + + + _Toolbar + Show a toolbar at the top of the window + + + + + + _View + + _About... diff --git a/player/main.c b/player/main.c index 9722235..85dba4e 100644 --- a/player/main.c +++ b/player/main.c @@ -55,6 +55,7 @@ static GtkWidget *glk = NULL; GtkBuilder *builder = NULL; GtkWidget *aboutwindow = NULL; GtkWidget *prefswindow = NULL; +GtkWidget *toolbar = NULL; GObject * load_object(const gchar *name) @@ -110,6 +111,7 @@ create_window(void) aboutwindow = GTK_WIDGET(load_object("aboutwindow")); prefswindow = GTK_WIDGET(load_object("prefswindow")); GtkActionGroup *actiongroup = GTK_ACTION_GROUP(load_object("actiongroup")); + GtkToggleAction *toolbar_action = GTK_TOGGLE_ACTION(load_object("toolbar")); const gchar **ptr; GtkRecentFilter *filter = gtk_recent_filter_new(); @@ -188,11 +190,16 @@ create_window(void) gtk_ui_manager_insert_action_group(uimanager, actiongroup, 0); GtkWidget *menubar = gtk_ui_manager_get_widget(uimanager, "/menubar"); - //GtkWidget *toolbar = gtk_ui_manager_get_widget(uimanager, "/toolbar"); + toolbar = gtk_ui_manager_get_widget(uimanager, "/toolbar"); + gtk_widget_set_no_show_all(toolbar, TRUE); + if(gtk_toggle_action_get_active(toolbar_action)) + gtk_widget_show(toolbar); + else + gtk_widget_hide(toolbar); gtk_box_pack_end(vbox, glk, TRUE, TRUE, 0); gtk_box_pack_start(vbox, menubar, FALSE, FALSE, 0); - //gtk_box_pack_start(vbox, toolbar, FALSE, FALSE, 0); + gtk_box_pack_start(vbox, toolbar, FALSE, FALSE, 0); gtk_builder_connect_signals(builder, glk); g_signal_connect(glk, "notify::program-name", G_CALLBACK(change_window_title), window);