gnucash stable: Multiple changes pushed
Robert Fewell
bobit at code.gnucash.org
Mon Oct 20 11:41:51 EDT 2025
Updated via https://github.com/Gnucash/gnucash/commit/dc9b37ae (commit)
via https://github.com/Gnucash/gnucash/commit/8e8d2bf0 (commit)
from https://github.com/Gnucash/gnucash/commit/e22c4065 (commit)
commit dc9b37aeff7ed896a2d0ac733fc5b26d1c8fe2ef
Merge: e22c406547 8e8d2bf002
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Oct 20 16:34:26 2025 +0100
Merge Oscar Megia's bug-799538 into stable
commit 8e8d2bf002843ec69b6ea2ef6ddca80a21974eb6
Author: Oscar MegÃa López <megia.oscar at gmail.com>
Date: Wed May 28 09:27:42 2025 +0200
Bug 799538 - Clipboard pastes to wrong field in...
Fixed Cut, Copy and Paste when focus is not in GnucashSheet.
Now, when the user clicks on the "Scheduled Transactions" tab,
the focus goes to the last edited cell.
diff --git a/gnucash/gnome/dialog-sx-editor.c b/gnucash/gnome/dialog-sx-editor.c
index f8144effed..92fd507ec6 100644
--- a/gnucash/gnome/dialog-sx-editor.c
+++ b/gnucash/gnome/dialog-sx-editor.c
@@ -1128,6 +1128,30 @@ sxed_delete_event (GtkWidget *widget, GdkEvent *event, gpointer ud)
return FALSE;
}
+static gboolean
+focus_idle_callback(gpointer user_data)
+{
+ GNCLedgerDisplay *ledger_display = (GNCLedgerDisplay *)user_data;
+
+ if (ledger_display)
+ gnc_ledger_display_refresh(ledger_display);
+
+ return FALSE;
+}
+
+static void
+on_notebook_switch_page(GtkNotebook *notebook, GtkWidget *page,
+ guint page_num, gpointer user_data)
+{
+ GtkWidget *current_page = gtk_notebook_get_nth_page(notebook, page_num);
+ if (current_page && page_num == 2)
+ {
+ GncSxEditorDialog *sxed = (GncSxEditorDialog *)user_data;
+
+ // Wait until Gtk is idle to refresh the display.
+ g_idle_add (focus_idle_callback, sxed->ledger);
+ }
+}
/*************************************
* Create the Schedule Editor Dialog *
@@ -1239,6 +1263,9 @@ gnc_ui_scheduled_xaction_editor_dialog_create (GtkWindow *parent,
g_signal_connect (sxed->dialog, "destroy",
G_CALLBACK (scheduledxaction_editor_dialog_destroy),
sxed);
+ g_signal_connect (sxed->notebook, "switch-page",
+ G_CALLBACK(on_notebook_switch_page),
+ sxed);
for (i = 0; widgets[i].name; i++)
{
diff --git a/gnucash/gnome/gnc-plugin-page-register.cpp b/gnucash/gnome/gnc-plugin-page-register.cpp
index b5f5fcf494..856f567bee 100644
--- a/gnucash/gnome/gnc-plugin-page-register.cpp
+++ b/gnucash/gnome/gnc-plugin-page-register.cpp
@@ -3654,6 +3654,17 @@ gnc_plugin_page_register_cmd_cut (GSimpleAction *simple,
ENTER ("(action %p, page %p)", simple, page);
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
+
+ GtkWidget *widget = gtk_window_get_focus(GTK_WINDOW (priv->gsr->window));
+ const char *name = gtk_widget_get_name(widget);
+ if (strcmp(name, "GnucashSheet") != 0)
+ {
+ gtk_editable_cut_clipboard( GTK_EDITABLE(widget));
+ LEAVE("Not cut from GnucashSheet");
+
+ return;
+ }
+
gnucash_register_cut_clipboard (priv->gsr->reg);
LEAVE ("");
}
@@ -3671,6 +3682,17 @@ gnc_plugin_page_register_cmd_copy (GSimpleAction *simple,
ENTER ("(action %p, page %p)", simple, page);
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
+
+ GtkWidget *widget = gtk_window_get_focus(GTK_WINDOW (priv->gsr->window));
+ const char *name = gtk_widget_get_name(widget);
+ if (strcmp(name, "GnucashSheet") != 0)
+ {
+ gtk_editable_copy_clipboard( GTK_EDITABLE(widget));
+ LEAVE("Not copied from GnucashSheet");
+
+ return;
+ }
+
gnucash_register_copy_clipboard (priv->gsr->reg);
LEAVE ("");
}
@@ -3688,6 +3710,17 @@ gnc_plugin_page_register_cmd_paste (GSimpleAction *simple,
ENTER ("(action %p, page %p)", simple, page);
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
+
+ GtkWidget *widget = gtk_window_get_focus(GTK_WINDOW (priv->gsr->window));
+ const char *name = gtk_widget_get_name(widget);
+ if (strcmp(name, "GnucashSheet") != 0)
+ {
+ gtk_editable_paste_clipboard( GTK_EDITABLE(widget));
+ LEAVE("Not pasted to GnucashSheet");
+
+ return;
+ }
+
gnucash_register_paste_clipboard (priv->gsr->reg);
LEAVE ("");
}
diff --git a/gnucash/register/register-gnome/gnucash-item-edit.c b/gnucash/register/register-gnome/gnucash-item-edit.c
index ee96f3d716..33faab3967 100644
--- a/gnucash/register/register-gnome/gnucash-item-edit.c
+++ b/gnucash/register/register-gnome/gnucash-item-edit.c
@@ -852,6 +852,10 @@ button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer *pointer)
}
return TRUE;
}
+
+ if (!gtk_widget_has_focus (GTK_WIDGET(sheet)))
+ gtk_widget_grab_focus (GTK_WIDGET(sheet));
+
return FALSE;
}
Summary of changes:
gnucash/gnome/dialog-sx-editor.c | 27 ++++++++++++++++++
gnucash/gnome/gnc-plugin-page-register.cpp | 33 ++++++++++++++++++++++
.../register/register-gnome/gnucash-item-edit.c | 4 +++
3 files changed, 64 insertions(+)
More information about the gnucash-changes
mailing list