diff options
author | jstebbins <[email protected]> | 2015-01-11 20:45:21 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2015-01-11 20:45:21 +0000 |
commit | 4c9a2335aaeadb89bce515b5cd5f0ad66dd7788d (patch) | |
tree | eb51eee90706fdb600f38398c16e6235f82b78d6 /gtk | |
parent | fca1620cd234a97a896116b30ff9a3d3d31eb685 (diff) |
LinGui: fix parent window of dialogs
libgtk has started complaining about floating dialogs
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6734 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/callbacks.c | 30 | ||||
-rw-r--r-- | gtk/src/callbacks.h | 5 | ||||
-rw-r--r-- | gtk/src/ghb-3.14.ui | 8 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 34 | ||||
-rw-r--r-- | gtk/src/hb-backend.h | 8 | ||||
-rw-r--r-- | gtk/src/presets.c | 10 | ||||
-rw-r--r-- | gtk/src/preview.c | 5 | ||||
-rw-r--r-- | gtk/src/queuehandler.c | 31 |
8 files changed, 89 insertions, 42 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c index 4dae08a23..4cdf210ea 100644 --- a/gtk/src/callbacks.c +++ b/gtk/src/callbacks.c @@ -1551,11 +1551,13 @@ destination_browse_clicked_cb(GtkButton *button, signal_user_data_t *ud) GtkEntry *entry; gchar *destname; gchar *basename; + GtkWindow *hb_window; g_debug("destination_browse_clicked_cb ()"); + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); destname = ghb_settings_get_string(ud->settings, "destination"); - dialog = gtk_file_chooser_dialog_new ("Choose Destination", - NULL, + dialog = gtk_file_chooser_dialog_new("Choose Destination", + hb_window, GTK_FILE_CHOOSER_ACTION_SAVE, GHB_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GHB_STOCK_SAVE, GTK_RESPONSE_ACCEPT, @@ -2531,6 +2533,7 @@ ghb_countdown_dialog( signal_user_data_t *ud, gint timeout) { + GtkWindow *hb_window; GtkWidget *dialog; GtkResponseType response; guint timeout_id; @@ -2542,7 +2545,8 @@ ghb_countdown_dialog( cd.ud = ud; // Toss up a warning dialog - dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); + dialog = gtk_message_dialog_new(hb_window, GTK_DIALOG_MODAL, type, GTK_BUTTONS_NONE, _("%s\n\n%s in %d seconds ..."), message, action, timeout); @@ -2567,13 +2571,13 @@ ghb_countdown_dialog( } gboolean -ghb_message_dialog(GtkMessageType type, const gchar *message, const gchar *no, const gchar *yes) +ghb_message_dialog(GtkWindow *parent, GtkMessageType type, const gchar *message, const gchar *no, const gchar *yes) { GtkWidget *dialog; GtkResponseType response; // Toss up a warning dialog - dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, + dialog = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL, type, GTK_BUTTONS_NONE, "%s", message); gtk_dialog_add_buttons( GTK_DIALOG(dialog), @@ -2589,12 +2593,12 @@ ghb_message_dialog(GtkMessageType type, const gchar *message, const gchar *no, c } void -ghb_error_dialog(GtkMessageType type, const gchar *message, const gchar *cancel) +ghb_error_dialog(GtkWindow *parent, GtkMessageType type, const gchar *message, const gchar *cancel) { GtkWidget *dialog; // Toss up a warning dialog - dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, + dialog = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL, type, GTK_BUTTONS_NONE, "%s", message); gtk_dialog_add_buttons( GTK_DIALOG(dialog), @@ -2606,12 +2610,14 @@ ghb_error_dialog(GtkMessageType type, const gchar *message, const gchar *cancel) void ghb_cancel_encode(signal_user_data_t *ud, const gchar *extra_msg) { + GtkWindow *hb_window; GtkWidget *dialog; GtkResponseType response; if (extra_msg == NULL) extra_msg = ""; // Toss up a warning dialog - dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); + dialog = gtk_message_dialog_new(hb_window, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, _("%sYour movie will be lost if you don't continue encoding."), extra_msg); @@ -2646,12 +2652,14 @@ ghb_cancel_encode(signal_user_data_t *ud, const gchar *extra_msg) gboolean ghb_cancel_encode2(signal_user_data_t *ud, const gchar *extra_msg) { + GtkWindow *hb_window; GtkWidget *dialog; GtkResponseType response; if (extra_msg == NULL) extra_msg = ""; // Toss up a warning dialog - dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); + dialog = gtk_message_dialog_new(hb_window, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, _("%sYour movie will be lost if you don't continue encoding."), extra_msg); @@ -4874,11 +4882,13 @@ tweak_setting_cb( ghb_settings_set_string(ud->settings, tweak_name, tweak); else { + GtkWindow *hb_window; gchar *message; + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); message = g_strdup_printf( _("Invalid Settings:\n%s"), tweak); - ghb_message_dialog(GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); + ghb_message_dialog(hb_window, GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); g_free(message); } } diff --git a/gtk/src/callbacks.h b/gtk/src/callbacks.h index ce5ae3b9b..eb7c02260 100644 --- a/gtk/src/callbacks.h +++ b/gtk/src/callbacks.h @@ -52,10 +52,11 @@ void ghb_hbfd(signal_user_data_t *ud, gboolean hbfd); gboolean ghb_file_menu_add_dvd(signal_user_data_t *ud); void ghb_udev_init(void); gboolean ghb_message_dialog( - GtkMessageType type, const gchar *message, + GtkWindow *parent, GtkMessageType type, const gchar *message, const gchar *no, const gchar *yes); void ghb_error_dialog( - GtkMessageType type, const gchar *message, const gchar *cancel); + GtkWindow *parent, GtkMessageType type, + const gchar *message, const gchar *cancel); void ghb_init_dep_map(void); void ghb_cancel_encode(signal_user_data_t *ud, const gchar *extra_msg); gboolean ghb_cancel_encode2(signal_user_data_t *ud, const gchar *extra_msg); diff --git a/gtk/src/ghb-3.14.ui b/gtk/src/ghb-3.14.ui index de5997bcd..a057ced78 100644 --- a/gtk/src/ghb-3.14.ui +++ b/gtk/src/ghb-3.14.ui @@ -338,6 +338,7 @@ conjunction with the "Forced" option.</property> <property name="page_increment">1</property> </object> <object class="GtkAboutDialog" id="hb_about"> + <property name="transient_for">hb_window</property> <property name="can_focus">False</property> <property name="border_width">5</property> <property name="title" translatable="yes">About HandBrake</property> @@ -6504,6 +6505,7 @@ Resets all queue jobs to pending and ready to run again.</property> <property name="page_increment">10</property> </object> <object class="GtkDialog" id="titla_add_multiple_dialog"> + <property name="transient_for">hb_window</property> <property name="can_focus">False</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> @@ -6701,6 +6703,7 @@ Resets all queue jobs to pending and ready to run again.</property> </action-widgets> </object> <object class="GtkDialog" id="prefs_dialog"> + <property name="transient_for">hb_window</property> <property name="can_focus">False</property> <property name="border_width">5</property> <property name="title" translatable="yes">Preferences</property> @@ -7429,6 +7432,7 @@ Check this if you want the queue to clean itself up by deleting completed jobs.< </action-widgets> </object> <object class="GtkDialog" id="preset_new_folder_dialog"> + <property name="transient_for">hb_window</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="border_width">5</property> @@ -7591,6 +7595,7 @@ Check this if you want the queue to clean itself up by deleting completed jobs.< </action-widgets> </object> <object class="GtkDialog" id="preset_save_dialog"> + <property name="transient_for">hb_window</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="border_width">5</property> @@ -8390,6 +8395,7 @@ Setting this to 0 means there is no maximum height.</property> </action-widgets> </object> <object class="GtkDialog" id="subtitle_dialog"> + <property name="transient_for">hb_window</property> <property name="can_focus">False</property> <property name="border_width">5</property> <property name="modal">True</property> @@ -8780,6 +8786,7 @@ in your output.</property> </action-widgets> </object> <object class="GtkDialog" id="audio_dialog"> + <property name="transient_for">hb_window</property> <property name="can_focus">False</property> <property name="border_width">5</property> <property name="modal">True</property> @@ -9307,6 +9314,7 @@ DRC allows you to 'compress' the range by making loud sounds softer and soft sou </action-widgets> </object> <object class="GtkDialog" id="update_dialog"> + <property name="transient_for">hb_window</property> <property name="can_focus">False</property> <property name="border_width">5</property> <property name="modal">True</property> diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index f84049b1f..da7252f78 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -3869,7 +3869,7 @@ ghb_validate_filter_string(const gchar *str, gint max_fields) } gboolean -ghb_validate_filters(GValue *settings) +ghb_validate_filters(GValue *settings, GtkWindow *parent) { gchar *str; gint index; @@ -3886,7 +3886,8 @@ ghb_validate_filters(GValue *settings) message = g_strdup_printf( _("Invalid Deinterlace Settings:\n\n%s\n"), str); - ghb_message_dialog(GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); + ghb_message_dialog(parent, GTK_MESSAGE_ERROR, + message, _("Cancel"), NULL); g_free(message); g_free(str); return FALSE; @@ -3903,7 +3904,8 @@ ghb_validate_filters(GValue *settings) message = g_strdup_printf( _("Invalid Detelecine Settings:\n\n%s\n"), str); - ghb_message_dialog(GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); + ghb_message_dialog(parent, GTK_MESSAGE_ERROR, + message, _("Cancel"), NULL); g_free(message); g_free(str); return FALSE; @@ -3920,7 +3922,8 @@ ghb_validate_filters(GValue *settings) message = g_strdup_printf( _("Invalid Decomb Settings:\n\n%s\n"), str); - ghb_message_dialog(GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); + ghb_message_dialog(parent, GTK_MESSAGE_ERROR, + message, _("Cancel"), NULL); g_free(message); g_free(str); return FALSE; @@ -3933,7 +3936,7 @@ ghb_validate_filters(GValue *settings) } gboolean -ghb_validate_video(GValue *settings) +ghb_validate_video(GValue *settings, GtkWindow *parent) { gint vcodec; gchar *message; @@ -3951,7 +3954,8 @@ ghb_validate_video(GValue *settings) _("Theora is not supported in the MP4 container.\n\n" "You should choose a different video codec or container.\n" "If you continue, FFMPEG will be chosen for you.")); - if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, _("Cancel"), _("Continue"))) + if (!ghb_message_dialog(parent, GTK_MESSAGE_WARNING, + message, _("Cancel"), _("Continue"))) { g_free(message); return FALSE; @@ -3965,7 +3969,7 @@ ghb_validate_video(GValue *settings) } gboolean -ghb_validate_subtitles(GValue *settings) +ghb_validate_subtitles(GValue *settings, GtkWindow *parent) { gint title_id, titleindex; const hb_title_t * title; @@ -3999,7 +4003,8 @@ ghb_validate_subtitles(GValue *settings) _("Only one subtitle may be burned into the video.\n\n" "You should change your subtitle selections.\n" "If you continue, some subtitles will be lost.")); - if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, _("Cancel"), _("Continue"))) + if (!ghb_message_dialog(parent, GTK_MESSAGE_WARNING, + message, _("Cancel"), _("Continue"))) { g_free(message); return FALSE; @@ -4022,7 +4027,7 @@ ghb_validate_subtitles(GValue *settings) _("Srt file does not exist or not a regular file.\n\n" "You should choose a valid file.\n" "If you continue, this subtitle will be ignored.")); - if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, + if (!ghb_message_dialog(parent, GTK_MESSAGE_WARNING, message, _("Cancel"), _("Continue"))) { g_free(message); @@ -4037,7 +4042,7 @@ ghb_validate_subtitles(GValue *settings) } gboolean -ghb_validate_audio(GValue *settings) +ghb_validate_audio(GValue *settings, GtkWindow *parent) { gint title_id, titleindex; const hb_title_t * title; @@ -4086,7 +4091,8 @@ ghb_validate_audio(GValue *settings) _("The source does not support Pass-Thru.\n\n" "You should choose a different audio codec.\n" "If you continue, one will be chosen for you.")); - if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, _("Cancel"), _("Continue"))) + if (!ghb_message_dialog(parent, GTK_MESSAGE_WARNING, + message, _("Cancel"), _("Continue"))) { g_free(message); return FALSE; @@ -4126,7 +4132,8 @@ ghb_validate_audio(GValue *settings) _("%s is not supported in the %s container.\n\n" "You should choose a different audio codec.\n" "If you continue, one will be chosen for you."), a_unsup, mux_s); - if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, _("Cancel"), _("Continue"))) + if (!ghb_message_dialog(parent, GTK_MESSAGE_WARNING, + message, _("Cancel"), _("Continue"))) { g_free(message); return FALSE; @@ -4150,7 +4157,8 @@ ghb_validate_audio(GValue *settings) _("The source audio does not support %s mixdown.\n\n" "You should choose a different mixdown.\n" "If you continue, one will be chosen for you."), mix_unsup); - if (!ghb_message_dialog(GTK_MESSAGE_WARNING, message, _("Cancel"), _("Continue"))) + if (!ghb_message_dialog(parent, GTK_MESSAGE_WARNING, + message, _("Cancel"), _("Continue"))) { g_free(message); return FALSE; diff --git a/gtk/src/hb-backend.h b/gtk/src/hb-backend.h index 4d946fc0d..fd6e5a641 100644 --- a/gtk/src/hb-backend.h +++ b/gtk/src/hb-backend.h @@ -144,10 +144,10 @@ gint ghb_subtitle_track_source(GValue *settings, gint track); const gchar* ghb_subtitle_track_lang(GValue *settings, gint track); gboolean ghb_validate_vquality(GValue *settings); -gboolean ghb_validate_audio(GValue *settings); -gboolean ghb_validate_subtitles(GValue *settings); -gboolean ghb_validate_video(GValue *settings); -gboolean ghb_validate_filters(GValue *settings); +gboolean ghb_validate_audio(GValue *settings, GtkWindow *parent); +gboolean ghb_validate_subtitles(GValue *settings, GtkWindow *parent); +gboolean ghb_validate_video(GValue *settings, GtkWindow *parent); +gboolean ghb_validate_filters(GValue *settings, GtkWindow *parent); gboolean ghb_validate_filter_string(const gchar *str, gint max_fields); void ghb_hb_cleanup(gboolean partial); gint ghb_lookup_combo_int(const gchar *name, const GValue *gval); diff --git a/gtk/src/presets.c b/gtk/src/presets.c index cfd68a168..ab07d14f3 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -3163,12 +3163,15 @@ settings_save(signal_user_data_t *ud, const GValue *path) { if (ghb_presets_get_folder(presetsPlist, indices, len)) { + GtkWindow *hb_window; gchar *message; + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); message = g_strdup_printf( _("%s: Folder already exists.\n" "You can not replace it with a preset."), name); - ghb_message_dialog(GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); + ghb_message_dialog(hb_window, GTK_MESSAGE_ERROR, + message, _("Cancel"), NULL); g_free(message); return; } @@ -3253,12 +3256,15 @@ folder_save(signal_user_data_t *ud, const GValue *path) { if (!ghb_presets_get_folder(presetsPlist, indices, len)) { + GtkWindow *hb_window; gchar *message; + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); message = g_strdup_printf( _("%s: Preset already exists.\n" "You can not replace it with a folder."), name); - ghb_message_dialog(GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); + ghb_message_dialog(hb_window, GTK_MESSAGE_ERROR, + message, _("Cancel"), NULL); g_free(message); g_free(indices); return; diff --git a/gtk/src/preview.c b/gtk/src/preview.c index c58281306..cb78fce7e 100644 --- a/gtk/src/preview.c +++ b/gtk/src/preview.c @@ -546,6 +546,8 @@ live_preview_cb(GstBus *bus, GstMessage *msg, gpointer data) //printf("element\n"); if (gst_is_missing_plugin_message(msg)) { + GtkWindow *hb_window; + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); gst_element_set_state(ud->preview->play, GST_STATE_PAUSED); gchar *message, *desc; desc = gst_missing_plugin_message_get_description(msg); @@ -553,7 +555,8 @@ live_preview_cb(GstBus *bus, GstMessage *msg, gpointer data) _("Missing GStreamer plugin\n" "Audio or Video may not play as expected\n\n%s"), desc); - ghb_message_dialog(GTK_MESSAGE_WARNING, message, "Ok", NULL); + ghb_message_dialog(hb_window, GTK_MESSAGE_WARNING, + message, "Ok", NULL); g_free(message); gst_element_set_state(ud->preview->play, GST_STATE_PLAYING); } diff --git a/gtk/src/queuehandler.c b/gtk/src/queuehandler.c index 021c56913..a7bd80ec4 100644 --- a/gtk/src/queuehandler.c +++ b/gtk/src/queuehandler.c @@ -780,6 +780,9 @@ validate_settings(signal_user_data_t *ud, GValue *settings, gint batch) gint count, ii; gint title_id, titleindex; const hb_title_t *title; + GtkWindow *hb_window; + + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); title_id = ghb_settings_get_int(settings, "title"); title = ghb_lookup_title(title_id, &titleindex); @@ -800,7 +803,8 @@ validate_settings(signal_user_data_t *ud, GValue *settings, gint batch) "Another queued job has specified the same destination.\n" "Do you want to overwrite?"), dest); - if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, _("Cancel"), _("Overwrite"))) + if (!ghb_message_dialog(hb_window, GTK_MESSAGE_QUESTION, + message, _("Cancel"), _("Overwrite"))) { g_free(message); return FALSE; @@ -816,7 +820,8 @@ validate_settings(signal_user_data_t *ud, GValue *settings, gint batch) _("Destination: %s\n\n" "This is not a valid directory."), destdir); - ghb_message_dialog(GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); + ghb_message_dialog(hb_window, GTK_MESSAGE_ERROR, + message, _("Cancel"), NULL); g_free(message); g_free(destdir); return FALSE; @@ -829,7 +834,8 @@ validate_settings(signal_user_data_t *ud, GValue *settings, gint batch) _("Destination: %s\n\n" "Can not read or write the directory."), destdir); - ghb_message_dialog(GTK_MESSAGE_ERROR, message, _("Cancel"), NULL); + ghb_message_dialog(hb_window, GTK_MESSAGE_ERROR, + message, _("Cancel"), NULL); g_free(message); g_free(destdir); return FALSE; @@ -859,7 +865,8 @@ validate_settings(signal_user_data_t *ud, GValue *settings, gint batch) _("Destination filesystem is almost full: %uM free\n\n" "Encode may be incomplete if you proceed.\n"), (guint)(size / (1024L*1024L))); - if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, _("Cancel"), _("Proceed"))) + if (!ghb_message_dialog(hb_window, GTK_MESSAGE_QUESTION, + message, _("Cancel"), _("Proceed"))) { g_free(message); g_free(destdir); @@ -881,7 +888,8 @@ validate_settings(signal_user_data_t *ud, GValue *settings, gint batch) "File already exists.\n" "Do you want to overwrite?"), dest); - if (!ghb_message_dialog(GTK_MESSAGE_QUESTION, message, _("Cancel"), _("Overwrite"))) + if (!ghb_message_dialog(hb_window, GTK_MESSAGE_QUESTION, + message, _("Cancel"), _("Overwrite"))) { g_free(message); return FALSE; @@ -890,22 +898,22 @@ validate_settings(signal_user_data_t *ud, GValue *settings, gint batch) g_unlink(dest); } // Validate audio settings - if (!ghb_validate_audio(settings)) + if (!ghb_validate_audio(settings, hb_window)) { return FALSE; } // Validate audio settings - if (!ghb_validate_subtitles(settings)) + if (!ghb_validate_subtitles(settings, hb_window)) { return FALSE; } // Validate video settings - if (!ghb_validate_video(settings)) + if (!ghb_validate_video(settings, hb_window)) { return FALSE; } // Validate filter settings - if (!ghb_validate_filters(settings)) + if (!ghb_validate_filters(settings, hb_window)) { return FALSE; } @@ -1968,10 +1976,13 @@ find_pid: if (unfinished) { + GtkWindow *hb_window; + hb_window = GTK_WINDOW(GHB_WIDGET(ud->builder, "hb_window")); message = g_strdup_printf( _("You have %d unfinished job(s) in a saved queue.\n\n" "Would you like to reload them?"), unfinished); - if (ghb_message_dialog(GTK_MESSAGE_QUESTION, message, _("No"), _("Yes"))) + if (ghb_message_dialog(hb_window, GTK_MESSAGE_QUESTION, + message, _("No"), _("Yes"))) { GtkWidget *widget = GHB_WIDGET(ud->builder, "show_queue"); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(widget), TRUE); |