gnucash unstable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sat Mar 17 19:10:47 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/1f7edb23 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/7989f02c (commit)
	 via  https://github.com/Gnucash/gnucash/commit/01bb2985 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/28b2e732 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/e5892004 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/fb973e00 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/5f51145e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b7460922 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/41298bfd (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a54a1a15 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4bbf70e1 (commit)
	from  https://github.com/Gnucash/gnucash/commit/a43b115a (commit)



commit 1f7edb23f6ec50e45d0e00500ae445efb5ebad43
Merge: 7989f02 28b2e73
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Mar 17 16:04:17 2018 -0700

    Merge Bob Fewell's assorted GUI fixups PR 310 into unstable.
    
    Although the PR was titled "Some [fixes] for missing transient parent
    warnings", it actually has a bugfix and an assorted collection of
    GUI cleanups that happen to include a couple of transient-parent fixes.


commit 7989f02c73bfdd25da124bec435405ce8310b445
Merge: a43b115 01bb298
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Mar 17 15:53:46 2018 -0700

    Merge Tomas Schlosser's "Allow creation of prices in Python bindings" into unstable.


commit 01bb298504c6da536aa1b012cf05c7a97490abbe
Author: Tomas Schlosser <tomason at users.noreply.github.com>
Date:   Fri Mar 16 14:25:46 2018 +0100

    Allow creation of prices in Python bindings
    
    Using the function gnc_price_create and book as a parameter, it is possible to create the new GncPrice object. This will remove the necessity of cloning the prices from existing ones in Python scripts.

diff --git a/bindings/python/gnucash_core.py b/bindings/python/gnucash_core.py
index fe86958..f69cac5 100644
--- a/bindings/python/gnucash_core.py
+++ b/bindings/python/gnucash_core.py
@@ -356,7 +356,7 @@ class GncPrice(GnuCashCoreClass):
 
       See also http://code.gnucash.org/docs/head/group__Price.html
     '''
-    pass
+    _new_instance = 'gnc_price_create'
 GncPrice.add_methods_with_prefix('gnc_price_')
 
 

commit 28b2e732abc3b8ef8335e370a589d894b387b017
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Mar 12 06:42:52 2018 +0000

    When doing a file save from the a new start we have no key file
    
    Test for Key_file not being NULL before trying to free it.

diff --git a/libgnucash/app-utils/gnc-state.c b/libgnucash/app-utils/gnc-state.c
index f416c9d..b21c6f7 100644
--- a/libgnucash/app-utils/gnc-state.c
+++ b/libgnucash/app-utils/gnc-state.c
@@ -193,7 +193,8 @@ gnc_state_set_base (const QofSession *session)
     DEBUG("Clean up");
     g_free(sf_extension);
     g_free(original);
-    g_key_file_free (key_file);
+    if (key_file != NULL)
+        g_key_file_free (key_file);
 
     LEAVE ();
 }

commit e589200402238b73fce697275b9f13b23c519518
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Mar 12 06:39:49 2018 +0000

    Stop critical error due to testing null filename
    
    g_filename_from_uri returns NULL if it is not a file uri so test for the
    file:// prefix before doing g_file_test

diff --git a/gnucash/gnome-utils/dialog-file-access.c b/gnucash/gnome-utils/dialog-file-access.c
index c641b8a..ce88602 100644
--- a/gnucash/gnome-utils/dialog-file-access.c
+++ b/gnucash/gnome-utils/dialog-file-access.c
@@ -132,12 +132,14 @@ gnc_ui_file_access_response_cb(GtkDialog *dialog, gint response, GtkDialog *unus
         {
             return;
         }
-
-        if ( g_file_test( g_filename_from_uri( url, NULL, NULL ),
-                          G_FILE_TEST_IS_DIR ))
+        if (g_str_has_prefix (url, "file://"))
         {
-            gtk_file_chooser_set_current_folder_uri( faw->fileChooser, url );
-            return;
+            if ( g_file_test( g_filename_from_uri( url, NULL, NULL ),
+                              G_FILE_TEST_IS_DIR ))
+            {
+                gtk_file_chooser_set_current_folder_uri( faw->fileChooser, url );
+                return;
+            }
         }
         if ( faw->type == FILE_ACCESS_OPEN )
         {

commit fb973e008fe4a39158722a4677b99caf12fec0f4
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Mar 12 06:35:19 2018 +0000

    Change dialog-new-user to use a GtkWindow
    
    Change from using a GtkDialog to a GtkWindow to stop the transient
    parent warning and add parent for cancel dialog. No strings have been
    changed just the top level container.

diff --git a/gnucash/gnome/dialog-new-user.c b/gnucash/gnome/dialog-new-user.c
index 3cf6a9a..51c8773 100644
--- a/gnucash/gnome/dialog-new-user.c
+++ b/gnucash/gnome/dialog-new-user.c
@@ -45,7 +45,18 @@ static QofLogModule log_module = GNC_MOD_GUI;
 /* function to open a qif import assistant */
 static void (*qifImportAssistantFcn)(void) = NULL;
 
-static void gnc_ui_new_user_cancel_dialog (void);
+struct _GNCNewUserDialog
+{
+    GtkWidget *window;
+
+    GtkWidget *new_accounts_button;
+    GtkWidget *import_qif_button;
+    GtkWidget *tutorial_button;
+    gboolean   ok_pressed;
+};
+
+static void
+gnc_ui_new_user_cancel_dialog (GtkWindow *parent);
 
 void
 gnc_new_user_dialog_register_qif_assistant (void (*cb_fcn)(void))
@@ -70,71 +81,106 @@ after_hierarchy_assistant(void)
     gnc_ui_file_access_for_save_as (gnc_ui_get_main_window (NULL));
 }
 
-void
-gnc_ui_new_user_dialog (void)
+static void
+gnc_ui_new_user_cancel_cb (GtkWidget * widget, gpointer data)
 {
-    GtkWidget *dialog;
-    GtkWidget *new_accounts_button;
-    GtkWidget *import_qif_button;
-    GtkWidget *tutorial_button;
-    GtkBuilder  *builder;
+    GNCNewUserDialog *new_user = data;
+
+    g_return_if_fail(new_user);
+    gtk_widget_destroy (new_user->window);
+}
+
+static void
+gnc_ui_new_user_destroy_cb (GtkWidget * widget, gpointer data)
+{
+    GNCNewUserDialog *new_user = data;
+
+    g_return_if_fail(new_user);
+    if (new_user->ok_pressed == FALSE)
+        gnc_ui_new_user_cancel_dialog (GTK_WINDOW(new_user->window));
+
+    g_free (new_user);
+}
+
+static void
+gnc_ui_new_user_ok_cb (GtkWidget * widget, gpointer data)
+{
+    GNCNewUserDialog *new_user = data;
+
+    g_return_if_fail(new_user);
+    new_user->ok_pressed = TRUE;
+
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (new_user->new_accounts_button)))
+    {
+        gnc_ui_hierarchy_assistant_with_callback(TRUE, after_hierarchy_assistant);
+    }
+    else if ((qifImportAssistantFcn != NULL)
+             && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (new_user->import_qif_button)))
+    {
+        qifImportAssistantFcn();
+        gncp_new_user_finish ();
+    }
+    else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (new_user->tutorial_button)))
+    {
+        gnc_gnome_help (HF_GUIDE, NULL);
+        gncp_new_user_finish ();
+    }
+    gtk_widget_destroy (new_user->window);
+}
+
+static gboolean
+gnc_ui_new_user_window_present (GtkWindow *window)
+{
+    gtk_window_present (GTK_WINDOW(window));
+    return FALSE;
+}
+
+static void
+gnc_ui_new_user_dialog_create (GNCNewUserDialog *new_user)
+{
+    GtkWidget  *window;
+    GtkBuilder *builder;
+    GtkWidget  *button;
     gint result;
 
     ENTER(" ");
     builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-new-user.glade", "new_user_dialog");
+    gnc_builder_add_from_file (builder, "dialog-new-user.glade", "new_user_window");
+    new_user->window = GTK_WIDGET(gtk_builder_get_object (builder, "new_user_window"));
 
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_user_dialog"));
+    gtk_window_set_keep_above (GTK_WINDOW(new_user->window), TRUE);
 
     // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncNewUserDialog");
+    gnc_widget_set_style_context (GTK_WIDGET(new_user->window), "GncNewUserDialog");
 
-    new_accounts_button = GTK_WIDGET(gtk_builder_get_object (builder, "new_accounts_button"));
-    import_qif_button = GTK_WIDGET(gtk_builder_get_object (builder, "import_qif_button"));
-    tutorial_button = GTK_WIDGET(gtk_builder_get_object (builder, "tutorial_button"));
+    new_user->new_accounts_button = GTK_WIDGET(gtk_builder_get_object (builder, "new_accounts_button"));
+    new_user->import_qif_button = GTK_WIDGET(gtk_builder_get_object (builder, "import_qif_button"));
+    new_user->tutorial_button = GTK_WIDGET(gtk_builder_get_object (builder, "tutorial_button"));
 
     /* Set the sensitivity of the qif-import button based on the availability
      * of the qif-import assistant.
      */
-    gtk_widget_set_sensitive (import_qif_button, (qifImportAssistantFcn != NULL));
+    gtk_widget_set_sensitive (new_user->import_qif_button, (qifImportAssistantFcn != NULL));
 
-    result = gtk_dialog_run (GTK_DIALOG (dialog));
-    switch (result)
-    {
-    case GTK_RESPONSE_CANCEL:
-    case GTK_RESPONSE_DELETE_EVENT:
-        gnc_ui_new_user_cancel_dialog ();
-        break;
-    case GTK_RESPONSE_OK:
-        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (new_accounts_button)))
-        {
-            gnc_ui_hierarchy_assistant_with_callback(TRUE, after_hierarchy_assistant);
-        }
-        else if ((qifImportAssistantFcn != NULL)
-                 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (import_qif_button)))
-        {
-            qifImportAssistantFcn();
-            gncp_new_user_finish ();
-        }
-        else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tutorial_button)))
-        {
-            gnc_gnome_help (HF_GUIDE, NULL);
-            gncp_new_user_finish ();
-        }
-        break;
-    default:
-        g_print ("DEBUG: Response: %d", result);
-        g_assert_not_reached ();
-        break;
-    }
+    g_signal_connect(G_OBJECT(new_user->window), "destroy",
+            G_CALLBACK(gnc_ui_new_user_destroy_cb), new_user);
+
+    button = GTK_WIDGET(gtk_builder_get_object (builder, "ok_but"));
+    g_signal_connect(button, "clicked", G_CALLBACK(gnc_ui_new_user_ok_cb), new_user);
+
+    button = GTK_WIDGET(gtk_builder_get_object (builder, "cancel_but"));
+    g_signal_connect(button, "clicked", G_CALLBACK(gnc_ui_new_user_cancel_cb), new_user);
+
+    new_user->ok_pressed = FALSE;
+
+    g_idle_add ((GSourceFunc)gnc_ui_new_user_window_present, GTK_WINDOW(new_user->window));
 
     g_object_unref(G_OBJECT(builder));
-    gtk_widget_destroy (dialog);
     LEAVE(" ");
 }
 
 static void
-gnc_ui_new_user_cancel_dialog (void)
+gnc_ui_new_user_cancel_dialog (GtkWindow *parent)
 {
     GtkWidget *dialog;
     GtkBuilder  *builder;
@@ -146,6 +192,8 @@ gnc_ui_new_user_cancel_dialog (void)
 
     dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_user_cancel_dialog"));
 
+    gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+
     result = gtk_dialog_run (GTK_DIALOG (dialog));
     keepshowing = (result == GTK_RESPONSE_YES);
 
@@ -161,3 +209,14 @@ gncp_new_user_finish (void)
 {
     gnc_hook_run(HOOK_BOOK_OPENED, gnc_get_current_session());
 }
+
+void
+gnc_ui_new_user_dialog (void)
+{
+    GNCNewUserDialog *new_user;
+
+    new_user = g_new0(GNCNewUserDialog, 1);
+    gnc_ui_new_user_dialog_create (new_user);
+    gtk_widget_show (new_user->window);
+}
+
diff --git a/gnucash/gnome/dialog-new-user.h b/gnucash/gnome/dialog-new-user.h
index 1d419e3..2780dbb 100644
--- a/gnucash/gnome/dialog-new-user.h
+++ b/gnucash/gnome/dialog-new-user.h
@@ -26,6 +26,8 @@
 #define GNC_PREFS_GROUP_NEW_USER "dialogs.new-user"
 #define GNC_PREF_FIRST_STARTUP "first-startup"
 
+typedef struct _GNCNewUserDialog GNCNewUserDialog;
+
 void gnc_ui_new_user_dialog (void);
 void gnc_set_first_startup (gboolean first_startup);
 
diff --git a/gnucash/gtkbuilder/dialog-new-user.glade b/gnucash/gtkbuilder/dialog-new-user.glade
index e2c4fa7..1d422ef 100644
--- a/gnucash/gtkbuilder/dialog-new-user.glade
+++ b/gnucash/gtkbuilder/dialog-new-user.glade
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.2 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkDialog" id="new_user_cancel_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
     <property name="resizable">False</property>
@@ -125,26 +124,22 @@
       <action-widget response="-9">no_but</action-widget>
       <action-widget response="-8">yes_but</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
-  <object class="GtkDialog" id="new_user_dialog">
+  <object class="GtkWindow" id="new_user_window">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="halign">start</property>
-    <property name="valign">start</property>
-    <property name="border_width">5</property>
-    <property name="resizable">False</property>
-    <property name="modal">True</property>
-    <property name="window_position">center</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="vbox1">
+    <child>
+      <object class="GtkBox" id="vbox2">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="halign">start</property>
         <property name="valign">start</property>
         <property name="orientation">vertical</property>
         <property name="spacing">14</property>
-        <child internal-child="action_area">
+        <child>
           <object class="GtkButtonBox" id="hbbox1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
@@ -210,7 +205,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label1">
+              <object class="GtkLabel" id="label2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes"><span size="larger" weight="bold">Welcome to GnuCash!</span></property>
@@ -222,7 +217,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="vbox2">
+              <object class="GtkBox" id="vbox3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="halign">start</property>
@@ -230,7 +225,7 @@
                 <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
-                  <object class="GtkLabel" id="label2">
+                  <object class="GtkLabel" id="label3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="label" translatable="yes">There are some predefined actions available that most new users prefer to get started with GnuCash. Select one of these actions from below and click the <i>OK</i> button or press the <i>Cancel</i> button if you don't want to perform any of them.</property>
@@ -250,10 +245,10 @@
                     <property name="label" translatable="yes">C_reate a new set of accounts</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="has_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="halign">start</property>
                     <property name="use_underline">True</property>
+                    <property name="active">True</property>
                     <property name="draw_indicator">True</property>
                   </object>
                   <packing>
@@ -314,9 +309,8 @@
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="-6">cancel_but</action-widget>
-      <action-widget response="-5">ok_but</action-widget>
-    </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>

commit 5f51145e95907402045aaaa069394f06154b6362
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Mar 12 06:34:37 2018 +0000

    A couple of changes to assistant glade files

diff --git a/gnucash/gtkbuilder/assistant-hierarchy.glade b/gnucash/gtkbuilder/assistant-hierarchy.glade
index 8e48b56..5d9770c 100644
--- a/gnucash/gtkbuilder/assistant-hierarchy.glade
+++ b/gnucash/gtkbuilder/assistant-hierarchy.glade
@@ -3,9 +3,10 @@
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkAssistant" id="hierarchy_assistant">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="border_width">12</property>
+    <property name="modal">True</property>
+    <property name="default_width">400</property>
     <property name="default_height">550</property>
     <signal name="cancel" handler="on_cancel" swapped="no"/>
     <signal name="close" handler="on_finish" swapped="no"/>
@@ -133,7 +134,7 @@ Select categories that correspond to the ways that you foresee you will use GnuC
           <object class="GtkPaned" id="hpaned100">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="position">650</property>
+            <property name="position">300</property>
             <property name="position_set">True</property>
             <child>
               <object class="GtkPaned" id="vpaned100">
diff --git a/gnucash/gtkbuilder/assistant-stock-split.glade b/gnucash/gtkbuilder/assistant-stock-split.glade
index bc3ea68..1a9f847 100644
--- a/gnucash/gtkbuilder/assistant-stock-split.glade
+++ b/gnucash/gtkbuilder/assistant-stock-split.glade
@@ -3,7 +3,6 @@
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkAssistant" id="stock_split_assistant">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="halign">start</property>
     <property name="border_width">12</property>

commit b74609221e23b098b3ad397423d233c10111cd12
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Mon Mar 12 06:32:04 2018 +0000

    Bug 794242 - Remove keep above setting for assistant hierarchy

diff --git a/gnucash/gnome/assistant-hierarchy.c b/gnucash/gnome/assistant-hierarchy.c
index ff5ff05..5e1f8a1 100644
--- a/gnucash/gnome/assistant-hierarchy.c
+++ b/gnucash/gnome/assistant-hierarchy.c
@@ -1271,10 +1271,6 @@ gnc_create_hierarchy_assistant (gboolean use_defaults, GncHierarchyAssistantFini
     // Set the style context for this assistant so it can be easily manipulated with css
     gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncAssistAccountHierarchy");
 
-    /* If we have a callback, make this window stay on top */
-    if (when_completed != NULL)
-        gtk_window_set_keep_above (GTK_WINDOW(data->dialog), TRUE);
-
     /* Enable buttons on first and last page. */
     gtk_assistant_set_page_complete (GTK_ASSISTANT (dialog),
                                      GTK_WIDGET(gtk_builder_get_object(builder, "intro_page_label")),
@@ -1331,6 +1327,7 @@ gnc_create_hierarchy_assistant (gboolean use_defaults, GncHierarchyAssistantFini
 
     data->when_completed = when_completed;
     data->use_defaults = use_defaults;
+    gtk_widget_show_all (dialog);
     return dialog;
 }
 

commit 41298bfd524cd87dcfb6b280443896d41aec7a0e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Mar 11 12:30:43 2018 +0000

    Fix transient parent warnings in import dialogs

diff --git a/gnucash/gtkbuilder/dialog-account-picker.glade b/gnucash/gtkbuilder/dialog-account-picker.glade
index e11c667..0bd5aa9 100644
--- a/gnucash/gtkbuilder/dialog-account-picker.glade
+++ b/gnucash/gtkbuilder/dialog-account-picker.glade
@@ -136,7 +136,6 @@
     </child>
   </object>
   <object class="GtkDialog" id="qif_import_account_picker_dialog">
-    <property name="visible">True</property>
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Select Account</property>
     <property name="default_width">300</property>
diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
index 397a353..80a871c 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
+++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
@@ -641,7 +641,8 @@ CsvImpTransAssist::CsvImpTransAssist ()
        Note, this will call g_new0 internally. The returned object is g_freed again
        either directly by the main matcher or in our assistant_finish code of the matcher
        is never reached. */
-    gnc_csv_importer_gui = gnc_gen_trans_assist_new (match_page, nullptr, false, 42);
+    gnc_csv_importer_gui = gnc_gen_trans_assist_new (GTK_WIDGET(csv_imp_asst),
+                                                     match_page, nullptr, false, 42);
 
     /* Summary Page */
     summary_page  = GTK_WIDGET(gtk_builder_get_object (builder, "summary_page"));
@@ -1786,7 +1787,7 @@ CsvImpTransAssist::acct_match_select(GtkTreeModel *model, GtkTreeIter* iter)
                                      MAPPING_ACCOUNT, &account, -1);
 
     auto acct_name = csv_tximp_acct_match_text_parse (text);
-    auto gnc_acc = gnc_import_select_account (nullptr, nullptr, true,
+    auto gnc_acc = gnc_import_select_account (GTK_WIDGET(csv_imp_asst), nullptr, true,
             acct_name.c_str(), nullptr, ACCT_TYPE_NONE, account, nullptr);
 
     if (gnc_acc) // We may have canceled
diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 627d218..78d46af 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -56,8 +56,7 @@
 
 struct _main_matcher_info
 {
-    GtkWidget *dialog;
-    GtkWidget *assistant;
+    GtkWidget *main_widget;
     GtkTreeView *view;
     GNCImportSettings *user_settings;
     int selected_row;
@@ -130,12 +129,11 @@ void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
         while (gtk_tree_model_iter_next (model, &iter));
     }
 
-
-    if (!(info->dialog == NULL))
+    if (GTK_IS_DIALOG(info->main_widget))
     {
-        gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->dialog));
+        gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->main_widget));
         gnc_import_Settings_delete (info->user_settings);
-        gtk_widget_destroy (GTK_WIDGET (info->dialog));
+        gtk_widget_destroy (GTK_WIDGET (info->main_widget));
     }
     else
         gnc_import_Settings_delete (info->user_settings);
@@ -236,7 +234,7 @@ on_matcher_help_clicked (GtkButton *button, gpointer user_data)
 
     help_dialog = GTK_WIDGET(gtk_builder_get_object (builder, "matcher_help_dialog"));
     gtk_window_set_transient_for(GTK_WINDOW(help_dialog),
-                                 GTK_WINDOW(info->dialog));
+                                 GTK_WINDOW(info->main_widget));
 
     /* Connect the signals */
     gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, help_dialog);
@@ -260,7 +258,8 @@ run_account_picker_dialog (GNCImportMainMatcher *info,
     gboolean ok_pressed;
     g_assert (trans_info);
     old_acc = gnc_import_TransInfo_get_destacc (trans_info);
-    new_acc = gnc_import_select_account(info->dialog,
+
+    new_acc = gnc_import_select_account(info->main_widget,
                                         NULL,
                                         TRUE,
                                         _("Destination account for the auto-balance split."),
@@ -276,7 +275,8 @@ static void
 run_match_dialog (GNCImportMainMatcher *info,
                   GNCImportTransInfo *trans_info)
 {
-    gnc_import_match_picker_run_and_close (trans_info, info->pending_matches);
+    gnc_import_match_picker_run_and_close (info->main_widget,
+                                           trans_info, info->pending_matches);
 }
 
 static void
@@ -472,7 +472,7 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
     /* Add the columns *
      * (keep the line break below to avoid a translator comment) */
     add_text_column(view,
-    		        _("Date"), DOWNLOADED_COL_DATE);
+                    _("Date"), DOWNLOADED_COL_DATE);
     column = add_text_column(view, _("Account"), DOWNLOADED_COL_ACCOUNT);
     gtk_tree_view_column_set_visible(column, show_account);
     add_text_column(view, _("Amount"), DOWNLOADED_COL_AMOUNT);
@@ -550,8 +550,8 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
     builder = gtk_builder_new();
     gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_dialog");
     gnc_builder_add_from_file (builder, "dialog-import.glade", "transaction_matcher_content");
-    info->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_dialog"));
-    g_assert (info->dialog != NULL);
+    info->main_widget = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_dialog"));
+    g_assert (info->main_widget != NULL);
 
     /* Pack the content into the dialog vbox */
     pbox = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_vbox"));
@@ -568,13 +568,13 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
     g_assert (heading_label != NULL);
 
     if (parent)
-        gtk_window_set_transient_for (GTK_WINDOW (info->dialog), GTK_WINDOW (parent));
+        gtk_window_set_transient_for (GTK_WINDOW (info->main_widget), GTK_WINDOW (parent));
 
     if (heading)
         gtk_label_set_text (GTK_LABEL (heading_label), heading);
 
-    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->dialog));
-    gtk_widget_show_all (GTK_WIDGET (info->dialog));
+    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(info->main_widget));
+    gtk_widget_show_all (GTK_WIDGET (info->main_widget));
 
     info->transaction_processed_cb = NULL;
 
@@ -591,9 +591,8 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
  *****************************************************************/
 
 GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
-        const gchar* heading,
-        gboolean all_from_same_account,
-        gint match_date_hardlimit)
+        GtkWidget *assistant_page, const gchar* heading,
+        gboolean all_from_same_account, gint match_date_hardlimit)
 {
     GNCImportMainMatcher *info;
     GtkBuilder *builder;
@@ -605,6 +604,7 @@ GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
 
     info = g_new0 (GNCImportMainMatcher, 1);
     info->pending_matches = gnc_import_PendingMatches_new();
+    info->main_widget = GTK_WIDGET(parent);
 
     /* Initialize user Settings. */
     info->user_settings = gnc_import_Settings_new ();
@@ -623,7 +623,7 @@ GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
     }
     /* Pack content into Assistant page widget */
     box = GTK_WIDGET(gtk_builder_get_object (builder, "transaction_matcher_content"));
-    gtk_box_pack_start( GTK_BOX(parent), box, TRUE, TRUE, 6);
+    gtk_box_pack_start (GTK_BOX(assistant_page), box, TRUE, TRUE, 6);
 
     /* Get the view */
     info->view = GTK_TREE_VIEW(gtk_builder_get_object (builder, "downloaded_view"));
@@ -669,7 +669,7 @@ gboolean gnc_gen_trans_list_run (GNCImportMainMatcher *info)
     gboolean result;
 
     /* DEBUG("Begin"); */
-    result = gtk_dialog_run (GTK_DIALOG (info->dialog));
+    result = gtk_dialog_run (GTK_DIALOG (info->main_widget));
     /* DEBUG("Result was %d", result); */
 
     /* No destroying here since the dialog was already destroyed through
@@ -962,7 +962,7 @@ void gnc_gen_trans_list_add_trans_with_ref_id(GNCImportMainMatcher *gui, Transac
 GtkWidget *gnc_gen_trans_list_widget (GNCImportMainMatcher *info)
 {
     g_assert(info);
-    return info->dialog;
+    return info->main_widget;
 }
 
 /** @} */
diff --git a/gnucash/import-export/import-main-matcher.h b/gnucash/import-export/import-main-matcher.h
index 2250355..b98c123 100644
--- a/gnucash/import-export/import-main-matcher.h
+++ b/gnucash/import-export/import-main-matcher.h
@@ -76,8 +76,10 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
  *   transaction matcher will be packed into. The data structure
  *   GNCImportMainMatcher is returned.
  *
- * @param parent The parent widget. This is the place the transaction
- * matcher will be packed into.
+ * @param parent The parent widget
+ *
+ * @param assistant_page The parent widget. This is the place the
+ * transaction matcher will be packed into.
  *
  * @param heading The heading label in the Importer window. May be NULL.
  *
@@ -98,9 +100,8 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
  * @return A pointer to the GNCImportMainMatcher which has been setup.
 */
 GNCImportMainMatcher * gnc_gen_trans_assist_new (GtkWidget *parent,
-        const gchar* heading,
-        gboolean all_from_same_account,
-        gint match_date_hardlimit);
+        GtkWidget *assistant_page, const gchar* heading,
+        gboolean all_from_same_account, gint match_date_hardlimit);
 
 
 /**  This starts the import process for transaction from an assistant.
diff --git a/gnucash/import-export/import-match-picker.c b/gnucash/import-export/import-match-picker.c
index c0f83e0..c396035 100644
--- a/gnucash/import-export/import-match-picker.c
+++ b/gnucash/import-export/import-match-picker.c
@@ -449,7 +449,7 @@ gnc_import_match_picker_init_match_view (GNCImportMatchPicker * matcher)
  * -- GUI initialization for the Match_Picker Dialog
 \********************************************************************/
 static void
-init_match_picker_gui(GNCImportMatchPicker * matcher)
+init_match_picker_gui(GtkWidget *parent, GNCImportMatchPicker * matcher)
 {
     GtkBuilder *builder;
 
@@ -467,7 +467,9 @@ init_match_picker_gui(GNCImportMatchPicker * matcher)
     matcher->downloaded_view = (GtkTreeView *)GTK_WIDGET(gtk_builder_get_object (builder, "download_view"));
     matcher->match_view = (GtkTreeView *)GTK_WIDGET(gtk_builder_get_object (builder, "matched_view"));
     matcher->reconciled_chk = (GtkCheckButton *)GTK_WIDGET(gtk_builder_get_object(builder, "hide_reconciled_check1"));
-    
+
+    gtk_window_set_transient_for (GTK_WINDOW (matcher->transaction_matcher), GTK_WINDOW(parent));
+
     gnc_prefs_bind (GNC_PREFS_GROUP, GNC_PREF_DISPLAY_RECONCILED,
                     matcher->reconciled_chk, "active");
 
@@ -503,7 +505,7 @@ init_match_picker_gui(GNCImportMatchPicker * matcher)
  * return after the user clicked Ok, Cancel, or Window-Close.
  */
 void
-gnc_import_match_picker_run_and_close (GNCImportTransInfo *transaction_info,
+gnc_import_match_picker_run_and_close (GtkWidget *parent, GNCImportTransInfo *transaction_info,
                                        GNCImportPendingMatches *pending_matches)
 {
     GNCImportMatchPicker *matcher;
@@ -519,7 +521,7 @@ gnc_import_match_picker_run_and_close (GNCImportTransInfo *transaction_info,
     matcher->pending_matches = pending_matches;
     
     /* DEBUG("Init match_picker"); */
-    init_match_picker_gui(matcher);
+    init_match_picker_gui(parent, matcher);
 
     /* Append this single transaction to the view and select it */
     downloaded_transaction_append(matcher, transaction_info);
diff --git a/gnucash/import-export/import-match-picker.h b/gnucash/import-export/import-match-picker.h
index 7b789ee..9ec7b31 100644
--- a/gnucash/import-export/import-match-picker.h
+++ b/gnucash/import-export/import-match-picker.h
@@ -48,10 +48,13 @@ typedef struct _transpickerdialog GNCImportMatchPicker;
  *
  * This function is used from the gnc-gen-transaction code.
  *
+ * @param parent The parent widget
  * @param transaction_info The TransInfo for which the user is supposed to
- * pick a matching transaction. */
+ * pick a matching transaction.
+ * @param pending_matches List of transactions */
 void
-gnc_import_match_picker_run_and_close (GNCImportTransInfo *transaction_info,
+gnc_import_match_picker_run_and_close (GtkWidget *parent,
+                                       GNCImportTransInfo *transaction_info,
                                        GNCImportPendingMatches *pending_matches);
 /**@}*/
 
diff --git a/gnucash/import-export/qif-imp/assistant-qif-import.c b/gnucash/import-export/qif-imp/assistant-qif-import.c
index 51e27d4..21f3e74 100644
--- a/gnucash/import-export/qif-imp/assistant-qif-import.c
+++ b/gnucash/import-export/qif-imp/assistant-qif-import.c
@@ -616,7 +616,7 @@ rematch_line(QIFImportWindow *wind, GtkTreeSelection *selection,
     map_entry = scm_list_ref(display_info, scm_from_int (row));
 
     /* Call the account picker to update it. */
-    if (!qif_account_picker_dialog(wind, map_entry))
+    if (!qif_account_picker_dialog(GTK_WINDOW(wind->window), wind, map_entry))
         return;
     gnc_name = scm_call_1(get_gnc_name, map_entry);
 
diff --git a/gnucash/import-export/qif-imp/dialog-account-picker.c b/gnucash/import-export/qif-imp/dialog-account-picker.c
index 5c21318..d6def51 100644
--- a/gnucash/import-export/qif-imp/dialog-account-picker.c
+++ b/gnucash/import-export/qif-imp/dialog-account-picker.c
@@ -324,7 +324,7 @@ gnc_ui_qif_account_picker_map_cb(GtkWidget * w, gpointer user_data)
  * If the clicks Cancel instead, FALSE is returned. Modal.
  ****************************************************************/
 gboolean
-qif_account_picker_dialog(QIFImportWindow * qif_wind, SCM map_entry)
+qif_account_picker_dialog(GtkWindow *parent, QIFImportWindow * qif_wind, SCM map_entry)
 {
     QIFAccountPickerDialog * wind;
     SCM gnc_name     = scm_c_eval_string("qif-map-entry:gnc-name");
@@ -353,6 +353,8 @@ qif_account_picker_dialog(QIFImportWindow * qif_wind, SCM map_entry)
     wind->treeview   = GTK_TREE_VIEW(gtk_builder_get_object (builder, "account_tree"));
     wind->qif_wind   = qif_wind;
 
+    gtk_window_set_transient_for (GTK_WINDOW (wind->dialog), parent);
+
     {
         GtkTreeStore *store;
         GtkCellRenderer *renderer;
diff --git a/gnucash/import-export/qif-imp/dialog-account-picker.h b/gnucash/import-export/qif-imp/dialog-account-picker.h
index b5e7bbc..36bbd6d 100644
--- a/gnucash/import-export/qif-imp/dialog-account-picker.h
+++ b/gnucash/import-export/qif-imp/dialog-account-picker.h
@@ -28,7 +28,7 @@
 
 #include "assistant-qif-import.h"
 
-gboolean qif_account_picker_dialog(QIFImportWindow * wind, SCM initial_sel);
+gboolean qif_account_picker_dialog (GtkWindow *parent, QIFImportWindow * wind, SCM initial_sel);
 
 typedef struct _accountpickerdialog QIFAccountPickerDialog;
 

commit a54a1a159b2384f8333f8bf75a5e92273553acf4
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Mar 11 12:22:51 2018 +0000

    Add missing response section to the account picker dialog

diff --git a/gnucash/gtkbuilder/dialog-account-picker.glade b/gnucash/gtkbuilder/dialog-account-picker.glade
index f88bede..e11c667 100644
--- a/gnucash/gtkbuilder/dialog-account-picker.glade
+++ b/gnucash/gtkbuilder/dialog-account-picker.glade
@@ -258,5 +258,10 @@
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget response="1">newbutton</action-widget>
+      <action-widget response="-6">cancelbutton</action-widget>
+      <action-widget response="-5">okbutton</action-widget>
+    </action-widgets>
   </object>
 </interface>

commit 4bbf70e10309117b4a20129e1758dc1da04b5ce2
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Sun Mar 11 12:18:16 2018 +0000

    Glade 3.20 adds surplus padding option to action area
    
    When glade files are saved which have GtkAssistants defined a packing
    section is added to the assistant action area which then causes a
    warning so remove them.

diff --git a/gnucash/gtkbuilder/assistant-csv-account-import.glade b/gnucash/gtkbuilder/assistant-csv-account-import.glade
index b119eb1..1594e66 100644
--- a/gnucash/gtkbuilder/assistant-csv-account-import.glade
+++ b/gnucash/gtkbuilder/assistant-csv-account-import.glade
@@ -354,9 +354,6 @@ Cancel to abort.</property>
       <object class="GtkBox" id="assistant-action_area2">
         <property name="can_focus">False</property>
       </object>
-      <packing>
-        <property name="has_padding">False</property>
-      </packing>
     </child>
   </object>
 </interface>
diff --git a/gnucash/gtkbuilder/assistant-csv-price-import.glade b/gnucash/gtkbuilder/assistant-csv-price-import.glade
index ed111e6..03a9a5b 100644
--- a/gnucash/gtkbuilder/assistant-csv-price-import.glade
+++ b/gnucash/gtkbuilder/assistant-csv-price-import.glade
@@ -1114,9 +1114,6 @@ Cancel to abort.</b></property>
       <object class="GtkBox">
         <property name="can_focus">False</property>
       </object>
-      <packing>
-        <property name="has_padding">False</property>
-      </packing>
     </child>
   </object>
 </interface>
diff --git a/gnucash/gtkbuilder/assistant-csv-trans-import.glade b/gnucash/gtkbuilder/assistant-csv-trans-import.glade
index 157f25d..9968453 100644
--- a/gnucash/gtkbuilder/assistant-csv-trans-import.glade
+++ b/gnucash/gtkbuilder/assistant-csv-trans-import.glade
@@ -1196,9 +1196,6 @@ More information can be displayed by using the help button.</property>
       <object class="GtkBox" id="assistant-action_area2">
         <property name="can_focus">False</property>
       </object>
-      <packing>
-        <property name="has_padding">False</property>
-      </packing>
     </child>
   </object>
 </interface>
diff --git a/gnucash/gtkbuilder/assistant-xml-encoding.glade b/gnucash/gtkbuilder/assistant-xml-encoding.glade
index 49dbb87..950b603 100644
--- a/gnucash/gtkbuilder/assistant-xml-encoding.glade
+++ b/gnucash/gtkbuilder/assistant-xml-encoding.glade
@@ -170,9 +170,6 @@
       <object class="GtkBox" id="assistant-action_area2">
         <property name="can_focus">False</property>
       </object>
-      <packing>
-        <property name="has_padding">False</property>
-      </packing>
     </child>
   </object>
   <object class="GtkDialog" id="encodings_dialog">



Summary of changes:
 bindings/python/gnucash_core.py                    |   2 +-
 gnucash/gnome-utils/dialog-file-access.c           |  12 +-
 gnucash/gnome/assistant-hierarchy.c                |   5 +-
 gnucash/gnome/dialog-new-user.c                    | 151 ++++++++++++++-------
 gnucash/gnome/dialog-new-user.h                    |   2 +
 .../gtkbuilder/assistant-csv-account-import.glade  |   3 -
 .../gtkbuilder/assistant-csv-price-import.glade    |   3 -
 .../gtkbuilder/assistant-csv-trans-import.glade    |   3 -
 gnucash/gtkbuilder/assistant-hierarchy.glade       |   5 +-
 gnucash/gtkbuilder/assistant-stock-split.glade     |   1 -
 gnucash/gtkbuilder/assistant-xml-encoding.glade    |   3 -
 gnucash/gtkbuilder/dialog-account-picker.glade     |   6 +-
 gnucash/gtkbuilder/dialog-new-user.glade           |  36 ++---
 .../csv-imp/assistant-csv-trans-import.cpp         |   5 +-
 gnucash/import-export/import-main-matcher.c        |  42 +++---
 gnucash/import-export/import-main-matcher.h        |  11 +-
 gnucash/import-export/import-match-picker.c        |  10 +-
 gnucash/import-export/import-match-picker.h        |   7 +-
 .../import-export/qif-imp/assistant-qif-import.c   |   2 +-
 .../import-export/qif-imp/dialog-account-picker.c  |   4 +-
 .../import-export/qif-imp/dialog-account-picker.h  |   2 +-
 libgnucash/app-utils/gnc-state.c                   |   3 +-
 22 files changed, 187 insertions(+), 131 deletions(-)



More information about the gnucash-changes mailing list