summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--gtk/src/callbacks.c94
-rw-r--r--gtk/src/ghb-3.12.ui33
-rw-r--r--gtk/src/ghb-3.14.ui33
-rw-r--r--gtk/src/ghb.ui33
-rw-r--r--gtk/src/preview.c47
5 files changed, 165 insertions, 75 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
diff --git a/gtk/src/ghb-3.12.ui b/gtk/src/ghb-3.12.ui
index 542a4a3aa..222743e5d 100644
--- a/gtk/src/ghb-3.12.ui
+++ b/gtk/src/ghb-3.12.ui
@@ -745,30 +745,30 @@ libx264 authors:
</object>
</child>
<child>
- <object class="GtkMenuItem" id="show_preview_menu">
- <property name="label" translatable="yes">_Preview</property>
+ <object class="GtkCheckMenuItem" id="show_queue_menu">
+ <property name="label" translatable="yes">_Queue</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="picture_settings_alt_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_queue_menu_toggled_cb" swapped="no"/>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="show_activity_menu">
- <property name="label" translatable="yes">_Activity Window</property>
+ <object class="GtkCheckMenuItem" id="show_preview_menu">
+ <property name="label" translatable="yes">_Preview</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="show_activity_menu_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="preview_menu_toggled_cb" swapped="no"/>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="show_queue_menu">
- <property name="label" translatable="yes">Show _Queue</property>
+ <object class="GtkCheckMenuItem" id="show_activity_menu">
+ <property name="label" translatable="yes">_Activity Window</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="show_queue_menu_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_activity_menu_toggled_cb" swapped="no"/>
</object>
</child>
</object>
@@ -985,9 +985,10 @@ libx264 authors:
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip_text" translatable="yes">Show Queue</property>
<property name="is_important">True</property>
- <property name="label" translatable="yes">Queue</property>
+ <property name="label" translatable="yes">Show
+Queue</property>
<property name="icon_name">hb-showqueue</property>
- <signal name="toggled" handler="show_queue_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_queue_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -1002,9 +1003,10 @@ libx264 authors:
<property name="tooltip_text" translatable="yes">Open Picture Settings and Preview window.
Here you can adjust cropping, resolution, aspect ratio, and filters.</property>
<property name="is_important">True</property>
- <property name="label" translatable="yes">Preview</property>
+ <property name="label" translatable="yes">Show
+Preview</property>
<property name="icon_name">hb-picture</property>
- <signal name="toggled" handler="picture_settings_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="preview_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -1018,9 +1020,10 @@ Here you can adjust cropping, resolution, aspect ratio, and filters.</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip_text" translatable="yes">Show Activity Window</property>
<property name="is_important">True</property>
- <property name="label" translatable="yes">Activity</property>
+ <property name="label" translatable="yes">Show
+Activity</property>
<property name="icon_name">hb-activity</property>
- <signal name="toggled" handler="show_activity_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_activity_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/gtk/src/ghb-3.14.ui b/gtk/src/ghb-3.14.ui
index a074f81a5..de6ca5653 100644
--- a/gtk/src/ghb-3.14.ui
+++ b/gtk/src/ghb-3.14.ui
@@ -746,30 +746,30 @@ libx264 authors:
</object>
</child>
<child>
- <object class="GtkMenuItem" id="show_preview_menu">
- <property name="label" translatable="yes">_Preview</property>
+ <object class="GtkCheckMenuItem" id="show_queue_menu">
+ <property name="label" translatable="yes">_Queue</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="picture_settings_alt_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_queue_menu_toggled_cb" swapped="no"/>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="show_activity_menu">
- <property name="label" translatable="yes">_Activity Window</property>
+ <object class="GtkCheckMenuItem" id="show_preview_menu">
+ <property name="label" translatable="yes">_Preview</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="show_activity_menu_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="preview_menu_toggled_cb" swapped="no"/>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="show_queue_menu">
- <property name="label" translatable="yes">Show _Queue</property>
+ <object class="GtkCheckMenuItem" id="show_activity_menu">
+ <property name="label" translatable="yes">_Activity Window</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="show_queue_menu_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_activity_menu_toggled_cb" swapped="no"/>
</object>
</child>
</object>
@@ -986,9 +986,10 @@ libx264 authors:
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip_text" translatable="yes">Show Queue</property>
<property name="is_important">True</property>
- <property name="label" translatable="yes">Queue</property>
+ <property name="label" translatable="yes">Show
+Queue</property>
<property name="icon_name">hb-showqueue</property>
- <signal name="toggled" handler="show_queue_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_queue_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -1003,9 +1004,10 @@ libx264 authors:
<property name="tooltip_text" translatable="yes">Open Picture Settings and Preview window.
Here you can adjust cropping, resolution, aspect ratio, and filters.</property>
<property name="is_important">True</property>
- <property name="label" translatable="yes">Preview</property>
+ <property name="label" translatable="yes">Show
+Preview</property>
<property name="icon_name">hb-picture</property>
- <signal name="toggled" handler="picture_settings_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="preview_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -1019,9 +1021,10 @@ Here you can adjust cropping, resolution, aspect ratio, and filters.</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip_text" translatable="yes">Show Activity Window</property>
<property name="is_important">True</property>
- <property name="label" translatable="yes">Activity</property>
+ <property name="label" translatable="yes">Show
+Activity</property>
<property name="icon_name">hb-activity</property>
- <signal name="toggled" handler="show_activity_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_activity_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui
index 5ae9fdd64..ee4678b35 100644
--- a/gtk/src/ghb.ui
+++ b/gtk/src/ghb.ui
@@ -745,30 +745,30 @@ libx264 authors:
</object>
</child>
<child>
- <object class="GtkMenuItem" id="show_preview_menu">
- <property name="label" translatable="yes">_Preview</property>
+ <object class="GtkCheckMenuItem" id="show_queue_menu">
+ <property name="label" translatable="yes">_Queue</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="picture_settings_alt_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_queue_menu_toggled_cb" swapped="no"/>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="show_activity_menu">
- <property name="label" translatable="yes">_Activity Window</property>
+ <object class="GtkCheckMenuItem" id="show_preview_menu">
+ <property name="label" translatable="yes">_Preview</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="show_activity_menu_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="preview_menu_toggled_cb" swapped="no"/>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="show_queue_menu">
- <property name="label" translatable="yes">Show _Queue</property>
+ <object class="GtkCheckMenuItem" id="show_activity_menu">
+ <property name="label" translatable="yes">_Activity Window</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="show_queue_menu_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_activity_menu_toggled_cb" swapped="no"/>
</object>
</child>
</object>
@@ -985,9 +985,10 @@ libx264 authors:
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip_text" translatable="yes">Show Queue</property>
<property name="is_important">True</property>
- <property name="label" translatable="yes">Queue</property>
+ <property name="label" translatable="yes">Show
+Queue</property>
<property name="icon_name">hb-showqueue</property>
- <signal name="toggled" handler="show_queue_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_queue_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -1002,9 +1003,10 @@ libx264 authors:
<property name="tooltip_text" translatable="yes">Open Picture Settings and Preview window.
Here you can adjust cropping, resolution, aspect ratio, and filters.</property>
<property name="is_important">True</property>
- <property name="label" translatable="yes">Preview</property>
+ <property name="label" translatable="yes">Show
+Preview</property>
<property name="icon_name">hb-picture</property>
- <signal name="toggled" handler="picture_settings_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="preview_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@@ -1018,9 +1020,10 @@ Here you can adjust cropping, resolution, aspect ratio, and filters.</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip_text" translatable="yes">Show Activity Window</property>
<property name="is_important">True</property>
- <property name="label" translatable="yes">Activity</property>
+ <property name="label" translatable="yes">Show
+Activity</property>
<property name="icon_name">hb-activity</property>
- <signal name="toggled" handler="show_activity_clicked_cb" swapped="no"/>
+ <signal name="toggled" handler="show_activity_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
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