summaryrefslogtreecommitdiffstats
path: root/gtk/src/callbacks.c
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2015-10-06 10:41:26 -0700
committerJohn Stebbins <[email protected]>2015-10-06 10:41:26 -0700
commitb1297b9204a47c9081f9299ff1f4ea7f7bb4da16 (patch)
tree9a6a38401d33a04580d4b0a689a5262870199ec4 /gtk/src/callbacks.c
parentf311cb5e081a931eb68a2590e4e16241d28123ce (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/callbacks.c')
-rw-r--r--gtk/src/callbacks.c94
1 files changed, 75 insertions, 19 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 6c8dc88e4..ac184ee29 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -3696,21 +3696,49 @@ ghb_log_cb(GIOChannel *source, GIOCondition cond, gpointer data)
return TRUE;
}
+static void
+update_activity_labels(signal_user_data_t *ud, gboolean active)
+{
+ GtkToolButton *button;
+
+ button = GTK_TOOL_BUTTON(GHB_WIDGET(ud->builder, "show_activity"));
+
+ if (!active)
+ {
+ gtk_tool_button_set_label(button, "Show\nActivity");
+ }
+ else
+ {
+ gtk_tool_button_set_label(button, "Hide\nActivity");
+ }
+}
+
G_MODULE_EXPORT void
-show_activity_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+show_activity_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window");
- gtk_widget_set_visible(widget, gtk_toggle_tool_button_get_active(
- GTK_TOGGLE_TOOL_BUTTON(xwidget)));
+ GtkWidget *activity_window;
+ GtkCheckMenuItem *menuitem;
+ gboolean active;
+
+ active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget));
+ activity_window = GHB_WIDGET(ud->builder, "activity_window");
+ gtk_widget_set_visible(activity_window, active);
+ update_activity_labels(ud, active);
+
+ menuitem = GTK_CHECK_MENU_ITEM(GHB_WIDGET(ud->builder,
+ "show_activity_menu"));
+ gtk_check_menu_item_set_active(menuitem, active);
}
G_MODULE_EXPORT void
-show_activity_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+show_activity_menu_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window");
- gtk_widget_set_visible(widget, TRUE);
- widget = GHB_WIDGET (ud->builder, "show_activity");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
+ GtkToggleToolButton *button;
+ gboolean active;
+
+ active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+ button = GTK_TOGGLE_TOOL_BUTTON(GHB_WIDGET(ud->builder, "show_activity"));
+ gtk_toggle_tool_button_set_active(button, active);
}
G_MODULE_EXPORT gboolean
@@ -3814,25 +3842,53 @@ hb_about_response_cb(GtkWidget *widget, gint response, signal_user_data_t *ud)
gtk_widget_hide (widget);
}
+static void
+update_queue_labels(signal_user_data_t *ud, gboolean active)
+{
+ GtkToolButton *button;
+
+ button = GTK_TOOL_BUTTON(GHB_WIDGET(ud->builder, "show_queue"));
+
+ if (!active)
+ {
+ gtk_tool_button_set_label(button, "Show\nQueue");
+ }
+ else
+ {
+ gtk_tool_button_set_label(button, "Hide\nQueue");
+ }
+}
+
G_MODULE_EXPORT void
-show_queue_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+show_queue_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GtkWidget *widget;
- GtkStack *stack;
+ GtkWidget *tab;
+ GtkCheckMenuItem *menuitem;
+ GtkStack *stack;
+ gboolean active;
+ active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget));
stack = GTK_STACK(GHB_WIDGET(ud->builder, "QueueStack"));
- if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(xwidget)))
- widget = GHB_WIDGET(ud->builder, "queue_tab");
+ if (active)
+ tab = GHB_WIDGET(ud->builder, "queue_tab");
else
- widget = GHB_WIDGET(ud->builder, "settings_tab");
- gtk_stack_set_visible_child(stack, widget);
+ tab = GHB_WIDGET(ud->builder, "settings_tab");
+ gtk_stack_set_visible_child(stack, tab);
+ update_queue_labels(ud, active);
+
+ menuitem = GTK_CHECK_MENU_ITEM(GHB_WIDGET(ud->builder, "show_queue_menu"));
+ gtk_check_menu_item_set_active(menuitem, active);
}
G_MODULE_EXPORT void
-show_queue_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+show_queue_menu_toggled_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- GtkWidget *widget = GHB_WIDGET(ud->builder, "show_queue");
- gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE);
+ GtkToggleToolButton *button;
+ gboolean active;
+
+ active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+ button = GTK_TOGGLE_TOOL_BUTTON(GHB_WIDGET(ud->builder, "show_queue"));
+ gtk_toggle_tool_button_set_active(button, active);
}
G_MODULE_EXPORT void