diff options
author | John Stebbins <[email protected]> | 2015-10-06 10:41:26 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2015-10-06 10:41:26 -0700 |
commit | b1297b9204a47c9081f9299ff1f4ea7f7bb4da16 (patch) | |
tree | 9a6a38401d33a04580d4b0a689a5262870199ec4 /gtk/src/preview.c | |
parent | f311cb5e081a931eb68a2590e4e16241d28123ce (diff) |
LinGui: improve behavior of queue, preview, and activity toggles
Put "View" menu items in the same order as toolbar toggle buttons.
Make "View" menu items check boxes that mirror toolbar buttons.
Change the label of the toolbar buttons to "Hide *" when activated and
"Show *" when deactivated.
Diffstat (limited to 'gtk/src/preview.c')
-rw-r--r-- | gtk/src/preview.c | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/gtk/src/preview.c b/gtk/src/preview.c index 656bd18a5..e567b7af0 100644 --- a/gtk/src/preview.c +++ b/gtk/src/preview.c @@ -1221,13 +1221,16 @@ ghb_preview_set_visible(signal_user_data_t *ud) { gint title_id, titleindex; const hb_title_t *title; + GtkToggleToolButton *button; GtkWidget *widget; gboolean active; + button = GTK_TOGGLE_TOOL_BUTTON(GHB_WIDGET(ud->builder, "show_preview")); + active = gtk_toggle_tool_button_get_active(button); + title_id = ghb_dict_get_int(ud->settings, "title"); title = ghb_lookup_title(title_id, &titleindex); - active = ghb_dict_get_bool(ud->globals, "show_preview") && - title != NULL; + active &= title != NULL; widget = GHB_WIDGET(ud->builder, "preview_window"); gtk_widget_set_visible(widget, active); if (active) @@ -1240,25 +1243,47 @@ ghb_preview_set_visible(signal_user_data_t *ud) } } +static void +update_preview_labels(signal_user_data_t *ud, gboolean active) +{ + GtkToolButton *button; + + button = GTK_TOOL_BUTTON(GHB_WIDGET(ud->builder, "show_preview")); + + if (!active) + { + gtk_tool_button_set_label(button, "Show\nPreview"); + } + else + { + gtk_tool_button_set_label(button, "Hide\nPreview"); + } +} + G_MODULE_EXPORT void -picture_settings_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +preview_toggled_cb(GtkWidget *xwidget, signal_user_data_t *ud) { - g_debug("picture_settings_clicked_cb()"); - ghb_widget_to_setting(ud->globals, xwidget); + GtkCheckMenuItem *menuitem; + gboolean active; + active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(xwidget)); ghb_preview_set_visible(ud); + update_preview_labels(ud, active); + + menuitem = GTK_CHECK_MENU_ITEM(GHB_WIDGET(ud->builder, + "show_preview_menu")); + gtk_check_menu_item_set_active(menuitem, active); } G_MODULE_EXPORT void -picture_settings_alt_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +preview_menu_toggled_cb(GtkWidget *xwidget, signal_user_data_t *ud) { - GtkWidget *toggle; + GtkToggleToolButton *button; gboolean active; - g_debug("picture_settings_alt_clicked_cb()"); - toggle = GHB_WIDGET (ud->builder, "show_preview"); - active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toggle)); - gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(toggle), !active); + active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(xwidget)); + button = GTK_TOGGLE_TOOL_BUTTON(GHB_WIDGET(ud->builder, "show_preview")); + gtk_toggle_tool_button_set_active(button, active); } static gboolean |