gnucash master: Multiple changes pushed
Robert Fewell
bobit at code.gnucash.org
Mon Jun 8 12:24:17 EDT 2020
Updated via https://github.com/Gnucash/gnucash/commit/cb69b806 (commit)
via https://github.com/Gnucash/gnucash/commit/4fba4735 (commit)
from https://github.com/Gnucash/gnucash/commit/d281a3f2 (commit)
commit cb69b806e7afc3e35adc3679f9ef580492484384
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Jun 8 17:16:23 2020 +0100
Update Schedule Transaction Template dialog status bar
Copy the functions from gnc_main_window that updates the status bar
with the action tooltips to gnc_window so that both GncMainWindow and
GncEmbeddedWindow can use without duplicating code.
diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index 352eb368f..1e57cbb2e 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -338,6 +338,10 @@ gnc_embedded_window_setup_window (GncEmbeddedWindow *window)
g_signal_connect (G_OBJECT (window->ui_merge), "add_widget",
G_CALLBACK (gnc_embedded_window_add_widget), window);
+ /* Use the "connect-proxy" signal for tooltip display in the status bar */
+ g_signal_connect (G_OBJECT (window->ui_merge), "connect-proxy",
+ G_CALLBACK (gnc_window_connect_proxy), priv->statusbar);
+
priv->action_group = NULL;
LEAVE(" ");
}
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 4829f0154..36c5a85ba 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -3490,95 +3490,6 @@ gnc_main_window_init_menu_updaters (GncMainWindow *window)
G_CALLBACK (gnc_main_window_edit_menu_hide_cb), window);
}
-/* CS: This callback functions will set the statusbar text to the
- * "tooltip" property of the currently selected GtkAction.
- *
- * This code is directly copied from gtk+/test/testmerge.c.
- * Thanks to (L)GPL! */
-typedef struct _ActionStatus ActionStatus;
-struct _ActionStatus
-{
- GtkAction *action;
- GtkWidget *statusbar;
-};
-
-static void
-action_status_destroy (gpointer data)
-{
- ActionStatus *action_status = data;
-
- g_object_unref (action_status->action);
- g_object_unref (action_status->statusbar);
-
- g_free (action_status);
-}
-
-static void
-set_tip (GtkWidget *widget)
-{
- ActionStatus *data;
- gchar *tooltip;
-
- data = g_object_get_data (G_OBJECT (widget), "action-status");
-
- if (data)
- {
- g_object_get (data->action, "tooltip", &tooltip, NULL);
-
- gtk_statusbar_push (GTK_STATUSBAR (data->statusbar), 0,
- tooltip ? tooltip : " ");
-
- g_free (tooltip);
- }
-}
-
-static void
-unset_tip (GtkWidget *widget)
-{
- ActionStatus *data;
-
- data = g_object_get_data (G_OBJECT (widget), "action-status");
-
- if (data)
- gtk_statusbar_pop (GTK_STATUSBAR (data->statusbar), 0);
-}
-
-static void
-connect_proxy (GtkUIManager *merge,
- GtkAction *action,
- GtkWidget *proxy,
- GtkWidget *statusbar)
-{
- if (GTK_IS_MENU_ITEM (proxy))
- {
- ActionStatus *data;
-
- data = g_object_get_data (G_OBJECT (proxy), "action-status");
- if (data)
- {
- g_object_unref (data->action);
- g_object_unref (data->statusbar);
-
- data->action = g_object_ref (action);
- data->statusbar = g_object_ref (statusbar);
- }
- else
- {
- data = g_new0 (ActionStatus, 1);
-
- data->action = g_object_ref (action);
- data->statusbar = g_object_ref (statusbar);
-
- g_object_set_data_full (G_OBJECT (proxy), "action-status",
- data, action_status_destroy);
-
- g_signal_connect (proxy, "select", G_CALLBACK (set_tip), NULL);
- g_signal_connect (proxy, "deselect", G_CALLBACK (unset_tip), NULL);
- }
- }
-}
-/* CS: end copied code from gtk+/test/testmerge.c */
-
static void
gnc_main_window_window_menu (GncMainWindow *window)
{
@@ -3700,10 +3611,10 @@ gnc_main_window_setup_window (GncMainWindow *window)
g_signal_connect (G_OBJECT (window->ui_merge), "add_widget",
G_CALLBACK (gnc_main_window_add_widget), window);
- /* Use the "connect-proxy" signal for tooltip display in the
- status bar */
+
+ /* Use the "connect-proxy" signal for tooltip display in the status bar */
g_signal_connect (G_OBJECT (window->ui_merge), "connect-proxy",
- G_CALLBACK (connect_proxy), priv->statusbar);
+ G_CALLBACK (gnc_window_connect_proxy), priv->statusbar);
filename = gnc_filepath_locate_ui_file("gnc-main-window-ui.xml");
diff --git a/gnucash/gnome-utils/gnc-window.c b/gnucash/gnome-utils/gnc-window.c
index c0de5658b..d84d41a98 100644
--- a/gnucash/gnome-utils/gnc-window.c
+++ b/gnucash/gnome-utils/gnc-window.c
@@ -210,3 +210,93 @@ gnc_window_show_progress (const char *message, double percentage)
while (gtk_events_pending ())
gtk_main_iteration ();
}
+
+
+/* CS: This callback functions will set the statusbar text to the
+ * "tooltip" property of the currently selected GtkAction.
+ *
+ * This code is directly copied from gtk+/test/testmerge.c.
+ * Thanks to (L)GPL! */
+typedef struct _ActionStatus ActionStatus;
+struct _ActionStatus
+{
+ GtkAction *action;
+ GtkWidget *statusbar;
+};
+
+static void
+action_status_destroy (gpointer data)
+{
+ ActionStatus *action_status = data;
+
+ g_object_unref (action_status->action);
+ g_object_unref (action_status->statusbar);
+
+ g_free (action_status);
+}
+
+static void
+set_tip (GtkWidget *widget)
+{
+ ActionStatus *data;
+ gchar *tooltip;
+
+ data = g_object_get_data (G_OBJECT (widget), "action-status");
+
+ if (data)
+ {
+ g_object_get (data->action, "tooltip", &tooltip, NULL);
+
+ gtk_statusbar_push (GTK_STATUSBAR (data->statusbar), 0,
+ tooltip ? tooltip : " ");
+
+ g_free (tooltip);
+ }
+}
+
+static void
+unset_tip (GtkWidget *widget)
+{
+ ActionStatus *data;
+
+ data = g_object_get_data (G_OBJECT (widget), "action-status");
+
+ if (data)
+ gtk_statusbar_pop (GTK_STATUSBAR (data->statusbar), 0);
+}
+
+void
+gnc_window_connect_proxy (GtkUIManager *merge,
+ GtkAction *action,
+ GtkWidget *proxy,
+ GtkWidget *statusbar)
+{
+ if (GTK_IS_MENU_ITEM (proxy))
+ {
+ ActionStatus *data;
+
+ data = g_object_get_data (G_OBJECT (proxy), "action-status");
+ if (data)
+ {
+ g_object_unref (data->action);
+ g_object_unref (data->statusbar);
+
+ data->action = g_object_ref (action);
+ data->statusbar = g_object_ref (statusbar);
+ }
+ else
+ {
+ data = g_new0 (ActionStatus, 1);
+
+ data->action = g_object_ref (action);
+ data->statusbar = g_object_ref (statusbar);
+
+ g_object_set_data_full (G_OBJECT (proxy), "action-status",
+ data, action_status_destroy);
+
+ g_signal_connect (proxy, "select", G_CALLBACK (set_tip), NULL);
+ g_signal_connect (proxy, "deselect", G_CALLBACK (unset_tip), NULL);
+ }
+ }
+}
+/* CS: end copied code from gtk+/test/testmerge.c */
diff --git a/gnucash/gnome-utils/gnc-window.h b/gnucash/gnome-utils/gnc-window.h
index fa9b23a22..c8144dc16 100644
--- a/gnucash/gnome-utils/gnc-window.h
+++ b/gnucash/gnome-utils/gnc-window.h
@@ -79,6 +79,22 @@ GncWindow *gnc_window_get_progressbar_window (void);
GtkWidget *gnc_window_get_progressbar (GncWindow *window);
void gnc_window_show_progress (const char *message, double percentage);
+/** This callback functions will set the statusbar text to the
+ * "tooltip" property of the currently selected GtkAction
+ *
+ * @param merge A pointer to the ui manager
+ *
+ * @param action A pointer to the action
+ *
+ * @param proxy A pointer to the proxy
+ *
+ * @param statusbar A pointer to the statusbar widget
+ */
+void gnc_window_connect_proxy (GtkUIManager *merge,
+ GtkAction *action,
+ GtkWidget *proxy,
+ GtkWidget *statusbar);
+
G_END_DECLS
#endif /* __GNC_WINDOW_H */
commit 4fba473570e84974083c9bade9f9b9278336e421
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Jun 8 16:57:02 2020 +0100
Add the Register width menu options to the Scheduled
Transaction Template dialog.
diff --git a/gnucash/gnome/dialog-sx-editor.c b/gnucash/gnome/dialog-sx-editor.c
index 4eda90060..c69f02c5f 100644
--- a/gnucash/gnome/dialog-sx-editor.c
+++ b/gnucash/gnome/dialog-sx-editor.c
@@ -168,6 +168,7 @@ static GtkActionEntry gnc_sxed_menu_entries [] =
{ "TransactionAction", NULL, N_("_Transaction"), NULL, NULL, NULL },
{ "ViewAction", NULL, N_("_View"), NULL, NULL, NULL },
{ "ActionsAction", NULL, N_("_Actions"), NULL, NULL, NULL },
+ { "WindowsAction", NULL, N_("_Windows"), NULL, NULL, NULL },
};
static guint gnc_sxed_menu_n_entries = G_N_ELEMENTS (gnc_sxed_menu_entries);
diff --git a/gnucash/ui/gnc-sxed-window-ui-full.xml b/gnucash/ui/gnc-sxed-window-ui-full.xml
index df8a774d9..8ec9760f7 100644
--- a/gnucash/ui/gnc-sxed-window-ui-full.xml
+++ b/gnucash/ui/gnc-sxed-window-ui-full.xml
@@ -33,6 +33,13 @@
</placeholder>
</menu>
+ <menu name="Windows" action="WindowsAction">
+ <placeholder name="WindowsLayoutPlaceholder">
+ <menuitem name="WindowsSaveLayout" action="WindowsSaveLayoutAction"/>
+ <menuitem name="WindowsResetLayout" action="WindowsResetLayoutAction"/>
+ </placeholder>
+ </menu>
+
</menubar>
<toolbar name="DefaultToolbar">
Summary of changes:
gnucash/gnome-utils/gnc-embedded-window.c | 4 ++
gnucash/gnome-utils/gnc-main-window.c | 95 +------------------------------
gnucash/gnome-utils/gnc-window.c | 90 +++++++++++++++++++++++++++++
gnucash/gnome-utils/gnc-window.h | 16 ++++++
gnucash/gnome/dialog-sx-editor.c | 1 +
gnucash/ui/gnc-sxed-window-ui-full.xml | 7 +++
6 files changed, 121 insertions(+), 92 deletions(-)
More information about the gnucash-changes
mailing list