gnucash stable: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Fri Jun 16 17:05:11 EDT 2023
Updated via https://github.com/Gnucash/gnucash/commit/0c6ae19c (commit)
via https://github.com/Gnucash/gnucash/commit/827bfabd (commit)
via https://github.com/Gnucash/gnucash/commit/915e95e5 (commit)
via https://github.com/Gnucash/gnucash/commit/eee5f674 (commit)
via https://github.com/Gnucash/gnucash/commit/48cf3a9a (commit)
via https://github.com/Gnucash/gnucash/commit/68b689c9 (commit)
via https://github.com/Gnucash/gnucash/commit/e6a564de (commit)
via https://github.com/Gnucash/gnucash/commit/1255d619 (commit)
via https://github.com/Gnucash/gnucash/commit/2e59bda9 (commit)
via https://github.com/Gnucash/gnucash/commit/c5d4f2bf (commit)
via https://github.com/Gnucash/gnucash/commit/81ce7bb1 (commit)
via https://github.com/Gnucash/gnucash/commit/d73117d1 (commit)
via https://github.com/Gnucash/gnucash/commit/08168bec (commit)
via https://github.com/Gnucash/gnucash/commit/f47c9295 (commit)
via https://github.com/Gnucash/gnucash/commit/d6764414 (commit)
via https://github.com/Gnucash/gnucash/commit/631d0e77 (commit)
via https://github.com/Gnucash/gnucash/commit/a0952e1e (commit)
via https://github.com/Gnucash/gnucash/commit/218ca30b (commit)
via https://github.com/Gnucash/gnucash/commit/17f41a79 (commit)
via https://github.com/Gnucash/gnucash/commit/b0c7e19a (commit)
via https://github.com/Gnucash/gnucash/commit/59e581ce (commit)
via https://github.com/Gnucash/gnucash/commit/579ffa29 (commit)
via https://github.com/Gnucash/gnucash/commit/939770e1 (commit)
via https://github.com/Gnucash/gnucash/commit/b715211b (commit)
via https://github.com/Gnucash/gnucash/commit/b853a49b (commit)
via https://github.com/Gnucash/gnucash/commit/422b01a5 (commit)
via https://github.com/Gnucash/gnucash/commit/5ea2e4e7 (commit)
via https://github.com/Gnucash/gnucash/commit/20673d97 (commit)
via https://github.com/Gnucash/gnucash/commit/aeab1953 (commit)
via https://github.com/Gnucash/gnucash/commit/1ca98da8 (commit)
via https://github.com/Gnucash/gnucash/commit/cb1313b0 (commit)
via https://github.com/Gnucash/gnucash/commit/16118c4f (commit)
via https://github.com/Gnucash/gnucash/commit/3e6ca813 (commit)
via https://github.com/Gnucash/gnucash/commit/b0fa5109 (commit)
via https://github.com/Gnucash/gnucash/commit/c87f9db9 (commit)
via https://github.com/Gnucash/gnucash/commit/1084071b (commit)
via https://github.com/Gnucash/gnucash/commit/ae352e9e (commit)
via https://github.com/Gnucash/gnucash/commit/91863dfb (commit)
via https://github.com/Gnucash/gnucash/commit/1c40aa8a (commit)
via https://github.com/Gnucash/gnucash/commit/45c3f283 (commit)
via https://github.com/Gnucash/gnucash/commit/241afec3 (commit)
via https://github.com/Gnucash/gnucash/commit/97a5bf0a (commit)
via https://github.com/Gnucash/gnucash/commit/80fdffb0 (commit)
via https://github.com/Gnucash/gnucash/commit/a8943dc3 (commit)
via https://github.com/Gnucash/gnucash/commit/4eb20b24 (commit)
via https://github.com/Gnucash/gnucash/commit/5d3eaa51 (commit)
via https://github.com/Gnucash/gnucash/commit/8cb697b8 (commit)
via https://github.com/Gnucash/gnucash/commit/b1d1f6b8 (commit)
via https://github.com/Gnucash/gnucash/commit/bd608327 (commit)
via https://github.com/Gnucash/gnucash/commit/f1a77ca7 (commit)
via https://github.com/Gnucash/gnucash/commit/0b215793 (commit)
via https://github.com/Gnucash/gnucash/commit/f935d786 (commit)
via https://github.com/Gnucash/gnucash/commit/74517c44 (commit)
via https://github.com/Gnucash/gnucash/commit/a6dcdb6a (commit)
via https://github.com/Gnucash/gnucash/commit/53ab52fa (commit)
from https://github.com/Gnucash/gnucash/commit/2e58dd83 (commit)
commit 0c6ae19c164b829e30cb00f860be4418509c7d12
Merge: 827bfabd69 68b689c95c
Author: John Ralls <jralls at ceridwen.us>
Date: Fri Jun 16 12:55:10 2023 -0700
Merge Richard Cohen's 'remove-gnc-define-type' into stable.
commit 827bfabd69a52f8ea292794c00facd34e4870f3a
Merge: 915e95e553 e6a564de82
Author: John Ralls <jralls at ceridwen.us>
Date: Fri Jun 16 12:42:42 2023 -0700
Merge Richard Cohen's 'declare-type-gnc-plugin' into stable.
commit 915e95e55320560e4b5ee5688c1a4b20691067ce
Merge: eee5f674c4 5ea2e4e78e
Author: John Ralls <jralls at ceridwen.us>
Date: Fri Jun 16 12:41:26 2023 -0700
Merge Richard Cohwn's 'declare-type-gnc-tree-view' into stable.
commit eee5f674c4b33738f0e6f5b32d38220d863d4769
Merge: 48cf3a9a32 c87f9db9ef
Author: John Ralls <jralls at ceridwen.us>
Date: Fri Jun 16 12:40:29 2023 -0700
Merge Richard Cohen's 'declare-type-gnc-tree-model' into stable.
commit 48cf3a9a32a8d74f4be5db80fb7fb3f6e4412d24
Merge: 2e58dd83b7 a8943dc315
Author: John Ralls <jralls at ceridwen.us>
Date: Fri Jun 16 12:39:20 2023 -0700
Merge Richard Cohen's 'declare-type-gncsearch' into stable.
commit 68b689c95c8aaba5a05366450d9c224fb949a897
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Tue Jun 6 20:43:38 2023 +0100
Refactor: remove GNC_DEFINE_TYPE, GNC_IMPLEMENT_INTERFACE
Use GObject constructed() instead
diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index a6588f3a44..eb2f657966 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -55,6 +55,7 @@ static QofLogModule log_module = GNC_MOD_GUI;
/* Declarations *********************************************************/
+static void gnc_embedded_window_constructed (GObject *object);
static void gnc_embedded_window_finalize (GObject *object);
static void gnc_embedded_window_dispose (GObject *object);
@@ -98,10 +99,10 @@ typedef struct GncEmbeddedWindowPrivate
GtkWidget *parent_window;
} GncEmbeddedWindowPrivate;
-GNC_DEFINE_TYPE_WITH_CODE(GncEmbeddedWindow, gnc_embedded_window, GTK_TYPE_BOX,
+G_DEFINE_TYPE_WITH_CODE(GncEmbeddedWindow, gnc_embedded_window, GTK_TYPE_BOX,
G_ADD_PRIVATE(GncEmbeddedWindow)
- GNC_IMPLEMENT_INTERFACE(GNC_TYPE_WINDOW,
- gnc_window_embedded_window_init))
+ G_IMPLEMENT_INTERFACE(GNC_TYPE_WINDOW,
+ gnc_window_embedded_window_init))
#define GNC_EMBEDDED_WINDOW_GET_PRIVATE(o) \
((GncEmbeddedWindowPrivate*)gnc_embedded_window_get_instance_private((GncEmbeddedWindow*)o))
@@ -187,6 +188,7 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
ENTER("klass %p", klass);
object_class = G_OBJECT_CLASS (klass);
+ object_class->constructed = gnc_embedded_window_constructed;
object_class->finalize = gnc_embedded_window_finalize;
object_class->dispose = gnc_embedded_window_dispose;
@@ -215,17 +217,14 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
/** Initialize a new instance of a gnucash embedded window. This
- * function initializes the object private storage space. It also
- * adds the new object to a list (for memory tracking purposes).
+ * function initializes the object private storage space.
*
* @param view The new object instance created by the object system.
*
- * @param klass A pointer to the class data structure for this
- * object. */
+ * */
static void
-gnc_embedded_window_init (GncEmbeddedWindow *window, void *data)
+gnc_embedded_window_init (GncEmbeddedWindow *window)
{
- GncEmbeddedWindowClass *klass = (GncEmbeddedWindowClass*)data;
ENTER("window %p", window);
gtk_orientable_set_orientation (GTK_ORIENTABLE(window), GTK_ORIENTATION_VERTICAL);
@@ -235,11 +234,22 @@ gnc_embedded_window_init (GncEmbeddedWindow *window, void *data)
gnc_embedded_window_setup_window (window);
- gnc_gobject_tracking_remember (G_OBJECT(window),
- G_OBJECT_CLASS(klass));
LEAVE(" ");
}
+/** The object has been fully constructed.
+ * This function adds the object to the tracking system.
+ *
+ * @param obj The new object instance created by the object
+ * system.
+ */
+ static void
+gnc_embedded_window_constructed (GObject *obj)
+{
+ gnc_gobject_tracking_remember(obj);
+
+ G_OBJECT_CLASS (gnc_embedded_window_parent_class)->constructed (obj);
+}
/** Finish destruction of an embedded window.
*
diff --git a/gnucash/gnome-utils/gnc-gobject-utils.c b/gnucash/gnome-utils/gnc-gobject-utils.c
index 8399e62972..fe43f036a6 100644
--- a/gnucash/gnome-utils/gnc-gobject-utils.c
+++ b/gnucash/gnome-utils/gnc-gobject-utils.c
@@ -120,25 +120,16 @@ gnc_gobject_tracking_dump (void)
/** Tell gnucash to remember this object in the database.
*/
void
-gnc_gobject_tracking_remember (GObject *object, GObjectClass *klass)
+gnc_gobject_tracking_remember (GObject *object)
{
- GHashTable *table;
- GList *list;
- const gchar *name;
-
g_return_if_fail(G_IS_OBJECT(object));
- /* Little dance here to handle startup conditions. During object
- * initialization the object type changes as each parent class
- * is initialized. The class passed to the initialization function
- * is always the ultimate class of the object. */
- if (klass == NULL)
- klass = G_OBJECT_GET_CLASS(object);
- name = g_type_name(G_TYPE_FROM_CLASS(klass));
+ GObjectClass *klass = G_OBJECT_GET_CLASS(object);
+ const gchar *name = g_type_name(G_TYPE_FROM_CLASS(klass));
//printf("Enter %s: object %p of type %s\n", G_STRFUNC, object, name);
- table = gnc_gobject_tracking_table();
- list = g_hash_table_lookup(table, name);
+ GHashTable *table = gnc_gobject_tracking_table();
+ GList *list = g_hash_table_lookup(table, name);
if (g_list_index(list, object) != -1)
{
diff --git a/gnucash/gnome-utils/gnc-gobject-utils.h b/gnucash/gnome-utils/gnc-gobject-utils.h
index 3d066e45cd..93db5a6e30 100644
--- a/gnucash/gnome-utils/gnc-gobject-utils.h
+++ b/gnucash/gnome-utils/gnc-gobject-utils.h
@@ -71,19 +71,9 @@ extern "C" {
/** Tell gnucash to remember this object in the database.
*
- * @param object The object to be tracked. This can be a fully or
- * partially instantiated object.
- *
- * @param klass The class structure for the object. This argument
- * may be NULL if a fully instantiated object is passed in as the
- * first argument. If a partially instantiated object is provided
- * (I.E. a parent class called this function) then this argument is
- * required. This is necessary because the class of the object
- * changes as each of the parent class is instantiated. The class
- * structure, however, status constant and always reflects the fully
- * instantiated object.
+ * @param object The fully constructed object to be tracked.
*/
-void gnc_gobject_tracking_remember (GObject *object, GObjectClass *klass);
+void gnc_gobject_tracking_remember (GObject *object);
/** Tell gnucash to drop this object from the database.
*
@@ -113,62 +103,6 @@ void gnc_gobject_tracking_dump (void);
/** @} */
-/** Some macros derived from glib type macros.
- * In glib type_name##init function only has one parameter. We need
- * the 2nd class parameter in certain calls. The main difference is
- * static void type_name##_init (TypeName *self, void *class);
- * instead of
- * static void type_name##_init (TypeName *self);
- * this code may need updating in future releases as glib changes.
- **/
-#define GNC_IMPLEMENT_INTERFACE(TYPE_IFACE, iface_init) { \
- const GInterfaceInfo g_implement_interface_info = { \
- (GInterfaceInitFunc)(void (*)(void *, void *)) iface_init, NULL, NULL \
- }; \
- g_type_add_interface_static (g_define_type_id, TYPE_IFACE, &g_implement_interface_info); \
-}
-
-#define GNC_DEFINE_TYPE_WITH_CODE(TN, t_n, T_P, _C_) _GNC_DEFINE_TYPE_EXTENDED_BEGIN (TN, t_n, T_P, 0) {_C_;} _GNC_DEFINE_TYPE_EXTENDED_END()
-
-#define _GNC_DEFINE_TYPE_EXTENDED_BEGIN(TypeName, type_name, TYPE_PARENT, flags) \
-\
-static void type_name##_init (TypeName *self, void *klass); \
-static void type_name##_class_init (TypeName##Class *klass); \
-static gpointer type_name##_parent_class = NULL; \
-static gint TypeName##_private_offset; \
-\
-_G_DEFINE_TYPE_EXTENDED_CLASS_INIT(TypeName, type_name) \
-\
-G_GNUC_UNUSED \
-static inline gpointer \
-type_name##_get_instance_private (TypeName *self) \
-{ \
- return (G_STRUCT_MEMBER_P (self, TypeName##_private_offset)); \
-} \
-\
-GType \
-type_name##_get_type (void) \
-{ \
- static gsize g_define_type_id_static = 0; \
- if (g_once_init_enter (&g_define_type_id_static)) \
- { \
- GType g_define_type_id = \
- g_type_register_static_simple (TYPE_PARENT, \
- g_intern_static_string (#TypeName), \
- sizeof (TypeName##Class), \
- (GClassInitFunc) type_name##_class_intern_init, \
- sizeof (TypeName), \
- (GInstanceInitFunc) type_name##_init, \
- (GTypeFlags) flags); \
- { /* custom code follows */
-#define _GNC_DEFINE_TYPE_EXTENDED_END() \
- /* following custom code */ \
- } \
- g_once_init_leave (&g_define_type_id_static, g_define_type_id); \
- } \
- return g_define_type_id_static; \
-} /* closes type_name##_get_type() */
-
#ifdef __cplusplus
}
#endif
diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp
index 51540ea424..249c8d414c 100644
--- a/gnucash/gnome-utils/gnc-main-window.cpp
+++ b/gnucash/gnome-utils/gnc-main-window.cpp
@@ -150,6 +150,7 @@ static guint secs_to_save = 0;
#define MSG_AUTO_SAVE _("Changes will be saved automatically in %u seconds")
/* Declarations *********************************************************/
+static void gnc_main_window_constructed (GObject *object);
static void gnc_main_window_finalize (GObject *object);
static void gnc_main_window_destroy (GtkWidget *widget);
@@ -259,7 +260,7 @@ typedef struct GncMainWindowPrivate
} GncMainWindowPrivate;
-GNC_DEFINE_TYPE_WITH_CODE(GncMainWindow, gnc_main_window, GTK_TYPE_APPLICATION_WINDOW,
+G_DEFINE_TYPE_WITH_CODE(GncMainWindow, gnc_main_window, GTK_TYPE_APPLICATION_WINDOW,
G_ADD_PRIVATE (GncMainWindow)
G_IMPLEMENT_INTERFACE (GNC_TYPE_WINDOW,
gnc_window_main_window_init))
@@ -2622,6 +2623,7 @@ gnc_main_window_class_init (GncMainWindowClass *klass)
window_type = g_quark_from_static_string ("gnc-main-window");
+ object_class->constructed = gnc_main_window_constructed;
object_class->finalize = gnc_main_window_finalize;
/* GtkWidget signals */
@@ -2704,21 +2706,14 @@ gnc_main_window_class_init (GncMainWindowClass *klass)
/** Initialize a new instance of a gnucash main window. This function
- * initializes the object private storage space. It also adds the
- * new object to a list (for memory tracking purposes).
+ * initializes the object private storage space.
*
* @param window The new object instance created by the object system.
- *
- * @param klass A pointer to the class data structure for this
- * object. */
+ * */
static void
-gnc_main_window_init (GncMainWindow *window, void *data)
+gnc_main_window_init (GncMainWindow *window)
{
- GncMainWindowPrivate *priv;
-
- GncMainWindowClass *klass = (GncMainWindowClass*)data;
-
- priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
+ GncMainWindowPrivate *priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
// Set the name for this dialog so it can be easily manipulated with css
gtk_widget_set_name (GTK_WIDGET(window), "gnc-id-main-window");
@@ -2745,10 +2740,21 @@ gnc_main_window_init (GncMainWindow *window, void *data)
window);
gnc_main_window_setup_window (window);
- gnc_gobject_tracking_remember(G_OBJECT(window),
- G_OBJECT_CLASS(klass));
}
+/** The object has been fully constructed.
+ * This function adds the object to the tracking system.
+ *
+ * @param obj The new object instance created by the object
+ * system.
+ */
+static void
+gnc_main_window_constructed (GObject *obj)
+{
+ gnc_gobject_tracking_remember(obj);
+
+ G_OBJECT_CLASS (gnc_main_window_parent_class)->constructed (obj);
+}
/** Finalize the GncMainWindow object. This function is called from
* the G_Object level to complete the destruction of the object. It
diff --git a/gnucash/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c
index 623b440205..61a22f5df0 100644
--- a/gnucash/gnome-utils/gnc-plugin-page.c
+++ b/gnucash/gnome-utils/gnc-plugin-page.c
@@ -43,6 +43,7 @@
/** The debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI;
+static void gnc_plugin_page_constructed (GObject *object);
static void gnc_plugin_page_finalize (GObject *object);
static void gnc_plugin_page_set_property (GObject *object,
guint prop_id,
@@ -106,7 +107,7 @@ typedef struct _GncPluginPagePrivate
} GncPluginPagePrivate;
-GNC_DEFINE_TYPE_WITH_CODE(GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE(GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT,
G_ADD_PRIVATE(GncPluginPage))
#define GNC_PLUGIN_PAGE_GET_PRIVATE(o) \
@@ -351,6 +352,7 @@ gnc_plugin_page_class_init (GncPluginPageClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+ gobject_class->constructed = gnc_plugin_page_constructed;
gobject_class->finalize = gnc_plugin_page_finalize;
gobject_class->set_property = gnc_plugin_page_set_property;
gobject_class->get_property = gnc_plugin_page_get_property;
@@ -451,21 +453,14 @@ gnc_plugin_page_class_init (GncPluginPageClass *klass)
/** Initialize a new instance of a gnucash content plugin. This
- * function initializes the object private storage space, and adds
- * the object to the tracking system.
+ * function initializes the object private storage space.
*
* @param page The new object instance created by the object system.
- *
- * @param klass A pointer to the class data structure for this
- * object. */
+ * */
static void
-gnc_plugin_page_init (GncPluginPage *page, void *data)
+gnc_plugin_page_init (GncPluginPage *page)
{
- GncPluginPagePrivate *priv;
-
- GncPluginPageClass *klass = (GncPluginPageClass*)data;
-
- priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
+ GncPluginPagePrivate *priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
priv->page_name = NULL;
priv->page_color = NULL;
priv->page_changed_id = 0;
@@ -474,11 +469,21 @@ gnc_plugin_page_init (GncPluginPage *page, void *data)
page->window = NULL;
page->summarybar = NULL;
-
- gnc_gobject_tracking_remember (G_OBJECT(page),
- G_OBJECT_CLASS(klass));
}
+/** The object has been fully constructed.
+ * This function adds the object to the tracking system.
+ *
+ * @param obj The new object instance created by the object
+ * system.
+ */
+ static void
+gnc_plugin_page_constructed (GObject *obj)
+{
+ gnc_gobject_tracking_remember(obj);
+
+ G_OBJECT_CLASS (gnc_plugin_page_parent_class)->constructed (obj);
+}
/** Finalize the gnucash plugin object. This function is called from
* the G_Object level to complete the destruction of the object. It
diff --git a/gnucash/gnome-utils/gnc-plugin.c b/gnucash/gnome-utils/gnc-plugin.c
index 521f42fce4..1dd26f1454 100644
--- a/gnucash/gnome-utils/gnc-plugin.c
+++ b/gnucash/gnome-utils/gnc-plugin.c
@@ -47,6 +47,7 @@
/** The debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI;
+static void gnc_plugin_constructed (GObject *object);
static void gnc_plugin_finalize (GObject *object);
@@ -57,8 +58,8 @@ typedef struct GncPluginPrivate
gpointer dummy;
} GncPluginPrivate;
-GNC_DEFINE_TYPE_WITH_CODE(GncPlugin, gnc_plugin, G_TYPE_OBJECT,
- G_ADD_PRIVATE(GncPlugin))
+G_DEFINE_TYPE_WITH_CODE(GncPlugin, gnc_plugin, G_TYPE_OBJECT,
+ G_ADD_PRIVATE(GncPlugin))
#define GNC_PLUGIN_GET_PRIVATE(o) \
((GncPluginPrivate*)gnc_plugin_get_instance_private((GncPlugin*)o))
@@ -75,6 +76,7 @@ gnc_plugin_class_init (GncPluginClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->constructed = gnc_plugin_constructed;
gobject_class->finalize = gnc_plugin_finalize;
}
@@ -82,18 +84,26 @@ gnc_plugin_class_init (GncPluginClass *klass)
/** Initialize a new instance of a gnucash menu-only plugin. This
* function adds the object to the tracking system.
*
- * @param plugin_page The new object instance created by the object
+ * @param plugin The new object instance created by the object
* system.
+ */
+static void
+gnc_plugin_init (GncPlugin *plugin)
+{
+}
+
+/** The object has been fully constructed.
+ * This function adds the object to the tracking system.
*
- * @param klass A pointer to the class data structure for this
- * object. */
+ * @param obj The new object instance created by the object
+ * system.
+ */
static void
-gnc_plugin_init (GncPlugin *plugin_page, void *data)
+gnc_plugin_constructed (GObject *obj)
{
- GncPluginClass *klass = (GncPluginClass*)data;
+ gnc_gobject_tracking_remember(obj);
- gnc_gobject_tracking_remember(G_OBJECT(plugin_page), \
- G_OBJECT_CLASS(klass));
+ G_OBJECT_CLASS (gnc_plugin_parent_class)->constructed (obj);
}
diff --git a/gnucash/gnome-utils/gnc-tree-model.c b/gnucash/gnome-utils/gnc-tree-model.c
index a990469bc9..0a7a21273d 100644
--- a/gnucash/gnome-utils/gnc-tree-model.c
+++ b/gnucash/gnome-utils/gnc-tree-model.c
@@ -36,6 +36,7 @@
static QofLogModule log_module = GNC_MOD_GUI;
/** Declarations *********************************************************/
+static void gnc_tree_model_constructed (GObject *object);
static void gnc_tree_model_finalize (GObject *object);
/** The instance private data for a generic tree model. */
@@ -44,7 +45,7 @@ typedef struct GncTreeModelPrivate
gpointer dummy;
} GncTreeModelPrivate;
-GNC_DEFINE_TYPE_WITH_CODE(GncTreeModel, gnc_tree_model, G_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE(GncTreeModel, gnc_tree_model, G_TYPE_OBJECT,
G_ADD_PRIVATE(GncTreeModel))
#define GNC_TREE_MODEL_GET_PRIVATE(o) \
@@ -63,17 +64,29 @@ gnc_tree_model_class_init (GncTreeModelClass *klass)
o_class = G_OBJECT_CLASS (klass);
/* GObject signals */
+ o_class->constructed = gnc_tree_model_constructed;
o_class->finalize = gnc_tree_model_finalize;
}
static void
-gnc_tree_model_init (GncTreeModel *model, void *data)
+gnc_tree_model_init (GncTreeModel *model)
{
- GncTreeModelClass *klass = (GncTreeModelClass*)data;
+}
+
+/** The object has been fully constructed.
+ * This function adds the object to the tracking system.
+ *
+ * @param obj The new object instance created by the object
+ * system.
+ */
+static void
+gnc_tree_model_constructed (GObject *obj)
+{
+ ENTER("model %p", obj);
+
+ gnc_gobject_tracking_remember(obj);
- ENTER("model %p", model);
- gnc_gobject_tracking_remember(G_OBJECT(model),
- G_OBJECT_CLASS(klass));
+ G_OBJECT_CLASS (gnc_tree_model_parent_class)->constructed (obj);
LEAVE(" ");
}
diff --git a/gnucash/gnome-utils/gnc-tree-view.c b/gnucash/gnome-utils/gnc-tree-view.c
index be9d4d1139..d9e6b3d6e5 100644
--- a/gnucash/gnome-utils/gnc-tree-view.c
+++ b/gnucash/gnome-utils/gnc-tree-view.c
@@ -77,6 +77,7 @@ enum
static QofLogModule log_module = GNC_MOD_GUI;
/**** Declarations ******************************************************/
+static void gnc_tree_view_constructed (GObject *object);
static void gnc_tree_view_finalize (GObject *object);
static void gnc_tree_view_destroy (GtkWidget *widget);
static void gnc_tree_view_set_property (GObject *object,
@@ -126,7 +127,7 @@ typedef struct GncTreeViewPrivate
gulong size_allocate_cb_id;
} GncTreeViewPrivate;
-GNC_DEFINE_TYPE_WITH_CODE(GncTreeView, gnc_tree_view, GTK_TYPE_TREE_VIEW,
+G_DEFINE_TYPE_WITH_CODE(GncTreeView, gnc_tree_view, GTK_TYPE_TREE_VIEW,
G_ADD_PRIVATE(GncTreeView))
#define GNC_TREE_VIEW_GET_PRIVATE(o) \
@@ -177,6 +178,7 @@ gnc_tree_view_class_init (GncTreeViewClass *klass)
G_PARAM_READWRITE));
/* GObject signals */
+ gobject_class->constructed = gnc_tree_view_constructed;
gobject_class->finalize = gnc_tree_view_finalize;
/* GtkWidget signals */
@@ -230,17 +232,12 @@ gnc_tree_view_select_column_icon_cb (GtkWidget *widget, GdkEventButton *event, g
* @internal
*/
static void
-gnc_tree_view_init (GncTreeView *view, void *data)
+gnc_tree_view_init (GncTreeView *view)
{
GncTreeViewPrivate *priv;
GtkTreeViewColumn *column;
GtkWidget *sep, *icon;
- GncTreeViewClass *klass = (GncTreeViewClass*)data;
-
- gnc_gobject_tracking_remember (G_OBJECT(view),
- G_OBJECT_CLASS(klass));
-
priv = GNC_TREE_VIEW_GET_PRIVATE(view);
priv->column_menu = NULL;
priv->show_column_menu = FALSE;
@@ -322,6 +319,20 @@ gnc_tree_view_init (GncTreeView *view, void *data)
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
}
+/** The object has been fully constructed.
+ * This function adds the object to the tracking system.
+ *
+ * @param obj The new object instance created by the object
+ * system.
+ */
+ static void
+gnc_tree_view_constructed (GObject *obj)
+{
+ gnc_gobject_tracking_remember(obj);
+
+ G_OBJECT_CLASS (gnc_tree_view_parent_class)->constructed (obj);
+}
+
/** Finalize the GncTreeView object. This function is called from the
* G_Object level to complete the destruction of the object. It
* should release any memory not previously released by the destroy
commit e6a564de8250ab2902c5f3f1fede7accc2289df1
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Tue Jun 13 16:58:41 2023 +0100
Refactor: remove unnecessary GncPlugin*Private
diff --git a/gnucash/gnome-utils/gnc-plugin-file-history.c b/gnucash/gnome-utils/gnc-plugin-file-history.c
index d4eddd7bc8..45174ba0bb 100644
--- a/gnucash/gnome-utils/gnc-plugin-file-history.c
+++ b/gnucash/gnome-utils/gnc-plugin-file-history.c
@@ -105,17 +105,6 @@ struct _GncPluginFileHistory
GncPlugin gnc_plugin;
};
-/** The instance private data for a file history plugin. This data
- * structure is unused. */
-typedef struct GncPluginFileHistoryPrivate
-{
- gpointer dummy;
-} GncPluginFileHistoryPrivate;
-
-
-#define GNC_PLUGIN_FILE_HISTORY_GET_PRIVATE(o) \
- ((GncPluginFileHistoryPrivate*)gnc_plugin_file_history_get_instance_private((GncPluginFileHistory*)o))
-
/************************************************************
* Other Functions *
************************************************************/
@@ -552,7 +541,7 @@ gnc_plugin_history_list_changed (gpointer prefs,
* Object Implementation *
************************************************************/
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginFileHistory, gnc_plugin_file_history, GNC_TYPE_PLUGIN)
+G_DEFINE_TYPE(GncPluginFileHistory, gnc_plugin_file_history, GNC_TYPE_PLUGIN)
/** Initialize the file history plugin class. */
static void
diff --git a/gnucash/gnome-utils/gnc-plugin-menu-additions.c b/gnucash/gnome-utils/gnc-plugin-menu-additions.c
index 2c08a6119e..98ef68cb9b 100644
--- a/gnucash/gnome-utils/gnc-plugin-menu-additions.c
+++ b/gnucash/gnome-utils/gnc-plugin-menu-additions.c
@@ -63,17 +63,9 @@ static QofLogModule log_module = GNC_MOD_GUI;
struct _GncPluginMenuAdditions
{
GncPlugin gnc_plugin;
-};
-/** Private data for this plugin. This data structure is unused. */
-typedef struct GncPluginMenuAdditionsPrivate
-{
GHashTable *item_hash;
-} GncPluginMenuAdditionsPrivate;
-
-#define GNC_PLUGIN_MENU_ADDITIONS_GET_PRIVATE(o) \
- ((GncPluginMenuAdditionsPrivate*)gnc_plugin_menu_additions_get_instance_private((GncPluginMenuAdditions*)o))
-
+};
/** Per-window private data for this plugin. This plugin is unique in
* that it manages its own menu items. */
@@ -101,7 +93,7 @@ static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
* Object Implementation *
************************************************************/
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginMenuAdditions, gnc_plugin_menu_additions, GNC_TYPE_PLUGIN)
+G_DEFINE_TYPE(GncPluginMenuAdditions, gnc_plugin_menu_additions, GNC_TYPE_PLUGIN)
static void
gnc_plugin_menu_additions_class_init (GncPluginMenuAdditionsClass *klass)
@@ -132,14 +124,11 @@ gnc_plugin_menu_additions_init (GncPluginMenuAdditions *plugin)
static void
gnc_plugin_menu_additions_finalize (GObject *object)
{
- GncPluginMenuAdditionsPrivate *priv;
g_return_if_fail (GNC_IS_PLUGIN_MENU_ADDITIONS(object));
ENTER("plugin %p", object);
- priv = GNC_PLUGIN_MENU_ADDITIONS_GET_PRIVATE(object);
-
- g_hash_table_destroy (priv->item_hash);
+ g_hash_table_destroy (GNC_PLUGIN_MENU_ADDITIONS(object)->item_hash);
G_OBJECT_CLASS (gnc_plugin_menu_additions_parent_class)->finalize (object);
LEAVE("");
@@ -185,10 +174,6 @@ gnc_plugin_menu_additions_action_new_cb (GSimpleAction *simple,
GVariant *parameter,
gpointer user_data)
{
- GncMainWindowActionData *cb_data = user_data;
- GncPlugin *plugin = cb_data->data;
- GncPluginMenuAdditionsPrivate *priv;
-
SCM extension;
gsize length;
const gchar *action_name;
@@ -197,13 +182,13 @@ gnc_plugin_menu_additions_action_new_cb (GSimpleAction *simple,
ENTER("");
- priv = GNC_PLUGIN_MENU_ADDITIONS_GET_PRIVATE(plugin);
-
action_name = g_variant_get_string (parameter, &length);
PINFO("action name is '%s'", action_name);
- extension = g_hash_table_lookup (priv->item_hash, action_name);
+ GncMainWindowActionData *cb_data = user_data;
+ GncPluginMenuAdditions *plugin = GNC_PLUGIN_MENU_ADDITIONS(cb_data->data);
+ extension = g_hash_table_lookup (plugin->item_hash, action_name);
if (extension)
{
@@ -482,7 +467,6 @@ gnc_plugin_menu_additions_add_to_window (GncPlugin *plugin,
GncMainWindow *window,
GQuark type)
{
- GncPluginMenuAdditionsPrivate *priv = GNC_PLUGIN_MENU_ADDITIONS_GET_PRIVATE(plugin);
GncPluginMenuAdditionsPerWindow per_window;
static GOnce accel_table_init = G_ONCE_INIT;
static GHashTable *table;
@@ -492,10 +476,11 @@ gnc_plugin_menu_additions_add_to_window (GncPlugin *plugin,
ENTER(" ");
- if (!priv->item_hash)
- priv->item_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ GncPluginMenuAdditions *menu_plugin = GNC_PLUGIN_MENU_ADDITIONS (plugin);
+ if (!menu_plugin->item_hash)
+ menu_plugin->item_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- per_window.item_hash = priv->item_hash;
+ per_window.item_hash = menu_plugin->item_hash;
per_window.build_menu_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
per_window.report_menu = g_menu_new ();
diff --git a/gnucash/gnome/gnc-plugin-account-tree.c b/gnucash/gnome/gnc-plugin-account-tree.c
index d857c0e4ae..ea9aa24310 100644
--- a/gnucash/gnome/gnc-plugin-account-tree.c
+++ b/gnucash/gnome/gnc-plugin-account-tree.c
@@ -72,16 +72,7 @@ struct _GncPluginAccountTree
GncPlugin gnc_plugin;
};
-/** The instance private data structure for an account tree plugin. */
-typedef struct GncPluginAccountTreePrivate
-{
- gpointer dummy;
-} GncPluginAccountTreePrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginAccountTree, gnc_plugin_account_tree, GNC_TYPE_PLUGIN)
-
-#define GNC_PLUGIN_ACCOUNT_TREE_GET_PRIVATE(o) \
- ((GncPluginAccountTreePrivate*)gnc_plugin_account_tree_get_instance_private((GncPluginAccountTree*)o))
+G_DEFINE_TYPE(GncPluginAccountTree, gnc_plugin_account_tree, GNC_TYPE_PLUGIN)
/* Create a new account tree menu plugin. */
GncPlugin *
diff --git a/gnucash/gnome/gnc-plugin-basic-commands.c b/gnucash/gnome/gnc-plugin-basic-commands.c
index 0a064d065f..626648f638 100644
--- a/gnucash/gnome/gnc-plugin-basic-commands.c
+++ b/gnucash/gnome/gnc-plugin-basic-commands.c
@@ -182,16 +182,6 @@ struct _GncPluginBasicCommands
GncPlugin gnc_plugin;
};
-/** The instance private data structure for an basic commands
- * plugin. */
-typedef struct GncPluginBasicCommandsPrivate
-{
- gpointer dummy;
-} GncPluginBasicCommandsPrivate;
-
-#define GNC_PLUGIN_BASIC_COMMANDS_GET_PRIVATE(o) \
- ((GncPluginBasicCommandsPrivate*)gnc_plugin_basic_commands_get_instance_private ((GncPluginBasicCommands*)o))
-
/** Create a new basic commands menu plugin. */
GncPlugin *
gnc_plugin_basic_commands_new (void)
@@ -278,7 +268,7 @@ gnc_plugin_basic_commands_main_window_page_changed (GncMainWindow *window,
}
}
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginBasicCommands, gnc_plugin_basic_commands, GNC_TYPE_PLUGIN)
+G_DEFINE_TYPE(GncPluginBasicCommands, gnc_plugin_basic_commands, GNC_TYPE_PLUGIN)
/** Initialize the class for a new basic commands plugin. This will
* set up any function pointers that override functions in the parent
diff --git a/gnucash/gnome/gnc-plugin-budget.c b/gnucash/gnome/gnc-plugin-budget.c
index c565098e14..db821763b6 100644
--- a/gnucash/gnome/gnc-plugin-budget.c
+++ b/gnucash/gnome/gnc-plugin-budget.c
@@ -83,14 +83,6 @@ struct _GncPluginBudget
GncPlugin gnc_plugin;
};
-typedef struct GncPluginBudgetPrivate
-{
- gpointer dummy;
-} GncPluginBudgetPrivate;
-
-#define GNC_PLUGIN_BUDGET_GET_PRIVATE(o) \
- ((GncPluginBudgetPrivate*)gnc_plugin_budget_get_instance_private((GncPluginBudget*)o))
-
GncPlugin *
gnc_plugin_budget_new (void)
{
@@ -129,7 +121,7 @@ remove_from_window (GncPlugin *plugin, GncMainWindow *window, GQuark type)
g_signal_handlers_disconnect_by_func (window, G_CALLBACK(page_changed), plugin);
}
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginBudget, gnc_plugin_budget, GNC_TYPE_PLUGIN)
+G_DEFINE_TYPE(GncPluginBudget, gnc_plugin_budget, GNC_TYPE_PLUGIN)
static void
gnc_plugin_budget_class_init (GncPluginBudgetClass *klass)
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index b42f4a4759..fe4c97d30b 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -177,17 +177,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
struct _GncPluginBusiness
{
GncPlugin gnc_plugin;
-};
-typedef struct GncPluginBusinessPrivate
-{
GncOwner *last_customer;
GncOwner *last_vendor;
GncOwner *last_employee;
-} GncPluginBusinessPrivate;
-
-#define GNC_PLUGIN_BUSINESS_GET_PRIVATE(o) \
- ((GncPluginBusinessPrivate*)gnc_plugin_business_get_instance_private((GncPluginBusiness*)o))
+};
GncPlugin *
gnc_plugin_business_new (void)
@@ -205,7 +199,7 @@ gnc_plugin_business_new (void)
return GNC_PLUGIN (plugin);
}
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginBusiness, gnc_plugin_business, GNC_TYPE_PLUGIN)
+G_DEFINE_TYPE(GncPluginBusiness, gnc_plugin_business, GNC_TYPE_PLUGIN)
static void
gnc_plugin_business_class_init (GncPluginBusinessClass *klass)
@@ -232,17 +226,14 @@ gnc_plugin_business_class_init (GncPluginBusinessClass *klass)
static void
gnc_plugin_business_init (GncPluginBusiness *plugin)
{
- GncPluginBusinessPrivate *priv;
-
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- priv->last_customer = gncOwnerNew ();
- gncOwnerInitCustomer (priv->last_customer, NULL);
+ plugin->last_customer = gncOwnerNew ();
+ gncOwnerInitCustomer (plugin->last_customer, NULL);
- priv->last_vendor = gncOwnerNew ();
- gncOwnerInitVendor (priv->last_vendor, NULL);
+ plugin->last_vendor = gncOwnerNew ();
+ gncOwnerInitVendor (plugin->last_vendor, NULL);
- priv->last_employee = gncOwnerNew ();
- gncOwnerInitEmployee (priv->last_employee, NULL);
+ plugin->last_employee = gncOwnerNew ();
+ gncOwnerInitEmployee (plugin->last_employee, NULL);
}
static void
@@ -302,15 +293,13 @@ gnc_plugin_business_cmd_customer_find_customer (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
GncCustomer*customer;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- customer = gncOwnerGetCustomer (priv->last_customer);
+ customer = gncOwnerGetCustomer (plugin->last_customer);
gnc_customer_search (GTK_WINDOW (mw->window), customer, gnc_get_current_book ());
}
@@ -321,15 +310,13 @@ gnc_plugin_business_cmd_customer_new_invoice (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
- gnc_ui_invoice_new (GTK_WINDOW (mw->window), priv->last_customer, gnc_get_current_book ());
+ gnc_ui_invoice_new (GTK_WINDOW (mw->window), plugin->last_customer, gnc_get_current_book ());
}
static void
@@ -339,15 +326,13 @@ gnc_plugin_business_cmd_customer_find_invoice (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
- gnc_invoice_search (GTK_WINDOW (mw->window), NULL, priv->last_customer, gnc_get_current_book ());
+ gnc_invoice_search (GTK_WINDOW (mw->window), NULL, plugin->last_customer, gnc_get_current_book ());
}
static void
@@ -357,14 +342,12 @@ gnc_plugin_business_cmd_customer_new_job (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- gnc_ui_job_new (GTK_WINDOW (mw->window), priv->last_customer, gnc_get_current_book ());
+ gnc_ui_job_new (GTK_WINDOW (mw->window), plugin->last_customer, gnc_get_current_book ());
}
static void
@@ -374,14 +357,12 @@ gnc_plugin_business_cmd_customer_find_job (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- gnc_job_search (GTK_WINDOW (mw->window), NULL, priv->last_customer, gnc_get_current_book ());
+ gnc_job_search (GTK_WINDOW (mw->window), NULL, plugin->last_customer, gnc_get_current_book ());
}
static void
@@ -391,14 +372,12 @@ gnc_plugin_business_cmd_customer_process_payment (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- gnc_ui_payment_new (GTK_WINDOW (mw->window), priv->last_customer, gnc_get_current_book ());
+ gnc_ui_payment_new (GTK_WINDOW (mw->window), plugin->last_customer, gnc_get_current_book ());
}
static void
@@ -435,15 +414,13 @@ gnc_plugin_business_cmd_vendor_find_vendor (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
GncVendor *vendor;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- vendor = gncOwnerGetVendor (priv->last_vendor);
+ vendor = gncOwnerGetVendor (plugin->last_vendor);
gnc_vendor_search (GTK_WINDOW (mw->window), vendor, gnc_get_current_book ());
}
@@ -454,15 +431,13 @@ gnc_plugin_business_cmd_vendor_new_bill (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
- gnc_ui_invoice_new (GTK_WINDOW (mw->window), priv->last_vendor, gnc_get_current_book ());
+ gnc_ui_invoice_new (GTK_WINDOW (mw->window), plugin->last_vendor, gnc_get_current_book ());
}
static void
@@ -472,15 +447,13 @@ gnc_plugin_business_cmd_vendor_find_bill (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
- gnc_invoice_search (GTK_WINDOW (mw->window), NULL, priv->last_vendor, gnc_get_current_book ());
+ gnc_invoice_search (GTK_WINDOW (mw->window), NULL, plugin->last_vendor, gnc_get_current_book ());
}
static void
@@ -490,14 +463,12 @@ gnc_plugin_business_cmd_vendor_new_job (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- gnc_ui_job_new (GTK_WINDOW (mw->window), priv->last_vendor, gnc_get_current_book ());
+ gnc_ui_job_new (GTK_WINDOW (mw->window), plugin->last_vendor, gnc_get_current_book ());
}
static void
@@ -507,14 +478,12 @@ gnc_plugin_business_cmd_vendor_find_job (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- gnc_job_search (GTK_WINDOW (mw->window), NULL, priv->last_vendor, gnc_get_current_book ());
+ gnc_job_search (GTK_WINDOW (mw->window), NULL, plugin->last_vendor, gnc_get_current_book ());
}
static void
@@ -524,14 +493,12 @@ gnc_plugin_business_cmd_vendor_process_payment (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- gnc_ui_payment_new (GTK_WINDOW (mw->window), priv->last_vendor, gnc_get_current_book ());
+ gnc_ui_payment_new (GTK_WINDOW (mw->window), plugin->last_vendor, gnc_get_current_book ());
}
static void
@@ -568,15 +535,13 @@ gnc_plugin_business_cmd_employee_find_employee (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
GncEmployee *employee;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- employee = gncOwnerGetEmployee (priv->last_employee);
+ employee = gncOwnerGetEmployee (plugin->last_employee);
gnc_employee_search (GTK_WINDOW (mw->window), employee, gnc_get_current_book ());
}
@@ -587,15 +552,13 @@ gnc_plugin_business_cmd_employee_new_expense_voucher (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
- gnc_ui_invoice_new (GTK_WINDOW (mw->window), priv->last_employee, gnc_get_current_book ());
+ gnc_ui_invoice_new (GTK_WINDOW (mw->window), plugin->last_employee, gnc_get_current_book ());
}
static void
@@ -605,15 +568,13 @@ gnc_plugin_business_cmd_employee_find_expense_voucher (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
- gnc_invoice_search (GTK_WINDOW (mw->window), NULL, priv->last_employee, gnc_get_current_book ());
+ gnc_invoice_search (GTK_WINDOW (mw->window), NULL, plugin->last_employee, gnc_get_current_book ());
}
static void
@@ -623,14 +584,12 @@ gnc_plugin_business_cmd_employee_process_payment (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin;
- GncPluginBusinessPrivate *priv;
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
plugin = GNC_PLUGIN_BUSINESS (mw->data);
- priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
- gnc_ui_payment_new (GTK_WINDOW (mw->window), priv->last_employee, gnc_get_current_book ());
+ gnc_ui_payment_new (GTK_WINDOW (mw->window), plugin->last_employee, gnc_get_current_book ());
}
static void
@@ -725,7 +684,6 @@ gnc_plugin_business_cmd_assign_payment (GSimpleAction *simple,
{
GncMainWindowActionData *mw = user_data;
GncPluginBusiness *plugin_business;
- GncPluginBusinessPrivate *plugin_business_priv;
GncPluginPage *plugin_page;
GNCSplitReg *gsr;
SplitRegister *reg;
@@ -759,15 +717,14 @@ gnc_plugin_business_cmd_assign_payment (GSimpleAction *simple,
g_return_if_fail(trans);
plugin_business = GNC_PLUGIN_BUSINESS (mw->data);
- plugin_business_priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin_business);
have_owner = gncOwnerGetOwnerFromTxn (trans, &owner);
if (have_owner)
owner_p = &owner;
else if (gnc_ui_payment_is_customer_payment(trans))
- owner_p = plugin_business_priv->last_customer;
+ owner_p = plugin_business->last_customer;
else
- owner_p = plugin_business_priv->last_vendor;
+ owner_p = plugin_business->last_vendor;
gnc_business_assign_payment (GTK_WINDOW (mw->window),
trans, owner_p);
diff --git a/gnucash/gnome/gnc-plugin-register.c b/gnucash/gnome/gnc-plugin-register.c
index 201c2670c1..ba4f3ad10b 100644
--- a/gnucash/gnome/gnc-plugin-register.c
+++ b/gnucash/gnome/gnc-plugin-register.c
@@ -64,15 +64,7 @@ struct _GncPluginRegister
GncPlugin gnc_plugin;
};
-typedef struct GncPluginRegisterPrivate
-{
- gpointer dummy;
-} GncPluginRegisterPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginRegister, gnc_plugin_register, GNC_TYPE_PLUGIN)
-
-#define GNC_PLUGIN_REGISTER_GET_PRIVATE(o) \
- ((GncPluginRegisterPrivate*)gnc_plugin_register_get_instance_private((GncPluginRegister*)o))
+G_DEFINE_TYPE(GncPluginRegister, gnc_plugin_register, GNC_TYPE_PLUGIN)
static QofLogModule log_module = GNC_MOD_GUI;
diff --git a/gnucash/gnome/gnc-plugin-report-system.c b/gnucash/gnome/gnc-plugin-report-system.c
index 7a9e924c43..aaf64f7b4a 100644
--- a/gnucash/gnome/gnc-plugin-report-system.c
+++ b/gnucash/gnome/gnc-plugin-report-system.c
@@ -66,15 +66,7 @@ struct _GncPluginReportSystem
GncPlugin gnc_plugin;
};
-typedef struct GncPluginReportSystemPrivate
-{
- gpointer dummy;
-} GncPluginReportSystemPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginReportSystem, gnc_plugin_report_system, GNC_TYPE_PLUGIN)
-
-#define GNC_PLUGIN_REPORT_SYSTEM_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_REPORT_SYSTEM, GncPluginReportSystemPrivate))
+G_DEFINE_TYPE(GncPluginReportSystem, gnc_plugin_report_system, GNC_TYPE_PLUGIN)
/************************************************************
* Object Implementation *
diff --git a/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
index 00bf02236a..57be5d8206 100644
--- a/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
+++ b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
@@ -64,15 +64,7 @@ struct _GncPluginCsvExport
GncPlugin gnc_plugin;
};
-typedef struct GncPluginCsvExportPrivate
-{
- gpointer dummy;
-} GncPluginCsvExportPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginCsvExport, gnc_plugin_csv_export, GNC_TYPE_PLUGIN)
-
-#define GNC_PLUGIN_CSV_EXPORT_GET_PRIVATE(o) \
- ((GncPluginCsvExportPrivate*)gnc_plugin_csv_export_get_instance_private((GncPluginCsvExport*)o))
+G_DEFINE_TYPE(GncPluginCsvExport, gnc_plugin_csv_export, GNC_TYPE_PLUGIN)
GncPlugin *
gnc_plugin_csv_export_new (void)
diff --git a/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
index df843cf138..ea0eea822f 100644
--- a/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
+++ b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
@@ -63,15 +63,7 @@ struct _GncPluginCsvImport
GncPlugin gnc_plugin;
};
-typedef struct GncPluginCsvImportPrivate
-{
- gpointer dummy;
-} GncPluginCsvImportPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginCsvImport, gnc_plugin_csv_import, GNC_TYPE_PLUGIN)
-
-#define GNC_PLUGIN_CSV_IMPORT_GET_PRIVATE(o) \
- ((GncPluginCsvImportPrivate*)gnc_plugin_csv_import_get_instance_private((GncPluginCsvImport*)o))
+G_DEFINE_TYPE(GncPluginCsvImport, gnc_plugin_csv_import, GNC_TYPE_PLUGIN)
GncPlugin *
gnc_plugin_csv_import_new (void)
diff --git a/gnucash/import-export/log-replay/gnc-plugin-log-replay.c b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
index e3ac2f1e54..255e298221 100644
--- a/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
+++ b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
@@ -59,15 +59,7 @@ struct _GncPluginLogReplay
GncPlugin gnc_plugin;
};
-typedef struct GncPluginLogReplayPrivate
-{
- gpointer dummy;
-} GncPluginLogReplayPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginLogReplay, gnc_plugin_log_replay, GNC_TYPE_PLUGIN)
-
-#define GNC_PLUGIN_LOG_REPLAY_GET_PRIVATE(o) \
- ((GncPluginLogReplayPrivate*)gnc_plugin_log_replay_get_instance_private((GncPluginLogReplay*)o))
+G_DEFINE_TYPE(GncPluginLogReplay, gnc_plugin_log_replay, GNC_TYPE_PLUGIN)
GncPlugin *
gnc_plugin_log_replay_new (void)
diff --git a/gnucash/import-export/ofx/gnc-plugin-ofx.c b/gnucash/import-export/ofx/gnc-plugin-ofx.c
index 70d6ed5e83..937077aa84 100644
--- a/gnucash/import-export/ofx/gnc-plugin-ofx.c
+++ b/gnucash/import-export/ofx/gnc-plugin-ofx.c
@@ -57,15 +57,7 @@ struct _GncPluginOfx
GncPlugin gnc_plugin;
};
-typedef struct GncPluginOfxPrivate
-{
- gpointer dummy;
-} GncPluginOfxPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginOfx, gnc_plugin_ofx, GNC_TYPE_PLUGIN)
-
-#define GNC_PLUGIN_OFX_GET_PRIVATE(o) \
- ((GncPluginOfxPrivate*)gnc_plugin_ofx_get_instance_private((GncPluginOfx*)o))
+G_DEFINE_TYPE(GncPluginOfx, gnc_plugin_ofx, GNC_TYPE_PLUGIN)
GncPlugin *
gnc_plugin_ofx_new (void)
diff --git a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
index e68e6f5251..718bd17581 100644
--- a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
+++ b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
@@ -59,15 +59,7 @@ struct _GncPluginQifImport
GncPlugin gnc_plugin;
};
-typedef struct GncPluginQifImportPrivate
-{
- gpointer dummy;
-} GncPluginQifImportPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginQifImport, gnc_plugin_qif_import, GNC_TYPE_PLUGIN)
-
-#define GNC_PLUGIN_QIF_IMPORT_GET_PRIVATE(o) \
- ((GncPluginQifImportPrivate*)gnc_plugin_qif_import_get_instance_private((GncPluginQifImport*)o))
+G_DEFINE_TYPE(GncPluginQifImport, gnc_plugin_qif_import, GNC_TYPE_PLUGIN)
GncPlugin *
gnc_plugin_qif_import_new (void)
commit 1255d6191721d094e6d1941c71f6cedc6890bb0f
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Tue Jun 13 16:32:45 2023 +0100
Refactor: hide implementation of GncPlugin* (move from .h -> .c)
diff --git a/gnucash/gnome-utils/gnc-plugin-file-history.c b/gnucash/gnome-utils/gnc-plugin-file-history.c
index 3ac2bf3ffe..d4eddd7bc8 100644
--- a/gnucash/gnome-utils/gnc-plugin-file-history.c
+++ b/gnucash/gnome-utils/gnc-plugin-file-history.c
@@ -99,6 +99,12 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
+/** The instance data structure for a file history plugin. */
+struct _GncPluginFileHistory
+{
+ GncPlugin gnc_plugin;
+};
+
/** The instance private data for a file history plugin. This data
* structure is unused. */
typedef struct GncPluginFileHistoryPrivate
diff --git a/gnucash/gnome-utils/gnc-plugin-file-history.h b/gnucash/gnome-utils/gnc-plugin-file-history.h
index 713d82935a..8dfb54e8db 100644
--- a/gnucash/gnome-utils/gnc-plugin-file-history.h
+++ b/gnucash/gnome-utils/gnc-plugin-file-history.h
@@ -45,14 +45,6 @@ G_DECLARE_FINAL_TYPE (GncPluginFileHistory, gnc_plugin_file_history, GNC, PLUGIN
#define GNC_PLUGIN_FILE_HISTORY_NAME "gnc-plugin-file-history"
-/* typedefs & structures */
-
-/** The instance data structure for a file history plugin. */
-struct _GncPluginFileHistory
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
diff --git a/gnucash/gnome-utils/gnc-plugin-menu-additions.c b/gnucash/gnome-utils/gnc-plugin-menu-additions.c
index 382556b146..2c08a6119e 100644
--- a/gnucash/gnome-utils/gnc-plugin-menu-additions.c
+++ b/gnucash/gnome-utils/gnc-plugin-menu-additions.c
@@ -60,6 +60,11 @@ static QofLogModule log_module = GNC_MOD_GUI;
#define PLUGIN_ACTIONS_NAME "gnc-plugin-menu-additions-actions"
+struct _GncPluginMenuAdditions
+{
+ GncPlugin gnc_plugin;
+};
+
/** Private data for this plugin. This data structure is unused. */
typedef struct GncPluginMenuAdditionsPrivate
{
diff --git a/gnucash/gnome-utils/gnc-plugin-menu-additions.h b/gnucash/gnome-utils/gnc-plugin-menu-additions.h
index 18d069e52c..953f49dfe5 100644
--- a/gnucash/gnome-utils/gnc-plugin-menu-additions.h
+++ b/gnucash/gnome-utils/gnc-plugin-menu-additions.h
@@ -48,12 +48,6 @@ G_DECLARE_FINAL_TYPE (GncPluginMenuAdditions, gnc_plugin_menu_additions, GNC, PL
#define GNC_PLUGIN_MENU_ADDITIONS_NAME "gnc-plugin-menu-additions"
-/* typedefs & structures */
-struct _GncPluginMenuAdditions
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
/** Create a new menu_additions plugin. This plugin attaches the menu
diff --git a/gnucash/gnome/gnc-plugin-account-tree.c b/gnucash/gnome/gnc-plugin-account-tree.c
index b23e698aaf..d857c0e4ae 100644
--- a/gnucash/gnome/gnc-plugin-account-tree.c
+++ b/gnucash/gnome/gnc-plugin-account-tree.c
@@ -65,6 +65,13 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
+/** The instance data structure for an account tree menu plugin. */
+struct _GncPluginAccountTree
+{
+ /** The parent object for this widget */
+ GncPlugin gnc_plugin;
+};
+
/** The instance private data structure for an account tree plugin. */
typedef struct GncPluginAccountTreePrivate
{
diff --git a/gnucash/gnome/gnc-plugin-account-tree.h b/gnucash/gnome/gnc-plugin-account-tree.h
index f401141b79..4bd072d9ec 100644
--- a/gnucash/gnome/gnc-plugin-account-tree.h
+++ b/gnucash/gnome/gnc-plugin-account-tree.h
@@ -46,15 +46,6 @@ G_DECLARE_FINAL_TYPE (GncPluginAccountTree, gnc_plugin_account_tree, GNC, PLUGIN
#define GNC_PLUGIN_ACCOUNT_TREE_NAME "gnc-plugin-account-tree"
-/* typedefs & structures */
-
-/** The instance data structure for an account tree menu plugin. */
-struct _GncPluginAccountTree
-{
- /** The parent object for this widget */
- GncPlugin gnc_plugin;
-};
-
/** Create a new account tree menu plugin.
*
* @return A pointer to the new object.
diff --git a/gnucash/gnome/gnc-plugin-basic-commands.c b/gnucash/gnome/gnc-plugin-basic-commands.c
index 64d451ab08..0a064d065f 100644
--- a/gnucash/gnome/gnc-plugin-basic-commands.c
+++ b/gnucash/gnome/gnc-plugin-basic-commands.c
@@ -175,6 +175,13 @@ static const gchar *dirty_only_active_actions[] =
NULL
};
+/** The instance data structure for an basic commands menu plugin. */
+struct _GncPluginBasicCommands
+{
+ /** The parent object for this widget */
+ GncPlugin gnc_plugin;
+};
+
/** The instance private data structure for an basic commands
* plugin. */
typedef struct GncPluginBasicCommandsPrivate
diff --git a/gnucash/gnome/gnc-plugin-basic-commands.h b/gnucash/gnome/gnc-plugin-basic-commands.h
index 497f4569b3..4744ab0aaa 100644
--- a/gnucash/gnome/gnc-plugin-basic-commands.h
+++ b/gnucash/gnome/gnc-plugin-basic-commands.h
@@ -45,15 +45,6 @@ G_DECLARE_FINAL_TYPE (GncPluginBasicCommands, gnc_plugin_basic_commands, GNC, PL
#define GNC_PLUGIN_BASIC_COMMANDS_NAME "gnc-plugin-basic-commands"
-/* typedefs & structures */
-
-/** The instance data structure for an basic commands menu plugin. */
-struct _GncPluginBasicCommands
-{
- /** The parent object for this widget */
- GncPlugin gnc_plugin;
-};
-
/** Create a new basic commands menu plugin.
*
* @return A pointer to the new object.
diff --git a/gnucash/gnome/gnc-plugin-budget.c b/gnucash/gnome/gnc-plugin-budget.c
index a6af81e589..c565098e14 100644
--- a/gnucash/gnome/gnc-plugin-budget.c
+++ b/gnucash/gnome/gnc-plugin-budget.c
@@ -78,6 +78,11 @@ static const gchar *plugin_writeable_actions[] =
NULL
};
+struct _GncPluginBudget
+{
+ GncPlugin gnc_plugin;
+};
+
typedef struct GncPluginBudgetPrivate
{
gpointer dummy;
diff --git a/gnucash/gnome/gnc-plugin-budget.h b/gnucash/gnome/gnc-plugin-budget.h
index c939db2e82..e2ed24038c 100644
--- a/gnucash/gnome/gnc-plugin-budget.h
+++ b/gnucash/gnome/gnc-plugin-budget.h
@@ -39,12 +39,6 @@ G_DECLARE_FINAL_TYPE (GncPluginBudget, gnc_plugin_budget, GNC, PLUGIN_BUDGET, Gn
#define GNC_PLUGIN_BUDGET_NAME "gnc-plugin-budget"
-/* typedefs & structures */
-struct _GncPluginBudget
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
GncPlugin *gnc_plugin_budget_new (void);
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index 05deefd1ba..b42f4a4759 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -174,6 +174,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
* Plugin Function Implementation *
************************************************************/
+struct _GncPluginBusiness
+{
+ GncPlugin gnc_plugin;
+};
+
typedef struct GncPluginBusinessPrivate
{
GncOwner *last_customer;
diff --git a/gnucash/gnome/gnc-plugin-business.h b/gnucash/gnome/gnc-plugin-business.h
index cc7a229531..76f95729e8 100644
--- a/gnucash/gnome/gnc-plugin-business.h
+++ b/gnucash/gnome/gnc-plugin-business.h
@@ -37,12 +37,6 @@ G_DECLARE_FINAL_TYPE (GncPluginBusiness, gnc_plugin_business, GNC, PLUGIN_BUSINE
#define GNC_PLUGIN_BUSINESS_NAME "gnc-plugin-business"
-/* typedefs & structures */
-struct _GncPluginBusiness
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
GncPlugin *gnc_plugin_business_new (void);
diff --git a/gnucash/gnome/gnc-plugin-register.c b/gnucash/gnome/gnc-plugin-register.c
index 4cae800185..201c2670c1 100644
--- a/gnucash/gnome/gnc-plugin-register.c
+++ b/gnucash/gnome/gnc-plugin-register.c
@@ -59,6 +59,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
+struct _GncPluginRegister
+{
+ GncPlugin gnc_plugin;
+};
+
typedef struct GncPluginRegisterPrivate
{
gpointer dummy;
diff --git a/gnucash/gnome/gnc-plugin-register.h b/gnucash/gnome/gnc-plugin-register.h
index db948bd97e..d4fdbb526d 100644
--- a/gnucash/gnome/gnc-plugin-register.h
+++ b/gnucash/gnome/gnc-plugin-register.h
@@ -35,12 +35,6 @@ G_DECLARE_FINAL_TYPE (GncPluginRegister, gnc_plugin_register, GNC, PLUGIN_REGIST
#define GNC_PLUGIN_REGISTER_NAME "gnc-plugin-register"
-/* typedefs & structures */
-struct _GncPluginRegister
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
GncPlugin *gnc_plugin_register_new (void);
diff --git a/gnucash/gnome/gnc-plugin-report-system.c b/gnucash/gnome/gnc-plugin-report-system.c
index 1a70836a5d..7a9e924c43 100644
--- a/gnucash/gnome/gnc-plugin-report-system.c
+++ b/gnucash/gnome/gnc-plugin-report-system.c
@@ -61,6 +61,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
+struct _GncPluginReportSystem
+{
+ GncPlugin gnc_plugin;
+};
+
typedef struct GncPluginReportSystemPrivate
{
gpointer dummy;
diff --git a/gnucash/gnome/gnc-plugin-report-system.h b/gnucash/gnome/gnc-plugin-report-system.h
index 2329c6f399..9f37a7f7c2 100644
--- a/gnucash/gnome/gnc-plugin-report-system.h
+++ b/gnucash/gnome/gnc-plugin-report-system.h
@@ -35,12 +35,6 @@ G_DECLARE_FINAL_TYPE (GncPluginReportSystem, gnc_plugin_report_system, GNC, PLUG
#define GNC_PLUGIN_REPORT_SYSTEM_NAME "gnc-plugin-report-system"
-/* typedefs & structures */
-struct _GncPluginReportSystem
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
void gnc_plugin_report_system_new (void);
diff --git a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
index b92728b11d..1f81e69a27 100644
--- a/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
+++ b/gnucash/import-export/aqb/gnc-plugin-aqbanking.c
@@ -139,6 +139,11 @@ static GncMainWindow *gnc_main_window = NULL;
* Object Implementation *
************************************************************/
+struct _GncPluginAqBanking
+{
+ GncPlugin gnc_plugin;
+};
+
G_DEFINE_TYPE(GncPluginAqBanking, gnc_plugin_aqbanking, GNC_TYPE_PLUGIN)
GncPlugin *
diff --git a/gnucash/import-export/aqb/gnc-plugin-aqbanking.h b/gnucash/import-export/aqb/gnc-plugin-aqbanking.h
index 86c90f0369..f31a1961ec 100644
--- a/gnucash/import-export/aqb/gnc-plugin-aqbanking.h
+++ b/gnucash/import-export/aqb/gnc-plugin-aqbanking.h
@@ -45,12 +45,6 @@ G_DECLARE_FINAL_TYPE (GncPluginAqBanking, gnc_plugin_aqbanking, GNC, PLUGIN_AQBA
#define GNC_PLUGIN_AQBANKING_NAME "gnc-plugin-aqbanking"
-/* typedefs & structures */
-struct _GncPluginAqBanking
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
/**
diff --git a/gnucash/import-export/bi-import/gnc-plugin-bi-import.c b/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
index b0cc0b89ae..68a70dbfaa 100644
--- a/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
+++ b/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
@@ -69,6 +69,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
* Object Implementation *
************************************************************/
+struct _GncPluginBiImport
+{
+ GncPlugin gnc_plugin;
+};
+
G_DEFINE_TYPE(GncPluginBiImport, gnc_plugin_bi_import, GNC_TYPE_PLUGIN)
GncPlugin *
diff --git a/gnucash/import-export/bi-import/gnc-plugin-bi-import.h b/gnucash/import-export/bi-import/gnc-plugin-bi-import.h
index e30ace1be1..298d8bb8fa 100644
--- a/gnucash/import-export/bi-import/gnc-plugin-bi-import.h
+++ b/gnucash/import-export/bi-import/gnc-plugin-bi-import.h
@@ -42,12 +42,6 @@ G_DECLARE_FINAL_TYPE (GncPluginBiImport, gnc_plugin_bi_import, GNC, PLUGIN_BI_IM
#define GNC_PLUGIN_BI_IMPORT_NAME "gnc-plugin-bi-import"
-/* typedefs & structures */
-struct _GncPluginBiImport
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
/**
diff --git a/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
index acb2982728..00bf02236a 100644
--- a/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
+++ b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
@@ -59,6 +59,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
+struct _GncPluginCsvExport
+{
+ GncPlugin gnc_plugin;
+};
+
typedef struct GncPluginCsvExportPrivate
{
gpointer dummy;
diff --git a/gnucash/import-export/csv-exp/gnc-plugin-csv-export.h b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.h
index fce7c6c8cf..affc6b4c46 100644
--- a/gnucash/import-export/csv-exp/gnc-plugin-csv-export.h
+++ b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.h
@@ -35,12 +35,6 @@ G_DECLARE_FINAL_TYPE (GncPluginCsvExport, gnc_plugin_csv_export, GNC, PLUGIN_CSV
#define GNC_PLUGIN_CSV_EXPORT_NAME "gnc-plugin-csv-export"
-/* typedefs & structures */
-struct _GncPluginCsvExport
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
GncPlugin *gnc_plugin_csv_export_new (void);
diff --git a/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
index cb01075abd..df843cf138 100644
--- a/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
+++ b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
@@ -58,6 +58,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
+struct _GncPluginCsvImport
+{
+ GncPlugin gnc_plugin;
+};
+
typedef struct GncPluginCsvImportPrivate
{
gpointer dummy;
diff --git a/gnucash/import-export/csv-imp/gnc-plugin-csv-import.h b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.h
index e9b653bc32..90edfee31a 100644
--- a/gnucash/import-export/csv-imp/gnc-plugin-csv-import.h
+++ b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.h
@@ -35,12 +35,6 @@ G_DECLARE_FINAL_TYPE (GncPluginCsvImport, gnc_plugin_csv_import, GNC, PLUGIN_CSV
#define GNC_PLUGIN_CSV_IMPORT_NAME "gnc-plugin-csv-import"
-/* typedefs & structures */
-struct _GncPluginCsvImport
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
GncPlugin *gnc_plugin_csv_import_new (void);
diff --git a/gnucash/import-export/customer-import/gnc-plugin-customer-import.c b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
index 74344164bc..bfd5420928 100644
--- a/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
+++ b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
@@ -67,6 +67,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
* Object Implementation *
************************************************************/
+struct _GncPluginCustomerImport
+{
+ GncPlugin gnc_plugin;
+};
+
G_DEFINE_TYPE(GncPluginCustomerImport, gnc_plugin_customer_import, GNC_TYPE_PLUGIN)
GncPlugin *
diff --git a/gnucash/import-export/customer-import/gnc-plugin-customer-import.h b/gnucash/import-export/customer-import/gnc-plugin-customer-import.h
index 543053bd23..b1032f49fd 100644
--- a/gnucash/import-export/customer-import/gnc-plugin-customer-import.h
+++ b/gnucash/import-export/customer-import/gnc-plugin-customer-import.h
@@ -42,12 +42,6 @@ G_DECLARE_FINAL_TYPE (GncPluginCustomerImport, gnc_plugin_customer_import, GNC,
#define GNC_PLUGIN_CUSTOMER_IMPORT_NAME "gnc-plugin-customer-import"
-/* typedefs & structures */
-struct _GncPluginCustomerImport
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
/**
diff --git a/gnucash/import-export/log-replay/gnc-plugin-log-replay.c b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
index 0e278ab3d6..e3ac2f1e54 100644
--- a/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
+++ b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
@@ -54,6 +54,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
+struct _GncPluginLogReplay
+{
+ GncPlugin gnc_plugin;
+};
+
typedef struct GncPluginLogReplayPrivate
{
gpointer dummy;
diff --git a/gnucash/import-export/log-replay/gnc-plugin-log-replay.h b/gnucash/import-export/log-replay/gnc-plugin-log-replay.h
index c74e04bff8..bd60484db2 100644
--- a/gnucash/import-export/log-replay/gnc-plugin-log-replay.h
+++ b/gnucash/import-export/log-replay/gnc-plugin-log-replay.h
@@ -35,12 +35,6 @@ G_DECLARE_FINAL_TYPE (GncPluginLogReplay, gnc_plugin_log_replay, GNC, PLUGIN_LOG
#define GNC_PLUGIN_LOG_REPLAY_NAME "gnc-plugin-log-replay"
-/* typedefs & structures */
-struct _GncPluginLogReplay
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
GncPlugin *gnc_plugin_log_replay_new (void);
diff --git a/gnucash/import-export/ofx/gnc-plugin-ofx.c b/gnucash/import-export/ofx/gnc-plugin-ofx.c
index 8a1f626527..70d6ed5e83 100644
--- a/gnucash/import-export/ofx/gnc-plugin-ofx.c
+++ b/gnucash/import-export/ofx/gnc-plugin-ofx.c
@@ -52,6 +52,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
+struct _GncPluginOfx
+{
+ GncPlugin gnc_plugin;
+};
+
typedef struct GncPluginOfxPrivate
{
gpointer dummy;
diff --git a/gnucash/import-export/ofx/gnc-plugin-ofx.h b/gnucash/import-export/ofx/gnc-plugin-ofx.h
index e3a2b64074..685ca0779b 100644
--- a/gnucash/import-export/ofx/gnc-plugin-ofx.h
+++ b/gnucash/import-export/ofx/gnc-plugin-ofx.h
@@ -35,12 +35,6 @@ G_DECLARE_FINAL_TYPE (GncPluginOfx, gnc_plugin_ofx, GNC, PLUGIN_OFX, GncPlugin)
#define GNC_PLUGIN_OFX_NAME "gnc-plugin-ofx"
-/* typedefs & structures */
-struct _GncPluginOfx
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
GncPlugin *gnc_plugin_ofx_new (void);
diff --git a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
index b14ccfe50a..e68e6f5251 100644
--- a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
+++ b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
@@ -54,6 +54,11 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
+struct _GncPluginQifImport
+{
+ GncPlugin gnc_plugin;
+};
+
typedef struct GncPluginQifImportPrivate
{
gpointer dummy;
diff --git a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.h b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.h
index bdba6ac0a2..2f81f55757 100644
--- a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.h
+++ b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.h
@@ -36,12 +36,6 @@ G_DECLARE_FINAL_TYPE (GncPluginQifImport, gnc_plugin_qif_import, GNC, PLUGIN_QIF
#define GNC_PLUGIN_QIF_IMPORT_NAME "gnc-plugin-qif-import"
-/* typedefs & structures */
-struct _GncPluginQifImport
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
GncPlugin *gnc_plugin_qif_import_new (void);
diff --git a/libgnucash/gnc-module/example/gnc-plugin.example.c b/libgnucash/gnc-module/example/gnc-plugin.example.c
index c80047dfca..85accc9898 100644
--- a/libgnucash/gnc-module/example/gnc-plugin.example.c
+++ b/libgnucash/gnc-module/example/gnc-plugin.example.c
@@ -55,6 +55,11 @@ static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
* Object Implementation *
************************************************************/
+struct _GncPluginExample
+{
+ GncPlugin gnc_plugin;
+};
+
G_DEFINE_TYPE(GncPluginExample, gnc_plugin_example, GNC_TYPE_PLUGIN)
GncPlugin *
diff --git a/libgnucash/gnc-module/example/gnc-plugin.example.h b/libgnucash/gnc-module/example/gnc-plugin.example.h
index 5b8d607231..f472cf5dbb 100644
--- a/libgnucash/gnc-module/example/gnc-plugin.example.h
+++ b/libgnucash/gnc-module/example/gnc-plugin.example.h
@@ -42,12 +42,6 @@ G_DECLARE_FINAL_TYPE (GncPluginExample, gnc_plugin_example, GNC, PLUGIN_EXAMPLE)
#define GNC_PLUGIN_EXAMPLE_NAME "gnc-plugin-example"
-/* typedefs & structures */
-struct _GncPluginExample
-{
- GncPlugin gnc_plugin;
-};
-
/* function prototypes */
/**
commit 2e59bda951f71d37d34476a94a42e8be3471cc01
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:13:15 2023 +0100
Refactor: DECLARE_FINAL GncPluginExample < GncPlugin
- Fix the name
diff --git a/libgnucash/gnc-module/example/gnc-plugin.example.c b/libgnucash/gnc-module/example/gnc-plugin.example.c
index 6a739866f3..c80047dfca 100644
--- a/libgnucash/gnc-module/example/gnc-plugin.example.c
+++ b/libgnucash/gnc-module/example/gnc-plugin.example.c
@@ -55,16 +55,16 @@ static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
* Object Implementation *
************************************************************/
-G_DEFINE_TYPE(GncPluginexample, gnc_plugin_example, GNC_TYPE_PLUGIN)
+G_DEFINE_TYPE(GncPluginExample, gnc_plugin_example, GNC_TYPE_PLUGIN)
GncPlugin *
gnc_plugin_example_new (void)
{
- return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_example, (gchar*) NULL));
+ return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_EXAMPLE, (gchar*) NULL));
}
static void
-gnc_plugin_example_class_init (GncPluginexampleClass *klass)
+gnc_plugin_example_class_init (GncPluginExampleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
GncPluginClass *plugin_class = GNC_PLUGIN_CLASS(klass);
@@ -82,7 +82,7 @@ gnc_plugin_example_class_init (GncPluginexampleClass *klass)
}
static void
-gnc_plugin_example_init (GncPluginexample *plugin)
+gnc_plugin_example_init (GncPluginExample *plugin)
{
}
diff --git a/libgnucash/gnc-module/example/gnc-plugin.example.h b/libgnucash/gnc-module/example/gnc-plugin.example.h
index f3c8400a18..5b8d607231 100644
--- a/libgnucash/gnc-module/example/gnc-plugin.example.h
+++ b/libgnucash/gnc-module/example/gnc-plugin.example.h
@@ -38,28 +38,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_example (gnc_plugin_example_get_type())
-#define GNC_PLUGIN_example(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNC_TYPE_PLUGIN_example, GncPluginexample))
-#define GNC_PLUGIN_example_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNC_TYPE_PLUGIN_example, GncPluginexampleClass))
-#define GNC_IS_PLUGIN_example(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNC_TYPE_PLUGIN_example))
-#define GNC_IS_PLUGIN_example_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNC_TYPE_PLUGIN_example))
-#define GNC_PLUGIN_example_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNC_TYPE_PLUGIN_example, GncPluginexampleClass))
+G_DECLARE_FINAL_TYPE (GncPluginExample, gnc_plugin_example, GNC, PLUGIN_EXAMPLE)
-#define GNC_PLUGIN_example_NAME "gnc-plugin-example"
+#define GNC_PLUGIN_EXAMPLE_NAME "gnc-plugin-example"
/* typedefs & structures */
-typedef struct {
+struct _GncPluginExample
+{
GncPlugin gnc_plugin;
-} GncPluginexample;
-
-typedef struct {
- GncPluginClass gnc_plugin;
-} GncPluginexampleClass;
+};
/* function prototypes */
-/**
- * @return The glib runtime type of an example plugin page
- **/
-GType gnc_plugin_example_get_type (void);
/**
* @return A new GncPluginexample object
commit c5d4f2bf303b669d663078a818b0ee128e2ad98d
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:12:37 2023 +0100
Refactor: DECLARE_FINAL GncPluginQifImport < GncPlugin
diff --git a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.h b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.h
index f9d9ca49bb..bdba6ac0a2 100644
--- a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.h
+++ b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.h
@@ -32,28 +32,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_QIF_IMPORT (gnc_plugin_qif_import_get_type ())
-#define GNC_PLUGIN_QIF_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_QIF_IMPORT, GncPluginQifImport))
-#define GNC_PLUGIN_QIF_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_QIF_IMPORT, GncPluginQifImportClass))
-#define GNC_IS_PLUGIN_QIF_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_QIF_IMPORT))
-#define GNC_IS_PLUGIN_QIF_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_QIF_IMPORT))
-#define GNC_PLUGIN_QIF_IMPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_QIF_IMPORT, GncPluginQifImportClass))
+G_DECLARE_FINAL_TYPE (GncPluginQifImport, gnc_plugin_qif_import, GNC, PLUGIN_QIF_IMPORT, GncPlugin)
#define GNC_PLUGIN_QIF_IMPORT_NAME "gnc-plugin-qif-import"
/* typedefs & structures */
-typedef struct
+struct _GncPluginQifImport
{
GncPlugin gnc_plugin;
-} GncPluginQifImport;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginQifImportClass;
+};
/* function prototypes */
-GType gnc_plugin_qif_import_get_type (void);
-
GncPlugin *gnc_plugin_qif_import_new (void);
void gnc_plugin_qif_import_create_plugin (void);
commit 81ce7bb1070c45e49edaf2042f89a8ba813247cf
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:12:17 2023 +0100
Refactor: DECLARE_FINAL GncPluginOfx < GncPlugin
diff --git a/gnucash/import-export/ofx/gnc-plugin-ofx.h b/gnucash/import-export/ofx/gnc-plugin-ofx.h
index 8716eba560..e3a2b64074 100644
--- a/gnucash/import-export/ofx/gnc-plugin-ofx.h
+++ b/gnucash/import-export/ofx/gnc-plugin-ofx.h
@@ -31,28 +31,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_OFX (gnc_plugin_ofx_get_type ())
-#define GNC_PLUGIN_OFX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_OFX, GncPluginOfx))
-#define GNC_PLUGIN_OFX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_OFX, GncPluginOfxClass))
-#define GNC_IS_PLUGIN_OFX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_OFX))
-#define GNC_IS_PLUGIN_OFX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_OFX))
-#define GNC_PLUGIN_OFX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_OFX, GncPluginOfxClass))
+G_DECLARE_FINAL_TYPE (GncPluginOfx, gnc_plugin_ofx, GNC, PLUGIN_OFX, GncPlugin)
#define GNC_PLUGIN_OFX_NAME "gnc-plugin-ofx"
/* typedefs & structures */
-typedef struct
+struct _GncPluginOfx
{
GncPlugin gnc_plugin;
-} GncPluginOfx;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginOfxClass;
+};
/* function prototypes */
-GType gnc_plugin_ofx_get_type (void);
-
GncPlugin *gnc_plugin_ofx_new (void);
void gnc_plugin_ofx_create_plugin (void);
commit d73117d1ef0656fd8001e7bedfae76c3db2f6aea
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:11:45 2023 +0100
Refactor: DECLARE_FINAL GncPluginLogReplay < GncPlugin
- Fix the name
diff --git a/gnucash/import-export/log-replay/gnc-plugin-log-replay.c b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
index 28b11592bd..0e278ab3d6 100644
--- a/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
+++ b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
@@ -54,15 +54,15 @@ static const gchar *gnc_plugin_load_ui_items [] =
NULL,
};
-typedef struct GncPluginLogreplayPrivate
+typedef struct GncPluginLogReplayPrivate
{
gpointer dummy;
-} GncPluginLogreplayPrivate;
+} GncPluginLogReplayPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginLogreplay, gnc_plugin_log_replay, GNC_TYPE_PLUGIN)
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginLogReplay, gnc_plugin_log_replay, GNC_TYPE_PLUGIN)
#define GNC_PLUGIN_LOG_REPLAY_GET_PRIVATE(o) \
- ((GncPluginLogreplayPrivate*)gnc_plugin_log_replay_get_instance_private((GncPluginLogReplay*)o))
+ ((GncPluginLogReplayPrivate*)gnc_plugin_log_replay_get_instance_private((GncPluginLogReplay*)o))
GncPlugin *
gnc_plugin_log_replay_new (void)
@@ -71,7 +71,7 @@ gnc_plugin_log_replay_new (void)
}
static void
-gnc_plugin_log_replay_class_init (GncPluginLogreplayClass *klass)
+gnc_plugin_log_replay_class_init (GncPluginLogReplayClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GncPluginClass *plugin_class = GNC_PLUGIN_CLASS (klass);
@@ -90,7 +90,7 @@ gnc_plugin_log_replay_class_init (GncPluginLogreplayClass *klass)
}
static void
-gnc_plugin_log_replay_init (GncPluginLogreplay *plugin)
+gnc_plugin_log_replay_init (GncPluginLogReplay *plugin)
{
}
diff --git a/gnucash/import-export/log-replay/gnc-plugin-log-replay.h b/gnucash/import-export/log-replay/gnc-plugin-log-replay.h
index e2f0a8c13a..c74e04bff8 100644
--- a/gnucash/import-export/log-replay/gnc-plugin-log-replay.h
+++ b/gnucash/import-export/log-replay/gnc-plugin-log-replay.h
@@ -31,28 +31,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_LOG_REPLAY (gnc_plugin_log_replay_get_type ())
-#define GNC_PLUGIN_LOG_REPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_LOG_REPLAY, GncPluginLogreplay))
-#define GNC_PLUGIN_LOG_REPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_LOG_REPLAY, GncPluginLogreplayClass))
-#define GNC_IS_PLUGIN_LOG_REPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_LOG_REPLAY))
-#define GNC_IS_PLUGIN_LOG_REPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_LOG_REPLAY))
-#define GNC_PLUGIN_LOG_REPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_LOG_REPLAY, GncPluginLogreplayClass))
+G_DECLARE_FINAL_TYPE (GncPluginLogReplay, gnc_plugin_log_replay, GNC, PLUGIN_LOG_REPLAY, GncPlugin)
#define GNC_PLUGIN_LOG_REPLAY_NAME "gnc-plugin-log-replay"
/* typedefs & structures */
-typedef struct
+struct _GncPluginLogReplay
{
GncPlugin gnc_plugin;
-} GncPluginLogreplay;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginLogreplayClass;
+};
/* function prototypes */
-GType gnc_plugin_log_replay_get_type (void);
-
GncPlugin *gnc_plugin_log_replay_new (void);
void gnc_plugin_log_replay_create_plugin (void);
commit 08168bec26b6f7d15474fb60fb946f62f5823748
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:10:51 2023 +0100
Refactor: DECLARE_FINAL GncPluginCustomerImport < GncPlugin
- fix the camel-snake hybrid name
- except the name of the action, which is already used externally
diff --git a/gnucash/import-export/customer-import/gnc-plugin-customer-import.c b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
index f63a3aedd4..74344164bc 100644
--- a/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
+++ b/gnucash/import-export/customer-import/gnc-plugin-customer-import.c
@@ -49,6 +49,8 @@ static void gnc_plugin_customer_import_cmd_test (GSimpleAction *simple, GVariant
static GActionEntry gnc_plugin_actions [] =
{
+ // should be "CustomerImportAction", but "customer_importAction"
+ // is already used externally in accelerator maps
{ "customer_importAction", gnc_plugin_customer_import_cmd_test, NULL, NULL, NULL },
};
/** The number of actions provided by this plugin. */
@@ -65,16 +67,16 @@ static const gchar *gnc_plugin_load_ui_items [] =
* Object Implementation *
************************************************************/
-G_DEFINE_TYPE(GncPlugincustomer_import, gnc_plugin_customer_import, GNC_TYPE_PLUGIN)
+G_DEFINE_TYPE(GncPluginCustomerImport, gnc_plugin_customer_import, GNC_TYPE_PLUGIN)
GncPlugin *
gnc_plugin_customer_import_new (void)
{
- return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_customer_import, (gchar*) NULL));
+ return GNC_PLUGIN (g_object_new (GNC_TYPE_PLUGIN_CUSTOMER_IMPORT, (gchar*) NULL));
}
static void
-gnc_plugin_customer_import_class_init (GncPlugincustomer_importClass *klass)
+gnc_plugin_customer_import_class_init (GncPluginCustomerImportClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GncPluginClass *plugin_class = GNC_PLUGIN_CLASS(klass);
@@ -82,7 +84,7 @@ gnc_plugin_customer_import_class_init (GncPlugincustomer_importClass *klass)
object_class->finalize = gnc_plugin_customer_import_finalize;
/* plugin info */
- plugin_class->plugin_name = GNC_PLUGIN_customer_import_NAME;
+ plugin_class->plugin_name = GNC_PLUGIN_CUSTOMER_IMPORT_NAME;
/* widget addition/removal */
plugin_class->actions_name = PLUGIN_ACTIONS_NAME;
@@ -93,7 +95,7 @@ gnc_plugin_customer_import_class_init (GncPlugincustomer_importClass *klass)
}
static void
-gnc_plugin_customer_import_init (GncPlugincustomer_import *plugin)
+gnc_plugin_customer_import_init (GncPluginCustomerImport *plugin)
{
}
diff --git a/gnucash/import-export/customer-import/gnc-plugin-customer-import.h b/gnucash/import-export/customer-import/gnc-plugin-customer-import.h
index 43fde78845..543053bd23 100644
--- a/gnucash/import-export/customer-import/gnc-plugin-customer-import.h
+++ b/gnucash/import-export/customer-import/gnc-plugin-customer-import.h
@@ -37,31 +37,18 @@
G_BEGIN_DECLS
/* type macros */
-#define GNC_TYPE_PLUGIN_customer_import (gnc_plugin_customer_import_get_type())
-#define GNC_PLUGIN_customer_import(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_import))
-#define GNC_PLUGIN_customer_import_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_importClass))
-#define GNC_IS_PLUGIN_customer_import(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNC_TYPE_PLUGIN_customer_import))
-#define GNC_IS_PLUGIN_customer_import_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNC_TYPE_PLUGIN_customer_import))
-#define GNC_PLUGIN_customer_import_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNC_TYPE_PLUGIN_customer_import, GncPlugincustomer_importClass))
+#define GNC_TYPE_PLUGIN_CUSTOMER_IMPORT (gnc_plugin_customer_import_get_type())
+G_DECLARE_FINAL_TYPE (GncPluginCustomerImport, gnc_plugin_customer_import, GNC, PLUGIN_CUSTOMER_IMPORT, GncPlugin)
-#define GNC_PLUGIN_customer_import_NAME "gnc-plugin-customer-import"
+#define GNC_PLUGIN_CUSTOMER_IMPORT_NAME "gnc-plugin-customer-import"
/* typedefs & structures */
-typedef struct
+struct _GncPluginCustomerImport
{
GncPlugin gnc_plugin;
-} GncPlugincustomer_import;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPlugincustomer_importClass;
+};
/* function prototypes */
-/**
- * @return The glib runtime type of an customer_import plugin page
- **/
-GType gnc_plugin_customer_import_get_type (void);
/**
* @return A new GncPlugincustomer_import object
commit f47c9295bc8cf438ecf17bd0547f997e453cb029
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:09:49 2023 +0100
Refactor: DECLARE_FINAL GncPluginCsvImport < GncPlugin
diff --git a/gnucash/import-export/csv-imp/gnc-plugin-csv-import.h b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.h
index 7f96f81c4b..e9b653bc32 100644
--- a/gnucash/import-export/csv-imp/gnc-plugin-csv-import.h
+++ b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.h
@@ -31,28 +31,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_CSV_IMPORT (gnc_plugin_csv_import_get_type ())
-#define GNC_PLUGIN_CSV_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_CSV_IMPORT, GncPluginCsvImport))
-#define GNC_PLUGIN_CSV_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_CSV_IMPORT, GncPluginCsvImportClass))
-#define GNC_IS_PLUGIN_CSV_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_CSV_IMPORT))
-#define GNC_IS_PLUGIN_CSV_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_CSV_IMPORT))
-#define GNC_PLUGIN_CSV_IMPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_CSV_IMPORT, GncPluginCsvImportClass))
+G_DECLARE_FINAL_TYPE (GncPluginCsvImport, gnc_plugin_csv_import, GNC, PLUGIN_CSV_IMPORT, GncPlugin)
#define GNC_PLUGIN_CSV_IMPORT_NAME "gnc-plugin-csv-import"
/* typedefs & structures */
-typedef struct
+struct _GncPluginCsvImport
{
GncPlugin gnc_plugin;
-} GncPluginCsvImport;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginCsvImportClass;
+};
/* function prototypes */
-GType gnc_plugin_csv_import_get_type (void);
-
GncPlugin *gnc_plugin_csv_import_new (void);
void gnc_plugin_csv_import_create_plugin (void);
commit d6764414c1cf620916c69f211267b2f15711891c
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:09:30 2023 +0100
Refactor: DECLARE_FINAL GncPluginCsvExport < GncPlugin
diff --git a/gnucash/import-export/csv-exp/gnc-plugin-csv-export.h b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.h
index 82571142f6..fce7c6c8cf 100644
--- a/gnucash/import-export/csv-exp/gnc-plugin-csv-export.h
+++ b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.h
@@ -31,28 +31,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_CSV_EXPORT (gnc_plugin_csv_export_get_type ())
-#define GNC_PLUGIN_CSV_EXPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_CSV_EXPORT, GncPluginCsvExport))
-#define GNC_PLUGIN_CSV_EXPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_CSV_EXPORT, GncPluginCsvExportClass))
-#define GNC_IS_PLUGIN_CSV_EXPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_CSV_EXPORT))
-#define GNC_IS_PLUGIN_CSV_EXPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_CSV_EXPORT))
-#define GNC_PLUGIN_CSV_EXPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_CSV_EXPORT, GncPluginCsvExportClass))
+G_DECLARE_FINAL_TYPE (GncPluginCsvExport, gnc_plugin_csv_export, GNC, PLUGIN_CSV_EXPORT, GncPlugin)
#define GNC_PLUGIN_CSV_EXPORT_NAME "gnc-plugin-csv-export"
/* typedefs & structures */
-typedef struct
+struct _GncPluginCsvExport
{
GncPlugin gnc_plugin;
-} GncPluginCsvExport;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginCsvExportClass;
+};
/* function prototypes */
-GType gnc_plugin_csv_export_get_type (void);
-
GncPlugin *gnc_plugin_csv_export_new (void);
void gnc_plugin_csv_export_create_plugin (void);
commit 631d0e77557d01117e2f4eb2438ac264537f33a7
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:09:13 2023 +0100
Refactor: DECLARE_FINAL GncPluginBiImport < GncPlugin
- fix the camel-snake hybrid name
- except the name of the action, which is already used externally
diff --git a/gnucash/import-export/bi-import/gnc-plugin-bi-import.c b/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
index 33afe70248..b0cc0b89ae 100644
--- a/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
+++ b/gnucash/import-export/bi-import/gnc-plugin-bi-import.c
@@ -51,6 +51,8 @@ static void gnc_plugin_bi_import_cmd_test (GSimpleAction *simple, GVariant *para
static GActionEntry gnc_plugin_actions [] =
{
+ // should be "BiImportAction", but "bi_importAction" is already
+ // used externally in accelerator maps
{ "bi_importAction", gnc_plugin_bi_import_cmd_test, NULL, NULL, NULL },
};
/** The number of actions provided by this plugin. */
@@ -67,7 +69,7 @@ static const gchar *gnc_plugin_load_ui_items [] =
* Object Implementation *
************************************************************/
-G_DEFINE_TYPE(GncPluginbi_import, gnc_plugin_bi_import, GNC_TYPE_PLUGIN)
+G_DEFINE_TYPE(GncPluginBiImport, gnc_plugin_bi_import, GNC_TYPE_PLUGIN)
GncPlugin *
gnc_plugin_bi_import_new (void)
@@ -76,7 +78,7 @@ gnc_plugin_bi_import_new (void)
}
static void
-gnc_plugin_bi_import_class_init (GncPluginbi_importClass *klass)
+gnc_plugin_bi_import_class_init (GncPluginBiImportClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GncPluginClass *plugin_class = GNC_PLUGIN_CLASS(klass);
@@ -95,7 +97,7 @@ gnc_plugin_bi_import_class_init (GncPluginbi_importClass *klass)
}
static void
-gnc_plugin_bi_import_init (GncPluginbi_import *plugin)
+gnc_plugin_bi_import_init (GncPluginBiImport *plugin)
{
}
diff --git a/gnucash/import-export/bi-import/gnc-plugin-bi-import.h b/gnucash/import-export/bi-import/gnc-plugin-bi-import.h
index 074be3df0f..e30ace1be1 100644
--- a/gnucash/import-export/bi-import/gnc-plugin-bi-import.h
+++ b/gnucash/import-export/bi-import/gnc-plugin-bi-import.h
@@ -38,30 +38,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_BI_IMPORT (gnc_plugin_bi_import_get_type())
-#define GNC_PLUGIN_BI_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNC_TYPE_PLUGIN_BI_IMPORT, GncPluginbi_import))
-#define GNC_PLUGIN_BI_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNC_TYPE_PLUGIN_BI_IMPORT, GncPluginbi_importClass))
-#define GNC_IS_PLUGIN_BI_IMPORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNC_TYPE_PLUGIN_BI_IMPORT))
-#define GNC_IS_PLUGIN_BI_IMPORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNC_TYPE_PLUGIN_BI_IMPORT))
-#define GNC_PLUGIN_BI_IMPORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNC_TYPE_PLUGIN_BI_IMPORT, GncPluginbi_importClass))
+G_DECLARE_FINAL_TYPE (GncPluginBiImport, gnc_plugin_bi_import, GNC, PLUGIN_BI_IMPORT, GncPlugin)
#define GNC_PLUGIN_BI_IMPORT_NAME "gnc-plugin-bi-import"
/* typedefs & structures */
-typedef struct
+struct _GncPluginBiImport
{
GncPlugin gnc_plugin;
-} GncPluginbi_import;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginbi_importClass;
+};
/* function prototypes */
-/**
- * @return The glib runtime type of an bi_import plugin page
- **/
-GType gnc_plugin_bi_import_get_type (void);
/**
* @return A new GncPluginbi_import object
commit a0952e1e5a0d65dd48ca0226605e92066d63f13b
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:08:11 2023 +0100
Refactor: DECLARE_FINAL GncPluginAqBanking < GncPlugin
diff --git a/gnucash/import-export/aqb/gnc-plugin-aqbanking.h b/gnucash/import-export/aqb/gnc-plugin-aqbanking.h
index b2206cfd14..86c90f0369 100644
--- a/gnucash/import-export/aqb/gnc-plugin-aqbanking.h
+++ b/gnucash/import-export/aqb/gnc-plugin-aqbanking.h
@@ -41,32 +41,18 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_AQBANKING (gnc_plugin_aqbanking_get_type())
-#define GNC_PLUGIN_AQBANKING(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNC_TYPE_PLUGIN_AQBANKING, GncPluginAqBanking))
-#define GNC_PLUGIN_AQBANKING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNC_TYPE_PLUGIN_AQBANKING, GncPluginAqBankingClass))
-#define GNC_IS_PLUGIN_AQBANKING(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNC_TYPE_PLUGIN_AQBANKING))
-#define GNC_IS_PLUGIN_AQBANKING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNC_TYPE_PLUGIN_AQBANKING))
-#define GNC_PLUGIN_AQBANKING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNC_TYPE_PLUGIN_AQBANKING, GncPluginAqBankingClass))
+G_DECLARE_FINAL_TYPE (GncPluginAqBanking, gnc_plugin_aqbanking, GNC, PLUGIN_AQBANKING, GncPlugin)
#define GNC_PLUGIN_AQBANKING_NAME "gnc-plugin-aqbanking"
/* typedefs & structures */
-typedef struct
+struct _GncPluginAqBanking
{
GncPlugin gnc_plugin;
-} GncPluginAqBanking;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginAqBankingClass;
+};
/* function prototypes */
-/**
- * @return The glib runtime type of an aqbanking plugin page
- **/
-GType gnc_plugin_aqbanking_get_type(void);
-
/**
* @return A new GncPluginAqBanking object
*/
commit 218ca30b461a97cc0302914f0d292794f2a62d2f
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Sat May 20 14:24:24 2023 +0100
Refactor: DECLARE_FINAL GncPluginReportSystem < GncPlugin
diff --git a/gnucash/gnome/gnc-plugin-report-system.h b/gnucash/gnome/gnc-plugin-report-system.h
index b897514ec7..2329c6f399 100644
--- a/gnucash/gnome/gnc-plugin-report-system.h
+++ b/gnucash/gnome/gnc-plugin-report-system.h
@@ -31,27 +31,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_REPORT_SYSTEM (gnc_plugin_report_system_get_type ())
-#define GNC_PLUGIN_REPORT_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_REPORT_SYSTEM, GncPluginReportSystem))
-#define GNC_PLUGIN_REPORT_SYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_REPORT_SYSTEM, GncPluginReportSystemClass))
-#define GNC_IS_PLUGIN_REPORT_SYSTEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_REPORT_SYSTEM))
-#define GNC_IS_PLUGIN_REPORT_SYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_REPORT_SYSTEM))
-#define GNC_PLUGIN_REPORT_SYSTEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_REPORT_SYSTEM, GncPluginReportSystemClass))
+G_DECLARE_FINAL_TYPE (GncPluginReportSystem, gnc_plugin_report_system, GNC, PLUGIN_REPORT_SYSTEM, GncPlugin)
#define GNC_PLUGIN_REPORT_SYSTEM_NAME "gnc-plugin-report-system"
/* typedefs & structures */
-typedef struct
+struct _GncPluginReportSystem
{
GncPlugin gnc_plugin;
-} GncPluginReportSystem;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginReportSystemClass;
+};
/* function prototypes */
-GType gnc_plugin_report_system_get_type (void);
void gnc_plugin_report_system_new (void);
G_END_DECLS
commit 17f41a796a84073c8d1c2ed4aa8b80db53bcd1c6
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Sun Jun 11 16:33:30 2023 +0100
Refactor: DECLARE_FINAL GncPluginRegister < GncPlugin
diff --git a/gnucash/gnome/gnc-plugin-register.h b/gnucash/gnome/gnc-plugin-register.h
index 7991d27335..db948bd97e 100644
--- a/gnucash/gnome/gnc-plugin-register.h
+++ b/gnucash/gnome/gnc-plugin-register.h
@@ -31,28 +31,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_REGISTER (gnc_plugin_register_get_type ())
-#define GNC_PLUGIN_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_REGISTER, GncPluginRegister))
-#define GNC_PLUGIN_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_REGISTER, GncPluginRegisterClass))
-#define GNC_IS_PLUGIN_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_REGISTER))
-#define GNC_IS_PLUGIN_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_REGISTER))
-#define GNC_PLUGIN_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_REGISTER, GncPluginRegisterClass))
+G_DECLARE_FINAL_TYPE (GncPluginRegister, gnc_plugin_register, GNC, PLUGIN_REGISTER, GncPlugin)
#define GNC_PLUGIN_REGISTER_NAME "gnc-plugin-register"
/* typedefs & structures */
-typedef struct
+struct _GncPluginRegister
{
GncPlugin gnc_plugin;
-} GncPluginRegister;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginRegisterClass;
+};
/* function prototypes */
-GType gnc_plugin_register_get_type (void);
-
GncPlugin *gnc_plugin_register_new (void);
G_END_DECLS
commit b0c7e19ab11466b60fa62711a8c4d7783109c455
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Sat May 20 14:24:15 2023 +0100
Refactor: DECLARE_FINAL GncPluginBusiness < GncPlugin
diff --git a/gnucash/gnome/gnc-plugin-business.h b/gnucash/gnome/gnc-plugin-business.h
index 73027cd58c..cc7a229531 100644
--- a/gnucash/gnome/gnc-plugin-business.h
+++ b/gnucash/gnome/gnc-plugin-business.h
@@ -33,27 +33,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_BUSINESS (gnc_plugin_business_get_type ())
-#define GNC_PLUGIN_BUSINESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_BUSINESS, GncPluginBusiness))
-#define GNC_PLUGIN_BUSINESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_BUSINESS, GncPluginBusinessClass))
-#define GNC_IS_PLUGIN_BUSINESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_BUSINESS))
-#define GNC_IS_PLUGIN_BUSINESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_BUSINESS))
-#define GNC_PLUGIN_BUSINESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_BUSINESS, GncPluginBusinessClass))
+G_DECLARE_FINAL_TYPE (GncPluginBusiness, gnc_plugin_business, GNC, PLUGIN_BUSINESS, GncPlugin)
#define GNC_PLUGIN_BUSINESS_NAME "gnc-plugin-business"
/* typedefs & structures */
-typedef struct
+struct _GncPluginBusiness
{
GncPlugin gnc_plugin;
-} GncPluginBusiness;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginBusinessClass;
+};
/* function prototypes */
-GType gnc_plugin_business_get_type (void);
GncPlugin *gnc_plugin_business_new (void);
commit 59e581ceed130aaaf311522e04e777f65b2d76ff
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Sat May 20 14:24:05 2023 +0100
Refactor: DECLARE_FINAL GncPluginBudget < GncPlugin
diff --git a/gnucash/gnome/gnc-plugin-budget.h b/gnucash/gnome/gnc-plugin-budget.h
index 8c62938add..c939db2e82 100644
--- a/gnucash/gnome/gnc-plugin-budget.h
+++ b/gnucash/gnome/gnc-plugin-budget.h
@@ -35,27 +35,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_BUDGET (gnc_plugin_budget_get_type ())
-#define GNC_PLUGIN_BUDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_BUDGET, GncPluginBudget))
-#define GNC_PLUGIN_BUDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_BUDGET, GncPluginBudgetClass))
-#define GNC_IS_PLUGIN_BUDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_BUDGET))
-#define GNC_IS_PLUGIN_BUDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_BUDGET))
-#define GNC_PLUGIN_BUDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_BUDGET, GncPluginBudgetClass))
+G_DECLARE_FINAL_TYPE (GncPluginBudget, gnc_plugin_budget, GNC, PLUGIN_BUDGET, GncPlugin)
#define GNC_PLUGIN_BUDGET_NAME "gnc-plugin-budget"
/* typedefs & structures */
-typedef struct
+struct _GncPluginBudget
{
GncPlugin gnc_plugin;
-} GncPluginBudget;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginBudgetClass;
+};
/* function prototypes */
-GType gnc_plugin_budget_get_type (void);
GncPlugin *gnc_plugin_budget_new (void);
/* Launch the budget list dialog.*/
commit 579ffa292ba1faab842548c4c0e30bfd7667e5bb
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Sat May 20 14:23:56 2023 +0100
Refactor: DECLARE_FINAL GncPluginBasicCommands < GncPlugin
diff --git a/gnucash/gnome/gnc-plugin-basic-commands.h b/gnucash/gnome/gnc-plugin-basic-commands.h
index f2315ad952..497f4569b3 100644
--- a/gnucash/gnome/gnc-plugin-basic-commands.h
+++ b/gnucash/gnome/gnc-plugin-basic-commands.h
@@ -41,38 +41,18 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_BASIC_COMMANDS (gnc_plugin_basic_commands_get_type ())
-#define GNC_PLUGIN_BASIC_COMMANDS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_BASIC_COMMANDS, GncPluginBasicCommands))
-#define GNC_PLUGIN_BASIC_COMMANDS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_BASIC_COMMANDS, GncPluginBasicCommandsClass))
-#define GNC_IS_PLUGIN_BASIC_COMMANDS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_BASIC_COMMANDS))
-#define GNC_IS_PLUGIN_BASIC_COMMANDS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_BASIC_COMMANDS))
-#define GNC_PLUGIN_BASIC_COMMANDS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_BASIC_COMMANDS, GncPluginBasicCommandsClass))
+G_DECLARE_FINAL_TYPE (GncPluginBasicCommands, gnc_plugin_basic_commands, GNC, PLUGIN_BASIC_COMMANDS, GncPlugin)
#define GNC_PLUGIN_BASIC_COMMANDS_NAME "gnc-plugin-basic-commands"
/* typedefs & structures */
/** The instance data structure for an basic commands menu plugin. */
-typedef struct
+struct _GncPluginBasicCommands
{
/** The parent object for this widget */
GncPlugin gnc_plugin;
-} GncPluginBasicCommands;
-
-
-/** The class data structure for a basic commands menu plugin. */
-typedef struct
-{
- /** The parent class for this widget. */
- GncPluginClass gnc_plugin;
-} GncPluginBasicCommandsClass;
-
-
-/** Get the type of the basic commands menu plugin.
- *
- * @return A GType.
- */
-GType gnc_plugin_basic_commands_get_type (void);
-
+};
/** Create a new basic commands menu plugin.
*
commit 939770e1b1a6b5c32196c4245dde1dbf3e7269b9
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Sat May 20 14:23:32 2023 +0100
Refactor: DECLARE_FINAL GncPluginAccountTree < GncPlugin
diff --git a/gnucash/gnome/gnc-plugin-account-tree.h b/gnucash/gnome/gnc-plugin-account-tree.h
index 4c1018cef7..f401141b79 100644
--- a/gnucash/gnome/gnc-plugin-account-tree.h
+++ b/gnucash/gnome/gnc-plugin-account-tree.h
@@ -42,37 +42,18 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_ACCOUNT_TREE (gnc_plugin_account_tree_get_type ())
-#define GNC_PLUGIN_ACCOUNT_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_ACCOUNT_TREE, GncPluginAccountTree))
-#define GNC_PLUGIN_ACCOUNT_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_ACCOUNT_TREE, GncPluginAccountTreeClass))
-#define GNC_IS_PLUGIN_ACCOUNT_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_ACCOUNT_TREE))
-#define GNC_IS_PLUGIN_ACCOUNT_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_ACCOUNT_TREE))
-#define GNC_PLUGIN_ACCOUNT_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_ACCOUNT_TREE, GncPluginAccountTreeClass))
+G_DECLARE_FINAL_TYPE (GncPluginAccountTree, gnc_plugin_account_tree, GNC, PLUGIN_ACCOUNT_TREE, GncPlugin)
#define GNC_PLUGIN_ACCOUNT_TREE_NAME "gnc-plugin-account-tree"
/* typedefs & structures */
/** The instance data structure for an account tree menu plugin. */
-typedef struct
+struct _GncPluginAccountTree
{
/** The parent object for this widget */
GncPlugin gnc_plugin;
-} GncPluginAccountTree;
-
-/** The class data structure for an account tree menu plugin. */
-typedef struct
-{
- /** The parent class for this widget. */
- GncPluginClass gnc_plugin;
-} GncPluginAccountTreeClass;
-
-
-/** Get the type of the account tree menu plugin.
- *
- * @return A GType.
- */
-GType gnc_plugin_account_tree_get_type (void);
-
+};
/** Create a new account tree menu plugin.
*
commit b715211b24ac1b5edeb3eec77a232877fd2742d3
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:37:23 2023 +0100
Refactor: DECLARE_FINAL GncPluginMenuAdditions < GncPlugin
diff --git a/gnucash/gnome-utils/gnc-plugin-menu-additions.h b/gnucash/gnome-utils/gnc-plugin-menu-additions.h
index 5ba45ceb5f..18d069e52c 100644
--- a/gnucash/gnome-utils/gnc-plugin-menu-additions.h
+++ b/gnucash/gnome-utils/gnc-plugin-menu-additions.h
@@ -44,35 +44,18 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_MENU_ADDITIONS (gnc_plugin_menu_additions_get_type ())
-#define GNC_PLUGIN_MENU_ADDITIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_MENU_ADDITIONS, GncPluginMenuAdditions))
-#define GNC_PLUGIN_MENU_ADDITIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_MENU_ADDITIONS, GncPluginMenuAdditionsClass))
-#define GNC_IS_PLUGIN_MENU_ADDITIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_MENU_ADDITIONS))
-#define GNC_IS_PLUGIN_MENU_ADDITIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_MENU_ADDITIONS))
-#define GNC_PLUGIN_MENU_ADDITIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_MENU_ADDITIONS, GncPluginMenuAdditionsClass))
+G_DECLARE_FINAL_TYPE (GncPluginMenuAdditions, gnc_plugin_menu_additions, GNC, PLUGIN_MENU_ADDITIONS, GncPlugin)
#define GNC_PLUGIN_MENU_ADDITIONS_NAME "gnc-plugin-menu-additions"
/* typedefs & structures */
-typedef struct
+struct _GncPluginMenuAdditions
{
GncPlugin gnc_plugin;
-} GncPluginMenuAdditions;
-
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginMenuAdditionsClass;
+};
/* function prototypes */
-
-/** Get the type of an extensions plugin.
- *
- * @return A GType.
- */
-GType gnc_plugin_menu_additions_get_type (void);
-
-
/** Create a new menu_additions plugin. This plugin attaches the menu
* items from Scheme code to any window that is opened.
*
commit b853a49b4e247b4655c9c470fb160aa6714b1917
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:36:50 2023 +0100
Refactor: DECLARE_FINAL GncPluginFileHistory < GncPlugin
diff --git a/gnucash/gnome-utils/gnc-plugin-file-history.h b/gnucash/gnome-utils/gnc-plugin-file-history.h
index 24a30a5a76..713d82935a 100644
--- a/gnucash/gnome-utils/gnc-plugin-file-history.h
+++ b/gnucash/gnome-utils/gnc-plugin-file-history.h
@@ -41,39 +41,21 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN_FILE_HISTORY (gnc_plugin_file_history_get_type ())
-#define GNC_PLUGIN_FILE_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_PLUGIN_FILE_HISTORY, GncPluginFileHistory))
-#define GNC_PLUGIN_FILE_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_FILE_HISTORY, GncPluginFileHistoryClass))
-#define GNC_IS_PLUGIN_FILE_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_PLUGIN_FILE_HISTORY))
-#define GNC_IS_PLUGIN_FILE_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_FILE_HISTORY))
-#define GNC_PLUGIN_FILE_HISTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_PLUGIN_FILE_HISTORY, GncPluginFileHistoryClass))
+G_DECLARE_FINAL_TYPE (GncPluginFileHistory, gnc_plugin_file_history, GNC, PLUGIN_FILE_HISTORY, GncPlugin)
#define GNC_PLUGIN_FILE_HISTORY_NAME "gnc-plugin-file-history"
/* typedefs & structures */
/** The instance data structure for a file history plugin. */
-typedef struct
+struct _GncPluginFileHistory
{
GncPlugin gnc_plugin;
-} GncPluginFileHistory;
+};
-/** The class data structure for a file history plugin. */
-typedef struct
-{
- GncPluginClass gnc_plugin;
-} GncPluginFileHistoryClass;
-
/* function prototypes */
-
-/** Get the type of a file history plugin.
- *
- * @return A GType.
- */
-GType gnc_plugin_file_history_get_type (void);
-
-
/** Create a new file history plugin. This plugin attaches the file
* history menu to any window that is opened.
*
commit 422b01a55e25b8bfb947a8e824223649b74bcc67
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Sat May 20 14:23:05 2023 +0100
Refactor: DECLARE_DERIVABLE GncPlugin < GObject
diff --git a/gnucash/gnome-utils/gnc-plugin.h b/gnucash/gnome-utils/gnc-plugin.h
index ab4619b86b..9d7fe5d8b1 100644
--- a/gnucash/gnome-utils/gnc-plugin.h
+++ b/gnucash/gnome-utils/gnc-plugin.h
@@ -86,25 +86,14 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_PLUGIN (gnc_plugin_get_type ())
-#define GNC_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PLUGIN, GncPlugin))
-#define GNC_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN, GncPluginClass))
-#define GNC_IS_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PLUGIN))
-#define GNC_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN))
-#define GNC_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_PLUGIN, GncPluginClass))
+G_DECLARE_DERIVABLE_TYPE (GncPlugin, gnc_plugin, GNC, PLUGIN, GObject)
#define GNC_PLUGIN_NAME "GncPlugin"
/* typedefs & structures */
-/** The instance data structure for a menu-only plugin. */
-typedef struct
-{
- /** The parent object for this widget */
- GObject gobject;
-} GncPlugin;
-
/** The class data structure for a menu-only plugin. */
-typedef struct
+struct _GncPluginClass
{
/** The parent class for this widget. */
GObjectClass gobject;
@@ -163,17 +152,10 @@ typedef struct
* window. */
void (* remove_from_window)
(GncPlugin *plugin, GncMainWindow *window, GQuark type);
-} GncPluginClass;
+};
/* function prototypes */
-/** Get the type of a menu-only plugin.
- *
- * @return A GType.
- */
-GType gnc_plugin_get_type (void);
-
-
/** Add the specified plugin to the specified window. This function
* will add the page's user interface from the window and call the
* plugin to perform any plugin specific actions.
commit 5ea2e4e78e5310c5739905f15ca7647b68061677
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Tue Jun 13 15:30:47 2023 +0100
Refactor: remove unnecessary GncTreeView*Private
diff --git a/gnucash/gnome-utils/gnc-tree-view-account.c b/gnucash/gnome-utils/gnc-tree-view-account.c
index f38ad518d5..3ffb885d1d 100644
--- a/gnucash/gnome-utils/gnc-tree-view-account.c
+++ b/gnucash/gnome-utils/gnc-tree-view-account.c
@@ -62,7 +62,7 @@ static void gnc_tree_view_account_finalize (GObject *object);
static gboolean gnc_tree_view_search_compare (GtkTreeModel *model, gint column,
const gchar *key, GtkTreeIter *iter, gpointer search_data);
-static void gtva_update_column_names (GncTreeView *view);
+static void gtva_update_column_names (GncTreeViewAccount *view);
static void gtva_currency_changed_cb (void);
static gboolean gnc_tree_view_account_filter_helper (GtkTreeModel *model,
@@ -97,10 +97,7 @@ struct _GncTreeViewAccount
{
GncTreeView gnc_tree_view;
int stamp;
-};
-typedef struct GncTreeViewAccountPrivate
-{
AccountViewInfo avi;
gnc_tree_view_account_filter_func filter_fn;
@@ -122,15 +119,12 @@ typedef struct GncTreeViewAccountPrivate
} GncTreeViewAccountPrivate;
-#define GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(o) \
- ((GncTreeViewAccountPrivate*)gnc_tree_view_account_get_instance_private((GncTreeViewAccount*)o))
-
/************************************************************/
/* g_object required functions */
/************************************************************/
-G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewAccount, gnc_tree_view_account, GNC_TYPE_TREE_VIEW)
+G_DEFINE_TYPE(GncTreeViewAccount, gnc_tree_view_account, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_account_class_init (GncTreeViewAccountClass *klass)
@@ -165,42 +159,33 @@ gnc_init_account_view_info(AccountViewInfo *avi)
static void
gnc_tree_view_account_init (GncTreeViewAccount *view)
{
- GncTreeViewAccountPrivate *priv;
-
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
-
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
GNC_PREF_ACCOUNT_COLOR,
gnc_tree_view_account_color_update,
view);
- gnc_init_account_view_info(&priv->avi);
+ gnc_init_account_view_info(&view->avi);
}
static void
gnc_tree_view_account_finalize (GObject *object)
{
- GncTreeViewAccount *account_view;
- GncTreeViewAccountPrivate *priv;
-
ENTER("view %p", object);
g_return_if_fail (object != NULL);
g_return_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (object));
- account_view = GNC_TREE_VIEW_ACCOUNT (object);
-
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
+ GncTreeViewAccount *view = GNC_TREE_VIEW_ACCOUNT (object);
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
GNC_PREF_ACCOUNT_COLOR,
gnc_tree_view_account_color_update,
- account_view);
- if (priv->filter_destroy)
+ view);
+ if (view->filter_destroy)
{
- priv->filter_destroy(priv->filter_data);
- priv->filter_destroy = NULL;
+ view->filter_destroy(view->filter_data);
+ view->filter_destroy = NULL;
}
- priv->filter_fn = NULL;
+ view->filter_fn = NULL;
G_OBJECT_CLASS (gnc_tree_view_account_parent_class)->finalize (object);
LEAVE(" ");
@@ -669,9 +654,8 @@ acc_color_data_func (GtkTreeViewColumn *col,
GtkCellRenderer *renderer,
GtkTreeModel *model,
GtkTreeIter *iter,
- gpointer view)
+ gpointer data)
{
- GncTreeViewAccountPrivate *priv;
gchar *acc_color = NULL, *acc_cond_color = NULL;
gchar *item;
GdkRGBA color;
@@ -698,8 +682,8 @@ acc_color_data_func (GtkTreeViewColumn *col,
/* Determine whether columns other than the
* Account Color column should be colored. */
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
- if (priv->show_account_color)
+ GncTreeViewAccount *view = data;
+ if (view->show_account_color)
acc_cond_color = acc_color;
column_name = g_object_get_data(G_OBJECT(col), PREF_NAME);
@@ -723,14 +707,12 @@ acc_color_data_func (GtkTreeViewColumn *col,
static void
gnc_tree_view_account_color_update (gpointer gsettings, gchar *key, gpointer user_data)
{
- GncTreeViewAccountPrivate *priv;
GncTreeViewAccount *view;
g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(user_data));
view = user_data;
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
if (g_strcmp0 (key, GNC_PREF_ACCOUNT_COLOR) == 0)
- priv->show_account_color = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, key);
+ view->show_account_color = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, key);
// do a refilter so the tree view background color gets updated
gnc_tree_view_account_refilter (view);
@@ -761,25 +743,21 @@ gnc_tree_view_account_column_add_color (GncTreeViewAccount *view, GtkTreeViewCol
GtkTreeView *
gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
{
- GncTreeView *view;
GtkTreeModel *model, *f_model, *s_model;
GtkTreePath *virtual_root_path = NULL;
const gchar *sample_type, *sample_commodity;
- GncTreeViewAccountPrivate *priv;
GtkTreeViewColumn *tax_info_column, *acc_color_column, *acc_balance_limit_column;
GtkCellRenderer *renderer;
GList *col_list = NULL, *node = NULL;
ENTER(" ");
/* Create our view */
- view = g_object_new (GNC_TYPE_TREE_VIEW_ACCOUNT,
- "has-tooltip", true,
- "name", "gnc-id-account-tree", NULL);
-
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(GNC_TREE_VIEW_ACCOUNT (view));
+ GncTreeViewAccount *view = g_object_new (GNC_TYPE_TREE_VIEW_ACCOUNT,
+ "has-tooltip", true,
+ "name", "gnc-id-account-tree", NULL);
/* Get the show_account_color value from gsettings */
- priv->show_account_color = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_COLOR);
+ view->show_account_color = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_ACCOUNT_COLOR);
/* Create/get a pointer to the existing model for this set of books. */
model = gnc_tree_model_account_new (root);
@@ -806,140 +784,140 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
sample_type = xaccAccountGetTypeStr(ACCT_TYPE_CREDIT);
sample_commodity = gnc_commodity_get_fullname(gnc_default_currency());
- priv->name_column
- = gnc_tree_view_add_text_column(view, _("Account Name"), "name",
+ view->name_column
+ = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Account Name"), "name",
GNC_ICON_ACCOUNT, "Expenses:Entertainment",
GNC_TREE_MODEL_ACCOUNT_COL_NAME,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Type"), "type", NULL, sample_type,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Type"), "type", NULL, sample_type,
GNC_TREE_MODEL_ACCOUNT_COL_TYPE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Commodity"), "commodity", NULL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Commodity"), "commodity", NULL,
sample_commodity,
GNC_TREE_MODEL_ACCOUNT_COL_COMMODITY,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- priv->code_column
- = gnc_tree_view_add_text_column(view, _("Account Code"), "account-code", NULL,
+ view->code_column
+ = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Account Code"), "account-code", NULL,
"1-123-1234",
GNC_TREE_MODEL_ACCOUNT_COL_CODE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_code);
- priv->desc_column
- = gnc_tree_view_add_text_column(view, _("Description"), "description", NULL,
+ view->desc_column
+ = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Description"), "description", NULL,
"Sample account description.",
GNC_TREE_MODEL_ACCOUNT_COL_DESCRIPTION,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_numeric_column(view, _("Last Num"), "lastnum", "12345",
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Last Num"), "lastnum", "12345",
GNC_TREE_MODEL_ACCOUNT_COL_LASTNUM,
GNC_TREE_VIEW_COLUMN_COLOR_NONE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_numeric_column(view, _("Present"), "present",
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Present"), "present",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_PRESENT,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_present_value);
- priv->present_report_column
- = gnc_tree_view_add_numeric_column(view, _("Present (Report)"), "present_report",
+ view->present_report_column
+ = gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Present (Report)"), "present_report",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_PRESENT_REPORT,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_PRESENT,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_present_value);
- gnc_tree_view_add_numeric_column(view, _("Balance"), "balance",
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Balance"), "balance",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_BALANCE,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_balance_value);
- priv->balance_report_column
- = gnc_tree_view_add_numeric_column(view, _("Balance (Report)"), "balance_report",
+ view->balance_report_column
+ = gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Balance (Report)"), "balance_report",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_REPORT,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_balance_value);
- gnc_tree_view_add_numeric_column(view, _("Balance (Period)"), "balance-period",
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Balance (Period)"), "balance-period",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_BALANCE_PERIOD,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_BALANCE_PERIOD,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_balance_period_value);
- gnc_tree_view_add_numeric_column(view, _("Cleared"), "cleared",
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Cleared"), "cleared",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_CLEARED,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_cleared_value);
- priv->cleared_report_column
- = gnc_tree_view_add_numeric_column(view, _("Cleared (Report)"), "cleared_report",
+ view->cleared_report_column
+ = gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Cleared (Report)"), "cleared_report",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_CLEARED_REPORT,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_CLEARED,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_cleared_value);
- gnc_tree_view_add_numeric_column(view, _("Reconciled"), "reconciled",
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Reconciled"), "reconciled",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_reconciled_value);
- priv->reconciled_report_column
- = gnc_tree_view_add_numeric_column(view, _("Reconciled (Report)"), "reconciled_report",
+ view->reconciled_report_column
+ = gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Reconciled (Report)"), "reconciled_report",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_REPORT,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_reconciled_value);
- gnc_tree_view_add_text_column(view, _("Last Reconcile Date"), "last-recon-date", NULL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Last Reconcile Date"), "last-recon-date", NULL,
"Last Reconcile Date",
GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_DATE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_last_reconcile_date);
- gnc_tree_view_add_numeric_column(view, _("Future Minimum"), "future_min",
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Future Minimum"), "future_min",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_future_min_value);
- priv->future_min_report_column
- = gnc_tree_view_add_numeric_column(view, _("Future Minimum (Report)"), "future_min_report",
+ view->future_min_report_column
+ = gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Future Minimum (Report)"), "future_min_report",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_FUTURE_MIN_REPORT,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_FUTURE_MIN,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_future_min_value);
- gnc_tree_view_add_numeric_column(view, _("Total"), "total",
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Total"), "total",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_TOTAL,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_total_value);
- priv->total_report_column
- = gnc_tree_view_add_numeric_column(view, _("Total (Report)"), "total_report",
+ view->total_report_column
+ = gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Total (Report)"), "total_report",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_REPORT,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_total_value);
- gnc_tree_view_add_numeric_column(view, _("Total (Period)"), "total-period",
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Total (Period)"), "total-period",
SAMPLE_ACCOUNT_VALUE,
GNC_TREE_MODEL_ACCOUNT_COL_TOTAL_PERIOD,
GNC_TREE_MODEL_ACCOUNT_COL_COLOR_TOTAL_PERIOD,
@@ -948,7 +926,7 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
/* Translators: The C is the column title and stands for Color, this should be one character */
acc_color_column
- = gnc_tree_view_add_text_column(view, C_("Column header for 'Color'", "C"), "account-color", NULL,
+ = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), C_("Column header for 'Color'", "C"), "account-color", NULL,
"xx",
GNC_TREE_VIEW_COLUMN_DATA_NONE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
@@ -962,7 +940,7 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (acc_color_column), _("Account Color"));
acc_balance_limit_column
- = gnc_tree_view_add_pix_column (view,
+ = gnc_tree_view_add_pix_column (GNC_TREE_VIEW(view),
C_("Column header for 'Balance Limit'", "L"),
"account-balance-limit",
"xx",
@@ -977,15 +955,15 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
/* Also add the full title to the column header as a tooltip */
gtk_widget_set_tooltip_text (gtk_tree_view_column_get_button (acc_balance_limit_column), _("Balance Limit"));
- priv->notes_column
- = gnc_tree_view_add_text_view_column(view, _("Notes"), "notes", NULL,
+ view->notes_column
+ = gnc_tree_view_add_text_view_column(GNC_TREE_VIEW(view), _("Notes"), "notes", NULL,
"Sample account notes.",
GNC_TREE_MODEL_ACCOUNT_COL_NOTES,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
tax_info_column
- = gnc_tree_view_add_text_column(view, _("Tax Info"), "tax-info", NULL,
+ = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Tax Info"), "tax-info", NULL,
"Sample tax info.",
GNC_TREE_MODEL_ACCOUNT_COL_TAX_INFO,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
@@ -998,7 +976,7 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
GTK_TREE_VIEW(view),
NULL);
- gnc_tree_view_add_toggle_column (view, _("Hidden"),
+ gnc_tree_view_add_toggle_column (GNC_TREE_VIEW(view), _("Hidden"),
C_("Column header for 'Hidden'", "H"),
"hidden",
GNC_TREE_MODEL_ACCOUNT_COL_HIDDEN,
@@ -1006,7 +984,7 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
sort_by_hidden,
gnc_tree_view_account_hidden_toggled);
- gnc_tree_view_add_toggle_column(view, _("Placeholder"),
+ gnc_tree_view_add_toggle_column(GNC_TREE_VIEW(view), _("Placeholder"),
C_("Column header for 'Placeholder'", "P"),
"placeholder",
GNC_TREE_MODEL_ACCOUNT_COL_PLACEHOLDER,
@@ -1014,7 +992,7 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
sort_by_placeholder,
gnc_tree_view_account_placeholder_toggled);
- gnc_tree_view_add_toggle_column(view, _("Opening Balance"),
+ gnc_tree_view_add_toggle_column(GNC_TREE_VIEW(view), _("Opening Balance"),
C_("Column header for 'Opening Balance'", "O"),
"opening-balance",
GNC_TREE_MODEL_ACCOUNT_COL_OPENING_BALANCE,
@@ -1039,7 +1017,7 @@ gnc_tree_view_account_new_with_root (Account *root, gboolean show_root)
gtva_update_column_names(view);
/* By default only the first column is visible. */
- gnc_tree_view_configure_columns(view);
+ gnc_tree_view_configure_columns(GNC_TREE_VIEW(view));
gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
gnc_tree_view_account_filter_helper,
view,
@@ -1212,17 +1190,13 @@ gnc_tree_view_account_clear_model_cache (GncTreeViewAccount *view)
* specified tree.
*/
void
-gnc_tree_view_account_get_view_info (GncTreeViewAccount *account_view,
+gnc_tree_view_account_get_view_info (GncTreeViewAccount *view,
AccountViewInfo *avi)
{
- GncTreeViewAccountPrivate *priv;
-
- g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
+ g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
g_return_if_fail(avi != NULL);
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
-
- *avi = priv->avi;
+ *avi = view->avi;
}
/*
@@ -1230,21 +1204,18 @@ gnc_tree_view_account_get_view_info (GncTreeViewAccount *account_view,
* match the callers request.
*/
void
-gnc_tree_view_account_set_view_info (GncTreeViewAccount *account_view,
+gnc_tree_view_account_set_view_info (GncTreeViewAccount *view,
AccountViewInfo *avi)
{
- GncTreeViewAccountPrivate *priv;
-
- ENTER("%p", account_view);
- g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(account_view));
+ ENTER("%p", view);
+ g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
g_return_if_fail(avi != NULL);
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(account_view);
- priv->avi = *avi;
+ view->avi = *avi;
gnc_tree_view_account_set_filter(
- account_view, gnc_tree_view_account_filter_by_view_info,
- &priv->avi, NULL);
+ view, gnc_tree_view_account_filter_by_view_info,
+ &view->avi, NULL);
LEAVE(" ");
}
@@ -1256,7 +1227,6 @@ gnc_tree_view_account_filter_helper (GtkTreeModel *model,
{
Account *account;
GncTreeViewAccount *view = data;
- GncTreeViewAccountPrivate *priv;
g_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
@@ -1264,9 +1234,8 @@ gnc_tree_view_account_filter_helper (GtkTreeModel *model,
account = gnc_tree_model_account_get_account (
GNC_TREE_MODEL_ACCOUNT(model), iter);
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
- if (priv->filter_fn)
- return priv->filter_fn(account, priv->filter_data);
+ if (view->filter_fn)
+ return view->filter_fn(account, view->filter_data);
else return TRUE;
}
@@ -1283,21 +1252,18 @@ gnc_tree_view_account_set_filter (GncTreeViewAccount *view,
gpointer data,
GSourceFunc destroy)
{
- GncTreeViewAccountPrivate *priv;
-
ENTER("view %p, filter func %p, data %p, destroy %p",
view, func, data, destroy);
g_return_if_fail(GNC_IS_TREE_VIEW_ACCOUNT(view));
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
- if (priv->filter_destroy)
+ if (view->filter_destroy)
{
- priv->filter_destroy(priv->filter_data);
+ view->filter_destroy(view->filter_data);
}
- priv->filter_destroy = destroy;
- priv->filter_data = data;
- priv->filter_fn = func;
+ view->filter_destroy = destroy;
+ view->filter_data = data;
+ view->filter_fn = func;
gnc_tree_view_account_refilter(view);
LEAVE(" ");
@@ -1534,7 +1500,7 @@ gnc_tree_view_account_set_selected_account (GncTreeViewAccount *view,
typedef struct
{
GList* return_list;
- GncTreeViewAccountPrivate* priv;
+ GncTreeViewAccount* view;
} GncTreeViewSelectionInfo;
/*
@@ -1562,7 +1528,7 @@ get_selected_accounts_helper (GtkTreeModel *s_model,
account = iter.user_data;
/* Only selected if it passes the filter */
- if (gtvsi->priv->filter_fn == NULL || gtvsi->priv->filter_fn(account, gtvsi->priv->filter_data))
+ if (gtvsi->view->filter_fn == NULL || gtvsi->view->filter_fn(account, gtvsi->view->filter_data))
{
gtvsi->return_list = g_list_prepend (gtvsi->return_list, account);
}
@@ -1584,7 +1550,6 @@ gnc_tree_view_account_get_selected_accounts (GncTreeViewAccount *view)
g_return_val_if_fail (GNC_IS_TREE_VIEW_ACCOUNT (view), NULL);
info.return_list = NULL;
- info.priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
gtk_tree_selection_selected_foreach(selection, get_selected_accounts_helper, &info);
info.return_list = g_list_reverse (info.return_list);
@@ -1813,34 +1778,30 @@ gtva_update_column_name (GtkTreeViewColumn *column,
static void
-gtva_update_column_names (GncTreeView *view)
+gtva_update_column_names (GncTreeViewAccount *view)
{
- GncTreeViewAccountPrivate *priv;
- const gchar *mnemonic;
-
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
- mnemonic = gnc_commodity_get_mnemonic(gnc_default_report_currency());
+ const gchar *mnemonic = gnc_commodity_get_mnemonic(gnc_default_report_currency());
- gtva_update_column_name(priv->present_report_column,
+ gtva_update_column_name(view->present_report_column,
/* Translators: %s is a currency mnemonic.*/
_("Present (%s)"), mnemonic);
- gtva_update_column_name(priv->balance_report_column,
+ gtva_update_column_name(view->balance_report_column,
/* Translators: %s is a currency mnemonic.*/
_("Balance (%s)"), mnemonic);
- gtva_update_column_name(priv->cleared_report_column,
+ gtva_update_column_name(view->cleared_report_column,
/* Translators: %s is a currency mnemonic.*/
_("Cleared (%s)"), mnemonic);
- gtva_update_column_name(priv->reconciled_report_column,
+ gtva_update_column_name(view->reconciled_report_column,
/* Translators: %s is a currency mnemonic.*/
_("Reconciled (%s)"), mnemonic);
- gtva_update_column_name(priv->future_min_report_column,
+ gtva_update_column_name(view->future_min_report_column,
/* Translators: %s is a currency mnemonic.*/
_("Future Minimum (%s)"), mnemonic);
- gtva_update_column_name(priv->total_report_column,
+ gtva_update_column_name(view->total_report_column,
/* Translators: %s is a currency mnemonic.*/
_("Total (%s)"), mnemonic);
- gnc_tree_view_set_show_column_menu(view, FALSE);
- gnc_tree_view_set_show_column_menu(view, TRUE);
+ gnc_tree_view_set_show_column_menu(GNC_TREE_VIEW(view), FALSE);
+ gnc_tree_view_set_show_column_menu(GNC_TREE_VIEW(view), TRUE);
}
@@ -2794,36 +2755,28 @@ void
gnc_tree_view_account_set_name_edited(GncTreeViewAccount *view,
GncTreeViewAccountColumnTextEdited edited_cb)
{
- GncTreeViewAccountPrivate *priv;
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
- gtva_set_column_editor(view, priv->name_column, edited_cb);
+ gtva_set_column_editor(view, view->name_column, edited_cb);
}
void
gnc_tree_view_account_set_code_edited(GncTreeViewAccount *view,
GncTreeViewAccountColumnTextEdited edited_cb)
{
- GncTreeViewAccountPrivate *priv;
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
- gtva_set_column_editor(view, priv->code_column, edited_cb);
+ gtva_set_column_editor(view, view->code_column, edited_cb);
}
void
gnc_tree_view_account_set_description_edited(GncTreeViewAccount *view,
GncTreeViewAccountColumnTextEdited edited_cb)
{
- GncTreeViewAccountPrivate *priv;
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
- gtva_set_column_editor(view, priv->desc_column, edited_cb);
+ gtva_set_column_editor(view, view->desc_column, edited_cb);
}
void
gnc_tree_view_account_set_notes_edited(GncTreeViewAccount *view,
GncTreeViewAccountColumnTextEdited edited_cb)
{
- GncTreeViewAccountPrivate *priv;
- priv = GNC_TREE_VIEW_ACCOUNT_GET_PRIVATE(view);
- gtva_set_column_editor(view, priv->notes_column, edited_cb);
+ gtva_set_column_editor(view, view->notes_column, edited_cb);
}
static
diff --git a/gnucash/gnome-utils/gnc-tree-view-commodity.c b/gnucash/gnome-utils/gnc-tree-view-commodity.c
index 880394ec7d..b3c6f78010 100644
--- a/gnucash/gnome-utils/gnc-tree-view-commodity.c
+++ b/gnucash/gnome-utils/gnc-tree-view-commodity.c
@@ -56,20 +56,11 @@ struct _GncTreeViewCommodity
int stamp;
};
-typedef struct GncTreeViewCommodityPrivate
-{
- gpointer dummy;
-} GncTreeViewCommodityPrivate;
-
-#define GNC_TREE_VIEW_COMMODITY_GET_PRIVATE(o) \
- ((GncTreeViewCommodityPrivate*)gnc_tree_view_commodity_get_instance_private(GncTreeViewCommodity*)o))
-
-
/************************************************************/
/* g_object required functions */
/************************************************************/
-G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewCommodity, gnc_tree_view_commodity, GNC_TYPE_TREE_VIEW)
+G_DEFINE_TYPE(GncTreeViewCommodity, gnc_tree_view_commodity, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_commodity_class_init (GncTreeViewCommodityClass *klass)
diff --git a/gnucash/gnome-utils/gnc-tree-view-owner.c b/gnucash/gnome-utils/gnc-tree-view-owner.c
index 866c310812..d1b1762845 100644
--- a/gnucash/gnome-utils/gnc-tree-view-owner.c
+++ b/gnucash/gnome-utils/gnc-tree-view-owner.c
@@ -56,7 +56,7 @@ static QofLogModule log_module = GNC_MOD_GUI;
/** Declarations *********************************************************/
static void gnc_tree_view_owner_finalize (GObject *object);
-static void gtvo_update_column_names (GncTreeView *view);
+static void gtvo_update_column_names (GncTreeViewOwner *view);
static void gtvo_currency_changed_cb (void);
static gboolean gnc_tree_view_owner_filter_helper (GtkTreeModel *model,
@@ -74,10 +74,7 @@ struct _GncTreeViewOwner
{
GncTreeView gnc_tree_view;
int stamp;
-};
-typedef struct GncTreeViewOwnerPrivate
-{
OwnerViewInfo ovi;
gnc_tree_view_owner_filter_func filter_fn;
@@ -88,17 +85,14 @@ typedef struct GncTreeViewOwnerPrivate
GtkTreeViewColumn *id_column;
GtkTreeViewColumn *balance_report_column;
GtkTreeViewColumn *notes_column;
-} GncTreeViewOwnerPrivate;
-
-#define GNC_TREE_VIEW_OWNER_GET_PRIVATE(o) \
- ((GncTreeViewOwnerPrivate*)gnc_tree_view_owner_get_instance_private((GncTreeViewOwner*)o))
+};
/************************************************************/
/* g_object required functions */
/************************************************************/
-G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewOwner, gnc_tree_view_owner, GNC_TYPE_TREE_VIEW)
+G_DEFINE_TYPE(GncTreeViewOwner, gnc_tree_view_owner, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_owner_class_init (GncTreeViewOwnerClass *klass)
@@ -129,31 +123,24 @@ gnc_init_owner_view_info(OwnerViewInfo *ovi)
static void
gnc_tree_view_owner_init (GncTreeViewOwner *view)
{
- GncTreeViewOwnerPrivate *priv;
-
- priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(view);
- gnc_init_owner_view_info(&priv->ovi);
+ gnc_init_owner_view_info(&view->ovi);
}
static void
gnc_tree_view_owner_finalize (GObject *object)
{
- GncTreeViewOwner *owner_view;
- GncTreeViewOwnerPrivate *priv;
-
ENTER("view %p", object);
g_return_if_fail (object != NULL);
g_return_if_fail (GNC_IS_TREE_VIEW_OWNER (object));
- owner_view = GNC_TREE_VIEW_OWNER (object);
+ GncTreeViewOwner *view = GNC_TREE_VIEW_OWNER (object);
- priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(owner_view);
- if (priv->filter_destroy)
+ if (view->filter_destroy)
{
- priv->filter_destroy(priv->filter_data);
- priv->filter_destroy = NULL;
+ view->filter_destroy(view->filter_data);
+ view->filter_destroy = NULL;
}
- priv->filter_fn = NULL;
+ view->filter_fn = NULL;
G_OBJECT_CLASS (gnc_tree_view_owner_parent_class)->finalize (object);
LEAVE(" ");
@@ -331,11 +318,9 @@ sort_by_balance_value (GtkTreeModel *f_model,
GtkTreeView *
gnc_tree_view_owner_new (GncOwnerType owner_type)
{
- GncTreeView *view;
GtkTreeModel *model, *f_model, *s_model;
const gchar *sample_type, *sample_currency;
const gchar *owner_name = NULL, * owner_id = NULL;
- GncTreeViewOwnerPrivate *priv;
ENTER(" ");
@@ -365,10 +350,8 @@ gnc_tree_view_owner_new (GncOwnerType owner_type)
break;
}
/* Create our view */
- view = g_object_new (GNC_TYPE_TREE_VIEW_OWNER,
- "name", "gnc-id-owner-tree", NULL);
-
- priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(GNC_TREE_VIEW_OWNER (view));
+ GncTreeViewOwner *view = g_object_new (GNC_TYPE_TREE_VIEW_OWNER,
+ "name", "gnc-id-owner-tree", NULL);
/* Create/get a pointer to the existing model for this set of books. */
model = gnc_tree_model_owner_new (owner_type);
@@ -391,90 +374,90 @@ gnc_tree_view_owner_new (GncOwnerType owner_type)
sample_type = gncOwnerTypeToQofIdType (GNC_OWNER_CUSTOMER);
sample_currency = gnc_commodity_get_fullname(gnc_default_currency());
- priv->name_column
- = gnc_tree_view_add_text_column(view, owner_name, GNC_OWNER_TREE_NAME_COL,
+ view->name_column
+ = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), owner_name, GNC_OWNER_TREE_NAME_COL,
NULL, "GnuCash Inc.",
GNC_TREE_MODEL_OWNER_COL_NAME,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Type"), GNC_OWNER_TREE_TYPE_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Type"), GNC_OWNER_TREE_TYPE_COL,
NULL, sample_type,
GNC_TREE_MODEL_OWNER_COL_TYPE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- priv->id_column
- = gnc_tree_view_add_text_column(view, owner_id, GNC_OWNER_TREE_ID_COL,
+ view->id_column
+ = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), owner_id, GNC_OWNER_TREE_ID_COL,
NULL, "1-123-1234",
GNC_TREE_MODEL_OWNER_COL_ID,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Currency"), GNC_OWNER_TREE_CURRENCY_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Currency"), GNC_OWNER_TREE_CURRENCY_COL,
NULL, sample_currency,
GNC_TREE_MODEL_OWNER_COL_CURRENCY,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Address Name"), GNC_OWNER_TREE_ADDRESS_NAME_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Address Name"), GNC_OWNER_TREE_ADDRESS_NAME_COL,
NULL, "GnuCash Inc.",
GNC_TREE_MODEL_OWNER_COL_ADDRESS_NAME,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Address 1"), GNC_OWNER_TREE_ADDRESS_1_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Address 1"), GNC_OWNER_TREE_ADDRESS_1_COL,
NULL, "Free Software Foundation",
GNC_TREE_MODEL_OWNER_COL_ADDRESS_1,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Address 2"), GNC_OWNER_TREE_ADDRESS_2_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Address 2"), GNC_OWNER_TREE_ADDRESS_2_COL,
NULL, "51 Franklin Street, Fifth Floor",
GNC_TREE_MODEL_OWNER_COL_ADDRESS_2,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Address 3"), GNC_OWNER_TREE_ADDRESS_3_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Address 3"), GNC_OWNER_TREE_ADDRESS_3_COL,
NULL, "Boston, MA 02110-1301",
GNC_TREE_MODEL_OWNER_COL_ADDRESS_3,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Address 4"), GNC_OWNER_TREE_ADDRESS_4_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Address 4"), GNC_OWNER_TREE_ADDRESS_4_COL,
NULL, "USA",
GNC_TREE_MODEL_OWNER_COL_ADDRESS_4,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Phone"), GNC_OWNER_TREE_PHONE_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Phone"), GNC_OWNER_TREE_PHONE_COL,
NULL, "+1-617-542-5942",
GNC_TREE_MODEL_OWNER_COL_PHONE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("Fax"), GNC_OWNER_TREE_FAX_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Fax"), GNC_OWNER_TREE_FAX_COL,
NULL, "+1-617-542-2652",
GNC_TREE_MODEL_OWNER_COL_FAX,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_text_column(view, _("E-mail"), GNC_OWNER_TREE_EMAIL_COL,
+ gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("E-mail"), GNC_OWNER_TREE_EMAIL_COL,
NULL, "gnu at gnu.org",
GNC_TREE_MODEL_OWNER_COL_EMAIL,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_numeric_column(view, _("Balance"), GNC_OWNER_TREE_BALANCE_COL,
+ gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Balance"), GNC_OWNER_TREE_BALANCE_COL,
SAMPLE_OWNER_VALUE,
GNC_TREE_MODEL_OWNER_COL_BALANCE,
GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_balance_value);
- priv->balance_report_column
- = gnc_tree_view_add_numeric_column(view, _("Balance"), GNC_OWNER_TREE_BALANCE_REPORT_COL,
+ view->balance_report_column
+ = gnc_tree_view_add_numeric_column(GNC_TREE_VIEW(view), _("Balance"), GNC_OWNER_TREE_BALANCE_REPORT_COL,
SAMPLE_OWNER_VALUE,
GNC_TREE_MODEL_OWNER_COL_BALANCE_REPORT,
GNC_TREE_MODEL_OWNER_COL_COLOR_BALANCE,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_balance_value);
- priv->notes_column
- = gnc_tree_view_add_text_column(view, _("Notes"), GNC_OWNER_TREE_NOTES_COL, NULL,
+ view->notes_column
+ = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Notes"), GNC_OWNER_TREE_NOTES_COL, NULL,
"Sample owner notes.",
GNC_TREE_MODEL_OWNER_COL_NOTES,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
sort_by_string);
- gnc_tree_view_add_toggle_column (view, _("Active"),
+ gnc_tree_view_add_toggle_column (GNC_TREE_VIEW(view), _("Active"),
C_("Column letter for 'Active'", "A"),
GNC_OWNER_TREE_ACTIVE_COL,
GNC_TREE_MODEL_OWNER_COL_ACTIVE,
@@ -486,7 +469,7 @@ gnc_tree_view_owner_new (GncOwnerType owner_type)
gtvo_update_column_names(view);
/* By default only the first column is visible. */
- gnc_tree_view_configure_columns(view);
+ gnc_tree_view_configure_columns(GNC_TREE_VIEW(view));
gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (f_model),
gnc_tree_view_owner_filter_helper,
view,
@@ -601,7 +584,6 @@ gnc_tree_view_owner_filter_helper (GtkTreeModel *model,
{
GncOwner *owner;
GncTreeViewOwner *view = data;
- GncTreeViewOwnerPrivate *priv;
g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
@@ -609,9 +591,8 @@ gnc_tree_view_owner_filter_helper (GtkTreeModel *model,
owner = gnc_tree_model_owner_get_owner (
GNC_TREE_MODEL_OWNER(model), iter);
- priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(view);
- if (priv->filter_fn)
- return priv->filter_fn(owner, priv->filter_data);
+ if (view->filter_fn)
+ return view->filter_fn(owner, view->filter_data);
else return TRUE;
}
@@ -628,21 +609,18 @@ gnc_tree_view_owner_set_filter (GncTreeViewOwner *view,
gpointer data,
GSourceFunc destroy)
{
- GncTreeViewOwnerPrivate *priv;
-
ENTER("view %p, filter func %p, data %p, destroy %p",
view, func, data, destroy);
g_return_if_fail(GNC_IS_TREE_VIEW_OWNER(view));
- priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(view);
- if (priv->filter_destroy)
+ if (view->filter_destroy)
{
- priv->filter_destroy(priv->filter_data);
+ view->filter_destroy(view->filter_data);
}
- priv->filter_destroy = destroy;
- priv->filter_data = data;
- priv->filter_fn = func;
+ view->filter_destroy = destroy;
+ view->filter_data = data;
+ view->filter_fn = func;
gnc_tree_view_owner_refilter(view);
LEAVE(" ");
@@ -854,7 +832,7 @@ gnc_tree_view_owner_set_selected_owner (GncTreeViewOwner *view,
typedef struct
{
GList* return_list;
- GncTreeViewOwnerPrivate* priv;
+ GncTreeViewOwner* view;
} GncTreeViewSelectionInfo;
#if 0 /* Not Used */
@@ -883,7 +861,7 @@ get_selected_owners_helper (GtkTreeModel *s_model,
owner = iter.user_data;
/* Only selected if it passes the filter */
- if (gtvsi->priv->filter_fn == NULL || gtvsi->priv->filter_fn(owner, gtvsi->priv->filter_data))
+ if (gtvsi->view->filter_fn == NULL || gtvsi->view->filter_fn(owner, gtvsi->view->filter_data))
{
gtvsi->return_list = g_list_append(gtvsi->return_list, owner);
}
@@ -910,19 +888,15 @@ gtvo_update_column_name (GtkTreeViewColumn *column,
static void
-gtvo_update_column_names (GncTreeView *view)
+gtvo_update_column_names (GncTreeViewOwner *view)
{
- GncTreeViewOwnerPrivate *priv;
- const gchar *mnemonic;
-
- priv = GNC_TREE_VIEW_OWNER_GET_PRIVATE(view);
- mnemonic = gnc_commodity_get_mnemonic(gnc_default_report_currency());
+ const gchar *mnemonic = gnc_commodity_get_mnemonic(gnc_default_report_currency());
- gtvo_update_column_name(priv->balance_report_column,
+ gtvo_update_column_name(view->balance_report_column,
/* Translators: %s is a currency mnemonic.*/
_("Balance (%s)"), mnemonic);
- gnc_tree_view_set_show_column_menu(view, FALSE);
- gnc_tree_view_set_show_column_menu(view, TRUE);
+ gnc_tree_view_set_show_column_menu(GNC_TREE_VIEW(view), FALSE);
+ gnc_tree_view_set_show_column_menu(GNC_TREE_VIEW(view), TRUE);
}
diff --git a/gnucash/gnome-utils/gnc-tree-view-price.c b/gnucash/gnome-utils/gnc-tree-view-price.c
index 70e2448be6..96e22ea77f 100644
--- a/gnucash/gnome-utils/gnc-tree-view-price.c
+++ b/gnucash/gnome-utils/gnc-tree-view-price.c
@@ -56,20 +56,12 @@ struct _GncTreeViewPrice
int stamp;
};
-typedef struct GncTreeViewPricePrivate
-{
- gpointer dummy;
-} GncTreeViewPricePrivate;
-
-#define GNC_TREE_VIEW_PRICE_GET_PRIVATE(o) \
- ((GncTreeViewPricePrivate*)gnc_tree_view_price_get_instance_private((GncTreeViewPrice*)o))
-
/************************************************************/
/* g_object required functions */
/************************************************************/
-G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewPrice, gnc_tree_view_price, GNC_TYPE_TREE_VIEW)
+G_DEFINE_TYPE(GncTreeViewPrice, gnc_tree_view_price, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_price_class_init (GncTreeViewPriceClass *klass)
diff --git a/gnucash/gnome-utils/gnc-tree-view-sx-list.c b/gnucash/gnome-utils/gnc-tree-view-sx-list.c
index 0779873ccc..8e1f429815 100644
--- a/gnucash/gnome-utils/gnc-tree-view-sx-list.c
+++ b/gnucash/gnome-utils/gnc-tree-view-sx-list.c
@@ -53,18 +53,12 @@ static void gnc_tree_view_sx_list_finalize(GObject *object);
struct _GncTreeViewSxList
{
GncTreeView gnc_tree_view;
-};
-typedef struct GncTreeViewSxListPrivate
-{
GtkTreeModel *tree_model;
gboolean disposed;
-} GncTreeViewSxListPrivate;
-
-#define GNC_TREE_VIEW_SX_LIST_GET_PRIVATE(o) \
- ((GncTreeViewSxListPrivate*)gnc_tree_view_sx_list_get_instance_private((GncTreeViewSxList*)o))
+};
-G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewSxList, gnc_tree_view_sx_list, GNC_TYPE_TREE_VIEW)
+G_DEFINE_TYPE(GncTreeViewSxList, gnc_tree_view_sx_list, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_sx_list_class_init(GncTreeViewSxListClass *klass)
@@ -88,20 +82,18 @@ static void
gnc_tree_view_sx_list_dispose(GObject *object)
{
GncTreeViewSxList *view;
- GncTreeViewSxListPrivate *priv;
gnc_leave_return_if_fail (object != NULL);
gnc_leave_return_if_fail (GNC_IS_TREE_VIEW_SX_LIST (object));
view = GNC_TREE_VIEW_SX_LIST (object);
- priv = GNC_TREE_VIEW_SX_LIST_GET_PRIVATE(view);
- if (priv->disposed)
+ if (view->disposed)
return;
- priv->disposed = TRUE;
+ view->disposed = TRUE;
- g_object_unref(G_OBJECT(priv->tree_model));
- priv->tree_model = NULL;
+ g_object_unref(G_OBJECT(view->tree_model));
+ view->tree_model = NULL;
G_OBJECT_CLASS (gnc_tree_view_sx_list_parent_class)->dispose (object);
}
@@ -118,46 +110,40 @@ gnc_tree_view_sx_list_finalize(GObject *object)
GtkTreeView*
gnc_tree_view_sx_list_new(GncSxInstanceModel *sx_instances)
{
- GncTreeView *view;
- GtkTreeViewColumn *col;
- GncTreeViewSxListPrivate *priv;
-
- view = (GncTreeView*)g_object_new(GNC_TYPE_TREE_VIEW_SX_LIST, NULL);
+ GncTreeViewSxList *view = (GncTreeViewSxList*)g_object_new(GNC_TYPE_TREE_VIEW_SX_LIST, NULL);
g_object_set(view, "name", "gnc-id-sx-list-tree", NULL);
- priv = GNC_TREE_VIEW_SX_LIST_GET_PRIVATE(view);
-
- priv->tree_model = GTK_TREE_MODEL(gnc_sx_list_tree_model_adapter_new(sx_instances));
- gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL(priv->tree_model));
+ view->tree_model = GTK_TREE_MODEL(gnc_sx_list_tree_model_adapter_new(sx_instances));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL(view->tree_model));
- col = gnc_tree_view_add_text_column(view, _("Name"), "name", NULL,
+ GtkTreeViewColumn *col = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Name"), "name", NULL,
"Semi-Monthly Paycheck",
SXLTMA_COL_NAME, -1, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
- col = gnc_tree_view_add_toggle_column(view, _("Enabled"),
+ col = gnc_tree_view_add_toggle_column(GNC_TREE_VIEW(view), _("Enabled"),
C_("Single-character short column-title form of 'Enabled'", "E"),
"enabled", SXLTMA_COL_ENABLED,
GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
NULL, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
- col = gnc_tree_view_add_text_column(view, _("Frequency"), "frequency", NULL,
+ col = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Frequency"), "frequency", NULL,
"Weekly (x3): -------",
SXLTMA_COL_FREQUENCY, -1, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
- col = gnc_tree_view_add_text_column(view, _("Last Occur"), "last-occur", NULL,
+ col = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Last Occur"), "last-occur", NULL,
"2007-01-02",
SXLTMA_COL_LAST_OCCUR, -1, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
- col = gnc_tree_view_add_text_column(view, _("Next Occur"), "next-occur", NULL,
+ col = gnc_tree_view_add_text_column(GNC_TREE_VIEW(view), _("Next Occur"), "next-occur", NULL,
"2007-01-02",
SXLTMA_COL_NEXT_OCCUR, -1, NULL);
g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
- gnc_tree_view_configure_columns(view);
+ gnc_tree_view_configure_columns(GNC_TREE_VIEW(view));
gtk_widget_show(GTK_WIDGET(view));
return GTK_TREE_VIEW(view);
@@ -167,8 +153,7 @@ SchedXaction*
gnc_tree_view_sx_list_get_sx_from_path(GncTreeViewSxList *view, GtkTreePath *path)
{
GtkTreeIter iter;
- GncTreeViewSxListPrivate *priv = GNC_TREE_VIEW_SX_LIST_GET_PRIVATE(view);
- gtk_tree_model_get_iter(GTK_TREE_MODEL(priv->tree_model), &iter, path);
+ gtk_tree_model_get_iter(GTK_TREE_MODEL(view->tree_model), &iter, path);
return gnc_sx_list_tree_model_adapter_get_sx_instances(
- GNC_SX_LIST_TREE_MODEL_ADAPTER(priv->tree_model), &iter)->sx;
+ GNC_SX_LIST_TREE_MODEL_ADAPTER(view->tree_model), &iter)->sx;
}
commit 20673d97ce5757cb99302e1c94a21f93b141d0f8
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Tue Jun 13 14:28:12 2023 +0100
Refactor: hide implementation of GncTreeView* (move from .h -> .c)
diff --git a/gnucash/gnome-utils/gnc-tree-view-account.c b/gnucash/gnome-utils/gnc-tree-view-account.c
index 1d54241e5a..f38ad518d5 100644
--- a/gnucash/gnome-utils/gnc-tree-view-account.c
+++ b/gnucash/gnome-utils/gnc-tree-view-account.c
@@ -93,6 +93,12 @@ static gboolean
gnc_tree_view_tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard_tip,
GtkTooltip *tooltip, gpointer user_data);
+struct _GncTreeViewAccount
+{
+ GncTreeView gnc_tree_view;
+ int stamp;
+};
+
typedef struct GncTreeViewAccountPrivate
{
AccountViewInfo avi;
diff --git a/gnucash/gnome-utils/gnc-tree-view-account.h b/gnucash/gnome-utils/gnc-tree-view-account.h
index 38ae73daee..9a2fa35d09 100644
--- a/gnucash/gnome-utils/gnc-tree-view-account.h
+++ b/gnucash/gnome-utils/gnc-tree-view-account.h
@@ -59,12 +59,6 @@ struct AccountViewInfo_s
};
-struct _GncTreeViewAccount
-{
- GncTreeView gnc_tree_view;
- int stamp;
-};
-
typedef struct
{
GtkWidget *dialog;
diff --git a/gnucash/gnome-utils/gnc-tree-view-commodity.c b/gnucash/gnome-utils/gnc-tree-view-commodity.c
index 4a49647154..880394ec7d 100644
--- a/gnucash/gnome-utils/gnc-tree-view-commodity.c
+++ b/gnucash/gnome-utils/gnc-tree-view-commodity.c
@@ -50,6 +50,12 @@ static QofLogModule log_module = GNC_MOD_GUI;
static void gnc_tree_view_commodity_finalize (GObject *object);
static void gnc_tree_view_commodity_destroy (GtkWidget *widget);
+struct _GncTreeViewCommodity
+{
+ GncTreeView gnc_tree_view;
+ int stamp;
+};
+
typedef struct GncTreeViewCommodityPrivate
{
gpointer dummy;
diff --git a/gnucash/gnome-utils/gnc-tree-view-commodity.h b/gnucash/gnome-utils/gnc-tree-view-commodity.h
index c758c8bc8f..26643abbdd 100644
--- a/gnucash/gnome-utils/gnc-tree-view-commodity.h
+++ b/gnucash/gnome-utils/gnc-tree-view-commodity.h
@@ -46,13 +46,6 @@ G_BEGIN_DECLS
#define GNC_TYPE_TREE_VIEW_COMMODITY (gnc_tree_view_commodity_get_type ())
G_DECLARE_FINAL_TYPE (GncTreeViewCommodity, gnc_tree_view_commodity, GNC, TREE_VIEW_COMMODITY, GncTreeView)
-/* typedefs & structures */
-struct _GncTreeViewCommodity
-{
- GncTreeView gnc_tree_view;
- int stamp;
-};
-
/** @name Commodity Tree View Constructors
@{ */
diff --git a/gnucash/gnome-utils/gnc-tree-view-owner.c b/gnucash/gnome-utils/gnc-tree-view-owner.c
index f8a805ff51..866c310812 100644
--- a/gnucash/gnome-utils/gnc-tree-view-owner.c
+++ b/gnucash/gnome-utils/gnc-tree-view-owner.c
@@ -70,6 +70,12 @@ static void gtvo_setup_column_renderer_edited_cb(GncTreeViewOwner *owner_view,
GncTreeViewOwnerColumnTextEdited col_edited_cb);
#endif /* Not Used */
+struct _GncTreeViewOwner
+{
+ GncTreeView gnc_tree_view;
+ int stamp;
+};
+
typedef struct GncTreeViewOwnerPrivate
{
OwnerViewInfo ovi;
diff --git a/gnucash/gnome-utils/gnc-tree-view-owner.h b/gnucash/gnome-utils/gnc-tree-view-owner.h
index 312365b94e..9f78d0ca94 100644
--- a/gnucash/gnome-utils/gnc-tree-view-owner.h
+++ b/gnucash/gnome-utils/gnc-tree-view-owner.h
@@ -59,12 +59,6 @@ struct OwnerViewInfo_s
};
-struct _GncTreeViewOwner
-{
- GncTreeView gnc_tree_view;
- int stamp;
-};
-
typedef struct
{
GtkWidget *dialog;
diff --git a/gnucash/gnome-utils/gnc-tree-view-price.c b/gnucash/gnome-utils/gnc-tree-view-price.c
index 886c777767..70e2448be6 100644
--- a/gnucash/gnome-utils/gnc-tree-view-price.c
+++ b/gnucash/gnome-utils/gnc-tree-view-price.c
@@ -50,6 +50,12 @@ static QofLogModule log_module = GNC_MOD_GUI;
static void gnc_tree_view_price_finalize (GObject *object);
static void gnc_tree_view_price_destroy (GtkWidget *widget);
+struct _GncTreeViewPrice
+{
+ GncTreeView gnc_tree_view;
+ int stamp;
+};
+
typedef struct GncTreeViewPricePrivate
{
gpointer dummy;
diff --git a/gnucash/gnome-utils/gnc-tree-view-price.h b/gnucash/gnome-utils/gnc-tree-view-price.h
index 47f3c38138..f9d9b7c04c 100644
--- a/gnucash/gnome-utils/gnc-tree-view-price.h
+++ b/gnucash/gnome-utils/gnc-tree-view-price.h
@@ -46,13 +46,6 @@ G_BEGIN_DECLS
#define GNC_TYPE_TREE_VIEW_PRICE (gnc_tree_view_price_get_type ())
G_DECLARE_FINAL_TYPE (GncTreeViewPrice, gnc_tree_view_price, GNC, TREE_VIEW_PRICE, GncTreeView)
-/* typedefs & structures */
-struct _GncTreeViewPrice
-{
- GncTreeView gnc_tree_view;
- int stamp;
-};
-
/** @name Price Tree View Constructors
@{ */
diff --git a/gnucash/gnome-utils/gnc-tree-view-sx-list.c b/gnucash/gnome-utils/gnc-tree-view-sx-list.c
index 673af2353e..0779873ccc 100644
--- a/gnucash/gnome-utils/gnc-tree-view-sx-list.c
+++ b/gnucash/gnome-utils/gnc-tree-view-sx-list.c
@@ -50,6 +50,11 @@ static QofLogModule log_module = LOG_MOD;
static void gnc_tree_view_sx_list_dispose(GObject *object);
static void gnc_tree_view_sx_list_finalize(GObject *object);
+struct _GncTreeViewSxList
+{
+ GncTreeView gnc_tree_view;
+};
+
typedef struct GncTreeViewSxListPrivate
{
GtkTreeModel *tree_model;
diff --git a/gnucash/gnome-utils/gnc-tree-view-sx-list.h b/gnucash/gnome-utils/gnc-tree-view-sx-list.h
index 6319e64db7..970b4c7098 100644
--- a/gnucash/gnome-utils/gnc-tree-view-sx-list.h
+++ b/gnucash/gnome-utils/gnc-tree-view-sx-list.h
@@ -40,11 +40,6 @@ G_BEGIN_DECLS
#define GNC_TYPE_TREE_VIEW_SX_LIST (gnc_tree_view_sx_list_get_type ())
G_DECLARE_FINAL_TYPE (GncTreeViewSxList, gnc_tree_view_sx_list, GNC, TREE_VIEW_SX_LIST, GncTreeView)
-struct _GncTreeViewSxList
-{
- GncTreeView gnc_tree_view;
-};
-
GtkTreeView* gnc_tree_view_sx_list_new(GncSxInstanceModel *sx_instances);
SchedXaction* gnc_tree_view_sx_list_get_sx_from_path(GncTreeViewSxList *view, GtkTreePath *path);
commit aeab1953b055c5cdf67e7dd66067aa59fb6b7029
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:45:40 2023 +0100
Refactor: DECLARE_FINAL GncTreeViewSxList < GncTreeView
diff --git a/gnucash/gnome-utils/gnc-tree-view-sx-list.h b/gnucash/gnome-utils/gnc-tree-view-sx-list.h
index 573ba35760..6319e64db7 100644
--- a/gnucash/gnome-utils/gnc-tree-view-sx-list.h
+++ b/gnucash/gnome-utils/gnc-tree-view-sx-list.h
@@ -38,23 +38,12 @@
G_BEGIN_DECLS
#define GNC_TYPE_TREE_VIEW_SX_LIST (gnc_tree_view_sx_list_get_type ())
-#define GNC_TREE_VIEW_SX_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxList))
-#define GNC_TREE_VIEW_SX_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxListClass))
-#define GNC_IS_TREE_VIEW_SX_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_SX_LIST))
-#define GNC_IS_TREE_VIEW_SX_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_SX_LIST))
-#define GNC_TREE_VIEW_SX_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_SX_LIST, GncTreeViewSxListClass))
+G_DECLARE_FINAL_TYPE (GncTreeViewSxList, gnc_tree_view_sx_list, GNC, TREE_VIEW_SX_LIST, GncTreeView)
-typedef struct
+struct _GncTreeViewSxList
{
GncTreeView gnc_tree_view;
-} GncTreeViewSxList;
-
-typedef struct
-{
- GncTreeViewClass gnc_tree_view;
-} GncTreeViewSxListClass;
-
-GType gnc_tree_view_sx_list_get_type(void);
+};
GtkTreeView* gnc_tree_view_sx_list_new(GncSxInstanceModel *sx_instances);
commit 1ca98da8f201039a9e4be6cf39f4bbe45917363c
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:45:11 2023 +0100
Refactor: DECLARE_FINAL GncTreeViewPrice < GncTreeView
diff --git a/gnucash/gnome-utils/gnc-tree-view-price.h b/gnucash/gnome-utils/gnc-tree-view-price.h
index 740a2c2600..47f3c38138 100644
--- a/gnucash/gnome-utils/gnc-tree-view-price.h
+++ b/gnucash/gnome-utils/gnc-tree-view-price.h
@@ -44,29 +44,14 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_VIEW_PRICE (gnc_tree_view_price_get_type ())
-#define GNC_TREE_VIEW_PRICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_PRICE, GncTreeViewPrice))
-#define GNC_TREE_VIEW_PRICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_PRICE, GncTreeViewPriceClass))
-#define GNC_IS_TREE_VIEW_PRICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_PRICE))
-#define GNC_IS_TREE_VIEW_PRICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_PRICE))
-#define GNC_TREE_VIEW_PRICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_PRICE, GncTreeViewPriceClass))
+G_DECLARE_FINAL_TYPE (GncTreeViewPrice, gnc_tree_view_price, GNC, TREE_VIEW_PRICE, GncTreeView)
/* typedefs & structures */
-typedef struct
+struct _GncTreeViewPrice
{
GncTreeView gnc_tree_view;
int stamp;
-} GncTreeViewPrice;
-
-typedef struct
-{
- GncTreeViewClass gnc_tree_view;
-} GncTreeViewPriceClass;
-
-
-
-/* Standard g_object type */
-GType gnc_tree_view_price_get_type (void);
-
+};
/** @name Price Tree View Constructors
@{ */
commit cb1313b08e0952b9ea0d87795deb1c2d904c5973
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:44:46 2023 +0100
Refactor: DECLARE_FINAL GncTreeViewOwner < GncTreeView
diff --git a/gnucash/gnome-utils/gnc-tree-view-owner.h b/gnucash/gnome-utils/gnc-tree-view-owner.h
index a0c213ad1a..312365b94e 100644
--- a/gnucash/gnome-utils/gnc-tree-view-owner.h
+++ b/gnucash/gnome-utils/gnc-tree-view-owner.h
@@ -45,11 +45,8 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_VIEW_OWNER (gnc_tree_view_owner_get_type ())
-#define GNC_TREE_VIEW_OWNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_OWNER, GncTreeViewOwner))
-#define GNC_TREE_VIEW_OWNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_OWNER, GncTreeViewOwnerClass))
-#define GNC_IS_TREE_VIEW_OWNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_OWNER))
-#define GNC_IS_TREE_VIEW_OWNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_OWNER))
-#define GNC_TREE_VIEW_OWNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_OWNER, GncTreeViewOwnerClass))
+G_DECLARE_FINAL_TYPE (GncTreeViewOwner, gnc_tree_view_owner, GNC, TREE_VIEW_OWNER, GncTreeView)
+
#define GNC_TREE_VIEW_OWNER_NAME "GncTreeViewOwner"
/* typedefs & structures */
@@ -62,16 +59,11 @@ struct OwnerViewInfo_s
};
-typedef struct
+struct _GncTreeViewOwner
{
GncTreeView gnc_tree_view;
int stamp;
-} GncTreeViewOwner;
-
-typedef struct
-{
- GncTreeViewClass gnc_tree_view;
-} GncTreeViewOwnerClass;
+};
typedef struct
{
@@ -127,10 +119,6 @@ void gnc_tree_view_owner_restore(GncTreeViewOwner *view,
GncOwnerType owner_type);
-/* Get the GType for an GncTreeViewOwner object. */
-GType gnc_tree_view_owner_get_type (void);
-
-
/** @name Owner Tree View Constructor
@{ */
commit 16118c4f2f6dbbf5a50f84cf3c9424aa5e31c088
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:44:22 2023 +0100
Refactor: DECLARE_FINAL GncTreeViewCommodity < GncTreeView
diff --git a/gnucash/gnome-utils/gnc-tree-view-commodity.h b/gnucash/gnome-utils/gnc-tree-view-commodity.h
index 1f7e80bb50..c758c8bc8f 100644
--- a/gnucash/gnome-utils/gnc-tree-view-commodity.h
+++ b/gnucash/gnome-utils/gnc-tree-view-commodity.h
@@ -44,29 +44,14 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_VIEW_COMMODITY (gnc_tree_view_commodity_get_type ())
-#define GNC_TREE_VIEW_COMMODITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_COMMODITY, GncTreeViewCommodity))
-#define GNC_TREE_VIEW_COMMODITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_COMMODITY, GncTreeViewCommodityClass))
-#define GNC_IS_TREE_VIEW_COMMODITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_COMMODITY))
-#define GNC_IS_TREE_VIEW_COMMODITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_COMMODITY))
-#define GNC_TREE_VIEW_COMMODITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_COMMODITY, GncTreeViewCommodityClass))
+G_DECLARE_FINAL_TYPE (GncTreeViewCommodity, gnc_tree_view_commodity, GNC, TREE_VIEW_COMMODITY, GncTreeView)
/* typedefs & structures */
-typedef struct
+struct _GncTreeViewCommodity
{
GncTreeView gnc_tree_view;
int stamp;
-} GncTreeViewCommodity;
-
-typedef struct
-{
- GncTreeViewClass gnc_tree_view;
-} GncTreeViewCommodityClass;
-
-
-
-/* Get the GType for an GncTreeViewCommodity object. */
-GType gnc_tree_view_commodity_get_type (void);
-
+};
/** @name Commodity Tree View Constructors
@{ */
commit 3e6ca813d94fc9746ef75de1029be8c34353ccb1
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:43:48 2023 +0100
Refactor: DECLARE_FINAL GncTreeViewAccount < GncTreeView
diff --git a/gnucash/gnome-utils/gnc-tree-view-account.h b/gnucash/gnome-utils/gnc-tree-view-account.h
index a4241585b6..38ae73daee 100644
--- a/gnucash/gnome-utils/gnc-tree-view-account.h
+++ b/gnucash/gnome-utils/gnc-tree-view-account.h
@@ -44,11 +44,8 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_VIEW_ACCOUNT (gnc_tree_view_account_get_type ())
-#define GNC_TREE_VIEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccount))
-#define GNC_TREE_VIEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccountClass))
-#define GNC_IS_TREE_VIEW_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT))
-#define GNC_IS_TREE_VIEW_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW_ACCOUNT))
-#define GNC_TREE_VIEW_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW_ACCOUNT, GncTreeViewAccountClass))
+G_DECLARE_FINAL_TYPE (GncTreeViewAccount, gnc_tree_view_account, GNC, TREE_VIEW_ACCOUNT, GncTreeView)
+
#define GNC_TREE_VIEW_ACCOUNT_NAME "GncTreeViewAccount"
/* typedefs & structures */
@@ -62,16 +59,11 @@ struct AccountViewInfo_s
};
-typedef struct
+struct _GncTreeViewAccount
{
GncTreeView gnc_tree_view;
int stamp;
-} GncTreeViewAccount;
-
-typedef struct
-{
- GncTreeViewClass gnc_tree_view;
-} GncTreeViewAccountClass;
+};
typedef struct
{
commit b0fa510972f6d1a27cbdd8e815b46e564c76f6fb
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:46:35 2023 +0100
Refactor: DECLARE_DERIVABLE GncTreeView < GtkTreeView
diff --git a/gnucash/gnome-utils/gnc-tree-view.h b/gnucash/gnome-utils/gnc-tree-view.h
index 16040bc447..294bec6a4a 100644
--- a/gnucash/gnome-utils/gnc-tree-view.h
+++ b/gnucash/gnome-utils/gnc-tree-view.h
@@ -38,28 +38,16 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_VIEW (gnc_tree_view_get_type ())
-#define GNC_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_VIEW, GncTreeView))
-#define GNC_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_VIEW, GncTreeViewClass))
-#define GNC_IS_TREE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_VIEW))
-#define GNC_IS_TREE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_VIEW))
-#define GNC_TREE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_VIEW, GncTreeViewClass))
+G_DECLARE_DERIVABLE_TYPE (GncTreeView, gnc_tree_view, GNC, TREE_VIEW, GtkTreeView)
+
#define GNC_TREE_VIEW_NAME "GncTreeView"
/* typedefs & structures */
-typedef struct
-{
- GtkTreeView gtk_tree_view;
-} GncTreeView;
-
-typedef struct
+struct _GncTreeViewClass
{
GtkTreeViewClass gtk_tree_view;
-} GncTreeViewClass;
-
-/* Standard g_object type */
-GType gnc_tree_view_get_type (void);
-
+};
/* The columns managed by gnc-tree-view can use the following column
attributes. Set them with:
commit c87f9db9ef2ed5ddd1cb06d4b151b31fb2867933
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Tue Jun 13 13:04:59 2023 +0100
Refactor: remove unnecessary GncTreeModel*Private
diff --git a/gnucash/gnome-utils/gnc-tree-model-account-types.c b/gnucash/gnome-utils/gnc-tree-model-account-types.c
index 7fb1bb9933..b420095e7b 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account-types.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account-types.c
@@ -50,18 +50,11 @@ struct _GncTreeModelAccountTypes
{
GObject gobject;
int stamp;
-};
-typedef struct GncTreeModelAccountTypesPrivate
-{
guint32 selected;
-} GncTreeModelAccountTypesPrivate;
-
-#define GNC_TREE_MODEL_ACCOUNT_TYPES_GET_PRIVATE(o) \
- ((GncTreeModelAccountTypesPrivate*)gnc_tree_model_account_types_get_instance_private((GncTreeModelAccountTypes*)o))
+};
G_DEFINE_TYPE_WITH_CODE(GncTreeModelAccountTypes, gnc_tree_model_account_types, G_TYPE_OBJECT,
- G_ADD_PRIVATE(GncTreeModelAccountTypes)
G_IMPLEMENT_INTERFACE(GTK_TYPE_TREE_MODEL,
gnc_tree_model_account_types_tree_model_init))
@@ -94,12 +87,8 @@ gnc_tree_model_account_types_finalize (GObject * object)
GtkTreeModel *
gnc_tree_model_account_types_new (guint32 selected)
{
- GncTreeModelAccountTypes *model;
- GncTreeModelAccountTypesPrivate *priv;
-
- model = g_object_new (GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES, NULL);
- priv = GNC_TREE_MODEL_ACCOUNT_TYPES_GET_PRIVATE(model);
- priv->selected = selected;
+ GncTreeModelAccountTypes *model = g_object_new (GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES, NULL);
+ model->selected = selected;
return GTK_TREE_MODEL (model);
}
@@ -413,13 +402,11 @@ gnc_tree_model_account_types_get_value (GtkTreeModel * tree_model,
GValue * value)
{
GncTreeModelAccountTypes *model = GNC_TREE_MODEL_ACCOUNT_TYPES(tree_model);
- GncTreeModelAccountTypesPrivate *priv;
g_return_if_fail (GNC_IS_TREE_MODEL_ACCOUNT_TYPES (model));
g_return_if_fail (iter != NULL);
g_return_if_fail (iter->stamp == model->stamp);
- priv = GNC_TREE_MODEL_ACCOUNT_TYPES_GET_PRIVATE(model);
switch (column)
{
case GNC_TREE_MODEL_ACCOUNT_TYPES_COL_TYPE:
@@ -433,7 +420,7 @@ gnc_tree_model_account_types_get_value (GtkTreeModel * tree_model,
break;
case GNC_TREE_MODEL_ACCOUNT_TYPES_COL_SELECTED:
g_value_init (value, G_TYPE_BOOLEAN);
- g_value_set_boolean (value, priv->selected &
+ g_value_set_boolean (value, model->selected &
(1 << GPOINTER_TO_INT (iter->user_data)));
break;
default:
diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
index bd3ad98625..d190249578 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account.c
@@ -96,11 +96,6 @@ struct _GncTreeModelAccount
GncTreeModel gnc_tree_model; /**< The parent object data. */
int stamp; /**< The state of the model. Any state
* change increments this number. */
-};
-
-/** The instance private data for an account tree model. */
-typedef struct GncTreeModelAccountPrivate
-{
QofBook *book;
Account *root;
gint event_handler_id;
@@ -108,18 +103,13 @@ typedef struct GncTreeModelAccountPrivate
GHashTable *account_values_hash;
-} GncTreeModelAccountPrivate;
+};
G_DEFINE_TYPE_WITH_CODE (GncTreeModelAccount,
gnc_tree_model_account, GNC_TYPE_TREE_MODEL,
- G_ADD_PRIVATE (GncTreeModelAccount)
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL,
gnc_tree_model_account_tree_model_init))
-#define GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(o) \
- ((GncTreeModelAccountPrivate*)gnc_tree_model_account_get_instance_private((GncTreeModelAccount*)o))
-
-
/************************************************************/
/* Account Tree Model - Misc Functions */
/************************************************************/
@@ -134,28 +124,25 @@ G_DEFINE_TYPE_WITH_CODE (GncTreeModelAccount,
static void
gnc_tree_model_account_update_color (gpointer gsettings, gchar *key, gpointer user_data)
{
- GncTreeModelAccountPrivate *priv;
- GncTreeModelAccount *model;
gboolean use_red;
g_return_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(user_data));
- model = user_data;
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
+ GncTreeModelAccount *model = user_data;
// destroy/recreate the cached account value hash to force update
- g_hash_table_destroy (priv->account_values_hash);
- priv->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_hash_table_destroy (model->account_values_hash);
+ model->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
use_red = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
- if (priv->negative_color)
- g_free (priv->negative_color);
+ if (model->negative_color)
+ g_free (model->negative_color);
if (use_red)
- priv->negative_color = gnc_get_negative_color ();
+ model->negative_color = gnc_get_negative_color ();
else
- priv->negative_color = NULL;
+ model->negative_color = NULL;
}
/************************************************************/
@@ -177,7 +164,6 @@ gnc_tree_model_account_class_init (GncTreeModelAccountClass *klass)
static void
gnc_tree_model_account_init (GncTreeModelAccount *model)
{
- GncTreeModelAccountPrivate *priv;
gboolean use_red;
ENTER("model %p", model);
@@ -188,20 +174,19 @@ gnc_tree_model_account_init (GncTreeModelAccount *model)
use_red = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
- priv->book = NULL;
- priv->root = NULL;
+ model->book = NULL;
+ model->root = NULL;
- if (priv->negative_color)
- g_free (priv->negative_color);
+ if (model->negative_color)
+ g_free (model->negative_color);
if (use_red)
- priv->negative_color = gnc_get_negative_color ();
+ model->negative_color = gnc_get_negative_color ();
else
- priv->negative_color = NULL;
+ model->negative_color = NULL;
// create the account values cache hash
- priv->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
+ model->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
@@ -214,7 +199,6 @@ gnc_tree_model_account_init (GncTreeModelAccount *model)
static void
gnc_tree_model_account_finalize (GObject *object)
{
- GncTreeModelAccountPrivate *priv;
GncTreeModelAccount *model;
g_return_if_fail (object != NULL);
@@ -223,9 +207,8 @@ gnc_tree_model_account_finalize (GObject *object)
ENTER("model %p", object);
model = GNC_TREE_MODEL_ACCOUNT(object);
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
- priv->book = NULL;
+ model->book = NULL;
G_OBJECT_CLASS(gnc_tree_model_account_parent_class)->finalize (object);
LEAVE(" ");
@@ -234,7 +217,6 @@ gnc_tree_model_account_finalize (GObject *object)
static void
gnc_tree_model_account_dispose (GObject *object)
{
- GncTreeModelAccountPrivate *priv;
GncTreeModelAccount *model;
g_return_if_fail (object != NULL);
@@ -243,19 +225,18 @@ gnc_tree_model_account_dispose (GObject *object)
ENTER("model %p", object);
model = GNC_TREE_MODEL_ACCOUNT(object);
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
- if (priv->event_handler_id)
+ if (model->event_handler_id)
{
- qof_event_unregister_handler (priv->event_handler_id);
- priv->event_handler_id = 0;
+ qof_event_unregister_handler (model->event_handler_id);
+ model->event_handler_id = 0;
}
- if (priv->negative_color)
- g_free (priv->negative_color);
+ if (model->negative_color)
+ g_free (model->negative_color);
// destroy the cached account values
- g_hash_table_destroy (priv->account_values_hash);
+ g_hash_table_destroy (model->account_values_hash);
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
gnc_tree_model_account_update_color,
@@ -274,7 +255,6 @@ GtkTreeModel *
gnc_tree_model_account_new (Account *root)
{
GncTreeModelAccount *model;
- GncTreeModelAccountPrivate *priv;
const GList *item;
ENTER("root %p", root);
@@ -282,8 +262,7 @@ gnc_tree_model_account_new (Account *root)
for ( ; item; item = g_list_next (item))
{
model = (GncTreeModelAccount *)item->data;
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
- if (priv->root == root)
+ if (model->root == root)
{
g_object_ref (G_OBJECT(model));
LEAVE("returning existing model %p", model);
@@ -293,11 +272,10 @@ gnc_tree_model_account_new (Account *root)
model = g_object_new (GNC_TYPE_TREE_MODEL_ACCOUNT, NULL);
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
- priv->book = gnc_get_current_book();
- priv->root = root;
+ model->book = gnc_get_current_book();
+ model->root = root;
- priv->event_handler_id = qof_event_register_handler
+ model->event_handler_id = qof_event_register_handler
((QofEventHandler)gnc_tree_model_account_event_handler, model);
LEAVE("model %p", model);
@@ -437,7 +415,6 @@ gnc_tree_model_account_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path)
{
- GncTreeModelAccountPrivate *priv;
GncTreeModelAccount *model;
Account *account, *parent;
gint i, *indices;
@@ -451,7 +428,6 @@ gnc_tree_model_account_get_iter (GtkTreeModel *tree_model,
}
model = GNC_TREE_MODEL_ACCOUNT(tree_model);
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
if (gtk_tree_path_get_depth (path) <= 0)
{
@@ -467,7 +443,7 @@ gnc_tree_model_account_get_iter (GtkTreeModel *tree_model,
}
parent = NULL;
- account = priv->root;
+ account = model->root;
for (i = 1; i < gtk_tree_path_get_depth (path); i++)
{
parent = account;
@@ -494,7 +470,6 @@ gnc_tree_model_account_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelAccount *model = GNC_TREE_MODEL_ACCOUNT(tree_model);
- GncTreeModelAccountPrivate *priv;
Account *account, *parent;
GtkTreePath *path;
gint i;
@@ -506,8 +481,7 @@ gnc_tree_model_account_get_path (GtkTreeModel *tree_model,
ENTER("model %p, iter %s", model, iter_to_string (iter));
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
- if (priv->root == NULL)
+ if (model->root == NULL)
{
LEAVE("failed (1)");
return NULL;
@@ -547,11 +521,8 @@ gnc_tree_model_account_set_color (GncTreeModelAccount *model,
gboolean negative,
GValue *value)
{
- GncTreeModelAccountPrivate *priv;
-
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
if (negative)
- g_value_set_static_string (value, priv->negative_color);
+ g_value_set_static_string (value, model->negative_color);
else
g_value_set_static_string (value, NULL);
}
@@ -562,7 +533,6 @@ gnc_tree_model_account_compute_period_balance (GncTreeModelAccount *model,
gboolean recurse,
gboolean *negative)
{
- GncTreeModelAccountPrivate *priv;
GNCPrintAmountInfo print_info;
time64 t1, t2;
gnc_numeric b3;
@@ -570,8 +540,7 @@ gnc_tree_model_account_compute_period_balance (GncTreeModelAccount *model,
if (negative)
*negative = FALSE;
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
- if (acct == priv->root)
+ if (acct == model->root)
return g_strdup ("");
t1 = gnc_accounting_period_fiscal_start ();
@@ -605,11 +574,9 @@ gnc_tree_model_account_clear_cache (GncTreeModelAccount *model)
{
if (model)
{
- GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
-
// destroy the cached account values and recreate
- g_hash_table_destroy (priv->account_values_hash);
- priv->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_hash_table_destroy (model->account_values_hash);
+ model->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
gtk_tree_model_foreach (GTK_TREE_MODEL(model), row_changed_foreach_func, NULL);
@@ -649,20 +616,19 @@ clear_account_cached_values (GncTreeModelAccount *model, GHashTable *hash, Accou
static void
gnc_tree_model_account_clear_cached_values (GncTreeModelAccount *model, Account *account)
{
- GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
Account *parent;
// no hash table or account, return
- if ((!priv->account_values_hash) || (!account))
+ if ((!model->account_values_hash) || (!account))
return;
- clear_account_cached_values (model, priv->account_values_hash, account);
+ clear_account_cached_values (model, model->account_values_hash, account);
parent = gnc_account_get_parent (account);
// clear also all parent accounts, this will update any balances/totals
while (parent)
{
- clear_account_cached_values (model, priv->account_values_hash, parent);
+ clear_account_cached_values (model, model->account_values_hash, parent);
parent = gnc_account_get_parent (parent);
}
}
@@ -671,19 +637,18 @@ static gboolean
gnc_tree_model_account_get_cached_value (GncTreeModelAccount *model, Account *account,
gint column, gchar **cached_string)
{
- GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
gchar acct_guid_str[GUID_ENCODING_LENGTH + 1];
gchar *key = NULL;
gpointer value;
gboolean found;
- if ((!priv->account_values_hash) || (!account))
+ if ((!model->account_values_hash) || (!account))
return FALSE;
guid_to_string_buff (xaccAccountGetGUID (account), acct_guid_str);
key = g_strdup_printf ("%s,%d", acct_guid_str, column);
- found = g_hash_table_lookup_extended (priv->account_values_hash, key,
+ found = g_hash_table_lookup_extended (model->account_values_hash, key,
NULL, &value);
if (found)
@@ -698,9 +663,7 @@ static void
gnc_tree_model_account_set_cached_value (GncTreeModelAccount *model, Account *account,
gint column, GValue *value)
{
- GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
-
- if ((!priv->account_values_hash) || (!account))
+ if ((!model->account_values_hash) || (!account))
return;
// only interested in string values
@@ -713,7 +676,7 @@ gnc_tree_model_account_set_cached_value (GncTreeModelAccount *model, Account *ac
guid_to_string_buff (xaccAccountGetGUID (account), acct_guid_str);
key = g_strdup_printf ("%s,%d", acct_guid_str, column);
- g_hash_table_insert (priv->account_values_hash, key, g_strdup (str));
+ g_hash_table_insert (model->account_values_hash, key, g_strdup (str));
}
}
@@ -724,7 +687,6 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
GValue *value)
{
GncTreeModelAccount *model = GNC_TREE_MODEL_ACCOUNT(tree_model);
- GncTreeModelAccountPrivate *priv;
Account *account;
gboolean negative; /* used to set "deficit style" also known as red numbers */
gchar *string;
@@ -741,7 +703,6 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
iter_to_string (iter), column);
account = (Account *) iter->user_data;
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
// lets see if the value is in the cache
if (gnc_tree_model_account_get_cached_value (model, account, column, &cached_string))
@@ -756,7 +717,7 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
{
case GNC_TREE_MODEL_ACCOUNT_COL_NAME:
g_value_init (value, G_TYPE_STRING);
- if (account == priv->root)
+ if (account == model->root)
g_value_set_string (value, _("New top level account"));
else
g_value_set_string (value, xaccAccountGetName (account));
@@ -1037,7 +998,6 @@ gnc_tree_model_account_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent_iter)
{
- GncTreeModelAccountPrivate *priv;
GncTreeModelAccount *model;
Account *account, *parent;
@@ -1046,9 +1006,8 @@ gnc_tree_model_account_iter_children (GtkTreeModel *tree_model,
tree_model, iter, (parent_iter ? iter_to_string (parent_iter) : "(null)"));
model = GNC_TREE_MODEL_ACCOUNT(tree_model);
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
- if (priv->root == NULL)
+ if (model->root == NULL)
{
iter->stamp = 0;
LEAVE("failed (no root)");
@@ -1058,7 +1017,7 @@ gnc_tree_model_account_iter_children (GtkTreeModel *tree_model,
/* Special case when no parent supplied. */
if (!parent_iter)
{
- iter->user_data = priv->root;
+ iter->user_data = model->root;
iter->user_data2 = NULL;
iter->user_data3 = GINT_TO_POINTER(0);
iter->stamp = model->stamp;
@@ -1152,7 +1111,6 @@ gnc_tree_model_account_iter_nth_child (GtkTreeModel *tree_model,
int n)
{
GncTreeModelAccount *model;
- GncTreeModelAccountPrivate *priv;
Account *account, *parent;
if (parent_iter)
@@ -1172,7 +1130,6 @@ gnc_tree_model_account_iter_nth_child (GtkTreeModel *tree_model,
gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(tree_model), FALSE);
model = GNC_TREE_MODEL_ACCOUNT(tree_model);
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
/* Special case when no parent supplied. */
if (!parent_iter)
@@ -1183,7 +1140,7 @@ gnc_tree_model_account_iter_nth_child (GtkTreeModel *tree_model,
return FALSE;
}
- iter->user_data = priv->root;
+ iter->user_data = model->root;
iter->user_data2 = NULL;
iter->user_data3 = GINT_TO_POINTER(0);
iter->stamp = model->stamp;
@@ -1302,7 +1259,6 @@ gnc_tree_model_account_get_iter_from_account (GncTreeModelAccount *model,
Account *account,
GtkTreeIter *iter)
{
- GncTreeModelAccountPrivate *priv;
Account *parent;
gint i;
@@ -1314,8 +1270,7 @@ gnc_tree_model_account_get_iter_from_account (GncTreeModelAccount *model,
iter->user_data = account;
iter->stamp = model->stamp;
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
- if (account == priv->root)
+ if (account == model->root)
{
iter->user_data2 = NULL;
iter->user_data3 = GINT_TO_POINTER(0);
@@ -1323,7 +1278,7 @@ gnc_tree_model_account_get_iter_from_account (GncTreeModelAccount *model,
return TRUE;
}
- if (priv->root != gnc_account_get_root (account))
+ if (model->root != gnc_account_get_root (account))
{
LEAVE("Root doesn't match");
return FALSE;
@@ -1448,7 +1403,6 @@ gnc_tree_model_account_event_handler (QofInstance *entity,
GncTreeModelAccount *model,
GncEventData *ed)
{
- GncTreeModelAccountPrivate *priv;
const gchar *parent_name;
GtkTreePath *path = NULL;
GtkTreeIter iter;
@@ -1461,16 +1415,15 @@ gnc_tree_model_account_event_handler (QofInstance *entity,
ENTER("entity %p of type %d, model %p, event_data %p",
entity, event_type, model, ed);
- priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
account = GNC_ACCOUNT(entity);
- if (gnc_account_get_book (account) != priv->book)
+ if (gnc_account_get_book (account) != model->book)
{
LEAVE("not in this book");
return;
}
- if (gnc_account_get_root (account) != priv->root)
+ if (gnc_account_get_root (account) != model->root)
{
LEAVE("not in this model");
return;
@@ -1505,7 +1458,7 @@ gnc_tree_model_account_event_handler (QofInstance *entity,
case QOF_EVENT_REMOVE:
if (!ed) /* Required for a remove. */
break;
- parent = ed->node ? GNC_ACCOUNT(ed->node) : priv->root;
+ parent = ed->node ? GNC_ACCOUNT(ed->node) : model->root;
parent_name = ed->node ? xaccAccountGetName (parent) : "Root";
DEBUG("remove child %d of account %p (%s)", ed->idx, parent, parent_name);
path = gnc_tree_model_account_get_path_from_account (model, parent);
diff --git a/gnucash/gnome-utils/gnc-tree-model-commodity.c b/gnucash/gnome-utils/gnc-tree-model-commodity.c
index 387df0ae8e..fe80392458 100644
--- a/gnucash/gnome-utils/gnc-tree-model-commodity.c
+++ b/gnucash/gnome-utils/gnc-tree-model-commodity.c
@@ -97,21 +97,13 @@ struct _GncTreeModelCommodity
GncTreeModel gnc_tree_model; /**< The parent object data. */
int stamp; /**< The state of the model. Any state
* change increments this number. */
-};
-/** The instance private data for a commodity database tree model. */
-typedef struct GncTreeModelCommodityPrivate
-{
QofBook *book;
gnc_commodity_table *commodity_table;
gint event_handler_id;
-} GncTreeModelCommodityPrivate;
-
-#define GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(o) \
- ((GncTreeModelCommodityPrivate*)gnc_tree_model_commodity_get_instance_private((GncTreeModelCommodity*)o))
+};
G_DEFINE_TYPE_WITH_CODE(GncTreeModelCommodity, gnc_tree_model_commodity, GNC_TYPE_TREE_MODEL,
- G_ADD_PRIVATE(GncTreeModelCommodity)
G_IMPLEMENT_INTERFACE(GTK_TYPE_TREE_MODEL,
gnc_tree_model_commodity_tree_model_init))
@@ -137,7 +129,6 @@ static void
gnc_tree_model_commodity_finalize (GObject *object)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
g_return_if_fail (object != NULL);
g_return_if_fail (GNC_IS_TREE_MODEL_COMMODITY (object));
@@ -145,9 +136,8 @@ gnc_tree_model_commodity_finalize (GObject *object)
ENTER("model %p", object);
model = GNC_TREE_MODEL_COMMODITY (object);
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
- priv->book = NULL;
- priv->commodity_table = NULL;
+ model->book = NULL;
+ model->commodity_table = NULL;
G_OBJECT_CLASS (gnc_tree_model_commodity_parent_class)->finalize (object);
LEAVE(" ");
@@ -157,19 +147,17 @@ static void
gnc_tree_model_commodity_dispose (GObject *object)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
g_return_if_fail (object != NULL);
g_return_if_fail (GNC_IS_TREE_MODEL_COMMODITY (object));
ENTER("model %p", object);
model = GNC_TREE_MODEL_COMMODITY (object);
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
- if (priv->event_handler_id)
+ if (model->event_handler_id)
{
- qof_event_unregister_handler (priv->event_handler_id);
- priv->event_handler_id = 0;
+ qof_event_unregister_handler (model->event_handler_id);
+ model->event_handler_id = 0;
}
G_OBJECT_CLASS (gnc_tree_model_commodity_parent_class)->dispose (object);
@@ -180,7 +168,6 @@ GtkTreeModel *
gnc_tree_model_commodity_new (QofBook *book, gnc_commodity_table *ct)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
const GList *item;
ENTER("");
@@ -189,8 +176,7 @@ gnc_tree_model_commodity_new (QofBook *book, gnc_commodity_table *ct)
for ( ; item; item = g_list_next(item))
{
model = (GncTreeModelCommodity *)item->data;
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
- if (priv->commodity_table == ct)
+ if (model->commodity_table == ct)
{
g_object_ref(G_OBJECT(model));
LEAVE("returning existing model %p", model);
@@ -199,11 +185,10 @@ gnc_tree_model_commodity_new (QofBook *book, gnc_commodity_table *ct)
}
model = g_object_new (GNC_TYPE_TREE_MODEL_COMMODITY, NULL);
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
- priv->book = book;
- priv->commodity_table = ct;
+ model->book = book;
+ model->commodity_table = ct;
- priv->event_handler_id =
+ model->event_handler_id =
qof_event_register_handler (gnc_tree_model_commodity_event_handler, model);
LEAVE("");
@@ -397,7 +382,6 @@ gnc_tree_model_commodity_get_iter (GtkTreeModel *tree_model,
GtkTreePath *path)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
gnc_commodity *commodity = NULL;
@@ -427,8 +411,7 @@ gnc_tree_model_commodity_get_iter (GtkTreeModel *tree_model,
/* Make sure the model has a commodity db. */
model = GNC_TREE_MODEL_COMMODITY (tree_model);
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
- ct = priv->commodity_table;
+ ct = model->commodity_table;
if (ct == NULL)
{
LEAVE("no commodity table");
@@ -480,7 +463,6 @@ gnc_tree_model_commodity_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
GtkTreePath *path;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
@@ -495,8 +477,7 @@ gnc_tree_model_commodity_get_path (GtkTreeModel *tree_model,
ENTER("model %p, iter %p (%s)", tree_model, iter, iter_to_string(iter));
/* Make sure this model has a commodity db. */
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
- ct = priv->commodity_table;
+ ct = model->commodity_table;
if (ct == NULL)
{
LEAVE("no commodity table");
@@ -659,7 +640,6 @@ gnc_tree_model_commodity_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
GList *list;
@@ -673,10 +653,9 @@ gnc_tree_model_commodity_iter_next (GtkTreeModel *tree_model,
g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
ENTER("model %p, iter %p(%s)", tree_model, iter, iter_to_string(iter));
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
if (iter->user_data == ITER_IS_NAMESPACE)
{
- ct = priv->commodity_table;
+ ct = model->commodity_table;
list = gnc_commodity_table_get_namespaces_list(ct);
}
else if (iter->user_data == ITER_IS_COMMODITY)
@@ -709,7 +688,6 @@ gnc_tree_model_commodity_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *parent)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
GList *list;
@@ -719,11 +697,10 @@ gnc_tree_model_commodity_iter_children (GtkTreeModel *tree_model,
ENTER("model %p, iter %p, parent %p (%s)",
tree_model, iter, parent, iter_to_string(parent));
model = GNC_TREE_MODEL_COMMODITY (tree_model);
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
if (parent == NULL)
{
- ct = priv->commodity_table;
+ ct = model->commodity_table;
list = gnc_commodity_table_get_namespaces_list(ct);
if (list == NULL)
{
@@ -789,7 +766,6 @@ gnc_tree_model_commodity_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
GList *list;
@@ -798,11 +774,10 @@ gnc_tree_model_commodity_iter_n_children (GtkTreeModel *tree_model,
ENTER("model %p, iter %p (%s)", tree_model, iter, iter_to_string(iter));
model = GNC_TREE_MODEL_COMMODITY (tree_model);
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
if (iter == NULL)
{
- ct = priv->commodity_table;
+ ct = model->commodity_table;
list = gnc_commodity_table_get_namespaces_list(ct);
LEAVE("ns list length %d", g_list_length(list));
return g_list_length (list);
@@ -827,7 +802,6 @@ gnc_tree_model_commodity_iter_nth_child (GtkTreeModel *tree_model,
int n)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
GList *list;
@@ -838,11 +812,10 @@ gnc_tree_model_commodity_iter_nth_child (GtkTreeModel *tree_model,
ENTER("model %p, iter %p, parent %p (%s)",
tree_model, iter, parent, iter_to_string(parent));
model = GNC_TREE_MODEL_COMMODITY (tree_model);
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
if (parent == NULL)
{
- ct = priv->commodity_table;
+ ct = model->commodity_table;
list = gnc_commodity_table_get_namespaces_list(ct);
iter->stamp = model->stamp;
@@ -877,7 +850,6 @@ gnc_tree_model_commodity_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *child)
{
GncTreeModelCommodity *model;
- GncTreeModelCommodityPrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
GList *list;
@@ -889,7 +861,6 @@ gnc_tree_model_commodity_iter_parent (GtkTreeModel *tree_model,
ENTER("model %p, iter %p, child %p (%s)",
tree_model, iter, child, iter_to_string(child));
model = GNC_TREE_MODEL_COMMODITY (tree_model);
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
if (child->user_data == ITER_IS_NAMESPACE)
{
@@ -897,7 +868,7 @@ gnc_tree_model_commodity_iter_parent (GtkTreeModel *tree_model,
return FALSE;
}
- ct = priv->commodity_table;
+ ct = model->commodity_table;
list = gnc_commodity_table_get_namespaces_list(ct);
name_space = gnc_commodity_get_namespace_ds((gnc_commodity*)child->user_data2);
@@ -1008,7 +979,6 @@ gnc_tree_model_commodity_get_iter_from_namespace (GncTreeModelCommodity *model,
gnc_commodity_namespace *name_space,
GtkTreeIter *iter)
{
- GncTreeModelCommodityPrivate *priv;
GList *list;
gint n;
@@ -1018,8 +988,7 @@ gnc_tree_model_commodity_get_iter_from_namespace (GncTreeModelCommodity *model,
ENTER("model %p, namespace %p, iter %p", model, name_space, iter);
- priv = GNC_TREE_MODEL_COMMODITY_GET_PRIVATE(model);
- list = gnc_commodity_table_get_namespaces_list(priv->commodity_table);
+ list = gnc_commodity_table_get_namespaces_list(model->commodity_table);
if (list == NULL)
{
LEAVE("");
diff --git a/gnucash/gnome-utils/gnc-tree-model-owner.c b/gnucash/gnome-utils/gnc-tree-model-owner.c
index 7ab068e473..c8dcd39553 100644
--- a/gnucash/gnome-utils/gnc-tree-model-owner.c
+++ b/gnucash/gnome-utils/gnc-tree-model-owner.c
@@ -92,28 +92,19 @@ struct _GncTreeModelOwner
GncTreeModel gnc_tree_model; /**< The parent object data. */
int stamp; /**< The state of the model. Any state
* change increments this number. */
-};
-/** The instance private data for an owner tree model. */
-typedef struct GncTreeModelOwnerPrivate
-{
QofBook *book;
GncOwnerType owner_type;
OwnerList *owner_list;
gint event_handler_id;
const gchar *negative_color;
-} GncTreeModelOwnerPrivate;
+};
G_DEFINE_TYPE_WITH_CODE(GncTreeModelOwner, gnc_tree_model_owner,
GNC_TYPE_TREE_MODEL,
- G_ADD_PRIVATE(GncTreeModelOwner)
G_IMPLEMENT_INTERFACE(GTK_TYPE_TREE_MODEL,
gnc_tree_model_owner_tree_model_init))
-#define GNC_TREE_MODEL_OWNER_GET_PRIVATE(o) \
- ((GncTreeModelOwnerPrivate*)gnc_tree_model_owner_get_instance_private((GncTreeModelOwner*)o))
-
-
/************************************************************/
/* Owner Tree Model - Misc Functions */
/************************************************************/
@@ -127,15 +118,13 @@ G_DEFINE_TYPE_WITH_CODE(GncTreeModelOwner, gnc_tree_model_owner,
static void
gnc_tree_model_owner_update_color (gpointer gsettings, gchar *key, gpointer user_data)
{
- GncTreeModelOwnerPrivate *priv;
GncTreeModelOwner *model;
gboolean use_red;
g_return_if_fail(GNC_IS_TREE_MODEL_OWNER(user_data));
model = user_data;
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
use_red = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
- priv->negative_color = use_red ? "red" : NULL;
+ model->negative_color = use_red ? "red" : NULL;
}
/************************************************************/
/* g_object required functions */
@@ -156,7 +145,6 @@ gnc_tree_model_owner_class_init (GncTreeModelOwnerClass *klass)
static void
gnc_tree_model_owner_init (GncTreeModelOwner *model)
{
- GncTreeModelOwnerPrivate *priv;
gboolean red;
ENTER("model %p", model);
@@ -167,11 +155,10 @@ gnc_tree_model_owner_init (GncTreeModelOwner *model)
red = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
- priv->book = NULL;
- priv->owner_list = NULL;
- priv->owner_type = GNC_OWNER_NONE;
- priv->negative_color = red ? "red" : NULL;
+ model->book = NULL;
+ model->owner_list = NULL;
+ model->owner_type = GNC_OWNER_NONE;
+ model->negative_color = red ? "red" : NULL;
gnc_prefs_register_cb(GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
gnc_tree_model_owner_update_color,
@@ -183,7 +170,6 @@ gnc_tree_model_owner_init (GncTreeModelOwner *model)
static void
gnc_tree_model_owner_finalize (GObject *object)
{
- GncTreeModelOwnerPrivate *priv;
GncTreeModelOwner *model;
g_return_if_fail (object != NULL);
@@ -192,13 +178,12 @@ gnc_tree_model_owner_finalize (GObject *object)
ENTER("model %p", object);
model = GNC_TREE_MODEL_OWNER (object);
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
- if (priv->owner_list)
- g_list_free_full (priv->owner_list, (GDestroyNotify) gncOwnerFree);
+ if (model->owner_list)
+ g_list_free_full (model->owner_list, (GDestroyNotify) gncOwnerFree);
- priv->book = NULL;
- priv->owner_list = NULL;
+ model->book = NULL;
+ model->owner_list = NULL;
G_OBJECT_CLASS(gnc_tree_model_owner_parent_class)->finalize (object);
LEAVE(" ");
@@ -207,7 +192,6 @@ gnc_tree_model_owner_finalize (GObject *object)
static void
gnc_tree_model_owner_dispose (GObject *object)
{
- GncTreeModelOwnerPrivate *priv;
GncTreeModelOwner *model;
g_return_if_fail (object != NULL);
@@ -216,12 +200,11 @@ gnc_tree_model_owner_dispose (GObject *object)
ENTER("model %p", object);
model = GNC_TREE_MODEL_OWNER (object);
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
- if (priv->event_handler_id)
+ if (model->event_handler_id)
{
- qof_event_unregister_handler (priv->event_handler_id);
- priv->event_handler_id = 0;
+ qof_event_unregister_handler (model->event_handler_id);
+ model->event_handler_id = 0;
}
gnc_prefs_remove_cb_by_func(GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
@@ -241,7 +224,6 @@ GtkTreeModel *
gnc_tree_model_owner_new (GncOwnerType owner_type)
{
GncTreeModelOwner *model;
- GncTreeModelOwnerPrivate *priv;
const GList *item;
ENTER("owner_type %d", owner_type);
@@ -249,8 +231,7 @@ gnc_tree_model_owner_new (GncOwnerType owner_type)
for ( ; item; item = g_list_next(item))
{
model = (GncTreeModelOwner *)item->data;
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
- if (priv->owner_type == owner_type)
+ if (model->owner_type == owner_type)
{
g_object_ref(G_OBJECT(model));
LEAVE("returning existing model %p", model);
@@ -261,12 +242,11 @@ gnc_tree_model_owner_new (GncOwnerType owner_type)
model = g_object_new (GNC_TYPE_TREE_MODEL_OWNER,
NULL);
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
- priv->book = gnc_get_current_book();
- priv->owner_type = owner_type;
- priv->owner_list = gncBusinessGetOwnerList (priv->book, gncOwnerTypeToQofIdType(owner_type), TRUE);
+ model->book = gnc_get_current_book();
+ model->owner_type = owner_type;
+ model->owner_list = gncBusinessGetOwnerList (model->book, gncOwnerTypeToQofIdType(owner_type), TRUE);
- priv->event_handler_id = qof_event_register_handler
+ model->event_handler_id = qof_event_register_handler
((QofEventHandler)gnc_tree_model_owner_event_handler, model);
LEAVE("model %p", model);
@@ -386,7 +366,6 @@ gnc_tree_model_owner_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path)
{
- GncTreeModelOwnerPrivate *priv;
GncTreeModelOwner *model;
GncOwner *owner;
gint *indices;
@@ -400,7 +379,6 @@ gnc_tree_model_owner_get_iter (GtkTreeModel *tree_model,
}
model = GNC_TREE_MODEL_OWNER (tree_model);
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
/* We keep a simple list of owners, not a tree, so only depth 1 is valid */
if (gtk_tree_path_get_depth (path) != 1)
@@ -411,7 +389,7 @@ gnc_tree_model_owner_get_iter (GtkTreeModel *tree_model,
indices = gtk_tree_path_get_indices (path);
- owner = g_list_nth_data (priv->owner_list, indices[0]);
+ owner = g_list_nth_data (model->owner_list, indices[0]);
if (owner == NULL)
{
iter->stamp = 0;
@@ -433,7 +411,6 @@ gnc_tree_model_owner_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelOwner *model = GNC_TREE_MODEL_OWNER (tree_model);
- GncTreeModelOwnerPrivate *priv;
GncOwner *owner;
GtkTreePath *path;
gint i;
@@ -445,8 +422,7 @@ gnc_tree_model_owner_get_path (GtkTreeModel *tree_model,
ENTER("model %p, iter %s", model, iter_to_string(iter));
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
- if (priv->owner_list == NULL)
+ if (model->owner_list == NULL)
{
LEAVE("failed (1)");
return NULL;
@@ -455,7 +431,7 @@ gnc_tree_model_owner_get_path (GtkTreeModel *tree_model,
owner = (GncOwner *) iter->user_data;
path = gtk_tree_path_new ();
- i = g_list_index (priv->owner_list, owner);
+ i = g_list_index (model->owner_list, owner);
if (i == -1)
{
gtk_tree_path_free (path);
@@ -477,11 +453,8 @@ gnc_tree_model_owner_set_color(GncTreeModelOwner *model,
gboolean negative,
GValue *value)
{
- GncTreeModelOwnerPrivate *priv;
-
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
if (negative)
- g_value_set_static_string (value, priv->negative_color);
+ g_value_set_static_string (value, model->negative_color);
else
g_value_set_static_string (value, NULL);
}
@@ -646,7 +619,6 @@ gnc_tree_model_owner_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelOwner *model = GNC_TREE_MODEL_OWNER (tree_model);
- GncTreeModelOwnerPrivate *priv;
GncOwner *owner;
gint i;
@@ -657,11 +629,9 @@ gnc_tree_model_owner_iter_next (GtkTreeModel *tree_model,
ENTER("model %p, iter %s", tree_model, iter_to_string (iter));
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
-
/* Get the *next* sibling owner. */
i = GPOINTER_TO_INT (iter->user_data2);
- owner = g_list_nth_data (priv->owner_list, i + 1);
+ owner = g_list_nth_data (model->owner_list, i + 1);
if (owner == NULL)
{
iter->stamp = 0;
@@ -682,7 +652,6 @@ gnc_tree_model_owner_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent_iter)
{
- GncTreeModelOwnerPrivate *priv;
GncTreeModelOwner *model;
g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), FALSE);
@@ -690,14 +659,13 @@ gnc_tree_model_owner_iter_children (GtkTreeModel *tree_model,
tree_model, iter, (parent_iter ? iter_to_string(parent_iter) : "(null)"));
model = GNC_TREE_MODEL_OWNER (tree_model);
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
/* Owner lists don't have children, so this function call only
* makes sense if no parent_iter was supplied. In that case,
* return the first owner in the list */
if (!parent_iter)
{
- iter->user_data = g_list_nth_data (priv->owner_list, 0);
+ iter->user_data = g_list_nth_data (model->owner_list, 0);
iter->user_data2 = GINT_TO_POINTER (0);
iter->user_data3 = NULL;
iter->stamp = model->stamp;
@@ -725,19 +693,17 @@ gnc_tree_model_owner_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelOwner *model;
- GncTreeModelOwnerPrivate *priv;
g_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), -1);
model = GNC_TREE_MODEL_OWNER (tree_model);
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE (model);
/* Owner lists don't have children, so always return 0, except for
* the special case this request comes for the special "root" iter
* (NULL). For that exception we return the size of the owner list.
*/
if (iter == NULL)
- return (gint) g_list_length (priv->owner_list);
+ return (gint) g_list_length (model->owner_list);
g_return_val_if_fail (
GNC_TREE_MODEL_OWNER (tree_model)->stamp == iter->stamp, -1);
@@ -752,7 +718,6 @@ gnc_tree_model_owner_iter_nth_child (GtkTreeModel *tree_model,
int n)
{
GncTreeModelOwner *model;
- GncTreeModelOwnerPrivate *priv;
if (parent_iter)
{
@@ -771,14 +736,13 @@ gnc_tree_model_owner_iter_nth_child (GtkTreeModel *tree_model,
gnc_leave_return_val_if_fail (GNC_IS_TREE_MODEL_OWNER (tree_model), FALSE);
model = GNC_TREE_MODEL_OWNER (tree_model);
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
/* Owner lists don't have children, so this function call only
* makes sense if no parent_iter was supplied. In that case,
* return the first owner in the list */
if (!parent_iter)
{
- iter->user_data = g_list_nth_data (priv->owner_list, n);
+ iter->user_data = g_list_nth_data (model->owner_list, n);
iter->user_data2 = GINT_TO_POINTER (n);
iter->user_data3 = NULL;
iter->stamp = model->stamp;
@@ -834,7 +798,6 @@ gnc_tree_model_owner_get_iter_from_owner (GncTreeModelOwner *model,
GncOwner *owner,
GtkTreeIter *iter)
{
- GncTreeModelOwnerPrivate *priv;
GList *owner_in_list;
ENTER("model %p, owner %p, iter %p", model, owner, iter);
@@ -842,14 +805,12 @@ gnc_tree_model_owner_get_iter_from_owner (GncTreeModelOwner *model,
gnc_leave_return_val_if_fail ((owner != NULL), FALSE);
gnc_leave_return_val_if_fail ((iter != NULL), FALSE);
-
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
- owner_in_list = g_list_find_custom (priv->owner_list, (gconstpointer)owner, (GCompareFunc)gncOwnerGCompareFunc);
+ owner_in_list = g_list_find_custom (model->owner_list, (gconstpointer)owner, (GCompareFunc)gncOwnerGCompareFunc);
if (owner_in_list)
{
iter->stamp = model->stamp;
iter->user_data = owner_in_list->data;
- iter->user_data2 = GINT_TO_POINTER (g_list_position (priv->owner_list, owner_in_list));
+ iter->user_data2 = GINT_TO_POINTER (g_list_position (model->owner_list, owner_in_list));
iter->user_data3 = NULL;
LEAVE("iter %s", iter_to_string (iter));
return TRUE;
@@ -945,7 +906,6 @@ gnc_tree_model_owner_event_handler (QofInstance *entity,
GncTreeModelOwner *model,
GncEventData *ed)
{
- GncTreeModelOwnerPrivate *priv;
GtkTreePath *path = NULL;
GtkTreeIter iter;
GncOwner owner;
@@ -957,16 +917,15 @@ gnc_tree_model_owner_event_handler (QofInstance *entity,
ENTER("entity %p of type %d, model %p, event_data %p",
entity, event_type, model, ed);
- priv = GNC_TREE_MODEL_OWNER_GET_PRIVATE(model);
qofOwnerSetEntity (&owner, entity);
- if (gncOwnerGetType(&owner) != priv->owner_type)
+ if (gncOwnerGetType(&owner) != model->owner_type)
{
LEAVE("model type and owner type differ");
return;
}
- if (qof_instance_get_book (entity) != priv->book)
+ if (qof_instance_get_book (entity) != model->book)
{
LEAVE("not in this book");
return;
@@ -979,11 +938,11 @@ gnc_tree_model_owner_event_handler (QofInstance *entity,
/* Tell the filters/views where the new owner was added. */
DEBUG("add owner %p (%s)", &owner, gncOwnerGetName(&owner));
/* First update our copy of the owner list. This isn't done automatically */
- if (priv->owner_list)
- g_list_free_full (priv->owner_list, (GDestroyNotify) gncOwnerFree);
+ if (model->owner_list)
+ g_list_free_full (model->owner_list, (GDestroyNotify) gncOwnerFree);
- priv->owner_list = gncBusinessGetOwnerList (priv->book,
- gncOwnerTypeToQofIdType(priv->owner_type), TRUE);
+ model->owner_list = gncBusinessGetOwnerList (model->book,
+ gncOwnerTypeToQofIdType(model->owner_type), TRUE);
increment_stamp(model);
if (!gnc_tree_model_owner_get_iter_from_owner (model, &owner, &iter))
{
@@ -1003,7 +962,7 @@ gnc_tree_model_owner_event_handler (QofInstance *entity,
if (!ed) /* Required for a remove. */
break;
DEBUG("remove owner %d (%s) from owner_list %p", ed->idx,
- gncOwnerGetName(&owner), priv->owner_list);
+ gncOwnerGetName(&owner), model->owner_list);
path = gtk_tree_path_new();
if (!path)
{
diff --git a/gnucash/gnome-utils/gnc-tree-model-price.c b/gnucash/gnome-utils/gnc-tree-model-price.c
index 6c7e6ac0b8..09b980de05 100644
--- a/gnucash/gnome-utils/gnc-tree-model-price.c
+++ b/gnucash/gnome-utils/gnc-tree-model-price.c
@@ -126,22 +126,13 @@ struct _GncTreeModelPrice
GncTreeModel gnc_tree_model; /**< The parent object data. */
int stamp; /**< The state of the model. Any state
* change increments this number. */
-};
-
-/** The instance private data for a price database tree model. */
-typedef struct GncTreeModelPricePrivate
-{
QofBook *book;
GNCPriceDB *price_db;
gint event_handler_id;
GNCPrintAmountInfo print_info;
-} GncTreeModelPricePrivate;
-
-#define GNC_TREE_MODEL_PRICE_GET_PRIVATE(o) \
- ((GncTreeModelPricePrivate*)gnc_tree_model_price_get_instance_private((GncTreeModelPrice*)o))
+};
G_DEFINE_TYPE_WITH_CODE(GncTreeModelPrice, gnc_tree_model_price, GNC_TYPE_TREE_MODEL,
- G_ADD_PRIVATE(GncTreeModelPrice)
G_IMPLEMENT_INTERFACE(GTK_TYPE_TREE_MODEL,
gnc_tree_model_price_tree_model_init))
@@ -157,22 +148,18 @@ gnc_tree_model_price_class_init (GncTreeModelPriceClass *klass)
static void
gnc_tree_model_price_init (GncTreeModelPrice *model)
{
- GncTreeModelPricePrivate *priv;
-
while (model->stamp == 0)
{
model->stamp = g_random_int ();
}
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
- priv->print_info = gnc_default_price_print_info(NULL);
+ model->print_info = gnc_default_price_print_info(NULL);
}
static void
gnc_tree_model_price_finalize (GObject *object)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
ENTER("model %p", object);
@@ -180,10 +167,9 @@ gnc_tree_model_price_finalize (GObject *object)
g_return_if_fail (GNC_IS_TREE_MODEL_PRICE (object));
model = GNC_TREE_MODEL_PRICE (object);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
- priv->book = NULL;
- priv->price_db = NULL;
+ model->book = NULL;
+ model->price_db = NULL;
G_OBJECT_CLASS (gnc_tree_model_price_parent_class)->finalize (object);
LEAVE(" ");
@@ -193,19 +179,17 @@ static void
gnc_tree_model_price_dispose (GObject *object)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
ENTER("model %p", object);
g_return_if_fail (object != NULL);
g_return_if_fail (GNC_IS_TREE_MODEL_PRICE (object));
model = GNC_TREE_MODEL_PRICE (object);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
- if (priv->event_handler_id)
+ if (model->event_handler_id)
{
- qof_event_unregister_handler (priv->event_handler_id);
- priv->event_handler_id = 0;
+ qof_event_unregister_handler (model->event_handler_id);
+ model->event_handler_id = 0;
}
G_OBJECT_CLASS (gnc_tree_model_price_parent_class)->dispose (object);
@@ -216,7 +200,6 @@ GtkTreeModel *
gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
const GList *item;
ENTER(" ");
@@ -225,8 +208,7 @@ gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
for ( ; item; item = g_list_next(item))
{
model = (GncTreeModelPrice *)item->data;
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
- if (priv->price_db == price_db)
+ if (model->price_db == price_db)
{
g_object_ref(G_OBJECT(model));
LEAVE("returning existing model %p", model);
@@ -236,11 +218,10 @@ gnc_tree_model_price_new (QofBook *book, GNCPriceDB *price_db)
model = g_object_new (GNC_TYPE_TREE_MODEL_PRICE, NULL);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
- priv->book = book;
- priv->price_db = price_db;
+ model->book = book;
+ model->price_db = price_db;
- priv->event_handler_id =
+ model->event_handler_id =
qof_event_register_handler (gnc_tree_model_price_event_handler, model);
LEAVE("returning new model %p", model);
@@ -340,7 +321,6 @@ gnc_tree_model_price_get_price (GncTreeModelPrice *model,
static const gchar *
iter_to_string (GncTreeModelPrice *model, GtkTreeIter *iter)
{
- GncTreeModelPricePrivate *priv;
gnc_commodity_namespace *name_space;
gnc_commodity *commodity;
GNCPrice *price;
@@ -358,7 +338,6 @@ iter_to_string (GncTreeModelPrice *model, GtkTreeIter *iter)
static char string[ITER_STRING_LEN + 1];
#endif
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
if (iter)
{
switch (GPOINTER_TO_INT(iter->user_data))
@@ -388,7 +367,7 @@ iter_to_string (GncTreeModelPrice *model, GtkTreeIter *iter)
"[stamp:%x data:%d (PRICE), %p (%s:%s), %d]",
iter->stamp, GPOINTER_TO_INT(iter->user_data),
iter->user_data2, gnc_commodity_get_mnemonic (commodity),
- xaccPrintAmount (gnc_price_get_value (price), priv->print_info),
+ xaccPrintAmount (gnc_price_get_value (price), model->print_info),
GPOINTER_TO_INT(iter->user_data3));
break;
@@ -469,7 +448,6 @@ gnc_tree_model_price_get_iter (GtkTreeModel *tree_model,
GtkTreePath *path)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
gnc_commodity *commodity = NULL;
@@ -497,15 +475,14 @@ gnc_tree_model_price_get_iter (GtkTreeModel *tree_model,
/* Make sure the model has a price db. */
model = GNC_TREE_MODEL_PRICE (tree_model);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
- if (priv->price_db == NULL)
+ if (model->price_db == NULL)
{
LEAVE("no price db");
return FALSE;
}
/* Verify the first part of the path: the namespace. */
- ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
+ ct = qof_book_get_data (model->book, GNC_COMMODITY_TABLE);
ns_list = gnc_commodity_table_get_namespaces_list(ct);
i = gtk_tree_path_get_indices (path)[0];
name_space = g_list_nth_data (ns_list, i);
@@ -549,7 +526,7 @@ gnc_tree_model_price_get_iter (GtkTreeModel *tree_model,
/* Verify the third part of the path: the price. */
i = gtk_tree_path_get_indices (path)[2];
- price = gnc_pricedb_nth_price(priv->price_db, commodity, i);
+ price = gnc_pricedb_nth_price(model->price_db, commodity, i);
/* There's a race condition here that I can't resolve.
* Comment this check out for now, and we'll handle the
* resulting problem elsewhere. */
@@ -575,7 +552,6 @@ gnc_tree_model_price_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelPrice *model = GNC_TREE_MODEL_PRICE (tree_model);
- GncTreeModelPricePrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
gnc_commodity *commodity;
@@ -589,8 +565,7 @@ gnc_tree_model_price_get_path (GtkTreeModel *tree_model,
g_return_val_if_fail (iter->stamp == model->stamp, NULL);
/* Make sure this model has a price db. */
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
- if (priv->price_db == NULL)
+ if (model->price_db == NULL)
{
LEAVE("no price db");
return FALSE;
@@ -607,7 +582,7 @@ gnc_tree_model_price_get_path (GtkTreeModel *tree_model,
}
/* Get the namespaces list. */
- ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
+ ct = qof_book_get_data (model->book, GNC_COMMODITY_TABLE);
ns_list = gnc_commodity_table_get_namespaces_list(ct);
if (iter->user_data == ITER_IS_COMMODITY)
@@ -641,7 +616,6 @@ gnc_tree_model_price_get_value (GtkTreeModel *tree_model,
GValue *value)
{
GncTreeModelPrice *model = GNC_TREE_MODEL_PRICE (tree_model);
- GncTreeModelPricePrivate *priv;
gnc_commodity_namespace *name_space;
gnc_commodity *commodity;
GNCPrice *price;
@@ -750,9 +724,8 @@ gnc_tree_model_price_get_value (GtkTreeModel *tree_model,
break;
case GNC_TREE_MODEL_PRICE_COL_VALUE:
g_value_init (value, G_TYPE_STRING);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
g_value_set_string (value, xaccPrintAmount (gnc_price_get_value (price),
- priv->print_info));
+ model->print_info));
break;
case GNC_TREE_MODEL_PRICE_COL_VISIBILITY:
g_value_init (value, G_TYPE_BOOLEAN);
@@ -768,7 +741,6 @@ gnc_tree_model_price_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelPrice *model = GNC_TREE_MODEL_PRICE (tree_model);
- GncTreeModelPricePrivate *priv;
gnc_commodity_table *ct;
gnc_commodity *commodity;
gnc_commodity_namespace *name_space;
@@ -781,10 +753,9 @@ gnc_tree_model_price_iter_next (GtkTreeModel *tree_model,
g_return_val_if_fail (iter->user_data != NULL, FALSE);
g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
if (iter->user_data == ITER_IS_NAMESPACE)
{
- ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
+ ct = qof_book_get_data (model->book, GNC_COMMODITY_TABLE);
list = gnc_commodity_table_get_namespaces_list(ct);
n = GPOINTER_TO_INT(iter->user_data3) + 1;
iter->user_data2 = g_list_nth_data(list, n);
@@ -816,7 +787,7 @@ gnc_tree_model_price_iter_next (GtkTreeModel *tree_model,
{
commodity = gnc_price_get_commodity((GNCPrice*)iter->user_data2);
n = GPOINTER_TO_INT(iter->user_data3) + 1;
- iter->user_data2 = gnc_pricedb_nth_price(priv->price_db, commodity, n);
+ iter->user_data2 = gnc_pricedb_nth_price(model->price_db, commodity, n);
if (iter->user_data2 == NULL)
{
LEAVE("no next iter");
@@ -839,7 +810,6 @@ gnc_tree_model_price_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *parent)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
gnc_commodity *commodity;
@@ -851,10 +821,9 @@ gnc_tree_model_price_iter_children (GtkTreeModel *tree_model,
ENTER("model %p, iter %p, parent %p (%s)",
tree_model, iter, parent, iter_to_string(model, parent));
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
if (parent == NULL)
{
- ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
+ ct = qof_book_get_data (model->book, GNC_COMMODITY_TABLE);
list = gnc_commodity_table_get_namespaces_list(ct);
if (list == NULL)
{
@@ -892,7 +861,7 @@ gnc_tree_model_price_iter_children (GtkTreeModel *tree_model,
{
GNCPrice *price;
commodity = (gnc_commodity *)parent->user_data2;
- price = gnc_pricedb_nth_price(priv->price_db, commodity, 0);
+ price = gnc_pricedb_nth_price(model->price_db, commodity, 0);
if (price == NULL)
{
LEAVE("no prices");
@@ -915,7 +884,6 @@ gnc_tree_model_price_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
gnc_commodity_namespace *name_space;
gnc_commodity *commodity;
gboolean result;
@@ -927,7 +895,6 @@ gnc_tree_model_price_iter_has_child (GtkTreeModel *tree_model,
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
if (iter->user_data == ITER_IS_PRICE)
{
LEAVE("price has no children");
@@ -945,7 +912,7 @@ gnc_tree_model_price_iter_has_child (GtkTreeModel *tree_model,
if (iter->user_data == ITER_IS_COMMODITY)
{
commodity = (gnc_commodity *)iter->user_data2;
- result = gnc_pricedb_has_prices(priv->price_db, commodity, NULL);
+ result = gnc_pricedb_has_prices(model->price_db, commodity, NULL);
LEAVE("%s children", result ? "has" : "no");
return result;
}
@@ -959,7 +926,6 @@ gnc_tree_model_price_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
gnc_commodity *commodity;
@@ -972,10 +938,9 @@ gnc_tree_model_price_iter_n_children (GtkTreeModel *tree_model,
ENTER("model %p, iter %p (%s)", tree_model, iter,
iter_to_string(model, iter));
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
if (iter == NULL)
{
- ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
+ ct = qof_book_get_data (model->book, GNC_COMMODITY_TABLE);
list = gnc_commodity_table_get_namespaces_list(ct);
LEAVE("ns list length %d", g_list_length(list));
return g_list_length (list);
@@ -992,7 +957,7 @@ gnc_tree_model_price_iter_n_children (GtkTreeModel *tree_model,
if (iter->user_data == ITER_IS_COMMODITY)
{
commodity = (gnc_commodity *)iter->user_data2;
- n = gnc_pricedb_num_prices(priv->price_db, commodity);
+ n = gnc_pricedb_num_prices(model->price_db, commodity);
LEAVE("price list length %d", n);
return n;
}
@@ -1008,7 +973,6 @@ gnc_tree_model_price_iter_nth_child (GtkTreeModel *tree_model,
int n)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
gnc_commodity_table *ct;
gnc_commodity_namespace *name_space;
gnc_commodity *commodity;
@@ -1021,10 +985,9 @@ gnc_tree_model_price_iter_nth_child (GtkTreeModel *tree_model,
ENTER("model %p, iter %p, parent %p (%s), n %d",
tree_model, iter, parent, iter_to_string(model, parent), n);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
if (parent == NULL)
{
- ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
+ ct = qof_book_get_data (model->book, GNC_COMMODITY_TABLE);
list = gnc_commodity_table_get_namespaces_list(ct);
iter->stamp = model->stamp;
@@ -1054,7 +1017,7 @@ gnc_tree_model_price_iter_nth_child (GtkTreeModel *tree_model,
iter->stamp = model->stamp;
iter->user_data = ITER_IS_PRICE;
- iter->user_data2 = gnc_pricedb_nth_price(priv->price_db, commodity, n);
+ iter->user_data2 = gnc_pricedb_nth_price(model->price_db, commodity, n);
iter->user_data3 = GINT_TO_POINTER(n);
LEAVE("price iter %p (%s)", iter, iter_to_string(model, iter));
return iter->user_data2 != NULL;
@@ -1071,7 +1034,6 @@ gnc_tree_model_price_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *child)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
gnc_commodity_table *ct;
gnc_commodity * commodity;
gnc_commodity_namespace *name_space;
@@ -1085,7 +1047,6 @@ gnc_tree_model_price_iter_parent (GtkTreeModel *tree_model,
ENTER("model %p, iter %p, child %p (%s)",
tree_model, iter, child, iter_to_string(model, child));
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
if (child->user_data == ITER_IS_NAMESPACE)
{
LEAVE("ns has no parent");
@@ -1094,7 +1055,7 @@ gnc_tree_model_price_iter_parent (GtkTreeModel *tree_model,
if (child->user_data == ITER_IS_COMMODITY)
{
- ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
+ ct = qof_book_get_data (model->book, GNC_COMMODITY_TABLE);
list = gnc_commodity_table_get_namespaces_list(ct);
name_space = gnc_commodity_get_namespace_ds((gnc_commodity*)child->user_data2);
@@ -1132,7 +1093,6 @@ gnc_tree_model_price_get_iter_from_price (GncTreeModelPrice *model,
GNCPrice *price,
GtkTreeIter *iter)
{
- GncTreeModelPricePrivate *priv;
gnc_commodity *commodity;
GList *list;
gint n;
@@ -1142,7 +1102,6 @@ gnc_tree_model_price_get_iter_from_price (GncTreeModelPrice *model,
g_return_val_if_fail ((price != NULL), FALSE);
g_return_val_if_fail ((iter != NULL), FALSE);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
commodity = gnc_price_get_commodity(price);
if (commodity == NULL)
{
@@ -1150,7 +1109,7 @@ gnc_tree_model_price_get_iter_from_price (GncTreeModelPrice *model,
return FALSE;
}
- list = gnc_pricedb_get_prices(priv->price_db, commodity, NULL);
+ list = gnc_pricedb_get_prices(model->price_db, commodity, NULL);
if (list == NULL)
{
LEAVE("empty list");
@@ -1268,7 +1227,6 @@ gnc_tree_model_price_get_iter_from_namespace (GncTreeModelPrice *model,
gnc_commodity_namespace *name_space,
GtkTreeIter *iter)
{
- GncTreeModelPricePrivate *priv;
gnc_commodity_table *ct;
GList *list;
gint n;
@@ -1278,8 +1236,7 @@ gnc_tree_model_price_get_iter_from_namespace (GncTreeModelPrice *model,
g_return_val_if_fail ((name_space != NULL), FALSE);
g_return_val_if_fail ((iter != NULL), FALSE);
- priv = GNC_TREE_MODEL_PRICE_GET_PRIVATE(model);
- ct = qof_book_get_data (priv->book, GNC_COMMODITY_TABLE);
+ ct = qof_book_get_data (model->book, GNC_COMMODITY_TABLE);
list = gnc_commodity_table_get_namespaces_list(ct);
if (list == NULL)
{
@@ -1541,7 +1498,6 @@ gnc_tree_model_price_event_handler (QofInstance *entity,
gpointer event_data)
{
GncTreeModelPrice *model;
- GncTreeModelPricePrivate *priv;
GtkTreePath *path;
GtkTreeIter iter;
remove_data *data;
@@ -1550,11 +1506,10 @@ 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 (priv->price_db);
+ gnc_tree_model_price_do_deletions (model->price_db);
/* hard failures */
g_return_if_fail(GNC_IS_TREE_MODEL_PRICE(model));
@@ -1616,7 +1571,7 @@ gnc_tree_model_price_event_handler (QofInstance *entity,
case QOF_EVENT_ADD:
/* Tell the filters/views where the new price was added. */
DEBUG("add %s", name);
- gnc_pricedb_nth_price_reset_cache (priv->price_db);
+ gnc_pricedb_nth_price_reset_cache (model->price_db);
gnc_tree_model_price_row_add (model, &iter);
break;
@@ -1635,7 +1590,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, priv->price_db, NULL);
+ gnc_tree_model_price_do_deletions, model->price_db, NULL);
LEAVE(" ");
return;
commit 1084071be68c022fffddabbcf4340c7daad3893c
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Tue Jun 13 13:04:37 2023 +0100
Refactor: hide implementation of GncTreeModel* (move from .h -> .c)
diff --git a/gnucash/gnome-utils/gnc-tree-model-account-types.c b/gnucash/gnome-utils/gnc-tree-model-account-types.c
index 489953e64d..7fb1bb9933 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account-types.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account-types.c
@@ -46,6 +46,12 @@ gnc_tree_model_account_types_finalize (GObject * object);
static void
gnc_tree_model_account_types_tree_model_init (GtkTreeModelIface * iface);
+struct _GncTreeModelAccountTypes
+{
+ GObject gobject;
+ int stamp;
+};
+
typedef struct GncTreeModelAccountTypesPrivate
{
guint32 selected;
diff --git a/gnucash/gnome-utils/gnc-tree-model-account-types.h b/gnucash/gnome-utils/gnc-tree-model-account-types.h
index 29019be2d6..902c65377f 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account-types.h
+++ b/gnucash/gnome-utils/gnc-tree-model-account-types.h
@@ -54,13 +54,6 @@ typedef enum
GNC_TREE_MODEL_ACCOUNT_TYPES_NUM_COLUMNS
} GncTreeModelAccountTypesColumn;
-/* typedefs & structures */
-struct _GncTreeModelAccountTypes
-{
- GObject gobject;
- int stamp;
-};
-
/* function prototypes */
/* Choose one of two methods to use the GncTreeModelAccountTypes
diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
index 0fb6f2f100..bd3ad98625 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account.c
@@ -90,6 +90,14 @@ static void gnc_tree_model_account_event_handler (QofInstance *entity,
GncTreeModelAccount *model,
GncEventData *ed);
+/** The instance data structure for an account tree model. */
+struct _GncTreeModelAccount
+{
+ GncTreeModel gnc_tree_model; /**< The parent object data. */
+ int stamp; /**< The state of the model. Any state
+ * change increments this number. */
+};
+
/** The instance private data for an account tree model. */
typedef struct GncTreeModelAccountPrivate
{
diff --git a/gnucash/gnome-utils/gnc-tree-model-account.h b/gnucash/gnome-utils/gnc-tree-model-account.h
index 802e4efd01..4b2baefd1b 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.h
+++ b/gnucash/gnome-utils/gnc-tree-model-account.h
@@ -96,16 +96,6 @@ typedef enum
GNC_TREE_MODEL_ACCOUNT_NUM_COLUMNS
} GncTreeModelAccountColumn;
-/* typedefs & structures */
-
-/** The instance data structure for an account tree model. */
-struct _GncTreeModelAccount
-{
- GncTreeModel gnc_tree_model; /**< The parent object data. */
- int stamp; /**< The state of the model. Any state
- * change increments this number. */
-};
-
/** Clear the tree model account cached values.
*
* @param model A pointer to the account tree model.
diff --git a/gnucash/gnome-utils/gnc-tree-model-commodity.c b/gnucash/gnome-utils/gnc-tree-model-commodity.c
index d1b9113cad..387df0ae8e 100644
--- a/gnucash/gnome-utils/gnc-tree-model-commodity.c
+++ b/gnucash/gnome-utils/gnc-tree-model-commodity.c
@@ -91,6 +91,14 @@ static void gnc_tree_model_commodity_event_handler (QofInstance *entity,
gpointer user_data,
gpointer event_data);
+/** The instance data structure for a commodity tree model. */
+struct _GncTreeModelCommodity
+{
+ GncTreeModel gnc_tree_model; /**< The parent object data. */
+ int stamp; /**< The state of the model. Any state
+ * change increments this number. */
+};
+
/** The instance private data for a commodity database tree model. */
typedef struct GncTreeModelCommodityPrivate
{
diff --git a/gnucash/gnome-utils/gnc-tree-model-commodity.h b/gnucash/gnome-utils/gnc-tree-model-commodity.h
index e8ef562cb9..0bbad9f9bf 100644
--- a/gnucash/gnome-utils/gnc-tree-model-commodity.h
+++ b/gnucash/gnome-utils/gnc-tree-model-commodity.h
@@ -72,17 +72,6 @@ typedef enum
GNC_TREE_MODEL_COMMODITY_NUM_COLUMNS
} GncTreeModelCommodityColumn;
-/* typedefs & structures */
-
-/** The instance data structure for a commodity tree model. */
-struct _GncTreeModelCommodity
-{
- GncTreeModel gnc_tree_model; /**< The parent object data. */
- int stamp; /**< The state of the model. Any state
- * change increments this number. */
-};
-
-
/** @name Account Tree Model Constructors
@{ */
diff --git a/gnucash/gnome-utils/gnc-tree-model-owner.c b/gnucash/gnome-utils/gnc-tree-model-owner.c
index 0f9eb8183d..7ab068e473 100644
--- a/gnucash/gnome-utils/gnc-tree-model-owner.c
+++ b/gnucash/gnome-utils/gnc-tree-model-owner.c
@@ -86,6 +86,14 @@ static void gnc_tree_model_owner_event_handler (QofInstance *entity,
GncTreeModelOwner *model,
GncEventData *ed);
+/** The instance data structure for an owner tree model. */
+struct _GncTreeModelOwner
+{
+ GncTreeModel gnc_tree_model; /**< The parent object data. */
+ int stamp; /**< The state of the model. Any state
+ * change increments this number. */
+};
+
/** The instance private data for an owner tree model. */
typedef struct GncTreeModelOwnerPrivate
{
diff --git a/gnucash/gnome-utils/gnc-tree-model-owner.h b/gnucash/gnome-utils/gnc-tree-model-owner.h
index 8907333276..2f292cb7f0 100644
--- a/gnucash/gnome-utils/gnc-tree-model-owner.h
+++ b/gnucash/gnome-utils/gnc-tree-model-owner.h
@@ -75,16 +75,6 @@ typedef enum
GNC_TREE_MODEL_OWNER_NUM_COLUMNS
} GncTreeModelOwnerColumn;
-/* typedefs & structures */
-
-/** The instance data structure for an owner tree model. */
-struct _GncTreeModelOwner
-{
- GncTreeModel gnc_tree_model; /**< The parent object data. */
- int stamp; /**< The state of the model. Any state
- * change increments this number. */
-};
-
/** @name Owner Tree Model Constructors
@{ */
diff --git a/gnucash/gnome-utils/gnc-tree-model-price.c b/gnucash/gnome-utils/gnc-tree-model-price.c
index c5e642c48c..6c7e6ac0b8 100644
--- a/gnucash/gnome-utils/gnc-tree-model-price.c
+++ b/gnucash/gnome-utils/gnc-tree-model-price.c
@@ -120,6 +120,14 @@ static void gnc_tree_model_price_event_handler (QofInstance *entity,
gpointer user_data,
gpointer event_data);
+/** The instance data structure for a price tree model. */
+struct _GncTreeModelPrice
+{
+ GncTreeModel gnc_tree_model; /**< The parent object data. */
+ int stamp; /**< The state of the model. Any state
+ * change increments this number. */
+};
+
/** The instance private data for a price database tree model. */
typedef struct GncTreeModelPricePrivate
{
diff --git a/gnucash/gnome-utils/gnc-tree-model-price.h b/gnucash/gnome-utils/gnc-tree-model-price.h
index 2c89c43917..4783c29662 100644
--- a/gnucash/gnome-utils/gnc-tree-model-price.h
+++ b/gnucash/gnome-utils/gnc-tree-model-price.h
@@ -66,16 +66,6 @@ typedef enum
GNC_TREE_MODEL_PRICE_NUM_COLUMNS
} GncTreeModelPriceColumn;
-/* typedefs & structures */
-
-/** The instance data structure for a price tree model. */
-struct _GncTreeModelPrice
-{
- GncTreeModel gnc_tree_model; /**< The parent object data. */
- int stamp; /**< The state of the model. Any state
- * change increments this number. */
-};
-
/** @name Account Tree Model Constructors
@{ */
commit ae352e9efe56d9d013d43d248c85dab8922d19a9
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:41:53 2023 +0100
Refactor: Remove unused GncTreeModelSelection
diff --git a/gnucash/gnome-utils/gnc-tree-model-selection.c b/gnucash/gnome-utils/gnc-tree-model-selection.c
deleted file mode 100644
index 11c4f91949..0000000000
--- a/gnucash/gnome-utils/gnc-tree-model-selection.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/*
- * gnc-tree-model-selection.c -- GtkTreeModel which supports a
- * selectable column.
- *
- * Copyright (C) 2003 Jan Arne Petersen
- * Author: Jan Arne Petersen <jpetersen at uni-bonn.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, contact:
- *
- * Free Software Foundation Voice: +1-617-542-5942
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
- * Boston, MA 02110-1301, USA gnu at gnu.org
- */
-
-#include <config.h>
-
-#include <gtk/gtk.h>
-
-#include "gnc-tree-model-selection.h"
-
-static void gnc_tree_model_selection_finalize (GObject *object);
-
-static void gnc_tree_model_selection_tree_model_init (GtkTreeModelIface *iface);
-static GtkTreeModelFlags gnc_tree_model_selection_get_flags (GtkTreeModel *tree_model);
-static int gnc_tree_model_selection_get_n_columns (GtkTreeModel *tree_model);
-static GType gnc_tree_model_selection_get_column_type (GtkTreeModel *tree_model,
- int index);
-static gboolean gnc_tree_model_selection_get_iter (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreePath *path);
-static GtkTreePath *gnc_tree_model_selection_get_path (GtkTreeModel *tree_model,
- GtkTreeIter *iter);
-static void gnc_tree_model_selection_get_value (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- int column,
- GValue *value);
-static gboolean gnc_tree_model_selection_iter_next (GtkTreeModel *tree_model,
- GtkTreeIter *iter);
-static gboolean gnc_tree_model_selection_iter_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent);
-static gboolean gnc_tree_model_selection_iter_has_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter);
-static int gnc_tree_model_selection_iter_n_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter);
-static gboolean gnc_tree_model_selection_iter_nth_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent,
- int n);
-static gboolean gnc_tree_model_selection_iter_parent (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *child);
-
-static void gnc_tree_model_selection_row_changed (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- GncTreeModelSelection *selection_model);
-static void gnc_tree_model_selection_row_inserted (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- GncTreeModelSelection *selection_model);
-static void gnc_tree_model_selection_row_has_child_toggled (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- GncTreeModelSelection *selection_model);
-static void gnc_tree_model_selection_row_deleted (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GncTreeModelSelection *selection_model);
-static void gnc_tree_model_selection_rows_reordered (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gint *new_order,
- GncTreeModelSelection *selection_model);
-
-static void gnc_tree_model_selection_toggled (GtkCellRendererToggle *toggle,
- gchar *path,
- GncTreeModelSelection *model);
-
-typedef struct GncTreeModelSelectionPrivate
-{
- GtkTreeModel *child_model;
-
- GHashTable *selections;
-} GncTreeModelSelectionPrivate;
-
-#define GNC_TREE_MODEL_SELECTION_GET_PRIVATE(o) \
- ((GncTreeModelSelectionPrivate*)gnc_tree_model_selection_get_instance_private((GncTreeModelSelection*)o))
-
-G_DEFINE_TYPE_WITH_CODE(GncTreeModelSelection, gnc_tree_model_selection, G_TYPE_OBJECT
- G_ADD_PRIVATE(GncTreeModelSelection)
- G_IMPLEMENT_INTERFACE(GTK_TYPE_TREE_MODEL,
- gnc_tree_model_selection_tree_model_init))
-
-static void
-gnc_tree_model_selection_class_init (GncTreeModelSelectionClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gnc_tree_model_selection_finalize;
-}
-
-static void
-gnc_tree_model_selection_init (GncTreeModelSelection *model)
-{
- GncTreeModelSelectionPrivate *priv;
-
- while (model->stamp == 0)
- {
- model->stamp = g_random_int ();
- }
-
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
- priv->selections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-}
-
-static void
-gnc_tree_model_selection_finalize (GObject *object)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNC_IS_TREE_MODEL_SELECTION (object));
-
- model = GNC_TREE_MODEL_SELECTION (object);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- g_object_unref (priv->child_model);
- g_hash_table_destroy (priv->selections);
-
- G_OBJECT_CLASS (gnc_tree_model_selection_parent_class)->finalize (object);
-}
-
-GtkTreeModel *
-gnc_tree_model_selection_new (GtkTreeModel *child_model)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
-
- model = g_object_new (GNC_TYPE_TREE_MODEL_SELECTION, NULL);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- priv->child_model = child_model;
- g_object_ref (child_model);
- g_signal_connect (G_OBJECT (child_model), "row_changed",
- G_CALLBACK (gnc_tree_model_selection_row_changed), model);
- g_signal_connect (G_OBJECT (child_model), "row_inserted",
- G_CALLBACK (gnc_tree_model_selection_row_inserted), model);
- g_signal_connect (G_OBJECT (child_model), "row_has_child_toggled",
- G_CALLBACK (gnc_tree_model_selection_row_has_child_toggled), model);
- g_signal_connect (G_OBJECT (child_model), "row_deleted",
- G_CALLBACK (gnc_tree_model_selection_row_deleted), model);
- g_signal_connect (G_OBJECT (child_model), "rows_reordered",
- G_CALLBACK (gnc_tree_model_selection_rows_reordered), model);
-
- return GTK_TREE_MODEL (model);
-}
-
-void
-gnc_tree_model_selection_convert_child_iter_to_iter (GncTreeModelSelection *model,
- GtkTreeIter *selection_iter,
- GtkTreeIter *child_iter)
-{
- g_return_if_fail (GNC_IS_TREE_MODEL_SELECTION (model));
- g_return_if_fail (child_iter != NULL);
- g_return_if_fail (selection_iter != NULL);
-
- selection_iter->stamp = model->stamp;
-
- selection_iter->user_data = gtk_tree_iter_copy (child_iter);
-}
-
-void
-gnc_tree_model_selection_convert_iter_to_child_iter (GncTreeModelSelection *model,
- GtkTreeIter *child_iter,
- GtkTreeIter *selection_iter)
-{
- g_return_if_fail (GNC_IS_TREE_MODEL_SELECTION (model));
- g_return_if_fail (selection_iter != NULL);
- g_return_if_fail (GNC_TREE_MODEL_SELECTION (model)->stamp == selection_iter->stamp);
- g_return_if_fail (selection_iter->user_data != NULL);
- g_return_if_fail (child_iter != NULL);
-
- child_iter->stamp = ((GtkTreeIter *) selection_iter->user_data)->stamp;
- child_iter->user_data = ((GtkTreeIter *) selection_iter->user_data)->user_data;
- child_iter->user_data2 = ((GtkTreeIter *) selection_iter->user_data)->user_data2;
- child_iter->user_data3 = ((GtkTreeIter *) selection_iter->user_data)->user_data3;
-}
-
-
-void
-gnc_tree_model_selection_set_selected (GncTreeModelSelection *model,
- GtkTreeIter *iter,
- gboolean selected)
-{
- GncTreeModelSelectionPrivate *priv;
- gchar *path_string;
- GtkTreePath *path;
-
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
- path_string = gtk_tree_model_get_string_from_iter (GTK_TREE_MODEL (model), iter);
-
- if (selected == (g_hash_table_lookup (priv->selections, path_string) != NULL))
- {
- g_free (path_string);
- return;
- }
-
- if (selected)
- {
- g_hash_table_insert (priv->selections, g_strdup (path_string), GINT_TO_POINTER (1));
- }
- else
- {
- g_hash_table_remove (priv->selections, path_string);
- }
-
- path = gtk_tree_path_new_from_string (path_string);
- gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, iter);
- gtk_tree_path_free (path);
-
- g_free (path_string);
-}
-
-static void
-gnc_tree_model_selection_tree_model_init (GtkTreeModelIface *iface)
-{
- iface->get_flags = gnc_tree_model_selection_get_flags;
- iface->get_n_columns = gnc_tree_model_selection_get_n_columns;
- iface->get_column_type = gnc_tree_model_selection_get_column_type;
- iface->get_iter = gnc_tree_model_selection_get_iter;
- iface->get_path = gnc_tree_model_selection_get_path;
- iface->get_value = gnc_tree_model_selection_get_value;
- iface->iter_next = gnc_tree_model_selection_iter_next;
- iface->iter_children = gnc_tree_model_selection_iter_children;
- iface->iter_has_child = gnc_tree_model_selection_iter_has_child;
- iface->iter_n_children = gnc_tree_model_selection_iter_n_children;
- iface->iter_nth_child = gnc_tree_model_selection_iter_nth_child;
- iface->iter_parent = gnc_tree_model_selection_iter_parent;
-}
-
-static GtkTreeModelFlags
-gnc_tree_model_selection_get_flags (GtkTreeModel *tree_model)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), 0);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- return gtk_tree_model_get_flags (priv->child_model);
-}
-
-static int
-gnc_tree_model_selection_get_n_columns (GtkTreeModel *tree_model)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), 0);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- return gtk_tree_model_get_n_columns (priv->child_model) + 1;
-}
-
-static GType
-gnc_tree_model_selection_get_column_type (GtkTreeModel *tree_model,
- int index)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- gint columns = gnc_tree_model_selection_get_n_columns (tree_model);
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), G_TYPE_INVALID);
- g_return_val_if_fail ((index >= 0) && (index < columns), G_TYPE_INVALID);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- if (index < columns - 1)
- {
- return gtk_tree_model_get_column_type (priv->child_model, index);
- }
- else
- {
- return G_TYPE_BOOLEAN;
- }
-}
-
-static gboolean
-gnc_tree_model_selection_get_iter (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreePath *path)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- GtkTreeIter child_iter;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), FALSE);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- if (!gtk_tree_model_get_iter (priv->child_model, &child_iter, path))
- {
- return FALSE;
- }
-
- gnc_tree_model_selection_convert_child_iter_to_iter (model, iter, &child_iter);
-
- return TRUE;
-}
-
-static GtkTreePath *
-gnc_tree_model_selection_get_path (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- GtkTreeIter child_iter;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), NULL);
- g_return_val_if_fail (iter != NULL, NULL);
- g_return_val_if_fail (iter->stamp == GNC_TREE_MODEL_SELECTION (tree_model)->stamp, NULL);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- gnc_tree_model_selection_convert_iter_to_child_iter (model, &child_iter, iter);
-
- return gtk_tree_model_get_path (priv->child_model, &child_iter);
-}
-
-static void
-gnc_tree_model_selection_get_value (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- int column,
- GValue *value)
-{
- gint columns = gnc_tree_model_selection_get_n_columns (tree_model);
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- GtkTreeIter child_iter;
- gchar *path;
-
- g_return_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model));
- g_return_if_fail ((column >= 0) && (column < columns));
- g_return_if_fail (iter != NULL);
- g_return_if_fail (iter->stamp == GNC_TREE_MODEL_SELECTION (tree_model)->stamp);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- gnc_tree_model_selection_convert_iter_to_child_iter (model, &child_iter, iter);
-
- if (column < columns - 1)
- {
- gtk_tree_model_get_value (priv->child_model, &child_iter, column, value);
- }
- else
- {
- g_value_init (value, G_TYPE_BOOLEAN);
-
- path = gtk_tree_model_get_string_from_iter (priv->child_model, &child_iter);
- g_value_set_boolean (value, g_hash_table_lookup (priv->selections, path) != NULL);
- g_free (path);
- }
-}
-
-static gboolean
-gnc_tree_model_selection_iter_next (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- GtkTreeIter child_iter;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), FALSE);
- g_return_val_if_fail (iter != NULL, FALSE);
- g_return_val_if_fail (iter->stamp == GNC_TREE_MODEL_SELECTION (tree_model)->stamp, FALSE);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- gnc_tree_model_selection_convert_iter_to_child_iter (model, &child_iter, iter);
-
- if (!gtk_tree_model_iter_next (priv->child_model, &child_iter))
- {
- return FALSE;
- }
- else
- {
- gnc_tree_model_selection_convert_child_iter_to_iter (model, iter, &child_iter);
-
- return TRUE;
- }
-}
-
-static gboolean
-gnc_tree_model_selection_iter_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- GtkTreeIter child_iter;
- GtkTreeIter child_parent;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), FALSE);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- if (parent == NULL)
- {
- if (!gtk_tree_model_iter_children (priv->child_model, &child_iter, NULL))
- return FALSE;
- }
- else
- {
- g_return_val_if_fail (parent != NULL, FALSE);
- g_return_val_if_fail (parent->stamp == model->stamp, FALSE);
-
- gnc_tree_model_selection_convert_iter_to_child_iter (model, &child_parent, parent);
-
- if (!gtk_tree_model_iter_children (priv->child_model, &child_iter, &child_parent))
- return FALSE;
- }
-
- gnc_tree_model_selection_convert_child_iter_to_iter (model, iter, &child_iter);
-
- return TRUE;
-}
-
-static gboolean
-gnc_tree_model_selection_iter_has_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- GtkTreeIter child_iter;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), FALSE);
- g_return_val_if_fail (iter != NULL, FALSE);
- g_return_val_if_fail (iter->stamp == GNC_TREE_MODEL_SELECTION (tree_model)->stamp, FALSE);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- gnc_tree_model_selection_convert_iter_to_child_iter (model, &child_iter, iter);
-
- return gtk_tree_model_iter_has_child (priv->child_model, &child_iter);
-}
-
-static int
-gnc_tree_model_selection_iter_n_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- GtkTreeIter child_iter;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), 0);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- if (iter == NULL)
- {
- return gtk_tree_model_iter_n_children (priv->child_model, NULL);
- }
- else
- {
- g_return_val_if_fail (iter != NULL, 0);
- g_return_val_if_fail (iter->stamp == model->stamp, 0);
-
- gnc_tree_model_selection_convert_iter_to_child_iter (model, &child_iter, iter);
-
- return gtk_tree_model_iter_n_children (priv->child_model, &child_iter);
- }
-}
-
-static gboolean
-gnc_tree_model_selection_iter_nth_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent,
- int n)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- GtkTreeIter child_iter;
- GtkTreeIter child_parent;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), FALSE);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- if (parent == NULL)
- {
- if (!gtk_tree_model_iter_nth_child (priv->child_model, &child_iter, NULL, n))
- return FALSE;
- }
- else
- {
- g_return_val_if_fail (iter != NULL, FALSE);
- g_return_val_if_fail (iter->stamp == model->stamp, FALSE);
-
- gnc_tree_model_selection_convert_iter_to_child_iter (model, &child_parent, parent);
-
- if (!gtk_tree_model_iter_nth_child (priv->child_model, &child_iter, &child_parent, n))
- return FALSE;
- }
-
- gnc_tree_model_selection_convert_child_iter_to_iter (model, iter, &child_iter);
-
- return TRUE;
-}
-
-static gboolean
-gnc_tree_model_selection_iter_parent (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *child)
-{
- GncTreeModelSelection *model;
- GncTreeModelSelectionPrivate *priv;
- GtkTreeIter child_child;
- GtkTreeIter child_iter;
-
- g_return_val_if_fail (GNC_IS_TREE_MODEL_SELECTION (tree_model), FALSE);
- g_return_val_if_fail (child != NULL, FALSE);
- g_return_val_if_fail (child->stamp == GNC_TREE_MODEL_SELECTION (tree_model)->stamp, FALSE);
-
- model = GNC_TREE_MODEL_SELECTION (tree_model);
- priv = GNC_TREE_MODEL_SELECTION_GET_PRIVATE(model);
-
- gnc_tree_model_selection_convert_iter_to_child_iter (model, &child_child, child);
-
- if (!gtk_tree_model_iter_parent (priv->child_model, &child_iter, &child_child))
- {
- return FALSE;
- }
- else
- {
- gnc_tree_model_selection_convert_child_iter_to_iter (model, iter, &child_iter);
-
- return TRUE;
- }
-}
-
-static void
-gnc_tree_model_selection_row_changed (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- GncTreeModelSelection *selection_model)
-{
- GtkTreeIter selection_iter;
-
- gnc_tree_model_selection_convert_child_iter_to_iter (selection_model, &selection_iter, iter);
-
- gtk_tree_model_row_changed (GTK_TREE_MODEL (selection_model), path, &selection_iter);
-}
-
-static void
-gnc_tree_model_selection_row_inserted (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- GncTreeModelSelection *selection_model)
-{
- GtkTreeIter selection_iter;
-
- gnc_tree_model_selection_convert_child_iter_to_iter (selection_model, &selection_iter, iter);
-
- gtk_tree_model_row_inserted (GTK_TREE_MODEL (selection_model), path, &selection_iter);
-}
-
-static void
-gnc_tree_model_selection_row_has_child_toggled (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- GncTreeModelSelection *selection_model)
-{
- GtkTreeIter selection_iter;
-
- gnc_tree_model_selection_convert_child_iter_to_iter (selection_model, &selection_iter, iter);
-
- gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (selection_model), path, &selection_iter);
-}
-
-static void
-gnc_tree_model_selection_row_deleted (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GncTreeModelSelection *selection_model)
-{
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (selection_model), path);
-}
-
-static void
-gnc_tree_model_selection_rows_reordered (GtkTreeModel *tree_model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gint *new_order,
- GncTreeModelSelection *selection_model)
-{
- GtkTreeIter selection_iter;
-
- gnc_tree_model_selection_convert_child_iter_to_iter (selection_model, &selection_iter, iter);
-
- gtk_tree_model_rows_reordered (GTK_TREE_MODEL (selection_model), path, &selection_iter, new_order);
-}
-
-static void
-gnc_tree_model_selection_toggled (GtkCellRendererToggle *toggle,
- gchar *path,
- GncTreeModelSelection *model)
-{
- GtkTreeIter iter;
-
- if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (model), &iter, path))
- {
- gnc_tree_model_selection_set_selected (model, &iter, !gtk_cell_renderer_toggle_get_active (toggle));
- }
-}
diff --git a/gnucash/gnome-utils/gnc-tree-model-selection.h b/gnucash/gnome-utils/gnc-tree-model-selection.h
deleted file mode 100644
index c06e469e13..0000000000
--- a/gnucash/gnome-utils/gnc-tree-model-selection.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * gnc-tree-model-selection.h -- GtkTreeModel which supports a
- * selectable column.
- *
- * Copyright (C) 2003 Jan Arne Petersen
- * Author: Jan Arne Petersen <jpetersen at uni-bonn.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, contact:
- *
- * Free Software Foundation Voice: +1-617-542-5942
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
- * Boston, MA 02110-1301, USA gnu at gnu.org
- */
-
-/*
- * This file creates a GtkTreeModel that extends an existing
- * GtkTreeModel by a single column. This new column holds a single
- * boolean value per row.
- *
- * GtkTreeViews allow the creation of columns in any order, not just
- * the order they appear in the underlying model. The most likely use
- * of this code will have the first view column mapped to this extra
- * boolean model column, and the column value displayed by a checkbox.
- */
-
-#ifndef __GNC_TREE_MODEL_SELECTION_H
-#define __GNC_TREE_MODEL_SELECTION_H
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-/* type macros */
-#define GNC_TYPE_TREE_MODEL_SELECTION (gnc_tree_model_selection_get_type ())
-#define GNC_TREE_MODEL_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_SELECTION, GncTreeModelSelection))
-#define GNC_TREE_MODEL_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_SELECTION, GncTreeModelSelectionClass))
-#define GNC_IS_TREE_MODEL_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_SELECTION))
-#define GNC_IS_TREE_MODEL_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_SELECTION))
-#define GNC_TREE_MODEL_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_SELECTION, GncTreeModelSelectionClass))
-
-/* typedefs & structures */
-typedef struct
-{
- GObject gobject;
- int stamp;
-} GncTreeModelSelection;
-
-typedef struct
-{
- GObjectClass gobject;
-} GncTreeModelSelectionClass;
-
-/* function prototypes */
-GType gnc_tree_model_selection_get_type (void);
-
-GtkTreeModel *gnc_tree_model_selection_new (GtkTreeModel *child_model);
-
-void gnc_tree_model_selection_convert_child_iter_to_iter (GncTreeModelSelection *model,
- GtkTreeIter *selection_iter,
- GtkTreeIter *child_iter);
-void gnc_tree_model_selection_convert_iter_to_child_iter (GncTreeModelSelection *model,
- GtkTreeIter *child_iter,
- GtkTreeIter *selection_iter);
-
-void gnc_tree_model_selection_set_selected (GncTreeModelSelection *model,
- GtkTreeIter *iter,
- gboolean selected);
-
-G_END_DECLS
-
-#endif /* __GNC_TREE_MODEL_SELECTION_H */
commit 91863dfb4bbc1edcdb9b573c369bd4d36cc4204d
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:41:08 2023 +0100
Refactor: DECLARE_FINAL GncTreeModelPrice < GncTreeModel
diff --git a/gnucash/gnome-utils/gnc-tree-model-price.h b/gnucash/gnome-utils/gnc-tree-model-price.h
index 6a89d03ffd..2c89c43917 100644
--- a/gnucash/gnome-utils/gnc-tree-model-price.h
+++ b/gnucash/gnome-utils/gnc-tree-model-price.h
@@ -45,11 +45,8 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_MODEL_PRICE (gnc_tree_model_price_get_type ())
-#define GNC_TREE_MODEL_PRICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_PRICE, GncTreeModelPrice))
-#define GNC_TREE_MODEL_PRICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_PRICE, GncTreeModelPriceClass))
-#define GNC_IS_TREE_MODEL_PRICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_PRICE))
-#define GNC_IS_TREE_MODEL_PRICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_PRICE))
-#define GNC_TREE_MODEL_PRICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_PRICE, GncTreeModelPriceClass))
+G_DECLARE_FINAL_TYPE (GncTreeModelPrice, gnc_tree_model_price, GNC, TREE_MODEL_PRICE, GncTreeModel)
+
#define GNC_TREE_MODEL_PRICE_NAME "GncTreeModelPrice"
@@ -72,27 +69,12 @@ typedef enum
/* typedefs & structures */
/** The instance data structure for a price tree model. */
-typedef struct
+struct _GncTreeModelPrice
{
GncTreeModel gnc_tree_model; /**< The parent object data. */
int stamp; /**< The state of the model. Any state
* change increments this number. */
-} GncTreeModelPrice;
-
-
-/** The class data structure for a price tree model. */
-typedef struct
-{
- GncTreeModelClass gnc_tree_model;/**< The parent object data. */
-} GncTreeModelPriceClass;
-
-
-/** Get the type of a price tree plugin.
- *
- * @return A GType.
- */
-GType gnc_tree_model_price_get_type (void);
-
+};
/** @name Account Tree Model Constructors
@{ */
commit 1c40aa8a77dd7eae1326e9bbc7d93b6c1ecee796
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:40:44 2023 +0100
Refactor: DECLARE_FINAL GncTreeModelOwner < GncTreeModel
diff --git a/gnucash/gnome-utils/gnc-tree-model-owner.h b/gnucash/gnome-utils/gnc-tree-model-owner.h
index ed4ce19c8b..8907333276 100644
--- a/gnucash/gnome-utils/gnc-tree-model-owner.h
+++ b/gnucash/gnome-utils/gnc-tree-model-owner.h
@@ -43,11 +43,8 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_MODEL_OWNER (gnc_tree_model_owner_get_type ())
-#define GNC_TREE_MODEL_OWNER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_OWNER, GncTreeModelOwner))
-#define GNC_TREE_MODEL_OWNER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_OWNER, GncTreeModelOwnerClass))
-#define GNC_IS_TREE_MODEL_OWNER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_OWNER))
-#define GNC_IS_TREE_MODEL_OWNER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_OWNER))
-#define GNC_TREE_MODEL_OWNER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_OWNER, GncTreeModelOwnerClass))
+G_DECLARE_FINAL_TYPE (GncTreeModelOwner, gnc_tree_model_owner, GNC, TREE_MODEL_OWNER, GncTreeModel)
+
#define GNC_TREE_MODEL_OWNER_NAME "GncTreeModelOwner"
@@ -81,28 +78,12 @@ typedef enum
/* typedefs & structures */
/** The instance data structure for an owner tree model. */
-typedef struct
+struct _GncTreeModelOwner
{
GncTreeModel gnc_tree_model; /**< The parent object data. */
int stamp; /**< The state of the model. Any state
* change increments this number. */
-} GncTreeModelOwner;
-
-
-/** The class data structure for an owner tree model. */
-typedef struct
-{
- GncTreeModelClass gnc_tree_model;/**< The parent object data. */
-} GncTreeModelOwnerClass;
-
-
-
-/** Get the type of an owner tree plugin.
- *
- * @return A GType.
- */
-GType gnc_tree_model_owner_get_type (void);
-
+};
/** @name Owner Tree Model Constructors
@{ */
commit 45c3f2831a7f9d756ca260aa0b67913e9ce15b4a
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:40:20 2023 +0100
Refactor: DECLARE_FINAL GncTreeModelCommodity < GncTreeModel
diff --git a/gnucash/gnome-utils/gnc-tree-model-commodity.h b/gnucash/gnome-utils/gnc-tree-model-commodity.h
index dc9b88acc4..e8ef562cb9 100644
--- a/gnucash/gnome-utils/gnc-tree-model-commodity.h
+++ b/gnucash/gnome-utils/gnc-tree-model-commodity.h
@@ -45,11 +45,8 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_MODEL_COMMODITY (gnc_tree_model_commodity_get_type ())
-#define GNC_TREE_MODEL_COMMODITY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_COMMODITY, GncTreeModelCommodity))
-#define GNC_TREE_MODEL_COMMODITY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_COMMODITY, GncTreeModelCommodityClass))
-#define GNC_IS_TREE_MODEL_COMMODITY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_COMMODITY))
-#define GNC_IS_TREE_MODEL_COMMODITY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_COMMODITY))
-#define GNC_TREE_MODEL_COMMODITY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_COMMODITY, GncTreeModelCommodityClass))
+G_DECLARE_FINAL_TYPE (GncTreeModelCommodity, gnc_tree_model_commodity, GNC, TREE_MODEL_COMMODITY, GncTreeModel)
+
#define GNC_TREE_MODEL_COMMODITY_NAME "GncTreeModelCommodity"
@@ -78,26 +75,12 @@ typedef enum
/* typedefs & structures */
/** The instance data structure for a commodity tree model. */
-typedef struct
+struct _GncTreeModelCommodity
{
GncTreeModel gnc_tree_model; /**< The parent object data. */
int stamp; /**< The state of the model. Any state
* change increments this number. */
-} GncTreeModelCommodity;
-
-
-/** The class data structure for a commodity tree model. */
-typedef struct
-{
- GncTreeModelClass gnc_tree_model;/**< The parent object data. */
-} GncTreeModelCommodityClass;
-
-
-/** Get the type of a commodity tree plugin.
- *
- * @return A GType.
- */
-GType gnc_tree_model_commodity_get_type (void);
+};
/** @name Account Tree Model Constructors
commit 241afec3a8abc15cda19a30a667c4184b89241fa
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:39:43 2023 +0100
Refactor: DECLARE_FINAL GncTreeModelAccount < GncTreeModel
diff --git a/gnucash/gnome-utils/gnc-tree-model-account.h b/gnucash/gnome-utils/gnc-tree-model-account.h
index a9c83d112a..802e4efd01 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.h
+++ b/gnucash/gnome-utils/gnc-tree-model-account.h
@@ -45,14 +45,9 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_MODEL_ACCOUNT (gnc_tree_model_account_get_type ())
-#define GNC_TREE_MODEL_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL_ACCOUNT, GncTreeModelAccount))
-#define GNC_TREE_MODEL_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL_ACCOUNT, GncTreeModelAccountClass))
-#define GNC_IS_TREE_MODEL_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL_ACCOUNT))
-#define GNC_IS_TREE_MODEL_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL_ACCOUNT))
-#define GNC_TREE_MODEL_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL_ACCOUNT, GncTreeModelAccountClass))
+G_DECLARE_FINAL_TYPE (GncTreeModelAccount, gnc_tree_model_account, GNC, TREE_MODEL_ACCOUNT, GncTreeModel)
#define GNC_TREE_MODEL_ACCOUNT_NAME "GncTreeModelAccount"
-
typedef enum
{
GNC_TREE_MODEL_ACCOUNT_COL_NAME,
@@ -104,27 +99,12 @@ typedef enum
/* typedefs & structures */
/** The instance data structure for an account tree model. */
-typedef struct
+struct _GncTreeModelAccount
{
GncTreeModel gnc_tree_model; /**< The parent object data. */
int stamp; /**< The state of the model. Any state
* change increments this number. */
-} GncTreeModelAccount;
-
-
-/** The class data structure for an account tree model. */
-typedef struct
-{
- GncTreeModelClass gnc_tree_model;/**< The parent object data. */
-} GncTreeModelAccountClass;
-
-
-
-/** Get the type of an account tree plugin.
- *
- * @return A GType.
- */
-GType gnc_tree_model_account_get_type (void);
+};
/** Clear the tree model account cached values.
*
commit 97a5bf0a3d1e77f8e3a278b7def69a8933f5e7f1
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:39:06 2023 +0100
Refactor: DECLARE_FINAL GncTreeModelAccountTypes < GObject
diff --git a/gnucash/gnome-utils/gnc-tree-model-account-types.h b/gnucash/gnome-utils/gnc-tree-model-account-types.h
index b383b4c1a1..29019be2d6 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account-types.h
+++ b/gnucash/gnome-utils/gnc-tree-model-account-types.h
@@ -44,11 +44,7 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES (gnc_tree_model_account_types_get_type ())
-#define GNC_TREE_MODEL_ACCOUNT_TYPES(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES, GncTreeModelAccountTypes))
-#define GNC_TREE_MODEL_ACCOUNT_TYPES_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES, GncTreeModelAccountTypesClass))
-#define GNC_IS_TREE_MODEL_ACCOUNT_TYPES(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES))
-#define GNC_IS_TREE_MODEL_ACCOUNT_TYPES_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES))
-#define GNC_TREE_MODEL_ACCOUNT_TYPES_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_TREE_MODEL_ACCOUNT_TYPES, GncTreeModelAccountTypesClass))
+G_DECLARE_FINAL_TYPE (GncTreeModelAccountTypes, gnc_tree_model_account_types, GNC, TREE_MODEL_ACCOUNT_TYPES, GObject)
typedef enum
{
@@ -59,19 +55,13 @@ typedef enum
} GncTreeModelAccountTypesColumn;
/* typedefs & structures */
-typedef struct
+struct _GncTreeModelAccountTypes
{
GObject gobject;
int stamp;
-} GncTreeModelAccountTypes;
-
-typedef struct
-{
- GObjectClass gobject;
-} GncTreeModelAccountTypesClass;
+};
/* function prototypes */
-GType gnc_tree_model_account_types_get_type (void);
/* Choose one of two methods to use the GncTreeModelAccountTypes
objects defined here, depending on how you want to deal with
commit 80fdffb07b26af38081e659242496b0ea690ae89
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Mon Jun 12 19:42:49 2023 +0100
Refactor: DECLARE_DERIVABLE GncTreeModel < GObject
diff --git a/gnucash/gnome-utils/gnc-tree-model.h b/gnucash/gnome-utils/gnc-tree-model.h
index 5d9878b982..7b25065eb2 100644
--- a/gnucash/gnome-utils/gnc-tree-model.h
+++ b/gnucash/gnome-utils/gnc-tree-model.h
@@ -41,36 +41,17 @@ G_BEGIN_DECLS
/* type macros */
#define GNC_TYPE_TREE_MODEL (gnc_tree_model_get_type ())
-#define GNC_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNC_TYPE_TREE_MODEL, GncTreeModel))
-#define GNC_TREE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_TREE_MODEL, GncTreeModelClass))
-#define GNC_IS_TREE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNC_TYPE_TREE_MODEL))
-#define GNC_IS_TREE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_TREE_MODEL))
-#define GNC_TREE_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_TYPE_TREE_MODEL, GncTreeModelClass))
+G_DECLARE_DERIVABLE_TYPE (GncTreeModel, gnc_tree_model, GNC, TREE_MODEL, GObject)
+
#define GNC_TREE_MODEL_NAME "GncTreeModel"
/* typedefs & structures */
-/** The instance data structure for a generic tree model. */
-typedef struct
-{
- GObject g_object; /**< The parent object data. */
-} GncTreeModel;
-
-
/** The class data structure for a generic tree model. */
-typedef struct
+struct _GncTreeModelClass
{
GObjectClass g_object; /**< The parent object data. */
-} GncTreeModelClass;
-
-
-
-/** Get the type of a generic tree model plugin.
- *
- * @return A GType.
- */
-GType gnc_tree_model_get_type (void);
-
+};
G_END_DECLS
commit a8943dc315dbd0a4d748673f677c99ca9b43ecf3
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 26 16:11:47 2023 +0100
Refactor: remove unnecessary GNCSearch*Private
- rename parent to parent_instance
- remove unused member dummy
diff --git a/gnucash/gnome-search/search-boolean.c b/gnucash/gnome-search/search-boolean.c
index 36afbe85cb..2561d11afc 100644
--- a/gnucash/gnome-search/search-boolean.c
+++ b/gnucash/gnome-search/search-boolean.c
@@ -45,23 +45,14 @@ static void gnc_search_boolean_finalize (GObject *obj);
struct _GNCSearchBoolean
{
- GNCSearchCoreType parent;
+ GNCSearchCoreType parent_instance;
gboolean value;
-};
-
-typedef struct _GNCSearchBooleanPrivate GNCSearchBooleanPrivate;
-struct _GNCSearchBooleanPrivate
-{
GtkWindow *parent;
- gpointer dummy;
};
-G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchBoolean, gnc_search_boolean, GNC_TYPE_SEARCH_CORE_TYPE)
-
-#define _PRIVATE(o) \
- ((GNCSearchBooleanPrivate*)gnc_search_boolean_get_instance_private((GNCSearchBoolean*)o))
+G_DEFINE_TYPE(GNCSearchBoolean, gnc_search_boolean, GNC_TYPE_SEARCH_CORE_TYPE)
static void
gnc_search_boolean_class_init (GNCSearchBooleanClass *klass)
@@ -123,13 +114,11 @@ static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchBoolean *fi = (GNCSearchBoolean *)fe;
- GNCSearchBooleanPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_BOOLEAN (fi));
- priv = _PRIVATE(fi);
- priv->parent = GTK_WINDOW(parent);
+ fi->parent = GTK_WINDOW(parent);
}
static gboolean
diff --git a/gnucash/gnome-search/search-date.c b/gnucash/gnome-search/search-date.c
index 85119e489c..3a7c12d1fb 100644
--- a/gnucash/gnome-search/search-date.c
+++ b/gnucash/gnome-search/search-date.c
@@ -49,24 +49,16 @@ static void gnc_search_date_finalize (GObject *obj);
struct _GNCSearchDate
{
- GNCSearchCoreType parent;
+ GNCSearchCoreType parent_instance;
QofQueryCompare how;
time64 tt;
-};
-
-typedef struct _GNCSearchDatePrivate GNCSearchDatePrivate;
-struct _GNCSearchDatePrivate
-{
GtkWidget *entry;
GtkWindow *parent;
};
-G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchDate, gnc_search_date, GNC_TYPE_SEARCH_CORE_TYPE)
-
-#define _PRIVATE(o) \
- ((GNCSearchDatePrivate*)gnc_search_date_get_instance_private((GNCSearchDate*)o))
+G_DEFINE_TYPE(GNCSearchDate, gnc_search_date, GNC_TYPE_SEARCH_CORE_TYPE)
static void
gnc_search_date_class_init (GNCSearchDateClass *klass)
@@ -99,14 +91,12 @@ static void
gnc_search_date_finalize (GObject *obj)
{
GNCSearchDate *o;
- GNCSearchDatePrivate *priv;
g_assert (GNC_IS_SEARCH_DATE (obj));
o = GNC_SEARCH_DATE(obj);
- priv = _PRIVATE(o);
- if (priv->entry)
- gtk_widget_destroy (priv->entry);
+ if (o->entry)
+ gtk_widget_destroy (o->entry);
G_OBJECT_CLASS (gnc_search_date_parent_class)->finalize(obj);
}
@@ -146,13 +136,11 @@ static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchDate *fi = (GNCSearchDate *)fe;
- GNCSearchDatePrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_DATE (fi));
- priv = _PRIVATE(fi);
- priv->parent = GTK_WINDOW(parent);
+ fi->parent = GTK_WINDOW(parent);
}
static gboolean
@@ -212,28 +200,24 @@ static void
grab_focus (GNCSearchCoreType *fe)
{
GNCSearchDate *fi = (GNCSearchDate *)fe;
- GNCSearchDatePrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_DATE (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gtk_widget_grab_focus (GNC_DATE_EDIT(priv->entry)->date_entry);
+ if (fi->entry)
+ gtk_widget_grab_focus (GNC_DATE_EDIT(fi->entry)->date_entry);
}
static void
editable_enters (GNCSearchCoreType *fe)
{
GNCSearchDate *fi = (GNCSearchDate *)fe;
- GNCSearchDatePrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_DATE (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gnc_date_activates_default (GNC_DATE_EDIT (priv->entry), TRUE);
+ if (fi->entry)
+ gnc_date_activates_default (GNC_DATE_EDIT (fi->entry), TRUE);
}
static GtkWidget *
@@ -241,12 +225,10 @@ gncs_get_widget (GNCSearchCoreType *fe)
{
GtkWidget *entry, *menu, *box;
GNCSearchDate *fi = (GNCSearchDate *)fe;
- GNCSearchDatePrivate *priv;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_DATE (fi), NULL);
- priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
@@ -259,7 +241,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
g_signal_connect (G_OBJECT (entry), "date_changed", G_CALLBACK (date_changed), fe);
gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 3);
g_object_ref (entry);
- priv->entry = entry;
+ fi->entry = entry;
/* And return the box */
return box;
@@ -268,15 +250,13 @@ gncs_get_widget (GNCSearchCoreType *fe)
static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
{
GNCSearchDate *fi = (GNCSearchDate *)fe;
- GNCSearchDatePrivate *priv;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_DATE (fi), NULL);
/* Make sure we actually use the currently-entered date */
- priv = _PRIVATE(fi);
- if (priv->entry)
- gnc_search_date_set_date_from_edit (fi, GNC_DATE_EDIT (priv->entry));
+ if (fi->entry)
+ gnc_search_date_set_date_from_edit (fi, GNC_DATE_EDIT (fi->entry));
if (fi->how == QOF_COMPARE_EQUAL || fi->how == QOF_COMPARE_NEQ)
return qof_query_date_predicate (fi->how, QOF_DATE_MATCH_DAY, fi->tt);
diff --git a/gnucash/gnome-search/search-double.c b/gnucash/gnome-search/search-double.c
index eea6116218..140995bb41 100644
--- a/gnucash/gnome-search/search-double.c
+++ b/gnucash/gnome-search/search-double.c
@@ -49,25 +49,17 @@ static void gnc_search_double_finalize (GObject *obj);
struct _GNCSearchDouble
{
- GNCSearchCoreType parent;
+ GNCSearchCoreType parent_instance;
QofQueryCompare how;
double value;
-};
-
-typedef struct _GNCSearchDoublePrivate GNCSearchDoublePrivate;
-struct _GNCSearchDoublePrivate
-{
GtkWidget * entry;
GNCAmountEdit *gae;
GtkWindow *parent;
};
-G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchDouble, gnc_search_double, GNC_TYPE_SEARCH_CORE_TYPE)
-
-#define _PRIVATE(o) \
- ((GNCSearchDoublePrivate*)gnc_search_double_get_instance_private((GNCSearchDouble*)o))
+G_DEFINE_TYPE(GNCSearchDouble, gnc_search_double, GNC_TYPE_SEARCH_CORE_TYPE)
static void
gnc_search_double_class_init (GNCSearchDoubleClass *klass)
@@ -139,31 +131,26 @@ static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchDouble *fi = (GNCSearchDouble *)fe;
- GNCSearchDoublePrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_DOUBLE (fi));
- priv = _PRIVATE(fi);
- priv->parent = GTK_WINDOW(parent);
+ fi->parent = GTK_WINDOW(parent);
}
static gboolean
gncs_validate (GNCSearchCoreType *fe)
{
GNCSearchDouble *fi = (GNCSearchDouble *)fe;
- GNCSearchDoublePrivate *priv;
gboolean valid = TRUE;
GError *error = NULL;
g_return_val_if_fail (fi, FALSE);
g_return_val_if_fail (GNC_IS_SEARCH_DOUBLE (fi), FALSE);
- priv = _PRIVATE(fi);
-
- if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT(priv->gae), &error))
+ if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT(fi->gae), &error))
{
- gnc_error_dialog (GTK_WINDOW(priv->parent), "%s", error->message);
+ gnc_error_dialog (GTK_WINDOW(fi->parent), "%s", error->message);
valid = FALSE;
g_error_free (error);
}
@@ -201,28 +188,24 @@ static void
grab_focus (GNCSearchCoreType *fe)
{
GNCSearchDouble *fi = (GNCSearchDouble *)fe;
- GNCSearchDoublePrivate *priv ;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_DOUBLE (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gtk_widget_grab_focus (priv->entry);
+ if (fi->entry)
+ gtk_widget_grab_focus (fi->entry);
}
static void
editable_enters (GNCSearchCoreType *fe)
{
GNCSearchDouble *fi = (GNCSearchDouble *)fe;
- GNCSearchDoublePrivate *priv ;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_DOUBLE (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gtk_entry_set_activates_default(GTK_ENTRY (priv->entry), TRUE);
+ if (fi->entry)
+ gtk_entry_set_activates_default(GTK_ENTRY (fi->entry), TRUE);
}
static GtkWidget *
@@ -230,12 +213,10 @@ gncs_get_widget (GNCSearchCoreType *fe)
{
GtkWidget *entry, *menu, *box;
GNCSearchDouble *fi = (GNCSearchDouble *)fe;
- GNCSearchDoublePrivate *priv ;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_DOUBLE (fi), NULL);
- priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
@@ -249,8 +230,8 @@ gncs_get_widget (GNCSearchCoreType *fe)
gnc_amount_edit_set_damount (GNC_AMOUNT_EDIT (entry), fi->value);
g_signal_connect (G_OBJECT (entry), "amount_changed", G_CALLBACK (entry_changed), fe);
gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 3);
- priv->entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (entry));
- priv->gae = GNC_AMOUNT_EDIT (entry);
+ fi->entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (entry));
+ fi->gae = GNC_AMOUNT_EDIT (entry);
/* And return the box */
return box;
@@ -259,14 +240,12 @@ gncs_get_widget (GNCSearchCoreType *fe)
static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
{
GNCSearchDouble *fi = (GNCSearchDouble *)fe;
- GNCSearchDoublePrivate *priv ;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_DOUBLE (fi), NULL);
/* force the computation of the entry, because we may not get the signal */
- priv = _PRIVATE(fi);
- entry_changed (priv->gae, fi);
+ entry_changed (fi->gae, fi);
return qof_query_double_predicate (fi->how, fi->value);
}
diff --git a/gnucash/gnome-search/search-int64.c b/gnucash/gnome-search/search-int64.c
index 6961ef7c22..bae4e7d613 100644
--- a/gnucash/gnome-search/search-int64.c
+++ b/gnucash/gnome-search/search-int64.c
@@ -49,25 +49,17 @@ static void gnc_search_int64_finalize (GObject *obj);
struct _GNCSearchInt64
{
- GNCSearchCoreType parent;
+ GNCSearchCoreType parent_instance;
QofQueryCompare how;
gint64 value;
-};
-
-typedef struct _GNCSearchInt64Private GNCSearchInt64Private;
-struct _GNCSearchInt64Private
-{
GtkWidget *entry;
GNCAmountEdit *gae;
GtkWindow *parent;
};
-G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchInt64, gnc_search_int64, GNC_TYPE_SEARCH_CORE_TYPE)
-
-#define _PRIVATE(o) \
- ((GNCSearchInt64Private*)gnc_search_int64_get_instance_private((GNCSearchInt64*)o))
+G_DEFINE_TYPE(GNCSearchInt64, gnc_search_int64, GNC_TYPE_SEARCH_CORE_TYPE)
static void
gnc_search_int64_class_init (GNCSearchInt64Class *klass)
@@ -139,31 +131,26 @@ static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchInt64 *fi = (GNCSearchInt64 *)fe;
- GNCSearchInt64Private *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_INT64 (fi));
- priv = _PRIVATE(fi);
- priv->parent = GTK_WINDOW(parent);
+ fi->parent = GTK_WINDOW(parent);
}
static gboolean
gncs_validate (GNCSearchCoreType *fe)
{
GNCSearchInt64 *fi = (GNCSearchInt64 *)fe;
- GNCSearchInt64Private *priv;
gboolean valid = TRUE;
GError *error = NULL;
g_return_val_if_fail (fi, FALSE);
g_return_val_if_fail (GNC_IS_SEARCH_INT64 (fi), FALSE);
- priv = _PRIVATE(fi);
-
- if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT(priv->gae), &error))
+ if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT(fi->gae), &error))
{
- gnc_error_dialog (GTK_WINDOW(priv->parent), "%s", error->message);
+ gnc_error_dialog (GTK_WINDOW(fi->parent), "%s", error->message);
valid = FALSE;
g_error_free (error);
}
@@ -202,28 +189,24 @@ static void
grab_focus (GNCSearchCoreType *fe)
{
GNCSearchInt64 *fi = (GNCSearchInt64 *)fe;
- GNCSearchInt64Private *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_INT64 (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gtk_widget_grab_focus (priv->entry);
+ if (fi->entry)
+ gtk_widget_grab_focus (fi->entry);
}
static void
editable_enters (GNCSearchCoreType *fe)
{
GNCSearchInt64 *fi = (GNCSearchInt64 *)fe;
- GNCSearchInt64Private *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_INT64 (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gtk_entry_set_activates_default(GTK_ENTRY (priv->entry), TRUE);
+ if (fi->entry)
+ gtk_entry_set_activates_default(GTK_ENTRY (fi->entry), TRUE);
}
static GtkWidget *
@@ -231,12 +214,10 @@ gncs_get_widget (GNCSearchCoreType *fe)
{
GtkWidget *entry, *menu, *box;
GNCSearchInt64 *fi = (GNCSearchInt64 *)fe;
- GNCSearchInt64Private *priv;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_INT64 (fi), NULL);
- priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
@@ -255,8 +236,8 @@ gncs_get_widget (GNCSearchCoreType *fe)
}
g_signal_connect (G_OBJECT (entry), "amount_changed", G_CALLBACK (entry_changed), fe);
gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 3);
- priv->entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (entry));
- priv->gae = GNC_AMOUNT_EDIT (entry);
+ fi->entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (entry));
+ fi->gae = GNC_AMOUNT_EDIT (entry);
/* And return the box */
return box;
@@ -265,14 +246,12 @@ gncs_get_widget (GNCSearchCoreType *fe)
static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
{
GNCSearchInt64 *fi = (GNCSearchInt64 *)fe;
- GNCSearchInt64Private *priv;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_INT64 (fi), NULL);
/* force the computation of the entry, because we may not get the signal */
- priv = _PRIVATE(fi);
- entry_changed (priv->gae, fi);
+ entry_changed (fi->gae, fi);
return qof_query_int64_predicate (fi->how, fi->value);
}
diff --git a/gnucash/gnome-search/search-numeric.c b/gnucash/gnome-search/search-numeric.c
index 42b4fb20f4..7ce7de756a 100644
--- a/gnucash/gnome-search/search-numeric.c
+++ b/gnucash/gnome-search/search-numeric.c
@@ -49,28 +49,19 @@ static void gnc_search_numeric_finalize (GObject *obj);
struct _GNCSearchNumeric
{
- GNCSearchCoreType parent;
- struct _GNCSearchNumericPrivate *priv;
+ GNCSearchCoreType parent_instance;
QofQueryCompare how;
gnc_numeric value;
QofNumericMatch option;
-};
-
-typedef struct _GNCSearchNumericPrivate GNCSearchNumericPrivate;
-struct _GNCSearchNumericPrivate
-{
gboolean is_debcred;
GtkWidget * entry;
GNCAmountEdit *gae;
GtkWindow *parent;
};
-G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchNumeric, gnc_search_numeric, GNC_TYPE_SEARCH_CORE_TYPE)
-
-#define _PRIVATE(o) \
- ((GNCSearchNumericPrivate*)gnc_search_numeric_get_instance_private((GNCSearchNumeric*)o))
+G_DEFINE_TYPE(GNCSearchNumeric, gnc_search_numeric, GNC_TYPE_SEARCH_CORE_TYPE)
static void
gnc_search_numeric_class_init (GNCSearchNumericClass *klass)
@@ -134,11 +125,9 @@ GNCSearchNumeric *
gnc_search_numeric_debcred_new (void)
{
GNCSearchNumeric *o;
- GNCSearchNumericPrivate *priv;
o = g_object_new(GNC_TYPE_SEARCH_NUMERIC, NULL);
- priv = _PRIVATE(o);
- priv->is_debcred = TRUE;
+ o->is_debcred = TRUE;
return o;
}
@@ -171,31 +160,26 @@ static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
- GNCSearchNumericPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_NUMERIC (fi));
- priv = _PRIVATE(fi);
- priv->parent = GTK_WINDOW(parent);
+ fi->parent = GTK_WINDOW(parent);
}
static gboolean
gncs_validate (GNCSearchCoreType *fe)
{
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
- GNCSearchNumericPrivate *priv;
gboolean valid = TRUE;
GError *error = NULL;
g_return_val_if_fail (fi, FALSE);
g_return_val_if_fail (GNC_IS_SEARCH_NUMERIC (fi), FALSE);
- priv = _PRIVATE(fi);
-
- if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT(priv->gae), &error))
+ if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT(fi->gae), &error))
{
- gnc_error_dialog (GTK_WINDOW(priv->parent), "%s", error->message);
+ gnc_error_dialog (GTK_WINDOW(fi->parent), "%s", error->message);
valid = FALSE;
g_error_free (error);
}
@@ -212,29 +196,26 @@ static GtkWidget *
make_how_menu (GNCSearchCoreType *fe)
{
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
- GNCSearchNumericPrivate *priv;
GtkComboBox *combo;
- priv = _PRIVATE(fi);
-
combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
- gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ gnc_combo_box_search_add(combo, (fi->is_debcred ?
_("less than") : _("is less than")),
QOF_COMPARE_LT);
- gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ gnc_combo_box_search_add(combo, (fi->is_debcred ?
_("less than or equal to") :
_("is less than or equal to")),
QOF_COMPARE_LTE);
- gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ gnc_combo_box_search_add(combo, (fi->is_debcred ?
_("equal to") : _("equals")),
QOF_COMPARE_EQUAL);
- gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ gnc_combo_box_search_add(combo, (fi->is_debcred ?
_("not equal to") : _("does not equal")),
QOF_COMPARE_NEQ);
- gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ gnc_combo_box_search_add(combo, (fi->is_debcred ?
_("greater than") : _("is greater than")),
QOF_COMPARE_GT);
- gnc_combo_box_search_add(combo, (priv->is_debcred ?
+ gnc_combo_box_search_add(combo, (fi->is_debcred ?
_("greater than or equal to") :
_("is greater than or equal to")),
QOF_COMPARE_GTE);
@@ -265,28 +246,24 @@ static void
grab_focus (GNCSearchCoreType *fe)
{
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
- GNCSearchNumericPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_NUMERIC (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gtk_widget_grab_focus (priv->entry);
+ if (fi->entry)
+ gtk_widget_grab_focus (fi->entry);
}
static void
editable_enters (GNCSearchCoreType *fe)
{
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
- GNCSearchNumericPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_NUMERIC (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gtk_entry_set_activates_default(GTK_ENTRY (priv->entry), TRUE);
+ if (fi->entry)
+ gtk_entry_set_activates_default(GTK_ENTRY (fi->entry), TRUE);
}
static GtkWidget *
@@ -294,17 +271,15 @@ gncs_get_widget (GNCSearchCoreType *fe)
{
GtkWidget *entry, *menu, *box;
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
- GNCSearchNumericPrivate *priv;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_NUMERIC (fi), NULL);
- priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
/* Build and connect the option menu(s) */
- if (priv->is_debcred)
+ if (fi->is_debcred)
{
menu = make_option_menu (fe);
gtk_box_pack_start (GTK_BOX (box), menu, FALSE, FALSE, 3);
@@ -318,8 +293,8 @@ gncs_get_widget (GNCSearchCoreType *fe)
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (entry), fi->value);
g_signal_connect (G_OBJECT (entry), "amount_changed", G_CALLBACK (entry_changed), fe);
gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 3);
- priv->gae = GNC_AMOUNT_EDIT (entry);
- priv->entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (entry));
+ fi->gae = GNC_AMOUNT_EDIT (entry);
+ fi->entry = gnc_amount_edit_gtk_entry (GNC_AMOUNT_EDIT (entry));
/* And return the box */
return box;
@@ -328,14 +303,12 @@ gncs_get_widget (GNCSearchCoreType *fe)
static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
{
GNCSearchNumeric *fi = (GNCSearchNumeric *)fe;
- GNCSearchNumericPrivate *priv;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_NUMERIC (fi), NULL);
/* force the computation of the entry, because we may not get the signal */
- priv = _PRIVATE(fi);
- entry_changed (priv->gae, fi);
+ entry_changed (fi->gae, fi);
return qof_query_numeric_predicate (fi->how, fi->option, fi->value);
}
@@ -343,18 +316,15 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
{
GNCSearchNumeric *se, *fse = (GNCSearchNumeric *)fe;
- GNCSearchNumericPrivate *se_priv, *fse_priv;
g_return_val_if_fail (fse, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_NUMERIC (fse), NULL);
- fse_priv = _PRIVATE(fse);
se = gnc_search_numeric_new ();
gnc_search_numeric_set_value (se, fse->value);
gnc_search_numeric_set_how (se, fse->how);
- se_priv = _PRIVATE(se);
gnc_search_numeric_set_option (se, fse->option);
- se_priv->is_debcred = fse_priv->is_debcred;
+ se->is_debcred = fse->is_debcred;
return (GNCSearchCoreType *)se;
}
diff --git a/gnucash/gnome-search/search-reconciled.c b/gnucash/gnome-search/search-reconciled.c
index 52dd519c22..4ec704979e 100644
--- a/gnucash/gnome-search/search-reconciled.c
+++ b/gnucash/gnome-search/search-reconciled.c
@@ -47,24 +47,15 @@ static void gnc_search_reconciled_finalize (GObject *obj);
struct _GNCSearchReconciled
{
- GNCSearchCoreType parent;
+ GNCSearchCoreType parent_instance;
QofCharMatch how;
cleared_match_t value;
-};
-
-typedef struct _GNCSearchReconciledPrivate GNCSearchReconciledPrivate;
-struct _GNCSearchReconciledPrivate
-{
GtkWindow *parent;
- gpointer dummy;
};
-G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchReconciled, gnc_search_reconciled, GNC_TYPE_SEARCH_CORE_TYPE)
-
-#define _PRIVATE(o) \
- ((GNCSearchReconciledPrivate*)gnc_search_reconciled_get_instance_private((GNCSearchReconciled*)o))
+G_DEFINE_TYPE(GNCSearchReconciled, gnc_search_reconciled, GNC_TYPE_SEARCH_CORE_TYPE)
static void
gnc_search_reconciled_class_init (GNCSearchReconciledClass *klass)
@@ -135,13 +126,11 @@ static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchReconciled *fi = (GNCSearchReconciled *)fe;
- GNCSearchReconciledPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_RECONCILED (fi));
- priv = _PRIVATE(fi);
- priv->parent = GTK_WINDOW(parent);
+ fi->parent = GTK_WINDOW(parent);
}
static gboolean
diff --git a/gnucash/gnome-search/search-string.c b/gnucash/gnome-search/search-string.c
index 58400cc142..dcea25bb9a 100644
--- a/gnucash/gnome-search/search-string.c
+++ b/gnucash/gnome-search/search-string.c
@@ -49,25 +49,17 @@ static void gnc_search_string_finalize (GObject *obj);
struct _GNCSearchString
{
- GNCSearchCoreType parent;
+ GNCSearchCoreType parent_instance;
GNCSearchString_Type how;
gboolean ign_case;
char * value;
-};
-
-typedef struct _GNCSearchStringPrivate GNCSearchStringPrivate;
-struct _GNCSearchStringPrivate
-{
GtkWidget *entry;
GtkWindow *parent;
};
-G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchString, gnc_search_string, GNC_TYPE_SEARCH_CORE_TYPE)
-
-#define _PRIVATE(o) \
- ((GNCSearchStringPrivate*)gnc_search_string_get_instance_private((GNCSearchString*)o))
+G_DEFINE_TYPE(GNCSearchString, gnc_search_string, GNC_TYPE_SEARCH_CORE_TYPE)
static void
gnc_search_string_class_init (GNCSearchStringClass *klass)
@@ -154,18 +146,15 @@ static gboolean
gncs_validate (GNCSearchCoreType *fe)
{
GNCSearchString *fi = (GNCSearchString *)fe;
- GNCSearchStringPrivate *priv;
gboolean valid = TRUE;
g_return_val_if_fail (fi, FALSE);
g_return_val_if_fail (GNC_IS_SEARCH_STRING (fi), FALSE);
- priv = _PRIVATE(fi);
-
if (!fi->value || *(fi->value) == '\0')
{
GtkWidget *dialog;
- dialog = gtk_message_dialog_new (GTK_WINDOW(priv->parent),
+ dialog = gtk_message_dialog_new (GTK_WINDOW(fi->parent),
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
@@ -203,7 +192,7 @@ gncs_validate (GNCSearchCoreType *fe)
fi->value, regmsg);
g_free (regmsg);
- dialog = gtk_message_dialog_new (GTK_WINDOW(priv->parent),
+ dialog = gtk_message_dialog_new (GTK_WINDOW(fi->parent),
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
@@ -259,41 +248,35 @@ static void
grab_focus (GNCSearchCoreType *fe)
{
GNCSearchString *fi = (GNCSearchString *)fe;
- GNCSearchStringPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_STRING (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gtk_widget_grab_focus (priv->entry);
+ if (fi->entry)
+ gtk_widget_grab_focus (fi->entry);
}
static void
editable_enters (GNCSearchCoreType *fe)
{
GNCSearchString *fi = (GNCSearchString *)fe;
- GNCSearchStringPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_STRING (fi));
- priv = _PRIVATE(fi);
- if (priv->entry)
- gtk_entry_set_activates_default(GTK_ENTRY (priv->entry), TRUE);
+ if (fi->entry)
+ gtk_entry_set_activates_default(GTK_ENTRY (fi->entry), TRUE);
}
static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchString *fi = (GNCSearchString *)fe;
- GNCSearchStringPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_STRING (fi));
- priv = _PRIVATE(fi);
- priv->parent = GTK_WINDOW(parent);
+ fi->parent = GTK_WINDOW(parent);
}
static GtkWidget *
@@ -301,12 +284,10 @@ gncs_get_widget (GNCSearchCoreType *fe)
{
GtkWidget *entry, *toggle, *menu, *box;
GNCSearchString *fi = (GNCSearchString *)fe;
- GNCSearchStringPrivate *priv;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_STRING (fi), NULL);
- priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
@@ -320,7 +301,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
gtk_entry_set_text (GTK_ENTRY (entry), fi->value);
g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (entry_changed), fe);
gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 3);
- priv->entry = entry;
+ fi->entry = entry;
/* Build and connect the case-sensitive check button; defaults to off */
toggle = gtk_check_button_new_with_label (_("Match case"));
diff --git a/gnucash/gnome/search-owner.c b/gnucash/gnome/search-owner.c
index c7df5e2422..c76d422daa 100644
--- a/gnucash/gnome/search-owner.c
+++ b/gnucash/gnome/search-owner.c
@@ -49,23 +49,17 @@ static void gnc_search_owner_finalize (GObject *obj);
struct _GNCSearchOwner
{
- GNCSearchCoreType parent;
+ GNCSearchCoreType parent_instance;
QofGuidMatch how;
-};
-typedef struct _GNCSearchOwnerPrivate
-{
GncOwner owner;
GtkWindow * parent;
GtkWidget * owner_box;
GtkWidget * owner_choice;
} GNCSearchOwnerPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchOwner, gnc_search_owner, GNC_TYPE_SEARCH_CORE_TYPE)
-
-#define _PRIVATE(o) \
- ((GNCSearchOwnerPrivate*)gnc_search_owner_get_instance_private((GNCSearchOwner*)o))
+G_DEFINE_TYPE(GNCSearchOwner, gnc_search_owner, GNC_TYPE_SEARCH_CORE_TYPE)
enum
{
@@ -125,17 +119,15 @@ static gboolean
gncs_validate (GNCSearchCoreType *fe)
{
GNCSearchOwner *fi = (GNCSearchOwner *)fe;
- GNCSearchOwnerPrivate *priv;
gboolean valid = TRUE;
g_return_val_if_fail (fi, FALSE);
g_return_val_if_fail (GNC_IS_SEARCH_OWNER (fi), FALSE);
- priv = _PRIVATE(fi);
- if (priv->owner.owner.undefined == NULL)
+ if (fi->owner.owner.undefined == NULL)
{
valid = FALSE;
- gnc_error_dialog (GTK_WINDOW(priv->parent), "%s", _("You have not selected an owner"));
+ gnc_error_dialog (GTK_WINDOW(fi->parent), "%s", _("You have not selected an owner"));
}
/* XXX */
@@ -147,39 +139,33 @@ static int
owner_changed_cb (GtkWidget *widget, gpointer data)
{
GNCSearchOwner *fe = data;
- GNCSearchOwnerPrivate *priv;
- priv = _PRIVATE(fe);
- gnc_owner_get_owner (priv->owner_choice, &(priv->owner));
+ gnc_owner_get_owner (fe->owner_choice, &(fe->owner));
return FALSE;
}
static void
set_owner_widget (GNCSearchOwner *fe)
{
- GNCSearchOwnerPrivate *priv;
-
/* Remove the old choice widget */
- priv = _PRIVATE(fe);
- if (priv->owner_choice)
- gtk_container_remove (GTK_CONTAINER (priv->owner_box), priv->owner_choice);
+ if (fe->owner_choice)
+ gtk_container_remove (GTK_CONTAINER (fe->owner_box), fe->owner_choice);
/* Create a new choice widget */
- priv->owner_choice =
- gnc_owner_select_create (NULL, priv->owner_box,
- gnc_get_current_book(), &(priv->owner));
+ fe->owner_choice =
+ gnc_owner_select_create (NULL, fe->owner_box,
+ gnc_get_current_book(), &(fe->owner));
/* Setup the "changed" callback */
- g_signal_connect (G_OBJECT (priv->owner_choice), "changed",
+ g_signal_connect (G_OBJECT (fe->owner_choice), "changed",
G_CALLBACK (owner_changed_cb), fe);
- gtk_widget_show_all (priv->owner_choice);
+ gtk_widget_show_all (fe->owner_choice);
}
static void
type_combo_changed (GtkWidget *widget, GNCSearchOwner *fe)
{
- GNCSearchOwnerPrivate *priv;
GncOwnerType type;
g_return_if_fail(GTK_IS_COMBO_BOX(widget));
@@ -187,14 +173,13 @@ type_combo_changed (GtkWidget *widget, GNCSearchOwner *fe)
type = gnc_combo_box_search_get_active(GTK_COMBO_BOX(widget));
/* If the type changed or if we don't have a type create the owner_choice */
- priv = _PRIVATE(fe);
- if (type != gncOwnerGetType (&(priv->owner)))
+ if (type != gncOwnerGetType (&(fe->owner)))
{
- priv->owner.type = type;
- priv->owner.owner.undefined = NULL;
+ fe->owner.type = type;
+ fe->owner.owner.undefined = NULL;
set_owner_widget (fe);
}
- else if (priv->owner_choice == NULL)
+ else if (fe->owner_choice == NULL)
set_owner_widget (fe);
}
@@ -202,12 +187,10 @@ static GtkWidget *
make_type_menu (GNCSearchCoreType *fe)
{
GNCSearchOwner *fi = (GNCSearchOwner *)fe;
- GNCSearchOwnerPrivate *priv;
GtkComboBox *combo;
GncOwnerType type;
- priv = _PRIVATE(fi);
- type = gncOwnerGetType (&(priv->owner));
+ type = gncOwnerGetType (&(fi->owner));
combo = GTK_COMBO_BOX(gnc_combo_box_new_search());
gnc_combo_box_search_add(combo, _("Customer"), GNC_OWNER_CUSTOMER);
@@ -242,13 +225,11 @@ static void
pass_parent (GNCSearchCoreType *fe, gpointer parent)
{
GNCSearchOwner *fi = (GNCSearchOwner *)fe;
- GNCSearchOwnerPrivate *priv;
g_return_if_fail (fi);
g_return_if_fail (GNC_IS_SEARCH_OWNER (fi));
- priv = _PRIVATE(fi);
- priv->parent = GTK_WINDOW(parent);
+ fi->parent = GTK_WINDOW(parent);
}
static GtkWidget *
@@ -256,12 +237,10 @@ gncs_get_widget (GNCSearchCoreType *fe)
{
GtkWidget *how_menu, *type_menu, *box;
GNCSearchOwner *fi = (GNCSearchOwner *)fe;
- GNCSearchOwnerPrivate *priv;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_OWNER (fi), NULL);
- priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
@@ -270,8 +249,8 @@ gncs_get_widget (GNCSearchCoreType *fe)
gtk_box_pack_start (GTK_BOX (box), how_menu, FALSE, FALSE, 3);
/* Create the owner box */
- priv->owner_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous (GTK_BOX (priv->owner_box), FALSE);
+ fi->owner_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_box_set_homogeneous (GTK_BOX (fi->owner_box), FALSE);
/* Build and connect the "type" option menu.
* Note that this will build the owner_choice and
@@ -281,7 +260,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
gtk_box_pack_start (GTK_BOX (box), type_menu, FALSE, FALSE, 3);
/* connect the owner box */
- gtk_box_pack_start (GTK_BOX (box), priv->owner_box, FALSE, FALSE, 3);
+ gtk_box_pack_start (GTK_BOX (box), fi->owner_box, FALSE, FALSE, 3);
/* And return the box */
return box;
@@ -290,15 +269,13 @@ gncs_get_widget (GNCSearchCoreType *fe)
static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
{
GNCSearchOwner *fi = (GNCSearchOwner *)fe;
- GNCSearchOwnerPrivate *priv;
const GncGUID *guid;
GList *l = NULL;
g_return_val_if_fail (fi, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_OWNER (fi), NULL);
- priv = _PRIVATE(fi);
- guid = gncOwnerGetGUID (&(priv->owner));
+ guid = gncOwnerGetGUID (&(fi->owner));
l = g_list_prepend (l, (gpointer)guid);
return qof_query_guid_predicate (fi->how, l);
@@ -307,16 +284,13 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
{
GNCSearchOwner *se, *fse = (GNCSearchOwner *)fe;
- GNCSearchOwnerPrivate *se_priv, *fse_priv;
g_return_val_if_fail (fse, NULL);
g_return_val_if_fail (GNC_IS_SEARCH_OWNER (fse), NULL);
se = gnc_search_owner_new ();
se->how = fse->how;
- se_priv = _PRIVATE(se);
- fse_priv = _PRIVATE(fse);
- gncOwnerCopy (&(fse_priv->owner), &(se_priv->owner));
+ gncOwnerCopy (&(fse->owner), &(se->owner));
return (GNCSearchCoreType *)se;
}
commit 4eb20b245681fdaa30c00af5a1297c93e3085d68
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 26 15:37:28 2023 +0100
Refactor: hide implementation of GNCSearch* (move from .h to .c)
diff --git a/gnucash/gnome-search/search-account.c b/gnucash/gnome-search/search-account.c
index fcf606dd0c..1116148b22 100644
--- a/gnucash/gnome-search/search-account.c
+++ b/gnucash/gnome-search/search-account.c
@@ -47,6 +47,13 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe);
static void gnc_search_account_finalize (GObject *obj);
+struct _GNCSearchAccount
+{
+ GNCSearchCoreType parent;
+
+ QofGuidMatch how;
+};
+
typedef struct _GNCSearchAccountPrivate GNCSearchAccountPrivate;
struct _GNCSearchAccountPrivate
diff --git a/gnucash/gnome-search/search-account.h b/gnucash/gnome-search/search-account.h
index 5308f3f5e0..c545329434 100644
--- a/gnucash/gnome-search/search-account.h
+++ b/gnucash/gnome-search/search-account.h
@@ -28,13 +28,6 @@
#define GNC_TYPE_SEARCH_ACCOUNT (gnc_search_account_get_type ())
G_DECLARE_FINAL_TYPE (GNCSearchAccount, gnc_search_account, GNC, SEARCH_ACCOUNT, GNCSearchCoreType)
-struct _GNCSearchAccount
-{
- GNCSearchCoreType parent;
-
- QofGuidMatch how;
-};
-
GNCSearchAccount *gnc_search_account_new (void);
GNCSearchAccount *gnc_search_account_matchall_new (void);
diff --git a/gnucash/gnome-search/search-boolean.c b/gnucash/gnome-search/search-boolean.c
index 208b396a49..36afbe85cb 100644
--- a/gnucash/gnome-search/search-boolean.c
+++ b/gnucash/gnome-search/search-boolean.c
@@ -43,6 +43,13 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe);
static void gnc_search_boolean_finalize (GObject *obj);
+struct _GNCSearchBoolean
+{
+ GNCSearchCoreType parent;
+
+ gboolean value;
+};
+
typedef struct _GNCSearchBooleanPrivate GNCSearchBooleanPrivate;
struct _GNCSearchBooleanPrivate
diff --git a/gnucash/gnome-search/search-boolean.h b/gnucash/gnome-search/search-boolean.h
index 6796167c34..6e73f71ea9 100644
--- a/gnucash/gnome-search/search-boolean.h
+++ b/gnucash/gnome-search/search-boolean.h
@@ -28,13 +28,6 @@
#define GNC_TYPE_SEARCH_BOOLEAN (gnc_search_boolean_get_type ())
G_DECLARE_FINAL_TYPE (GNCSearchBoolean, gnc_search_boolean, GNC, SEARCH_BOOLEAN, GNCSearchCoreType)
-struct _GNCSearchBoolean
-{
- GNCSearchCoreType parent;
-
- gboolean value;
-};
-
GNCSearchBoolean *gnc_search_boolean_new (void);
/* methods */
diff --git a/gnucash/gnome-search/search-date.c b/gnucash/gnome-search/search-date.c
index 61a2860fa2..85119e489c 100644
--- a/gnucash/gnome-search/search-date.c
+++ b/gnucash/gnome-search/search-date.c
@@ -47,6 +47,14 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe);
static void gnc_search_date_finalize (GObject *obj);
+struct _GNCSearchDate
+{
+ GNCSearchCoreType parent;
+
+ QofQueryCompare how;
+ time64 tt;
+};
+
typedef struct _GNCSearchDatePrivate GNCSearchDatePrivate;
struct _GNCSearchDatePrivate
diff --git a/gnucash/gnome-search/search-date.h b/gnucash/gnome-search/search-date.h
index f943793a4f..ff91b88521 100644
--- a/gnucash/gnome-search/search-date.h
+++ b/gnucash/gnome-search/search-date.h
@@ -29,14 +29,6 @@
#define GNC_TYPE_SEARCH_DATE (gnc_search_date_get_type ())
G_DECLARE_FINAL_TYPE (GNCSearchDate, gnc_search_date, GNC, SEARCH_DATE, GNCSearchCoreType)
-struct _GNCSearchDate
-{
- GNCSearchCoreType parent;
-
- QofQueryCompare how;
- time64 tt;
-};
-
GNCSearchDate *gnc_search_date_new (void);
/* methods */
diff --git a/gnucash/gnome-search/search-double.c b/gnucash/gnome-search/search-double.c
index df57bd088f..eea6116218 100644
--- a/gnucash/gnome-search/search-double.c
+++ b/gnucash/gnome-search/search-double.c
@@ -47,6 +47,14 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe);
static void gnc_search_double_finalize (GObject *obj);
+struct _GNCSearchDouble
+{
+ GNCSearchCoreType parent;
+
+ QofQueryCompare how;
+ double value;
+};
+
typedef struct _GNCSearchDoublePrivate GNCSearchDoublePrivate;
struct _GNCSearchDoublePrivate
diff --git a/gnucash/gnome-search/search-double.h b/gnucash/gnome-search/search-double.h
index 989ff130c2..2a3e0be2bc 100644
--- a/gnucash/gnome-search/search-double.h
+++ b/gnucash/gnome-search/search-double.h
@@ -28,14 +28,6 @@
#define GNC_TYPE_SEARCH_DOUBLE (gnc_search_double_get_type ())
G_DECLARE_FINAL_TYPE (GNCSearchDouble, gnc_search_double, GNC, SEARCH_DOUBLE, GNCSearchCoreType)
-struct _GNCSearchDouble
-{
- GNCSearchCoreType parent;
-
- QofQueryCompare how;
- double value;
-};
-
GNCSearchDouble *gnc_search_double_new (void);
/* methods */
diff --git a/gnucash/gnome-search/search-int64.c b/gnucash/gnome-search/search-int64.c
index 763b94a8cb..6961ef7c22 100644
--- a/gnucash/gnome-search/search-int64.c
+++ b/gnucash/gnome-search/search-int64.c
@@ -47,6 +47,13 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe);
static void gnc_search_int64_finalize (GObject *obj);
+struct _GNCSearchInt64
+{
+ GNCSearchCoreType parent;
+
+ QofQueryCompare how;
+ gint64 value;
+};
typedef struct _GNCSearchInt64Private GNCSearchInt64Private;
diff --git a/gnucash/gnome-search/search-int64.h b/gnucash/gnome-search/search-int64.h
index 26b263a02c..2d046aff70 100644
--- a/gnucash/gnome-search/search-int64.h
+++ b/gnucash/gnome-search/search-int64.h
@@ -28,14 +28,6 @@
#define GNC_TYPE_SEARCH_INT64 (gnc_search_int64_get_type ())
G_DECLARE_FINAL_TYPE (GNCSearchInt64, gnc_search_int64, GNC, SEARCH_INT64, GNCSearchCoreType)
-struct _GNCSearchInt64
-{
- GNCSearchCoreType parent;
-
- QofQueryCompare how;
- gint64 value;
-};
-
GNCSearchInt64 *gnc_search_int64_new (void);
/* methods */
diff --git a/gnucash/gnome-search/search-numeric.c b/gnucash/gnome-search/search-numeric.c
index 38d59df468..42b4fb20f4 100644
--- a/gnucash/gnome-search/search-numeric.c
+++ b/gnucash/gnome-search/search-numeric.c
@@ -47,6 +47,16 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe);
static void gnc_search_numeric_finalize (GObject *obj);
+struct _GNCSearchNumeric
+{
+ GNCSearchCoreType parent;
+ struct _GNCSearchNumericPrivate *priv;
+
+ QofQueryCompare how;
+ gnc_numeric value;
+ QofNumericMatch option;
+};
+
typedef struct _GNCSearchNumericPrivate GNCSearchNumericPrivate;
struct _GNCSearchNumericPrivate
diff --git a/gnucash/gnome-search/search-numeric.h b/gnucash/gnome-search/search-numeric.h
index 0f3d053cfd..b3dd462f19 100644
--- a/gnucash/gnome-search/search-numeric.h
+++ b/gnucash/gnome-search/search-numeric.h
@@ -29,16 +29,6 @@
#define GNC_TYPE_SEARCH_NUMERIC (gnc_search_numeric_get_type ())
G_DECLARE_FINAL_TYPE (GNCSearchNumeric, gnc_search_numeric, GNC, SEARCH_NUMERIC, GNCSearchCoreType)
-struct _GNCSearchNumeric
-{
- GNCSearchCoreType parent;
- struct _GNCSearchNumericPrivate *priv;
-
- QofQueryCompare how;
- gnc_numeric value;
- QofNumericMatch option;
-};
-
GNCSearchNumeric *gnc_search_numeric_new (void);
GNCSearchNumeric *gnc_search_numeric_debcred_new (void);
diff --git a/gnucash/gnome-search/search-reconciled.c b/gnucash/gnome-search/search-reconciled.c
index e4ad4c80e4..52dd519c22 100644
--- a/gnucash/gnome-search/search-reconciled.c
+++ b/gnucash/gnome-search/search-reconciled.c
@@ -45,6 +45,14 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe);
static void gnc_search_reconciled_finalize (GObject *obj);
+struct _GNCSearchReconciled
+{
+ GNCSearchCoreType parent;
+
+ QofCharMatch how;
+ cleared_match_t value;
+};
+
typedef struct _GNCSearchReconciledPrivate GNCSearchReconciledPrivate;
struct _GNCSearchReconciledPrivate
diff --git a/gnucash/gnome-search/search-reconciled.h b/gnucash/gnome-search/search-reconciled.h
index b73990ab8c..a2c4b12c12 100644
--- a/gnucash/gnome-search/search-reconciled.h
+++ b/gnucash/gnome-search/search-reconciled.h
@@ -28,14 +28,6 @@
#define GNC_TYPE_SEARCH_RECONCILED (gnc_search_reconciled_get_type ())
G_DECLARE_FINAL_TYPE (GNCSearchReconciled, gnc_search_reconciled, GNC, SEARCH_RECONCILED, GNCSearchCoreType)
-struct _GNCSearchReconciled
-{
- GNCSearchCoreType parent;
-
- QofCharMatch how;
- cleared_match_t value;
-};
-
GNCSearchReconciled *gnc_search_reconciled_new (void);
/* methods */
diff --git a/gnucash/gnome-search/search-string.c b/gnucash/gnome-search/search-string.c
index 31cb32367c..58400cc142 100644
--- a/gnucash/gnome-search/search-string.c
+++ b/gnucash/gnome-search/search-string.c
@@ -47,6 +47,15 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe);
static void gnc_search_string_finalize (GObject *obj);
+struct _GNCSearchString
+{
+ GNCSearchCoreType parent;
+
+ GNCSearchString_Type how;
+ gboolean ign_case;
+ char * value;
+};
+
typedef struct _GNCSearchStringPrivate GNCSearchStringPrivate;
struct _GNCSearchStringPrivate
diff --git a/gnucash/gnome-search/search-string.h b/gnucash/gnome-search/search-string.h
index ed294c355b..d9d413ee2d 100644
--- a/gnucash/gnome-search/search-string.h
+++ b/gnucash/gnome-search/search-string.h
@@ -37,15 +37,6 @@ typedef enum _search_string_how
SEARCH_STRING_NOT_EQUAL
} GNCSearchString_Type;
-struct _GNCSearchString
-{
- GNCSearchCoreType parent;
-
- GNCSearchString_Type how;
- gboolean ign_case;
- char * value;
-};
-
GNCSearchString *gnc_search_string_new (void);
/* methods */
diff --git a/gnucash/gnome/search-owner.c b/gnucash/gnome/search-owner.c
index ff70c816bb..c7df5e2422 100644
--- a/gnucash/gnome/search-owner.c
+++ b/gnucash/gnome/search-owner.c
@@ -47,6 +47,13 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe);
static void gnc_search_owner_finalize (GObject *obj);
+struct _GNCSearchOwner
+{
+ GNCSearchCoreType parent;
+
+ QofGuidMatch how;
+};
+
typedef struct _GNCSearchOwnerPrivate
{
GncOwner owner;
diff --git a/gnucash/gnome/search-owner.h b/gnucash/gnome/search-owner.h
index 1acb790a38..2e1bd7b8b0 100644
--- a/gnucash/gnome/search-owner.h
+++ b/gnucash/gnome/search-owner.h
@@ -28,13 +28,6 @@
#define GNC_TYPE_SEARCH_OWNER (gnc_search_owner_get_type ())
G_DECLARE_FINAL_TYPE (GNCSearchOwner, gnc_search_owner, GNC, SEARCH_OWNER, GNCSearchCoreType)
-struct _GNCSearchOwner
-{
- GNCSearchCoreType parent;
-
- QofGuidMatch how;
-};
-
GNCSearchOwner *gnc_search_owner_new (void);
/* methods */
commit 5d3eaa51c76bf81cc755926cdbe63a0190098635
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 19 16:26:34 2023 +0100
Refactor: DECLARE_FINAL GNCSearchOwner < GNCSearchCoreType
diff --git a/gnucash/gnome/search-owner.c b/gnucash/gnome/search-owner.c
index fad235fbf0..ff70c816bb 100644
--- a/gnucash/gnome/search-owner.c
+++ b/gnucash/gnome/search-owner.c
@@ -95,7 +95,7 @@ gnc_search_owner_init (GNCSearchOwner *o)
static void
gnc_search_owner_finalize (GObject *obj)
{
- g_assert (IS_GNCSEARCH_OWNER (obj));
+ g_assert (GNC_IS_SEARCH_OWNER (obj));
G_OBJECT_CLASS (gnc_search_owner_parent_class)->finalize(obj);
}
@@ -122,7 +122,7 @@ gncs_validate (GNCSearchCoreType *fe)
gboolean valid = TRUE;
g_return_val_if_fail (fi, FALSE);
- g_return_val_if_fail (IS_GNCSEARCH_OWNER (fi), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_OWNER (fi), FALSE);
priv = _PRIVATE(fi);
if (priv->owner.owner.undefined == NULL)
@@ -238,7 +238,7 @@ pass_parent (GNCSearchCoreType *fe, gpointer parent)
GNCSearchOwnerPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_OWNER (fi));
+ g_return_if_fail (GNC_IS_SEARCH_OWNER (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
@@ -252,7 +252,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
GNCSearchOwnerPrivate *priv;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_OWNER (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_OWNER (fi), NULL);
priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
@@ -288,7 +288,7 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
GList *l = NULL;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_OWNER (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_OWNER (fi), NULL);
priv = _PRIVATE(fi);
guid = gncOwnerGetGUID (&(priv->owner));
@@ -303,7 +303,7 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
GNCSearchOwnerPrivate *se_priv, *fse_priv;
g_return_val_if_fail (fse, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_OWNER (fse), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_OWNER (fse), NULL);
se = gnc_search_owner_new ();
se->how = fse->how;
diff --git a/gnucash/gnome/search-owner.h b/gnucash/gnome/search-owner.h
index 2b573c3416..1acb790a38 100644
--- a/gnucash/gnome/search-owner.h
+++ b/gnucash/gnome/search-owner.h
@@ -26,12 +26,7 @@
#include "qof.h"
#define GNC_TYPE_SEARCH_OWNER (gnc_search_owner_get_type ())
-#define GNCSEARCH_OWNER(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, gnc_search_owner_get_type (), GNCSearchOwner)
-#define GNCSEARCH_OWNER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, gnc_search_owner_get_type (), GNCSearchOwnerClass)
-#define IS_GNCSEARCH_OWNER(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, gnc_search_owner_get_type ())
-
-typedef struct _GNCSearchOwner GNCSearchOwner;
-typedef struct _GNCSearchOwnerClass GNCSearchOwnerClass;
+G_DECLARE_FINAL_TYPE (GNCSearchOwner, gnc_search_owner, GNC, SEARCH_OWNER, GNCSearchCoreType)
struct _GNCSearchOwner
{
@@ -40,16 +35,6 @@ struct _GNCSearchOwner
QofGuidMatch how;
};
-struct _GNCSearchOwnerClass
-{
- GNCSearchCoreTypeClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-GType gnc_search_owner_get_type (void);
GNCSearchOwner *gnc_search_owner_new (void);
/* methods */
commit 8cb697b8a9d0583b4a1f45b06123593fec1300f4
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 19 16:26:24 2023 +0100
Refactor: DECLARE_FINAL GNCSearchString < GNCSearchCoreType
diff --git a/gnucash/gnome-search/search-string.c b/gnucash/gnome-search/search-string.c
index b14e1222df..31cb32367c 100644
--- a/gnucash/gnome-search/search-string.c
+++ b/gnucash/gnome-search/search-string.c
@@ -92,7 +92,7 @@ static void
gnc_search_string_finalize (GObject *obj)
{
GNCSearchString *o = (GNCSearchString *)obj;
- g_assert (IS_GNCSEARCH_STRING (o));
+ g_assert (GNC_IS_SEARCH_STRING (o));
g_free (o->value);
@@ -117,7 +117,7 @@ void
gnc_search_string_set_value (GNCSearchString *fi, const char *value)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_STRING (fi));
+ g_return_if_fail (GNC_IS_SEARCH_STRING (fi));
if (fi->value)
g_free (fi->value);
@@ -129,7 +129,7 @@ void
gnc_search_string_set_how (GNCSearchString *fi, GNCSearchString_Type how)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_STRING (fi));
+ g_return_if_fail (GNC_IS_SEARCH_STRING (fi));
fi->how = how;
}
@@ -137,7 +137,7 @@ void
gnc_search_string_set_case (GNCSearchString *fi, gboolean ignore_case)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_STRING (fi));
+ g_return_if_fail (GNC_IS_SEARCH_STRING (fi));
fi->ign_case = ignore_case;
}
@@ -149,7 +149,7 @@ gncs_validate (GNCSearchCoreType *fe)
gboolean valid = TRUE;
g_return_val_if_fail (fi, FALSE);
- g_return_val_if_fail (IS_GNCSEARCH_STRING (fi), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_STRING (fi), FALSE);
priv = _PRIVATE(fi);
@@ -253,7 +253,7 @@ grab_focus (GNCSearchCoreType *fe)
GNCSearchStringPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_STRING (fi));
+ g_return_if_fail (GNC_IS_SEARCH_STRING (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -267,7 +267,7 @@ editable_enters (GNCSearchCoreType *fe)
GNCSearchStringPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_STRING (fi));
+ g_return_if_fail (GNC_IS_SEARCH_STRING (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -281,7 +281,7 @@ pass_parent (GNCSearchCoreType *fe, gpointer parent)
GNCSearchStringPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_STRING (fi));
+ g_return_if_fail (GNC_IS_SEARCH_STRING (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
@@ -295,7 +295,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
GNCSearchStringPrivate *priv;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_STRING (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_STRING (fi), NULL);
priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
@@ -330,7 +330,7 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
gboolean is_regex = FALSE;
g_return_val_if_fail (ss, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_STRING (ss), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_STRING (ss), NULL);
switch (ss->how)
{
@@ -368,7 +368,7 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
GNCSearchString *se, *fse = (GNCSearchString *)fe;
g_return_val_if_fail (fse, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_STRING (fse), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_STRING (fse), NULL);
se = gnc_search_string_new ();
gnc_search_string_set_value (se, fse->value);
diff --git a/gnucash/gnome-search/search-string.h b/gnucash/gnome-search/search-string.h
index b4badcccc9..ed294c355b 100644
--- a/gnucash/gnome-search/search-string.h
+++ b/gnucash/gnome-search/search-string.h
@@ -25,12 +25,7 @@
#include "search-core-type.h"
#define GNC_TYPE_SEARCH_STRING (gnc_search_string_get_type ())
-#define GNCSEARCH_STRING(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_SEARCH_STRING, GNCSearchString)
-#define GNCSEARCH_STRING_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_SEARCH_STRING, GNCSearchStringClass)
-#define IS_GNCSEARCH_STRING(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_SEARCH_STRING)
-
-typedef struct _GNCSearchString GNCSearchString;
-typedef struct _GNCSearchStringClass GNCSearchStringClass;
+G_DECLARE_FINAL_TYPE (GNCSearchString, gnc_search_string, GNC, SEARCH_STRING, GNCSearchCoreType)
typedef enum _search_string_how
{
@@ -51,16 +46,6 @@ struct _GNCSearchString
char * value;
};
-struct _GNCSearchStringClass
-{
- GNCSearchCoreTypeClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-GType gnc_search_string_get_type (void);
GNCSearchString *gnc_search_string_new (void);
/* methods */
commit b1d1f6b8d1829ad0dd38d24f77209706d165d17e
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 19 16:26:16 2023 +0100
Refactor: DECLARE_FINAL GNCSearchReconciled < GNCSearchCoreType
diff --git a/gnucash/gnome-search/search-reconciled.c b/gnucash/gnome-search/search-reconciled.c
index d7fd1bfecc..e4ad4c80e4 100644
--- a/gnucash/gnome-search/search-reconciled.c
+++ b/gnucash/gnome-search/search-reconciled.c
@@ -87,7 +87,7 @@ static void
gnc_search_reconciled_finalize (GObject *obj)
{
GNCSearchReconciled *o = (GNCSearchReconciled *)obj;
- g_assert (IS_GNCSEARCH_RECONCILED (o));
+ g_assert (GNC_IS_SEARCH_RECONCILED (o));
G_OBJECT_CLASS (gnc_search_reconciled_parent_class)->finalize(obj);
}
@@ -110,7 +110,7 @@ void
gnc_search_reconciled_set_value (GNCSearchReconciled *fi, cleared_match_t value)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_RECONCILED (fi));
+ g_return_if_fail (GNC_IS_SEARCH_RECONCILED (fi));
fi->value = value;
}
@@ -119,7 +119,7 @@ void
gnc_search_reconciled_set_how (GNCSearchReconciled *fi, QofCharMatch how)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_RECONCILED (fi));
+ g_return_if_fail (GNC_IS_SEARCH_RECONCILED (fi));
fi->how = how;
}
@@ -130,7 +130,7 @@ pass_parent (GNCSearchCoreType *fe, gpointer parent)
GNCSearchReconciledPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_RECONCILED (fi));
+ g_return_if_fail (GNC_IS_SEARCH_RECONCILED (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
@@ -143,7 +143,7 @@ gncs_validate (GNCSearchCoreType *fe)
gboolean valid = TRUE;
g_return_val_if_fail (fi, FALSE);
- g_return_val_if_fail (IS_GNCSEARCH_RECONCILED (fi), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_RECONCILED (fi), FALSE);
/* XXX */
@@ -203,7 +203,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
GNCSearchReconciled *fi = (GNCSearchReconciled *)fe;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_RECONCILED (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_RECONCILED (fi), NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
@@ -240,7 +240,7 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
int i;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_RECONCILED (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_RECONCILED (fi), NULL);
/* This code should look a lot like xaccQueryAddClearedMatch() */
@@ -267,7 +267,7 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
GNCSearchReconciled *se, *fse = (GNCSearchReconciled *)fe;
g_return_val_if_fail (fse, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_RECONCILED (fse), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_RECONCILED (fse), NULL);
se = gnc_search_reconciled_new ();
gnc_search_reconciled_set_value (se, fse->value);
diff --git a/gnucash/gnome-search/search-reconciled.h b/gnucash/gnome-search/search-reconciled.h
index cd14e39c07..b73990ab8c 100644
--- a/gnucash/gnome-search/search-reconciled.h
+++ b/gnucash/gnome-search/search-reconciled.h
@@ -26,12 +26,7 @@
#include "Query.h" /* for cleared_match_t */
#define GNC_TYPE_SEARCH_RECONCILED (gnc_search_reconciled_get_type ())
-#define GNCSEARCH_RECONCILED(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_SEARCH_RECONCILED, GNCSearchReconciled)
-#define GNCSEARCH_RECONCILED_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_SEARCH_RECONCILED, GNCSearchReconciledClass)
-#define IS_GNCSEARCH_RECONCILED(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_SEARCH_RECONCILED)
-
-typedef struct _GNCSearchReconciled GNCSearchReconciled;
-typedef struct _GNCSearchReconciledClass GNCSearchReconciledClass;
+G_DECLARE_FINAL_TYPE (GNCSearchReconciled, gnc_search_reconciled, GNC, SEARCH_RECONCILED, GNCSearchCoreType)
struct _GNCSearchReconciled
{
@@ -41,16 +36,6 @@ struct _GNCSearchReconciled
cleared_match_t value;
};
-struct _GNCSearchReconciledClass
-{
- GNCSearchCoreTypeClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-GType gnc_search_reconciled_get_type (void);
GNCSearchReconciled *gnc_search_reconciled_new (void);
/* methods */
commit bd6083278db31b1ec82586efef3ed3a5e39fc1e6
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 19 16:25:55 2023 +0100
Refactor: DECLARE_FINAL GNCSearchNumeric < GNCSearchCoreType
diff --git a/gnucash/gnome-search/search-numeric.c b/gnucash/gnome-search/search-numeric.c
index fc812e8df9..38d59df468 100644
--- a/gnucash/gnome-search/search-numeric.c
+++ b/gnucash/gnome-search/search-numeric.c
@@ -94,7 +94,7 @@ static void
gnc_search_numeric_finalize (GObject *obj)
{
GNCSearchNumeric *o = (GNCSearchNumeric *)obj;
- g_assert (IS_GNCSEARCH_NUMERIC (o));
+ g_assert (GNC_IS_SEARCH_NUMERIC (o));
G_OBJECT_CLASS (gnc_search_numeric_parent_class)->finalize(obj);
}
@@ -136,7 +136,7 @@ void
gnc_search_numeric_set_value (GNCSearchNumeric *fi, gnc_numeric value)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_NUMERIC (fi));
+ g_return_if_fail (GNC_IS_SEARCH_NUMERIC (fi));
fi->value = value;
}
@@ -145,7 +145,7 @@ void
gnc_search_numeric_set_how (GNCSearchNumeric *fi, QofQueryCompare how)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_NUMERIC (fi));
+ g_return_if_fail (GNC_IS_SEARCH_NUMERIC (fi));
fi->how = how;
}
@@ -153,7 +153,7 @@ void
gnc_search_numeric_set_option (GNCSearchNumeric *fi, QofNumericMatch option)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_NUMERIC (fi));
+ g_return_if_fail (GNC_IS_SEARCH_NUMERIC (fi));
fi->option = option;
}
@@ -164,7 +164,7 @@ pass_parent (GNCSearchCoreType *fe, gpointer parent)
GNCSearchNumericPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_NUMERIC (fi));
+ g_return_if_fail (GNC_IS_SEARCH_NUMERIC (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
@@ -179,7 +179,7 @@ gncs_validate (GNCSearchCoreType *fe)
GError *error = NULL;
g_return_val_if_fail (fi, FALSE);
- g_return_val_if_fail (IS_GNCSEARCH_NUMERIC (fi), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_NUMERIC (fi), FALSE);
priv = _PRIVATE(fi);
@@ -258,7 +258,7 @@ grab_focus (GNCSearchCoreType *fe)
GNCSearchNumericPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_NUMERIC (fi));
+ g_return_if_fail (GNC_IS_SEARCH_NUMERIC (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -272,7 +272,7 @@ editable_enters (GNCSearchCoreType *fe)
GNCSearchNumericPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_NUMERIC (fi));
+ g_return_if_fail (GNC_IS_SEARCH_NUMERIC (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -287,7 +287,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
GNCSearchNumericPrivate *priv;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_NUMERIC (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_NUMERIC (fi), NULL);
priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
@@ -321,7 +321,7 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
GNCSearchNumericPrivate *priv;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_NUMERIC (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_NUMERIC (fi), NULL);
/* force the computation of the entry, because we may not get the signal */
priv = _PRIVATE(fi);
@@ -336,7 +336,7 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
GNCSearchNumericPrivate *se_priv, *fse_priv;
g_return_val_if_fail (fse, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_NUMERIC (fse), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_NUMERIC (fse), NULL);
fse_priv = _PRIVATE(fse);
se = gnc_search_numeric_new ();
diff --git a/gnucash/gnome-search/search-numeric.h b/gnucash/gnome-search/search-numeric.h
index f039ced6c9..0f3d053cfd 100644
--- a/gnucash/gnome-search/search-numeric.h
+++ b/gnucash/gnome-search/search-numeric.h
@@ -27,12 +27,7 @@
#include "qof.h"
#define GNC_TYPE_SEARCH_NUMERIC (gnc_search_numeric_get_type ())
-#define GNCSEARCH_NUMERIC(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_SEARCH_NUMERIC, GNCSearchNumeric)
-#define GNCSEARCH_NUMERIC_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_SEARCH_NUMERIC, GNCSearchNumericClass)
-#define IS_GNCSEARCH_NUMERIC(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_SEARCH_NUMERIC)
-
-typedef struct _GNCSearchNumeric GNCSearchNumeric;
-typedef struct _GNCSearchNumericClass GNCSearchNumericClass;
+G_DECLARE_FINAL_TYPE (GNCSearchNumeric, gnc_search_numeric, GNC, SEARCH_NUMERIC, GNCSearchCoreType)
struct _GNCSearchNumeric
{
@@ -44,16 +39,6 @@ struct _GNCSearchNumeric
QofNumericMatch option;
};
-struct _GNCSearchNumericClass
-{
- GNCSearchCoreTypeClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-GType gnc_search_numeric_get_type (void);
GNCSearchNumeric *gnc_search_numeric_new (void);
GNCSearchNumeric *gnc_search_numeric_debcred_new (void);
commit f1a77ca782f289851cab6028addeca8fe5819241
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 19 16:25:44 2023 +0100
Refactor: DECLARE_FINAL GNCSearchInt64 < GNCSearchCoreType
diff --git a/gnucash/gnome-search/search-int64.c b/gnucash/gnome-search/search-int64.c
index 47e8038ec1..763b94a8cb 100644
--- a/gnucash/gnome-search/search-int64.c
+++ b/gnucash/gnome-search/search-int64.c
@@ -92,7 +92,7 @@ static void
gnc_search_int64_finalize (GObject *obj)
{
GNCSearchInt64 *o = (GNCSearchInt64 *)obj;
- g_assert (IS_GNCSEARCH_INT64 (o));
+ g_assert (GNC_IS_SEARCH_INT64 (o));
G_OBJECT_CLASS (gnc_search_int64_parent_class)->finalize(obj);
}
@@ -115,7 +115,7 @@ void
gnc_search_int64_set_value (GNCSearchInt64 *fi, gint64 value)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_INT64 (fi));
+ g_return_if_fail (GNC_IS_SEARCH_INT64 (fi));
fi->value = value;
}
@@ -124,7 +124,7 @@ void
gnc_search_int64_set_how (GNCSearchInt64 *fi, QofQueryCompare how)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_INT64 (fi));
+ g_return_if_fail (GNC_IS_SEARCH_INT64 (fi));
fi->how = how;
}
@@ -135,7 +135,7 @@ pass_parent (GNCSearchCoreType *fe, gpointer parent)
GNCSearchInt64Private *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_INT64 (fi));
+ g_return_if_fail (GNC_IS_SEARCH_INT64 (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
@@ -150,7 +150,7 @@ gncs_validate (GNCSearchCoreType *fe)
GError *error = NULL;
g_return_val_if_fail (fi, FALSE);
- g_return_val_if_fail (IS_GNCSEARCH_INT64 (fi), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_INT64 (fi), FALSE);
priv = _PRIVATE(fi);
@@ -198,7 +198,7 @@ grab_focus (GNCSearchCoreType *fe)
GNCSearchInt64Private *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_INT64 (fi));
+ g_return_if_fail (GNC_IS_SEARCH_INT64 (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -212,7 +212,7 @@ editable_enters (GNCSearchCoreType *fe)
GNCSearchInt64Private *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_INT64 (fi));
+ g_return_if_fail (GNC_IS_SEARCH_INT64 (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -227,7 +227,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
GNCSearchInt64Private *priv;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_INT64 (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_INT64 (fi), NULL);
priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
@@ -261,7 +261,7 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
GNCSearchInt64Private *priv;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_INT64 (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_INT64 (fi), NULL);
/* force the computation of the entry, because we may not get the signal */
priv = _PRIVATE(fi);
@@ -275,7 +275,7 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
GNCSearchInt64 *se, *fse = (GNCSearchInt64 *)fe;
g_return_val_if_fail (fse, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_INT64 (fse), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_INT64 (fse), NULL);
se = gnc_search_int64_new ();
gnc_search_int64_set_value (se, fse->value);
diff --git a/gnucash/gnome-search/search-int64.h b/gnucash/gnome-search/search-int64.h
index a07900c8bd..26b263a02c 100644
--- a/gnucash/gnome-search/search-int64.h
+++ b/gnucash/gnome-search/search-int64.h
@@ -26,12 +26,7 @@
#include "qof.h"
#define GNC_TYPE_SEARCH_INT64 (gnc_search_int64_get_type ())
-#define GNCSEARCH_INT64(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_SEARCH_INT64, GNCSearchInt64)
-#define GNCSEARCH_INT64_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_SEARCH_INT64, GNCSearchInt64Class)
-#define IS_GNCSEARCH_INT64(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_SEARCH_INT64)
-
-typedef struct _GNCSearchInt64 GNCSearchInt64;
-typedef struct _GNCSearchInt64Class GNCSearchInt64Class;
+G_DECLARE_FINAL_TYPE (GNCSearchInt64, gnc_search_int64, GNC, SEARCH_INT64, GNCSearchCoreType)
struct _GNCSearchInt64
{
@@ -41,16 +36,6 @@ struct _GNCSearchInt64
gint64 value;
};
-struct _GNCSearchInt64Class
-{
- GNCSearchCoreTypeClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-GType gnc_search_int64_get_type (void);
GNCSearchInt64 *gnc_search_int64_new (void);
/* methods */
commit 0b215793b6ca903bd181a6353a5a39dbbdc5822a
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 19 16:25:31 2023 +0100
Refactor: DECLARE_FINAL GNCSearchDouble < GNCSearchCoreType
diff --git a/gnucash/gnome-search/search-double.c b/gnucash/gnome-search/search-double.c
index 2c6d695b4b..df57bd088f 100644
--- a/gnucash/gnome-search/search-double.c
+++ b/gnucash/gnome-search/search-double.c
@@ -91,7 +91,7 @@ static void
gnc_search_double_finalize (GObject *obj)
{
GNCSearchDouble *o = (GNCSearchDouble *)obj;
- g_assert (IS_GNCSEARCH_DOUBLE (o));
+ g_assert (GNC_IS_SEARCH_DOUBLE (o));
G_OBJECT_CLASS (gnc_search_double_parent_class)->finalize(obj);
}
@@ -114,7 +114,7 @@ void
gnc_search_double_set_value (GNCSearchDouble *fi, double value)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DOUBLE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DOUBLE (fi));
fi->value = value;
}
@@ -123,7 +123,7 @@ void
gnc_search_double_set_how (GNCSearchDouble *fi, QofQueryCompare how)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DOUBLE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DOUBLE (fi));
fi->how = how;
}
@@ -134,7 +134,7 @@ pass_parent (GNCSearchCoreType *fe, gpointer parent)
GNCSearchDoublePrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DOUBLE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DOUBLE (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
@@ -149,7 +149,7 @@ gncs_validate (GNCSearchCoreType *fe)
GError *error = NULL;
g_return_val_if_fail (fi, FALSE);
- g_return_val_if_fail (IS_GNCSEARCH_DOUBLE (fi), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_DOUBLE (fi), FALSE);
priv = _PRIVATE(fi);
@@ -196,7 +196,7 @@ grab_focus (GNCSearchCoreType *fe)
GNCSearchDoublePrivate *priv ;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DOUBLE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DOUBLE (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -210,7 +210,7 @@ editable_enters (GNCSearchCoreType *fe)
GNCSearchDoublePrivate *priv ;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DOUBLE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DOUBLE (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -225,7 +225,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
GNCSearchDoublePrivate *priv ;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_DOUBLE (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_DOUBLE (fi), NULL);
priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
@@ -254,7 +254,7 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
GNCSearchDoublePrivate *priv ;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_DOUBLE (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_DOUBLE (fi), NULL);
/* force the computation of the entry, because we may not get the signal */
priv = _PRIVATE(fi);
@@ -268,7 +268,7 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
GNCSearchDouble *se, *fse = (GNCSearchDouble *)fe;
g_return_val_if_fail (fse, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_DOUBLE (fse), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_DOUBLE (fse), NULL);
se = gnc_search_double_new ();
gnc_search_double_set_value (se, fse->value);
diff --git a/gnucash/gnome-search/search-double.h b/gnucash/gnome-search/search-double.h
index b49c2e487e..989ff130c2 100644
--- a/gnucash/gnome-search/search-double.h
+++ b/gnucash/gnome-search/search-double.h
@@ -26,12 +26,7 @@
#include "qof.h"
#define GNC_TYPE_SEARCH_DOUBLE (gnc_search_double_get_type ())
-#define GNCSEARCH_DOUBLE(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_SEARCH_DOUBLE, GNCSearchDouble)
-#define GNCSEARCH_DOUBLE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_SEARCH_DOUBLE, GNCSearchDoubleClass)
-#define IS_GNCSEARCH_DOUBLE(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_SEARCH_DOUBLE)
-
-typedef struct _GNCSearchDouble GNCSearchDouble;
-typedef struct _GNCSearchDoubleClass GNCSearchDoubleClass;
+G_DECLARE_FINAL_TYPE (GNCSearchDouble, gnc_search_double, GNC, SEARCH_DOUBLE, GNCSearchCoreType)
struct _GNCSearchDouble
{
@@ -41,16 +36,6 @@ struct _GNCSearchDouble
double value;
};
-struct _GNCSearchDoubleClass
-{
- GNCSearchCoreTypeClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-GType gnc_search_double_get_type (void);
GNCSearchDouble *gnc_search_double_new (void);
/* methods */
commit f935d7868bfa74606ba51bb3988cbdfed44e9679
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 19 16:25:18 2023 +0100
Refactor: DECLARE_FINAL GNCSearchDate < GNCSearchCoreType
diff --git a/gnucash/gnome-search/search-date.c b/gnucash/gnome-search/search-date.c
index 62d50beb5b..61a2860fa2 100644
--- a/gnucash/gnome-search/search-date.c
+++ b/gnucash/gnome-search/search-date.c
@@ -93,9 +93,9 @@ gnc_search_date_finalize (GObject *obj)
GNCSearchDate *o;
GNCSearchDatePrivate *priv;
- g_assert (IS_GNCSEARCH_DATE (obj));
+ g_assert (GNC_IS_SEARCH_DATE (obj));
- o = GNCSEARCH_DATE(obj);
+ o = GNC_SEARCH_DATE(obj);
priv = _PRIVATE(o);
if (priv->entry)
gtk_widget_destroy (priv->entry);
@@ -121,7 +121,7 @@ void
gnc_search_date_set_date (GNCSearchDate *fi, time64 tt)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DATE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DATE (fi));
fi->tt = tt;
}
@@ -130,7 +130,7 @@ void
gnc_search_date_set_how (GNCSearchDate *fi, QofQueryCompare how)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DATE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DATE (fi));
fi->how = how;
}
@@ -141,7 +141,7 @@ pass_parent (GNCSearchCoreType *fe, gpointer parent)
GNCSearchDatePrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DATE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DATE (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
@@ -154,7 +154,7 @@ gncs_validate (GNCSearchCoreType *fe)
gboolean valid = TRUE;
g_return_val_if_fail (fi, FALSE);
- g_return_val_if_fail (IS_GNCSEARCH_DATE (fi), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_DATE (fi), FALSE);
/* XXX */
@@ -207,7 +207,7 @@ grab_focus (GNCSearchCoreType *fe)
GNCSearchDatePrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DATE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DATE (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -221,7 +221,7 @@ editable_enters (GNCSearchCoreType *fe)
GNCSearchDatePrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_DATE (fi));
+ g_return_if_fail (GNC_IS_SEARCH_DATE (fi));
priv = _PRIVATE(fi);
if (priv->entry)
@@ -236,7 +236,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
GNCSearchDatePrivate *priv;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_DATE (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_DATE (fi), NULL);
priv = _PRIVATE(fi);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
@@ -263,7 +263,7 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
GNCSearchDatePrivate *priv;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_DATE (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_DATE (fi), NULL);
/* Make sure we actually use the currently-entered date */
priv = _PRIVATE(fi);
@@ -281,7 +281,7 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
GNCSearchDate *se, *fse = (GNCSearchDate *)fe;
g_return_val_if_fail (fse, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_DATE (fse), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_DATE (fse), NULL);
se = gnc_search_date_new ();
gnc_search_date_set_date (se, fse->tt);
diff --git a/gnucash/gnome-search/search-date.h b/gnucash/gnome-search/search-date.h
index 766ff06712..f943793a4f 100644
--- a/gnucash/gnome-search/search-date.h
+++ b/gnucash/gnome-search/search-date.h
@@ -27,12 +27,7 @@
#include "qof.h"
#define GNC_TYPE_SEARCH_DATE (gnc_search_date_get_type ())
-#define GNCSEARCH_DATE(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_SEARCH_DATE, GNCSearchDate)
-#define GNCSEARCH_DATE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_SEARCH_DATE, GNCSearchDateClass)
-#define IS_GNCSEARCH_DATE(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_SEARCH_DATE)
-
-typedef struct _GNCSearchDate GNCSearchDate;
-typedef struct _GNCSearchDateClass GNCSearchDateClass;
+G_DECLARE_FINAL_TYPE (GNCSearchDate, gnc_search_date, GNC, SEARCH_DATE, GNCSearchCoreType)
struct _GNCSearchDate
{
@@ -42,16 +37,6 @@ struct _GNCSearchDate
time64 tt;
};
-struct _GNCSearchDateClass
-{
- GNCSearchCoreTypeClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-GType gnc_search_date_get_type (void);
GNCSearchDate *gnc_search_date_new (void);
/* methods */
commit 74517c44a5797c9762687dc7313a2b860eb468a4
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 19 16:25:07 2023 +0100
Refactor: DECLARE_FINAL GNCSearchBoolean < GNCSearchCoreType
diff --git a/gnucash/gnome-search/search-boolean.c b/gnucash/gnome-search/search-boolean.c
index d54056ccec..208b396a49 100644
--- a/gnucash/gnome-search/search-boolean.c
+++ b/gnucash/gnome-search/search-boolean.c
@@ -84,7 +84,7 @@ static void
gnc_search_boolean_finalize (GObject *obj)
{
GNCSearchBoolean *o = (GNCSearchBoolean *)obj;
- g_assert (IS_GNCSEARCH_BOOLEAN (o));
+ g_assert (GNC_IS_SEARCH_BOOLEAN (o));
G_OBJECT_CLASS (gnc_search_boolean_parent_class)->finalize(obj);
}
@@ -107,7 +107,7 @@ void
gnc_search_boolean_set_value (GNCSearchBoolean *fi, gboolean value)
{
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_BOOLEAN (fi));
+ g_return_if_fail (GNC_IS_SEARCH_BOOLEAN (fi));
fi->value = value;
}
@@ -119,7 +119,7 @@ pass_parent (GNCSearchCoreType *fe, gpointer parent)
GNCSearchBooleanPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_BOOLEAN (fi));
+ g_return_if_fail (GNC_IS_SEARCH_BOOLEAN (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
@@ -132,7 +132,7 @@ gncs_validate (GNCSearchCoreType *fe)
gboolean valid = TRUE;
g_return_val_if_fail (fi, FALSE);
- g_return_val_if_fail (IS_GNCSEARCH_BOOLEAN (fi), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_BOOLEAN (fi), FALSE);
/* XXX */
@@ -152,7 +152,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
GNCSearchBoolean *fi = (GNCSearchBoolean *)fe;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_BOOLEAN (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_BOOLEAN (fi), NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
@@ -172,7 +172,7 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
GNCSearchBoolean *fi = (GNCSearchBoolean *)fe;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_BOOLEAN (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_BOOLEAN (fi), NULL);
return qof_query_boolean_predicate (QOF_COMPARE_EQUAL, fi->value);
}
@@ -182,7 +182,7 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
GNCSearchBoolean *se, *fse = (GNCSearchBoolean *)fe;
g_return_val_if_fail (fse, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_BOOLEAN (fse), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_BOOLEAN (fse), NULL);
se = gnc_search_boolean_new ();
gnc_search_boolean_set_value (se, fse->value);
diff --git a/gnucash/gnome-search/search-boolean.h b/gnucash/gnome-search/search-boolean.h
index d7cfd071f9..6796167c34 100644
--- a/gnucash/gnome-search/search-boolean.h
+++ b/gnucash/gnome-search/search-boolean.h
@@ -26,12 +26,7 @@
#include "qof.h"
#define GNC_TYPE_SEARCH_BOOLEAN (gnc_search_boolean_get_type ())
-#define GNCSEARCH_BOOLEAN(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_SEARCH_BOOLEAN, GNCSearchBoolean)
-#define GNCSEARCH_BOOLEAN_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_SEARCH_BOOLEAN, GNCSearchBooleanClass)
-#define IS_GNCSEARCH_BOOLEAN(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_SEARCH_BOOLEAN)
-
-typedef struct _GNCSearchBoolean GNCSearchBoolean;
-typedef struct _GNCSearchBooleanClass GNCSearchBooleanClass;
+G_DECLARE_FINAL_TYPE (GNCSearchBoolean, gnc_search_boolean, GNC, SEARCH_BOOLEAN, GNCSearchCoreType)
struct _GNCSearchBoolean
{
@@ -40,16 +35,6 @@ struct _GNCSearchBoolean
gboolean value;
};
-struct _GNCSearchBooleanClass
-{
- GNCSearchCoreTypeClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-GType gnc_search_boolean_get_type (void);
GNCSearchBoolean *gnc_search_boolean_new (void);
/* methods */
commit a6dcdb6a68c475162d35bc6ecda8007c7cd97bee
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Fri May 19 16:24:35 2023 +0100
Refactor: DECLARE_FINAL GNCSearchAccount < GNCSearchCoreType
diff --git a/gnucash/gnome-search/search-account.c b/gnucash/gnome-search/search-account.c
index a623fae96d..fcf606dd0c 100644
--- a/gnucash/gnome-search/search-account.c
+++ b/gnucash/gnome-search/search-account.c
@@ -89,7 +89,7 @@ static void
gnc_search_account_finalize (GObject *obj)
{
GNCSearchAccount *o = (GNCSearchAccount *)obj;
- g_assert (IS_GNCSEARCH_ACCOUNT (o));
+ g_assert (GNC_IS_SEARCH_ACCOUNT (o));
G_OBJECT_CLASS (gnc_search_account_parent_class)->finalize(obj);
}
@@ -136,7 +136,7 @@ gncs_validate (GNCSearchCoreType *fe)
gboolean valid = TRUE;
g_return_val_if_fail (fi, FALSE);
- g_return_val_if_fail (IS_GNCSEARCH_ACCOUNT (fi), FALSE);
+ g_return_val_if_fail (GNC_IS_SEARCH_ACCOUNT (fi), FALSE);
priv = _PRIVATE(fi);
@@ -265,7 +265,7 @@ gncs_get_widget (GNCSearchCoreType *fe)
char *desc;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_ACCOUNT (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_ACCOUNT (fi), NULL);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
gtk_box_set_homogeneous (GTK_BOX (box), FALSE);
@@ -295,7 +295,7 @@ static QofQueryPredData* gncs_get_predicate (GNCSearchCoreType *fe)
GList *l = NULL, *node;
g_return_val_if_fail (fi, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_ACCOUNT (fi), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_ACCOUNT (fi), NULL);
priv = _PRIVATE(fi);
for (node = priv->selected_accounts; node; node = node->next)
@@ -315,7 +315,7 @@ static GNCSearchCoreType *gncs_clone(GNCSearchCoreType *fe)
GNCSearchAccountPrivate *se_priv, *fse_priv;
g_return_val_if_fail (fse, NULL);
- g_return_val_if_fail (IS_GNCSEARCH_ACCOUNT (fse), NULL);
+ g_return_val_if_fail (GNC_IS_SEARCH_ACCOUNT (fse), NULL);
fse_priv = _PRIVATE(fse);
se = gnc_search_account_new ();
@@ -334,7 +334,7 @@ pass_parent (GNCSearchCoreType *fe, gpointer parent)
GNCSearchAccountPrivate *priv;
g_return_if_fail (fi);
- g_return_if_fail (IS_GNCSEARCH_ACCOUNT (fi));
+ g_return_if_fail (GNC_IS_SEARCH_ACCOUNT (fi));
priv = _PRIVATE(fi);
priv->parent = GTK_WINDOW(parent);
diff --git a/gnucash/gnome-search/search-account.h b/gnucash/gnome-search/search-account.h
index 23cbd3abc4..5308f3f5e0 100644
--- a/gnucash/gnome-search/search-account.h
+++ b/gnucash/gnome-search/search-account.h
@@ -26,12 +26,7 @@
#include "qof.h"
#define GNC_TYPE_SEARCH_ACCOUNT (gnc_search_account_get_type ())
-#define GNCSEARCH_ACCOUNT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, GNC_TYPE_SEARCH_ACCOUNT, GNCSearchAccount)
-#define GNCSEARCH_ACCOUNT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, GNC_TYPE_SEARCH_ACCOUNT, GNCSearchAccountClass)
-#define IS_GNCSEARCH_ACCOUNT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, GNC_TYPE_SEARCH_ACCOUNT)
-
-typedef struct _GNCSearchAccount GNCSearchAccount;
-typedef struct _GNCSearchAccountClass GNCSearchAccountClass;
+G_DECLARE_FINAL_TYPE (GNCSearchAccount, gnc_search_account, GNC, SEARCH_ACCOUNT, GNCSearchCoreType)
struct _GNCSearchAccount
{
@@ -40,16 +35,6 @@ struct _GNCSearchAccount
QofGuidMatch how;
};
-struct _GNCSearchAccountClass
-{
- GNCSearchCoreTypeClass parent_class;
-
- /* virtual methods */
-
- /* signals */
-};
-
-GType gnc_search_account_get_type (void);
GNCSearchAccount *gnc_search_account_new (void);
GNCSearchAccount *gnc_search_account_matchall_new (void);
commit 53ab52fa4e979fe335ecfd11ea6afc256239d29b
Author: Richard Cohen <richard at daijobu.co.uk>
Date: Wed May 17 17:49:22 2023 +0100
Refactor: DECLARE_DERIVABLE GNCSearchCoreType < GObject
- remove unused GNCSearchParam *param
diff --git a/gnucash/gnome-search/search-core-type.h b/gnucash/gnome-search/search-core-type.h
index e9a81deeb9..30844ed125 100644
--- a/gnucash/gnome-search/search-core-type.h
+++ b/gnucash/gnome-search/search-core-type.h
@@ -30,20 +30,9 @@ extern "C" {
#endif
#define GNC_TYPE_SEARCH_CORE_TYPE (gnc_search_core_type_get_type ())
-#define GNC_SEARCH_CORE_TYPE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreType))
-#define GNC_SEARCH_CORE_TYPE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreTypeClass))
-#define GNC_IS_SEARCH_CORE_TYPE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_SEARCH_CORE_TYPE))
-#define GNC_SEARCH_CORE_TYPE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreTypeClass))
+G_DECLARE_DERIVABLE_TYPE (GNCSearchCoreType, gnc_search_core_type, GNC, SEARCH_CORE_TYPE, GObject)
-typedef struct
-{
- GObject parent;
-
- /* This appears to be unused */
- GNCSearchParam * param;
-} GNCSearchCoreType;
-
-typedef struct
+struct _GNCSearchCoreTypeClass
{
GObjectClass parent_class;
@@ -55,12 +44,9 @@ typedef struct
GNCSearchCoreType * (*clone) (GNCSearchCoreType *fe);
GtkWidget * (*get_widget) (GNCSearchCoreType *);
QofQueryPredData* (*get_predicate) (GNCSearchCoreType *);
-
- /* signals */
-} GNCSearchCoreTypeClass;
+};
/* These are internal functions */
-GType gnc_search_core_type_get_type (void);
GNCSearchCoreType * gnc_search_core_type_new (void);
/* Create a new search core_type */
Summary of changes:
gnucash/gnome-search/search-account.c | 19 +-
gnucash/gnome-search/search-account.h | 24 +-
gnucash/gnome-search/search-boolean.c | 32 +-
gnucash/gnome-search/search-boolean.h | 24 +-
gnucash/gnome-search/search-core-type.h | 20 +-
gnucash/gnome-search/search-date.c | 68 +--
gnucash/gnome-search/search-date.h | 25 +-
gnucash/gnome-search/search-double.c | 67 +--
gnucash/gnome-search/search-double.h | 25 +-
gnucash/gnome-search/search-int64.c | 66 +--
gnucash/gnome-search/search-int64.h | 25 +-
gnucash/gnome-search/search-numeric.c | 96 ++--
gnucash/gnome-search/search-numeric.h | 27 +-
gnucash/gnome-search/search-reconciled.c | 35 +-
gnucash/gnome-search/search-reconciled.h | 25 +-
gnucash/gnome-search/search-string.c | 64 +--
gnucash/gnome-search/search-string.h | 26 +-
gnucash/gnome-utils/gnc-embedded-window.c | 32 +-
gnucash/gnome-utils/gnc-gobject-utils.c | 19 +-
gnucash/gnome-utils/gnc-gobject-utils.h | 70 +--
gnucash/gnome-utils/gnc-main-window.cpp | 34 +-
gnucash/gnome-utils/gnc-plugin-file-history.c | 15 +-
gnucash/gnome-utils/gnc-plugin-file-history.h | 28 +-
gnucash/gnome-utils/gnc-plugin-menu-additions.c | 36 +-
gnucash/gnome-utils/gnc-plugin-menu-additions.h | 25 +-
gnucash/gnome-utils/gnc-plugin-page.c | 35 +-
gnucash/gnome-utils/gnc-plugin.c | 28 +-
gnucash/gnome-utils/gnc-plugin.h | 24 +-
gnucash/gnome-utils/gnc-tree-model-account-types.c | 23 +-
gnucash/gnome-utils/gnc-tree-model-account-types.h | 19 +-
gnucash/gnome-utils/gnc-tree-model-account.c | 145 ++---
gnucash/gnome-utils/gnc-tree-model-account.h | 32 +-
gnucash/gnome-utils/gnc-tree-model-commodity.c | 71 +--
gnucash/gnome-utils/gnc-tree-model-commodity.h | 32 +-
gnucash/gnome-utils/gnc-tree-model-owner.c | 115 ++--
gnucash/gnome-utils/gnc-tree-model-owner.h | 33 +-
gnucash/gnome-utils/gnc-tree-model-price.c | 113 ++--
gnucash/gnome-utils/gnc-tree-model-price.h | 32 +-
gnucash/gnome-utils/gnc-tree-model-selection.c | 638 ---------------------
gnucash/gnome-utils/gnc-tree-model-selection.h | 82 ---
gnucash/gnome-utils/gnc-tree-model.c | 25 +-
gnucash/gnome-utils/gnc-tree-model.h | 27 +-
gnucash/gnome-utils/gnc-tree-view-account.c | 225 +++-----
gnucash/gnome-utils/gnc-tree-view-account.h | 18 +-
gnucash/gnome-utils/gnc-tree-view-commodity.c | 13 +-
gnucash/gnome-utils/gnc-tree-view-commodity.h | 24 +-
gnucash/gnome-utils/gnc-tree-view-owner.c | 120 ++--
gnucash/gnome-utils/gnc-tree-view-owner.h | 22 +-
gnucash/gnome-utils/gnc-tree-view-price.c | 12 +-
gnucash/gnome-utils/gnc-tree-view-price.h | 24 +-
gnucash/gnome-utils/gnc-tree-view-sx-list.c | 50 +-
gnucash/gnome-utils/gnc-tree-view-sx-list.h | 18 +-
gnucash/gnome-utils/gnc-tree-view.c | 25 +-
gnucash/gnome-utils/gnc-tree-view.h | 20 +-
gnucash/gnome/gnc-plugin-account-tree.c | 14 +-
gnucash/gnome/gnc-plugin-account-tree.h | 30 +-
gnucash/gnome/gnc-plugin-basic-commands.c | 15 +-
gnucash/gnome/gnc-plugin-basic-commands.h | 31 +-
gnucash/gnome/gnc-plugin-budget.c | 11 +-
gnucash/gnome/gnc-plugin-budget.h | 18 +-
gnucash/gnome/gnc-plugin-business.c | 96 +---
gnucash/gnome/gnc-plugin-business.h | 18 +-
gnucash/gnome/gnc-plugin-register.c | 11 +-
gnucash/gnome/gnc-plugin-register.h | 19 +-
gnucash/gnome/gnc-plugin-report-system.c | 11 +-
gnucash/gnome/gnc-plugin-report-system.h | 18 +-
gnucash/gnome/search-owner.c | 85 ++-
gnucash/gnome/search-owner.h | 24 +-
gnucash/import-export/aqb/gnc-plugin-aqbanking.c | 5 +
gnucash/import-export/aqb/gnc-plugin-aqbanking.h | 22 +-
.../import-export/bi-import/gnc-plugin-bi-import.c | 13 +-
.../import-export/bi-import/gnc-plugin-bi-import.h | 21 +-
.../import-export/csv-exp/gnc-plugin-csv-export.c | 11 +-
.../import-export/csv-exp/gnc-plugin-csv-export.h | 19 +-
.../import-export/csv-imp/gnc-plugin-csv-import.c | 11 +-
.../import-export/csv-imp/gnc-plugin-csv-import.h | 19 +-
.../customer-import/gnc-plugin-customer-import.c | 17 +-
.../customer-import/gnc-plugin-customer-import.h | 25 +-
.../log-replay/gnc-plugin-log-replay.c | 15 +-
.../log-replay/gnc-plugin-log-replay.h | 19 +-
gnucash/import-export/ofx/gnc-plugin-ofx.c | 11 +-
gnucash/import-export/ofx/gnc-plugin-ofx.h | 19 +-
.../import-export/qif-imp/gnc-plugin-qif-import.c | 11 +-
.../import-export/qif-imp/gnc-plugin-qif-import.h | 19 +-
libgnucash/gnc-module/example/gnc-plugin.example.c | 13 +-
libgnucash/gnc-module/example/gnc-plugin.example.h | 21 +-
86 files changed, 869 insertions(+), 2795 deletions(-)
delete mode 100644 gnucash/gnome-utils/gnc-tree-model-selection.c
delete mode 100644 gnucash/gnome-utils/gnc-tree-model-selection.h
More information about the gnucash-changes
mailing list