Add the 'page_changed' signal to GncEmbeddedWindow

This fixes an error message 'page_changed is invalid for instance of
type GncEmbeddedWindow' when you double click on the selected schedule
in the sx editor.
This commit is contained in:
Robert Fewell 2020-02-16 14:38:38 +00:00
parent ce0d52e1ef
commit ba1af5504d
2 changed files with 36 additions and 1 deletions

View File

@ -40,6 +40,13 @@
#include "gnc-window.h" #include "gnc-window.h"
#include "dialog-utils.h" #include "dialog-utils.h"
/** Names of signals generated by the embedded window. */
enum
{
PAGE_CHANGED,
LAST_SIGNAL
};
/* Static Globals *******************************************************/ /* Static Globals *******************************************************/
/** The debugging module that this .o belongs to. */ /** The debugging module that this .o belongs to. */
@ -93,6 +100,10 @@ GNC_DEFINE_TYPE_WITH_CODE(GncEmbeddedWindow, gnc_embedded_window, GTK_TYPE_BOX,
#define GNC_EMBEDDED_WINDOW_GET_PRIVATE(o) \ #define GNC_EMBEDDED_WINDOW_GET_PRIVATE(o) \
((GncEmbeddedWindowPrivate*)g_type_instance_get_private((GTypeInstance*)o, GNC_TYPE_EMBEDDED_WINDOW)) ((GncEmbeddedWindowPrivate*)g_type_instance_get_private((GTypeInstance*)o, GNC_TYPE_EMBEDDED_WINDOW))
/** A holding place for all the signals generated by the embedded window
* code. */
static guint embedded_window_signals[LAST_SIGNAL] = { 0 };
/* Display a data plugin page in a window. */ /* Display a data plugin page in a window. */
void void
gnc_embedded_window_open_page (GncEmbeddedWindow *window, gnc_embedded_window_open_page (GncEmbeddedWindow *window,
@ -179,7 +190,27 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
object_class->finalize = gnc_embedded_window_finalize; object_class->finalize = gnc_embedded_window_finalize;
object_class->dispose = gnc_embedded_window_dispose; object_class->dispose = gnc_embedded_window_dispose;
/**
* GncEmbeddedWindow::page_changed:
* @param window: the #GncEmbeddedWindow
* @param page: the #GncPluginPage
*
* The "page_changed" signal is emitted when a new page is
* selected in the notebook of a GncEmbeddedWindow. This can be
* used to to adjust menu actions based upon which page is
* currently displayed in a window.
*/
embedded_window_signals[PAGE_CHANGED] =
g_signal_new ("page_changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GncEmbeddedWindowClass, page_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
G_TYPE_OBJECT);
LEAVE(" "); LEAVE(" ");
} }

View File

@ -68,6 +68,10 @@ typedef struct
{ {
/** The parent class for an embedded window. */ /** The parent class for an embedded window. */
GtkBoxClass vbox; GtkBoxClass vbox;
/* callbacks */
void (*page_changed) (GncEmbeddedWindow *window,
GncPluginPage *page);
} GncEmbeddedWindowClass; } GncEmbeddedWindowClass;