gnucash master: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Tue Feb 21 05:18:06 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/d6514a47 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d4820a25 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/b59bf0b6 (commit)
	from  https://github.com/Gnucash/gnucash/commit/a84f191e (commit)



commit d6514a47f24e86c374625963451c37cbaf8d49a7
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Feb 21 10:11:25 2023 +0000

    Windows build failure, variable set but not used
    
    With the introduction of using -Werror=unused-but-set-variable, a
    variable in strptime.c was defined but no used.
    
    Moved to be included in #ifdef _NL_CURRENT as that is where it is used.

diff --git a/borrowed/libc/strptime.c b/borrowed/libc/strptime.c
index ff6b152f2..58af36ff1 100644
--- a/borrowed/libc/strptime.c
+++ b/borrowed/libc/strptime.c
@@ -436,14 +436,13 @@ int era_cnt;
     int have_mon, have_mday;
 #ifdef _NL_CURRENT
     size_t num_eras;
-#endif
     struct era_entry *era;
-
+    era = NULL;
+#endif
     have_I = is_pm = 0;
     century = -1;
     want_century = 0;
     want_era = 0;
-    era = NULL;
 
     have_wday = want_xday = have_yday = have_mon = have_mday = 0;
 

commit d4820a25a47b50491dee2337e8682ef73e586e79
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Feb 21 10:04:05 2023 +0000

    Sort the gnc tree view column menu

diff --git a/gnucash/gnome-utils/gnc-tree-view.c b/gnucash/gnome-utils/gnc-tree-view.c
index 0e48e3b84..ed43471c0 100644
--- a/gnucash/gnome-utils/gnc-tree-view.c
+++ b/gnucash/gnome-utils/gnc-tree-view.c
@@ -40,6 +40,7 @@
 
 #include "gnc-tree-view.h"
 #include "gnc-engine.h"
+#include "gnc-glib-utils.h"
 #include "gnc-gnome-utils.h"
 #include "gnc-gobject-utils.h"
 #include "gnc-cell-renderer-date.h"
@@ -1287,6 +1288,21 @@ gnc_tree_view_create_menu_item (GtkTreeViewColumn *column,
     // LEAVE(" ");
 }
 
+static gint
+column_menu_sort (GtkTreeViewColumn *columna, GtkTreeViewColumn *columnb)
+{
+    const gchar *column_namea = g_object_get_data (G_OBJECT(columna), REAL_TITLE);
+    const gchar *column_nameb = g_object_get_data (G_OBJECT(columnb), REAL_TITLE);
+
+    if (!column_namea)
+        column_namea = gtk_tree_view_column_get_title (columna);
+
+    if (!column_nameb)
+        column_nameb = gtk_tree_view_column_get_title (columnb);
+
+    return safe_utf8_collate (column_namea, column_nameb);
+}
+
 /** This function is called to build the column selection menu.  It
  *  first destroys any old column selection menu, then checks to see
  *  if a new menu should be built.  If so, it calls the
@@ -1324,6 +1340,7 @@ gnc_tree_view_build_column_menu (GncTreeView *view)
 
         /* Now build a new menu */
         column_list = gtk_tree_view_get_columns (GTK_TREE_VIEW(view));
+        column_list = g_list_sort (column_list, (GCompareFunc)column_menu_sort);
         g_list_foreach (column_list, (GFunc)gnc_tree_view_create_menu_item, view);
         g_list_free (column_list);
     }

commit b59bf0b6335e28a638608ec2581d6fc02fb12031
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Tue Feb 21 09:52:11 2023 +0000

    Delete action on account page not disabled on edits
    
    When the notes or description cells are edited, the toolbar delete
    account action was not being disabled and so when you tried to deleted
    some text the account was deleted instead.
    
    Fixed by specifying correct action group and using it.

diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp
index 0e1b0970f..7a940bac7 100644
--- a/gnucash/gnome-utils/gnc-main-window.cpp
+++ b/gnucash/gnome-utils/gnc-main-window.cpp
@@ -3526,8 +3526,9 @@ gnc_main_window_find_action_in_group (GncMainWindow *window,
     g_return_val_if_fail (action_name != nullptr, nullptr);
 
     auto action_group = gtk_widget_get_action_group (GTK_WIDGET(window), group_name);
+
     if (action_group)
-        action = g_action_map_lookup_action (G_ACTION_MAP(window), action_name);
+        action = g_action_map_lookup_action (G_ACTION_MAP(action_group), action_name);
 
     return action;
 }
diff --git a/gnucash/gnome/gnc-plugin-page-account-tree.c b/gnucash/gnome/gnc-plugin-page-account-tree.c
index ed8a7b013..9d4c14c28 100644
--- a/gnucash/gnome/gnc-plugin-page-account-tree.c
+++ b/gnucash/gnome/gnc-plugin-page-account-tree.c
@@ -598,9 +598,9 @@ static void
 gnc_plugin_page_account_editing_started_cd (gpointer various, GncPluginPageRegister *page)
 {
     GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(page);
-    GAction *action = gnc_main_window_find_action (GNC_MAIN_WINDOW(plugin_page->window),
-                                                   "EditDeleteAccountAction");
-
+    GAction *action = gnc_main_window_find_action_in_group (GNC_MAIN_WINDOW(plugin_page->window),
+                                                            "GncPluginPageAccountTreeActions",
+                                                            "EditDeleteAccountAction");
     if (action != NULL)
         g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
 }
@@ -609,9 +609,9 @@ static void
 gnc_plugin_page_account_editing_finished_cb (gpointer various, GncPluginPageRegister *page)
 {
     GncPluginPage *plugin_page = GNC_PLUGIN_PAGE(page);
-    GAction *action = gnc_main_window_find_action (GNC_MAIN_WINDOW(plugin_page->window),
-                                                   "EditDeleteAccountAction");
-
+    GAction *action = gnc_main_window_find_action_in_group (GNC_MAIN_WINDOW(plugin_page->window),
+                                                            "GncPluginPageAccountTreeActions",
+                                                            "EditDeleteAccountAction");
     if (action != NULL)
         g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
 }



Summary of changes:
 borrowed/libc/strptime.c                     |  5 ++---
 gnucash/gnome-utils/gnc-main-window.cpp      |  3 ++-
 gnucash/gnome-utils/gnc-tree-view.c          | 17 +++++++++++++++++
 gnucash/gnome/gnc-plugin-page-account-tree.c | 12 ++++++------
 4 files changed, 27 insertions(+), 10 deletions(-)



More information about the gnucash-changes mailing list