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-icons.h b/gnucash/gnome-utils/gnc-icons.h index 72d76451c0..3a00be339b 100644 --- a/gnucash/gnome-utils/gnc-icons.h +++ b/gnucash/gnome-utils/gnc-icons.h @@ -49,7 +49,7 @@ G_BEGIN_DECLS #define GNC_ICON_PDF_EXPORT "gnc-gnome-pdf" //FIXME: use own budget icons? -#define GNC_ICON_BUDGET "gnc-budget" +#define GNC_ICON_BUDGET "gnc-account" #define GNC_ICON_NEW_BUDGET "gnc-account" #define GNC_ICON_OPEN_BUDGET "gnc-account-open" //#define GNC_ICON_CLOSE_BUDGET "gnc-close-account" 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-utils/gtkbuilder/dialog-preferences.glade b/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade index 4aff574e15..51ee5b776f 100644 --- a/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade +++ b/gnucash/gnome-utils/gtkbuilder/dialog-preferences.glade @@ -2837,6 +2837,7 @@ many months before the current month: True On high resolution screens reports tend to be hard to read. This option allows you to scale reports up by the set factor. For example setting this to 2.0 will display reports at twice their typical size. start + 12 default_zoom_adj 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-sx-editor.c b/gnucash/gnome/dialog-sx-editor.c index 61e246a0ce..645bd1626a 100644 --- a/gnucash/gnome/dialog-sx-editor.c +++ b/gnucash/gnome/dialog-sx-editor.c @@ -1114,8 +1114,8 @@ sxed_delete_event( GtkWidget *widget, GdkEvent *event, gpointer ud ) * Create the Schedule Editor Dialog * ************************************/ GncSxEditorDialog * -gnc_ui_scheduled_xaction_editor_dialog_create (SchedXaction *sx, - gboolean newSX) +gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent, + SchedXaction *sx, gboolean newSX) { GncSxEditorDialog *sxed; GtkBuilder *builder; @@ -1192,12 +1192,13 @@ gnc_ui_scheduled_xaction_editor_dialog_create (SchedXaction *sx, // Set the style context for this dialog so it can be easily manipulated with css gnc_widget_set_style_context (GTK_WIDGET(sxed->dialog), "GncSxEditorDialog"); + + gtk_window_set_transient_for (GTK_WINDOW (sxed->dialog), parent); /* Setup the end-date GNC widget */ { GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "editor_end_date_box")); - sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new (gnc_time (NULL), - FALSE, FALSE)); + sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE)); gtk_widget_show(GTK_WIDGET(sxed->endDateEntry)); g_signal_connect( sxed->endDateEntry, "date-changed", G_CALLBACK( sxed_excal_update_adapt_cb ), sxed ); @@ -1714,6 +1715,7 @@ typedef struct _acct_deletion_handler_data { GList *affected_sxes; GtkWidget *dialog; + GtkWindow *parent; } acct_deletion_handler_data; @@ -1726,8 +1728,8 @@ _open_editors(GtkDialog *dialog, gint response_code, gpointer data) GList *sx_iter; for (sx_iter = adhd->affected_sxes; sx_iter; sx_iter = sx_iter->next) { - gnc_ui_scheduled_xaction_editor_dialog_create((SchedXaction*)sx_iter->data, - FALSE); + gnc_ui_scheduled_xaction_editor_dialog_create(GTK_WINDOW(adhd->parent), + (SchedXaction*)sx_iter->data, FALSE); } } g_list_free(adhd->affected_sxes); @@ -1759,6 +1761,7 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_ acct_deletion_handler_data *data; GtkBuilder *builder; GtkWidget *dialog; + GtkWindow *parent; GtkListStore *name_list; GtkTreeView *list; GtkTreeViewColumn *name_column; @@ -1768,6 +1771,9 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_ gnc_builder_add_from_file (builder, "dialog-sx.glade", "account_deletion_dialog"); dialog = GTK_WIDGET(gtk_builder_get_object (builder, "account_deletion_dialog")); + parent = gnc_ui_get_main_window (NULL); + + gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); list = GTK_TREE_VIEW(gtk_builder_get_object (builder, "sx_list")); @@ -1776,6 +1782,7 @@ _sx_engine_event_handler(QofInstance *ent, QofEventId event_type, gpointer user_ data = (acct_deletion_handler_data*)g_new0(acct_deletion_handler_data, 1); data->dialog = dialog; + data->parent = parent; data->affected_sxes = affected_sxes; name_list = gtk_list_store_new(1, G_TYPE_STRING); for (sx_iter = affected_sxes; sx_iter != NULL; sx_iter = sx_iter->next) diff --git a/gnucash/gnome/dialog-sx-editor.h b/gnucash/gnome/dialog-sx-editor.h index 7e6d203e60..c7d6e1e497 100644 --- a/gnucash/gnome/dialog-sx-editor.h +++ b/gnucash/gnome/dialog-sx-editor.h @@ -24,6 +24,7 @@ #define DIALOG_SX_EDITOR_H #include "SchedXaction.h" +#include #define DIALOG_SCHEDXACTION_CM_CLASS "dialog-scheduledtransactions" #define DIALOG_SCHEDXACTION_EDITOR_CM_CLASS "dialog-scheduledtransaction-editor" @@ -36,8 +37,8 @@ typedef struct _GncSxEditorDialog GncSxEditorDialog; -GncSxEditorDialog* gnc_ui_scheduled_xaction_editor_dialog_create(SchedXaction *sx, - gboolean newSX); +GncSxEditorDialog* gnc_ui_scheduled_xaction_editor_dialog_create(GtkWindow *parent, + SchedXaction *sx, gboolean newSX); void gnc_ui_scheduled_xaction_editor_dialog_destroy(GncSxEditorDialog *sxd); diff --git a/gnucash/gnome/dialog-sx-editor2.c b/gnucash/gnome/dialog-sx-editor2.c index 333da7ff40..6b280dd048 100644 --- a/gnucash/gnome/dialog-sx-editor2.c +++ b/gnucash/gnome/dialog-sx-editor2.c @@ -1087,8 +1087,8 @@ sxed_delete_event (GtkWidget *widget, GdkEvent *event, gpointer ud) * Create the Schedule Editor Dialog * ************************************/ GncSxEditorDialog2 * -gnc_ui_scheduled_xaction_editor_dialog_create2 (SchedXaction *sx, - gboolean newSX) +gnc_ui_scheduled_xaction_editor_dialog_create2 (GtkWindow *parent, + SchedXaction *sx, gboolean newSX) { GncSxEditorDialog2 *sxed; GtkBuilder *builder; @@ -1166,11 +1166,12 @@ gnc_ui_scheduled_xaction_editor_dialog_create2 (SchedXaction *sx, // Set the style context for this dialog so it can be easily manipulated with css gnc_widget_set_style_context (GTK_WIDGET(sxed->dialog), "GncSxEditorDialog"); + gtk_window_set_transient_for (GTK_WINDOW (sxed->dialog), parent); + /* Setup the end-date GNC widget */ { GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "editor_end_date_box")); - sxed->endDateEntry = GNC_DATE_EDIT (gnc_date_edit_new (gnc_time (NULL), - FALSE, FALSE)); + sxed->endDateEntry = GNC_DATE_EDIT (gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE)); gtk_widget_show (GTK_WIDGET (sxed->endDateEntry)); g_signal_connect (sxed->endDateEntry, "date-changed", G_CALLBACK (sxed_excal_update_adapt_cb), sxed); @@ -1665,6 +1666,7 @@ typedef struct _acct_deletion_handler_data { GList *affected_sxes; GtkWidget *dialog; + GtkWindow *parent; } acct_deletion_handler_data; @@ -1677,8 +1679,8 @@ _open_editors (GtkDialog *dialog, gint response_code, gpointer data) GList *sx_iter; for (sx_iter = adhd->affected_sxes; sx_iter; sx_iter = sx_iter->next) { - gnc_ui_scheduled_xaction_editor_dialog_create2 ((SchedXaction*)sx_iter->data, - FALSE); + gnc_ui_scheduled_xaction_editor_dialog_create2 (GTK_WINDOW(adhd->parent), + (SchedXaction*)sx_iter->data, FALSE); } } g_list_free (adhd->affected_sxes); @@ -1710,6 +1712,7 @@ _sx_engine_event_handler (QofInstance *ent, QofEventId event_type, gpointer user acct_deletion_handler_data *data; GtkBuilder *builder; GtkWidget *dialog; + GtkWindow *parent; GtkListStore *name_list; GtkTreeView *list; GtkTreeViewColumn *name_column; @@ -1719,6 +1722,9 @@ _sx_engine_event_handler (QofInstance *ent, QofEventId event_type, gpointer user gnc_builder_add_from_file (builder, "dialog-sx.glade", "account_deletion_dialog"); dialog = GTK_WIDGET (gtk_builder_get_object (builder, "account_deletion_dialog")); + parent = gnc_ui_get_main_window (NULL); + + gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); list = GTK_TREE_VIEW (gtk_builder_get_object (builder, "sx_list")); @@ -1727,6 +1733,7 @@ _sx_engine_event_handler (QofInstance *ent, QofEventId event_type, gpointer user data = (acct_deletion_handler_data*)g_new0 (acct_deletion_handler_data, 1); data->dialog = dialog; + data->parent = parent; data->affected_sxes = affected_sxes; name_list = gtk_list_store_new (1, G_TYPE_STRING); for (sx_iter = affected_sxes; sx_iter != NULL; sx_iter = sx_iter->next) diff --git a/gnucash/gnome/dialog-sx-editor2.h b/gnucash/gnome/dialog-sx-editor2.h index b8c7cdf0ef..26ab52a180 100644 --- a/gnucash/gnome/dialog-sx-editor2.h +++ b/gnucash/gnome/dialog-sx-editor2.h @@ -36,8 +36,8 @@ typedef struct _GncSxEditorDialog2 GncSxEditorDialog2; -GncSxEditorDialog2* gnc_ui_scheduled_xaction_editor_dialog_create2 (SchedXaction *sx, - gboolean newSX); +GncSxEditorDialog2* gnc_ui_scheduled_xaction_editor_dialog_create2 (GtkWindow *parent, + SchedXaction *sx, gboolean newSX); void gnc_ui_scheduled_xaction_editor_dialog_destroy2 (GncSxEditorDialog2 *sxd); diff --git a/gnucash/gnome/dialog-sx-from-trans.c b/gnucash/gnome/dialog-sx-from-trans.c index f300b1e7f1..c8625bea89 100644 --- a/gnucash/gnome/dialog-sx-from-trans.c +++ b/gnucash/gnome/dialog-sx-from-trans.c @@ -612,7 +612,8 @@ sxftd_advanced_clicked(SXFromTransInfo *sxfti) context = g_main_context_default(); while (g_main_context_iteration(context, FALSE)); - gnc_ui_scheduled_xaction_editor_dialog_create(sxfti->sx, TRUE /* newSX */); + gnc_ui_scheduled_xaction_editor_dialog_create(gnc_ui_get_main_window (sxfti->dialog), + sxfti->sx, TRUE /* newSX */); /* close ourself, since advanced editing entails us, and there are sync * issues otherwise. */ sxftd_close(sxfti, FALSE); @@ -752,7 +753,7 @@ sxftd_update_excal_adapt( GObject *o, gpointer ud ) * Create the dialog * ********************/ void -gnc_sx_create_from_trans( Transaction *trans ) +gnc_sx_create_from_trans( GtkWindow *parent, Transaction *trans ) { #ifndef __MINGW32__ int errno; @@ -771,6 +772,8 @@ gnc_sx_create_from_trans( Transaction *trans ) // Set the style context for this dialog so it can be easily manipulated with css gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncSxFromTransDialog"); + gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); + sxfti->builder = builder; sxfti->dialog = dialog; sxfti->trans = trans; diff --git a/gnucash/gnome/dialog-sx-from-trans.h b/gnucash/gnome/dialog-sx-from-trans.h index 413aef2d73..aa66212b1c 100644 --- a/gnucash/gnome/dialog-sx-from-trans.h +++ b/gnucash/gnome/dialog-sx-from-trans.h @@ -27,6 +27,6 @@ #include "Transaction.h" -void gnc_sx_create_from_trans(Transaction *trans); +void gnc_sx_create_from_trans(GtkWindow *parent, Transaction *trans); #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/gnc-plugin-budget.c b/gnucash/gnome/gnc-plugin-budget.c index aab03faa8f..b885fb9927 100644 --- a/gnucash/gnome/gnc-plugin-budget.c +++ b/gnucash/gnome/gnc-plugin-budget.c @@ -242,7 +242,7 @@ gnc_plugin_budget_cmd_open_budget (GtkAction *action, } else { - bgt = gnc_budget_gui_select_budget(book); + bgt = gnc_budget_gui_select_budget(GTK_WINDOW(data->window), book); } if (bgt) gnc_main_window_open_page( @@ -276,7 +276,7 @@ gnc_plugin_budget_cmd_copy_budget (GtkAction *action, } else { - bgt = gnc_budget_gui_select_budget(book); + bgt = gnc_budget_gui_select_budget(GTK_WINDOW(data->window), book); } if (bgt) @@ -311,7 +311,7 @@ row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *column, } GncBudget * -gnc_budget_gui_select_budget(QofBook *book) +gnc_budget_gui_select_budget(GtkWindow *parent, QofBook *book) { GncBudget *bgt; GtkDialog *dlg; @@ -323,7 +323,7 @@ gnc_budget_gui_select_budget(QofBook *book) gboolean ok; dlg = GTK_DIALOG(gtk_dialog_new_with_buttons( - _("Select a Budget"), NULL, GTK_DIALOG_MODAL, + _("Select a Budget"), parent, GTK_DIALOG_MODAL, _("_OK"), GTK_RESPONSE_OK, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL)); diff --git a/gnucash/gnome/gnc-plugin-budget.h b/gnucash/gnome/gnc-plugin-budget.h index 5a1f6c2951..7e63f3587b 100644 --- a/gnucash/gnome/gnc-plugin-budget.h +++ b/gnucash/gnome/gnc-plugin-budget.h @@ -59,7 +59,7 @@ GType gnc_plugin_budget_get_type(void); GncPlugin *gnc_plugin_budget_new(void); /* Launch the budget list dialog.*/ -GncBudget * gnc_budget_gui_select_budget(QofBook *book); +GncBudget * gnc_budget_gui_select_budget(GtkWindow *parent, QofBook *book); G_END_DECLS diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c index daad4491d3..eb418b345c 100644 --- a/gnucash/gnome/gnc-plugin-business.c +++ b/gnucash/gnome/gnc-plugin-business.c @@ -910,6 +910,10 @@ gnc_plugin_business_update_menus (GncPluginPage *plugin_page) if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page)) return; + // Check that this is a main window and not embedded sx + if (!GNC_IS_MAIN_WINDOW(plugin_page->window)) + return; + is_txn_register = GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page); window = GNC_MAIN_WINDOW(plugin_page->window); g_return_if_fail(GNC_IS_MAIN_WINDOW(window)); @@ -1055,6 +1059,10 @@ static void update_inactive_actions(GncPluginPage *plugin_page) if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page)) return; + // Check that this is a main window and not embedded sx + if (!GNC_IS_MAIN_WINDOW(plugin_page->window)) + return; + window = GNC_MAIN_WINDOW(plugin_page->window); g_return_if_fail(GNC_IS_MAIN_WINDOW(window)); action_group = gnc_main_window_get_action_group(window, PLUGIN_ACTIONS_NAME); diff --git a/gnucash/gnome/gnc-plugin-page-budget.c b/gnucash/gnome/gnc-plugin-page-budget.c index 5f2607ae93..f39f2c4834 100644 --- a/gnucash/gnome/gnc-plugin-page-budget.c +++ b/gnucash/gnome/gnc-plugin-page-budget.c @@ -163,7 +163,7 @@ static GtkActionEntry gnc_plugin_page_budget_actions [] = static guint gnc_plugin_page_budget_n_actions = G_N_ELEMENTS (gnc_plugin_page_budget_actions); -#if 0 +#if 0 static const gchar *actions_requiring_account[] = { "OpenAccountAction", @@ -785,8 +785,7 @@ gnc_plugin_page_budget_cmd_view_options (GtkAction *action, priv->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "budget_options_container_dialog")); - gtk_window_set_transient_for( - GTK_WINDOW(priv->dialog), + gtk_window_set_transient_for(GTK_WINDOW(priv->dialog), GTK_WINDOW(gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page)))); gbname = GTK_WIDGET(gtk_builder_get_object (builder, "BudgetName")); @@ -939,8 +938,7 @@ gnc_plugin_page_budget_cmd_estimate_budget(GtkAction *action, dialog = GTK_WIDGET(gtk_builder_get_object (builder, "budget_estimate_dialog")); - gtk_window_set_transient_for( - GTK_WINDOW(dialog), + gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page)))); hb = GTK_WIDGET(gtk_builder_get_object (builder, "StartDate_hbox")); diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c index 057db7e297..0ef9fe9c79 100644 --- a/gnucash/gnome/gnc-plugin-page-register.c +++ b/gnucash/gnome/gnc-plugin-page-register.c @@ -3799,13 +3799,15 @@ gnc_plugin_page_register_cmd_schedule (GtkAction *action, GncPluginPageRegister *plugin_page) { GncPluginPageRegisterPrivate *priv; + GtkWindow *window; ENTER("(action %p, plugin_page %p)", action, plugin_page); g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(plugin_page)); + window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page))); priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page); - gsr_default_schedule_handler(priv->gsr, NULL); + gsr_default_schedule_handler(priv->gsr, window); LEAVE(" "); } diff --git a/gnucash/gnome/gnc-plugin-page-register2.c b/gnucash/gnome/gnc-plugin-page-register2.c index bd10fa9ead..58d9d36073 100644 --- a/gnucash/gnome/gnc-plugin-page-register2.c +++ b/gnucash/gnome/gnc-plugin-page-register2.c @@ -3622,6 +3622,7 @@ gnc_plugin_page_register2_cmd_schedule (GtkAction *action, GncPluginPageRegister2Private *priv; GncTreeViewSplitReg *view; Transaction *trans; + GtkWindow *window; ENTER("(action %p, plugin_page %p)", action, plugin_page); @@ -3629,6 +3630,7 @@ gnc_plugin_page_register2_cmd_schedule (GtkAction *action, priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page); view = gnc_ledger_display2_get_split_view_register (priv->ledger); + window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page))); trans = gnc_tree_view_split_reg_get_current_trans (view); @@ -3682,12 +3684,12 @@ gnc_plugin_page_register2_cmd_schedule (GtkAction *action, if (theSX) { - gnc_ui_scheduled_xaction_editor_dialog_create2 (theSX, FALSE); + gnc_ui_scheduled_xaction_editor_dialog_create2 (window, theSX, FALSE); LEAVE(" "); return; } } - gnc_sx_create_from_trans (trans); + gnc_sx_create_from_trans (window, trans); LEAVE(" "); } diff --git a/gnucash/gnome/gnc-plugin-page-sx-list.c b/gnucash/gnome/gnc-plugin-page-sx-list.c index 6b6686836f..cc0bf04248 100644 --- a/gnucash/gnome/gnc-plugin-page-sx-list.c +++ b/gnucash/gnome/gnc-plugin-page-sx-list.c @@ -639,6 +639,7 @@ gnc_plugin_page_sx_list_recreate_page (GtkWidget *window, static void gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page) { + GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page))); SchedXaction *new_sx; gboolean new_sx_flag = TRUE; @@ -655,7 +656,7 @@ gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page) schedule = g_list_append(schedule, r); gnc_sx_set_schedule(new_sx, schedule); } - gnc_ui_scheduled_xaction_editor_dialog_create(new_sx, new_sx_flag); + gnc_ui_scheduled_xaction_editor_dialog_create(window, new_sx, new_sx_flag); } #ifdef REGISTER2_ENABLED @@ -663,6 +664,7 @@ gnc_plugin_page_sx_list_cmd_new(GtkAction *action, GncPluginPageSxList *page) static void gnc_plugin_page_sx_list_cmd_new2 (GtkAction *action, GncPluginPageSxList *page) { + GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page))); SchedXaction *new_sx; gboolean new_sx_flag = TRUE; @@ -679,7 +681,7 @@ gnc_plugin_page_sx_list_cmd_new2 (GtkAction *action, GncPluginPageSxList *page) schedule = g_list_append (schedule, r); gnc_sx_set_schedule (new_sx, schedule); } - gnc_ui_scheduled_xaction_editor_dialog_create2 (new_sx, new_sx_flag); + gnc_ui_scheduled_xaction_editor_dialog_create2 (window, new_sx, new_sx_flag); } /*################## Added for Reg2 #################*/ #endif @@ -687,7 +689,8 @@ gnc_plugin_page_sx_list_cmd_new2 (GtkAction *action, GncPluginPageSxList *page) static void _edit_sx(gpointer data, gpointer user_data) { - gnc_ui_scheduled_xaction_editor_dialog_create((SchedXaction*)data, FALSE); + gnc_ui_scheduled_xaction_editor_dialog_create(GTK_WINDOW(user_data), + (SchedXaction*)data, FALSE); } #ifdef REGISTER2_ENABLED @@ -695,7 +698,8 @@ _edit_sx(gpointer data, gpointer user_data) static void _edit_sx2 (gpointer data, gpointer user_data) { - gnc_ui_scheduled_xaction_editor_dialog_create2 ((SchedXaction*)data, FALSE); + gnc_ui_scheduled_xaction_editor_dialog_create2 (GTK_WINDOW(user_data), + (SchedXaction*)data, FALSE); } /*################## Added for Reg2 #################*/ #endif @@ -711,6 +715,7 @@ static void gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page) { GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page); + GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page))); GtkTreeSelection *selection; GList *selected_paths, *to_edit; GtkTreeModel *model; @@ -726,7 +731,7 @@ gnc_plugin_page_sx_list_cmd_edit(GtkAction *action, GncPluginPageSxList *page) to_edit = gnc_g_list_map(selected_paths, (GncGMapFunc)_argument_reorder_fn, priv->tree_view); - g_list_foreach(to_edit, (GFunc)_edit_sx, NULL); + g_list_foreach(to_edit, (GFunc)_edit_sx, window); g_list_free(to_edit); g_list_foreach(selected_paths, (GFunc)gtk_tree_path_free, NULL); g_list_free(selected_paths); @@ -738,6 +743,7 @@ static void gnc_plugin_page_sx_list_cmd_edit2 (GtkAction *action, GncPluginPageSxList *page) { GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE (page); + GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page))); GtkTreeSelection *selection; GList *selected_paths, *to_edit; GtkTreeModel *model; @@ -753,7 +759,7 @@ gnc_plugin_page_sx_list_cmd_edit2 (GtkAction *action, GncPluginPageSxList *page) to_edit = gnc_g_list_map (selected_paths, (GncGMapFunc)_argument_reorder_fn, priv->tree_view); - g_list_foreach(to_edit, (GFunc)_edit_sx2, NULL); + g_list_foreach(to_edit, (GFunc)_edit_sx2, window); g_list_free (to_edit); g_list_foreach (selected_paths, (GFunc)gtk_tree_path_free, NULL); g_list_free (selected_paths); @@ -769,9 +775,10 @@ gppsl_row_activated_cb(GtkTreeView *tree_view, { GncPluginPageSxList *page = GNC_PLUGIN_PAGE_SX_LIST(user_data); GncPluginPageSxListPrivate *priv = GNC_PLUGIN_PAGE_SX_LIST_GET_PRIVATE(page); + GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page))); SchedXaction *sx = gnc_tree_view_sx_list_get_sx_from_path(GNC_TREE_VIEW_SX_LIST(priv->tree_view), path); - gnc_ui_scheduled_xaction_editor_dialog_create(sx, FALSE); + gnc_ui_scheduled_xaction_editor_dialog_create(window, sx, FALSE); } diff --git a/gnucash/gnome/gnc-split-reg.c b/gnucash/gnome/gnc-split-reg.c index 13cdc978d6..1cb02f2c2a 100644 --- a/gnucash/gnome/gnc-split-reg.c +++ b/gnucash/gnome/gnc-split-reg.c @@ -1363,10 +1363,10 @@ gsr_default_schedule_handler( GNCSplitReg *gsr, gpointer data ) if ( theSX ) { - gnc_ui_scheduled_xaction_editor_dialog_create(theSX, FALSE); + gnc_ui_scheduled_xaction_editor_dialog_create(GTK_WINDOW(data), theSX, FALSE); return; } - gnc_sx_create_from_trans(pending_trans); + gnc_sx_create_from_trans(GTK_WINDOW(data), pending_trans); } 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-sx.glade b/gnucash/gnome/gtkbuilder/dialog-sx.glade index f09c8f334e..a08f9435e9 100644 --- a/gnucash/gnome/gtkbuilder/dialog-sx.glade +++ b/gnucash/gnome/gtkbuilder/dialog-sx.glade @@ -3,7 +3,6 @@ - True False 6 Account Deletion 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 diff --git a/gnucash/gnome/gtkbuilder/gnc-plugin-page-budget.glade b/gnucash/gnome/gtkbuilder/gnc-plugin-page-budget.glade index b05fa0d8fe..aa2b171a7a 100644 --- a/gnucash/gnome/gtkbuilder/gnc-plugin-page-budget.glade +++ b/gnucash/gnome/gtkbuilder/gnc-plugin-page-budget.glade @@ -10,7 +10,6 @@ 1 - True False 5 Estimate Budget Values @@ -174,7 +173,6 @@ 12 - True False Budget Options True @@ -393,7 +391,6 @@ - True False 6 Budget List diff --git a/gnucash/html/gnc-html-webkit2.c b/gnucash/html/gnc-html-webkit2.c index 0a8c377346..b2ce26c649 100644 --- a/gnucash/html/gnc-html-webkit2.c +++ b/gnucash/html/gnc-html-webkit2.c @@ -1123,7 +1123,7 @@ impl_webkit_print (GncHtml* self) priv = GNC_HTML_WEBKIT_GET_PRIVATE (self); op = webkit_print_operation_new (priv->web_view); - top = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))); + top = GTK_WINDOW(priv->base.parent); webkit_print_operation_run_dialog (op, top); g_object_unref (op); } diff --git a/gnucash/register/register-gnome/gnucash-header.c b/gnucash/register/register-gnome/gnucash-header.c index 156ae68ab2..017a496141 100644 --- a/gnucash/register/register-gnome/gnucash-header.c +++ b/gnucash/register/register-gnome/gnucash-header.c @@ -49,22 +49,6 @@ enum PROP_CURSOR_NAME, /* the name of the current cursor */ }; -static gboolean -gnc_header_draw (GtkWidget *header, cairo_t *cr) -{ - GnucashSheet *sheet = GNC_HEADER(header)->sheet; - GdkWindow *sheet_layout_win = gtk_layout_get_bin_window (GTK_LAYOUT(sheet)); - gint x, y; - - // use this to get the scroll x value to align the header - gdk_window_get_position (sheet_layout_win, &x, &y); - - cairo_set_source_surface (cr, GNC_HEADER(header)->surface, x, 0); - cairo_paint (cr); - - return TRUE; -} - static void gnc_header_draw_offscreen (GncHeader *header) { @@ -202,6 +186,28 @@ gnc_header_draw_offscreen (GncHeader *header) } +static gboolean +gnc_header_draw (GtkWidget *header, cairo_t *cr) +{ + GnucashSheet *sheet = GNC_HEADER(header)->sheet; + GdkWindow *sheet_layout_win = gtk_layout_get_bin_window (GTK_LAYOUT(sheet)); + gint x, y; + + // use this to get the scroll x value to align the header + gdk_window_get_position (sheet_layout_win, &x, &y); + + // if the register page is moved to another window, the surface is + // not created so test for a surface and create one if null + if (GNC_HEADER(header)->surface == NULL) + gnc_header_draw_offscreen (GNC_HEADER(header)); + + cairo_set_source_surface (cr, GNC_HEADER(header)->surface, x, 0); + cairo_paint (cr); + + return TRUE; +} + + void gnc_header_request_redraw (GncHeader *header) { diff --git a/gnucash/register/register-gnome/gnucash-sheet.c b/gnucash/register/register-gnome/gnucash-sheet.c index 520d33bbba..68c5924ecf 100644 --- a/gnucash/register/register-gnome/gnucash-sheet.c +++ b/gnucash/register/register-gnome/gnucash-sheet.c @@ -1809,9 +1809,13 @@ gnucash_sheet_key_press_event_internal (GtkWidget *widget, GdkEventKey *event) /* Forward the keystroke to the input line */ if (pass_on) { - gboolean result; + gboolean result = FALSE; gtk_editable_set_editable(GTK_EDITABLE(sheet->entry), TRUE); - result = gtk_widget_event (sheet->entry, (GdkEvent *) event); + + // If sheet is readonly, entry is not realized + if (gtk_widget_get_realized (GTK_WIDGET(sheet->entry))) + result = gtk_widget_event (sheet->entry, (GdkEvent *) event); + gtk_editable_set_editable(GTK_EDITABLE(sheet->entry), FALSE); return result; } diff --git a/gnucash/register/register-gnome/gnucash-style.c b/gnucash/register/register-gnome/gnucash-style.c index e9996202bf..f62d2eef0e 100644 --- a/gnucash/register/register-gnome/gnucash-style.c +++ b/gnucash/register/register-gnome/gnucash-style.c @@ -209,8 +209,8 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor, cd->pixel_height = gnc_item_edit_get_margin (item_edit, top_bottom) + gnc_item_edit_get_padding_border (item_edit, top_bottom); } - - max_height = MAX(max_height, cd->pixel_height); + // add 1 to cd->pixel_height to allow for a cell border + max_height = MAX(max_height, cd->pixel_height + 1); if (cd->pixel_width > 0) continue; diff --git a/gnucash/report/report-gnome/gnc-plugin-page-report.c b/gnucash/report/report-gnome/gnc-plugin-page-report.c index a719e27fdf..909e83faf8 100644 --- a/gnucash/report/report-gnome/gnc-plugin-page-report.c +++ b/gnucash/report/report-gnome/gnc-plugin-page-report.c @@ -1537,10 +1537,12 @@ gnc_get_export_filename (SCM choice) filepath = gnc_file_dialog (gnc_ui_get_main_window (NULL), title, NULL, default_dir, GNC_FILE_DIALOG_EXPORT); - /* Try to test for extension on file name, add if missing */ - if (g_strrstr(filepath, ".") == NULL) - filepath = g_strconcat(filepath, ".", g_ascii_strdown(type, strlen(type)), NULL); - + if (filepath != NULL) // test for cancel pressed + { + /* Try to test for extension on file name, add if missing */ + if (g_strrstr(filepath, ".") == NULL) + filepath = g_strconcat(filepath, ".", g_ascii_strdown(type, strlen(type)), NULL); + } g_free (type); g_free (title); g_free (default_dir);