gnucash unstable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Feb 24 14:12:27 EST 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/765c117a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c10bb895 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/c76efd65 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/36fa8d57 (commit)
	from  https://github.com/Gnucash/gnucash/commit/e186d77a (commit)



commit 765c117aac110f405a3d6297ffecccf7874c3f8c
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Feb 24 10:55:03 2018 -0800

    Optimize GncDateTime string constructor.
    
    Turns out the stream facet parser is really slow. Since we have a
    well-constrained universe of input formats we don't really need that
    overhead. This got a 33% improvement in loading a large SQLite database.

diff --git a/libgnucash/engine/gnc-datetime.cpp b/libgnucash/engine/gnc-datetime.cpp
index 2ddc9dd..e86d47e 100644
--- a/libgnucash/engine/gnc-datetime.cpp
+++ b/libgnucash/engine/gnc-datetime.cpp
@@ -190,7 +190,7 @@ public:
     GncDateTimeImpl(const time64 time) : m_time(LDT_from_unix_local(time)) {}
     GncDateTimeImpl(const struct tm tm) : m_time(LDT_from_struct_tm(tm)) {}
     GncDateTimeImpl(const GncDateImpl& date, DayPart part = DayPart::neutral);
-    GncDateTimeImpl(const std::string str);
+    GncDateTimeImpl(std::string str);
     GncDateTimeImpl(PTime&& pt) : m_time(pt, tzp.get(pt.date().year())) {}
     GncDateTimeImpl(LDT&& ldt) : m_time(ldt) {}
 
@@ -278,7 +278,7 @@ tz_from_string(std::string str)
     return TZ_Ptr(new PTZ(tzstr));
 }
 
-GncDateTimeImpl::GncDateTimeImpl(const std::string str) :
+GncDateTimeImpl::GncDateTimeImpl(std::string str) :
     m_time(unix_epoch, utc_zone)
 {
     if (str.empty()) return;
@@ -289,17 +289,12 @@ GncDateTimeImpl::GncDateTimeImpl(const std::string str) :
 
     try
     {
-        using Facet = boost::posix_time::time_input_facet;
-        //The stream destructor frees the facet, so it must be heap-allocated.
-        auto input_facet(new Facet());
-        std::istringstream ss(str.substr(0, tzpos));
-        ss.imbue(std::locale(std::locale(), input_facet));
-        if (str.find("-") == 4)
-            input_facet->set_iso_extended_format();
-        else /* Not in iso format, try squashed format. */
-            input_facet->format("%Y%m%d%H%M%S");
-        PTime pdt(not_a_date_time);
-        ss >> pdt;
+        bool delimited = str.find("-") == 4;
+        if (!delimited)
+            str.insert(8, "T");
+        auto pdt = delimited ?
+            boost::posix_time::time_from_string(str.substr(0, tzpos)) :
+            boost::posix_time::from_iso_string(str.substr(0,tzpos));
         m_time = LDT(pdt.date(), pdt.time_of_day(), tzptr,
                          LDTBase::NOT_DATE_TIME_ON_ERROR);
     }
@@ -446,7 +441,7 @@ GncDateTime::GncDateTime(const time64 time) :
     m_impl(new GncDateTimeImpl(time)) {}
 GncDateTime::GncDateTime(const struct tm tm) :
     m_impl(new GncDateTimeImpl(tm)) {}
-GncDateTime::GncDateTime(const std::string str) :
+GncDateTime::GncDateTime(std::string str) :
     m_impl(new GncDateTimeImpl(str)) {}
 GncDateTime::~GncDateTime() = default;
 
diff --git a/libgnucash/engine/gnc-datetime.hpp b/libgnucash/engine/gnc-datetime.hpp
index d8cd724..27b7e83 100644
--- a/libgnucash/engine/gnc-datetime.hpp
+++ b/libgnucash/engine/gnc-datetime.hpp
@@ -105,7 +105,7 @@ public:
  * default is UTC, not the local one.
  * @exception std::invalid_argument if the year is outside the constraints.
  */
-    GncDateTime(const std::string str);
+    GncDateTime(std::string str);
     ~GncDateTime();
 /** Set the GncDateTime to the date and time indicated in the computer's clock.
  */

commit c10bb89547ed9fcb206b3e1ff34b4c1fd349e65b
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Feb 23 15:27:14 2018 -0800

    Delete unused and redundant macro.

diff --git a/gnucash/gnome/dialog-date-close.h b/gnucash/gnome/dialog-date-close.h
index c8572e2..03d33f0 100644
--- a/gnucash/gnome/dialog-date-close.h
+++ b/gnucash/gnome/dialog-date-close.h
@@ -58,28 +58,6 @@ gnc_dialog_dates_acct_question_parented (GtkWidget *parent, const char *message,
         Timespec *ddue, Timespec *post,
         char **memo, Account **acct, gboolean *answer);
 
-#define gnc_dialog_dates_acct_parented(parent, message,	\
-				ddue_label_message,							\
-				post_label_message,							\
-				acct_label_message,							\
-				ok_is_default,								\
-				acct_types, book,							\
-				terms,										\
-				/* Returned Data... */						\
-				ddue, post,									\
-				memo, acct)									\
-		gnc_dialog_dates_acct_question_parented (parent, message,	\
-				ddue_label_message,							\
-				post_label_message,							\
-				acct_label_message,							\
-				NULL,						\
-				ok_is_default,								\
-				acct_types, book,							\
-				terms,										\
-				/* Returned Data... */						\
-				ddue, post,									\
-				memo, acct, NULL)									\
- 
 
 gboolean
 gnc_dialog_date_acct_parented (GtkWidget *parent, const char *message,

commit c76efd656ecdd77571102af57e936fc4ce4be97b
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Feb 23 15:18:01 2018 -0800

    Transient-for for Edit/New Account dialog.

diff --git a/gnucash/gnome-utils/dialog-account.c b/gnucash/gnome-utils/dialog-account.c
index 3c2a59d..3bd0827 100644
--- a/gnucash/gnome-utils/dialog-account.c
+++ b/gnucash/gnome-utils/dialog-account.c
@@ -1568,7 +1568,8 @@ refresh_handler (GHashTable *changes, gpointer user_data)
 
 
 static AccountWindow *
-gnc_ui_new_account_window_internal (QofBook *book,
+gnc_ui_new_account_window_internal (GtkWindow *parent,
+                                    QofBook *book,
                                     Account *base_account,
                                     gchar **subaccount_names,
                                     GList *valid_types,
@@ -1616,6 +1617,8 @@ gnc_ui_new_account_window_internal (QofBook *book,
     }
 
     gnc_account_window_create (aw);
+    gtk_window_set_transient_for (GTK_WINDOW (aw->dialog), parent);
+    
     gnc_account_to_ui (aw);
 
     gnc_resume_gui_refresh ();
@@ -1722,23 +1725,27 @@ gnc_split_account_name (QofBook *book, const char *in_name, Account **base_accou
  ************************************************************/
 
 Account *
-gnc_ui_new_accounts_from_name_window (const char *name)
+gnc_ui_new_accounts_from_name_window (GtkWindow *parent, const char *name)
 {
-    return  gnc_ui_new_accounts_from_name_with_defaults (name, NULL, NULL, NULL);
+    return  gnc_ui_new_accounts_from_name_with_defaults (parent, name, NULL,
+                                                         NULL, NULL);
 }
 
 Account *
-gnc_ui_new_accounts_from_name_window_with_types (const char *name,
-        GList *valid_types)
+gnc_ui_new_accounts_from_name_window_with_types (GtkWindow *parent,
+                                                 const char *name,
+                                                 GList *valid_types)
 {
-    return gnc_ui_new_accounts_from_name_with_defaults(name, valid_types, NULL, NULL);
+    return gnc_ui_new_accounts_from_name_with_defaults(parent, name,
+                                                       valid_types, NULL, NULL);
 }
 
 Account *
-gnc_ui_new_accounts_from_name_with_defaults (const char *name,
-        GList *valid_types,
-        const gnc_commodity * default_commodity,
-        Account * parent)
+gnc_ui_new_accounts_from_name_with_defaults (GtkWindow *parent,
+                                             const char *name,
+                                             GList *valid_types,
+                                             const gnc_commodity * default_commodity,
+                                             Account * parent_acct)
 {
     QofBook *book;
     AccountWindow *aw;
@@ -1749,7 +1756,7 @@ gnc_ui_new_accounts_from_name_with_defaults (const char *name,
     gboolean done = FALSE;
 
     ENTER("name %s, valid %p, commodity %p, account %p",
-          name, valid_types, default_commodity, parent);
+          name, valid_types, default_commodity, parent_acct);
     book = gnc_get_current_book();
     if (!name || *name == '\0')
     {
@@ -1759,11 +1766,12 @@ gnc_ui_new_accounts_from_name_with_defaults (const char *name,
     else
         subaccount_names = gnc_split_account_name (book, name, &base_account);
 
-    if (parent != NULL)
+    if (parent_acct != NULL)
     {
-        base_account = parent;
+        base_account = parent_acct;
     }
-    aw = gnc_ui_new_account_window_internal (book, base_account, subaccount_names,
+    aw = gnc_ui_new_account_window_internal (parent, book, base_account,
+                                             subaccount_names,
             valid_types, default_commodity,
             TRUE);
 
@@ -1819,10 +1827,10 @@ find_by_account (gpointer find_data, gpointer user_data)
  * Return: EditAccountWindow object
  */
 void
-gnc_ui_edit_account_window(Account *account)
+gnc_ui_edit_account_window(GtkWindow *parent, Account *account)
 {
     AccountWindow * aw;
-    Account *parent;
+    Account *parent_acct;
 
     if (account == NULL)
         return;
@@ -1847,6 +1855,7 @@ gnc_ui_edit_account_window(Account *account)
     gnc_suspend_gui_refresh ();
 
     gnc_account_window_create (aw);
+    gtk_window_set_transient_for (GTK_WINDOW (aw->dialog), parent);
     gnc_account_to_ui (aw);
 
     gnc_resume_gui_refresh ();
@@ -1854,13 +1863,13 @@ gnc_ui_edit_account_window(Account *account)
     gtk_widget_show_all (aw->dialog);
     gtk_widget_hide (aw->opening_balance_page);
 
-    parent = gnc_account_get_parent (account);
-    if (parent == NULL)
-        parent = account;		/* must be at the root */
+    parent_acct = gnc_account_get_parent (account);
+    if (parent_acct == NULL)
+        parent_acct = account;		/* must be at the root */
 
     gtk_tree_view_collapse_all (aw->parent_tree);
     gnc_tree_view_account_set_selected_account (
-        GNC_TREE_VIEW_ACCOUNT(aw->parent_tree), parent);
+        GNC_TREE_VIEW_ACCOUNT(aw->parent_tree), parent_acct);
 
     gnc_account_window_set_name (aw);
 
@@ -1886,20 +1895,23 @@ gnc_ui_edit_account_window(Account *account)
  *        parent - The initial parent for the new account (optional)
  */
 void
-gnc_ui_new_account_window(QofBook *book, Account *parent)
+gnc_ui_new_account_window (GtkWindow *parent, QofBook *book,
+                           Account *parent_acct)
 {
     g_return_if_fail(book != NULL);
     if (parent && book)
-        g_return_if_fail(gnc_account_get_book(parent) == book);
+        g_return_if_fail(gnc_account_get_book(parent_acct) == book);
 
-    gnc_ui_new_account_window_internal (book, parent, NULL, NULL, NULL, FALSE);
+    gnc_ui_new_account_window_internal (parent, book, parent_acct, NULL, NULL,
+                                        NULL, FALSE);
 }
 
 void
-gnc_ui_new_account_with_types( QofBook *book,
-                               GList *valid_types )
+gnc_ui_new_account_with_types (GtkWindow *parent, QofBook *book,
+                               GList *valid_types)
 {
-    gnc_ui_new_account_window_internal( book, NULL, NULL, valid_types, NULL, FALSE );
+    gnc_ui_new_account_window_internal (parent, book, NULL, NULL,
+                                        valid_types, NULL, FALSE);
 }
 
 /************************************************************
diff --git a/gnucash/gnome-utils/dialog-account.h b/gnucash/gnome-utils/dialog-account.h
index 5003dc5..ffdb44b 100644
--- a/gnucash/gnome-utils/dialog-account.h
+++ b/gnucash/gnome-utils/dialog-account.h
@@ -45,10 +45,12 @@
 
 /** Disply a window for editing the attributes of an existing account.
  *
+ *  @param parent The widget on which to parent the dialog.
+ *
  *  @param account This parameter specifies the account whose data
  *  will be edited.
  */
-void gnc_ui_edit_account_window (Account *account);
+void gnc_ui_edit_account_window (GtkWindow *parent, Account *account);
 
 
 /** Disply a window for creating a new account.  This function will
@@ -56,20 +58,25 @@ void gnc_ui_edit_account_window (Account *account);
  *  the caller specified.  The user is free, however, to choose any
  *  parent account they wish.
  *
+ *  @param parent The widget on which to parent the dialog.
+ *
  *  @param book The book in which the new account should be created.
  *  This is a required argument.
  *
- *  @param parent The initially selected parent account.  This
+ *  @param parent_acct The initially selected parent account.  This
  *  argument is optional, but if supplied must be an account contained
  *  in the specified book.
  */
-void gnc_ui_new_account_window (QofBook *book, Account *parent);
+void gnc_ui_new_account_window (GtkWindow *parent,
+                                QofBook *book, Account *parent_acct);
 
 
 /** Disply a window for creating a new account.  This function will
  *  restrict the available account type values to the list specified
  *  by the caller.
  *
+ *  @param parent The widget on which to parent the dialog.
+ *
  *  @param book The book in which the new account should be created.
  *  This is a required argument.
  *
@@ -77,7 +84,7 @@ void gnc_ui_new_account_window (QofBook *book, Account *parent);
  *  which are allowed to be created.  The calling function is
  *  responsible for freeing this list.
  */
-void gnc_ui_new_account_with_types (QofBook *book,
+void gnc_ui_new_account_with_types (GtkWindow *parent, QofBook *book,
                                     GList *valid_types);
 /** @} */
 
@@ -88,15 +95,20 @@ void gnc_ui_new_account_with_types (QofBook *book,
 
 /** Disply a modal window for creating a new account
  *
+ *  @param parent The widget on which to parent the dialog.
+ *
  *  @param name The account name/path to be created.  This parameter
  *  is not used for determining the initially selected parent account.
  */
-Account * gnc_ui_new_accounts_from_name_window (const char *name);
+Account * gnc_ui_new_accounts_from_name_window (GtkWindow *parent,
+                                                const char *name);
 
 /** Disply a modal window for creating a new account.  This function
  *  will restrict the available account type values to the list
  *  specified by the caller.
  *
+ *  @param parent The widget on which to parent the dialog.
+ *
  *  @param name The account name/path to be created.  This parameter
  *  is not used for determining the initially selected parent account.
  *
@@ -107,7 +119,8 @@ Account * gnc_ui_new_accounts_from_name_window (const char *name);
  *  @return A pointer to the newly created account.
  */
 /* Note that the caller owns the valid_types list */
-Account * gnc_ui_new_accounts_from_name_window_with_types (const char *name,
+Account * gnc_ui_new_accounts_from_name_window_with_types (GtkWindow *parent,
+                                                           const char *name,
         GList *valid_types);
 
 
@@ -115,6 +128,8 @@ Account * gnc_ui_new_accounts_from_name_window_with_types (const char *name,
  *  will restrict the available account type values to the list
  *  specified by the caller.
  *
+ *  @param parent The widget on which to parent the dialog.
+ *
  *  @param name The account name/path to be created.  This parameter
  *  is not used for determining the initially selected parent account.
  *
@@ -125,14 +140,15 @@ Account * gnc_ui_new_accounts_from_name_window_with_types (const char *name,
  *  @param default_commodity The commodity to initially select when
  *  the dialog is presented.
  *
- *  @param parent The initially selected parent account.
+ *  @param parent_acct The initially selected parent account.
  *
  *  @return A pointer to the newly created account.
  */
-Account * gnc_ui_new_accounts_from_name_with_defaults (const char *name,
-        GList *valid_types,
-        const gnc_commodity * default_commodity,
-        Account * parent);
+Account * gnc_ui_new_accounts_from_name_with_defaults (GtkWindow *parent,
+                                        const char *name,
+                                        GList *valid_types,
+                                        const gnc_commodity * default_commodity,
+                                        Account * parent_acct);
 
 /*
  * register a callback that get's called when the account has changed
diff --git a/gnucash/gnome-utils/gnc-account-sel.c b/gnucash/gnome-utils/gnc-account-sel.c
index d255ce6..f3a2916 100644
--- a/gnucash/gnome-utils/gnc-account-sel.c
+++ b/gnucash/gnome-utils/gnc-account-sel.c
@@ -480,11 +480,13 @@ static void
 gas_new_account_click( GtkButton *b, gpointer ud )
 {
     GNCAccountSel *gas = (GNCAccountSel*)ud;
+    GtkWindow *parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gas)));
     if (gas->isModal)
-        gnc_ui_new_accounts_from_name_window_with_types ( NULL,
-                gas->acctTypeFilters );
+        gnc_ui_new_accounts_from_name_window_with_types (parent, NULL,
+                                                         gas->acctTypeFilters );
     else
-        gnc_ui_new_account_with_types( gnc_get_current_book(), gas->acctTypeFilters );
+        gnc_ui_new_account_with_types (parent, gnc_get_current_book(),
+                                       gas->acctTypeFilters );
 }
 
 gint
diff --git a/gnucash/gnome-utils/gnc-tree-control-split-reg.c b/gnucash/gnome-utils/gnc-tree-control-split-reg.c
index 1eecf27..3c68ddd 100644
--- a/gnucash/gnome-utils/gnc-tree-control-split-reg.c
+++ b/gnucash/gnome-utils/gnc-tree-control-split-reg.c
@@ -1973,7 +1973,7 @@ gnc_tree_control_split_reg_get_account_by_name (GncTreeViewSplitReg *view, const
             return NULL;
 
         /* User said yes, they want to create a new account. */
-        account = gnc_ui_new_accounts_from_name_window (name);
+        account = gnc_ui_new_accounts_from_name_window (window, name);
         if (!account)
             return NULL;
     }
diff --git a/gnucash/gnome/gnc-plugin-page-account-tree.c b/gnucash/gnome/gnc-plugin-page-account-tree.c
index e9a1a53..4269f51 100644
--- a/gnucash/gnome/gnc-plugin-page-account-tree.c
+++ b/gnucash/gnome/gnc-plugin-page-account-tree.c
@@ -1072,8 +1072,9 @@ static void
 gnc_plugin_page_account_tree_cmd_new_account (GtkAction *action, GncPluginPageAccountTree *page)
 {
     Account *account = gnc_plugin_page_account_tree_get_current_account (page);
-
-    gnc_ui_new_account_window (gnc_get_current_book(), account);
+    GtkWindow *parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
+    gnc_ui_new_account_window (parent, gnc_get_current_book(),
+                               account);
 }
 
 static void
@@ -1134,13 +1135,13 @@ static void
 gnc_plugin_page_account_tree_cmd_edit_account (GtkAction *action, GncPluginPageAccountTree *page)
 {
     Account *account;
-
+    GtkWindow *parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
     ENTER("action %p, page %p", action, page);
 
     account = gnc_plugin_page_account_tree_get_current_account (page);
     g_return_if_fail (account != NULL);
 
-    gnc_ui_edit_account_window (account);
+    gnc_ui_edit_account_window (parent, account);
     LEAVE(" ");
 }
 
diff --git a/gnucash/gnome/gnc-plugin-page-invoice.c b/gnucash/gnome/gnc-plugin-page-invoice.c
index 1b8b869..f58b700 100644
--- a/gnucash/gnome/gnc-plugin-page-invoice.c
+++ b/gnucash/gnome/gnc-plugin-page-invoice.c
@@ -726,10 +726,11 @@ static void
 gnc_plugin_page_invoice_cmd_new_account (GtkAction *action,
         GncPluginPageInvoice *plugin_page)
 {
+    GtkWindow *parent = NULL;
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
-
+    parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
-    gnc_ui_new_account_window (gnc_get_current_book(), NULL);
+    gnc_ui_new_account_window (parent, gnc_get_current_book(), NULL);
     LEAVE(" ");
 }
 
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index 0ef9fe9..57372d4 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -2951,13 +2951,13 @@ gnc_plugin_page_register_cmd_edit_account (GtkAction *action,
         GncPluginPageRegister *page)
 {
     Account *account;
-
+    GtkWindow *parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
 
     ENTER("(action %p, page %p)", action, page);
     account = gnc_plugin_page_register_get_account (page);
     if (account)
-        gnc_ui_edit_account_window (account);
+        gnc_ui_edit_account_window (parent, account);
     LEAVE(" ");
 }
 
diff --git a/gnucash/gnome/gnc-plugin-page-register2.c b/gnucash/gnome/gnc-plugin-page-register2.c
index 58d9d36..5021607 100644
--- a/gnucash/gnome/gnc-plugin-page-register2.c
+++ b/gnucash/gnome/gnc-plugin-page-register2.c
@@ -2752,13 +2752,13 @@ gnc_plugin_page_register2_cmd_edit_account (GtkAction *action,
         GncPluginPageRegister2 *page) //this works
 {
     Account *account;
-
+    GtkWindow *parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
 
     ENTER("(action %p, page %p)", action, page);
     account = gnc_plugin_page_register2_get_account (page);
     if (account)
-        gnc_ui_edit_account_window (account);
+        gnc_ui_edit_account_window (parent, account);
     LEAVE(" ");
 }
 
diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index 78ed182..d080647 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -1388,7 +1388,7 @@ gnc_recn_edit_account_cb(GtkAction *action, gpointer data)
     if (account == NULL)
         return;
 
-    gnc_ui_edit_account_window (account);
+    gnc_ui_edit_account_window (GTK_WINDOW (recnData->window), account);
 }
 
 
diff --git a/gnucash/gnome/window-reconcile2.c b/gnucash/gnome/window-reconcile2.c
index d8d59be..4f7cbc9 100644
--- a/gnucash/gnome/window-reconcile2.c
+++ b/gnucash/gnome/window-reconcile2.c
@@ -1349,7 +1349,7 @@ gnc_recn_edit_account_cb (GtkAction *action, gpointer data)
     if (account == NULL)
         return;
 
-    gnc_ui_edit_account_window (account);
+    gnc_ui_edit_account_window (GTK_WINDOW (recnData->window), account);
 }
 
 
diff --git a/gnucash/import-export/import-account-matcher.c b/gnucash/import-export/import-account-matcher.c
index 4e59b98..5373ef8 100644
--- a/gnucash/import-export/import-account-matcher.c
+++ b/gnucash/import-export/import-account-matcher.c
@@ -143,6 +143,8 @@ gnc_import_add_account(GtkWidget *button, AccountPickerDialog *picker)
 {
     Account *selected_account, *new_account;
     GList * valid_types = NULL;
+    GtkWindow *parent = GTK_WINDOW (gtk_widget_get_toplevel (button));
+
     /*DEBUG("Begin");  */
     if (picker->new_account_default_type != ACCT_TYPE_NONE)
     {
@@ -150,10 +152,11 @@ gnc_import_add_account(GtkWidget *button, AccountPickerDialog *picker)
         valid_types = g_list_prepend(valid_types, GINT_TO_POINTER(picker->new_account_default_type));
     }
     selected_account = gnc_tree_view_account_get_selected_account(picker->account_tree);
-    new_account = gnc_ui_new_accounts_from_name_with_defaults ( picker->account_human_description,
-                  valid_types,
-                  picker->new_account_default_commodity,
-                  selected_account);
+    new_account = gnc_ui_new_accounts_from_name_with_defaults (parent,
+                                          picker->account_human_description,
+                                          valid_types,
+                                          picker->new_account_default_commodity,
+                                          selected_account);
     g_list_free(valid_types);
     gnc_tree_view_account_set_selected_account(picker->account_tree, new_account);
 }
diff --git a/gnucash/import-export/ofx/gnc-ofx-import.c b/gnucash/import-export/ofx/gnc-ofx-import.c
index 08d950e..5a37e15 100644
--- a/gnucash/import-export/ofx/gnc-ofx-import.c
+++ b/gnucash/import-export/ofx/gnc-ofx-import.c
@@ -79,7 +79,7 @@ int ofx_proc_status_cb(struct OfxStatusData data)
 */
 
 int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data);
-int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data);
+int ofx_proc_transaction_cb (struct OfxTransactionData data, void *user_data);
 int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data);
 static double ofx_get_investment_amount(const struct OfxTransactionData* data);
 
@@ -292,7 +292,8 @@ static gnc_numeric gnc_ofx_numeric_from_double_txn(double value, const Transacti
 
 /* Opens the dialog to create a new account with given name, commodity, parent, type.
  * Returns the new account, or NULL if it couldn't be created.. */
-static Account *gnc_ofx_new_account(const char* name,
+static Account *gnc_ofx_new_account(GtkWindow* parent,
+                                    const char* name,
                                     const gnc_commodity * account_commodity,
                                     Account *parent_account,
                                     GNCAccountType new_account_default_type)
@@ -318,10 +319,10 @@ static Account *gnc_ofx_new_account(const char* name,
                                GINT_TO_POINTER(xaccAccountGetType(parent_account)));
         }
     }
-    result = gnc_ui_new_accounts_from_name_with_defaults (name,
-             valid_types,
-             account_commodity,
-             parent_account);
+    result = gnc_ui_new_accounts_from_name_with_defaults (parent, name,
+                                                          valid_types,
+                                                          account_commodity,
+                                                          parent_account);
     g_list_free(valid_types);
     return result;
 }
@@ -343,7 +344,7 @@ fix_ofx_bug_39 (time64 t)
     return t;
 }
 
-int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data)
+int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
 {
     char dest_string[255];
     time64 current_time = gnc_time (NULL);
@@ -358,6 +359,7 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
     Transaction *transaction;
     Split *split;
     gchar *notes, *tmp;
+    GtkWindow *parent = GTK_WINDOW (user_data);
 
     g_assert(gnc_ofx_importer_gui);
 
@@ -637,7 +639,8 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
                             // commodity.
                             Account *parent_account = investment_account;
                             investment_account =
-                                gnc_ofx_new_account(investment_account_text,
+                                gnc_ofx_new_account(parent,
+                                                    investment_account_text,
                                                     investment_commodity,
                                                     parent_account,
                                                     ACCT_TYPE_STOCK);
@@ -1020,7 +1023,7 @@ void gnc_file_ofx_import (GtkWindow *parent)
 
         /*ofx_set_statement_cb(libofx_context, ofx_proc_statement_cb, 0);*/
         ofx_set_account_cb(libofx_context, ofx_proc_account_cb, 0);
-        ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, 0);
+        ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, parent);
         ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0);
         /*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/
 
diff --git a/gnucash/register/ledger-core/gncEntryLedger.c b/gnucash/register/ledger-core/gncEntryLedger.c
index b3ea148..91d0736 100644
--- a/gnucash/register/ledger-core/gncEntryLedger.c
+++ b/gnucash/register/ledger-core/gncEntryLedger.c
@@ -111,7 +111,7 @@ gnc_entry_ledger_get_account_by_name (GncEntryLedger *ledger, BasicCell * bcell,
         else
             account_types = g_list_prepend (account_types, (gpointer)ACCT_TYPE_EXPENSE);
 
-        account = gnc_ui_new_accounts_from_name_window_with_types (name, account_types);
+        account = gnc_ui_new_accounts_from_name_window_with_types (GTK_WINDOW (ledger->parent), name, account_types);
         g_list_free ( account_types );
         if (!account)
             return NULL;
diff --git a/gnucash/register/ledger-core/split-register.c b/gnucash/register/ledger-core/split-register.c
index 69c1793..760b727 100644
--- a/gnucash/register/ledger-core/split-register.c
+++ b/gnucash/register/ledger-core/split-register.c
@@ -1852,6 +1852,7 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
     ComboCell *cell = (ComboCell *) bcell;
     Account *account;
     static gboolean creating_account = FALSE;
+    GtkWindow *parent = GTK_WINDOW (gnc_split_register_get_parent (reg));
 
     if (!name || (strlen(name) == 0))
         return NULL;
@@ -1864,12 +1865,11 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
     if (!account && !creating_account)
     {
         /* Ask if they want to create a new one. */
-        if (!gnc_verify_dialog (GTK_WINDOW (gnc_split_register_get_parent (reg)),
-                                TRUE, missing, name))
+        if (!gnc_verify_dialog (parent, TRUE, missing, name))
             return NULL;
         creating_account = TRUE;
         /* User said yes, they want to create a new account. */
-        account = gnc_ui_new_accounts_from_name_window (name);
+        account = gnc_ui_new_accounts_from_name_window (parent, name);
         creating_account = FALSE;
         if (!account)
             return NULL;

commit 36fa8d57bf9cd1a6485a50ab1f5db67c92176036
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Feb 23 13:29:39 2018 -0800

    Transient-for for reconcile information dialog.

diff --git a/gnucash/gnome-utils/gnc-tree-util-split-reg.c b/gnucash/gnome-utils/gnc-tree-util-split-reg.c
index e7f81fd..d7d3836 100644
--- a/gnucash/gnome-utils/gnc-tree-util-split-reg.c
+++ b/gnucash/gnome-utils/gnc-tree-util-split-reg.c
@@ -182,7 +182,8 @@ gtu_sr_handle_exchange_rate (GncTreeViewSplitReg *view, gnc_numeric amount, Tran
             rate_split = gtu_sr_get_rate_from_db (reg_comm, xfer_comm);
 
         /* create the exchange-rate dialog */
-        xfer = gnc_xfer_dialog (NULL, NULL);
+
+        xfer = gnc_xfer_dialog (GTK_WIDGET (view), NULL);
 
         gnc_xfer_dialog_is_exchange_dialog (xfer, &rate_split);
 
diff --git a/gnucash/gnome/window-reconcile.c b/gnucash/gnome/window-reconcile.c
index c1190d8..78ed182 100644
--- a/gnucash/gnome/window-reconcile.c
+++ b/gnucash/gnome/window-reconcile.c
@@ -2152,7 +2152,7 @@ recnFinishCB (GtkAction *action, RecnWindow *recnData)
         Account *payment_account;
         XferDialog *xfer;
 
-        xfer = gnc_xfer_dialog(NULL, account);
+        xfer = gnc_xfer_dialog (GTK_WIDGET (recnData->window), account);
 
         gnc_xfer_dialog_set_amount(xfer, gnc_numeric_neg (recnData->new_ending));
 
diff --git a/gnucash/gnome/window-reconcile2.c b/gnucash/gnome/window-reconcile2.c
index 3b8082f..d8d59be 100644
--- a/gnucash/gnome/window-reconcile2.c
+++ b/gnucash/gnome/window-reconcile2.c
@@ -2096,7 +2096,7 @@ recnFinishCB (GtkAction *action, RecnWindow2 *recnData)
         Account *payment_account;
         XferDialog *xfer;
 
-        xfer = gnc_xfer_dialog (NULL, account);
+        xfer = gnc_xfer_dialog (GTK_WIDGET (recnData->window), account);
 
         gnc_xfer_dialog_set_amount (xfer, gnc_numeric_neg (recnData->new_ending));
 
diff --git a/gnucash/register/ledger-core/split-register-control.c b/gnucash/register/ledger-core/split-register-control.c
index 3ab5c3e..235befa 100644
--- a/gnucash/register/ledger-core/split-register-control.c
+++ b/gnucash/register/ledger-core/split-register-control.c
@@ -1250,7 +1250,7 @@ gnc_split_register_xfer_dialog(SplitRegister *reg, Transaction *txn,
     cur = reg->table->current_cursor;
 
     /* Create the exchange rate dialog. */
-    xfer = gnc_xfer_dialog(NULL, NULL);
+    xfer = gnc_xfer_dialog(GTK_WIDGET (reg), NULL);
     g_return_val_if_fail(xfer, NULL);
 
     /* Set the description. */



Summary of changes:
 gnucash/gnome-utils/dialog-account.c               | 64 +++++++++++++---------
 gnucash/gnome-utils/dialog-account.h               | 38 +++++++++----
 gnucash/gnome-utils/gnc-account-sel.c              |  8 ++-
 gnucash/gnome-utils/gnc-tree-control-split-reg.c   |  2 +-
 gnucash/gnome-utils/gnc-tree-util-split-reg.c      |  3 +-
 gnucash/gnome/dialog-date-close.h                  | 22 --------
 gnucash/gnome/gnc-plugin-page-account-tree.c       |  9 +--
 gnucash/gnome/gnc-plugin-page-invoice.c            |  5 +-
 gnucash/gnome/gnc-plugin-page-register.c           |  4 +-
 gnucash/gnome/gnc-plugin-page-register2.c          |  4 +-
 gnucash/gnome/window-reconcile.c                   |  4 +-
 gnucash/gnome/window-reconcile2.c                  |  4 +-
 gnucash/import-export/import-account-matcher.c     | 11 ++--
 gnucash/import-export/ofx/gnc-ofx-import.c         | 21 ++++---
 gnucash/register/ledger-core/gncEntryLedger.c      |  2 +-
 .../register/ledger-core/split-register-control.c  |  2 +-
 gnucash/register/ledger-core/split-register.c      |  6 +-
 libgnucash/engine/gnc-datetime.cpp                 | 23 +++-----
 libgnucash/engine/gnc-datetime.hpp                 |  2 +-
 19 files changed, 123 insertions(+), 111 deletions(-)



More information about the gnucash-changes mailing list