diff options
author | jstebbins <[email protected]> | 2009-10-04 17:05:53 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-10-04 17:05:53 +0000 |
commit | 3021bb32dce28e276796d9eaaebbd3a85dc15f8c (patch) | |
tree | 4773e2b6b36fd4d36fe4aba892a9683791c9961e /gtk | |
parent | ce793fa5ebd19fafb38287bcb011e2c93ca32216 (diff) |
LinGui: modify the interaction between preview window and settings window
make hiding the settings window from the preview "settings" button
a separate state from the settings button in the main window. The "hidden"
status persists when you toggle the settings button in the main window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2866 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/ghb.ui | 6 | ||||
-rw-r--r-- | gtk/src/preview.c | 86 |
2 files changed, 27 insertions, 65 deletions
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index a6b8e0c33..eb4268f80 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -6139,11 +6139,11 @@ The classic deinterlace filter is applied to all frames. Frames that are not int </packing> </child> <child> - <object class="GtkButton" id="settings_button"> + <object class="GtkToggleButton" id="hide_settings"> <property name="visible">True</property> <property name="can_focus">True</property> - <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="label" translatable="yes">Settings</property> + <property name="tooltip-text" translatable="yes">Hide the picture settings window while leaving the preview visible.</property> + <property name="label" translatable="yes">Hide Settings</property> <signal handler="picture_settings_alt2_clicked_cb" name="clicked"/> </object> <packing> diff --git a/gtk/src/preview.c b/gtk/src/preview.c index ee522f7a8..577cbd557 100644 --- a/gtk/src/preview.c +++ b/gtk/src/preview.c @@ -858,18 +858,21 @@ preview_button_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) G_MODULE_EXPORT void picture_settings_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) { - GtkWidget *widget; - gboolean active; + GtkWidget *widget, *toggle; + gboolean active, hide_settings; gint x, y; g_debug("picture_settings_clicked_cb()"); + toggle = GHB_WIDGET (ud->builder, "hide_settings"); + hide_settings = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)); + widget = GHB_WIDGET (ud->builder, "settings_window"); active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(xwidget)); x = ghb_settings_get_int(ud->settings, "settings_x"); y = ghb_settings_get_int(ud->settings, "settings_y"); if (x >= 0 && y >= 0) gtk_window_move(GTK_WINDOW(widget), x, y); - set_visible(widget, active); + set_visible(widget, active && !hide_settings); if (ghb_settings_get_boolean(ud->settings, "show_preview")) { widget = GHB_WIDGET (ud->builder, "preview_window"); @@ -945,43 +948,25 @@ picture_settings_alt2_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) gboolean active; gint signal_id; gint handler_id = 0; + GtkWidget *window; g_debug("picture_settings_alt2_clicked_cb()"); - toggle = GHB_WIDGET (ud->builder, "show_picture"); - active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toggle)); - if (active) + toggle = GHB_WIDGET (ud->builder, "hide_settings"); + active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)); + window = GHB_WIDGET(ud->builder, "settings_window"); + if (!active) { - // I don't want deleting the settings window to also remove the - // preview window, but changing the toggle will do this, so temporarily - // ignore the toggled signal - signal_id = g_signal_lookup("toggled", GTK_TYPE_TOGGLE_TOOL_BUTTON); - if (signal_id > 0) - { - // Valid signal id found. This should always succeed. - handler_id = g_signal_handler_find((gpointer)toggle, - G_SIGNAL_MATCH_ID, - signal_id, 0, 0, 0, 0); - if (handler_id > 0) - { - // This should also always succeed - g_signal_handler_block ((gpointer)toggle, handler_id); - } - } + gtk_button_set_label(GTK_BUTTON(toggle), "Hide Settings"); + gtk_widget_set_tooltip_text(toggle, + "Hide the picture settings window while " + "leaving the preview visible."); + gtk_widget_show(window); } - - GtkWidget *widget = GHB_WIDGET (ud->builder, "settings_window"); - gint x, y; - - x = ghb_settings_get_int(ud->settings, "settings_x"); - y = ghb_settings_get_int(ud->settings, "settings_y"); - if (x >= 0 && y >= 0) - gtk_window_move(GTK_WINDOW(widget), x, y); - set_visible(widget, !active); - gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(toggle), !active); - - if (handler_id > 0) + else { - g_signal_handler_unblock ((gpointer)toggle, handler_id); + gtk_button_set_label(GTK_BUTTON(toggle), "Show Settings"); + gtk_widget_set_tooltip_text(toggle, "Show picture settings."); + gtk_widget_hide(window); } } @@ -1004,7 +989,8 @@ preview_window_delete_cb( signal_user_data_t *ud) { 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; } @@ -1014,34 +1000,10 @@ settings_window_delete_cb( GdkEvent *event, signal_user_data_t *ud) { - gint signal_id; - gint handler_id = 0; - - gtk_widget_hide(widget); + live_preview_stop(ud); widget = GHB_WIDGET (ud->builder, "show_picture"); - - // I don't want deleting the settings window to also remove the - // preview window, but changing the toggle will do this, so temporarily - // ignore the toggled signal - signal_id = g_signal_lookup("toggled", GTK_TYPE_TOGGLE_TOOL_BUTTON); - if (signal_id > 0) - { - // Valid signal id found. This should always succeed. - handler_id = g_signal_handler_find((gpointer)widget, G_SIGNAL_MATCH_ID, - signal_id, 0, 0, 0, 0); - if (handler_id > 0) - { - // This should also always succeed - g_signal_handler_block ((gpointer)widget, handler_id); - } - } - gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), FALSE); - if (handler_id > 0) - { - g_signal_handler_unblock ((gpointer)widget, handler_id); - } return TRUE; } @@ -1148,7 +1110,7 @@ ghb_curved_rect_mask(gint width, gint height, gint radius) double w, h; if (!width || !height) - return NULL; + return NULL; shape = (GdkDrawable *)gdk_pixmap_new (NULL, width, height, 1); |