diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/callbacks.c | 162 | ||||
-rw-r--r-- | gtk/src/data_res.gresource.xml | 2 | ||||
-rw-r--r-- | gtk/src/ghb.m4 | 899 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 1 | ||||
-rw-r--r-- | gtk/src/icon_res.gresource.xml | 2 | ||||
-rw-r--r-- | gtk/src/icons.c | 10 | ||||
-rw-r--r-- | gtk/src/main.c | 314 | ||||
-rw-r--r-- | gtk/src/makedeps.py | 3 | ||||
-rw-r--r-- | gtk/src/presets.c | 292 | ||||
-rw-r--r-- | gtk/src/presets.h | 5 | ||||
-rw-r--r-- | gtk/src/preview.c | 46 | ||||
-rw-r--r-- | gtk/src/preview.h | 2 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 76 | ||||
-rw-r--r-- | gtk/src/resources.c | 6 | ||||
-rw-r--r-- | gtk/src/settings.h | 37 | ||||
-rw-r--r-- | gtk/src/ui_res.gresource.xml | 2 |
16 files changed, 1058 insertions, 801 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 5ac796680..91dfc6347 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -305,24 +305,23 @@ ghb_check_all_depencencies(signal_user_data_t *ud) } G_MODULE_EXPORT void -on_quit1_activate(GtkMenuItem *quit, signal_user_data_t *ud) +quit_action_cb(GSimpleAction *action, GVariant *param, signal_user_data_t *ud) { gint state = ghb_get_queue_state(); - g_debug("on_quit1_activate ()"); if (state & (GHB_STATE_WORKING|GHB_STATE_SEARCHING)) { if (ghb_cancel_encode2(ud, _("Closing HandBrake will terminate encoding.\n"))) { ghb_hb_cleanup(FALSE); prune_logs(ud); - gtk_main_quit(); + g_application_quit(G_APPLICATION(ud->app)); return; } return; } ghb_hb_cleanup(FALSE); prune_logs(ud); - gtk_main_quit(); + g_application_quit(G_APPLICATION(ud->app)); } gboolean @@ -1193,7 +1192,7 @@ ghb_load_settings(signal_user_data_t * ud) else { ghb_dict_set_bool(ud->settings, "preset_reload", TRUE); - ghb_select_preset(ud->builder, fullname); + ghb_select_preset(ud, fullname); ghb_dict_set_bool(ud->settings, "preset_reload", FALSE); } @@ -1370,7 +1369,7 @@ ghb_do_scan( } static void -do_source_dialog(GtkButton *button, gboolean single, signal_user_data_t *ud) +do_source_dialog(gboolean single, signal_user_data_t *ud) { GtkWidget *dialog; const gchar *sourcename; @@ -1420,6 +1419,7 @@ do_source_dialog(GtkButton *button, gboolean single, signal_user_data_t *ud) } } +#if 0 G_MODULE_EXPORT void source_button_clicked_cb(GtkButton *button, signal_user_data_t *ud) { @@ -1431,14 +1431,32 @@ source_button_clicked_cb(GtkButton *button, signal_user_data_t *ud) } else { - do_source_dialog(button, FALSE, ud); + do_source_dialog(FALSE, ud); + } +} +#else +G_MODULE_EXPORT void +source_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) +{ + ghb_status_t status; + ghb_get_status(&status); + if (status.scan.state & GHB_STATE_SCANNING) + { + ghb_backend_scan_stop(); + } + else + { + do_source_dialog(FALSE, ud); } } +#endif G_MODULE_EXPORT void -single_title_source_cb(GtkButton *button, signal_user_data_t *ud) +single_title_action_cb(GSimpleAction *action, GVariant * param, + signal_user_data_t *ud) { - do_source_dialog(button, TRUE, ud); + do_source_dialog(TRUE, ud); } G_MODULE_EXPORT void @@ -1590,7 +1608,8 @@ dest_file_changed_cb(GtkEntry *entry, signal_user_data_t *ud) } G_MODULE_EXPORT void -destination_browse_clicked_cb(GtkButton *button, signal_user_data_t *ud) +destination_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { GtkWidget *dialog; GtkEntry *entry; @@ -1598,7 +1617,6 @@ destination_browse_clicked_cb(GtkButton *button, signal_user_data_t *ud) gchar *basename; GtkWindow *hb_window; - g_debug("destination_browse_clicked_cb ()"); hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); destname = ghb_dict_get_string(ud->settings, "destination"); dialog = gtk_file_chooser_dialog_new("Choose Destination", @@ -1636,7 +1654,7 @@ window_destroy_event_cb(GtkWidget *widget, GdkEvent *event, signal_user_data_t * g_debug("window_destroy_event_cb ()"); ghb_hb_cleanup(FALSE); prune_logs(ud); - gtk_main_quit(); + g_application_quit(G_APPLICATION(ud->app)); return FALSE; } @@ -1651,14 +1669,14 @@ window_delete_event_cb(GtkWidget *widget, GdkEvent *event, signal_user_data_t *u { ghb_hb_cleanup(FALSE); prune_logs(ud); - gtk_main_quit(); + g_application_quit(G_APPLICATION(ud->app)); return FALSE; } return TRUE; } ghb_hb_cleanup(FALSE); prune_logs(ud); - gtk_main_quit(); + g_application_quit(G_APPLICATION(ud->app)); return FALSE; } @@ -2344,7 +2362,7 @@ title_changed_cb(GtkWidget *widget, signal_user_data_t *ud) gtk_range_set_range(GTK_RANGE(widget), 1, preview_count); ghb_reset_preview_image(ud); - ghb_preview_set_visible(ud); + //ghb_preview_set_visible(ud); } } @@ -2989,11 +3007,11 @@ generic_entry_changed_cb(GtkEntry *entry, signal_user_data_t *ud) } G_MODULE_EXPORT void -prefs_dialog_cb(GtkWidget *xwidget, signal_user_data_t *ud) +preferences_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { GtkWidget *dialog; - g_debug("prefs_dialog_cb ()"); dialog = GHB_WIDGET(ud->builder, "prefs_dialog"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_hide(dialog); @@ -3021,7 +3039,7 @@ quit_cb(countdown_t *cd) prune_logs(cd->ud); gtk_widget_destroy (GTK_WIDGET(cd->dlg)); - gtk_main_quit(); + g_application_quit(G_APPLICATION(cd->ud->app)); return FALSE; } str = g_strdup_printf(_("%s\n\n%s in %d seconds ..."), @@ -3043,7 +3061,7 @@ shutdown_cb(countdown_t *cd) prune_logs(cd->ud); ghb_shutdown_gsm(); - gtk_main_quit(); + g_application_quit(G_APPLICATION(cd->ud->app)); return FALSE; } str = g_strdup_printf(_("%s\n\n%s in %d seconds ..."), @@ -4055,31 +4073,16 @@ update_activity_labels(signal_user_data_t *ud, gboolean active) } G_MODULE_EXPORT void -show_activity_toggled_cb(GtkWidget *widget, signal_user_data_t *ud) +show_activity_action_cb(GSimpleAction *action, GVariant *value, + signal_user_data_t *ud) { - GtkWidget *activity_window; - GtkCheckMenuItem *menuitem; - gboolean active; + GtkWidget * activity_window; + gboolean state = g_variant_get_boolean(value); - active = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(widget)); + g_simple_action_set_state(action, value); 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_toggled_cb(GtkWidget *widget, signal_user_data_t *ud) -{ - 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); + gtk_widget_set_visible(activity_window, state); + update_activity_labels(ud, state); } G_MODULE_EXPORT gboolean @@ -4151,26 +4154,13 @@ browse_url(const gchar *url) #endif } -#if 0 - JJJ -void -about_web_hook(GtkAboutDialog *about, const gchar *link, gpointer data) -{ - browse_url(link); -} -#endif - G_MODULE_EXPORT void -about_activate_cb(GtkWidget *xwidget, signal_user_data_t *ud) +about_action_cb(GSimpleAction *action, GVariant *param, signal_user_data_t *ud) { GtkWidget *widget = GHB_WIDGET (ud->builder, "hb_about"); gchar *ver; ver = g_strdup_printf("%s (%s)", HB_PROJECT_VERSION, HB_PROJECT_BUILD_ARCH); -#if 0 - JJJ - gtk_about_dialog_set_url_hook(about_web_hook, NULL, NULL); -#endif gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(widget), ver); g_free(ver); gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(widget), @@ -4183,7 +4173,7 @@ about_activate_cb(GtkWidget *xwidget, signal_user_data_t *ud) #define HB_DOCS "https://handbrake.fr/docs/" G_MODULE_EXPORT void -guide_activate_cb(GtkWidget *xwidget, signal_user_data_t *ud) +guide_action_cb(GSimpleAction *action, GVariant *param, signal_user_data_t *ud) { browse_url(HB_DOCS); } @@ -4227,36 +4217,29 @@ update_queue_labels(signal_user_data_t *ud) g_free(str); } -G_MODULE_EXPORT void -show_queue_toggled_cb(GtkWidget *widget, signal_user_data_t *ud) +static void +show_queue(signal_user_data_t *ud, gboolean show) { 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 (active) + if (show) tab = GHB_WIDGET(ud->builder, "queue_tab"); else tab = GHB_WIDGET(ud->builder, "settings_tab"); gtk_stack_set_visible_child(stack, tab); update_queue_labels(ud); - - 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_toggled_cb(GtkWidget *widget, signal_user_data_t *ud) +show_queue_action_cb(GSimpleAction *action, GVariant *value, + signal_user_data_t *ud) { - GtkToggleToolButton *button; - gboolean active; + gboolean state = g_variant_get_boolean(value); - 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_simple_action_set_state(action, value); + show_queue(ud, state); } static void @@ -4272,17 +4255,18 @@ presets_window_set_visible(signal_user_data_t *ud, gboolean visible) return; } + int w, h; + w = ghb_dict_get_int(ud->prefs, "presets_window_width"); + h = ghb_dict_get_int(ud->prefs, "presets_window_height"); + presets_window = GHB_WIDGET(ud->builder, "presets_window"); + if (w > 200 && h > 200) + { + gtk_window_resize(GTK_WINDOW(presets_window), w, h); + } gtk_widget_set_visible(presets_window, visible); if (visible) { - int w, h; - w = ghb_dict_get_int(ud->prefs, "presets_window_width"); - h = ghb_dict_get_int(ud->prefs, "presets_window_height"); - if (w > 200 && h > 200) - { - gtk_window_resize(GTK_WINDOW(presets_window), w, h); - } gtk_window_get_position(GTK_WINDOW(hb_window), &x, &y); x -= w + 10; if (x < 0) @@ -4295,9 +4279,13 @@ presets_window_set_visible(signal_user_data_t *ud, gboolean visible) } G_MODULE_EXPORT void -show_presets_toggled_cb(GtkWidget *widget, signal_user_data_t *ud) +show_presets_action_cb(GSimpleAction *action, GVariant *value, + signal_user_data_t *ud) { - ghb_widget_to_setting(ud->prefs, widget); + gboolean state = g_variant_get_boolean(value); + + g_simple_action_set_state(action, value); + ghb_dict_set(ud->prefs, "show_presets", ghb_boolean_value(state)); presets_window_set_visible(ud, ghb_dict_get_bool(ud->prefs, "show_presets")); ghb_pref_save(ud->prefs, "show_presets"); @@ -4501,7 +4489,7 @@ ghb_hbfd(signal_user_data_t *ud, gboolean hbfd) { GtkWidget *widget; g_debug("ghb_hbfd"); - widget = GHB_WIDGET(ud->builder, "queue_pause1"); + widget = GHB_WIDGET(ud->builder, "queue_pause"); gtk_widget_set_visible(widget, !hbfd); widget = GHB_WIDGET(ud->builder, "queue_add"); gtk_widget_set_visible(widget, !hbfd); @@ -4528,12 +4516,13 @@ ghb_hbfd(signal_user_data_t *ud, gboolean hbfd) } G_MODULE_EXPORT void -hbfd_toggled_cb(GtkWidget *widget, signal_user_data_t *ud) +hbfd_action_cb(GSimpleAction *action, GVariant *value, signal_user_data_t *ud) { - g_debug("hbfd_toggled_cb"); - ghb_widget_to_setting(ud->prefs, widget); - gboolean hbfd = ghb_dict_get_bool(ud->prefs, "hbfd"); - ghb_hbfd(ud, hbfd); + gboolean state = g_variant_get_boolean(value); + + g_simple_action_set_state(action, value); + ghb_dict_set(ud->prefs, "hbfd", ghb_boolean_value(state)); + ghb_hbfd(ud, state); ghb_pref_save(ud->prefs, "hbfd"); } @@ -4607,7 +4596,6 @@ tweaks_changed_cb(GtkWidget *widget, signal_user_data_t *ud) G_MODULE_EXPORT void hbfd_feature_changed_cb(GtkWidget *widget, signal_user_data_t *ud) { - g_debug("hbfd_feature_changed_cb"); ghb_widget_to_setting (ud->prefs, widget); const gchar *name = ghb_get_setting_key(widget); ghb_pref_set(ud->prefs, name); diff --git a/gtk/src/data_res.gresource.xml b/gtk/src/data_res.gresource.xml index d0f75543b..5b0741ceb 100644 --- a/gtk/src/data_res.gresource.xml +++ b/gtk/src/data_res.gresource.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <gresources> - <gresource prefix="/org/handbrake/data"> + <gresource prefix="/org/handbrake/ghb/data"> <file>internal_defaults.json</file> <file>widget.deps</file> <file>widget_reverse.deps</file> diff --git a/gtk/src/ghb.m4 b/gtk/src/ghb.m4 index 67a76a3b6..b7ab56373 100644 --- a/gtk/src/ghb.m4 +++ b/gtk/src/ghb.m4 @@ -6,7 +6,6 @@ define([filter_output], [$1])])dnl filter_output([ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.0 on Tue Jan 14 14:36:08 2014 --> <interface> <!-- interface-requires gtk+ 3.0 --> <object class="GtkFileFilter" id="SourceFilterAVI"/> @@ -126,7 +125,7 @@ conjunction with the "Forced" option.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_save_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-save</property> </object> </child> <child> @@ -135,7 +134,7 @@ conjunction with the "Forced" option.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_remove_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-remove</property> </object> </child> <child> @@ -144,7 +143,7 @@ conjunction with the "Forced" option.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_default_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-default</property> </object> </child> <child> @@ -153,7 +152,7 @@ conjunction with the "Forced" option.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_new_folder_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-folder</property> </object> </child> <child> @@ -162,7 +161,7 @@ conjunction with the "Forced" option.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="preset_export_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-export</property> </object> </child> <child> @@ -171,7 +170,7 @@ conjunction with the "Forced" option.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="preset_import_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-import</property> </object> </child> <child> @@ -180,7 +179,7 @@ conjunction with the "Forced" option.</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_restore_clicked_cb" swapped="no"/> + <property name="action-name">app.presets-reload</property> </object> </child> </object> @@ -711,42 +710,7 @@ libx264 authors: </child> </object> - <object class="GtkMenu" id="tray_menu"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkMenuItem" id="show_hide"> - <property name="label" translatable="yes">_Minimize/Maximize</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="use_underline">True</property> - <signal name="activate" handler="show_hide_toggle_cb" swapped="no"/> - </object> - <object class="GtkMenuItem" id="tray_queue_pause"> - <property name="label" translatable="yes">_Pause Encoding</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="use_underline">True</property> - <signal name="activate" handler="queue_pause_clicked_cb" swapped="no"/> - </object> - <object class="GtkMenuItem" id="tray_quit"> - <property name="label" translatable="yes">_Quit</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_quit1_activate" swapped="no"/> - </object> - <object class="GtkMenuItem" id="tray_about"> - <property name="label" translatable="yes">_About</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="use_underline">True</property> - <signal name="activate" handler="about_activate_cb" swapped="no"/> - </object> - </child> - </object> - - <object class="GtkWindow" id="hb_window"> + <object class="GtkApplicationWindow" id="hb_window"> <property name="can_focus">False</property> <property name="events">GDK_VISIBILITY_NOTIFY_MASK</property> <property name="title" translatable="yes">HandBrake</property> @@ -784,7 +748,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="source_button_clicked_cb" swapped="no"/> + <property name="action-name">app.source</property> </object> </child> <child> @@ -793,7 +757,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="single_title_source_cb" swapped="no"/> + <property name="action-name">app.single</property> </object> </child> <child> @@ -802,7 +766,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="destination_browse_clicked_cb" swapped="no"/> + <property name="action-name">app.destination</property> </object> </child> <child> @@ -817,7 +781,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="prefs_dialog_cb" swapped="no"/> + <property name="action-name">app.preferences</property> </object> </child> <child> @@ -832,7 +796,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="on_quit1_activate" swapped="no"/> + <property name="action-name">app.quit</property> </object> </child> </object> @@ -855,7 +819,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="queue_add_clicked_cb" swapped="no"/> + <property name="action-name">app.queue-add</property> </object> </child> <child> @@ -864,7 +828,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="queue_add_multiple_clicked_cb" swapped="no"/> + <property name="action-name">app.queue-add-all</property> </object> </child> <child> @@ -873,7 +837,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="queue_start_clicked_cb" swapped="no"/> + <property name="action-name">app.queue-start</property> </object> </child> <child> @@ -882,7 +846,16 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="queue_pause_clicked_cb" swapped="no"/> + <property name="action-name">app.queue-pause</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="queue_save_menu"> + <property name="label" translatable="yes">S_ave Queue</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + <property name="action-name">app.queue-save</property> </object> </child> </object> @@ -905,7 +878,7 @@ libx264 authors: <property name="visible">False</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="toggled" handler="hbfd_toggled_cb" swapped="no"/> + <property name="action-name">app.hbfd</property> </object> </child> <child> @@ -914,7 +887,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="toggled" handler="show_presets_toggled_cb" swapped="no"/> + <property name="action-name">app.show-presets</property> </object> </child> <child> @@ -923,7 +896,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="toggled" handler="show_queue_menu_toggled_cb" swapped="no"/> + <property name="action-name">app.show-queue</property> </object> </child> <child> @@ -932,7 +905,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="toggled" handler="preview_menu_toggled_cb" swapped="no"/> + <property name="action-name">app.show-preview</property> </object> </child> <child> @@ -941,7 +914,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="toggled" handler="show_activity_menu_toggled_cb" swapped="no"/> + <property name="action-name">app.show-activity</property> </object> </child> </object> @@ -964,7 +937,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_save_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-save</property> </object> </child> <child> @@ -973,7 +946,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_remove_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-remove</property> </object> </child> <child> @@ -982,7 +955,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_default_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-default</property> </object> </child> <child> @@ -991,7 +964,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_new_folder_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-folder</property> </object> </child> <child> @@ -1000,7 +973,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="preset_export_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-export</property> </object> </child> <child> @@ -1009,7 +982,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="preset_import_clicked_cb" swapped="no"/> + <property name="action-name">app.preset-import</property> </object> </child> <child> @@ -1018,7 +991,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="presets_restore_clicked_cb" swapped="no"/> + <property name="action-name">app.presets-reload</property> </object> </child> </object> @@ -1041,7 +1014,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="about_activate_cb" swapped="no"/> + <property name="action-name">app.about</property> </object> </child> <child> @@ -1050,7 +1023,7 @@ libx264 authors: <property name="visible">True</property> <property name="can_focus">False</property> <property name="use_underline">True</property> - <signal name="activate" handler="guide_activate_cb" swapped="no"/> + <property name="action-name">app.guide</property> </object> </child> </object> @@ -1065,245 +1038,455 @@ libx264 authors: </packing> </child> <child> - <object class="GtkBox" id="hbox10"> - <property name="orientation">horizontal</property> + <object class="GtkBox" id="vbox11"> + <property name="orientation">vertical</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkBox" id="vbox11"> - <property name="orientation">vertical</property> + <object class="GtkToolbar" id="toolbar1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="show-arrow">False</property> + <property name="icon_size">5</property> + <child> + <object class="GtkToolButton" id="sourcetoolbutton"> + <property name="visible">True</property> + <property name="can_focus">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">Choose Video Source</property> + <property name="is_important">True</property> + <property name="label" translatable="yes">Open +Source</property> + <property name="icon_name">hb-source</property> + <property name="action-name">app.source</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="queue_add"> + <property name="visible">True</property> + <property name="can_focus">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">Add to Queue</property> + <property name="is_important">True</property> + <property name="label" translatable="yes">Add To +Queue</property> + <property name="icon_name">hb-add-queue</property> + <property name="action-name">app.queue-add</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="queue_start"> + <property name="visible">True</property> + <property name="can_focus">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">Start Encoding</property> + <property name="is_important">True</property> + <property name="label" translatable="yes">Start +Encoding</property> + <property name="icon_name">hb-start</property> + <property name="action-name">app.queue-start</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="queue_pause"> + <property name="visible">True</property> + <property name="can_focus">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">Pause Encoding</property> + <property name="is_important">True</property> + <property name="label" translatable="yes">Pause +Encoding</property> + <property name="icon_name">hb-pause</property> + <property name="action-name">app.queue-pause</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkSeparatorToolItem" id="main_tool_sep1"> + <property name="visible">True</property> + <property name="draw">False</property> + </object> + <packing> + <property name="expand">True</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="show_queue"> + <property name="visible">True</property> + <property name="can_focus">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="is_important">True</property> + <property name="label" translatable="yes">Show +Queue</property> + <property name="icon_name">hb-showqueue</property> + <property name="action-name">app.show-queue</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="show_preview"> + <property name="visible">True</property> + <property name="can_focus">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 Preview Window</property> + <property name="is_important">True</property> + <property name="label" translatable="yes">Show +Preview</property> + <property name="icon_name">hb-picture</property> + <property name="action-name">app.show-preview</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="show_activity"> + <property name="visible">True</property> + <property name="can_focus">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="is_important">True</property> + <property name="label" translatable="yes">Show +Activity</property> + <property name="icon_name">hb-activity</property> + <property name="action-name">app.show-activity</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="hbox54"> + <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="margin-end">12</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> <child> - <object class="GtkToolbar" id="toolbar1"> + <object class="GtkBox" id="SourceInfoBox"> + <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="show-arrow">False</property> - <property name="icon_size">5</property> + <property name="spacing">6</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> <child> - <object class="GtkToolButton" id="sourcetoolbutton"> + <object class="GtkLabel" id="label7"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Source:</b></property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="volume_label"> + <property name="visible">True</property> + <property name="can_focus">False</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">Choose Video Source</property> - <property name="is_important">True</property> - <property name="label" translatable="yes">Open -Source</property> - <property name="icon_name">hb-source</property> - <signal name="clicked" handler="source_button_clicked_cb" swapped="no"/> + <property name="halign">start</property> + <property name="ellipsize">middle</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes">None</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> <child> - <object class="GtkToolButton" id="queue_add"> + <object class="GtkLabel" id="source_info_label"> <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> + <property name="can_focus">False</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">Add to Queue</property> - <property name="is_important">True</property> - <property name="label" translatable="yes">Add To -Queue</property> - <property name="icon_name">hb-add-queue</property> - <signal name="clicked" handler="queue_add_clicked_cb" swapped="no"/> + <property name="halign">end</property> + <property name="label" translatable="yes"></property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkProgressBar" id="scan_prog"> + <property name="height_request">10</property> + <property name="can_focus">False</property> + <property name="valign">center</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="table7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="column_spacing">5</property> + <property name="hexpand">True</property> + <property name="halign">GTK_ALIGN_FILL</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> + <property name="row-spacing">2</property> + <child> + <object class="GtkLabel" id="label20"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="label" translatable="yes">Title:</property> + </object> + <packing> + <property name="top_attach">0</property> + <property name="left_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="hbox42"> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="hexpand">True</property> + <property name="halign">GTK_ALIGN_FILL</property> + <property name="spacing">5</property> + <child> + <object class="GtkComboBox" id="title"> + <property name="visible">True</property> + <property name="valign">GTK_ALIGN_CENTER</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="tooltip_text" translatable="yes">Set the title to encode. +By default the longest title is chosen. +This is often the feature title of a DVD.</property> + <property name="has_frame">False</property> + <signal name="changed" handler="title_changed_cb" swapped="no"/> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="angle_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="label" translatable="yes">Angle:</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="fill">False</property> + <property name="position">1</property> </packing> </child> <child> - <object class="GtkToolButton" id="queue_start1"> + <object class="GtkSpinButton" id="angle"> + <property name="width-chars">3</property> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="can_focus">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">Start Encoding</property> - <property name="is_important">True</property> - <property name="label" translatable="yes">Start -Encoding</property> - <property name="icon_name">hb-start</property> - <signal name="clicked" handler="queue_start_clicked_cb" swapped="no"/> + <property name="tooltip_text" translatable="yes">For multi-angle DVD's, select the desired angle to encode.</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="adjustment">adjustment27</property> + <property name="halign">end</property> + <signal name="value-changed" handler="title_angle_changed_cb" swapped="no"/> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> <child> - <object class="GtkToolButton" id="queue_pause1"> + <object class="GtkButton" id="title_reset"> + <property name="label" translatable="yes">Reset All Titles</property> <property name="visible">True</property> - <property name="sensitive">False</property> <property name="can_focus">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">Pause Encoding</property> - <property name="is_important">True</property> - <property name="label" translatable="yes">Pause -Encoding</property> - <property name="icon_name">hb-pause</property> - <signal name="clicked" handler="queue_pause_clicked_cb" swapped="no"/> + <property name="tooltip_text" translatable="yes">Apply current settings to all titles</property> + <property name="receives_default">True</property> + <property name="halign">end</property> + <signal name="clicked" handler="title_reset_clicked_cb" swapped="no"/> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="fill">True</property> + <property name="position">3</property> </packing> </child> + </object> + <packing> + <property name="top_attach">0</property> + <property name="left_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="chapter_box"> + <property name="halign">start</property> + <property name="valign">center</property> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="spacing">5</property> <child> - <object class="GtkSeparatorToolItem" id="main_tool_sep1"> + <object class="GtkComboBox" id="PtoPType"> <property name="visible">True</property> - <property name="draw">False</property> + <property name="valign">GTK_ALIGN_CENTER</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes">Range of title to encode. Can be chapters, seconds, or frames.</property> + <signal name="changed" handler="ptop_widget_changed_cb" swapped="no"/> </object> <packing> - <property name="expand">True</property> - <property name="homogeneous">False</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkToggleToolButton" id="show_queue"> + <object class="GtkSpinButton" id="start_point"> + <property name="width-chars">10</property> <property name="visible">True</property> <property name="can_focus">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="is_important">True</property> - <property name="label" translatable="yes">Show -Queue</property> - <property name="icon_name">hb-showqueue</property> - <signal name="toggled" handler="show_queue_toggled_cb" swapped="no"/> + <property name="tooltip_text" translatable="yes">Set the first chapter to encode.</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="adjustment">adjustment1</property> + <property name="numeric">True</property> + <signal name="value-changed" handler="start_point_changed_cb" swapped="no"/> + <signal name="output" handler="ptop_output_cb" swapped="no"/> + <signal name="input" handler="ptop_input_cb" swapped="no"/> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> <child> - <object class="GtkToggleToolButton" id="show_preview"> + <object class="GtkLabel" id="label56"> <property name="visible">True</property> - <property name="can_focus">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 Preview Window</property> - <property name="is_important">True</property> - <property name="label" translatable="yes">Show -Preview</property> - <property name="icon_name">hb-picture</property> - <signal name="toggled" handler="preview_toggled_cb" swapped="no"/> + <property name="can_focus">False</property> + <property name="label" translatable="yes">through</property> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> <child> - <object class="GtkToggleToolButton" id="show_activity"> + <object class="GtkSpinButton" id="end_point"> + <property name="width-chars">10</property> <property name="visible">True</property> <property name="can_focus">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="is_important">True</property> - <property name="label" translatable="yes">Show -Activity</property> - <property name="icon_name">hb-activity</property> - <signal name="toggled" handler="show_activity_toggled_cb" swapped="no"/> + <property name="tooltip_text" translatable="yes">Set the last chapter to encode.</property> + <property name="primary_icon_activatable">False</property> + <property name="secondary_icon_activatable">False</property> + <property name="adjustment">adjustment2</property> + <property name="numeric">True</property> + <signal name="value-changed" handler="end_point_changed_cb" swapped="no"/> + <signal name="output" handler="ptop_output_cb" swapped="no"/> + <signal name="input" handler="ptop_input_cb" swapped="no"/> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="fill">True</property> + <property name="position">3</property> </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="vbox15"> - <property name="orientation">vertical</property> - <property name="hexpand">True</property> - <property name="halign">GTK_ALIGN_FILL</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">6</property> <child> - <object class="GtkBox" id="hbox54"> + <object class="GtkBox" id="hbox47"> <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="margin-start">6</property> + <property name="spacing">7</property> <child> - <object class="GtkBox" id="SourceInfoBox"> - <property name="orientation">horizontal</property> + <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">6</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <child> - <object class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Source:</b></property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="volume_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="halign">start</property> - <property name="ellipsize">middle</property> - <property name="margin-end">12</property> - <property name="label" translatable="yes">None</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="source_info_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="halign">end</property> - <property name="label" translatable="yes"></property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> + <property name="halign">start</property> + <property name="label" translatable="yes">Duration:</property> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkProgressBar" id="scan_prog"> - <property name="height_request">10</property> + <object class="GtkLabel" id="title_duration"> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="valign">center</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="halign">start</property> + <property name="label" translatable="yes">hh:mm:ss</property> + <property name="width_chars">8</property> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> <property name="position">1</property> </packing> @@ -1312,249 +1495,87 @@ Activity</property> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">4</property> </packing> </child> + </object> + <packing> + <property name="top_attach">1</property> + <property name="left_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkBox" id="preset_selection_box"> + <property name="halign">start</property> + <property name="valign">center</property> + <property name="orientation">horizontal</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> + <property name="margin-top">12</property> + <property name="spacing">5</property> + <child> + <object class="GtkLabel" id="preset_selection_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes"><b>Preset:</b></property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="presets_menu_button"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="direction">down</property> <child> - <object class="GtkGrid" id="table7"> + <object class="GtkBox" id="presets_menu_button_box"> + <property name="orientation">horizontal</property> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="column_spacing">5</property> - <property name="hexpand">True</property> - <property name="halign">GTK_ALIGN_FILL</property> - <property name="margin-start">6</property> - <property name="row-spacing">2</property> <child> - <object class="GtkLabel" id="label20"> + <object class="GtkLabel" id="presets_menu_button_label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="label" translatable="yes">Title:</property> - </object> - <packing> - <property name="top_attach">0</property> - <property name="left_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkBox" id="hbox42"> - <property name="orientation">horizontal</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="hexpand">True</property> - <property name="halign">GTK_ALIGN_FILL</property> - <property name="spacing">5</property> - <child> - <object class="GtkComboBox" id="title"> - <property name="visible">True</property> - <property name="valign">GTK_ALIGN_CENTER</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="tooltip_text" translatable="yes">Set the title to encode. -By default the longest title is chosen. -This is often the feature title of a DVD.</property> - <property name="has_frame">False</property> - <signal name="changed" handler="title_changed_cb" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="angle_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="label" translatable="yes">Angle:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="angle"> - <property name="width-chars">3</property> - <property name="visible">True</property> - <property name="can_focus">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">For multi-angle DVD's, select the desired angle to encode.</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - <property name="adjustment">adjustment27</property> - <property name="halign">end</property> - <signal name="value-changed" handler="title_angle_changed_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkButton" id="title_reset"> - <property name="label" translatable="yes">Reset All Titles</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="tooltip_text" translatable="yes">Apply current settings to all titles</property> - <property name="receives_default">True</property> - <property name="halign">end</property> - <signal name="clicked" handler="title_reset_clicked_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> + <property name="width-chars">50</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Choose Preset</property> + <property name="use_markup">True</property> </object> <packing> - <property name="top_attach">0</property> - <property name="left_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkBox" id="chapter_box"> - <property name="halign">start</property> - <property name="valign">center</property> - <property name="orientation">horizontal</property> + <object class="GtkImage" id="presets_menu_button_arrow"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="spacing">5</property> - <child> - <object class="GtkComboBox" id="PtoPType"> - <property name="visible">True</property> - <property name="valign">GTK_ALIGN_CENTER</property> - <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">Range of title to encode. Can be chapters, seconds, or frames.</property> - <signal name="changed" handler="ptop_widget_changed_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="start_point"> - <property name="width-chars">10</property> - <property name="visible">True</property> - <property name="can_focus">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">Set the first chapter to encode.</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - <property name="adjustment">adjustment1</property> - <property name="numeric">True</property> - <signal name="value-changed" handler="start_point_changed_cb" swapped="no"/> - <signal name="output" handler="ptop_output_cb" swapped="no"/> - <signal name="input" handler="ptop_input_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label56"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">through</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="end_point"> - <property name="width-chars">10</property> - <property name="visible">True</property> - <property name="can_focus">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">Set the last chapter to encode.</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - <property name="adjustment">adjustment2</property> - <property name="numeric">True</property> - <signal name="value-changed" handler="end_point_changed_cb" swapped="no"/> - <signal name="output" handler="ptop_output_cb" swapped="no"/> - <signal name="input" handler="ptop_input_cb" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - <child> - <object class="GtkBox" id="hbox47"> - <property name="orientation">horizontal</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="spacing">7</property> - <child> - <object class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes">Duration:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="title_duration"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="halign">start</property> - <property name="label" translatable="yes">hh:mm:ss</property> - <property name="width_chars">8</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">4</property> - </packing> - </child> + <property name="icon_name">pan-down-symbolic</property> </object> <packing> - <property name="top_attach">1</property> - <property name="left_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> </child> </object> <packing> @@ -1567,7 +1588,7 @@ This is often the feature title of a DVD.</property> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">3</property> </packing> </child> </object> @@ -6871,7 +6892,7 @@ Resets all queue jobs to pending and ready to run again.</property> <property name="icon_name">document-save-as</property> <property name="tooltip_text" translatable="yes">Save the current queue of encode jobs to a file. This file may be reloaded at a later time to edit your jobs and re-encode.</property> - <signal name="clicked" handler="queue_save_clicked_cb" swapped="no"/> + <property name="action-name">app.queue-save</property> </object> <packing> <property name="expand">False</property> @@ -8569,6 +8590,8 @@ Setting this to 0 means there is no maximum height.</property> <signal name="delete-event" handler="preview_window_delete_cb" swapped="no"/> <child> <object class="GtkEventBox" id="preview_image"> + <property name="width_request">854</property> + <property name="height_request">480</property> <property name="visible">True</property> <property name="app_paintable">True</property> <property name="can_focus">False</property> diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index fb8f03205..c38835959 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -3118,6 +3118,7 @@ void ghb_backend_init(gint debug) { /* Init libhb */ + hb_global_init(); h_scan = hb_init( debug ); h_queue = hb_init( debug ); h_live = hb_init( debug ); diff --git a/gtk/src/icon_res.gresource.xml b/gtk/src/icon_res.gresource.xml index e81378f36..abfd4c2e6 100644 --- a/gtk/src/icon_res.gresource.xml +++ b/gtk/src/icon_res.gresource.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <gresources> - <gresource prefix="/org/handbrake/icons/scalable/apps"> + <gresource prefix="/org/handbrake/ghb/icons/scalable/apps"> <file>hb-activity.svg</file> <file>hb-add-queue.svg</file> <file>hb-complete.svg</file> diff --git a/gtk/src/icons.c b/gtk/src/icons.c index a0f19e372..0e889e0c6 100644 --- a/gtk/src/icons.c +++ b/gtk/src/icons.c @@ -30,13 +30,13 @@ ghb_load_icons() #if GTK_CHECK_VERSION(3, 14, 0) ghb_icons_register_resource(); gtk_icon_theme_add_resource_path(gtk_icon_theme_get_default(), - "/org/handbrake/icons"); + "/org/handbrake/ghb/icons"); #else ghb_icons_register_resource(); GResource *icon_res = ghb_icons_get_resource(); char ** children = g_resource_enumerate_children(icon_res, - "/org/handbrake/icons/scalable/apps", 0, NULL); + "/org/handbrake/ghb/icons/scalable/apps", 0, NULL); if (children == NULL) { @@ -46,8 +46,10 @@ ghb_load_icons() int ii; for (ii = 0; children[ii] != NULL; ii++) { - char *path = g_strdup_printf("/org/handbrake/icons/scalable/apps/%s", - children[ii]); + char * path; + + path = g_strdup_printf("/org/handbrake/ghb/icons/scalable/apps/%s", + children[ii]); GBytes *gbytes = g_resource_lookup_data(icon_res, path, 0, NULL); gsize data_size; gconstpointer data = g_bytes_get_data(gbytes, &data_size); diff --git a/gtk/src/main.c b/gtk/src/main.c index de5eb0f28..a452830bb 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -93,9 +93,9 @@ create_builder_or_die(const gchar * name) const gchar *ghb_ui; gsize data_size; - ghb_ui_register_resource(); GResource *ui_res = ghb_ui_get_resource(); - GBytes *gbytes = g_resource_lookup_data(ui_res, "/org/handbrake/ui/ghb.ui", + GBytes *gbytes = g_resource_lookup_data(ui_res, + "/org/handbrake/ghb/ui/ghb.ui", 0, NULL); ghb_ui = g_bytes_get_data(gbytes, &data_size); @@ -649,7 +649,8 @@ IoRedirect(signal_user_data_t *ud) // "Invalid byte sequence in conversion input" // Set disable encoding on the channel. g_io_channel_set_encoding(channel, NULL, NULL); - g_io_add_watch(channel, G_IO_IN, ghb_log_cb, (gpointer)ud ); + ud->stderr_src_id = + g_io_add_watch(channel, G_IO_IN, ghb_log_cb, (gpointer)ud ); } typedef struct @@ -818,69 +819,143 @@ stackswitcher button.text-button \n\ extern G_MODULE_EXPORT void status_icon_query_tooltip_cb(void); -int -main(int argc, char *argv[]) +extern G_MODULE_EXPORT void +ghb_shutdown_cb(GApplication * app, signal_user_data_t *ud) { - signal_user_data_t *ud; - GError *error = NULL; - GOptionContext *context; - -#if defined(_WIN32) - // Tell gdk pixbuf where it's loader config file is. - _putenv_s("GDK_PIXBUF_MODULE_FILE", "ghb.exe.local/loaders.cache"); - _putenv_s("GST_PLUGIN_PATH", "lib/gstreamer-1.0"); -#endif +} - hb_global_init(); +G_MODULE_EXPORT void +source_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +single_title_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +destination_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +preferences_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +quit_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +queue_add_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +queue_add_all_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +queue_start_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +queue_pause_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +queue_save_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +show_presets_action_cb(GSimpleAction *action, GVariant *value, gpointer ud); +G_MODULE_EXPORT void +hbfd_action_cb(GSimpleAction *action, GVariant *value, gpointer ud); +G_MODULE_EXPORT void +show_queue_action_cb(GSimpleAction *action, GVariant *value, gpointer ud); +G_MODULE_EXPORT void +show_preview_action_cb(GSimpleAction *action, GVariant *value, gpointer ud); +G_MODULE_EXPORT void +show_activity_action_cb(GSimpleAction *action, GVariant *value, gpointer ud); +G_MODULE_EXPORT void +preset_save_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +preset_remove_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +preset_default_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +preset_folder_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +preset_export_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +preset_import_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +presets_reload_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +about_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +guide_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); +G_MODULE_EXPORT void +preset_select_action_cb(GSimpleAction *action, GVariant *param, gpointer ud); + +static void map_actions(GApplication * app, signal_user_data_t * ud) +{ + const GActionEntry entries[] = + { + { "source", source_action_cb }, + { "single", single_title_action_cb }, + { "destination", destination_action_cb }, + { "preferences", preferences_action_cb }, + { "quit", quit_action_cb }, + { "queue-add", queue_add_action_cb }, + { "queue-add-all", queue_add_all_action_cb }, + { "queue-start", queue_start_action_cb }, + { "queue-pause", queue_pause_action_cb }, + { "queue-save", queue_save_action_cb }, + { "hbfd", NULL, + NULL, "false", hbfd_action_cb }, + { "show-presets", NULL, + NULL, "false", show_presets_action_cb }, + { "show-queue", NULL, + NULL, "false", show_queue_action_cb }, + { "show-preview", NULL, + NULL, "false", show_preview_action_cb }, + { "show-activity", NULL, + NULL, "false", show_activity_action_cb }, + { "preset-save", preset_save_action_cb }, + { "preset-remove", preset_remove_action_cb }, + { "preset-default", preset_default_action_cb }, + { "preset-folder", preset_folder_action_cb }, + { "preset-export", preset_export_action_cb }, + { "preset-import", preset_import_action_cb }, + { "presets-reload", presets_reload_action_cb }, + { "about", about_action_cb }, + { "guide", guide_action_cb }, + { "preset-select", preset_select_action_cb, "s" }, + }; + g_action_map_add_action_entries(G_ACTION_MAP(app), entries, + G_N_ELEMENTS(entries), ud); +} -#ifdef ENABLE_NLS - bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); - bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); - textdomain(GETTEXT_PACKAGE); -#endif +gboolean +ghb_idle_ui_init(signal_user_data_t *ud) +{ + ghb_settings_to_ui(ud, ud->globals); + ghb_settings_to_ui(ud, ud->prefs); + // Note that ghb_settings_to_ui(ud->settings) happens when initial + // empty title is initialized. - context = g_option_context_new(_("- Transcode media formats")); - g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); - g_option_context_add_group(context, gtk_get_option_group(TRUE)); -#if defined(_ENABLE_GST) - g_option_context_add_group(context, gst_init_get_option_group()); -#endif - g_option_context_parse(context, &argc, &argv, &error); - if (error != NULL) + // Init settings that are dependent on command line args + if (dvd_device != NULL) { - g_warning("%s: %s", G_STRFUNC, error->message); - g_clear_error(&error); + // Source overridden from command line option + ghb_dict_set_string(ud->globals, "scan_source", dvd_device); + g_idle_add((GSourceFunc)ghb_idle_scan, ud); + } + else + { + GhbValue *gval = ghb_dict_get_value(ud->prefs, "default_source"); + ghb_dict_set(ud->globals, "scan_source", ghb_value_dup(gval)); } - g_option_context_free(context); -#if defined(_WIN32) - if (win32_console) + if (arg_preset != NULL) { - // Enable console logging - if(AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole()){ - close(STDOUT_FILENO); - freopen("CONOUT$", "w", stdout); - close(STDERR_FILENO); - freopen("CONOUT$", "w", stderr); - } + ghb_select_preset(ud, arg_preset); } else { - // Non-console windows apps do not have a stderr->_file - // assigned properly - stderr->_file = STDERR_FILENO; - stdout->_file = STDOUT_FILENO; + ghb_select_default_preset(ud); } -#endif - if (argc > 1 && dvd_device == NULL && argv[1][0] != '-') - { - dvd_device = argv[1]; - } + // Grey out widgets that are dependent on a disabled feature + ghb_check_all_depencencies(ud); + + return FALSE; +} - gtk_init(&argc, &argv); +extern G_MODULE_EXPORT void +ghb_activate_cb(GApplication * app, signal_user_data_t * ud) +{ + GError * error = NULL; + GtkCssProvider * css = gtk_css_provider_new(); - GtkCssProvider *css = gtk_css_provider_new(); error = NULL; gtk_css_provider_load_from_data(css, MyCSS, -1, &error); if (error == NULL) @@ -913,11 +988,16 @@ main(int argc, char *argv[]) } ghb_write_pid_file(); - ud = g_malloc0(sizeof(signal_user_data_t)); + + // map application actions (menu callbacks) + map_actions(app, ud); + + // connect shutdown signal for cleanup + g_signal_connect(app, "shutdown", (GCallback)ghb_shutdown_cb, ud); + ud->debug = ghb_debug; g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, debug_log_handler, ud); g_log_set_handler("Gtk", G_LOG_LEVEL_WARNING, warn_log_handler, ud); - //g_log_set_handler("Gtk", G_LOG_LEVEL_CRITICAL, warn_log_handler, ud); ud->globals = ghb_dict_new(); ud->prefs = ghb_dict_new(); @@ -926,14 +1006,10 @@ main(int argc, char *argv[]) ghb_array_append(ud->settings_array, ud->settings); ud->builder = create_builder_or_die(BUILDER_NAME); + // Enable events that alert us to media change events watch_volumes(ud); - //GtkWidget *widget = GHB_WIDGET(ud->builder, "PictureDetelecineCustom"); - //gtk_entry_set_inner_border(widget, 2); - - // Since GtkBuilder no longer assigns object ids to widget names - // Assign a few that are necessary for style overrides to work #if defined(_NO_UPDATE_CHECK) GtkWidget *widget; widget = GHB_WIDGET(ud->builder, "check_updates_box"); @@ -975,6 +1051,9 @@ main(int argc, char *argv[]) buffer = gtk_text_view_get_buffer(textview); g_signal_connect(buffer, "changed", (GCallback)plot_changed_cb, ud); + // Initialize HB global settings and tables. + ghb_backend_init(0); + // Set up UI combo boxes. Some of these rely on HB global settings. ghb_combo_init(ud); g_debug("ud %p\n", ud); @@ -1009,52 +1088,23 @@ main(int argc, char *argv[]) ghb_prefs_to_settings(ud->prefs); int logLevel = ghb_dict_get_int(ud->prefs, "LoggingLevel"); - ghb_backend_init(logLevel); + ghb_log_level_set(logLevel); // Load the presets files ghb_presets_load(ud); - // Note that ghb_preset_to_settings(ud->settings) is called when - // the default preset is selected. - - ghb_settings_to_ui(ud, ud->globals); - ghb_settings_to_ui(ud, ud->prefs); - // Note that ghb_settings_to_ui(ud->settings) happens when initial - // empty title is initialized. + // GActions associated with widgets do not fire when the widget + // is changed from this GtkApplication "activate" signal. + // So initialize UI when idle. + g_idle_add((GSourceFunc)ghb_idle_ui_init, ud); - if (ghb_dict_get_bool(ud->prefs, "hbfd")) - { - ghb_hbfd(ud, TRUE); - } const gchar *source = ghb_dict_get_string(ud->prefs, "default_source"); ghb_dvd_set_current(source, ud); // Populate the presets tree view ghb_presets_list_init(ud, NULL); - // Get the first preset name - if (arg_preset != NULL) - { - ghb_select_preset(ud->builder, arg_preset); - } - else - { - ghb_select_default_preset(ud->builder); - } + ghb_presets_menu_init(ud); - // Grey out widgets that are dependent on a disabled feature - ghb_check_all_depencencies(ud); - - if (dvd_device != NULL) - { - // Source overridden from command line option - ghb_dict_set_string(ud->globals, "scan_source", dvd_device); - g_idle_add((GSourceFunc)ghb_idle_scan, ud); - } - else - { - GhbValue *gval = ghb_dict_get_value(ud->prefs, "default_source"); - ghb_dict_set(ud->globals, "scan_source", ghb_value_dup(gval)); - } // Reload and check status of the last saved queue g_idle_add((GSourceFunc)ghb_reload_queue, ud); @@ -1215,13 +1265,85 @@ main(int argc, char *argv[]) ghb_set_custom_filter_tooltip(ud, "PictureCombDetectCustom", "interlace detection", HB_FILTER_COMB_DETECT); + gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(ghb_window)); + GtkWidget * window = GHB_WIDGET(ud->builder, "presets_window"); + gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(window)); + gtk_widget_show(ghb_window); +} + +int +main(int argc, char *argv[]) +{ + //signal_user_data_t *ud; + GError *error = NULL; + GOptionContext *context; + +#if defined(_WIN32) + // Tell gdk pixbuf where it's loader config file is. + _putenv_s("GDK_PIXBUF_MODULE_FILE", "ghb.exe.local/loaders.cache"); + _putenv_s("GST_PLUGIN_PATH", "lib/gstreamer-1.0"); +#endif + + +#ifdef ENABLE_NLS + bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + textdomain(GETTEXT_PACKAGE); +#endif - // Everything should be go-to-go. Lets rock! + context = g_option_context_new(_("- Transcode media formats")); + g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); + g_option_context_add_group(context, gtk_get_option_group(TRUE)); +#if defined(_ENABLE_GST) + g_option_context_add_group(context, gst_init_get_option_group()); +#endif + g_option_context_parse(context, &argc, &argv, &error); + if (error != NULL) + { + g_warning("%s: %s", G_STRFUNC, error->message); + g_clear_error(&error); + } + g_option_context_free(context); + if (argc > 1 && dvd_device == NULL && argv[1][0] != '-') + { + dvd_device = argv[1]; + } + +#if defined(_WIN32) + if (win32_console) + { + // Enable console logging + if(AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole()){ + close(STDOUT_FILENO); + freopen("CONOUT$", "w", stdout); + close(STDERR_FILENO); + freopen("CONOUT$", "w", stderr); + } + } + else + { + // Non-console windows apps do not have a stderr->_file + // assigned properly + stderr->_file = STDERR_FILENO; + stdout->_file = STDOUT_FILENO; + } +#endif + + int status; + signal_user_data_t * ud; + + ghb_ui_register_resource(); + ud = g_malloc0(sizeof(signal_user_data_t)); + ud->app = gtk_application_new("org.handbrake.ghb", + G_APPLICATION_FLAGS_NONE); + g_signal_connect(ud->app, "activate", (GCallback)ghb_activate_cb, ud); + status = g_application_run(G_APPLICATION(ud->app), argc, argv); - gtk_main(); ghb_backend_close(); + // Remove stderr redirection + g_source_remove(ud->stderr_src_id); ghb_value_free(&ud->queue); ghb_value_free(&ud->settings_array); ghb_value_free(&ud->prefs); @@ -1240,5 +1362,5 @@ main(int argc, char *argv[]) g_free(ud->current_dvd_device); g_free(ud); - return 0; + return status; } diff --git a/gtk/src/makedeps.py b/gtk/src/makedeps.py index e2ed0c226..717611b3c 100644 --- a/gtk/src/makedeps.py +++ b/gtk/src/makedeps.py @@ -6,9 +6,6 @@ import json DepEntry = collections.namedtuple('DepEntry', 'widget dep enable die hide') dep_map = ( - DepEntry("title", "queue_add", "none", True, False), - DepEntry("title", "queue_add_menu", "none", True, False), - DepEntry("title", "queue_add_multiple_menu", "none", True, False), DepEntry("title", "preview_frame", "none", True, False), DepEntry("title", "chapters_tab", "none", True, False), DepEntry("title", "start_point", "none", True, False), diff --git a/gtk/src/presets.c b/gtk/src/presets.c index cc80434bd..a8d50b660 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -531,8 +531,57 @@ ghb_settings_to_ui(signal_user_data_t *ud, GhbValue *dict) ghb_value_free(&tmp); } +char* +preset_get_fullname(hb_preset_index_t *path, const char * sep) +{ + int ii; + GString *gstr; + hb_preset_index_t *tmp; + GhbValue *dict; + + gstr = g_string_new(""); + tmp = hb_preset_index_dup(path); + for (ii = 1; ii <= path->depth; ii++) + { + const char *name; + tmp->depth = ii; + dict = hb_preset_get(tmp); + if (dict == NULL) + { + break; + } + name = ghb_dict_get_string(dict, "PresetName"); + if (name != NULL) + { + g_string_append(gstr, sep); + g_string_append(gstr, name); + } + } + free(tmp); + char *str = g_string_free(gstr, FALSE); + return str; +} + static void -select_preset2(GtkBuilder *builder, hb_preset_index_t *path) +set_preset_menu_button_label(signal_user_data_t *ud, hb_preset_index_t *path) +{ + char * fullname, * text; + GtkLabel * label; + GhbValue * dict; + int type; + + dict = hb_preset_get(path); + type = ghb_dict_get_int(dict, "Type"); + fullname = preset_get_fullname(path, " > "); + label = GTK_LABEL(GHB_WIDGET(ud->builder, "presets_menu_button_label")); + text = g_strdup_printf("%s%s", type ? "Custom" : "Official", fullname); + gtk_label_set_text(label, text); + free(fullname); + free(text); +} + +static void +select_preset2(signal_user_data_t *ud, hb_preset_index_t *path) { GtkTreeView *treeview; GtkTreeSelection *selection; @@ -543,7 +592,7 @@ select_preset2(GtkBuilder *builder, hb_preset_index_t *path) if (path == NULL || path->depth == 0) return; - treeview = GTK_TREE_VIEW(GHB_WIDGET(builder, "presets_list")); + treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list")); selection = gtk_tree_view_get_selection (treeview); store = gtk_tree_view_get_model (treeview); treepath = ghb_tree_path_new_from_index(path); @@ -563,30 +612,31 @@ select_preset2(GtkBuilder *builder, hb_preset_index_t *path) gtk_tree_view_scroll_to_cell(treeview, treepath, NULL, FALSE, 0, 0); gtk_tree_path_free(treepath); } + set_preset_menu_button_label(ud, path); } void -ghb_select_preset(GtkBuilder *builder, const char *name) +ghb_select_preset(signal_user_data_t *ud, const char *name) { hb_preset_index_t *path; path = hb_preset_search_index(name, 1); if (path != NULL) { - select_preset2(builder, path); + select_preset2(ud, path); free(path); } } void -ghb_select_default_preset(GtkBuilder *builder) +ghb_select_default_preset(signal_user_data_t *ud) { hb_preset_index_t *path; path = hb_presets_get_default_index(); if (path != NULL) { - select_preset2(builder, path); + select_preset2(ud, path); g_free(path); } } @@ -1073,6 +1123,134 @@ get_preset_color(gint type, gboolean is_folder) return color; } +hb_preset_index_t * +get_selected_path(signal_user_data_t *ud) +{ + GtkTreeView *treeview; + GtkTreeSelection *selection; + GtkTreeModel *store; + GtkTreeIter iter; + + treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list")); + selection = gtk_tree_view_get_selection(treeview); + if (gtk_tree_selection_get_selected(selection, &store, &iter)) + { + return ghb_tree_get_index(store, &iter); + } + return NULL; +} + +G_MODULE_EXPORT void +preset_select_action_cb(GSimpleAction *action, GVariant *value, + signal_user_data_t *ud) +{ + const char * preset_path = g_variant_get_string(value, NULL); + + printf("value %s\n", preset_path); + ghb_select_preset(ud, preset_path); +} + +#if 1 +void +ghb_presets_menu_init(signal_user_data_t *ud) +{ + GMenu * menu = g_menu_new(); + hb_preset_index_t * path; + GhbValue * presets; + int menu_count, submenu_count, type, ii, jj; + + // Add official presets + path = hb_preset_index_init(NULL, 0); + presets = hb_presets_get_folder_children(path); + if (presets == NULL) + { + g_warning(_("ghb_presets_menu_init: Failed to find presets folder.")); + g_free(path); + return; + } + + menu_count = ghb_array_len(presets); + path->depth++; + // Process Official Presets in first pass, then Custom Presets + for (type = 0; type < 2; type++) + { + GMenu * section = g_menu_new(); + for (ii = 0; ii < menu_count; ii++) + { + GhbValue * dict; + const gchar * folder_name; + gint folder_type; + gboolean is_folder; + GhbValue * folder; + GString * folder_str; + + path->index[path->depth-1] = ii; + + dict = ghb_array_get(presets, ii); + folder_name = ghb_dict_get_string(dict, "PresetName"); + folder_type = ghb_dict_get_int(dict, "Type"); + is_folder = ghb_dict_get_bool(dict, "Folder"); + + if (folder_type != type) + { + continue; + } + + folder_str = g_string_new(""); + g_string_append_printf(folder_str, "/%s", folder_name); + if (is_folder) + { + GMenu * submenu = g_menu_new(); + + folder = hb_presets_get_folder_children(path); + submenu_count = ghb_array_len(folder); + for (jj = 0; jj < submenu_count; jj++) + { + const gchar * name; + GString * preset_str = g_string_new(folder_str->str); + + dict = ghb_array_get(folder, jj); + name = ghb_dict_get_string(dict, "PresetName"); + type = ghb_dict_get_int(dict, "Type"); + is_folder = ghb_dict_get_bool(dict, "Folder"); + + // Sanity check, Preset types must match their folder + if (type != folder_type) + { + continue; + } + // Enforce 2 level limit + if (is_folder) + { + continue; + } + g_string_append_printf(preset_str, "/%s", name); + + char * preset_path; + char * detail_action; + + preset_path = g_string_free(preset_str, FALSE); + detail_action = g_strdup_printf("app.preset-select(\"%s\")", + preset_path); + g_menu_append(submenu, name, detail_action); + free(preset_path); + } + g_menu_append_submenu(section, folder_name, + G_MENU_MODEL(submenu)); + } + g_string_free(folder_str, TRUE); + } + g_menu_append_section(menu, type ? "Custom" : "Official", + G_MENU_MODEL(section)); + } + + GtkMenuButton * mb; + + mb = GTK_MENU_BUTTON(GHB_WIDGET(ud->builder, "presets_menu_button")); + gtk_menu_button_set_menu_model(mb, G_MENU_MODEL(menu)); +} +#endif + void ghb_presets_list_init(signal_user_data_t *ud, const hb_preset_index_t *path) { @@ -1696,7 +1874,7 @@ settings_save(signal_user_data_t *ud, hb_preset_index_t *path, const char *name) ud->dont_clear_presets = TRUE; // Make the new preset the selected item - select_preset2(ud->builder, path); + select_preset2(ud, path); ud->dont_clear_presets = FALSE; return; } @@ -1760,7 +1938,8 @@ folder_save(signal_user_data_t *ud, hb_preset_index_t *path, const char *name) } G_MODULE_EXPORT void -preset_import_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +preset_import_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { GtkWindow *hb_window; GtkWidget *dialog; @@ -1831,38 +2010,22 @@ preset_import_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) ghb_presets_list_reinit(ud); if (index < 0) { - ghb_select_default_preset(ud->builder); + ghb_select_default_preset(ud); } else { hb_preset_index_t path; path.index[0] = index; path.depth = 1; - select_preset2(ud->builder, &path); + select_preset2(ud, &path); } } gtk_widget_destroy(dialog); } -hb_preset_index_t * -get_selected_path(signal_user_data_t *ud) -{ - GtkTreeView *treeview; - GtkTreeSelection *selection; - GtkTreeModel *store; - GtkTreeIter iter; - - treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "presets_list")); - selection = gtk_tree_view_get_selection(treeview); - if (gtk_tree_selection_get_selected(selection, &store, &iter)) - { - return ghb_tree_get_index(store, &iter); - } - return NULL; -} - G_MODULE_EXPORT void -preset_export_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +preset_export_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { hb_preset_index_t *path; const gchar *name; @@ -1939,7 +2102,8 @@ preset_export_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) } G_MODULE_EXPORT void -presets_new_folder_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +preset_folder_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { GtkWidget *dialog; GtkEntry *entry; @@ -1972,7 +2136,8 @@ presets_new_folder_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) } G_MODULE_EXPORT void -presets_save_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +preset_save_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { const gchar *name; const gchar *fullname; @@ -2028,18 +2193,20 @@ preset_type_changed_cb(GtkWidget *widget, signal_user_data_t *ud) } G_MODULE_EXPORT void -presets_restore_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +presets_reload_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { // Reload the builtin presets hb_presets_builtin_update(); store_presets(); ghb_presets_list_reinit(ud); - ghb_select_default_preset(ud->builder); + ghb_select_default_preset(ud); } G_MODULE_EXPORT void -presets_remove_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +preset_remove_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { GtkTreeView *treeview; GtkTreeSelection *selection; @@ -2102,7 +2269,7 @@ presets_remove_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) hb_preset_index_t *path; path = ghb_tree_get_index(store, &nextIter); - select_preset2(ud->builder, path); + select_preset2(ud, path); free(path); } } @@ -2364,7 +2531,7 @@ presets_drag_cb( // UI elements were shuffled again. recompute dst_path dst_path = ghb_tree_get_index(dst_model, &iter); presets_list_update_item(ud, dst_path, TRUE); - select_preset2(ud->builder, dst_path); + select_preset2(ud, dst_path); free(dst_path); store_presets(); @@ -2411,37 +2578,6 @@ presets_row_expanded_cb( store_presets(); } -char* -preset_get_fullname(hb_preset_index_t *path) -{ - int ii; - GString *gstr; - hb_preset_index_t *tmp; - GhbValue *dict; - - gstr = g_string_new(""); - tmp = hb_preset_index_dup(path); - for (ii = 1; ii <= path->depth; ii++) - { - const char *name; - tmp->depth = ii; - dict = hb_preset_get(tmp); - if (dict == NULL) - { - break; - } - name = ghb_dict_get_string(dict, "PresetName"); - if (name != NULL) - { - g_string_append(gstr, "/"); - g_string_append(gstr, name); - } - } - free(tmp); - char *str = g_string_free(gstr, FALSE); - return str; -} - // Makes a copy of the preset and assigns "PresetFullName" which // is use to look up the preset in the preset list should the need // arrise, e.g. saving changes to the preset. @@ -2467,7 +2603,7 @@ ghb_get_current_preset(signal_user_data_t *ud) char *fullname; preset = hb_value_dup(preset); - fullname = preset_get_fullname(path); + fullname = preset_get_fullname(path, "/"); ghb_dict_set_string(preset, "PresetFullName", fullname); free(fullname); } @@ -2479,10 +2615,10 @@ ghb_get_current_preset(signal_user_data_t *ud) G_MODULE_EXPORT void presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t *ud) { - GtkWidget *widget; - hb_preset_index_t *path; + GtkWidget * widget; + hb_preset_index_t * path; + gboolean sensitive = FALSE; - widget = GHB_WIDGET (ud->builder, "presets_remove"); path = get_selected_path(ud); if (path != NULL) { @@ -2491,20 +2627,19 @@ presets_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_ !ghb_dict_get_bool(ud->settings, "preset_reload")) { ghb_preset_to_settings(ud->settings, dict); - char *fullname = preset_get_fullname(path); + char *fullname = preset_get_fullname(path, "/"); ghb_dict_set_string(ud->settings, "PresetFullName", fullname); free(fullname); ghb_set_current_title_settings(ud); ghb_load_post_settings(ud); + set_preset_menu_button_label(ud, path); } - gtk_widget_set_sensitive(widget, TRUE); free(path); } - else - { - g_debug(_("No selection??? Perhaps unselected.")); - gtk_widget_set_sensitive(widget, FALSE); - } + widget = GHB_WIDGET (ud->builder, "presets_remove"); + gtk_widget_set_sensitive(widget, sensitive); + widget = GHB_WIDGET (ud->builder, "presets_window_remove"); + gtk_widget_set_sensitive(widget, sensitive); } void @@ -2521,7 +2656,8 @@ ghb_clear_presets_selection(signal_user_data_t *ud) } G_MODULE_EXPORT void -presets_default_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +preset_default_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { hb_preset_index_t *path = get_selected_path(ud); if (path != NULL) diff --git a/gtk/src/presets.h b/gtk/src/presets.h index d2d385372..b71137375 100644 --- a/gtk/src/presets.h +++ b/gtk/src/presets.h @@ -42,10 +42,11 @@ gchar* ghb_get_user_config_dir(gchar *subdir); void ghb_override_user_config_dir(char *dir); void ghb_settings_to_ui(signal_user_data_t *ud, GhbValue *dict); void ghb_clear_presets_selection(signal_user_data_t *ud); -void ghb_select_preset(GtkBuilder *builder, const char *name); -void ghb_select_default_preset(GtkBuilder *builder); +void ghb_select_preset(signal_user_data_t *ud, const char *name); +void ghb_select_default_preset(signal_user_data_t *ud); void ghb_presets_list_init(signal_user_data_t *ud, const hb_preset_index_t *path); +void ghb_presets_menu_init(signal_user_data_t *ud); int ghb_find_pid_file(); void ghb_write_pid_file(); GhbValue* ghb_get_current_preset(signal_user_data_t *ud); diff --git a/gtk/src/preview.c b/gtk/src/preview.c index 9dcf81c4f..508e284b9 100644 --- a/gtk/src/preview.c +++ b/gtk/src/preview.c @@ -936,7 +936,7 @@ init_preview_image(signal_user_data_t *ud) title_id = ghb_dict_get_int(ud->settings, "title"); title = ghb_lookup_title(title_id, &titleindex); - if (title == NULL) + if (title == NULL && ud->preview->pix != NULL) { g_object_unref(ud->preview->pix); ud->preview->pix = NULL; @@ -1068,22 +1068,19 @@ preview_button_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, si } void -ghb_preview_set_visible(signal_user_data_t *ud) +ghb_preview_set_visible(signal_user_data_t *ud, gboolean visible) { + GtkWidget *widget; +#if 0 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 &= title != NULL; + visible &= title != NULL; +#endif widget = GHB_WIDGET(ud->builder, "preview_window"); - if (active) + if (visible) { gint x, y; x = ghb_dict_get_int(ud->prefs, "preview_x"); @@ -1092,7 +1089,7 @@ ghb_preview_set_visible(signal_user_data_t *ud) gtk_window_move(GTK_WINDOW(widget), x, y); gtk_window_deiconify(GTK_WINDOW(widget)); } - gtk_widget_set_visible(widget, active); + gtk_widget_set_visible(widget, visible); } static void @@ -1113,29 +1110,14 @@ update_preview_labels(signal_user_data_t *ud, gboolean active) } G_MODULE_EXPORT void -preview_toggled_cb(GtkWidget *xwidget, signal_user_data_t *ud) -{ - 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 -preview_menu_toggled_cb(GtkWidget *xwidget, signal_user_data_t *ud) +show_preview_action_cb(GSimpleAction *action, GVariant *value, + signal_user_data_t *ud) { - GtkToggleToolButton *button; - gboolean active; + gboolean state = g_variant_get_boolean(value); - 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); + g_simple_action_set_state(action, value); + ghb_preview_set_visible(ud, state); + update_preview_labels(ud, state); } G_MODULE_EXPORT void diff --git a/gtk/src/preview.h b/gtk/src/preview.h index 0caefcecf..216e9e8df 100644 --- a/gtk/src/preview.h +++ b/gtk/src/preview.h @@ -35,6 +35,6 @@ void ghb_live_encode_done(signal_user_data_t *ud, gboolean success); void ghb_preview_cleanup(signal_user_data_t *ud); void ghb_live_reset(signal_user_data_t *ud); void ghb_par_scale(signal_user_data_t *ud, gint *width, gint *height, gint par_n, gint par_d); -void ghb_preview_set_visible(signal_user_data_t *ud); +void ghb_preview_set_visible(signal_user_data_t *ud, gboolean visible); #endif // _GHB_PREVIEW_H_ diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index c8fdd00fc..09c6e74e4 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -973,7 +973,8 @@ open_queue_file(signal_user_data_t *ud) } G_MODULE_EXPORT void -queue_save_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) +queue_save_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { save_queue_file(ud); } @@ -1328,7 +1329,6 @@ static gboolean queue_add(signal_user_data_t *ud, GhbValue *settings, gint batch) { // Add settings to the queue - g_debug("queue_add ()"); if (!validate_settings(ud, settings, batch)) { return FALSE; @@ -1369,9 +1369,9 @@ queue_add(signal_user_data_t *ud, GhbValue *settings, gint batch) } G_MODULE_EXPORT void -queue_add_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) +queue_add_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { - g_debug("queue_add_clicked_cb ()"); queue_add(ud, ud->settings, 0); // Validation of settings may have changed audio list ghb_audio_list_refresh_all(ud); @@ -1830,10 +1830,9 @@ GtkWidget * title_create_row(signal_user_data_t *ud) } G_MODULE_EXPORT void -queue_add_multiple_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) +queue_add_all_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { - g_debug("queue_add_multiple_clicked_cb ()"); - GtkListBox *list; GtkWidget *row; gint count, ii; @@ -1974,6 +1973,7 @@ ghb_queue_remove_row(signal_user_data_t *ud, int row) { ghb_queue_remove_row_internal(ud, row); ghb_save_queue(ud->queue); + ghb_queue_buttons_grey(ud); } G_MODULE_EXPORT void @@ -1988,6 +1988,7 @@ queue_delete_all_clicked_cb(GtkWidget *widget, signal_user_data_t *ud) } ghb_save_queue(ud->queue); ghb_update_pending(ud); + ghb_queue_buttons_grey(ud); } G_MODULE_EXPORT void @@ -2003,7 +2004,6 @@ queue_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) GhbValue *queueDict, *uiDict; gint status; - g_debug("queue_remove_clicked_cb ()"); treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "queue_list")); store = gtk_tree_view_get_model(treeview); treepath = gtk_tree_path_new_from_string (path); @@ -2043,6 +2043,7 @@ queue_remove_clicked_cb(GtkWidget *widget, gchar *path, signal_user_data_t *ud) gtk_tree_path_free (treepath); } ghb_update_pending(ud); + ghb_queue_buttons_grey(ud); } static gint @@ -2267,12 +2268,13 @@ queue_drag_cb( void ghb_queue_buttons_grey(signal_user_data_t *ud) { - GtkWidget *widget; + GtkWidget * widget; + GSimpleAction * action; gint queue_count; gint title_id, titleindex; const hb_title_t *title; gint queue_state, scan_state; - gboolean show_start, show_stop, paused; + gboolean allow_start, show_stop, allow_add, paused; queue_count = ghb_array_len(ud->queue); title_id = ghb_dict_get_int(ud->settings, "title"); @@ -2281,50 +2283,54 @@ ghb_queue_buttons_grey(signal_user_data_t *ud) queue_state = ghb_get_queue_state(); scan_state = ghb_get_scan_state(); - show_stop = queue_state & - (GHB_STATE_WORKING | GHB_STATE_SEARCHING | - GHB_STATE_SCANNING | GHB_STATE_MUXING | GHB_STATE_PAUSED); - show_start = !(scan_state & GHB_STATE_SCANNING) && - (title !=NULL || queue_count > 0); + show_stop = queue_state & + (GHB_STATE_WORKING | GHB_STATE_SEARCHING | + GHB_STATE_SCANNING | GHB_STATE_MUXING | GHB_STATE_PAUSED); + allow_start = !(scan_state & GHB_STATE_SCANNING) && + (title != NULL || queue_count > 0); + allow_add = !(scan_state & GHB_STATE_SCANNING) && title != NULL; paused = queue_state & GHB_STATE_PAUSED; - widget = GHB_WIDGET(ud->builder, "queue_save"); - gtk_widget_set_sensitive(widget, !!queue_count); - widget = GHB_WIDGET(ud->builder, "queue_add"); - gtk_widget_set_sensitive(widget, show_start); - widget = GHB_WIDGET(ud->builder, "queue_add_menu"); - gtk_widget_set_sensitive(widget, show_start); - widget = GHB_WIDGET(ud->builder, "queue_add_multiple_menu"); - gtk_widget_set_sensitive(widget, show_start); - - widget = GHB_WIDGET (ud->builder, "queue_start1"); + action = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(ud->app), + "queue-save")); + g_simple_action_set_enabled(action, !!queue_count); + action = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(ud->app), + "queue-add")); + g_simple_action_set_enabled(action, allow_add); + action = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(ud->app), + "queue-add-all")); + g_simple_action_set_enabled(action, allow_add); + action = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(ud->app), + "queue-start")); + g_simple_action_set_enabled(action, allow_start || show_stop); + action = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(ud->app), + "queue-pause")); + g_simple_action_set_enabled(action, show_stop); + + widget = GHB_WIDGET (ud->builder, "queue_start"); if (show_stop) { - gtk_widget_set_sensitive (widget, TRUE); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-stop"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), _("Stop\nEncoding")); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Stop Encoding")); } else { - gtk_widget_set_sensitive (widget, show_start); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), _("Start\nEncoding")); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Start Encoding")); } - widget = GHB_WIDGET (ud->builder, "queue_pause1"); + widget = GHB_WIDGET (ud->builder, "queue_pause"); if (paused) { - gtk_widget_set_sensitive (widget, show_stop); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-start"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), _("Resume\nEncoding")); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Resume Encoding")); } else { - gtk_widget_set_sensitive (widget, show_stop); gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(widget), "hb-pause"); gtk_tool_button_set_label(GTK_TOOL_BUTTON(widget), _("Pause\nEncoding")); gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(widget), _("Pause Encoding")); @@ -2333,26 +2339,22 @@ ghb_queue_buttons_grey(signal_user_data_t *ud) widget = GHB_WIDGET (ud->builder, "queue_start_menu"); if (show_stop) { - gtk_widget_set_sensitive (widget, TRUE); gtk_menu_item_set_label(GTK_MENU_ITEM(widget), _("S_top Encoding")); gtk_widget_set_tooltip_text(widget, _("Stop Encoding")); } else { - gtk_widget_set_sensitive (widget, show_start); gtk_menu_item_set_label(GTK_MENU_ITEM(widget), _("_Start Encoding")); gtk_widget_set_tooltip_text(widget, _("Start Encoding")); } widget = GHB_WIDGET (ud->builder, "queue_pause_menu"); if (paused) { - gtk_widget_set_sensitive (widget, show_start); gtk_menu_item_set_label(GTK_MENU_ITEM(widget), _("_Resume Encoding")); gtk_widget_set_tooltip_text(widget, _("Resume Encoding")); } else { - gtk_widget_set_sensitive (widget, show_stop); gtk_menu_item_set_label(GTK_MENU_ITEM(widget), _("_Pause Encoding")); gtk_widget_set_tooltip_text(widget, _("Pause Encoding")); } @@ -2374,7 +2376,8 @@ queue_list_size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation, GtkCel } G_MODULE_EXPORT void -queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +queue_start_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { GhbValue *queueDict, *uiDict; gboolean running = FALSE; @@ -2423,7 +2426,8 @@ queue_start_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) } G_MODULE_EXPORT void -queue_pause_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud) +queue_pause_action_cb(GSimpleAction *action, GVariant *param, + signal_user_data_t *ud) { ghb_pause_resume_queue(); } diff --git a/gtk/src/resources.c b/gtk/src/resources.c index 515dc43ae..3fb95344f 100644 --- a/gtk/src/resources.c +++ b/gtk/src/resources.c @@ -48,21 +48,21 @@ ghb_resource_init() GResource *data_res = ghb_data_get_resource(); gbytes = g_resource_lookup_data(data_res, - "/org/handbrake/data/internal_defaults.json", 0, NULL); + "/org/handbrake/ghb/data/internal_defaults.json", 0, NULL); data = g_bytes_get_data(gbytes, &data_size); val = ghb_json_parse(data); g_bytes_unref(gbytes); ghb_dict_set(resources, "internal-defaults", val); gbytes = g_resource_lookup_data(data_res, - "/org/handbrake/data/widget.deps", 0, NULL); + "/org/handbrake/ghb/data/widget.deps", 0, NULL); data = g_bytes_get_data(gbytes, &data_size); val = ghb_json_parse(data); g_bytes_unref(gbytes); ghb_dict_set(resources, "widget-deps", val); gbytes = g_resource_lookup_data(data_res, - "/org/handbrake/data/widget_reverse.deps", 0, NULL); + "/org/handbrake/ghb/data/widget_reverse.deps", 0, NULL); data = g_bytes_get_data(gbytes, &data_size); val = ghb_json_parse(data); g_bytes_unref(gbytes); diff --git a/gtk/src/settings.h b/gtk/src/settings.h index 22ad7a6b8..13470e45f 100644 --- a/gtk/src/settings.h +++ b/gtk/src/settings.h @@ -29,7 +29,6 @@ #define GHB_WIDGET(b,n) GTK_WIDGET(gtk_builder_get_object ((b), (n))) //#define GHB_WIDGET(b,n) GTK_WIDGET(debug_get_object((b), (n))) -#define GHB_ACTION(b,n) GTK_ACTION(gtk_builder_get_object ((b), (n))) #define GHB_OBJECT(b,n) gtk_builder_get_object ((b), (n)) GObject* debug_get_object(GtkBuilder *b, const gchar *n); @@ -59,23 +58,25 @@ typedef struct preview_s preview_t; typedef struct { gchar *current_dvd_device; - gboolean debug; - gboolean dont_clear_presets; - gboolean scale_busy; - gint cancel_encode; - GtkBuilder *builder; - GhbValue *x264_priv; - GhbValue *globals; - GhbValue *prefs; - GhbValue *settings; - GhbValue *settings_array; - GhbValue *queue; - GIOChannel *activity_log; - GIOChannel *job_activity_log; - preview_t *preview; - gchar *appcast; - gint appcast_len; - GdkVisibilityState hb_visibility; + gboolean debug; + gboolean dont_clear_presets; + gboolean scale_busy; + gint cancel_encode; + GtkBuilder * builder; + GhbValue * x264_priv; + GhbValue * globals; + GhbValue * prefs; + GhbValue * settings; + GhbValue * settings_array; + GhbValue * queue; + GIOChannel * activity_log; + GIOChannel * job_activity_log; + preview_t * preview; + gchar * appcast; + gint appcast_len; + GdkVisibilityState hb_visibility; + int stderr_src_id; + GtkApplication * app; } signal_user_data_t; enum diff --git a/gtk/src/ui_res.gresource.xml b/gtk/src/ui_res.gresource.xml index 214aa8ce7..0a06993d6 100644 --- a/gtk/src/ui_res.gresource.xml +++ b/gtk/src/ui_res.gresource.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <gresources> - <gresource prefix="/org/handbrake/ui"> + <gresource prefix="/org/handbrake/ghb/ui"> <file>ghb.ui</file> </gresource> </gresources> |