diff options
author | jstebbins <[email protected]> | 2009-01-08 22:44:02 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-01-08 22:44:02 +0000 |
commit | 24374882ef39dc1aa921c1ed3a93ee18b1866752 (patch) | |
tree | e924e60bf989cd60ea9f58615fae78a960737bdb /gtk/src | |
parent | 979826e24b3f187c3b488da47b720234c93f293d (diff) |
LinGui: make the activity, queue, and picture tool bar buttons into toggles
pressing while the corresponding window is displayed hides the window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2070 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src')
-rw-r--r-- | gtk/src/callbacks.c | 70 | ||||
-rw-r--r-- | gtk/src/ghb.ui | 24 | ||||
-rw-r--r-- | gtk/src/preview.c | 31 | ||||
-rw-r--r-- | gtk/src/resource_data.h | 38 | ||||
-rw-r--r-- | gtk/src/resources.plist | 24 |
5 files changed, 121 insertions, 66 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 74b982e2a..9944033da 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -1972,11 +1972,43 @@ ghb_log_cb(GIOChannel *source, GIOCondition cond, gpointer data) return TRUE; } +static void +set_visible(GtkWidget *widget, gboolean visible) +{ + if (visible) + { + gtk_widget_show_now(widget); + } + else + { + gtk_widget_hide(widget); + } +} + void show_activity_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window"); - gtk_widget_show (widget); + set_visible(widget, gtk_toggle_tool_button_get_active( + GTK_TOGGLE_TOOL_BUTTON(xwidget))); +} + +void +show_activity_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +{ + GtkWidget *widget = GHB_WIDGET (ud->builder, "activity_window"); + set_visible(widget, TRUE); + widget = GHB_WIDGET (ud->builder, "show_activity"); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE); +} + +gboolean +activity_window_delete_cb(GtkWidget *xwidget, GdkEvent *event, signal_user_data_t *ud) +{ + set_visible(xwidget, FALSE); + GtkWidget *widget = GHB_WIDGET (ud->builder, "show_activity"); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE); + return TRUE; } void @@ -2050,7 +2082,26 @@ void show_queue_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window"); - gtk_widget_show (widget); + set_visible(widget, gtk_toggle_tool_button_get_active( + GTK_TOGGLE_TOOL_BUTTON(xwidget))); +} + +void +show_queue_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +{ + GtkWidget *widget = GHB_WIDGET (ud->builder, "queue_window"); + set_visible(widget, TRUE); + widget = GHB_WIDGET (ud->builder, "show_queue"); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE); +} + +gboolean +queue_window_delete_cb(GtkWidget *xwidget, GdkEvent *event, signal_user_data_t *ud) +{ + set_visible(xwidget, FALSE); + GtkWidget *widget = GHB_WIDGET (ud->builder, "show_queue"); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE); + return TRUE; } void @@ -2252,19 +2303,6 @@ debug_log_handler(const gchar *domain, GLogLevelFlags flags, const gchar *msg, g } } -static void -set_visible(GtkWidget *widget, gboolean visible) -{ - if (visible) - { - gtk_widget_show_now(widget); - } - else - { - gtk_widget_hide(widget); - } -} - void ghb_hbfd(signal_user_data_t *ud, gboolean hbfd) { @@ -2289,8 +2327,6 @@ ghb_hbfd(signal_user_data_t *ud, gboolean hbfd) set_visible(widget, !hbfd); widget = GHB_WIDGET(ud->builder, "presets_remove"); set_visible(widget, !hbfd); - widget = GHB_WIDGET(ud->builder, "presets_default"); - set_visible(widget, !hbfd); widget = GHB_WIDGET (ud->builder, "hb_window"); gtk_window_resize(GTK_WINDOW(widget), 16, 16); diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 9971feb6b..9d69a29e4 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -293,7 +293,7 @@ <property name="icon-name">hb-picture</property> <property name="name">show_preview_menu</property> <property name="label" translatable="yes">_Picture Settings</property> - <signal handler="preview_button_clicked_cb" name="activate"/> + <signal handler="preview_menu_clicked_cb" name="activate"/> </object> </child> <child> @@ -301,7 +301,7 @@ <property name="icon-name">hb-activity</property> <property name="name">show_activity_menu</property> <property name="label" translatable="yes">_Activity Window</property> - <signal handler="show_activity_clicked_cb" name="activate"/> + <signal handler="show_activity_menu_clicked_cb" name="activate"/> </object> </child> <child> @@ -309,7 +309,7 @@ <property name="icon-name">hb-queue</property> <property name="name">show_queue_menu</property> <property name="label" translatable="yes">Show _Queue</property> - <signal handler="show_queue_clicked_cb" name="activate"/> + <signal handler="show_queue_menu_clicked_cb" name="activate"/> </object> </child> <child> @@ -446,39 +446,39 @@ </packing> </child> <child> - <object class="GtkToolButton" id="show_queue"> + <object class="GtkToggleToolButton" id="show_queue"> <property name="visible">True</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 Queue</property> <property name="label" translatable="yes">Show Queue</property> <property name="icon_name">hb-queue</property> - <signal handler="show_queue_clicked_cb" name="clicked"/> + <signal handler="show_queue_clicked_cb" name="toggled"/> </object> <packing> <property name="expand">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="show_picture"> + <object class="GtkToggleToolButton" id="show_picture"> <property name="visible">True</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">Open Picture Settings</property> <property name="label" translatable="yes">Picture Settings</property> <property name="icon_name">hb-picture</property> - <signal name="clicked" handler="preview_button_clicked_cb"/> + <signal name="toggled" handler="preview_button_clicked_cb"/> </object> <packing> <property name="expand">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="show_activity"> + <object class="GtkToggleToolButton" id="show_activity"> <property name="visible">True</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="label" translatable="yes">Activity Window</property> <property name="icon_name">hb-activity</property> - <signal handler="show_activity_clicked_cb" name="clicked"/> + <signal handler="show_activity_clicked_cb" name="toggled"/> </object> <packing> <property name="expand">False</property> @@ -762,7 +762,7 @@ </packing> </child> <child> - <object class="GtkTable" id="table1"> + <object class="GtkTable" id="container_box"> <property name="visible">True</property> <property name="n_rows">2</property> <property name="n_columns">2</property> @@ -3673,7 +3673,7 @@ location as the movie.</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="skip_taskbar_hint">True</property> <property name="skip_pager_hint">True</property> - <signal handler="gtk_widget_hide_on_delete" name="delete_event"/> + <signal handler="activity_window_delete_cb" name="delete_event"/> <child> <object class="GtkVBox" id="vbox37"> <property name="visible">True</property> @@ -3728,7 +3728,7 @@ location as the movie.</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="skip_taskbar_hint">True</property> <property name="skip_pager_hint">True</property> - <signal handler="gtk_widget_hide_on_delete" name="delete_event"/> + <signal handler="queue_window_delete_cb" name="delete_event"/> <child> <object class="GtkVBox" id="vbox34"> <property name="visible">True</property> diff --git a/gtk/src/preview.c b/gtk/src/preview.c index d032b9115..d9abf248f 100644 --- a/gtk/src/preview.c +++ b/gtk/src/preview.c @@ -737,17 +737,34 @@ preview_button_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, si ghb_set_preview_image(ud); } +static void +set_visible(GtkWidget *widget, gboolean visible) +{ + if (visible) + { + gtk_widget_show_now(widget); + } + else + { + gtk_widget_hide(widget); + } +} + void preview_button_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { - gint titleindex; - - titleindex = ghb_settings_combo_int(ud->settings, "title"); - if (titleindex < 0) return; - g_debug("titleindex %d", titleindex); + GtkWidget *widget = GHB_WIDGET (ud->builder, "preview_window"); + set_visible(widget, gtk_toggle_tool_button_get_active( + GTK_TOGGLE_TOOL_BUTTON(xwidget))); +} +void +preview_menu_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +{ GtkWidget *widget = GHB_WIDGET (ud->builder, "preview_window"); - gtk_widget_show (widget); + set_visible(widget, TRUE); + widget = GHB_WIDGET (ud->builder, "show_picture"); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE); } void @@ -770,6 +787,8 @@ preview_window_delete_cb( { live_preview_stop(ud); gtk_widget_hide(widget); + widget = GHB_WIDGET (ud->builder, "show_picture"); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE); return TRUE; } diff --git a/gtk/src/resource_data.h b/gtk/src/resource_data.h index a25fd01b3..fdbf9ff7f 100644 --- a/gtk/src/resource_data.h +++ b/gtk/src/resource_data.h @@ -412,8 +412,8 @@ "/property>\n" " <property name="label" translatable="yes&" "quot;>_Picture Settings</property>\n" -" <signal handler="preview_button_clicked_cb" na" -"me="activate"/>\n" +" <signal handler="preview_menu_clicked_cb" name" +"="activate"/>\n" " </object>\n" " </child>\n" " <child>\n" @@ -425,8 +425,8 @@ ";/property>\n" " <property name="label" translatable="yes&" "quot;>_Activity Window</property>\n" -" <signal handler="show_activity_clicked_cb" nam" -"e="activate"/>\n" +" <signal handler="show_activity_menu_clicked_cb"" +"; name="activate"/>\n" " </object>\n" " </child>\n" " <child>\n" @@ -438,8 +438,8 @@ "roperty>\n" " <property name="label" translatable="yes&" "quot;>Show _Queue</property>\n" -" <signal handler="show_queue_clicked_cb" name=&" -"quot;activate"/>\n" +" <signal handler="show_queue_menu_clicked_cb" n" +"ame="activate"/>\n" " </object>\n" " </child>\n" " <child>\n" @@ -642,8 +642,8 @@ " </packing>\n" " </child>\n" " <child>\n" -" <object class="GtkToolButton" id="show_" -"queue">\n" +" <object class="GtkToggleToolButton" id="" +";show_queue">\n" " <property name="visible">True</prope" "rty>\n" " <property name="events">GDK_POINTER_MOT" @@ -656,7 +656,7 @@ " <property name="icon_name">hb-queue<" "/property>\n" " <signal handler="show_queue_clicked_cb" na" -"me="clicked"/>\n" +"me="toggled"/>\n" " </object>\n" " <packing>\n" " <property name="expand">False</prope" @@ -664,8 +664,8 @@ " </packing>\n" " </child>\n" " <child>\n" -" <object class="GtkToolButton" id="show_" -"picture">\n" +" <object class="GtkToggleToolButton" id="" +";show_picture">\n" " <property name="visible">True</prope" "rty>\n" " <property name="events">GDK_POINTER_MOT" @@ -677,7 +677,7 @@ "yes">Picture Settings</property>\n" " <property name="icon_name">hb-picture&l" "t;/property>\n" -" <signal name="clicked" handler="previ" +" <signal name="toggled" handler="previ" "ew_button_clicked_cb"/>\n" " </object>\n" " <packing>\n" @@ -686,8 +686,8 @@ " </packing>\n" " </child>\n" " <child>\n" -" <object class="GtkToolButton" id="show_" -"activity">\n" +" <object class="GtkToggleToolButton" id="" +";show_activity">\n" " <property name="visible">True</prope" "rty>\n" " <property name="events">GDK_POINTER_MOT" @@ -700,7 +700,7 @@ " <property name="icon_name">hb-activity&" "lt;/property>\n" " <signal handler="show_activity_clicked_cb"" -" name="clicked"/>\n" +" name="toggled"/>\n" " </object>\n" " <packing>\n" " <property name="expand">False</prope" @@ -1152,7 +1152,7 @@ " </child>\n" " <child>\n" " <object class="GtkTable" id=" -""table1">\n" +""container_box">\n" " <property name="visible"&g" "t;True</property>\n" " <property name="n_rows">" @@ -5982,7 +5982,7 @@ "y>\n" " <property name="skip_pager_hint">True</property&" "gt;\n" -" <signal handler="gtk_widget_hide_on_delete" name="" +" <signal handler="activity_window_delete_cb" name="" ";delete_event"/>\n" " <child>\n" " <object class="GtkVBox" id="vbox37">\n" @@ -6071,8 +6071,8 @@ "y>\n" " <property name="skip_pager_hint">True</property&" "gt;\n" -" <signal handler="gtk_widget_hide_on_delete" name="" -";delete_event"/>\n" +" <signal handler="queue_window_delete_cb" name="de" +"lete_event"/>\n" " <child>\n" " <object class="GtkVBox" id="vbox34">\n" " <property name="visible">True</property>\n" diff --git a/gtk/src/resources.plist b/gtk/src/resources.plist index b12ce36f7..b0c415ae7 100644 --- a/gtk/src/resources.plist +++ b/gtk/src/resources.plist @@ -298,7 +298,7 @@ <property name="icon-name">hb-picture</property> <property name="name">show_preview_menu</property> <property name="label" translatable="yes">_Picture Settings</property> - <signal handler="preview_button_clicked_cb" name="activate"/> + <signal handler="preview_menu_clicked_cb" name="activate"/> </object> </child> <child> @@ -306,7 +306,7 @@ <property name="icon-name">hb-activity</property> <property name="name">show_activity_menu</property> <property name="label" translatable="yes">_Activity Window</property> - <signal handler="show_activity_clicked_cb" name="activate"/> + <signal handler="show_activity_menu_clicked_cb" name="activate"/> </object> </child> <child> @@ -314,7 +314,7 @@ <property name="icon-name">hb-queue</property> <property name="name">show_queue_menu</property> <property name="label" translatable="yes">Show _Queue</property> - <signal handler="show_queue_clicked_cb" name="activate"/> + <signal handler="show_queue_menu_clicked_cb" name="activate"/> </object> </child> <child> @@ -451,39 +451,39 @@ </packing> </child> <child> - <object class="GtkToolButton" id="show_queue"> + <object class="GtkToggleToolButton" id="show_queue"> <property name="visible">True</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 Queue</property> <property name="label" translatable="yes">Show Queue</property> <property name="icon_name">hb-queue</property> - <signal handler="show_queue_clicked_cb" name="clicked"/> + <signal handler="show_queue_clicked_cb" name="toggled"/> </object> <packing> <property name="expand">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="show_picture"> + <object class="GtkToggleToolButton" id="show_picture"> <property name="visible">True</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">Open Picture Settings</property> <property name="label" translatable="yes">Picture Settings</property> <property name="icon_name">hb-picture</property> - <signal name="clicked" handler="preview_button_clicked_cb"/> + <signal name="toggled" handler="preview_button_clicked_cb"/> </object> <packing> <property name="expand">False</property> </packing> </child> <child> - <object class="GtkToolButton" id="show_activity"> + <object class="GtkToggleToolButton" id="show_activity"> <property name="visible">True</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="label" translatable="yes">Activity Window</property> <property name="icon_name">hb-activity</property> - <signal handler="show_activity_clicked_cb" name="clicked"/> + <signal handler="show_activity_clicked_cb" name="toggled"/> </object> <packing> <property name="expand">False</property> @@ -767,7 +767,7 @@ </packing> </child> <child> - <object class="GtkTable" id="table1"> + <object class="GtkTable" id="container_box"> <property name="visible">True</property> <property name="n_rows">2</property> <property name="n_columns">2</property> @@ -3678,7 +3678,7 @@ location as the movie.</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="skip_taskbar_hint">True</property> <property name="skip_pager_hint">True</property> - <signal handler="gtk_widget_hide_on_delete" name="delete_event"/> + <signal handler="activity_window_delete_cb" name="delete_event"/> <child> <object class="GtkVBox" id="vbox37"> <property name="visible">True</property> @@ -3733,7 +3733,7 @@ location as the movie.</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="skip_taskbar_hint">True</property> <property name="skip_pager_hint">True</property> - <signal handler="gtk_widget_hide_on_delete" name="delete_event"/> + <signal handler="queue_window_delete_cb" name="delete_event"/> <child> <object class="GtkVBox" id="vbox34"> <property name="visible">True</property> |