gnucash maint: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Fri Apr 26 07:09:42 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/d1ee651b (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b87ba7ae (commit)
	 via  https://github.com/Gnucash/gnucash/commit/701974b2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/4368e18a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/9f0558ff (commit)
	 via  https://github.com/Gnucash/gnucash/commit/af96c746 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/ede281e2 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/93c8535e (commit)
	 via  https://github.com/Gnucash/gnucash/commit/397c5d13 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2262142b (commit)
	from  https://github.com/Gnucash/gnucash/commit/82a2fca2 (commit)



commit d1ee651bbc749d58b9441bc725dbd422c2eb0fcc
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Apr 24 17:02:01 2019 +0100

    Modify the qof log format based on max logger name from log.conf
    
    When you have multiple loggers enabled, the log file indentations are
    partly based on logger name length and so you can have false
    indentations which can cause confusion. This change gets the maximum
    name logger length and uses this for all with a minimum default length
    of 12 characters.

diff --git a/libgnucash/engine/qoflog.cpp b/libgnucash/engine/qoflog.cpp
index 6ed9c7c7c..841e85536 100644
--- a/libgnucash/engine/qoflog.cpp
+++ b/libgnucash/engine/qoflog.cpp
@@ -65,6 +65,7 @@ static gchar* function_buffer = NULL;
 static gint qof_log_num_spaces = 0;
 static GHashTable *log_table = NULL;
 static GLogFunc previous_handler = NULL;
+static gchar* qof_logger_format = NULL;
 
 void
 qof_log_indent(void)
@@ -124,7 +125,7 @@ log4glib_handler(const gchar     *log_domain,
         gnc_localtime_r (&now, &now_tm);
         qof_strftime(timestamp_buf, 9, format_24hour, &now_tm);
 
-        fprintf(fout, "* %s %*s <%s> %*s%s%s",
+        fprintf(fout, qof_logger_format,
                 timestamp_buf,
                 5, level_str,
                 (log_domain == NULL ? "" : log_domain),
@@ -151,6 +152,9 @@ qof_log_init_filename(const gchar* log_filename)
         log_table = g_hash_table_new_full(g_str_hash, g_str_equal,
                                           g_free, NULL);
 
+    if (!qof_logger_format)
+        qof_logger_format = g_strdup ("* %s %*s <%s> %*s%s%s"); //default format
+
     if (log_filename)
     {
         int fd;
@@ -263,13 +267,13 @@ qof_log_prettify (const char *name)
     if (p) *p = '\0';
     begin = g_strrstr (buffer, "*");
     if (begin == NULL)
-	begin = g_strrstr (buffer, " ");
+        begin = g_strrstr (buffer, " ");
     else if (* (begin + 1) == ' ')
         ++ begin;
     if (begin != NULL)
-	p = begin + 1;
+        p = begin + 1;
     else
-	p = buffer;
+        p = buffer;
 
     if (function_buffer)
         g_free(function_buffer);
@@ -317,6 +321,8 @@ qof_log_parse_log_config(const char *filename)
         gsize num_levels;
         unsigned int key_idx;
         gchar **levels;
+        gint logger_max_name_length = 12;
+        gchar *str = NULL;
 
         levels = g_key_file_get_keys(conf, levels_group, &num_levels, NULL);
 
@@ -326,6 +332,7 @@ qof_log_parse_log_config(const char *filename)
             gchar *logger_name = NULL, *level_str = NULL;
 
             logger_name = g_strdup(levels[key_idx]);
+            logger_max_name_length = MAX (logger_max_name_length, (gint) strlen (logger_name));
             level_str = g_key_file_get_string(conf, levels_group, logger_name, NULL);
             level = qof_log_level_from_string(level_str);
 
@@ -335,6 +342,13 @@ qof_log_parse_log_config(const char *filename)
             g_free(logger_name);
             g_free(level_str);
         }
+
+        str = g_strdup_printf ("%d", logger_max_name_length);
+        if (qof_logger_format)
+            g_free (qof_logger_format);
+        qof_logger_format = g_strconcat ("* %s %*s <%-", str, ".", str, "s> %*s%s%s", NULL);
+
+        g_free (str);
         g_strfreev(levels);
     }
 
@@ -380,8 +394,7 @@ qof_log_check(QofLogModule log_domain, QofLogLevel log_level)
 
     {
         gpointer match_level;
-        if (log_levels &&
-	    (match_level = g_hash_table_lookup(log_levels, "")) != NULL)
+        if (log_levels && (match_level = g_hash_table_lookup(log_levels, "")) != NULL)
             longest_match_level = (QofLogLevel)GPOINTER_TO_INT(match_level);
     }
 

commit b87ba7ae917aae30d2eff580740d8fe1bc66b7de
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Wed Apr 24 15:40:06 2019 +0100

    Bug 797051 - Overwrite prices without warning
    
    Currently if you add a price and a price already exists for that
    commodity/currency/day combination it will silently replace that price.
    The same is also true for editing a prices if you decide to change the
    date. To overcome this add a gnc-warning which allows the response to
    be saved temporary or permanently.

diff --git a/gnucash/gnome/dialog-price-editor.c b/gnucash/gnome/dialog-price-editor.c
index 70f771560..5b88992f4 100644
--- a/gnucash/gnome/dialog-price-editor.c
+++ b/gnucash/gnome/dialog-price-editor.c
@@ -44,6 +44,7 @@
 #include "gnc-session.h"
 #include "gnc-ui.h"
 #include "gnc-ui-util.h"
+#include "gnc-warnings.h"
 #include "guile-util.h"
 #include "engine-helpers.h"
 
@@ -93,6 +94,7 @@ gnc_prices_set_changed (PriceEditDialog *pedit_dialog, gboolean changed)
     pedit_dialog->changed = changed;
 
     gtk_widget_set_sensitive (pedit_dialog->apply_button, changed);
+    gtk_widget_set_sensitive (pedit_dialog->ok_button, changed);
 }
 
 
@@ -192,6 +194,56 @@ price_to_gui (PriceEditDialog *pedit_dialog)
 }
 
 
+static gboolean
+pedit_dialog_replace_found_price (PriceEditDialog *pedit_dialog,
+                                  const gnc_commodity *commodity,
+                                  const gnc_commodity *currency, time64 t)
+{
+    gboolean price_found = FALSE;
+    GNCPrice *test_price = gnc_pricedb_lookup_day_t64 (pedit_dialog->price_db,
+                                                       commodity, currency, t);
+
+    if (test_price)
+    {
+        if (pedit_dialog->is_new) // new price
+            price_found = TRUE;
+        else // edit price
+        {
+            if (!gnc_price_equal (test_price, pedit_dialog->price))
+                price_found = TRUE;
+        }
+        gnc_price_unref (test_price);
+    }
+
+    if (price_found)
+    {
+        gint response;
+        GtkWidget *dialog;
+        gchar *message = _("Are you sure you want to replace the existing price?");
+
+        dialog = gtk_message_dialog_new (GTK_WINDOW (pedit_dialog->dialog),
+                                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                                         GTK_MESSAGE_QUESTION,
+                                         GTK_BUTTONS_NONE,
+                                         "%s", _("Replace price?"));
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog),
+                        "%s", message);
+
+        gtk_dialog_add_buttons (GTK_DIALOG(dialog),
+                              _("_Cancel"), GTK_RESPONSE_CANCEL,
+                              _("_Replace"), GTK_RESPONSE_YES,
+                               (gchar *)NULL);
+        gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_YES);
+        response = gnc_dialog_run (GTK_DIALOG(dialog), GNC_PREF_WARN_PRICE_QUOTES_REPLACE);
+        gtk_widget_destroy (dialog);
+
+        if (response == GTK_RESPONSE_CANCEL)
+            return FALSE;
+    }
+    return TRUE;
+}
+
+
 static const char *
 gui_to_price (PriceEditDialog *pedit_dialog)
 {
@@ -229,20 +281,27 @@ gui_to_price (PriceEditDialog *pedit_dialog)
     value = gnc_amount_edit_get_amount
             (GNC_AMOUNT_EDIT (pedit_dialog->price_edit));
 
-    if (!pedit_dialog->price)
-        pedit_dialog->price = gnc_price_create (pedit_dialog->book);
-    gnc_price_begin_edit (pedit_dialog->price);
-    gnc_price_set_commodity (pedit_dialog->price, commodity);
-    gnc_price_set_currency (pedit_dialog->price, currency);
-    gnc_price_set_time64 (pedit_dialog->price, date);
-    gnc_price_set_source_string (pedit_dialog->price, source);
-    gnc_price_set_typestr (pedit_dialog->price, type);
-    gnc_price_set_value (pedit_dialog->price, value);
-    gnc_price_commit_edit (pedit_dialog->price);
-
-    g_free(name_space);
-
-    return NULL;
+    // test for existing price on same day
+    if (pedit_dialog_replace_found_price (pedit_dialog, commodity, currency, date))
+    {
+        if (!pedit_dialog->price)
+            pedit_dialog->price = gnc_price_create (pedit_dialog->book);
+        gnc_price_begin_edit (pedit_dialog->price);
+        gnc_price_set_commodity (pedit_dialog->price, commodity);
+        gnc_price_set_currency (pedit_dialog->price, currency);
+        gnc_price_set_time64 (pedit_dialog->price, date);
+        gnc_price_set_source_string (pedit_dialog->price, source);
+        gnc_price_set_typestr (pedit_dialog->price, type);
+        gnc_price_set_value (pedit_dialog->price, value);
+        gnc_price_commit_edit (pedit_dialog->price);
+        g_free (name_space);
+        return NULL;
+    }
+    else
+    {
+        g_free (name_space);
+        return "CANCEL";
+    }
 }
 
 
@@ -271,32 +330,39 @@ pedit_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
     PriceEditDialog *pedit_dialog = data;
     GNCPrice *new_price = NULL;
     const char *error_str;
+    gboolean price_is_ok = TRUE;
 
     if ((response == GTK_RESPONSE_OK) || (response == GTK_RESPONSE_APPLY))
     {
         error_str = gui_to_price (pedit_dialog);
-        if (error_str)
+        if (g_strcmp0 (error_str, "CANCEL") == 0)
+            price_is_ok = FALSE;
+        else if (error_str)
         {
             gnc_warning_dialog (GTK_WINDOW (pedit_dialog->dialog), "%s", error_str);
             return;
         }
 
         gnc_prices_set_changed (pedit_dialog, FALSE);
-        if (TRUE == pedit_dialog->is_new)
+        if (price_is_ok)
         {
-            gnc_pricedb_add_price (pedit_dialog->price_db, pedit_dialog->price);
-        }
+            if (pedit_dialog->is_new)
+                gnc_pricedb_add_price (pedit_dialog->price_db, pedit_dialog->price);
 
-        gnc_gui_refresh_all ();
+            gnc_gui_refresh_all ();
+        }
     }
 
     if (response == GTK_RESPONSE_APPLY)
     {
-        new_price = gnc_price_clone (pedit_dialog->price, pedit_dialog->book);
-        pedit_dialog->is_new = TRUE;
+        if (price_is_ok)
+        {
+            new_price = gnc_price_clone (pedit_dialog->price, pedit_dialog->book);
+            pedit_dialog->is_new = TRUE;
 
-        gnc_price_unref (pedit_dialog->price);
-        pedit_dialog->price = new_price;
+            gnc_price_unref (pedit_dialog->price);
+            pedit_dialog->price = new_price;
+        }
     }
     else
     {
@@ -475,11 +541,12 @@ gnc_price_pedit_dialog_create (GtkWidget *parent,
 
     w = GTK_WIDGET(gtk_builder_get_object (builder, "pd_apply_button"));
     pedit_dialog->apply_button = w;
-    gnc_prices_set_changed (pedit_dialog, FALSE);
 
     w = GTK_WIDGET(gtk_builder_get_object (builder, "pd_ok_button"));
     pedit_dialog->ok_button = w;
 
+    gnc_prices_set_changed (pedit_dialog, FALSE);
+
     gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pedit_dialog);
 
     g_object_unref(G_OBJECT(builder));
diff --git a/gnucash/gschemas/org.gnucash.warnings.gschema.xml.in b/gnucash/gschemas/org.gnucash.warnings.gschema.xml.in
index 912dcd8ee..1e1effc22 100644
--- a/gnucash/gschemas/org.gnucash.warnings.gschema.xml.in
+++ b/gnucash/gschemas/org.gnucash.warnings.gschema.xml.in
@@ -34,6 +34,11 @@
       <summary>Delete multiple price quotes</summary>
       <description>This dialog is presented before allowing you to delete multiple price quotes at one time.</description>
     </key>
+    <key name="price-quotes-replace" type="i">
+      <default>0</default>
+      <summary>Replace existing price</summary>
+      <description>This dialog is presented before allowing you to replace an existing price.</description>
+    </key>
     <key name="reg-is-acct-pay-rec" type="i">
       <default>0</default>
       <summary>Edit account payable/accounts receivable register</summary>
@@ -127,6 +132,11 @@
       <summary>Delete multiple price quotes</summary>
       <description>This dialog is presented before allowing you to delete multiple price quotes at one time.</description>
     </key>
+    <key name="price-quotes-replace" type="i">
+      <default>0</default>
+      <summary>Replace existing price</summary>
+      <description>This dialog is presented before allowing you to replace an existing price.</description>
+    </key>
     <key name="reg-is-acct-pay-rec" type="i">
       <default>0</default>
       <summary>Edit account payable/accounts receivable register</summary>

commit 701974b2c06cf88af555f44fcc910299a2b3e14c
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 23 15:30:39 2019 +0100

    Change the sensitivity of Add price button
    
    Enable the Add price button based on the number of rows selected as it
    does not make sense for it to be enabled with more than one row.

diff --git a/gnucash/gnome/dialog-price-edit-db.c b/gnucash/gnome/dialog-price-edit-db.c
index 93285a07e..ae2ed52f3 100644
--- a/gnucash/gnome/dialog-price-edit-db.c
+++ b/gnucash/gnome/dialog-price-edit-db.c
@@ -80,6 +80,7 @@ typedef struct
 
     GtkWidget * edit_button;
     GtkWidget * remove_button;
+    GtkWidget * add_button;
 
     GtkWidget *remove_dialog;
     GtkTreeView *remove_view;
@@ -580,6 +581,8 @@ gnc_prices_dialog_selection_changed (GtkTreeSelection *treeselection,
                               length == 1);
     gtk_widget_set_sensitive (pdb_dialog->remove_button,
                               length >= 1);
+    gtk_widget_set_sensitive (pdb_dialog->add_button,
+                              length <= 1);
     LEAVE("%d prices selected", length);
 }
 
@@ -708,6 +711,9 @@ gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
         button = GTK_WIDGET(gtk_builder_get_object (builder, "remove_button"));
         pdb_dialog->remove_button = button;
 
+        button = GTK_WIDGET(gtk_builder_get_object (builder, "add_button"));
+        pdb_dialog->add_button = button;
+
         if (!gnc_quote_source_fq_installed())
         {
             button = GTK_WIDGET(gtk_builder_get_object (builder, "get_quotes_button"));

commit 4368e18ac570f308a020f9fa06ac60a09af87f77
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 23 15:21:49 2019 +0100

    Bug 797165 - Crash on price deletion.
    
    Caused by the introduction of caching used in gnc_pricedb_nth_price,
    when prices were deleted, the cached list was never updated and so the
    tree model could reference a deleted price and hence crash. This also
    affected adding prices as the new prices would not show due to the
    cache not being updated. To fix this a function was added to reset the
    cache when prices are updated from the model.

diff --git a/gnucash/gnome-utils/gnc-tree-model-price.c b/gnucash/gnome-utils/gnc-tree-model-price.c
index cca362972..600631583 100644
--- a/gnucash/gnome-utils/gnc-tree-model-price.c
+++ b/gnucash/gnome-utils/gnc-tree-model-price.c
@@ -1474,7 +1474,7 @@ gnc_tree_model_price_row_delete (GncTreeModelPrice *model,
  *  item removal.
  */
 static gboolean
-gnc_tree_model_price_do_deletions (gpointer unused)
+gnc_tree_model_price_do_deletions (gpointer price_db)
 {
     ENTER(" ");
 
@@ -1490,6 +1490,7 @@ gnc_tree_model_price_do_deletions (gpointer unused)
 
             /* Remove the path. */
             gnc_tree_model_price_row_delete(data->model, data->path);
+            gnc_pricedb_nth_price_reset_cache (price_db);
 
             gtk_tree_path_free(data->path);
             g_free(data);
@@ -1540,6 +1541,7 @@ gnc_tree_model_price_event_handler (QofInstance *entity,
                                     gpointer event_data)
 {
     GncTreeModelPrice *model;
+    GncTreeModelPricePrivate *priv;
     GtkTreePath *path;
     GtkTreeIter iter;
     remove_data *data;
@@ -1548,10 +1550,11 @@ gnc_tree_model_price_event_handler (QofInstance *entity,
     ENTER("entity %p, event %d, model %p, event data %p",
           entity, event_type, user_data, event_data);
     model = (GncTreeModelPrice *)user_data;
+    priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
 
     /* Do deletions if any are pending. */
     if (pending_removals)
-        gnc_tree_model_price_do_deletions(NULL);
+        gnc_tree_model_price_do_deletions (priv->price_db);
 
     /* hard failures */
     g_return_if_fail(GNC_IS_TREE_MODEL_PRICE(model));
@@ -1611,8 +1614,9 @@ gnc_tree_model_price_event_handler (QofInstance *entity,
     switch (event_type)
     {
     case QOF_EVENT_ADD:
-        /* Tell the filters/views where the new account was added. */
+        /* Tell the filters/views where the new price was added. */
         DEBUG("add %s", name);
+        gnc_pricedb_nth_price_reset_cache (priv->price_db);
         gnc_tree_model_price_row_add (model, &iter);
         break;
 
@@ -1631,7 +1635,7 @@ gnc_tree_model_price_event_handler (QofInstance *entity,
         data->path = path;
         pending_removals = g_slist_append (pending_removals, data);
         g_idle_add_full(G_PRIORITY_HIGH_IDLE,
-                        gnc_tree_model_price_do_deletions, NULL, NULL);
+                        gnc_tree_model_price_do_deletions, priv->price_db, NULL);
 
         LEAVE(" ");
         return;
diff --git a/libgnucash/engine/gnc-pricedb-p.h b/libgnucash/engine/gnc-pricedb-p.h
index 06c611e8c..84ea6df73 100644
--- a/libgnucash/engine/gnc-pricedb-p.h
+++ b/libgnucash/engine/gnc-pricedb-p.h
@@ -57,6 +57,7 @@ struct gnc_price_db_s
     QofInstance inst;              /* globally unique object identifier */
     GHashTable *commodity_hash;
     gboolean bulk_update;		 /* TRUE while reading XML file, etc. */
+    gboolean reset_nth_price_cache;
 };
 
 struct _GncPriceDBClass
diff --git a/libgnucash/engine/gnc-pricedb.c b/libgnucash/engine/gnc-pricedb.c
index e5d07b97e..94075ac03 100644
--- a/libgnucash/engine/gnc-pricedb.c
+++ b/libgnucash/engine/gnc-pricedb.c
@@ -839,6 +839,7 @@ QOF_GOBJECT_IMPL(gnc_pricedb, GNCPriceDB, QOF_TYPE_INSTANCE);
 static void
 gnc_pricedb_init(GNCPriceDB* pdb)
 {
+    pdb->reset_nth_price_cache = FALSE;
 }
 
 static void
@@ -2202,7 +2203,7 @@ gnc_pricedb_nth_price (GNCPriceDB *db,
     if (!db || !c || n < 0) return NULL;
     ENTER ("db=%p commodity=%s index=%d", db, gnc_commodity_get_mnemonic(c), n);
 
-    if (last_c && prices && last_c == c)
+    if (last_c && prices && last_c == c && db->reset_nth_price_cache == FALSE)
     {
         result = g_list_nth_data (prices, n);
         LEAVE ("price=%p", result);
@@ -2217,6 +2218,8 @@ gnc_pricedb_nth_price (GNCPriceDB *db,
         prices = NULL;
     }
 
+    db->reset_nth_price_cache = FALSE;
+
     currency_hash = g_hash_table_lookup (db->commodity_hash, c);
     if (currency_hash)
     {
@@ -2230,6 +2233,13 @@ gnc_pricedb_nth_price (GNCPriceDB *db,
     return result;
 }
 
+void
+gnc_pricedb_nth_price_reset_cache (GNCPriceDB *db)
+{
+    if (db)
+        db->reset_nth_price_cache = TRUE;
+}
+
 GNCPrice *
 gnc_pricedb_lookup_day_t64(GNCPriceDB *db,
                            const gnc_commodity *c,
diff --git a/libgnucash/engine/gnc-pricedb.h b/libgnucash/engine/gnc-pricedb.h
index 3fbefe4f3..6a8301f3c 100644
--- a/libgnucash/engine/gnc-pricedb.h
+++ b/libgnucash/engine/gnc-pricedb.h
@@ -633,6 +633,8 @@ gnc_pricedb_nth_price (GNCPriceDB *db,
                        const gnc_commodity *c,
                        const int n);
 
+void gnc_pricedb_nth_price_reset_cache (GNCPriceDB *db);
+
 /* The following two convenience functions are used to test the xml backend */
 /** @brief Return the number of prices in the database.
  *

commit 9f0558ffb53061b5ca62a105273a173741fc1539
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 23 13:48:21 2019 +0100

    Add some missing log Macros for the price model
    
    Add some missing LEAVE macro statements so the log entries do not get
    longer and longer.

diff --git a/gnucash/gnome-utils/gnc-tree-model-price.c b/gnucash/gnome-utils/gnc-tree-model-price.c
index eaf24e897..cca362972 100644
--- a/gnucash/gnome-utils/gnc-tree-model-price.c
+++ b/gnucash/gnome-utils/gnc-tree-model-price.c
@@ -219,6 +219,8 @@ gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
     GncTreeModelPricePrivate *priv;
     const GList *item;
 
+    ENTER(" ");
+
     item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_PRICE_NAME);
     for ( ; item; item = g_list_next(item))
     {
@@ -232,8 +234,7 @@ gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
         }
     }
 
-    model = g_object_new (GNC_TYPE_TREE_MODEL_PRICE,
-                          NULL);
+    model = g_object_new (GNC_TYPE_TREE_MODEL_PRICE, NULL);
 
     priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
     priv->book = book;
@@ -242,6 +243,7 @@ gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
     priv->event_handler_id =
         qof_event_register_handler (gnc_tree_model_price_event_handler, model);
 
+    LEAVE("returning new model %p", model);
     return GTK_TREE_MODEL (model);
 }
 
@@ -1244,7 +1246,7 @@ gnc_tree_model_price_get_iter_from_commodity (GncTreeModelPrice *model,
     n = g_list_index(list, commodity);
     if (n == -1)
     {
-        LEAVE("not in list");
+        LEAVE("commodity not in list");
         return FALSE;
     }
 
@@ -1280,11 +1282,17 @@ gnc_tree_model_price_get_iter_from_namespace (GncTreeModelPrice *model,
     ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
     list = gnc_commodity_table_get_namespaces_list(ct);
     if (list == NULL)
+    {
+        LEAVE("namespace list empty");
         return FALSE;
+    }
 
     n = g_list_index(list, name_space);
     if (n == -1)
+    {
+        LEAVE("namespace not found");
         return FALSE;
+    }
 
     iter->stamp = model->stamp;
     iter->user_data  = ITER_IS_NAMESPACE;
@@ -1596,6 +1604,7 @@ gnc_tree_model_price_event_handler (QofInstance *entity,
     }
     else
     {
+        LEAVE(" ");
         return;
     }
 
diff --git a/libgnucash/engine/gnc-pricedb.c b/libgnucash/engine/gnc-pricedb.c
index 3e5df1850..e5d07b97e 100644
--- a/libgnucash/engine/gnc-pricedb.c
+++ b/libgnucash/engine/gnc-pricedb.c
@@ -309,18 +309,19 @@ gnc_price_create (QofBook *book)
 
     g_return_val_if_fail (book, NULL);
 
+    ENTER(" ");
     p = g_object_new(GNC_TYPE_PRICE, NULL);
 
     qof_instance_init_data (&p->inst, GNC_ID_PRICE, book);
     qof_event_gen (&p->inst, QOF_EVENT_CREATE, NULL);
-
+    LEAVE ("price created %p", p);
     return p;
 }
 
 static void
 gnc_price_destroy (GNCPrice *p)
 {
-    ENTER(" ");
+    ENTER("destroy price %p", p);
     qof_event_gen (&p->inst, QOF_EVENT_DESTROY, NULL);
 
     if (p->type) CACHE_REMOVE(p->type);
@@ -372,14 +373,14 @@ gnc_price_clone (GNCPrice* p, QofBook *book)
 
     if (!p)
     {
-        LEAVE (" ");
+        LEAVE ("return NULL");
         return NULL;
     }
 
     new_p = gnc_price_create(book);
     if (!new_p)
     {
-        LEAVE (" ");
+        LEAVE ("return NULL");
         return NULL;
     }
 
@@ -394,7 +395,7 @@ gnc_price_clone (GNCPrice* p, QofBook *book)
     gnc_price_set_value(new_p, gnc_price_get_value(p));
     gnc_price_set_currency(new_p, gnc_price_get_currency(p));
     gnc_price_commit_edit(new_p);
-    LEAVE (" ");
+    LEAVE ("return cloned price %p", new_p);
     return(new_p);
 }
 
@@ -1801,7 +1802,7 @@ GNCPrice *gnc_pricedb_lookup_latest(GNCPriceDB *db,
     result = price_list->data;
     gnc_price_ref(result);
     g_list_free (price_list);
-    LEAVE(" ");
+    LEAVE("price is %p", result);
     return result;
 }
 
@@ -2202,7 +2203,11 @@ gnc_pricedb_nth_price (GNCPriceDB *db,
     ENTER ("db=%p commodity=%s index=%d", db, gnc_commodity_get_mnemonic(c), n);
 
     if (last_c && prices && last_c == c)
-        return g_list_nth_data (prices, n);
+    {
+        result = g_list_nth_data (prices, n);
+        LEAVE ("price=%p", result);
+        return result;
+    }
 
     last_c = c;
 
@@ -2255,6 +2260,7 @@ gnc_pricedb_lookup_at_time64(GNCPriceDB *db,
         {
             gnc_price_ref(p);
             g_list_free (price_list);
+            LEAVE("price is %p", p);
             return p;
         }
         item = item->next;

commit af96c746a1c5260f29f96e5398c78f1ae9a5687d
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 23 13:47:19 2019 +0100

    Improve setting up the price tree views
    
    Before setting up the price tree view filters, disconnect the model
    from the tree view and then connect them after the re-filter.

diff --git a/gnucash/gnome-utils/gnc-tree-view-price.c b/gnucash/gnome-utils/gnc-tree-view-price.c
index 129a67c9d..35df37e7f 100644
--- a/gnucash/gnome-utils/gnc-tree-view-price.c
+++ b/gnucash/gnome-utils/gnc-tree-view-price.c
@@ -601,6 +601,11 @@ gnc_tree_view_price_set_filter (GncTreeViewPrice *view,
 
     s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
     f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
+
+    /* disconnect model from view */
+    g_object_ref (G_OBJECT(s_model));
+    gtk_tree_view_set_model (GTK_TREE_VIEW(view), NULL);
+
     gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
                                             gnc_tree_view_price_filter_helper,
                                             fd,
@@ -613,6 +618,11 @@ gnc_tree_view_price_set_filter (GncTreeViewPrice *view,
      * prices in the price database.  Once the very first price has been
      * added this error message goes away. */
     gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
+
+    /* connect model to view */
+    gtk_tree_view_set_model (GTK_TREE_VIEW(view), s_model);
+    g_object_unref (G_OBJECT(s_model));
+
     LEAVE(" ");
 }
 

commit ede281e2a8bc2786e0b5b08f2376465c0a87a387
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 23 13:46:06 2019 +0100

    Change the Prices dialogue to a GtkWindow.
    
    This removes the need for setting the transient parent which allows the
    dialogue to be placed behind the main application.

diff --git a/gnucash/gnome/dialog-price-edit-db.c b/gnucash/gnome/dialog-price-edit-db.c
index 602a9cd43..93285a07e 100644
--- a/gnucash/gnome/dialog-price-edit-db.c
+++ b/gnucash/gnome/dialog-price-edit-db.c
@@ -62,7 +62,6 @@ static QofLogModule log_module = GNC_MOD_GUI;
 
 void gnc_prices_dialog_window_destroy_cb (GtkWidget *object, gpointer data);
 void gnc_prices_dialog_close_cb (GtkDialog *dialog, gpointer data);
-void gnc_prices_dialog_response (GtkDialog *dialog, gint response_id, gpointer data);
 void gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data);
 void gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data);
 void gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data);
@@ -72,7 +71,7 @@ void gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data);
 
 typedef struct
 {
-    GtkWidget * dialog;
+    GtkWidget * window;
     QofSession *session;
     QofBook *book;
     GNCPriceDB *price_db;
@@ -96,10 +95,10 @@ gnc_prices_dialog_window_destroy_cb (GtkWidget *object, gpointer data)
     ENTER(" ");
     gnc_unregister_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog);
 
-    if (pdb_dialog->dialog)
+    if (pdb_dialog->window)
     {
-        gtk_widget_destroy(pdb_dialog->dialog);
-        pdb_dialog->dialog = NULL;
+        gtk_widget_destroy(pdb_dialog->window);
+        pdb_dialog->window = NULL;
     }
 
     g_free (pdb_dialog);
@@ -118,17 +117,6 @@ gnc_prices_dialog_close_cb (GtkDialog *dialog, gpointer data)
 }
 
 
-void
-gnc_prices_dialog_response (GtkDialog *dialog, gint response_id, gpointer data)
-{
-    PricesDialog *pdb_dialog = data;
-
-    ENTER(" ");
-    gnc_close_gui_component_by_data (DIALOG_PRICE_DB_CM_CLASS, pdb_dialog);
-    LEAVE(" ");
-}
-
-
 void
 gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data)
 {
@@ -149,7 +137,7 @@ gnc_prices_dialog_edit_clicked (GtkWidget *widget, gpointer data)
         return;
     }
 
-    gnc_price_edit_dialog (pdb_dialog->dialog, pdb_dialog->session,
+    gnc_price_edit_dialog (pdb_dialog->window, pdb_dialog->session,
                            price_list->data, GNC_PRICE_EDIT);
     g_list_free(price_list);
     LEAVE(" ");
@@ -190,7 +178,7 @@ gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data)
                                "Are you sure you want to delete the %d selected prices?",
                                length),
                       length);
-        dialog = gtk_message_dialog_new(GTK_WINDOW(pdb_dialog->dialog),
+        dialog = gtk_message_dialog_new(GTK_WINDOW(pdb_dialog->window),
                                         GTK_DIALOG_DESTROY_WITH_PARENT,
                                         GTK_MESSAGE_QUESTION,
                                         GTK_BUTTONS_NONE,
@@ -378,7 +366,6 @@ get_fiscal_end_date (void)
     PINFO("Fiscal end date is %s", datebuff);
 
     return time64_to_gdate (end);
-
 }
 
 void
@@ -435,7 +422,7 @@ gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data)
 
     gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog);
 
-    gtk_window_set_transient_for (GTK_WINDOW (pdb_dialog->remove_dialog), GTK_WINDOW (pdb_dialog->dialog));
+    gtk_window_set_transient_for (GTK_WINDOW (pdb_dialog->remove_dialog), GTK_WINDOW (pdb_dialog->window));
 
     pdb_dialog->remove_source = 9; // FQ and Commodities highlighted
     button = GTK_WIDGET(gtk_builder_get_object (builder, "checkbutton_fq"));
@@ -533,7 +520,7 @@ gnc_prices_dialog_add_clicked (GtkWidget *widget, gpointer data)
         price = price_list->data;
         g_list_free(price_list);
     }
-    gnc_price_edit_dialog (pdb_dialog->dialog, pdb_dialog->session,
+    gnc_price_edit_dialog (pdb_dialog->window, pdb_dialog->session,
                            price, GNC_PRICE_NEW);
     LEAVE(" ");
 }
@@ -562,7 +549,7 @@ gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data)
         return;
     }
 
-    scm_window =  SWIG_NewPointerObj(pdb_dialog->dialog,
+    scm_window =  SWIG_NewPointerObj(pdb_dialog->window,
                                      SWIG_TypeQuery("_p_GtkWindow"), 0);
 
     gnc_set_busy_cursor (NULL, TRUE);
@@ -670,32 +657,25 @@ row_activated_cb (GtkTreeView *view, GtkTreePath *path,
 static void
 gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
 {
-    GtkWidget *dialog, *scrolled_window;
+    GtkWidget *window, *scrolled_window;
     GtkBuilder *builder;
     GtkTreeView *view;
     GtkTreeSelection *selection;
 
     ENTER(" ");
     builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-price.glade", "prices_dialog");
+    gnc_builder_add_from_file (builder, "dialog-price.glade", "prices_window");
 
-    dialog = GTK_WIDGET(gtk_builder_get_object (builder, "prices_dialog"));
-    pdb_dialog->dialog = dialog;
+    window = GTK_WIDGET(gtk_builder_get_object (builder, "prices_window"));
+    pdb_dialog->window = window;
 
     // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(dialog), "GncPriceEditDialog");
+    gnc_widget_set_style_context (GTK_WIDGET(window), "GncPriceEditDialog");
 
     pdb_dialog->session = gnc_get_current_session();
     pdb_dialog->book = qof_session_get_book(pdb_dialog->session);
     pdb_dialog->price_db = gnc_pricedb_get_db(pdb_dialog->book);
 
-    /* parent */
-    if (parent != NULL)
-        gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
-
-    /* default to 'close' button */
-    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
-
     /* price tree */
     scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder, "price_list_window"));
     view = gnc_tree_view_price_new(pdb_dialog->book,
@@ -733,13 +713,20 @@ gnc_prices_dialog_create (GtkWidget * parent, PricesDialog *pdb_dialog)
             button = GTK_WIDGET(gtk_builder_get_object (builder, "get_quotes_button"));
             gtk_widget_set_sensitive(button, FALSE);
         }
+        /* default to 'close' button */
+        button = GTK_WIDGET(gtk_builder_get_object (builder, "close_button"));
+        gtk_widget_grab_default (button);
+        gtk_widget_grab_focus (button);
+
     }
 
-    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog);
+    g_signal_connect (pdb_dialog->window, "destroy",
+                      G_CALLBACK(gnc_prices_dialog_window_destroy_cb), pdb_dialog);
 
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, pdb_dialog);
     g_object_unref(G_OBJECT(builder));
 
-    gnc_restore_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog), GTK_WINDOW (parent));
+    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->window), GTK_WINDOW (parent));
     LEAVE(" ");
 }
 
@@ -750,9 +737,9 @@ close_handler (gpointer user_data)
     PricesDialog *pdb_dialog = user_data;
 
     ENTER(" ");
-    gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->dialog));
+    gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(pdb_dialog->window));
 
-    gtk_widget_destroy (GTK_WIDGET (pdb_dialog->dialog));
+    gtk_widget_destroy (GTK_WIDGET (pdb_dialog->window));
     LEAVE(" ");
 }
 
@@ -778,7 +765,7 @@ show_handler (const char *klass, gint component_id,
         return(FALSE);
     }
 
-    gtk_window_present (GTK_WINDOW(pdb_dialog->dialog));
+    gtk_window_present (GTK_WINDOW(pdb_dialog->window));
     LEAVE(" ");
     return(TRUE);
 }
@@ -815,6 +802,6 @@ gnc_prices_dialog (GtkWidget * parent)
 
     gtk_widget_grab_focus (GTK_WIDGET(pdb_dialog->price_tree));
 
-    gtk_widget_show (pdb_dialog->dialog);
+    gtk_widget_show (pdb_dialog->window);
     LEAVE(" ");
 }
diff --git a/gnucash/gtkbuilder/dialog-price.glade b/gnucash/gtkbuilder/dialog-price.glade
index e09c6ccb9..6d33455f9 100644
--- a/gnucash/gtkbuilder/dialog-price.glade
+++ b/gnucash/gtkbuilder/dialog-price.glade
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkListStore" id="liststore1">
@@ -54,6 +54,9 @@
     <property name="modal">True</property>
     <property name="type_hint">dialog</property>
     <signal name="response" handler="pedit_dialog_response_cb" swapped="no"/>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox18">
         <property name="visible">True</property>
@@ -366,6 +369,9 @@
     <property name="title" translatable="yes">Remove Old Prices</property>
     <property name="default_height">500</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox2">
         <property name="visible">True</property>
@@ -778,64 +784,30 @@ These prices were added so that there's always a "nearest in time" price for eve
       <action-widget response="-5">ok_button</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkDialog" id="prices_dialog">
+  <object class="GtkWindow" id="prices_window">
     <property name="can_focus">False</property>
-    <property name="border_width">6</property>
     <property name="title" translatable="yes">Price Database</property>
-    <property name="default_width">400</property>
+    <property name="default_width">800</property>
     <property name="default_height">400</property>
-    <property name="type_hint">normal</property>
-    <signal name="close" handler="gnc_prices_dialog_close_cb" after="yes" swapped="no"/>
-    <signal name="destroy" handler="gnc_prices_dialog_window_destroy_cb" swapped="no"/>
-    <signal name="response" handler="gnc_prices_dialog_response" swapped="no"/>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="vbox121">
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <object class="GtkBox" id="vbox11">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="spacing">6</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="hbuttonbox4">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="close_button">
-                <property name="label" translatable="yes">_Close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
-          <object class="GtkBox" id="hbox118">
+          <object class="GtkBox" id="hbox1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
               <object class="GtkScrolledWindow" id="price_list_window">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
+                <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
                 <property name="border_width">3</property>
                 <property name="shadow_type">in</property>
-                <child>
-                  <placeholder/>
-                </child>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -844,22 +816,106 @@ These prices were added so that there's always a "nearest in time" price for eve
               </packing>
             </child>
             <child>
-              <object class="GtkButtonBox" id="vbuttonbox5">
+              <object class="GtkBox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">5</property>
+                <property name="margin_bottom">12</property>
                 <property name="orientation">vertical</property>
-                <property name="layout_style">spread</property>
                 <child>
-                  <object class="GtkButton" id="get_quotes_button">
-                    <property name="label" translatable="yes">_Get Quotes</property>
+                  <object class="GtkButtonBox" id="vbuttonbox1">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="can_default">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Get new online quotes for stock accounts.</property>
-                    <property name="use_underline">True</property>
-                    <signal name="clicked" handler="gnc_prices_dialog_get_quotes_clicked" swapped="no"/>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">5</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">12</property>
+                    <property name="layout_style">start</property>
+                    <child>
+                      <object class="GtkButton" id="add_button">
+                        <property name="label" translatable="yes">_Add</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Add a new price.</property>
+                        <property name="use_underline">True</property>
+                        <signal name="clicked" handler="gnc_prices_dialog_add_clicked" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="remove_button">
+                        <property name="label" translatable="yes">_Remove</property>
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Remove the current price.</property>
+                        <property name="use_underline">True</property>
+                        <signal name="clicked" handler="gnc_prices_dialog_remove_clicked" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="edit_button">
+                        <property name="label" translatable="yes">_Edit</property>
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Edit the current price.</property>
+                        <property name="use_underline">True</property>
+                        <signal name="clicked" handler="gnc_prices_dialog_edit_clicked" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="remove_old_button">
+                        <property name="label" translatable="yes">Remove _Old</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Remove prices older than a user-entered date.</property>
+                        <property name="use_underline">True</property>
+                        <signal name="clicked" handler="gnc_prices_dialog_remove_old_clicked" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="get_quotes_button">
+                        <property name="label" translatable="yes">_Get Quotes</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Get new online quotes for stock accounts.</property>
+                        <property name="use_underline">True</property>
+                        <signal name="clicked" handler="gnc_prices_dialog_get_quotes_clicked" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">True</property>
@@ -868,93 +924,52 @@ These prices were added so that there's always a "nearest in time" price for eve
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkButton" id="add_button">
-                    <property name="label" translatable="yes">_Add</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="can_default">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Add a new price.</property>
-                    <property name="use_underline">True</property>
-                    <signal name="clicked" handler="gnc_prices_dialog_add_clicked" swapped="no"/>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="remove_button">
-                    <property name="label" translatable="yes">_Remove</property>
+                  <object class="GtkButtonBox" id="vbuttonbox2">
                     <property name="visible">True</property>
-                    <property name="sensitive">False</property>
-                    <property name="can_focus">True</property>
-                    <property name="can_default">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Remove the current price.</property>
-                    <property name="use_underline">True</property>
-                    <signal name="clicked" handler="gnc_prices_dialog_remove_clicked" swapped="no"/>
+                    <property name="can_focus">False</property>
+                    <property name="valign">end</property>
+                    <property name="border_width">5</property>
+                    <property name="orientation">vertical</property>
+                    <property name="layout_style">start</property>
+                    <child>
+                      <object class="GtkButton" id="close_button">
+                        <property name="label" translatable="yes">_Close</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="valign">start</property>
+                        <property name="use_underline">True</property>
+                        <signal name="clicked" handler="gnc_prices_dialog_close_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkButton" id="edit_button">
-                    <property name="label" translatable="yes">_Edit</property>
-                    <property name="visible">True</property>
-                    <property name="sensitive">False</property>
-                    <property name="can_focus">True</property>
-                    <property name="can_default">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Edit the current price.</property>
-                    <property name="use_underline">True</property>
-                    <signal name="clicked" handler="gnc_prices_dialog_edit_clicked" swapped="no"/>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="remove_old_button">
-                    <property name="label" translatable="yes">Remove _Old</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="can_default">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Remove prices older than a user-entered date.</property>
-                    <property name="use_underline">True</property>
-                    <signal name="clicked" handler="gnc_prices_dialog_remove_old_clicked" swapped="no"/>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">3</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="-7">close_button</action-widget>
-    </action-widgets>
   </object>
 </interface>

commit 93c8535ea9eaca5e22349096795accaac2b5c7df
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 23 11:56:35 2019 +0100

    Improve setting up the commodity tree view filters
    
    Before setting up the commodity tree view filters, disconnect the model
    from the tree view and then connect them after the re-filter.

diff --git a/gnucash/gnome-utils/gnc-tree-view-commodity.c b/gnucash/gnome-utils/gnc-tree-view-commodity.c
index d24fc787e..40f028964 100644
--- a/gnucash/gnome-utils/gnc-tree-view-commodity.c
+++ b/gnucash/gnome-utils/gnc-tree-view-commodity.c
@@ -576,6 +576,11 @@ gnc_tree_view_commodity_set_filter (GncTreeViewCommodity *view,
 
     s_model = gtk_tree_view_get_model(GTK_TREE_VIEW(view));
     f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
+
+    /* disconnect model from view */
+    g_object_ref (G_OBJECT(s_model));
+    gtk_tree_view_set_model (GTK_TREE_VIEW(view), NULL);
+
     gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
                                             gnc_tree_view_commodity_filter_helper,
                                             fd,
@@ -584,6 +589,11 @@ gnc_tree_view_commodity_set_filter (GncTreeViewCommodity *view,
     /* Whack any existing levels. The top two levels have been created
      * before this routine can be called. */
     gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (f_model));
+
+    /* connect model to view */
+    gtk_tree_view_set_model (GTK_TREE_VIEW(view), s_model);
+    g_object_unref (G_OBJECT(s_model));
+
     LEAVE(" ");
 }
 

commit 397c5d13583d8499eacb42d6e75c86c806e37e27
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 23 11:55:03 2019 +0100

    Keep selection on commodity after updates and adding
    
    After a commodity is updated or added, another row will be selected so
    add function to select a given commodity and call this after the
    changes so the selection can be maintained. For removal the selection
    is cleared so it is consistent.

diff --git a/gnucash/gnome-utils/gnc-tree-view-commodity.c b/gnucash/gnome-utils/gnc-tree-view-commodity.c
index f9c2cf9b7..d24fc787e 100644
--- a/gnucash/gnome-utils/gnc-tree-view-commodity.c
+++ b/gnucash/gnome-utils/gnc-tree-view-commodity.c
@@ -647,6 +647,44 @@ gnc_tree_view_commodity_get_selected_commodity (GncTreeViewCommodity *view)
     return commodity;
 }
 
+/*
+ * Select the commodity in the commodity tree view.
+ */
+void
+gnc_tree_view_commodity_select_commodity (GncTreeViewCommodity *view, gnc_commodity *commodity)
+{
+    GtkTreeSelection *selection;
+    GtkTreeModel *model, *f_model, *s_model;
+    GtkTreePath *tree_path;
+    GtkTreePath *f_tree_path;
+    GtkTreePath *s_tree_path;
+
+    g_return_if_fail (GNC_IS_TREE_VIEW_COMMODITY(view));
+    g_return_if_fail (commodity != NULL);
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
+
+    s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
+    f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model));
+    model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (f_model));
+
+    tree_path = gnc_tree_model_commodity_get_path_from_commodity (GNC_TREE_MODEL_COMMODITY(model), commodity);
+
+    if (tree_path)
+    {
+        f_tree_path = gtk_tree_model_filter_convert_child_path_to_path
+                                   (GTK_TREE_MODEL_FILTER (f_model), tree_path);
+
+        s_tree_path = gtk_tree_model_sort_convert_child_path_to_path
+                                   (GTK_TREE_MODEL_SORT (s_model), f_tree_path);
+
+        gtk_tree_view_expand_to_path (GTK_TREE_VIEW(view), s_tree_path);
+        gtk_tree_selection_select_path (selection, s_tree_path);
+        gtk_tree_path_free (tree_path);
+        gtk_tree_path_free (f_tree_path);
+        gtk_tree_path_free (s_tree_path);
+    }
+}
 
 #if 0 /* Not Used */
 /*
diff --git a/gnucash/gnome-utils/gnc-tree-view-commodity.h b/gnucash/gnome-utils/gnc-tree-view-commodity.h
index 52b61dde1..59280a0f7 100644
--- a/gnucash/gnome-utils/gnc-tree-view-commodity.h
+++ b/gnucash/gnome-utils/gnc-tree-view-commodity.h
@@ -203,6 +203,16 @@ gnc_commodity * gnc_tree_view_commodity_get_cursor_commodity (GncTreeViewCommodi
  */
 gnc_commodity * gnc_tree_view_commodity_get_selected_commodity  (GncTreeViewCommodity *view);
 
+
+/** Select the commodity in the associated commodity tree view.
+ *
+ *  @param view A pointer to an commodity tree view.
+ *
+ *  @param The commodity to select.
+ */
+void gnc_tree_view_commodity_select_commodity (GncTreeViewCommodity *view, gnc_commodity *commodity);
+
+
 /** This function selects all sub-commodities of an commodity in the
  *  commodity tree view.  All other commodities will be unselected.
  *
diff --git a/gnucash/gnome/dialog-commodities.c b/gnucash/gnome/dialog-commodities.c
index ea93e0779..8bcb80f6e 100644
--- a/gnucash/gnome/dialog-commodities.c
+++ b/gnucash/gnome/dialog-commodities.c
@@ -96,7 +96,10 @@ gnc_commodities_dialog_edit_clicked (GtkWidget *widget, gpointer data)
         return;
 
     if (gnc_ui_edit_commodity_modal (commodity, cd->window))
+    {
+        gnc_tree_view_commodity_select_commodity (cd->commodity_tree, commodity);
         gnc_gui_refresh_all ();
+    }
 }
 
 static void
@@ -213,6 +216,9 @@ gnc_commodities_dialog_remove_clicked (GtkWidget *widget, gpointer data)
         gnc_commodity_table_remove (ct, commodity);
         gnc_commodity_destroy (commodity);
         commodity = NULL;
+
+        // to be consistent, unselect all after remove
+        gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW(cd->commodity_tree)));
     }
 
     gnc_price_list_destroy(prices);
@@ -224,6 +230,7 @@ gnc_commodities_dialog_add_clicked (GtkWidget *widget, gpointer data)
 {
     CommoditiesDialog *cd = data;
     gnc_commodity *commodity;
+    gnc_commodity *ret_commodity;
     const char *name_space;
 
     commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
@@ -232,7 +239,8 @@ gnc_commodities_dialog_add_clicked (GtkWidget *widget, gpointer data)
     else
         name_space = NULL;
 
-    gnc_ui_new_commodity_modal (name_space, cd->window);
+    ret_commodity = gnc_ui_new_commodity_modal (name_space, cd->window);
+    gnc_tree_view_commodity_select_commodity (cd->commodity_tree, ret_commodity);
 }
 
 void

commit 2262142b6a72023c60625b33e0df9bcd4855ffb7
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Apr 23 11:42:38 2019 +0100

    Change the Securities dialogue to use GtkWindow
    
    Change the Securities dialogue from a GtkDialog to GtkWindow. This
    removes the need for setting the transient parent which allows the
    dialogue to be placed behind the main application.

diff --git a/gnucash/gnome/dialog-commodities.c b/gnucash/gnome/dialog-commodities.c
index b392c5b85..ea93e0779 100644
--- a/gnucash/gnome/dialog-commodities.c
+++ b/gnucash/gnome/dialog-commodities.c
@@ -51,7 +51,7 @@
 
 typedef struct
 {
-    GtkWidget * dialog;
+    GtkWidget * window;
     QofSession *session;
     QofBook *book;
 
@@ -65,29 +65,37 @@ typedef struct
 
 
 void gnc_commodities_window_destroy_cb (GtkWidget *object, CommoditiesDialog *cd);
-void gnc_commodities_dialog_response (GtkDialog *dialog, gint response, CommoditiesDialog *cd);
+void gnc_commodities_dialog_add_clicked (GtkWidget *widget, gpointer data);
+void gnc_commodities_dialog_edit_clicked (GtkWidget *widget, gpointer data);
+void gnc_commodities_dialog_remove_clicked (GtkWidget *widget, gpointer data);
+void gnc_commodities_dialog_close_clicked (GtkWidget *widget, gpointer data);
 void gnc_commodities_show_currencies_toggled (GtkToggleButton *toggle, CommoditiesDialog *cd);
 
 
-
 void
 gnc_commodities_window_destroy_cb (GtkWidget *object,   CommoditiesDialog *cd)
 {
     gnc_unregister_gui_component_by_data (DIALOG_COMMODITIES_CM_CLASS, cd);
 
+    if (cd->window)
+    {
+        gtk_widget_destroy(cd->window);
+        cd->window = NULL;
+    }
     g_free (cd);
 }
 
-static void
-edit_clicked (CommoditiesDialog *cd)
+void
+gnc_commodities_dialog_edit_clicked (GtkWidget *widget, gpointer data)
 {
+    CommoditiesDialog *cd = data;
     gnc_commodity *commodity;
 
     commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
     if (commodity == NULL)
         return;
 
-    if (gnc_ui_edit_commodity_modal (commodity, cd->dialog))
+    if (gnc_ui_edit_commodity_modal (commodity, cd->window))
         gnc_gui_refresh_all ();
 }
 
@@ -114,13 +122,14 @@ row_activated_cb (GtkTreeView *view, GtkTreePath *path,
         }
         else
             /* It's a commodity, so click the Edit button. */
-            edit_clicked(cd);
+            gnc_commodities_dialog_edit_clicked (NULL, cd);
     }
 }
 
-static void
-remove_clicked (CommoditiesDialog *cd)
+void
+gnc_commodities_dialog_remove_clicked (GtkWidget *widget, gpointer data)
 {
+    CommoditiesDialog *cd = data;
     GNCPriceDB *pdb;
     GList *node;
     GList *prices;
@@ -157,14 +166,14 @@ remove_clicked (CommoditiesDialog *cd)
                                 "at least one of your accounts. You may "
                                 "not delete it.");
 
-        gnc_warning_dialog (GTK_WINDOW (cd->dialog), "%s", message);
+        gnc_warning_dialog (GTK_WINDOW (cd->window), "%s", message);
         g_list_free (accounts);
         return;
     }
     g_list_free (accounts);
 
     pdb = gnc_pricedb_get_db (cd->book);
-    prices = gnc_pricedb_get_prices(pdb, commodity, NULL);
+    prices = gnc_pricedb_get_prices (pdb, commodity, NULL);
     if (prices)
     {
         message = _("This commodity has price quotes. Are "
@@ -179,19 +188,19 @@ remove_clicked (CommoditiesDialog *cd)
         warning = GNC_PREF_WARN_PRICE_COMM_DEL;
     }
 
-    dialog = gtk_message_dialog_new(GTK_WINDOW(cd->dialog),
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_MESSAGE_QUESTION,
-                                    GTK_BUTTONS_NONE,
-                                    "%s", _("Delete commodity?"));
-    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-            "%s", message);
-    gtk_dialog_add_buttons(GTK_DIALOG(dialog),
-                           _("_Cancel"), GTK_RESPONSE_CANCEL,
-                           _("_Delete"), GTK_RESPONSE_OK,
-                           (gchar *)NULL);
-    response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
-    gtk_widget_destroy(dialog);
+    dialog = gtk_message_dialog_new (GTK_WINDOW(cd->window),
+                                     GTK_DIALOG_DESTROY_WITH_PARENT,
+                                     GTK_MESSAGE_QUESTION,
+                                     GTK_BUTTONS_NONE,
+                                     "%s", _("Delete commodity?"));
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog),
+                                              "%s", message);
+    gtk_dialog_add_buttons (GTK_DIALOG(dialog),
+                            _("_Cancel"), GTK_RESPONSE_CANCEL,
+                            _("_Delete"), GTK_RESPONSE_OK,
+                            (gchar *)NULL);
+    response = gnc_dialog_run (GTK_DIALOG(dialog), warning);
+    gtk_widget_destroy (dialog);
 
     if (response == GTK_RESPONSE_OK)
     {
@@ -210,9 +219,10 @@ remove_clicked (CommoditiesDialog *cd)
     gnc_gui_refresh_all ();
 }
 
-static void
-add_clicked (CommoditiesDialog *cd)
+void
+gnc_commodities_dialog_add_clicked (GtkWidget *widget, gpointer data)
 {
+    CommoditiesDialog *cd = data;
     gnc_commodity *commodity;
     const char *name_space;
 
@@ -222,33 +232,14 @@ add_clicked (CommoditiesDialog *cd)
     else
         name_space = NULL;
 
-    gnc_ui_new_commodity_modal (name_space, cd->dialog);
+    gnc_ui_new_commodity_modal (name_space, cd->window);
 }
 
 void
-gnc_commodities_dialog_response (GtkDialog *dialog,
-                                 gint response,
-                                 CommoditiesDialog *cd)
+gnc_commodities_dialog_close_clicked (GtkWidget *widget, gpointer data)
 {
-    switch (response)
-    {
-    case GNC_RESPONSE_NEW:
-        add_clicked (cd);
-        return;
-
-    case GNC_RESPONSE_DELETE:
-        remove_clicked (cd);
-        return;
-
-    case GNC_RESPONSE_EDIT:
-        edit_clicked (cd);
-        return;
-
-    case GTK_RESPONSE_CLOSE:
-    default:
-        gnc_close_gui_component_by_data (DIALOG_COMMODITIES_CM_CLASS, cd);
-        return;
-    }
+    CommoditiesDialog *cd = data;
+    gnc_close_gui_component_by_data (DIALOG_COMMODITIES_CM_CLASS, cd);
 }
 
 static void
@@ -268,7 +259,6 @@ void
 gnc_commodities_show_currencies_toggled (GtkToggleButton *toggle,
         CommoditiesDialog *cd)
 {
-
     cd->show_currencies = gtk_toggle_button_get_active (toggle);
     gnc_tree_view_commodity_refilter (cd->commodity_tree);
 }
@@ -316,28 +306,21 @@ gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd)
     GtkTreeSelection *selection;
 
     builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "dialog-commodities.glade", "securities_dialog");
+    gnc_builder_add_from_file (builder, "dialog-commodities.glade", "securities_window");
 
-    cd->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "securities_dialog"));
+    cd->window = GTK_WIDGET(gtk_builder_get_object (builder, "securities_window"));
     cd->session = gnc_get_current_session();
     cd->book = qof_session_get_book(cd->session);
     cd->show_currencies = gnc_prefs_get_bool(GNC_PREFS_GROUP, GNC_PREF_INCL_ISO);
 
     // Set the style context for this dialog so it can be easily manipulated with css
-    gnc_widget_set_style_context (GTK_WIDGET(cd->dialog), "GncCommoditiesDialog");
-
-    gtk_builder_connect_signals(builder, cd);
-
-    /* parent */
-    if (parent != NULL)
-        gtk_window_set_transient_for (GTK_WINDOW (cd->dialog), GTK_WINDOW (parent));
+    gnc_widget_set_style_context (GTK_WIDGET(cd->window), "GncCommoditiesDialog");
 
     /* buttons */
     cd->remove_button = GTK_WIDGET(gtk_builder_get_object (builder, "remove_button"));
     cd->edit_button = GTK_WIDGET(gtk_builder_get_object (builder, "edit_button"));
 
     /* commodity tree */
-
     scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder, "commodity_list_window"));
     view = gnc_tree_view_commodity_new(cd->book,
                                        "state-section", STATE_SECTION,
@@ -361,8 +344,18 @@ gnc_commodities_dialog_create (GtkWidget * parent, CommoditiesDialog *cd)
     button = GTK_WIDGET(gtk_builder_get_object (builder, "show_currencies_button"));
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), cd->show_currencies);
 
-    g_object_unref(G_OBJECT(builder));
-    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(cd->dialog), GTK_WINDOW(parent));
+    /* default to 'close' button */
+    button = GTK_WIDGET(gtk_builder_get_object (builder, "close_button"));
+    gtk_widget_grab_default (button);
+    gtk_widget_grab_focus (button);
+
+    g_signal_connect (cd->window, "destroy",
+                      G_CALLBACK(gnc_commodities_window_destroy_cb), cd);
+
+    gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, cd);
+    g_object_unref (G_OBJECT(builder));
+
+    gnc_restore_window_size (GNC_PREFS_GROUP, GTK_WINDOW(cd->window), GTK_WINDOW(parent));
 }
 
 static void
@@ -370,11 +363,11 @@ close_handler (gpointer user_data)
 {
     CommoditiesDialog *cd = user_data;
 
-    gnc_save_window_size(GNC_PREFS_GROUP, GTK_WINDOW(cd->dialog));
+    gnc_save_window_size (GNC_PREFS_GROUP, GTK_WINDOW(cd->window));
 
-    gnc_prefs_set_bool(GNC_PREFS_GROUP, GNC_PREF_INCL_ISO, cd->show_currencies);
+    gnc_prefs_set_bool (GNC_PREFS_GROUP, GNC_PREF_INCL_ISO, cd->show_currencies);
 
-    gtk_widget_destroy(cd->dialog);
+    gtk_widget_destroy (cd->window);
 }
 
 static void
@@ -395,7 +388,7 @@ show_handler (const char *klass, gint component_id,
 
     if (!cd)
         return(FALSE);
-    gtk_window_present (GTK_WINDOW(cd->dialog));
+    gtk_window_present (GTK_WINDOW(cd->window));
     return(TRUE);
 }
 
@@ -427,5 +420,5 @@ gnc_commodities_dialog (GtkWidget * parent)
 
     gtk_widget_grab_focus (GTK_WIDGET(cd->commodity_tree));
 
-    gtk_widget_show (cd->dialog);
+    gtk_widget_show (cd->window);
 }
diff --git a/gnucash/gtkbuilder/dialog-commodities.glade b/gnucash/gtkbuilder/dialog-commodities.glade
index 457f2d0fa..3c3ff0140 100644
--- a/gnucash/gtkbuilder/dialog-commodities.glade
+++ b/gnucash/gtkbuilder/dialog-commodities.glade
@@ -1,108 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
-  <object class="GtkDialog" id="securities_dialog">
+  <object class="GtkWindow" id="securities_window">
     <property name="can_focus">False</property>
+    <property name="border_width">6</property>
     <property name="title" translatable="yes">Securities</property>
     <property name="default_width">400</property>
     <property name="default_height">400</property>
-    <property name="type_hint">normal</property>
-    <signal name="destroy" handler="gnc_commodities_window_destroy_cb" swapped="no"/>
-    <signal name="response" handler="gnc_commodities_dialog_response" swapped="no"/>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="vbox127">
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <object class="GtkBox" id="vbox12">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="hbuttonbox6">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="add_button">
-                <property name="label" translatable="yes">_Add</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip_text" translatable="yes">Add a new commodity.</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="remove_button">
-                <property name="label" translatable="yes">_Remove</property>
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip_text" translatable="yes">Remove the current commodity.</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="edit_button">
-                <property name="label" translatable="yes">_Edit</property>
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="tooltip_text" translatable="yes">Edit the current commodity.</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="close_button">
-                <property name="label" translatable="yes">_Close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
         <child>
-          <object class="GtkBox" id="commodities_vbox">
+          <object class="GtkBox" id="commodities_vbox1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="border_width">12</property>
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
-              <object class="GtkLabel" id="label1">
+              <object class="GtkLabel" id="label3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes"><b>Securities</b></property>
@@ -116,12 +38,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="hbox1">
+              <object class="GtkBox" id="hbox2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="spacing">6</property>
                 <child>
-                  <object class="GtkLabel" id="label2">
+                  <object class="GtkLabel" id="label4">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="label">    </property>
@@ -133,7 +55,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="vbox128">
+                  <object class="GtkBox" id="vbox1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="orientation">vertical</property>
@@ -145,9 +67,6 @@
                         <property name="hexpand">True</property>
                         <property name="vexpand">True</property>
                         <property name="shadow_type">in</property>
-                        <child>
-                          <placeholder/>
-                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -191,16 +110,93 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButtonBox" id="hbuttonbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="add_button">
+                <property name="label" translatable="yes">_Add</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Add a new commodity.</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="gnc_commodities_dialog_add_clicked" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="remove_button">
+                <property name="label" translatable="yes">_Remove</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Remove the current commodity.</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="gnc_commodities_dialog_remove_clicked" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="edit_button">
+                <property name="label" translatable="yes">_Edit</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Edit the current commodity.</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="gnc_commodities_dialog_edit_clicked" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="close_button">
+                <property name="label" translatable="yes">_Close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="gnc_commodities_dialog_close_clicked" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="1">add_button</action-widget>
-      <action-widget response="2">remove_button</action-widget>
-      <action-widget response="3">edit_button</action-widget>
-      <action-widget response="-6">close_button</action-widget>
-    </action-widgets>
   </object>
 </interface>



Summary of changes:
 gnucash/gnome-utils/gnc-tree-model-price.c         |  27 ++-
 gnucash/gnome-utils/gnc-tree-view-commodity.c      |  48 ++++
 gnucash/gnome-utils/gnc-tree-view-commodity.h      |  10 +
 gnucash/gnome-utils/gnc-tree-view-price.c          |  10 +
 gnucash/gnome/dialog-commodities.c                 | 135 +++++------
 gnucash/gnome/dialog-price-edit-db.c               |  73 +++---
 gnucash/gnome/dialog-price-editor.c                | 115 +++++++--
 .../gschemas/org.gnucash.warnings.gschema.xml.in   |  10 +
 gnucash/gtkbuilder/dialog-commodities.glade        | 198 ++++++++--------
 gnucash/gtkbuilder/dialog-price.glade              | 259 +++++++++++----------
 libgnucash/engine/gnc-pricedb-p.h                  |   1 +
 libgnucash/engine/gnc-pricedb.c                    |  32 ++-
 libgnucash/engine/gnc-pricedb.h                    |   2 +
 libgnucash/engine/qoflog.cpp                       |  25 +-
 14 files changed, 570 insertions(+), 375 deletions(-)



More information about the gnucash-changes mailing list