From 108f7fbd117b32f7722fef89ffb8143a4031c07b Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 30 Dec 2017 17:20:58 +0000 Subject: [PATCH] Fix some transient parent warnings --- gnucash/gnome-utils/dialog-preferences.c | 13 ++++++++----- gnucash/gnome-utils/dialog-preferences.h | 4 +++- gnucash/gnome-utils/gnc-main-window.c | 2 +- gnucash/gnome/dialog-fincalc.c | 6 +++++- gnucash/gnome/dialog-fincalc.h | 2 +- gnucash/gnome/dialog-trans-assoc.c | 10 +++++++--- gnucash/gnome/dialog-trans-assoc.h | 2 +- gnucash/gnome/gnc-plugin-basic-commands.c | 10 +++++----- gnucash/gnome/gtkbuilder/dialog-price.glade | 1 - gnucash/gnome/gtkbuilder/dialog-trans-assoc.glade | 1 - 10 files changed, 31 insertions(+), 20 deletions(-) diff --git a/gnucash/gnome-utils/dialog-preferences.c b/gnucash/gnome-utils/dialog-preferences.c index b3ba114656..815587e407 100644 --- a/gnucash/gnome-utils/dialog-preferences.c +++ b/gnucash/gnome-utils/dialog-preferences.c @@ -1197,7 +1197,7 @@ gnc_prefs_connect_one (const gchar *name, * @return A pointer to the newly created dialog. */ static GtkWidget * -gnc_preferences_dialog_create(void) +gnc_preferences_dialog_create(GtkWindow *parent) { GtkBuilder *builder; GtkWidget *dialog, *notebook, *label, *image; @@ -1236,6 +1236,9 @@ gnc_preferences_dialog_create(void) // Set the style context for this dialog so it can be easily manipulated with css gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncPreferenceDialog"); + /* parent */ + gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent)); + #ifndef REGISTER2_ENABLED /* Hide preferences that are related to register2 */ box = GTK_WIDGET (gtk_builder_get_object (builder, "label14")); @@ -1273,8 +1276,8 @@ gnc_preferences_dialog_create(void) book = gnc_get_current_book(); g_date_clear (&fy_end, 1); qof_instance_get (QOF_INSTANCE (book), - "fy-end", &fy_end, - NULL); + "fy-end", &fy_end, + NULL); box = GTK_WIDGET(gtk_builder_get_object (builder, "pref/" GNC_PREFS_GROUP_ACCT_SUMMARY "/" GNC_PREF_START_PERIOD)); period = gnc_period_select_new(TRUE); @@ -1425,7 +1428,7 @@ close_handler (gpointer user_data) * preferences dialog already exists it will be raised to the top of * the window stack instead of creating a new dialog. */ void -gnc_preferences_dialog (void) +gnc_preferences_dialog (GtkWindow *parent) { GtkWidget *dialog; @@ -1437,7 +1440,7 @@ gnc_preferences_dialog (void) return; } - dialog = gnc_preferences_dialog_create(); + dialog = gnc_preferences_dialog_create(parent); gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(dialog)); gtk_widget_show(dialog); diff --git a/gnucash/gnome-utils/dialog-preferences.h b/gnucash/gnome-utils/dialog-preferences.h index 50ec8faa91..f3154eac76 100644 --- a/gnucash/gnome-utils/dialog-preferences.h +++ b/gnucash/gnome-utils/dialog-preferences.h @@ -60,6 +60,8 @@ #ifndef GNC_DIALOG_PREFERENCES_H #define GNC_DIALOG_PREFERENCES_H +#include + /** This function adds a full page of preferences to the preferences * dialog. When the dialog is created, the specified widget will be * pulled from the specified glade file and added to the preferences @@ -100,7 +102,7 @@ void gnc_preferences_add_to_page (const gchar *filename, * the user. The preferences dialog is a singleton, so if a * preferences dialog already exists it will be raised to the top of * the window stack instead of creating a new dialog. */ -void gnc_preferences_dialog (void); +void gnc_preferences_dialog (GtkWindow *parent); #endif /** @} */ diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c index a65f51e719..38f1073c16 100644 --- a/gnucash/gnome-utils/gnc-main-window.c +++ b/gnucash/gnome-utils/gnc-main-window.c @@ -4199,7 +4199,7 @@ gnc_main_window_cmd_edit_paste (GtkAction *action, GncMainWindow *window) static void gnc_main_window_cmd_edit_preferences (GtkAction *action, GncMainWindow *window) { - gnc_preferences_dialog (); + gnc_preferences_dialog (GTK_WINDOW(window)); } static void diff --git a/gnucash/gnome/dialog-fincalc.c b/gnucash/gnome/dialog-fincalc.c index 25152cfdac..d7101836e4 100644 --- a/gnucash/gnome/dialog-fincalc.c +++ b/gnucash/gnome/dialog-fincalc.c @@ -549,7 +549,7 @@ fincalc_init_commodity_gae (GNCAmountEdit *edit) } void -gnc_ui_fincalc_dialog_create(void) +gnc_ui_fincalc_dialog_create(GtkWindow *parent) { FinCalcDialog *fcd; GtkWidget *button; @@ -575,6 +575,10 @@ gnc_ui_fincalc_dialog_create(void) // Set the style context for this dialog so it can be easily manipulated with css gnc_widget_set_style_context (GTK_WIDGET(fcd->dialog), "GncFinCalcDialog"); + /* parent */ + if (parent != NULL) + gtk_window_set_transient_for (GTK_WINDOW(fcd->dialog), GTK_WINDOW(parent)); + gnc_register_gui_component (DIALOG_FINCALC_CM_CLASS, NULL, close_handler, fcd); diff --git a/gnucash/gnome/dialog-fincalc.h b/gnucash/gnome/dialog-fincalc.h index 8a91af1f65..bca4b33bb6 100644 --- a/gnucash/gnome/dialog-fincalc.h +++ b/gnucash/gnome/dialog-fincalc.h @@ -25,7 +25,7 @@ typedef struct _FinCalcDialog FinCalcDialog; -void gnc_ui_fincalc_dialog_create(void); +void gnc_ui_fincalc_dialog_create(GtkWindow *parent); void gnc_ui_fincalc_dialog_destroy(FinCalcDialog *fcd); #endif diff --git a/gnucash/gnome/dialog-trans-assoc.c b/gnucash/gnome/dialog-trans-assoc.c index f5d865834e..5f83eebda3 100644 --- a/gnucash/gnome/dialog-trans-assoc.c +++ b/gnucash/gnome/dialog-trans-assoc.c @@ -375,7 +375,7 @@ get_trans_info (AssocDialog *assoc_dialog) } static void -gnc_assoc_dialog_create (AssocDialog *assoc_dialog) +gnc_assoc_dialog_create (GtkWindow *parent, AssocDialog *assoc_dialog) { GtkWidget *dialog; GtkBuilder *builder; @@ -396,6 +396,10 @@ gnc_assoc_dialog_create (AssocDialog *assoc_dialog) // Set the style context for this dialog so it can be easily manipulated with css gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncTransAssocDialog"); + /* parent */ + if (parent != NULL) + gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent)); + assoc_dialog->view = GTK_WIDGET(gtk_builder_get_object (builder, "treeview")); path_head = GTK_WIDGET(gtk_builder_get_object (builder, "path-head")); @@ -500,7 +504,7 @@ show_handler (const char *klass, gint component_id, * Return: nothing * \********************************************************************/ void -gnc_trans_assoc_dialog () +gnc_trans_assoc_dialog (GtkWindow *parent) { AssocDialog *assoc_dialog; @@ -512,7 +516,7 @@ gnc_trans_assoc_dialog () } assoc_dialog = g_new0 (AssocDialog, 1); - gnc_assoc_dialog_create (assoc_dialog); + gnc_assoc_dialog_create (parent, assoc_dialog); gnc_register_gui_component (DIALOG_ASSOC_CM_CLASS, refresh_handler, close_handler, diff --git a/gnucash/gnome/dialog-trans-assoc.h b/gnucash/gnome/dialog-trans-assoc.h index fa82fcb8a5..c95c5b759f 100644 --- a/gnucash/gnome/dialog-trans-assoc.h +++ b/gnucash/gnome/dialog-trans-assoc.h @@ -23,6 +23,6 @@ #ifndef DIALOG_TRANS_ASSOC_H #define DIALOG_TRANS_ASSOC_H -void gnc_trans_assoc_dialog (void); +void gnc_trans_assoc_dialog (GtkWindow *parent); #endif diff --git a/gnucash/gnome/gnc-plugin-basic-commands.c b/gnucash/gnome/gnc-plugin-basic-commands.c index 3142c714f1..d44cec70b9 100644 --- a/gnucash/gnome/gnc-plugin-basic-commands.c +++ b/gnucash/gnome/gnc-plugin-basic-commands.c @@ -616,7 +616,7 @@ static void gnc_main_window_cmd_tools_imap_editor (GtkAction *action, GncMainWindowActionData *data) { gnc_set_busy_cursor(NULL, TRUE); - gnc_imap_dialog (NULL); + gnc_imap_dialog (GTK_WIDGET (data->window)); gnc_unset_busy_cursor(NULL); } @@ -624,7 +624,7 @@ static void gnc_main_window_cmd_tools_trans_assoc (GtkAction *action, GncMainWindowActionData *data) { gnc_set_busy_cursor (NULL, TRUE); - gnc_trans_assoc_dialog (); + gnc_trans_assoc_dialog (GTK_WINDOW (data->window)); gnc_unset_busy_cursor (NULL); } @@ -632,7 +632,7 @@ static void gnc_main_window_cmd_tools_price_editor (GtkAction *action, GncMainWindowActionData *data) { gnc_set_busy_cursor(NULL, TRUE); - gnc_prices_dialog (NULL); + gnc_prices_dialog (GTK_WIDGET (data->window)); gnc_unset_busy_cursor(NULL); } @@ -640,14 +640,14 @@ static void gnc_main_window_cmd_tools_commodity_editor (GtkAction *action, GncMainWindowActionData *data) { gnc_set_busy_cursor(NULL, TRUE); - gnc_commodities_dialog (NULL); + gnc_commodities_dialog (GTK_WIDGET (data->window)); gnc_unset_busy_cursor(NULL); } static void gnc_main_window_cmd_tools_financial_calculator (GtkAction *action, GncMainWindowActionData *data) { - gnc_ui_fincalc_dialog_create(); + gnc_ui_fincalc_dialog_create(GTK_WINDOW (data->window)); } static void diff --git a/gnucash/gnome/gtkbuilder/dialog-price.glade b/gnucash/gnome/gtkbuilder/dialog-price.glade index cbf5c51ec5..e09c6ccb97 100644 --- a/gnucash/gnome/gtkbuilder/dialog-price.glade +++ b/gnucash/gnome/gtkbuilder/dialog-price.glade @@ -361,7 +361,6 @@ - True False 6 Remove Old Prices diff --git a/gnucash/gnome/gtkbuilder/dialog-trans-assoc.glade b/gnucash/gnome/gtkbuilder/dialog-trans-assoc.glade index eaf2b4006d..57e92b7eea 100644 --- a/gnucash/gnome/gtkbuilder/dialog-trans-assoc.glade +++ b/gnucash/gnome/gtkbuilder/dialog-trans-assoc.glade @@ -21,7 +21,6 @@ - True True True True