gnucash maint: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Tue Mar 19 12:33:29 EDT 2019
Updated via https://github.com/Gnucash/gnucash/commit/bc9d83c9 (commit)
via https://github.com/Gnucash/gnucash/commit/b0d0ee1a (commit)
via https://github.com/Gnucash/gnucash/commit/715a079b (commit)
via https://github.com/Gnucash/gnucash/commit/c1f5eb92 (commit)
via https://github.com/Gnucash/gnucash/commit/a0a0b30a (commit)
via https://github.com/Gnucash/gnucash/commit/8545ca40 (commit)
via https://github.com/Gnucash/gnucash/commit/2cb68073 (commit)
via https://github.com/Gnucash/gnucash/commit/cd23637e (commit)
via https://github.com/Gnucash/gnucash/commit/dfc6b1ed (commit)
via https://github.com/Gnucash/gnucash/commit/03927f8e (commit)
via https://github.com/Gnucash/gnucash/commit/f9fae441 (commit)
via https://github.com/Gnucash/gnucash/commit/86240d55 (commit)
via https://github.com/Gnucash/gnucash/commit/29ee4a2e (commit)
via https://github.com/Gnucash/gnucash/commit/8848fef5 (commit)
via https://github.com/Gnucash/gnucash/commit/10e2ebf1 (commit)
via https://github.com/Gnucash/gnucash/commit/966512f3 (commit)
via https://github.com/Gnucash/gnucash/commit/f7cb52f0 (commit)
via https://github.com/Gnucash/gnucash/commit/7ec2eabb (commit)
via https://github.com/Gnucash/gnucash/commit/6a25c599 (commit)
via https://github.com/Gnucash/gnucash/commit/2449d725 (commit)
via https://github.com/Gnucash/gnucash/commit/5393c63b (commit)
via https://github.com/Gnucash/gnucash/commit/96331ab6 (commit)
via https://github.com/Gnucash/gnucash/commit/c612026e (commit)
via https://github.com/Gnucash/gnucash/commit/93e4f314 (commit)
via https://github.com/Gnucash/gnucash/commit/d63a6e2e (commit)
via https://github.com/Gnucash/gnucash/commit/71272548 (commit)
via https://github.com/Gnucash/gnucash/commit/01de8938 (commit)
via https://github.com/Gnucash/gnucash/commit/e841a00a (commit)
via https://github.com/Gnucash/gnucash/commit/11414276 (commit)
via https://github.com/Gnucash/gnucash/commit/30151dc4 (commit)
via https://github.com/Gnucash/gnucash/commit/8356c58e (commit)
via https://github.com/Gnucash/gnucash/commit/2c73010b (commit)
via https://github.com/Gnucash/gnucash/commit/409f576a (commit)
via https://github.com/Gnucash/gnucash/commit/796f38cf (commit)
via https://github.com/Gnucash/gnucash/commit/a7e5ac83 (commit)
via https://github.com/Gnucash/gnucash/commit/b0fc0789 (commit)
via https://github.com/Gnucash/gnucash/commit/3fc6ff1f (commit)
via https://github.com/Gnucash/gnucash/commit/83e59419 (commit)
via https://github.com/Gnucash/gnucash/commit/bef2c201 (commit)
via https://github.com/Gnucash/gnucash/commit/5506973d (commit)
via https://github.com/Gnucash/gnucash/commit/1a29b81a (commit)
via https://github.com/Gnucash/gnucash/commit/ce27afb8 (commit)
via https://github.com/Gnucash/gnucash/commit/eab5753a (commit)
via https://github.com/Gnucash/gnucash/commit/e99c3d68 (commit)
via https://github.com/Gnucash/gnucash/commit/46451243 (commit)
via https://github.com/Gnucash/gnucash/commit/c8d8cc44 (commit)
via https://github.com/Gnucash/gnucash/commit/3eb5c88c (commit)
via https://github.com/Gnucash/gnucash/commit/df74ac3c (commit)
via https://github.com/Gnucash/gnucash/commit/8814ad77 (commit)
via https://github.com/Gnucash/gnucash/commit/8a4ef02c (commit)
via https://github.com/Gnucash/gnucash/commit/ddda8530 (commit)
via https://github.com/Gnucash/gnucash/commit/2ab6650e (commit)
via https://github.com/Gnucash/gnucash/commit/2cfc6118 (commit)
via https://github.com/Gnucash/gnucash/commit/1bfcc959 (commit)
via https://github.com/Gnucash/gnucash/commit/658da080 (commit)
from https://github.com/Gnucash/gnucash/commit/dd64cec2 (commit)
commit bc9d83c90f477934856b970ad18a839dc5ea2197
Merge: b0d0ee1a4 c1f5eb922
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Mar 19 09:12:48 2019 -0700
Merge Christoph Holterman's 'PR-G_ADD_PRIVATE-clean' into maint.
commit b0d0ee1a4087b9a7bece7b27ecdfe286382656e9
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Mar 11 16:00:39 2019 -0700
Bug 797091 - About window misbehaves.
Caching it is silly. Don't.
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index a3cf8c49c..4bde29f8b 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -205,11 +205,6 @@ typedef struct GncMainWindowPrivate
* window that is contained in the status bar. This pointer
* provides easy access for updating the progressbar. */
GtkWidget *progressbar;
- /** Pointer to the about dialog. We need this so that we create
- * only one, can attach to its activate-link signal, and can
- * destroy it with the main window.
- */
- GtkWidget *about_dialog;
/** The group of all actions provided by the main window
* itself. This does not include any action provided by menu
@@ -2610,7 +2605,6 @@ gnc_main_window_init (GncMainWindow *window,
/* Get the show_color_tabs value preference */
priv->show_color_tabs = gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_TAB_COLOR);
- priv->about_dialog = NULL;
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
GNC_PREF_TAB_COLOR,
@@ -2697,8 +2691,6 @@ gnc_main_window_destroy (GtkWidget *widget)
g_list_foreach (plugins, gnc_main_window_remove_plugin, window);
g_list_free (plugins);
}
- if (priv->about_dialog)
- g_object_unref (priv->about_dialog);
GTK_WIDGET_CLASS (parent_class)->destroy (widget);
}
@@ -4504,32 +4496,26 @@ url_signal_cb (GtkAboutDialog *dialog, gchar *uri, gpointer data)
static void
gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
{
- GncMainWindowPrivate *priv;
-
- priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
-
- if (priv->about_dialog == NULL)
- {
- /* Translators: %s will be replaced with the current year */
- gchar *copyright = g_strdup_printf(_("Copyright © 1997-%s The GnuCash contributors."),
- GNC_VCS_REV_YEAR);
- gchar **authors = get_file_strsplit("AUTHORS");
- gchar **documenters = get_file_strsplit("DOCUMENTERS");
- gchar *license = get_file("LICENSE");
- GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
- GdkPixbuf *logo = gtk_icon_theme_load_icon (icon_theme,
- GNC_ICON_APP,
- 128,
- GTK_ICON_LOOKUP_USE_BUILTIN,
- NULL);
- gchar *version = g_strdup_printf ("%s: %s\n%s: %s\nFinance::Quote: %s",
- _("Version"), gnc_version(),
- _("Build ID"), gnc_build_id(),
- gnc_quote_source_fq_version ()
- ? gnc_quote_source_fq_version ()
- : "-");
- priv->about_dialog = gtk_about_dialog_new ();
- g_object_set (priv->about_dialog,
+ /* Translators: %s will be replaced with the current year */
+ gchar *copyright = g_strdup_printf(_("Copyright © 1997-%s The GnuCash contributors."),
+ GNC_VCS_REV_YEAR);
+ gchar **authors = get_file_strsplit("AUTHORS");
+ gchar **documenters = get_file_strsplit("DOCUMENTERS");
+ gchar *license = get_file("LICENSE");
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
+ GdkPixbuf *logo = gtk_icon_theme_load_icon (icon_theme,
+ GNC_ICON_APP,
+ 128,
+ GTK_ICON_LOOKUP_USE_BUILTIN,
+ NULL);
+ gchar *version = g_strdup_printf ("%s: %s\n%s: %s\nFinance::Quote: %s",
+ _("Version"), gnc_version(),
+ _("Build ID"), gnc_build_id(),
+ gnc_quote_source_fq_version ()
+ ? gnc_quote_source_fq_version ()
+ : "-");
+ GtkDialog *dialog = GTK_DIALOG (gtk_about_dialog_new ());
+ g_object_set (G_OBJECT (dialog),
"authors", authors,
"documenters", documenters,
"comments", _("Accounting for personal and small business finance."),
@@ -4537,37 +4523,34 @@ gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
"license", license,
"logo", logo,
"name", "GnuCash",
- /* Translators: the following string will be shown in Help->About->Credits
- * Enter your name or that of your team and an email contact for feedback.
- * The string can have multiple rows, so you can also add a list of
- * contributors. */
+ /* Translators: the following string will be shown in Help->About->Credits
+ * Enter your name or that of your team and an email contact for feedback.
+ * The string can have multiple rows, so you can also add a list of
+ * contributors. */
"translator-credits", _("translator-credits"),
"version", version,
"website", PACKAGE_URL,
"website-label", _("Visit the GnuCash website."),
NULL);
- g_free(version);
- g_free(copyright);
- if (license)
- g_free(license);
- if (documenters)
- g_strfreev(documenters);
- if (authors)
- g_strfreev(authors);
- g_object_unref (logo);
- g_signal_connect (priv->about_dialog, "activate-link",
- G_CALLBACK (url_signal_cb), NULL);
- g_signal_connect (priv->about_dialog, "response",
- G_CALLBACK (gtk_widget_hide), NULL);
-
- /* Set dialog to resize. */
- gtk_window_set_resizable(GTK_WINDOW(priv->about_dialog), TRUE);
-
- gtk_window_set_transient_for (GTK_WINDOW (priv->about_dialog),
- GTK_WINDOW (window));
- }
- gtk_dialog_run (GTK_DIALOG (priv->about_dialog));
+ g_free(version);
+ g_free(copyright);
+ if (license)
+ g_free(license);
+ if (documenters)
+ g_strfreev(documenters);
+ if (authors)
+ g_strfreev(authors);
+ g_object_unref (logo);
+ g_signal_connect (dialog, "activate-link",
+ G_CALLBACK (url_signal_cb), NULL);
+ /* Set dialog to resize. */
+ gtk_window_set_resizable(GTK_WINDOW (dialog), TRUE);
+
+ gtk_window_set_transient_for (GTK_WINDOW (dialog),
+ GTK_WINDOW (window));
+ gtk_dialog_run (dialog);
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
commit 715a079be0eb2dabfe76967a5234329121f86524
Author: John Ralls <jralls at ceridwen.us>
Date: Mon Mar 11 15:43:26 2019 -0700
Remove copied code from gnc_quartz_should_quit.
Just call gnc_main_window_quit instead.
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 27f357f76..a3cf8c49c 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -3752,33 +3752,13 @@ gnc_quartz_shutdown (GtkosxApplication *theApp, gpointer data)
/* Do Nothing. It's too late. */
}
/* Should quit responds to NSApplicationBlockTermination; returning
- * TRUE means "don't terminate", FALSE means "do terminate". If we
- * decide that it's OK to terminate, then we queue a gnc_shutdown for
- * the next idle time (because we're not running in the main loop) and
- * then tell the OS not to terminate. That gives the gnc_shutdown an
- * opportunity to shut down.
+ * TRUE means "don't terminate", FALSE means "do terminate".
*/
static gboolean
gnc_quartz_should_quit (GtkosxApplication *theApp, GncMainWindow *window)
{
- QofSession *session;
- gboolean needs_save;
-
- if (gnc_current_session_exist())
- return FALSE;
- if (!gnc_main_window_all_finish_pending() ||
- gnc_file_save_in_progress())
-
- {
- return TRUE;
- }
- session = gnc_get_current_session();
- needs_save = qof_book_session_not_saved(qof_session_get_book(session)) &&
- !gnc_file_save_in_progress();
- if (needs_save && gnc_main_window_prompt_for_save(GTK_WIDGET(window)))
- return TRUE;
-
- g_timeout_add(250, gnc_main_window_timed_quit, NULL);
+ if (gnc_main_window_all_finish_pending())
+ return gnc_main_window_quit (window);
return TRUE;
}
commit c1f5eb92299cf1f241a72a251b1d7b97b004463d
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Mon Dec 24 03:32:21 2018 +0100
use GNC_DEFINE_TYPE_WITH_CODE to preserve 2nd init parameter
diff --git a/gnucash/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c
index 296691295..d238bfe3d 100644
--- a/gnucash/gnome-utils/gnc-plugin-page.c
+++ b/gnucash/gnome-utils/gnc-plugin-page.c
@@ -46,7 +46,8 @@ static QofLogModule log_module = GNC_MOD_GUI;
static gpointer parent_class = NULL;
static void gnc_plugin_page_class_init (GncPluginPageClass *klass);
-static void gnc_plugin_page_init (GncPluginPage *plugin_page);
+static void gnc_plugin_page_init (GncPluginPage *plugin_page,
+ void *data);
static void gnc_plugin_page_finalize (GObject *object);
static void gnc_plugin_page_set_property (GObject *object,
guint prop_id,
@@ -103,6 +104,9 @@ typedef struct _GncPluginPagePrivate
gchar *statusbar_text;
} GncPluginPagePrivate;
+GNC_DEFINE_TYPE_WITH_CODE(GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT,
+ G_ADD_PRIVATE(GncPluginPage))
+
#define GNC_PLUGIN_PAGE_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE, GncPluginPagePrivate))
@@ -348,8 +352,6 @@ gnc_plugin_page_unselected (GncPluginPage *plugin_page)
g_signal_emit (G_OBJECT (plugin_page), signals[UNSELECTED], 0);
}
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT)
-
/** Initialize the class for a new generic plugin page. This will set
* up any function pointers that override functions in the parent
* class, set up all properties and signals, and also configure the
@@ -501,9 +503,11 @@ gnc_plugin_page_class_init (GncPluginPageClass *klass)
* @param klass A pointer to the class data structure for this
* object. */
static void
-gnc_plugin_page_init (GncPluginPage *page)
+gnc_plugin_page_init (GncPluginPage *page, void *data)
{
GncPluginPagePrivate *priv;
+
+ GncPluginPageClass *klass = (GncPluginPageClass*)data;
priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page);
priv->page_name = NULL;
@@ -513,7 +517,8 @@ gnc_plugin_page_init (GncPluginPage *page)
page->window = NULL;
page->summarybar = NULL;
- gnc_gobject_tracking_remember(G_OBJECT(page), NULL);
+ gnc_gobject_tracking_remember(G_OBJECT(page),
+ G_OBJECT_CLASS(klass));
}
commit a0a0b30a8717d7d963aab0c2252c69f40b230e93
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 22:54:10 2018 +0100
replace deprecated g_type_class_add_private
use GNC_DEFINE_TYPE_WITH_CODE to preserve 2nd init parameter
..._get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-utils/gnc-plugin.c b/gnucash/gnome-utils/gnc-plugin.c
index 5a14a932f..d84f359e4 100644
--- a/gnucash/gnome-utils/gnc-plugin.c
+++ b/gnucash/gnome-utils/gnc-plugin.c
@@ -50,7 +50,7 @@ static gpointer parent_class = NULL;
static void gnc_plugin_class_init (GncPluginClass *klass);
static void gnc_plugin_init (GncPlugin *plugin_page,
- GncPluginClass *klass);
+ void *data);
static void gnc_plugin_finalize (GObject *object);
@@ -61,41 +61,12 @@ typedef struct GncPluginPrivate
gpointer dummy;
} GncPluginPrivate;
+GNC_DEFINE_TYPE_WITH_CODE(GncPlugin, gnc_plugin, G_TYPE_OBJECT,
+ G_ADD_PRIVATE(GncPlugin))
+
#define GNC_PLUGIN_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN, GncPluginPrivate))
-
-/** Get the type of a gnc window plugin.
- */
-GType
-gnc_plugin_get_type (void)
-{
- static GType gnc_plugin_type = 0;
-
- if (gnc_plugin_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPlugin),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_init,
- };
-
- gnc_plugin_type = g_type_register_static (G_TYPE_OBJECT,
- GNC_PLUGIN_NAME,
- &our_info, 0);
- }
-
- return gnc_plugin_type;
-}
-
-
/** Initialize the class for the new gnucash plugin object. This will
* set up any function pointers that override functions in the parent
* class, and also installs the proprieties that are unique to this
@@ -110,8 +81,6 @@ gnc_plugin_class_init (GncPluginClass *klass)
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = gnc_plugin_finalize;
-
- g_type_class_add_private(klass, sizeof(GncPluginPrivate));
}
@@ -124,8 +93,10 @@ gnc_plugin_class_init (GncPluginClass *klass)
* @param klass A pointer to the class data structure for this
* object. */
static void
-gnc_plugin_init (GncPlugin *plugin_page, GncPluginClass *klass)
+gnc_plugin_init (GncPlugin *plugin_page, void *data)
{
+ GncPluginClass *klass = (GncPluginClass*)data;
+
gnc_gobject_tracking_remember(G_OBJECT(plugin_page), \
G_OBJECT_CLASS(klass));
}
commit 8545ca408c5169731e0a0fcf5135e2b7584dc58e
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Sun Dec 23 21:58:31 2018 +0100
redefine macro to provide 2nd parameter for init
Use older (pre-glib-2.53.3) versions of _G_DEFINE_TYPE_EXTENDED_BEGIN
_G_DEFINE_TYPE_EXTENDED_END, and implement GNC_IMPLEMENT_INTERFACE
to take a two-parameter interface_init function.
Required to compile on distributions with older versions of glib-2.0.
some explanation about derived type macros
diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index c3216f737..38de73dc2 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -57,7 +57,6 @@ static void gnc_window_embedded_window_init (GncWindowIface *iface);
static void gnc_embedded_window_setup_window (GncEmbeddedWindow *window);
-
/** The instance private data for an embedded window object. */
typedef struct GncEmbeddedWindowPrivate
{
@@ -86,6 +85,11 @@ typedef struct GncEmbeddedWindowPrivate
GtkWidget *parent_window;
} GncEmbeddedWindowPrivate;
+GNC_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))
+
#define GNC_EMBEDDED_WINDOW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_EMBEDDED_WINDOW, GncEmbeddedWindowPrivate))
@@ -157,10 +161,6 @@ gnc_embedded_window_get_page (GncEmbeddedWindow *window)
return priv->page;
}
-G_DEFINE_TYPE_WITH_CODE(GncEmbeddedWindow, gnc_embedded_window, GTK_TYPE_BOX,
- G_ADD_PRIVATE(GncEmbeddedWindow)
- G_IMPLEMENT_INTERFACE(GNC_TYPE_WINDOW,
- gnc_window_embedded_window_init))
/** Initialize the class for a new gnucash embedded window. This will
* set up any function pointers that override functions in the parent
@@ -193,8 +193,9 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
* @param klass A pointer to the class data structure for this
* object. */
static void
-gnc_embedded_window_init (GncEmbeddedWindow *window)
+gnc_embedded_window_init (GncEmbeddedWindow *window, void *data)
{
+ GncEmbeddedWindowClass *klass = (GncEmbeddedWindowClass*)data;
ENTER("window %p", window);
gtk_orientable_set_orientation (GTK_ORIENTABLE(window), GTK_ORIENTATION_VERTICAL);
@@ -204,7 +205,8 @@ gnc_embedded_window_init (GncEmbeddedWindow *window)
gnc_embedded_window_setup_window (window);
- gnc_gobject_tracking_remember(G_OBJECT(window), NULL);
+ gnc_gobject_tracking_remember(G_OBJECT(window),
+ G_OBJECT_CLASS(klass));
LEAVE(" ");
}
diff --git a/gnucash/gnome-utils/gnc-gobject-utils.h b/gnucash/gnome-utils/gnc-gobject-utils.h
index 420e45ecf..11485def0 100644
--- a/gnucash/gnome-utils/gnc-gobject-utils.h
+++ b/gnucash/gnome-utils/gnc-gobject-utils.h
@@ -109,6 +109,62 @@ 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 *class); \
+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 volatile gsize g_define_type_id__volatile = 0; \
+ if (g_once_init_enter (&g_define_type_id__volatile)) \
+ { \
+ 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__volatile, g_define_type_id); \
+ } \
+ return g_define_type_id__volatile; \
+} /* closes type_name##_get_type() */
+
#endif /* GNC_GOBJECT_UTILS_H */
/** @} */
commit 2cb6807323878a002725519bb065c03bb51f8b83
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 20 21:57:37 2018 +0100
move G_DEFINE_TYPE_... further up
diff --git a/gnucash/gnome-utils/gnc-currency-edit.c b/gnucash/gnome-utils/gnc-currency-edit.c
index 4a088db19..a3ade068d 100644
--- a/gnucash/gnome-utils/gnc-currency-edit.c
+++ b/gnucash/gnome-utils/gnc-currency-edit.c
@@ -90,6 +90,8 @@ typedef struct _GNCCurrencyEditPrivate
gchar *mnemonic;
} GNCCurrencyEditPrivate;
+G_DEFINE_TYPE_WITH_PRIVATE(GNCCurrencyEdit, gnc_currency_edit, GTK_TYPE_COMBO_BOX)
+
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_CURRENCY_EDIT, GNCCurrencyEditPrivate))
@@ -153,9 +155,6 @@ gnc_currency_edit_get_property (GObject *object,
}
}
-
-G_DEFINE_TYPE_WITH_PRIVATE(GNCCurrencyEdit, gnc_currency_edit, GTK_TYPE_COMBO_BOX)
-
/** Initialize the GncCurrencyEdit class object.
*
* @internal
commit cd23637e3f047aae3b51ef205891dc608dbbd57d
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 20 20:24:23 2018 +0100
missed to remove call to g_type_class_add_private
diff --git a/gnucash/gnome-utils/gnc-tree-view-commodity.c b/gnucash/gnome-utils/gnc-tree-view-commodity.c
index 7973c543d..f9c2cf9b7 100644
--- a/gnucash/gnome-utils/gnc-tree-view-commodity.c
+++ b/gnucash/gnome-utils/gnc-tree-view-commodity.c
@@ -85,8 +85,6 @@ gnc_tree_view_commodity_class_init (GncTreeViewCommodityClass *klass)
/* GtkWidget signals */
widget_class->destroy = gnc_tree_view_commodity_destroy;
-
- g_type_class_add_private(klass, sizeof(GncTreeViewCommodityPrivate));
}
static void
commit dfc6b1ed04c72b67ab6603ad49a5575f1a393536
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Sat Dec 15 05:26:06 2018 +0100
Workaround to prevent segfault when accessing page_list->data when page_list is NULL
diff --git a/gnucash/gnome/gnc-plugin-page-account-tree.c b/gnucash/gnome/gnc-plugin-page-account-tree.c
index a4bf13100..d7ee28c0f 100644
--- a/gnucash/gnome/gnc-plugin-page-account-tree.c
+++ b/gnucash/gnome/gnc-plugin-page-account-tree.c
@@ -446,10 +446,10 @@ gnc_plugin_page_account_tree_init (GncPluginPageAccountTree *plugin_page)
/* Is this the first accounts page? */
page_list =
gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_ACCOUNT_TREE_NAME);
- if (plugin_page == page_list->data)
+ if (!page_list || plugin_page == page_list->data)
{
g_object_set_data(G_OBJECT(plugin_page), PLUGIN_PAGE_IMMUTABLE,
- GINT_TO_POINTER(1));
+ GINT_TO_POINTER(1));
}
/* Create menu and toolbar information */
commit 03927f8eee04b41bb1163a1b929f04df7a41565c
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 10:37:05 2018 +0100
use G_DEFINE_TYPE_WITH_CODE to replace g_type_class_add_private
gnc_tree_model_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
use GNC_DEFINE_TYPE_WITH_CODE to preserve 2nd init parameter
diff --git a/gnucash/gnome-utils/gnc-tree-model.c b/gnucash/gnome-utils/gnc-tree-model.c
index f9eacc941..432bcdf39 100644
--- a/gnucash/gnome-utils/gnc-tree-model.c
+++ b/gnucash/gnome-utils/gnc-tree-model.c
@@ -37,7 +37,8 @@ static QofLogModule log_module = GNC_MOD_GUI;
/** Declarations *********************************************************/
static void gnc_tree_model_class_init (GncTreeModelClass *klass);
-static void gnc_tree_model_init (GncTreeModel *model, GncTreeModelClass *klass);
+static void gnc_tree_model_init (GncTreeModel *model,
+ void *data);
static void gnc_tree_model_finalize (GObject *object);
/** The instance private data for a generic tree model. */
@@ -46,6 +47,9 @@ typedef struct GncTreeModelPrivate
gpointer dummy;
} GncTreeModelPrivate;
+GNC_DEFINE_TYPE_WITH_CODE(GncTreeModel, gnc_tree_model, G_TYPE_OBJECT,
+ G_ADD_PRIVATE(GncTreeModel))
+
#define GNC_TREE_MODEL_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_TREE_MODEL, GncTreeModelPrivate))
@@ -57,44 +61,6 @@ typedef struct GncTreeModelPrivate
/** A pointer to the parent class of a generic tree model. */
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_model_get_type (void)
-{
- static GType gnc_tree_model_type = 0;
-
- if (gnc_tree_model_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeModelClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_tree_model_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncTreeModel), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_tree_model_init
- };
-
- //static const GInterfaceInfo tree_model_info = {
- // (GInterfaceInitFunc) gnc_tree_model_tree_model_init,
- // NULL,
- // NULL
- //};
-
- gnc_tree_model_type = g_type_register_static (G_TYPE_OBJECT,
- GNC_TREE_MODEL_NAME,
- &our_info, 0);
-
- //g_type_add_interface_static (gnc_tree_model_type,
- // GTK_TYPE_TREE_MODEL,
- // &tree_model_info);
- }
-
- return gnc_tree_model_type;
-}
-
static void
gnc_tree_model_class_init (GncTreeModelClass *klass)
{
@@ -106,15 +72,16 @@ gnc_tree_model_class_init (GncTreeModelClass *klass)
/* GObject signals */
o_class->finalize = gnc_tree_model_finalize;
-
- g_type_class_add_private(klass, sizeof(GncTreeModelPrivate));
}
static void
-gnc_tree_model_init (GncTreeModel *model, GncTreeModelClass *klass)
+gnc_tree_model_init (GncTreeModel *model, void *data)
{
+ GncTreeModelClass *klass = (GncTreeModelClass*)data;
+
ENTER("model %p", model);
- gnc_gobject_tracking_remember(G_OBJECT(model), G_OBJECT_CLASS(klass));
+ gnc_gobject_tracking_remember(G_OBJECT(model),
+ G_OBJECT_CLASS(klass));
LEAVE(" ");
}
commit f9fae4418ecab04531735413df257fad861b4938
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 13 12:32:12 2018 +0100
fix
diff --git a/gnucash/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c
index 7857d57c6..296691295 100644
--- a/gnucash/gnome-utils/gnc-plugin-page.c
+++ b/gnucash/gnome-utils/gnc-plugin-page.c
@@ -46,8 +46,7 @@ static QofLogModule log_module = GNC_MOD_GUI;
static gpointer parent_class = NULL;
static void gnc_plugin_page_class_init (GncPluginPageClass *klass);
-static void gnc_plugin_page_init (GncPluginPage *plugin_page,
- GncPluginPageClass *klass);
+static void gnc_plugin_page_init (GncPluginPage *plugin_page);
static void gnc_plugin_page_finalize (GObject *object);
static void gnc_plugin_page_set_property (GObject *object,
guint prop_id,
@@ -502,7 +501,7 @@ gnc_plugin_page_class_init (GncPluginPageClass *klass)
* @param klass A pointer to the class data structure for this
* object. */
static void
-gnc_plugin_page_init (GncPluginPage *page, GncPluginPageClass *klass)
+gnc_plugin_page_init (GncPluginPage *page)
{
GncPluginPagePrivate *priv;
@@ -514,7 +513,7 @@ gnc_plugin_page_init (GncPluginPage *page, GncPluginPageClass *klass)
page->window = NULL;
page->summarybar = NULL;
- gnc_gobject_tracking_remember(G_OBJECT(page), G_OBJECT_CLASS(klass));
+ gnc_gobject_tracking_remember(G_OBJECT(page), NULL);
}
commit 86240d55421acf5c4b3064e0f9818f8b0c99a4de
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 13 12:30:24 2018 +0100
Revert "revert 630f5ba2a693d0a6a9b3ebced645dfd4c5046c98"
This reverts commit f61652fc242ec185833abe36f0a22a5e78a3dd8f.
diff --git a/gnucash/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c
index 8d5529cf5..7857d57c6 100644
--- a/gnucash/gnome-utils/gnc-plugin-page.c
+++ b/gnucash/gnome-utils/gnc-plugin-page.c
@@ -107,36 +107,6 @@ typedef struct _GncPluginPagePrivate
#define GNC_PLUGIN_PAGE_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE, GncPluginPagePrivate))
-GType
-gnc_plugin_page_get_type (void)
-{
- static GType gnc_plugin_page_type = 0;
-
- if (gnc_plugin_page_type == 0)
- {
- static const GTypeInfo our_info =
- {
-
- sizeof (GncPluginPageClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_page_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginPage),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_page_init,
- };
-
- gnc_plugin_page_type = g_type_register_static (G_TYPE_OBJECT,
- "GncPluginPage",
- &our_info, 0);
- }
-
- return gnc_plugin_page_type;
-}
-
-
/* Create the display widget that corresponds to this plugin. This
* function will be called by the main/embedded window manipulation
* code to create a widget that they can display. The returned
@@ -379,6 +349,7 @@ gnc_plugin_page_unselected (GncPluginPage *plugin_page)
g_signal_emit (G_OBJECT (plugin_page), signals[UNSELECTED], 0);
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT)
/** Initialize the class for a new generic plugin page. This will set
* up any function pointers that override functions in the parent
@@ -400,8 +371,6 @@ gnc_plugin_page_class_init (GncPluginPageClass *klass)
klass->tab_icon = NULL;
klass->plugin_name = NULL;
- g_type_class_add_private(klass, sizeof(GncPluginPagePrivate));
-
g_object_class_install_property
(gobject_class,
PROP_PAGE_NAME,
commit 29ee4a2e5515804a93c36cf98f8294c9a9098279
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 13 11:46:04 2018 +0100
trying to keep memory tracking
diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index 7a031ac2d..c3216f737 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -193,8 +193,7 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
* @param klass A pointer to the class data structure for this
* object. */
static void
-gnc_embedded_window_init (GncEmbeddedWindow *window)/*,
- GncEmbeddedWindowClass *klass)*/
+gnc_embedded_window_init (GncEmbeddedWindow *window)
{
ENTER("window %p", window);
@@ -205,8 +204,7 @@ gnc_embedded_window_init (GncEmbeddedWindow *window)/*,
gnc_embedded_window_setup_window (window);
-/* gnc_gobject_tracking_remember(G_OBJECT(window),
- G_OBJECT_CLASS(klass));*/
+ gnc_gobject_tracking_remember(G_OBJECT(window), NULL);
LEAVE(" ");
}
@@ -221,6 +219,7 @@ gnc_embedded_window_finalize (GObject *object)
g_return_if_fail (GNC_IS_EMBEDDED_WINDOW (object));
ENTER("object %p", object);
+ gnc_gobject_tracking_forget(object);
G_OBJECT_CLASS (parent_class)->finalize (object);
LEAVE(" ");
}
commit 8848fef573547917c31c5357091743609feb4189
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 13 11:23:57 2018 +0100
remove forget as memory tracking is removed
diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index 0ca90972f..7a031ac2d 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -221,7 +221,6 @@ gnc_embedded_window_finalize (GObject *object)
g_return_if_fail (GNC_IS_EMBEDDED_WINDOW (object));
ENTER("object %p", object);
- gnc_gobject_tracking_forget(object);
G_OBJECT_CLASS (parent_class)->finalize (object);
LEAVE(" ");
}
commit 10e2ebf1779c4d819b896f501edce8ac81050980
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Wed Dec 12 23:57:30 2018 +0100
trying to find a working gnc_embedded_window_class_init
diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index 98b517e81..0ca90972f 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -50,7 +50,6 @@ static GObjectClass *parent_class = NULL;
/* Declarations *********************************************************/
static void gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass);
-static void gnc_embedded_window_init (GncEmbeddedWindow *window, GncEmbeddedWindowClass *klass);
static void gnc_embedded_window_finalize (GObject *object);
static void gnc_embedded_window_dispose (GObject *object);
@@ -194,20 +193,20 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
* @param klass A pointer to the class data structure for this
* object. */
static void
-gnc_embedded_window_init (GncEmbeddedWindow *window,
- GncEmbeddedWindowClass *klass)
+gnc_embedded_window_init (GncEmbeddedWindow *window)/*,
+ GncEmbeddedWindowClass *klass)*/
{
ENTER("window %p", window);
gtk_orientable_set_orientation (GTK_ORIENTABLE(window), GTK_ORIENTATION_VERTICAL);
// Set the style context for this widget so it can be easily manipulated with css
- gnc_widget_set_style_context (GTK_WIDGET(window), "GncEmbededWindow");
+ gnc_widget_set_style_context (GTK_WIDGET(window), "GncEmbeddedWindow");
gnc_embedded_window_setup_window (window);
- gnc_gobject_tracking_remember(G_OBJECT(window),
- G_OBJECT_CLASS(klass));
+/* gnc_gobject_tracking_remember(G_OBJECT(window),
+ G_OBJECT_CLASS(klass));*/
LEAVE(" ");
}
commit 966512f37743bd5dfb946c91c0b9ab3f45c619b2
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Sun Dec 9 05:13:30 2018 +0100
Revert "Revert "use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private""
This reverts commit 250958ebfb50bf3425cc8ecca5220ffb20b3aac9.
diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index 2d0c5149e..98b517e81 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -90,48 +90,6 @@ typedef struct GncEmbeddedWindowPrivate
#define GNC_EMBEDDED_WINDOW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_EMBEDDED_WINDOW, GncEmbeddedWindowPrivate))
-
-
-/* Get the type of a gnc embedded window. */
-GType
-gnc_embedded_window_get_type (void)
-{
- static GType gnc_embedded_window_type = 0;
-
- if (gnc_embedded_window_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncEmbeddedWindowClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_embedded_window_class_init,
- NULL,
- NULL,
- sizeof (GncEmbeddedWindow),
- 0,
- (GInstanceInitFunc) gnc_embedded_window_init
- };
-
- static const GInterfaceInfo plugin_info =
- {
- (GInterfaceInitFunc) gnc_window_embedded_window_init,
- NULL,
- NULL
- };
-
- gnc_embedded_window_type = g_type_register_static (GTK_TYPE_BOX,
- "GncEmbeddedWindow",
- &our_info, 0);
- g_type_add_interface_static (gnc_embedded_window_type,
- GNC_TYPE_WINDOW,
- &plugin_info);
- }
-
- return gnc_embedded_window_type;
-}
-
-
/* Display a data plugin page in a window. */
void
gnc_embedded_window_open_page (GncEmbeddedWindow *window,
@@ -200,6 +158,10 @@ gnc_embedded_window_get_page (GncEmbeddedWindow *window)
return priv->page;
}
+G_DEFINE_TYPE_WITH_CODE(GncEmbeddedWindow, gnc_embedded_window, GTK_TYPE_BOX,
+ G_ADD_PRIVATE(GncEmbeddedWindow)
+ G_IMPLEMENT_INTERFACE(GNC_TYPE_WINDOW,
+ gnc_window_embedded_window_init))
/** Initialize the class for a new gnucash embedded window. This will
* set up any function pointers that override functions in the parent
@@ -218,8 +180,7 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
object_class->finalize = gnc_embedded_window_finalize;
object_class->dispose = gnc_embedded_window_dispose;
-
- g_type_class_add_private(klass, sizeof(GncEmbeddedWindowPrivate));
+
LEAVE(" ");
}
commit f7cb52f08bf0b9e8a39c82962f4a12c06c523170
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Sun Dec 9 02:06:19 2018 +0100
Revert "use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private"
This reverts commit 6bdea490a3e839eb4dd4894a42dd1f69d8688437.
error conflicting types for âgnc_embedded_window_initâ.
diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index 98b517e81..2d0c5149e 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -90,6 +90,48 @@ typedef struct GncEmbeddedWindowPrivate
#define GNC_EMBEDDED_WINDOW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_EMBEDDED_WINDOW, GncEmbeddedWindowPrivate))
+
+
+/* Get the type of a gnc embedded window. */
+GType
+gnc_embedded_window_get_type (void)
+{
+ static GType gnc_embedded_window_type = 0;
+
+ if (gnc_embedded_window_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (GncEmbeddedWindowClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gnc_embedded_window_class_init,
+ NULL,
+ NULL,
+ sizeof (GncEmbeddedWindow),
+ 0,
+ (GInstanceInitFunc) gnc_embedded_window_init
+ };
+
+ static const GInterfaceInfo plugin_info =
+ {
+ (GInterfaceInitFunc) gnc_window_embedded_window_init,
+ NULL,
+ NULL
+ };
+
+ gnc_embedded_window_type = g_type_register_static (GTK_TYPE_BOX,
+ "GncEmbeddedWindow",
+ &our_info, 0);
+ g_type_add_interface_static (gnc_embedded_window_type,
+ GNC_TYPE_WINDOW,
+ &plugin_info);
+ }
+
+ return gnc_embedded_window_type;
+}
+
+
/* Display a data plugin page in a window. */
void
gnc_embedded_window_open_page (GncEmbeddedWindow *window,
@@ -158,10 +200,6 @@ gnc_embedded_window_get_page (GncEmbeddedWindow *window)
return priv->page;
}
-G_DEFINE_TYPE_WITH_CODE(GncEmbeddedWindow, gnc_embedded_window, GTK_TYPE_BOX,
- G_ADD_PRIVATE(GncEmbeddedWindow)
- G_IMPLEMENT_INTERFACE(GNC_TYPE_WINDOW,
- gnc_window_embedded_window_init))
/** Initialize the class for a new gnucash embedded window. This will
* set up any function pointers that override functions in the parent
@@ -180,7 +218,8 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
object_class->finalize = gnc_embedded_window_finalize;
object_class->dispose = gnc_embedded_window_dispose;
-
+
+ g_type_class_add_private(klass, sizeof(GncEmbeddedWindowPrivate));
LEAVE(" ");
}
commit 7ec2eabbd9412f5c36b374f8b964b03cfa1a0f20
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 11:11:06 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_view_sx_list_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE. Rename GNCDateFormatPriv to GNCDateFormatPrivate.
diff --git a/gnucash/gnome-utils/gnc-tree-view-sx-list.c b/gnucash/gnome-utils/gnc-tree-view-sx-list.c
index d4858664b..c48a5325d 100644
--- a/gnucash/gnome-utils/gnc-tree-view-sx-list.c
+++ b/gnucash/gnome-utils/gnc-tree-view-sx-list.c
@@ -63,33 +63,7 @@ typedef struct GncTreeViewSxListPrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_view_sx_list_get_type(void)
-{
- static GType gnc_tree_view_sx_list_type = 0;
-
- if (gnc_tree_view_sx_list_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeViewSxListClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_view_sx_list_class_init,
- NULL,
- NULL,
- sizeof (GncTreeViewSxList),
- 0,
- (GInstanceInitFunc) gnc_tree_view_sx_list_init
- };
-
- gnc_tree_view_sx_list_type = g_type_register_static (GNC_TYPE_TREE_VIEW,
- "GncTreeViewSxList",
- &our_info, 0);
- }
-
- return gnc_tree_view_sx_list_type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewSxList, gnc_tree_view_sx_list, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_sx_list_class_init(GncTreeViewSxListClass *klass)
@@ -102,8 +76,6 @@ gnc_tree_view_sx_list_class_init(GncTreeViewSxListClass *klass)
o_class->dispose = gnc_tree_view_sx_list_dispose;
o_class->finalize = gnc_tree_view_sx_list_finalize;
-
- g_type_class_add_private(klass, sizeof(GncTreeViewSxListPrivate));
}
static void
commit 6a25c599850b856e78ecadd4fb3f883e13efe82e
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 11:10:35 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_view_commodity_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE. Rename GNCDateFormatPriv to GNCDateFormatPrivate.
diff --git a/gnucash/gnome-utils/gnc-tree-view-commodity.c b/gnucash/gnome-utils/gnc-tree-view-commodity.c
index 23a57d77e..7973c543d 100644
--- a/gnucash/gnome-utils/gnc-tree-view-commodity.c
+++ b/gnucash/gnome-utils/gnc-tree-view-commodity.c
@@ -67,33 +67,7 @@ typedef struct GncTreeViewCommodityPrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_view_commodity_get_type (void)
-{
- static GType gnc_tree_view_commodity_type = 0;
-
- if (gnc_tree_view_commodity_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeViewCommodityClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_view_commodity_class_init,
- NULL,
- NULL,
- sizeof (GncTreeViewCommodity),
- 0,
- (GInstanceInitFunc) gnc_tree_view_commodity_init
- };
-
- gnc_tree_view_commodity_type = g_type_register_static (GNC_TYPE_TREE_VIEW,
- "GncTreeViewCommodity",
- &our_info, 0);
- }
-
- return gnc_tree_view_commodity_type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewCommodity, gnc_tree_view_commodity, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_commodity_class_init (GncTreeViewCommodityClass *klass)
commit 2449d7257e528e546823bc7219619238a2da882f
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 11:10:02 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_view_account_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE.
diff --git a/gnucash/gnome-utils/gnc-tree-view-account.c b/gnucash/gnome-utils/gnc-tree-view-account.c
index 2953cd19e..93588fc40 100644
--- a/gnucash/gnome-utils/gnc-tree-view-account.c
+++ b/gnucash/gnome-utils/gnc-tree-view-account.c
@@ -124,33 +124,7 @@ typedef struct GncTreeViewAccountPrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_view_account_get_type (void)
-{
- static GType gnc_tree_view_account_type = 0;
-
- if (gnc_tree_view_account_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeViewAccountClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_view_account_class_init,
- NULL,
- NULL,
- sizeof (GncTreeViewAccount),
- 0,
- (GInstanceInitFunc) gnc_tree_view_account_init
- };
-
- gnc_tree_view_account_type = g_type_register_static (
- GNC_TYPE_TREE_VIEW, GNC_TREE_VIEW_ACCOUNT_NAME,
- &our_info, 0);
- }
-
- return gnc_tree_view_account_type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewAccount, gnc_tree_view_account, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_account_class_init (GncTreeViewAccountClass *klass)
@@ -163,8 +137,6 @@ gnc_tree_view_account_class_init (GncTreeViewAccountClass *klass)
o_class = G_OBJECT_CLASS (klass);
o_class->finalize = gnc_tree_view_account_finalize;
- g_type_class_add_private(klass, sizeof(GncTreeViewAccountPrivate));
-
gnc_hook_add_dangler(HOOK_CURRENCY_CHANGED,
(GFunc)gtva_currency_changed_cb, NULL);
}
commit 5393c63b65e27d0479abb6674f2a2571eaa0c429
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 11:09:31 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_menu_additions_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE. Rename GNCDateFormatPriv to GNCDateFormatPrivate.
diff --git a/gnucash/gnome-utils/gnc-plugin-menu-additions.c b/gnucash/gnome-utils/gnc-plugin-menu-additions.c
index cb2c587b0..b8d1eff2b 100644
--- a/gnucash/gnome-utils/gnc-plugin-menu-additions.c
+++ b/gnucash/gnome-utils/gnc-plugin-menu-additions.c
@@ -89,33 +89,7 @@ typedef struct _GncPluginMenuAdditionsPerWindow
* Object Implementation *
************************************************************/
-GType
-gnc_plugin_menu_additions_get_type (void)
-{
- static GType gnc_plugin_menu_additions_type = 0;
-
- if (gnc_plugin_menu_additions_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginMenuAdditionsClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_menu_additions_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginMenuAdditions),
- 0,
- (GInstanceInitFunc) gnc_plugin_menu_additions_init
- };
-
- gnc_plugin_menu_additions_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginMenuAdditions",
- &our_info, 0);
- }
-
- return gnc_plugin_menu_additions_type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginMenuAdditions, gnc_plugin_menu_additions, GNC_TYPE_PLUGIN)
static void
gnc_plugin_menu_additions_class_init (GncPluginMenuAdditionsClass *klass)
@@ -133,8 +107,6 @@ gnc_plugin_menu_additions_class_init (GncPluginMenuAdditionsClass *klass)
/* function overrides */
plugin_class->add_to_window = gnc_plugin_menu_additions_add_to_window;
plugin_class->remove_from_window = gnc_plugin_menu_additions_remove_from_window;
-
- g_type_class_add_private(klass, sizeof(GncPluginMenuAdditionsPrivate));
}
static void
commit 96331ab6dc19e3d87cf8dce99cb50dceb1241f55
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 11:08:22 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_manager_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE. Rename GNCDateFormatPriv to GNCDateFormatPrivate.
diff --git a/gnucash/gnome-utils/gnc-plugin-manager.c b/gnucash/gnome-utils/gnc-plugin-manager.c
index ee962db5d..73fb9ebea 100644
--- a/gnucash/gnome-utils/gnc-plugin-manager.c
+++ b/gnucash/gnome-utils/gnc-plugin-manager.c
@@ -59,34 +59,6 @@ static GncPluginManager *singleton = NULL;
static GObjectClass *parent_class = NULL;
-GType
-gnc_plugin_manager_get_type (void)
-{
- static GType gnc_plugin_manager_type = 0;
-
- if (gnc_plugin_manager_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginManagerClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_plugin_manager_class_init,
- NULL,
- NULL,
- sizeof (GncPluginManager),
- 0,
- (GInstanceInitFunc) gnc_plugin_manager_init
- };
-
- gnc_plugin_manager_type = g_type_register_static (G_TYPE_OBJECT,
- "GncPluginManager",
- &our_info, 0);
- }
-
- return gnc_plugin_manager_type;
-}
-
GncPluginManager *
gnc_plugin_manager_get (void)
{
@@ -179,6 +151,7 @@ gnc_plugin_manager_get_plugin (GncPluginManager *manager,
return GNC_PLUGIN (g_hash_table_lookup (priv->plugins_table, name));
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginManager, gnc_plugin_manager, G_TYPE_OBJECT)
static void
gnc_plugin_manager_class_init (GncPluginManagerClass *klass)
@@ -190,8 +163,6 @@ gnc_plugin_manager_class_init (GncPluginManagerClass *klass)
object_class->dispose = gnc_plugin_manager_dispose;
object_class->finalize = gnc_plugin_manager_finalize;
- g_type_class_add_private(klass, sizeof(GncPluginManagerPrivate));
-
signals[PLUGIN_ADDED] = g_signal_new ("plugin-added",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_FIRST,
commit c612026e686ed1071fa8abc1b14b1a537c3f3886
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 11:07:49 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_file_history_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE. Rename GNCDateFormatPriv to GNCDateFormatPrivate.
diff --git a/gnucash/gnome-utils/gnc-plugin-file-history.c b/gnucash/gnome-utils/gnc-plugin-file-history.c
index fb2e06444..44cab3374 100644
--- a/gnucash/gnome-utils/gnc-plugin-file-history.c
+++ b/gnucash/gnome-utils/gnc-plugin-file-history.c
@@ -518,37 +518,6 @@ gnc_plugin_history_list_changed (gpointer prefs,
* Object Implementation *
************************************************************/
-/* Get the type of a file history plugin. */
-GType
-gnc_plugin_file_history_get_type (void)
-{
- static GType gnc_plugin_file_history_type = 0;
-
- if (gnc_plugin_file_history_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginFileHistoryClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_file_history_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginFileHistory),
- 0,
- (GInstanceInitFunc) gnc_plugin_file_history_init
- };
-
- gnc_plugin_file_history_type =
- g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginFileHistory",
- &our_info, 0);
- }
-
- return gnc_plugin_file_history_type;
-}
-
-
/** Initialize the file history plugin class. */
static void
gnc_plugin_file_history_class_init (GncPluginFileHistoryClass *klass)
@@ -573,10 +542,9 @@ gnc_plugin_file_history_class_init (GncPluginFileHistoryClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginFileHistoryPrivate));
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginFileHistory, gnc_plugin_file_history, GNC_TYPE_PLUGIN)
/** Initialize an instance of the file history plugin. */
static void
commit 93e4f314e8c16ebe76238c3a7a974beb610ccbb8
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 11:07:17 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_date_format_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE. Rename GNCDateFormatPriv to GNCDateFormatPrivate.
diff --git a/gnucash/gnome-utils/gnc-date-format.c b/gnucash/gnome-utils/gnc-date-format.c
index 864a9af08..fe5198c11 100644
--- a/gnucash/gnome-utils/gnc-date-format.c
+++ b/gnucash/gnome-utils/gnc-date-format.c
@@ -53,9 +53,9 @@ enum
LAST_SIGNAL
};
-typedef struct _GNCDateFormatPriv GNCDateFormatPriv;
+typedef struct _GNCDateFormatPrivate GNCDateFormatPrivate;
-struct _GNCDateFormatPriv
+struct _GNCDateFormatPrivate
{
GtkWidget* format_combobox;
@@ -76,7 +76,7 @@ struct _GNCDateFormatPriv
};
#define GNC_DATE_FORMAT_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_DATE_FORMAT, GNCDateFormatPriv))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_DATE_FORMAT, GNCDateFormatPrivate))
static guint date_format_signals [LAST_SIGNAL] = { 0 };
@@ -89,40 +89,7 @@ void gnc_ui_date_format_changed_cb(GtkWidget *unused, gpointer user_data);
static GtkBoxClass *parent_class;
-/**
- * gnc_date_format_get_type:
- *
- * Returns the GType for the GNCDateFormat widget
- */
-GType
-gnc_date_format_get_type (void)
-{
- static GType date_format_type = 0;
-
- if (!date_format_type)
- {
- static const GTypeInfo date_format_info =
- {
- sizeof (GNCDateFormatClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_date_format_class_init,
- NULL,
- NULL,
- sizeof (GNCDateFormat),
- 0,
- (GInstanceInitFunc) gnc_date_format_init,
- NULL,
- };
-
- date_format_type = g_type_register_static(GTK_TYPE_BOX,
- "GNCDateFormat",
- &date_format_info, 0);
- }
-
- return date_format_type;
-}
-
+G_DEFINE_TYPE_WITH_PRIVATE(GNCDateFormat, gnc_date_format, GTK_TYPE_BOX)
static void
gnc_date_format_class_init (GNCDateFormatClass *klass)
@@ -133,8 +100,6 @@ gnc_date_format_class_init (GNCDateFormatClass *klass)
gobject_class->finalize = gnc_date_format_finalize;
- g_type_class_add_private(klass, sizeof(GNCDateFormatPriv));
-
date_format_signals [FORMAT_CHANGED] =
g_signal_new ("format_changed",
G_OBJECT_CLASS_TYPE (gobject_class),
@@ -151,7 +116,7 @@ gnc_date_format_class_init (GNCDateFormatClass *klass)
static void
gnc_date_format_init (GNCDateFormat *gdf)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
GtkBuilder *builder;
GtkWidget *dialog, *table;
@@ -238,7 +203,7 @@ gnc_date_format_new_without_label (void)
{
GtkWidget *widget = gnc_date_format_new_with_label(NULL);
GNCDateFormat *gdf = GNC_DATE_FORMAT(widget);
- GNCDateFormatPriv *priv = GNC_DATE_FORMAT_GET_PRIVATE(gdf);
+ GNCDateFormatPrivate *priv = GNC_DATE_FORMAT_GET_PRIVATE(gdf);
gtk_widget_destroy(priv->label);
priv->label = NULL;
@@ -260,7 +225,7 @@ GtkWidget *
gnc_date_format_new_with_label (const char *label)
{
GNCDateFormat *gdf;
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
gdf = g_object_new(GNC_TYPE_DATE_FORMAT, NULL);
priv = GNC_DATE_FORMAT_GET_PRIVATE(gdf);
@@ -276,7 +241,7 @@ gnc_date_format_new_with_label (const char *label)
void
gnc_date_format_set_format (GNCDateFormat *gdf, QofDateFormat format)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
g_return_if_fail(gdf);
g_return_if_fail(GNC_IS_DATE_FORMAT(gdf));
@@ -290,7 +255,7 @@ gnc_date_format_set_format (GNCDateFormat *gdf, QofDateFormat format)
QofDateFormat
gnc_date_format_get_format (GNCDateFormat *gdf)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
g_return_val_if_fail (gdf, QOF_DATE_FORMAT_LOCALE);
g_return_val_if_fail (GNC_IS_DATE_FORMAT(gdf), QOF_DATE_FORMAT_LOCALE);
@@ -303,7 +268,7 @@ gnc_date_format_get_format (GNCDateFormat *gdf)
void
gnc_date_format_set_months (GNCDateFormat *gdf, GNCDateMonthFormat months)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
GtkWidget *button = NULL;
g_return_if_fail(gdf);
@@ -335,7 +300,7 @@ gnc_date_format_set_months (GNCDateFormat *gdf, GNCDateMonthFormat months)
GNCDateMonthFormat
gnc_date_format_get_months (GNCDateFormat *gdf)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
g_return_val_if_fail(gdf, GNCDATE_MONTH_NUMBER);
g_return_val_if_fail(GNC_IS_DATE_FORMAT(gdf), GNCDATE_MONTH_NUMBER);
@@ -357,7 +322,7 @@ gnc_date_format_get_months (GNCDateFormat *gdf)
void
gnc_date_format_set_years (GNCDateFormat *gdf, gboolean include_century)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
g_return_if_fail(gdf);
g_return_if_fail(GNC_IS_DATE_FORMAT(gdf));
@@ -372,7 +337,7 @@ gnc_date_format_set_years (GNCDateFormat *gdf, gboolean include_century)
gboolean
gnc_date_format_get_years (GNCDateFormat *gdf)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
g_return_val_if_fail(gdf, FALSE);
g_return_val_if_fail(GNC_IS_DATE_FORMAT(gdf), FALSE);
@@ -385,7 +350,7 @@ gnc_date_format_get_years (GNCDateFormat *gdf)
void
gnc_date_format_set_custom (GNCDateFormat *gdf, const char *format)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
g_return_if_fail(gdf);
g_return_if_fail(GNC_IS_DATE_FORMAT(gdf));
@@ -402,7 +367,7 @@ gnc_date_format_set_custom (GNCDateFormat *gdf, const char *format)
const char *
gnc_date_format_get_custom (GNCDateFormat *gdf)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
g_return_val_if_fail(gdf, "");
g_return_val_if_fail(GNC_IS_DATE_FORMAT(gdf), "");
@@ -424,7 +389,7 @@ gnc_ui_date_format_changed_cb(GtkWidget *unused, gpointer user_data)
static void
gnc_date_format_enable_month (GNCDateFormat *gdf, gboolean sensitive)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
priv = GNC_DATE_FORMAT_GET_PRIVATE(gdf);
gtk_widget_set_sensitive(priv->months_label, sensitive);
@@ -437,7 +402,7 @@ gnc_date_format_enable_month (GNCDateFormat *gdf, gboolean sensitive)
static void
gnc_date_format_enable_year (GNCDateFormat *gdf, gboolean sensitive)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
priv = GNC_DATE_FORMAT_GET_PRIVATE(gdf);
gtk_widget_set_sensitive(priv->years_label, sensitive);
@@ -448,7 +413,7 @@ gnc_date_format_enable_year (GNCDateFormat *gdf, gboolean sensitive)
static void
gnc_date_format_enable_format (GNCDateFormat *gdf, gboolean sensitive)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
priv = GNC_DATE_FORMAT_GET_PRIVATE(gdf);
gtk_widget_set_sensitive(priv->custom_label, sensitive);
@@ -459,7 +424,7 @@ gnc_date_format_enable_format (GNCDateFormat *gdf, gboolean sensitive)
void
gnc_date_format_refresh (GNCDateFormat *gdf)
{
- GNCDateFormatPriv *priv;
+ GNCDateFormatPrivate *priv;
int sel_option;
gboolean enable_year, enable_month, enable_custom, check_modifiers;
static gchar *format, *c;
commit d63a6e2ea93a22f8eb1b93413679ce91f864d36c
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 11:06:14 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_currency_edit_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-utils/gnc-currency-edit.c b/gnucash/gnome-utils/gnc-currency-edit.c
index f956d1fb5..4a088db19 100644
--- a/gnucash/gnome-utils/gnc-currency-edit.c
+++ b/gnucash/gnome-utils/gnc-currency-edit.c
@@ -96,37 +96,6 @@ typedef struct _GNCCurrencyEditPrivate
/** @name Basic Object Implementation */
/** @{ */
-/* Return the GType for the GNCCurrencyEdit currency selection widget.
- */
-GType
-gnc_currency_edit_get_type (void)
-{
- static GType currency_edit_type = 0;
-
- if (currency_edit_type == 0)
- {
- static const GTypeInfo currency_edit_info =
- {
- sizeof (GNCCurrencyEditClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_currency_edit_class_init,
- NULL,
- NULL,
- sizeof (GNCCurrencyEdit),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_currency_edit_init,
- NULL
- };
-
- currency_edit_type = g_type_register_static (GTK_TYPE_COMBO_BOX,
- "GNCCurrencyEdit",
- ¤cy_edit_info, 0);
- }
-
- return currency_edit_type;
-}
-
enum
{
PROP_0,
@@ -185,7 +154,7 @@ gnc_currency_edit_get_property (GObject *object,
}
-
+G_DEFINE_TYPE_WITH_PRIVATE(GNCCurrencyEdit, gnc_currency_edit, GTK_TYPE_COMBO_BOX)
/** Initialize the GncCurrencyEdit class object.
*
@@ -199,8 +168,6 @@ gnc_currency_edit_class_init (GNCCurrencyEditClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
- g_type_class_add_private(klass, sizeof(GNCCurrencyEditPrivate));
-
gobject_class->set_property = gnc_currency_edit_set_property;
gobject_class->get_property = gnc_currency_edit_get_property;
gobject_class->finalize = gnc_currency_edit_finalize;
commit 71272548fbd03cb2456fac6a5097ec46df6026f0
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 11:04:17 2018 +0100
use G_DEFINE_TYPE_WITH_CODE to replace g_type_class_add_private
gnc_main_window_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
use GNC_DEFINE_TYPE_WITH_CODE to preserve 2nd init parameter
diff --git a/gnucash/gnome-utils/gnc-main-window.c b/gnucash/gnome-utils/gnc-main-window.c
index 921e1b680..314516604 100644
--- a/gnucash/gnome-utils/gnc-main-window.c
+++ b/gnucash/gnome-utils/gnc-main-window.c
@@ -129,7 +129,8 @@ static guint secs_to_save = 0;
/* Declarations *********************************************************/
static void gnc_main_window_class_init (GncMainWindowClass *klass);
-static void gnc_main_window_init (GncMainWindow *window, GncMainWindowClass *klass);
+static void gnc_main_window_init (GncMainWindow *window,
+ void *data);
static void gnc_main_window_finalize (GObject *object);
static void gnc_main_window_destroy (GtkWidget *widget);
@@ -233,6 +234,11 @@ typedef struct GncMainWindowPrivate
GHashTable *merged_actions_table;
} GncMainWindowPrivate;
+GNC_DEFINE_TYPE_WITH_CODE(GncMainWindow, gnc_main_window, GTK_TYPE_WINDOW,
+ G_ADD_PRIVATE (GncMainWindow)
+ G_IMPLEMENT_INTERFACE (GNC_TYPE_WINDOW,
+ gnc_window_main_window_init))
+
#define GNC_MAIN_WINDOW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_MAIN_WINDOW, GncMainWindowPrivate))
@@ -2461,45 +2467,6 @@ gnc_main_window_tab_entry_key_press_event (GtkWidget *entry,
* Widget Implementation *
************************************************************/
-/* Get the type of a gnc main window.
- */
-GType
-gnc_main_window_get_type (void)
-{
- static GType gnc_main_window_type = 0;
-
- if (gnc_main_window_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncMainWindowClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_main_window_class_init,
- NULL,
- NULL,
- sizeof (GncMainWindow),
- 0,
- (GInstanceInitFunc) gnc_main_window_init
- };
-
- static const GInterfaceInfo plugin_info =
- {
- (GInterfaceInitFunc) gnc_window_main_window_init,
- NULL,
- NULL
- };
-
- gnc_main_window_type = g_type_register_static (GTK_TYPE_WINDOW,
- GNC_MAIN_WINDOW_NAME,
- &our_info, 0);
- g_type_add_interface_static (gnc_main_window_type,
- GNC_TYPE_WINDOW,
- &plugin_info);
- }
-
- return gnc_main_window_type;
-}
/** Initialize the class for a new gnucash main window. This will set
@@ -2524,8 +2491,6 @@ gnc_main_window_class_init (GncMainWindowClass *klass)
/* GtkWidget signals */
gtkwidget_class->destroy = gnc_main_window_destroy;
- g_type_class_add_private(klass, sizeof(GncMainWindowPrivate));
-
/**
* GncMainWindow::page_added:
* @param window: the #GncMainWindow
@@ -2593,11 +2558,12 @@ gnc_main_window_class_init (GncMainWindowClass *klass)
* @param klass A pointer to the class data structure for this
* object. */
static void
-gnc_main_window_init (GncMainWindow *window,
- GncMainWindowClass *klass)
+gnc_main_window_init (GncMainWindow *window, void *data)
{
GncMainWindowPrivate *priv;
+ GncMainWindowClass *klass = (GncMainWindowClass*)data;
+
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
priv->merged_actions_table =
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@@ -2619,7 +2585,7 @@ gnc_main_window_init (GncMainWindow *window,
gnc_main_window_setup_window (window);
gnc_gobject_tracking_remember(G_OBJECT(window),
- G_OBJECT_CLASS(klass));
+ G_OBJECT_CLASS(klass));
}
commit 01de89383bc60b9e22829e3d5588a092fbd7d7fb
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 10:58:59 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_embedded_window_get_type is being replaced by
that provided by G_DEFINE_TYPE_WITH_PRIVATE and G_ADD_PRIVATE.
Replace g_type_add_interface_static by G_IMPLEMENT_INTERFACE.
diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c
index 2d0c5149e..98b517e81 100644
--- a/gnucash/gnome-utils/gnc-embedded-window.c
+++ b/gnucash/gnome-utils/gnc-embedded-window.c
@@ -90,48 +90,6 @@ typedef struct GncEmbeddedWindowPrivate
#define GNC_EMBEDDED_WINDOW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_EMBEDDED_WINDOW, GncEmbeddedWindowPrivate))
-
-
-/* Get the type of a gnc embedded window. */
-GType
-gnc_embedded_window_get_type (void)
-{
- static GType gnc_embedded_window_type = 0;
-
- if (gnc_embedded_window_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncEmbeddedWindowClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_embedded_window_class_init,
- NULL,
- NULL,
- sizeof (GncEmbeddedWindow),
- 0,
- (GInstanceInitFunc) gnc_embedded_window_init
- };
-
- static const GInterfaceInfo plugin_info =
- {
- (GInterfaceInitFunc) gnc_window_embedded_window_init,
- NULL,
- NULL
- };
-
- gnc_embedded_window_type = g_type_register_static (GTK_TYPE_BOX,
- "GncEmbeddedWindow",
- &our_info, 0);
- g_type_add_interface_static (gnc_embedded_window_type,
- GNC_TYPE_WINDOW,
- &plugin_info);
- }
-
- return gnc_embedded_window_type;
-}
-
-
/* Display a data plugin page in a window. */
void
gnc_embedded_window_open_page (GncEmbeddedWindow *window,
@@ -200,6 +158,10 @@ gnc_embedded_window_get_page (GncEmbeddedWindow *window)
return priv->page;
}
+G_DEFINE_TYPE_WITH_CODE(GncEmbeddedWindow, gnc_embedded_window, GTK_TYPE_BOX,
+ G_ADD_PRIVATE(GncEmbeddedWindow)
+ G_IMPLEMENT_INTERFACE(GNC_TYPE_WINDOW,
+ gnc_window_embedded_window_init))
/** Initialize the class for a new gnucash embedded window. This will
* set up any function pointers that override functions in the parent
@@ -218,8 +180,7 @@ gnc_embedded_window_class_init (GncEmbeddedWindowClass *klass)
object_class->finalize = gnc_embedded_window_finalize;
object_class->dispose = gnc_embedded_window_dispose;
-
- g_type_class_add_private(klass, sizeof(GncEmbeddedWindowPrivate));
+
LEAVE(" ");
}
commit e841a00a2148e5b4b087d95f747cb84c23cfcf9a
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 10:43:32 2018 +0100
use GNC_DEFINE_TYPE_WITH_CODE to replace g_type_class_add_private
gnc_tree_view_get_type is being replaced by that provided by GNC_DEFINE_TYPE_WITH_CODE.
GNC_DEFINE_TYPE_WITH_CODE preserves 2nd init parameter.
diff --git a/gnucash/gnome-utils/gnc-tree-view.c b/gnucash/gnome-utils/gnc-tree-view.c
index de8a0f66f..e1aa9ef46 100644
--- a/gnucash/gnome-utils/gnc-tree-view.c
+++ b/gnucash/gnome-utils/gnc-tree-view.c
@@ -77,7 +77,8 @@ static QofLogModule log_module = GNC_MOD_GUI;
/**** Declarations ******************************************************/
static void gnc_tree_view_class_init (GncTreeViewClass *klass);
-static void gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass);
+static void gnc_tree_view_init (GncTreeView *view,
+ void *data);
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,
@@ -130,6 +131,9 @@ typedef struct GncTreeViewPrivate
gulong size_allocate_cb_id;
} GncTreeViewPrivate;
+GNC_DEFINE_TYPE_WITH_CODE(GncTreeView, gnc_tree_view, GTK_TYPE_TREE_VIEW,
+ G_ADD_PRIVATE(GncTreeView))
+
#define GNC_TREE_VIEW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_TREE_VIEW, GncTreeViewPrivate))
@@ -143,40 +147,6 @@ typedef struct GncTreeViewPrivate
static GObjectClass *parent_class = NULL;
-/** Create a new glib type for the base gnucash tree view.
- *
- * @internal
- *
- * @return The new type value.
- */
-GType
-gnc_tree_view_get_type (void)
-{
- static GType gnc_tree_view_type = 0;
-
- if (gnc_tree_view_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeViewClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_view_class_init,
- NULL,
- NULL,
- sizeof (GncTreeView),
- 0,
- (GInstanceInitFunc) gnc_tree_view_init
- };
-
- gnc_tree_view_type = g_type_register_static (GTK_TYPE_TREE_VIEW,
- GNC_TREE_VIEW_NAME,
- &our_info, 0);
- }
-
- return gnc_tree_view_type;
-}
-
/** Initialize the class for the new base gnucash tree view. This
* will set up any function pointers that override functions in the
* parent class, and also installs the properties that are unique to
@@ -200,8 +170,6 @@ gnc_tree_view_class_init (GncTreeViewClass *klass)
gobject_class->set_property = gnc_tree_view_set_property;
gobject_class->get_property = gnc_tree_view_get_property;
- g_type_class_add_private(klass, sizeof(GncTreeViewPrivate));
-
g_object_class_install_property (gobject_class,
PROP_STATE_SECTION,
g_param_spec_string ("state-section",
@@ -241,14 +209,17 @@ gnc_tree_view_update_grid_lines (gpointer prefs, gchar* pref, gpointer user_data
* @internal
*/
static void
-gnc_tree_view_init (GncTreeView *view, GncTreeViewClass *klass)
+gnc_tree_view_init (GncTreeView *view, void *data)
{
GncTreeViewPrivate *priv;
GtkTreeViewColumn *column;
GtkWidget *icon;
GtkRequisition requisition;
- gnc_gobject_tracking_remember(G_OBJECT(view), G_OBJECT_CLASS(klass));
+ 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;
commit 114142766f9d0de2dcce224be02b5076e99b6188
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 10:32:25 2018 +0100
revert 630f5ba2a693d0a6a9b3ebced645dfd4c5046c98
Error about conflicting types for âgnc_plugin_page_initâ.
diff --git a/gnucash/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c
index 7857d57c6..8d5529cf5 100644
--- a/gnucash/gnome-utils/gnc-plugin-page.c
+++ b/gnucash/gnome-utils/gnc-plugin-page.c
@@ -107,6 +107,36 @@ typedef struct _GncPluginPagePrivate
#define GNC_PLUGIN_PAGE_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE, GncPluginPagePrivate))
+GType
+gnc_plugin_page_get_type (void)
+{
+ static GType gnc_plugin_page_type = 0;
+
+ if (gnc_plugin_page_type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+
+ sizeof (GncPluginPageClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) gnc_plugin_page_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GncPluginPage),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gnc_plugin_page_init,
+ };
+
+ gnc_plugin_page_type = g_type_register_static (G_TYPE_OBJECT,
+ "GncPluginPage",
+ &our_info, 0);
+ }
+
+ return gnc_plugin_page_type;
+}
+
+
/* Create the display widget that corresponds to this plugin. This
* function will be called by the main/embedded window manipulation
* code to create a widget that they can display. The returned
@@ -349,7 +379,6 @@ gnc_plugin_page_unselected (GncPluginPage *plugin_page)
g_signal_emit (G_OBJECT (plugin_page), signals[UNSELECTED], 0);
}
-G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT)
/** Initialize the class for a new generic plugin page. This will set
* up any function pointers that override functions in the parent
@@ -371,6 +400,8 @@ gnc_plugin_page_class_init (GncPluginPageClass *klass)
klass->tab_icon = NULL;
klass->plugin_name = NULL;
+ g_type_class_add_private(klass, sizeof(GncPluginPagePrivate));
+
g_object_class_install_property
(gobject_class,
PROP_PAGE_NAME,
commit 30151dc4fe9d3f9b8108536181327c5d743c5e41
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 10:32:03 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_page_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c
index 8d5529cf5..7857d57c6 100644
--- a/gnucash/gnome-utils/gnc-plugin-page.c
+++ b/gnucash/gnome-utils/gnc-plugin-page.c
@@ -107,36 +107,6 @@ typedef struct _GncPluginPagePrivate
#define GNC_PLUGIN_PAGE_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE, GncPluginPagePrivate))
-GType
-gnc_plugin_page_get_type (void)
-{
- static GType gnc_plugin_page_type = 0;
-
- if (gnc_plugin_page_type == 0)
- {
- static const GTypeInfo our_info =
- {
-
- sizeof (GncPluginPageClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_page_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginPage),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_page_init,
- };
-
- gnc_plugin_page_type = g_type_register_static (G_TYPE_OBJECT,
- "GncPluginPage",
- &our_info, 0);
- }
-
- return gnc_plugin_page_type;
-}
-
-
/* Create the display widget that corresponds to this plugin. This
* function will be called by the main/embedded window manipulation
* code to create a widget that they can display. The returned
@@ -379,6 +349,7 @@ gnc_plugin_page_unselected (GncPluginPage *plugin_page)
g_signal_emit (G_OBJECT (plugin_page), signals[UNSELECTED], 0);
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPage, gnc_plugin_page, G_TYPE_OBJECT)
/** Initialize the class for a new generic plugin page. This will set
* up any function pointers that override functions in the parent
@@ -400,8 +371,6 @@ gnc_plugin_page_class_init (GncPluginPageClass *klass)
klass->tab_icon = NULL;
klass->plugin_name = NULL;
- g_type_class_add_private(klass, sizeof(GncPluginPagePrivate));
-
g_object_class_install_property
(gobject_class,
PROP_PAGE_NAME,
commit 8356c58ed620cae4e021fef712b2d2e8e09df113
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 10:23:39 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private(rename)
..._get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
rename gctt to gnc_combott to fit naming standard
diff --git a/gnucash/gnome-utils/gnc-combott.c b/gnucash/gnome-utils/gnc-combott.c
index 995e2480f..9f2af1ce4 100644
--- a/gnucash/gnome-utils/gnc-combott.c
+++ b/gnucash/gnome-utils/gnc-combott.c
@@ -76,34 +76,34 @@ typedef struct GncCombottPrivate
} GncCombottPrivate;
/** Declarations *********************************************************/
-static void gctt_init (GncCombott *combott);
+static void gnc_combott_init (GncCombott *combott);
-static void gctt_class_init (GncCombottClass *klass);
+static void gnc_combott_class_init (GncCombottClass *klass);
-static void gctt_set_property (GObject *object,
+static void gnc_combott_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec);
-static void gctt_get_property (GObject *object,
+static void gnc_combott_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec);
-static void gctt_finalize (GObject *object);
+static void gnc_combott_finalize (GObject *object);
#if !GTK_CHECK_VERSION(3,22,0)
-static void gctt_combott_menu_position (GtkMenu *menu,
+static void gnc_combott_menu_position (GtkMenu *menu,
gint *x,
gint *y,
gint *push_in,
gpointer user_data);
#endif
-static void gctt_changed (GncCombott *combott);
-static void gctt_set_model (GncCombott *combott, GtkTreeModel *model);
-static void gctt_refresh_menu (GncCombott *combott, GtkTreeModel *model);
-static void gctt_rebuild_menu (GncCombott *combott, GtkTreeModel *model);
+static void gnc_combott_changed (GncCombott *combott);
+static void gnc_combott_set_model (GncCombott *combott, GtkTreeModel *model);
+static void gnc_combott_refresh_menu (GncCombott *combott, GtkTreeModel *model);
+static void gnc_combott_rebuild_menu (GncCombott *combott, GtkTreeModel *model);
static gboolean which_tooltip_cb (GtkWidget *widget, gint x, gint y,
gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data);
@@ -118,47 +118,21 @@ static void menuitem_response_cb (GtkMenuItem *item, gpointer *user_data);
/************************************************************/
static GObjectClass *parent_class = NULL;
-GType
-gnc_combott_get_type (void)
-{
- static GType combott_type = 0;
-
- if (!combott_type)
- {
- static const GTypeInfo combott_info =
- {
- sizeof (GncCombottClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gctt_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncCombott),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gctt_init,
- };
-
- combott_type = g_type_register_static (GTK_TYPE_BOX,
- "GncCombott",
- &combott_info, 0);
- }
- return combott_type;
-}
-
+G_DEFINE_TYPE_WITH_PRIVATE(GncCombott, gnc_combott, GTK_TYPE_BOX)
static void
-gctt_class_init (GncCombottClass *klass)
+gnc_combott_class_init (GncCombottClass *klass)
{
GObjectClass *gobject_class;
parent_class = g_type_class_peek_parent (klass);
gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->set_property = gctt_set_property;
- gobject_class->get_property = gctt_get_property;
- gobject_class->finalize = gctt_finalize;
+ gobject_class->set_property = gnc_combott_set_property;
+ gobject_class->get_property = gnc_combott_get_property;
+ gobject_class->finalize = gnc_combott_finalize;
- klass->changed = gctt_changed;
+ klass->changed = gnc_combott_changed;
combott_signals[CHANGED] =
g_signal_new ("changed",
@@ -199,13 +173,11 @@ gctt_class_init (GncCombottClass *klass)
G_MAXINT,
1,
G_PARAM_READWRITE));
-
- g_type_class_add_private(klass, sizeof(GncCombottPrivate));
}
static void
-gctt_init (GncCombott *combott)
+gnc_combott_init (GncCombott *combott)
{
GtkWidget *hbox;
GtkWidget *label;
@@ -268,7 +240,7 @@ gctt_init (GncCombott *combott)
static void
-gctt_set_property (GObject *object,
+gnc_combott_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec)
@@ -279,7 +251,7 @@ gctt_set_property (GObject *object,
switch (param_id)
{
case PROP_MODEL:
- gctt_set_model (combott, g_value_get_object (value));
+ gnc_combott_set_model (combott, g_value_get_object (value));
break;
case PROP_ACTIVE:
@@ -292,7 +264,7 @@ gctt_set_property (GObject *object,
case PROP_TIP_COL:
priv->tip_col = g_value_get_int (value);
- gctt_refresh_menu(combott, priv->model);
+ gnc_combott_refresh_menu(combott, priv->model);
break;
default:
@@ -308,7 +280,7 @@ gctt_set_property (GObject *object,
* ref the object when used in get_property().
*/
static void
-gctt_get_property (GObject *object,
+gnc_combott_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec)
@@ -342,7 +314,7 @@ gctt_get_property (GObject *object,
static void
-gctt_finalize (GObject *object)
+gnc_combott_finalize (GObject *object)
{
GncCombott *combott;
GncCombottPrivate *priv;
@@ -368,7 +340,7 @@ gctt_finalize (GObject *object)
static void
-gctt_set_model (GncCombott *combott, GtkTreeModel *model)
+gnc_combott_set_model (GncCombott *combott, GtkTreeModel *model)
{
GncCombottPrivate *priv;
@@ -377,7 +349,7 @@ gctt_set_model (GncCombott *combott, GtkTreeModel *model)
priv = GNC_COMBOTT_GET_PRIVATE (combott);
- gctt_rebuild_menu(combott, model);
+ gnc_combott_rebuild_menu(combott, model);
priv->model = model;
g_object_ref (priv->model);
@@ -385,7 +357,7 @@ gctt_set_model (GncCombott *combott, GtkTreeModel *model)
static void
-gctt_rebuild_menu (GncCombott *combott, GtkTreeModel *model)
+gnc_combott_rebuild_menu (GncCombott *combott, GtkTreeModel *model)
{
GncCombottPrivate *priv;
GtkTreeIter iter;
@@ -454,17 +426,17 @@ gctt_rebuild_menu (GncCombott *combott, GtkTreeModel *model)
static void
-gctt_refresh_menu (GncCombott *combott, GtkTreeModel *model)
+gnc_combott_refresh_menu (GncCombott *combott, GtkTreeModel *model)
{
g_return_if_fail (GNC_IS_COMBOTT (combott));
g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model));
- gctt_rebuild_menu(combott, model);
+ gnc_combott_rebuild_menu(combott, model);
}
static void
-gctt_changed(GncCombott *combott)
+gnc_combott_changed(GncCombott *combott)
{
/*
g_print("Changed Signal\n");
@@ -474,7 +446,7 @@ gctt_changed(GncCombott *combott)
#if !GTK_CHECK_VERSION(3,22,0)
static void
-gctt_combott_menu_position (GtkMenu *menu,
+gnc_combott_menu_position (GtkMenu *menu,
gint *x,
gint *y,
gint *push_in,
@@ -599,7 +571,7 @@ button_press_cb (GtkWidget *widget, GdkEvent *event, gpointer *user_data )
#else
gtk_menu_popup (GTK_MENU (priv->menu),
NULL, NULL,
- gctt_combott_menu_position, combott,
+ gnc_combott_menu_position, combott,
bevent->button, bevent->time);
#endif
commit 2c73010b8fda1a8c0e4ea41cd5af09f4216ac13b
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 00:59:25 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_model_account_types_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_CODE
and G_ADD_PRIVATE. Replace g_type_add_interface_static by G_IMPLEMENT_INTERFACE.
diff --git a/gnucash/gnome-utils/gnc-tree-model-account-types.c b/gnucash/gnome-utils/gnc-tree-model-account-types.c
index e76c0f8d2..beca1b54a 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account-types.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account-types.c
@@ -61,44 +61,10 @@ typedef struct GncTreeModelAccountTypesPrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_model_account_types_get_type (void)
-{
- static GType gnc_tree_model_account_types_type = 0;
-
- if (gnc_tree_model_account_types_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeModelAccountTypesClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_model_account_types_class_init,
- NULL,
- NULL,
- sizeof (GncTreeModelAccountTypes),
- 0,
- (GInstanceInitFunc) gnc_tree_model_account_types_init
- };
-
- static const GInterfaceInfo tree_model_info =
- {
- (GInterfaceInitFunc) gnc_tree_model_account_types_tree_model_init,
- NULL,
- NULL
- };
-
- gnc_tree_model_account_types_type =
- g_type_register_static (G_TYPE_OBJECT,
- "GncTreeModelAccountTypes",
- &our_info, 0);
-
- g_type_add_interface_static (gnc_tree_model_account_types_type,
- GTK_TYPE_TREE_MODEL, &tree_model_info);
- }
-
- return gnc_tree_model_account_types_type;
-}
+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))
static void
gnc_tree_model_account_types_class_init (GncTreeModelAccountTypesClass * klass)
@@ -108,8 +74,6 @@ gnc_tree_model_account_types_class_init (GncTreeModelAccountTypesClass * klass)
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gnc_tree_model_account_types_finalize;
-
- g_type_class_add_private(klass, sizeof(GncTreeModelAccountTypesPrivate));
}
static void
commit 409f576a5492da84a89d811457ec0bae33caeb4a
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 00:56:54 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_model_price_get_type is being replaced by
that provided by G_DEFINE_TYPE_WITH_PRIVATE and G_ADD_PRIVATE.
Replace g_type_add_interface_static by G_IMPLEMENT_INTERFACE.
diff --git a/gnucash/gnome-utils/gnc-tree-model-price.c b/gnucash/gnome-utils/gnc-tree-model-price.c
index 3656ec0cc..eaf24e897 100644
--- a/gnucash/gnome-utils/gnc-tree-model-price.c
+++ b/gnucash/gnome-utils/gnc-tree-model-price.c
@@ -137,44 +137,10 @@ typedef struct GncTreeModelPricePrivate
/** A pointer to the parent class of a price tree model. */
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_model_price_get_type (void)
-{
- static GType gnc_tree_model_price_type = 0;
-
- if (gnc_tree_model_price_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeModelPriceClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_model_price_class_init,
- NULL,
- NULL,
- sizeof (GncTreeModelPrice),
- 0,
- (GInstanceInitFunc) gnc_tree_model_price_init
- };
-
- static const GInterfaceInfo tree_model_info =
- {
- (GInterfaceInitFunc) gnc_tree_model_price_tree_model_init,
- NULL,
- NULL
- };
-
- gnc_tree_model_price_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
- GNC_TREE_MODEL_PRICE_NAME,
- &our_info, 0);
-
- g_type_add_interface_static (gnc_tree_model_price_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- }
-
- return gnc_tree_model_price_type;
-}
+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))
static void
gnc_tree_model_price_class_init (GncTreeModelPriceClass *klass)
@@ -185,8 +151,6 @@ gnc_tree_model_price_class_init (GncTreeModelPriceClass *klass)
o_class->finalize = gnc_tree_model_price_finalize;
o_class->dispose = gnc_tree_model_price_dispose;
-
- g_type_class_add_private(klass, sizeof(GncTreeModelPricePrivate));
}
static void
commit 796f38cfbdab3b07caf2afedb0756fae698ed849
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 00:52:10 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_period_select_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-utils/gnc-period-select.c b/gnucash/gnome-utils/gnc-period-select.c
index c5b514d99..fe27a54f5 100644
--- a/gnucash/gnome-utils/gnc-period-select.c
+++ b/gnucash/gnome-utils/gnc-period-select.c
@@ -502,38 +502,6 @@ gnc_period_select_set_property (GObject *object,
/** @name GncPeriodSelect Core Implementation
@{ */
-/* Returns the GType of a GncPeriodSelect widget.
- */
-GType
-gnc_period_select_get_type (void)
-{
- static GType period_select_type = 0;
-
- if (period_select_type == 0)
- {
- static const GTypeInfo period_select_info =
- {
- sizeof (GncPeriodSelectClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_period_select_class_init,
- NULL,
- NULL,
- sizeof (GncPeriodSelect),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_period_select_init,
- NULL
- };
-
- period_select_type = g_type_register_static(GTK_TYPE_BOX,
- "GncPeriodSelect",
- &period_select_info, 0);
- }
-
- return period_select_type;
-}
-
-
/** Initialize the class for the a Period Selection widget. This
* will set up any function pointers that override functions in the
* parent class, and also installs the proprieties that are unique to
@@ -594,10 +562,9 @@ gnc_period_select_class_init (GncPeriodSelectClass *klass)
G_MAXINT,
0,
G_PARAM_READWRITE));
-
- g_type_class_add_private(klass, sizeof(GncPeriodSelectPrivate));
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPeriodSelect, gnc_period_select, GTK_TYPE_BOX)
/** Initialize a new instance of a gnucash accounting period selection
* widget. This function allocates and initializes the object
commit a7e5ac8392b66268d805622ec496fe2feac96afe
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 00:51:06 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_view_split_reg_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-utils/gnc-tree-view-split-reg.c b/gnucash/gnome-utils/gnc-tree-view-split-reg.c
index bd89fb9ec..5ffd22b0d 100644
--- a/gnucash/gnome-utils/gnc-tree-view-split-reg.c
+++ b/gnucash/gnome-utils/gnc-tree-view-split-reg.c
@@ -305,33 +305,7 @@ struct GncTreeViewSplitRegPrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_view_split_reg_get_type(void)
-{
- static GType gnc_tree_view_split_reg_type = 0;
-
- if (gnc_tree_view_split_reg_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeViewSplitRegClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_view_split_reg_class_init,
- NULL,
- NULL,
- sizeof (GncTreeViewSplitReg),
- 0,
- (GInstanceInitFunc) gnc_tree_view_split_reg_init
- };
-
- gnc_tree_view_split_reg_type = g_type_register_static (GNC_TYPE_TREE_VIEW,
- "GncTreeViewSplitReg",
- &our_info, 0);
- }
- return gnc_tree_view_split_reg_type;
-}
-
+G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewSplitReg, gnc_tree_view_split_reg, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_split_reg_class_init (GncTreeViewSplitRegClass *klass)
@@ -345,8 +319,6 @@ gnc_tree_view_split_reg_class_init (GncTreeViewSplitRegClass *klass)
o_class->dispose = gnc_tree_view_split_reg_dispose;
o_class->finalize = gnc_tree_view_split_reg_finalize;
- g_type_class_add_private (klass, sizeof(GncTreeViewSplitRegPrivate));
-
gnc_tree_view_split_reg_signals[UPDATE_SIGNAL] =
g_signal_new("update_signal",
G_TYPE_FROM_CLASS (o_class),
commit b0fc0789125e9973d56de8deb809d6da4ec11ec2
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 00:44:27 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_model_owner_get_type is being replaced by
that provided by G_DEFINE_TYPE_WITH_PRIVATE and G_ADD_PRIVATE.
Replace g_type_add_interface_static by G_IMPLEMENT_INTERFACE.
diff --git a/gnucash/gnome-utils/gnc-tree-model-commodity.c b/gnucash/gnome-utils/gnc-tree-model-commodity.c
index 03f836d98..ebd0acd0a 100644
--- a/gnucash/gnome-utils/gnc-tree-model-commodity.c
+++ b/gnucash/gnome-utils/gnc-tree-model-commodity.c
@@ -106,44 +106,10 @@ typedef struct GncTreeModelCommodityPrivate
/** A pointer to the parent class of a commodity tree model. */
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_model_commodity_get_type (void)
-{
- static GType gnc_tree_model_commodity_type = 0;
-
- if (gnc_tree_model_commodity_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeModelCommodityClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_model_commodity_class_init,
- NULL,
- NULL,
- sizeof (GncTreeModelCommodity),
- 0,
- (GInstanceInitFunc) gnc_tree_model_commodity_init
- };
-
- static const GInterfaceInfo tree_model_info =
- {
- (GInterfaceInitFunc) gnc_tree_model_commodity_tree_model_init,
- NULL,
- NULL
- };
-
- gnc_tree_model_commodity_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
- GNC_TREE_MODEL_COMMODITY_NAME,
- &our_info, 0);
-
- g_type_add_interface_static (gnc_tree_model_commodity_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- }
-
- return gnc_tree_model_commodity_type;
-}
+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))
static void
gnc_tree_model_commodity_class_init (GncTreeModelCommodityClass *klass)
@@ -154,8 +120,6 @@ gnc_tree_model_commodity_class_init (GncTreeModelCommodityClass *klass)
o_class->finalize = gnc_tree_model_commodity_finalize;
o_class->dispose = gnc_tree_model_commodity_dispose;
-
- g_type_class_add_private(klass, sizeof(GncTreeModelCommodityPrivate));
}
static void
commit 3fc6ff1f61d23a4e9b2f5aaf4fdc7d971e221379
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Fri Dec 7 00:31:48 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_query_view_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-utils/gnc-query-view.c b/gnucash/gnome-utils/gnc-query-view.c
index 8830aa307..594fc866f 100644
--- a/gnucash/gnome-utils/gnc-query-view.c
+++ b/gnucash/gnome-utils/gnc-query-view.c
@@ -44,16 +44,16 @@ enum
LAST_SIGNAL
};
-typedef struct _GNCQueryViewPriv GNCQueryViewPriv;
+typedef struct _GNCQueryViewPrivate GNCQueryViewPrivate;
-struct _GNCQueryViewPriv
+struct _GNCQueryViewPrivate
{
const QofParam *get_guid;
gint component_id;
};
#define GNC_QUERY_VIEW_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_QUERY_VIEW, GNCQueryViewPriv))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_QUERY_VIEW, GNCQueryViewPrivate))
/** Static Globals ****************************************************/
static GtkTreeViewClass *parent_class = NULL;
@@ -76,34 +76,6 @@ static void gnc_query_view_fill (GNCQueryView *qview);
static void gnc_query_view_set_query_sort (GNCQueryView *qview, gboolean new_column);
-GType
-gnc_query_view_get_type (void)
-{
- static GType gnc_query_view_type = 0;
-
- if (!gnc_query_view_type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCQueryViewClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_query_view_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GNCQueryView), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_query_view_init,
- };
-
- gnc_query_view_type = g_type_register_static (GTK_TYPE_TREE_VIEW,
- "GNCQueryView",
- &type_info, 0);
- }
- return gnc_query_view_type;
-}
-
-
/********************************************************************\
* gnc_query_view_new *
* creates the query view *
@@ -115,7 +87,7 @@ gnc_query_view_get_type (void)
void
gnc_query_view_construct (GNCQueryView *qview, GList *param_list, Query *query)
{
- GNCQueryViewPriv *priv;
+ GNCQueryViewPrivate *priv;
g_return_if_fail (qview);
g_return_if_fail (param_list);
@@ -212,11 +184,12 @@ gnc_query_view_refresh_handler (GHashTable *changes, gpointer user_data)
gnc_query_view_set_query_sort (qview, TRUE);
}
+G_DEFINE_TYPE_WITH_PRIVATE(GNCQueryView, gnc_query_view, GTK_TYPE_TREE_VIEW)
static void
gnc_query_view_init (GNCQueryView *qview)
{
- GNCQueryViewPriv *priv;
+ GNCQueryViewPrivate *priv;
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(qview), "GncQueryView");
@@ -428,8 +401,6 @@ gnc_query_view_class_init (GNCQueryViewClass *klass)
parent_class = g_type_class_peek (GTK_TYPE_TREE_VIEW);
- g_type_class_add_private (klass, sizeof(GNCQueryViewPriv));
-
query_view_signals[COLUMN_TOGGLED] =
g_signal_new("column_toggled",
G_TYPE_FROM_CLASS (widget_class),
@@ -543,7 +514,7 @@ static void
gnc_query_view_destroy (GtkWidget *widget)
{
GNCQueryView *qview = GNC_QUERY_VIEW (widget);
- GNCQueryViewPriv *priv;
+ GNCQueryViewPrivate *priv;
priv = GNC_QUERY_VIEW_GET_PRIVATE (qview);
if (priv->component_id > 0)
@@ -765,7 +736,7 @@ gnc_query_view_set_query_sort (GNCQueryView *qview, gboolean new_column)
static void
gnc_query_view_fill (GNCQueryView *qview)
{
- GNCQueryViewPriv *priv;
+ GNCQueryViewPrivate *priv;
GtkTreeModel *model;
GtkTreeIter iter;
GList *entries, *item;
commit 83e59419da461ed798c127e9870e5f35bd4ddac5
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:29:14 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_page_sx_list_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome/gnc-plugin-page-sx-list.c b/gnucash/gnome/gnc-plugin-page-sx-list.c
index d480d4007..ec4851dd2 100644
--- a/gnucash/gnome/gnc-plugin-page-sx-list.c
+++ b/gnucash/gnome/gnc-plugin-page-sx-list.c
@@ -164,36 +164,6 @@ static GtkActionEntry gnc_plugin_page_sx_list_actions [] =
/** The number of actions provided by this plugin. */
static guint gnc_plugin_page_sx_list_n_actions = G_N_ELEMENTS (gnc_plugin_page_sx_list_actions);
-
-GType
-gnc_plugin_page_sx_list_get_type (void)
-{
- static GType gnc_plugin_page_sx_list_type = 0;
-
- if (gnc_plugin_page_sx_list_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginPageSxListClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_plugin_page_sx_list_class_init,
- NULL,
- NULL,
- sizeof (GncPluginPageSxList),
- 0,
- (GInstanceInitFunc) gnc_plugin_page_sx_list_init
- };
-
- gnc_plugin_page_sx_list_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
- GNC_PLUGIN_PAGE_SX_LIST_NAME,
- &our_info, 0);
- }
-
- return gnc_plugin_page_sx_list_type;
-}
-
-
GncPluginPage *
gnc_plugin_page_sx_list_new (void)
{
@@ -252,6 +222,7 @@ gnc_plugin_page_sx_list_main_window_page_changed (GncMainWindow *window,
}
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPageSxList, gnc_plugin_page_sx_list, GNC_TYPE_PLUGIN_PAGE)
static void
gnc_plugin_page_sx_list_class_init (GncPluginPageSxListClass *klass)
@@ -270,8 +241,6 @@ gnc_plugin_page_sx_list_class_init (GncPluginPageSxListClass *klass)
gnc_plugin_class->destroy_widget = gnc_plugin_page_sx_list_destroy_widget;
gnc_plugin_class->save_page = gnc_plugin_page_sx_list_save_page;
gnc_plugin_class->recreate_page = gnc_plugin_page_sx_list_recreate_page;
-
- g_type_class_add_private(klass, sizeof(GncPluginPageSxListPrivate));
}
commit bef2c2016a2352aee2793ad1f9a94025bc52f244
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:38:16 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_page_register2_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome/gnc-plugin-page-register2.c b/gnucash/gnome/gnc-plugin-page-register2.c
index a3f6db2fc..91d9736c2 100644
--- a/gnucash/gnome/gnc-plugin-page-register2.c
+++ b/gnucash/gnome/gnc-plugin-page-register2.c
@@ -563,34 +563,6 @@ static GObjectClass *parent_class = NULL;
/* Implementation */
/************************************************************/
-GType
-gnc_plugin_page_register2_get_type (void)
-{
- static GType gnc_plugin_page_register2_type = 0;
-
- if (gnc_plugin_page_register2_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginPageRegister2Class),
- NULL,
- NULL,
- (GClassInitFunc) gnc_plugin_page_register2_class_init,
- NULL,
- NULL,
- sizeof (GncPluginPageRegister2),
- 0,
- (GInstanceInitFunc) gnc_plugin_page_register2_init
- };
-
- gnc_plugin_page_register2_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
- GNC_PLUGIN_PAGE_REGISTER2_NAME,
- &our_info, 0);
- }
-
- return gnc_plugin_page_register2_type;
-}
-
/*#################################################################################*/
/*#################################################################################*/
static GncPluginPage *
@@ -714,6 +686,8 @@ gnc_plugin_page_register2_new_ledger (GNCLedgerDisplay2 *ledger)
return gnc_plugin_page_register2_new_common (ledger);
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPageRegister2, gnc_plugin_page_register2, GNC_TYPE_PLUGIN_PAGE)
+
static void
gnc_plugin_page_register2_class_init (GncPluginPageRegister2Class *klass)
{
@@ -734,8 +708,6 @@ gnc_plugin_page_register2_class_init (GncPluginPageRegister2Class *klass)
gnc_plugin_class->update_edit_menu_actions = gnc_plugin_page_register2_update_edit_menu;
gnc_plugin_class->finish_pending = gnc_plugin_page_register2_finish_pending;
- g_type_class_add_private(klass, sizeof(GncPluginPageRegister2Private));
-
gnc_ui_register_account_destroy_callback (gppr_account_destroy_cb);
}
commit 5506973d008614c33b9c3675ca1ad24136aa97ee
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:37:50 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_page_owner_tree_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome/gnc-plugin-page-owner-tree.c b/gnucash/gnome/gnc-plugin-page-owner-tree.c
index 418384223..b58e94039 100644
--- a/gnucash/gnome/gnc-plugin-page-owner-tree.c
+++ b/gnucash/gnome/gnc-plugin-page-owner-tree.c
@@ -310,34 +310,6 @@ static action_owners_struct action_owners[] =
{ NULL, GNC_OWNER_NONE },
};
-GType
-gnc_plugin_page_owner_tree_get_type (void)
-{
- static GType gnc_plugin_page_owner_tree_type = 0;
-
- if (gnc_plugin_page_owner_tree_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginPageOwnerTreeClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_plugin_page_owner_tree_class_init,
- NULL,
- NULL,
- sizeof (GncPluginPageOwnerTree),
- 0,
- (GInstanceInitFunc) gnc_plugin_page_owner_tree_init
- };
-
- gnc_plugin_page_owner_tree_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
- GNC_PLUGIN_PAGE_OWNER_TREE_NAME,
- &our_info, 0);
- }
-
- return gnc_plugin_page_owner_tree_type;
-}
-
GncPluginPage *
gnc_plugin_page_owner_tree_new (GncOwnerType owner_type)
{
@@ -431,6 +403,7 @@ gnc_plugin_page_owner_main_window_page_changed (GncMainWindow *window,
}
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPageOwnerTree, gnc_plugin_page_owner_tree, GNC_TYPE_PLUGIN_PAGE)
static void
gnc_plugin_page_owner_tree_class_init (GncPluginPageOwnerTreeClass *klass)
@@ -449,8 +422,6 @@ gnc_plugin_page_owner_tree_class_init (GncPluginPageOwnerTreeClass *klass)
gnc_plugin_class->save_page = gnc_plugin_page_owner_tree_save_page;
gnc_plugin_class->recreate_page = gnc_plugin_page_owner_tree_recreate_page;
- g_type_class_add_private(klass, sizeof(GncPluginPageOwnerTreePrivate));
-
plugin_page_signals[OWNER_SELECTED] =
g_signal_new ("owner_selected",
G_OBJECT_CLASS_TYPE (object_class),
commit 1a29b81a366c266c2877ff794944aae95c2c6ae6
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:37:23 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_page_account_tree_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome/gnc-plugin-page-account-tree.c b/gnucash/gnome/gnc-plugin-page-account-tree.c
index 41a28cc9e..a4bf13100 100644
--- a/gnucash/gnome/gnc-plugin-page-account-tree.c
+++ b/gnucash/gnome/gnc-plugin-page-account-tree.c
@@ -368,35 +368,6 @@ static action_toolbar_labels toolbar_labels[] =
{ NULL, NULL },
};
-
-GType
-gnc_plugin_page_account_tree_get_type (void)
-{
- static GType gnc_plugin_page_account_tree_type = 0;
-
- if (gnc_plugin_page_account_tree_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginPageAccountTreeClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_plugin_page_account_tree_class_init,
- NULL,
- NULL,
- sizeof (GncPluginPageAccountTree),
- 0,
- (GInstanceInitFunc) gnc_plugin_page_account_tree_init
- };
-
- gnc_plugin_page_account_tree_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
- GNC_PLUGIN_PAGE_ACCOUNT_TREE_NAME,
- &our_info, 0);
- }
-
- return gnc_plugin_page_account_tree_type;
-}
-
GncPluginPage *
gnc_plugin_page_account_tree_new (void)
{
@@ -410,6 +381,8 @@ gnc_plugin_page_account_tree_new (void)
return GNC_PLUGIN_PAGE (plugin_page);
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPageAccountTree, gnc_plugin_page_account_tree, GNC_TYPE_PLUGIN_PAGE)
+
static void
gnc_plugin_page_account_tree_class_init (GncPluginPageAccountTreeClass *klass)
{
@@ -427,8 +400,6 @@ gnc_plugin_page_account_tree_class_init (GncPluginPageAccountTreeClass *klass)
gnc_plugin_class->save_page = gnc_plugin_page_account_tree_save_page;
gnc_plugin_class->recreate_page = gnc_plugin_page_account_tree_recreate_page;
- g_type_class_add_private(klass, sizeof(GncPluginPageAccountTreePrivate));
-
plugin_page_signals[ACCOUNT_SELECTED] =
g_signal_new ("account_selected",
G_OBJECT_CLASS_TYPE (object_class),
commit ce27afb8924c0689235aecc5fe5953e13f5be835
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:36:54 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_business_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome/gnc-plugin-business.c b/gnucash/gnome/gnc-plugin-business.c
index 5efa09ba4..f97506bf0 100644
--- a/gnucash/gnome/gnc-plugin-business.c
+++ b/gnucash/gnome/gnc-plugin-business.c
@@ -344,34 +344,6 @@ typedef struct GncPluginBusinessPrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_plugin_business_get_type (void)
-{
- static GType gnc_plugin_business_type = 0;
-
- if (gnc_plugin_business_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginBusinessClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_business_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginBusiness),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_business_init
- };
-
- gnc_plugin_business_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginBusiness",
- &our_info, 0);
- }
-
- return gnc_plugin_business_type;
-}
-
GncPlugin *
gnc_plugin_business_new (void)
{
@@ -388,6 +360,8 @@ gnc_plugin_business_new (void)
return GNC_PLUGIN (plugin);
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginBusiness, gnc_plugin_business, GNC_TYPE_PLUGIN)
+
static void
gnc_plugin_business_class_init (GncPluginBusinessClass *klass)
{
@@ -409,8 +383,6 @@ gnc_plugin_business_class_init (GncPluginBusinessClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginBusinessPrivate));
}
static void
commit eab5753aa68474ecd0a07acbf936798a5a2e58fe
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:36:23 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_budget_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome/gnc-plugin-budget.c b/gnucash/gnome/gnc-plugin-budget.c
index 5d7aeb591..c1afd95f7 100644
--- a/gnucash/gnome/gnc-plugin-budget.c
+++ b/gnucash/gnome/gnc-plugin-budget.c
@@ -87,33 +87,6 @@ typedef struct GncPluginBudgetPrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_plugin_budget_get_type (void)
-{
- static GType gnc_plugin_budget_type = 0;
-
- if (!gnc_plugin_budget_type)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginBudgetClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_budget_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginBudget),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_budget_init
- };
-
- gnc_plugin_budget_type = g_type_register_static(
- GNC_TYPE_PLUGIN, "GncPluginBudget", &our_info, 0);
- }
-
- return gnc_plugin_budget_type;
-}
-
GncPlugin * gnc_plugin_budget_new (void)
{
GncPluginBudget *plugin;
@@ -149,6 +122,8 @@ gnc_plugin_budget_main_window_page_changed (GncMainWindow *window,
}
}
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginBudget, gnc_plugin_budget, GNC_TYPE_PLUGIN)
+
static void
gnc_plugin_budget_class_init (GncPluginBudgetClass *klass)
{
@@ -168,7 +143,6 @@ gnc_plugin_budget_class_init (GncPluginBudgetClass *klass)
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
- g_type_class_add_private(klass, sizeof(GncPluginBudgetPrivate));
LEAVE (" ");
}
commit e99c3d68d03746f9c265cd0a62beb181e56c5cfb
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:35:44 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_plugin_basic_commands_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome/gnc-plugin-basic-commands.c b/gnucash/gnome/gnc-plugin-basic-commands.c
index 566fc9721..2e5330c01 100644
--- a/gnucash/gnome/gnc-plugin-basic-commands.c
+++ b/gnucash/gnome/gnc-plugin-basic-commands.c
@@ -275,37 +275,6 @@ typedef struct GncPluginBasicCommandsPrivate
/** A pointer to the parent class of a plugin page. */
static GObjectClass *parent_class = NULL;
-
-/* Get the type of the basic commands menu plugin. */
-GType
-gnc_plugin_basic_commands_get_type (void)
-{
- static GType gnc_plugin_basic_commands_type = 0;
-
- if (gnc_plugin_basic_commands_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginBasicCommandsClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_basic_commands_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginBasicCommands),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_basic_commands_init
- };
-
- gnc_plugin_basic_commands_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginBasicCommands",
- &our_info, 0);
- }
-
- return gnc_plugin_basic_commands_type;
-}
-
-
/** Create a new basic commands menu plugin. */
GncPlugin *
gnc_plugin_basic_commands_new (void)
@@ -385,6 +354,8 @@ gnc_plugin_basic_commands_main_window_page_changed(GncMainWindow *window,
}
}
+G_DEFINE_TYPE_WITH_PRIVATE(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
* class, and also configure the private data storage for this
@@ -414,8 +385,6 @@ gnc_plugin_basic_commands_class_init (GncPluginBasicCommandsClass *klass)
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->important_actions = gnc_plugin_important_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginBasicCommandsPrivate));
}
commit 46451243072cc619a7eabbe209fc3762d4dcd79f
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:35:18 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_search_param_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-utils/search-param.c b/gnucash/gnome-utils/search-param.c
index ababab341..5b8417f4a 100644
--- a/gnucash/gnome-utils/search-param.c
+++ b/gnucash/gnome-utils/search-param.c
@@ -95,32 +95,8 @@ static guint signals[LAST_SIGNAL] = { 0 };
#endif
/* Base class */
-GType
-gnc_search_param_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0)
- {
- static GTypeInfo type_info =
- {
- sizeof(GNCSearchParamClass),
- NULL,
- NULL,
- (GClassInitFunc)gnc_search_param_class_init,
- NULL,
- NULL,
- sizeof(GNCSearchParam),
- 0,
- (GInstanceInitFunc)gnc_search_param_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "GNCSearchParam",
- &type_info, 0);
- }
- return type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchParam, gnc_search_param, G_TYPE_OBJECT)
static void
gnc_search_param_class_init (GNCSearchParamClass *klass)
@@ -130,8 +106,6 @@ gnc_search_param_class_init (GNCSearchParamClass *klass)
parent_gobject_class = g_type_class_peek_parent (klass);
object_class->finalize = gnc_search_param_finalize;
-
- g_type_class_add_private(klass, sizeof(GNCSearchParamPrivate));
}
static void
@@ -149,32 +123,8 @@ gnc_search_param_finalize (GObject *obj)
}
/* subclass for simple searches of a single element */
-GType
-gnc_search_param_simple_get_type (void)
-{
- static GType type = 0;
- if (type == 0)
- {
- static GTypeInfo type_info =
- {
- sizeof(GNCSearchParamSimpleClass),
- NULL,
- NULL,
- (GClassInitFunc)gnc_search_param_simple_class_init,
- NULL,
- NULL,
- sizeof(GNCSearchParamSimple),
- 0,
- (GInstanceInitFunc)gnc_search_param_simple_init
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_PARAM, "GNCSearchParamSimple",
- &type_info, 0);
- }
-
- return type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchParamSimple, gnc_search_param_simple, GNC_TYPE_SEARCH_PARAM)
static void
gnc_search_param_simple_class_init (GNCSearchParamSimpleClass *klass)
@@ -184,8 +134,6 @@ gnc_search_param_simple_class_init (GNCSearchParamSimpleClass *klass)
parent_search_param_class = g_type_class_peek_parent (klass);
object_class->finalize = gnc_search_param_simple_finalize;
-
- g_type_class_add_private(klass, sizeof(GNCSearchParamSimplePrivate));
}
static void
@@ -214,32 +162,8 @@ gnc_search_param_simple_finalize (GObject *obj)
}
/* Subclass for compound searches consisting of AND/OR of several elements */
-GType
-gnc_search_param_compound_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0)
- {
- static GTypeInfo type_info =
- {
- sizeof(GNCSearchParamCompoundClass),
- NULL,
- NULL,
- (GClassInitFunc)gnc_search_param_compound_class_init,
- NULL,
- NULL,
- sizeof(GNCSearchParamCompound),
- 0,
- (GInstanceInitFunc)gnc_search_param_compound_init
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_PARAM, "GNCSearchParamCompound",
- &type_info, 0);
- }
- return type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchParamCompound, gnc_search_param_compound, GNC_TYPE_SEARCH_PARAM)
static void
gnc_search_param_compound_class_init (GNCSearchParamCompoundClass *klass)
@@ -249,8 +173,6 @@ gnc_search_param_compound_class_init (GNCSearchParamCompoundClass *klass)
parent_search_param_class = g_type_class_peek_parent (klass);
object_class->finalize = gnc_search_param_compound_finalize;
-
- g_type_class_add_private(klass, sizeof(GNCSearchParamCompoundPrivate));
}
static void
commit c8d8cc44c05f8e796a7a7e4e2c90db6f4be0a10e
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:21:52 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_view_price_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-utils/gnc-tree-view-price.c b/gnucash/gnome-utils/gnc-tree-view-price.c
index b098df1c1..129a67c9d 100644
--- a/gnucash/gnome-utils/gnc-tree-view-price.c
+++ b/gnucash/gnome-utils/gnc-tree-view-price.c
@@ -67,33 +67,7 @@ typedef struct GncTreeViewPricePrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_view_price_get_type (void)
-{
- static GType gnc_tree_view_price_type = 0;
-
- if (gnc_tree_view_price_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeViewPriceClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_view_price_class_init,
- NULL,
- NULL,
- sizeof (GncTreeViewPrice),
- 0,
- (GInstanceInitFunc) gnc_tree_view_price_init
- };
-
- gnc_tree_view_price_type = g_type_register_static (GNC_TYPE_TREE_VIEW,
- "GncTreeViewPrice",
- &our_info, 0);
- }
-
- return gnc_tree_view_price_type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewPrice, gnc_tree_view_price, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_price_class_init (GncTreeViewPriceClass *klass)
@@ -111,8 +85,6 @@ gnc_tree_view_price_class_init (GncTreeViewPriceClass *klass)
/* GtkWidget signals */
widget_class->destroy = gnc_tree_view_price_destroy;
-
- g_type_class_add_private(klass, sizeof(GncTreeViewPricePrivate));
}
static void
commit 3eb5c88c5aa36a4fbb4e2de0473d4051f42efbe6
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:21:39 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_view_owner_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-utils/gnc-tree-view-owner.c b/gnucash/gnome-utils/gnc-tree-view-owner.c
index 153e5cc39..8d6e802ae 100644
--- a/gnucash/gnome-utils/gnc-tree-view-owner.c
+++ b/gnucash/gnome-utils/gnc-tree-view-owner.c
@@ -96,33 +96,7 @@ typedef struct GncTreeViewOwnerPrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_view_owner_get_type (void)
-{
- static GType gnc_tree_view_owner_type = 0;
-
- if (gnc_tree_view_owner_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeViewOwnerClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_view_owner_class_init,
- NULL,
- NULL,
- sizeof (GncTreeViewOwner),
- 0,
- (GInstanceInitFunc) gnc_tree_view_owner_init
- };
-
- gnc_tree_view_owner_type = g_type_register_static (
- GNC_TYPE_TREE_VIEW, GNC_TREE_VIEW_OWNER_NAME,
- &our_info, 0);
- }
-
- return gnc_tree_view_owner_type;
-}
+G_DEFINE_TYPE_WITH_PRIVATE(GncTreeViewOwner, gnc_tree_view_owner, GNC_TYPE_TREE_VIEW)
static void
gnc_tree_view_owner_class_init (GncTreeViewOwnerClass *klass)
@@ -135,8 +109,6 @@ gnc_tree_view_owner_class_init (GncTreeViewOwnerClass *klass)
o_class = G_OBJECT_CLASS (klass);
o_class->finalize = gnc_tree_view_owner_finalize;
- g_type_class_add_private(klass, sizeof(GncTreeViewOwnerPrivate));
-
gnc_hook_add_dangler(HOOK_CURRENCY_CHANGED,
(GFunc)gtvo_currency_changed_cb, NULL);
}
commit df74ac3cd2ba628fbaaa774a8796b4ab253abb46
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:20:21 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_model_selection_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_CODE
and G_ADD_PRIVATE. Replace g_type_add_interface_static by G_IMPLEMENT_INTERFACE.
diff --git a/gnucash/gnome-utils/gnc-tree-model-selection.c b/gnucash/gnome-utils/gnc-tree-model-selection.c
index 8f373052d..b7bd28e76 100644
--- a/gnucash/gnome-utils/gnc-tree-model-selection.c
+++ b/gnucash/gnome-utils/gnc-tree-model-selection.c
@@ -101,44 +101,10 @@ typedef struct GncTreeModelSelectionPrivate
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_model_selection_get_type (void)
-{
- static GType gnc_tree_model_selection_type = 0;
-
- if (gnc_tree_model_selection_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeModelSelectionClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_tree_model_selection_class_init,
- NULL,
- NULL,
- sizeof (GncTreeModelSelection),
- 0,
- (GInstanceInitFunc) gnc_tree_model_selection_init
- };
-
- static const GInterfaceInfo tree_model_info =
- {
- (GInterfaceInitFunc) gnc_tree_model_selection_tree_model_init,
- NULL,
- NULL
- };
-
- gnc_tree_model_selection_type = g_type_register_static (G_TYPE_OBJECT,
- "GncTreeModelSelection",
- &our_info, 0);
-
- g_type_add_interface_static (gnc_tree_model_selection_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- }
-
- return gnc_tree_model_selection_type;
-}
+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)
@@ -148,8 +114,6 @@ gnc_tree_model_selection_class_init (GncTreeModelSelectionClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gnc_tree_model_selection_finalize;
-
- g_type_class_add_private(klass, sizeof(GncTreeModelSelectionPrivate));
}
static void
commit 8814ad77154f29985aa5db1f9ae09961dfaa705a
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:19:55 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_model_owner_get_type is being replaced by that provided by G_DEFINE_TYPE_WITH_CODE
and G_ADD_PRIVATE. Replace g_type_add_interface_static by G_IMPLEMENT_INTERFACE.
diff --git a/gnucash/gnome-utils/gnc-tree-model-owner.c b/gnucash/gnome-utils/gnc-tree-model-owner.c
index 59cc6309a..34d7317ca 100644
--- a/gnucash/gnome-utils/gnc-tree-model-owner.c
+++ b/gnucash/gnome-utils/gnc-tree-model-owner.c
@@ -132,45 +132,6 @@ gnc_tree_model_owner_update_color (gpointer gsettings, gchar *key, gpointer user
/** A pointer to the parent class of an owner tree model. */
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_model_owner_get_type (void)
-{
- static GType gnc_tree_model_owner_type = 0;
-
- if (gnc_tree_model_owner_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeModelOwnerClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_tree_model_owner_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncTreeModelOwner), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_tree_model_owner_init
- };
-
- static const GInterfaceInfo tree_model_info =
- {
- (GInterfaceInitFunc) gnc_tree_model_owner_tree_model_init,
- NULL,
- NULL
- };
-
- gnc_tree_model_owner_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
- GNC_TREE_MODEL_OWNER_NAME,
- &our_info, 0);
-
- g_type_add_interface_static (gnc_tree_model_owner_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- }
-
- return gnc_tree_model_owner_type;
-}
-
static void
gnc_tree_model_owner_class_init (GncTreeModelOwnerClass *klass)
{
@@ -183,10 +144,13 @@ gnc_tree_model_owner_class_init (GncTreeModelOwnerClass *klass)
/* GObject signals */
o_class->finalize = gnc_tree_model_owner_finalize;
o_class->dispose = gnc_tree_model_owner_dispose;
-
- g_type_class_add_private(klass, sizeof(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))
+
static void
gnc_tree_model_owner_init (GncTreeModelOwner *model)
{
commit 8a4ef02c381b4f084d2d1810973e2d178a52a650
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 23:18:57 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private
gnc_tree_view_account_get_type is being replaced by that
provided by G_DEFINE_TYPE_WITH_CODE and G_ADD_PRIVATE.
Replace g_type_add_interface_static by G_IMPLEMENT_INTERFACE.
diff --git a/gnucash/gnome-utils/gnc-tree-model-account.c b/gnucash/gnome-utils/gnc-tree-model-account.c
index 3bc417363..695878414 100644
--- a/gnucash/gnome-utils/gnc-tree-model-account.c
+++ b/gnucash/gnome-utils/gnc-tree-model-account.c
@@ -144,44 +144,10 @@ gnc_tree_model_account_update_color (gpointer gsettings, gchar *key, gpointer us
/** A pointer to the parent class of an account tree model. */
static GObjectClass *parent_class = NULL;
-GType
-gnc_tree_model_account_get_type (void)
-{
- static GType gnc_tree_model_account_type = 0;
-
- if (gnc_tree_model_account_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncTreeModelAccountClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_tree_model_account_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncTreeModelAccount), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_tree_model_account_init
- };
-
- static const GInterfaceInfo tree_model_info =
- {
- (GInterfaceInitFunc) gnc_tree_model_account_tree_model_init,
- NULL,
- NULL
- };
-
- gnc_tree_model_account_type = g_type_register_static (GNC_TYPE_TREE_MODEL,
- GNC_TREE_MODEL_ACCOUNT_NAME,
- &our_info, 0);
-
- g_type_add_interface_static (gnc_tree_model_account_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- }
-
- return gnc_tree_model_account_type;
-}
+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))
static void
gnc_tree_model_account_class_init (GncTreeModelAccountClass *klass)
@@ -195,8 +161,6 @@ gnc_tree_model_account_class_init (GncTreeModelAccountClass *klass)
/* GObject signals */
o_class->finalize = gnc_tree_model_account_finalize;
o_class->dispose = gnc_tree_model_account_dispose;
-
- g_type_class_add_private(klass, sizeof(GncTreeModelAccountPrivate));
}
static void
commit ddda8530741c76e1a66e68d029b7374989348ac2
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Thu Dec 6 20:19:07 2018 +0100
use G_DEFINE_TYPE_WITH_PRIVATE to replace g_type_class_add_private -
replace objects ..._get_type method by that provided by G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/gnucash/gnome-search/gnc-general-search.c b/gnucash/gnome-search/gnc-general-search.c
index c0d4f2b35..174c00a31 100644
--- a/gnucash/gnome-search/gnc-general-search.c
+++ b/gnucash/gnome-search/gnc-general-search.c
@@ -75,46 +75,14 @@ struct _GNCGeneralSearchPrivate
gint component_id;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCGeneralSearch, gnc_general_search, GTK_TYPE_BOX)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_GENERAL_SEARCH, GNCGeneralSearchPrivate))
static GtkBoxClass *parent_class;
static guint general_search_signals[LAST_SIGNAL];
-
-/**
- * gnc_general_search_get_type:
- *
- * Returns the GType for the GNCGeneralSearch widget
- */
-GType
-gnc_general_search_get_type (void)
-{
- static GType general_search_type = 0;
-
- if (!general_search_type)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GNCGeneralSearchClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_general_search_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GNCGeneralSearch), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_general_search_init,
- };
-
- general_search_type = g_type_register_static (GTK_TYPE_BOX,
- "GNCGeneralSearch",
- &our_info, 0);
- }
-
- return general_search_type;
-}
-
static void
gnc_general_search_class_init (GNCGeneralSearchClass *klass)
{
@@ -134,8 +102,6 @@ gnc_general_search_class_init (GNCGeneralSearchClass *klass)
object_class->destroy = gnc_general_search_destroy;
klass->changed = NULL;
-
- g_type_class_add_private(klass, sizeof(GNCGeneralSearchPrivate));
}
static void
diff --git a/gnucash/gnome-search/search-account.c b/gnucash/gnome-search/search-account.c
index 429e525ae..6bce8894e 100644
--- a/gnucash/gnome-search/search-account.c
+++ b/gnucash/gnome-search/search-account.c
@@ -58,40 +58,13 @@ struct _GNCSearchAccountPrivate
GtkWindow *parent;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchAccount, gnc_search_account, GNC_TYPE_SEARCH_CORE_TYPE)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_ACCOUNT, GNCSearchAccountPrivate))
static GNCSearchCoreTypeClass *parent_class;
-
-GType
-gnc_search_account_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCSearchAccountClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_search_account_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GNCSearchAccount), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_search_account_init,
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
- "GNCSearchAccount",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_account_class_init (GNCSearchAccountClass *klass)
{
@@ -109,8 +82,6 @@ gnc_search_account_class_init (GNCSearchAccountClass *klass)
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
gnc_search_core_type->clone = gncs_clone;
-
- g_type_class_add_private(klass, sizeof(GNCSearchAccountPrivate));
}
static void
diff --git a/gnucash/gnome-search/search-boolean.c b/gnucash/gnome-search/search-boolean.c
index caecd6be5..8bc22479e 100644
--- a/gnucash/gnome-search/search-boolean.c
+++ b/gnucash/gnome-search/search-boolean.c
@@ -53,39 +53,13 @@ struct _GNCSearchBooleanPrivate
gpointer dummy;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchBoolean, gnc_search_boolean, GNC_TYPE_SEARCH_CORE_TYPE)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_BOOLEAN, GNCSearchBooleanPrivate))
static GNCSearchCoreTypeClass *parent_class;
-GType
-gnc_search_boolean_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCSearchBooleanClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_search_boolean_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GNCSearchBoolean), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_search_boolean_init,
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
- "GNCSearchBoolean",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_boolean_class_init (GNCSearchBooleanClass *klass)
{
@@ -103,8 +77,6 @@ gnc_search_boolean_class_init (GNCSearchBooleanClass *klass)
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
gnc_search_core_type->clone = gncs_clone;
-
- g_type_class_add_private(klass, sizeof(GNCSearchBooleanPrivate));
}
static void
diff --git a/gnucash/gnome-search/search-core-type.c b/gnucash/gnome-search/search-core-type.c
index 37424ee16..523309e0d 100644
--- a/gnucash/gnome-search/search-core-type.c
+++ b/gnucash/gnome-search/search-core-type.c
@@ -55,6 +55,8 @@ struct _GNCSearchCoreTypePrivate
gpointer dummy;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchCoreType, gnc_search_core_type, G_TYPE_OBJECT)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_CORE_TYPE, GNCSearchCoreTypePrivate))
@@ -62,32 +64,6 @@ static GObjectClass *parent_class;
static GHashTable *typeTable = NULL;
-GType
-gnc_search_core_type_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0)
- {
- GTypeInfo type_info =
- {
- sizeof (GNCSearchCoreTypeClass),
- NULL,
- NULL,
- (GClassInitFunc)gnc_search_core_type_class_init,
- NULL,
- NULL,
- sizeof (GNCSearchCoreType),
- 0,
- (GInstanceInitFunc)gnc_search_core_type_init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "GNCSearchCoreType", &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_core_type_class_init (GNCSearchCoreTypeClass *klass)
{
@@ -102,8 +78,6 @@ gnc_search_core_type_class_init (GNCSearchCoreTypeClass *klass)
klass->validate = validate;
klass->grab_focus = grab_focus;
klass->editable_enters = editable_enters;
-
- g_type_class_add_private(klass, sizeof(GNCSearchCoreTypePrivate));
}
static void
diff --git a/gnucash/gnome-search/search-date.c b/gnucash/gnome-search/search-date.c
index 7a746c265..10f82e389 100644
--- a/gnucash/gnome-search/search-date.c
+++ b/gnucash/gnome-search/search-date.c
@@ -57,39 +57,13 @@ struct _GNCSearchDatePrivate
GtkWindow *parent;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchDate, gnc_search_date, GNC_TYPE_SEARCH_CORE_TYPE)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_DATE, GNCSearchDatePrivate))
static GNCSearchCoreTypeClass *parent_class;
-GType
-gnc_search_date_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCSearchDateClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_search_date_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GNCSearchDate), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_search_date_init,
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
- "GNCSearchDate",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_date_class_init (GNCSearchDateClass *klass)
{
@@ -109,8 +83,6 @@ gnc_search_date_class_init (GNCSearchDateClass *klass)
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
gnc_search_core_type->clone = gncs_clone;
-
- g_type_class_add_private(klass, sizeof(GNCSearchDatePrivate));
}
static void
diff --git a/gnucash/gnome-search/search-double.c b/gnucash/gnome-search/search-double.c
index 191b270ea..3f906696e 100644
--- a/gnucash/gnome-search/search-double.c
+++ b/gnucash/gnome-search/search-double.c
@@ -57,39 +57,13 @@ struct _GNCSearchDoublePrivate
GtkWindow *parent;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchDouble, gnc_search_double, GNC_TYPE_SEARCH_CORE_TYPE)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_DOUBLE, GNCSearchDoublePrivate))
static GNCSearchCoreTypeClass *parent_class;
-GType
-gnc_search_double_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCSearchDoubleClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_search_double_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GNCSearchDouble), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_search_double_init,
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
- "GNCSearchDouble",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_double_class_init (GNCSearchDoubleClass *klass)
{
@@ -109,8 +83,6 @@ gnc_search_double_class_init (GNCSearchDoubleClass *klass)
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
gnc_search_core_type->clone = gncs_clone;
-
- g_type_class_add_private(klass, sizeof(GNCSearchDoublePrivate));
}
static void
diff --git a/gnucash/gnome-search/search-int64.c b/gnucash/gnome-search/search-int64.c
index a1c3f7ff7..ecf6cadc7 100644
--- a/gnucash/gnome-search/search-int64.c
+++ b/gnucash/gnome-search/search-int64.c
@@ -58,39 +58,13 @@ struct _GNCSearchInt64Private
GtkWindow *parent;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchInt64, gnc_search_int64, GNC_TYPE_SEARCH_CORE_TYPE)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_INT64, GNCSearchInt64Private))
static GNCSearchCoreTypeClass *parent_class;
-GType
-gnc_search_int64_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCSearchInt64Class), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_search_int64_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GNCSearchInt64), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_search_int64_init,
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
- "GNCSearchInt64",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_int64_class_init (GNCSearchInt64Class *klass)
{
@@ -110,8 +84,6 @@ gnc_search_int64_class_init (GNCSearchInt64Class *klass)
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
gnc_search_core_type->clone = gncs_clone;
-
- g_type_class_add_private(klass, sizeof(GNCSearchInt64Private));
}
static void
diff --git a/gnucash/gnome-search/search-numeric.c b/gnucash/gnome-search/search-numeric.c
index 97d0b4ff0..d5fc64a75 100644
--- a/gnucash/gnome-search/search-numeric.c
+++ b/gnucash/gnome-search/search-numeric.c
@@ -58,39 +58,13 @@ struct _GNCSearchNumericPrivate
GtkWindow *parent;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchNumeric, gnc_search_numeric, GNC_TYPE_SEARCH_CORE_TYPE)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_NUMERIC, GNCSearchNumericPrivate))
static GNCSearchCoreTypeClass *parent_class;
-GType
-gnc_search_numeric_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCSearchNumericClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_search_numeric_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GNCSearchNumeric), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_search_numeric_init,
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
- "GNCSearchNumeric",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_numeric_class_init (GNCSearchNumericClass *klass)
{
@@ -110,8 +84,6 @@ gnc_search_numeric_class_init (GNCSearchNumericClass *klass)
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
gnc_search_core_type->clone = gncs_clone;
-
- g_type_class_add_private(klass, sizeof(GNCSearchNumericPrivate));
}
static void
diff --git a/gnucash/gnome-search/search-reconciled.c b/gnucash/gnome-search/search-reconciled.c
index 31f3866f8..f92815378 100644
--- a/gnucash/gnome-search/search-reconciled.c
+++ b/gnucash/gnome-search/search-reconciled.c
@@ -54,39 +54,13 @@ struct _GNCSearchReconciledPrivate
gpointer dummy;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchReconciled, gnc_search_reconciled, GNC_TYPE_SEARCH_CORE_TYPE)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_RECONCILED, GNCSearchReconciledPrivate))
static GNCSearchCoreTypeClass *parent_class;
-GType
-gnc_search_reconciled_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCSearchReconciledClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_search_reconciled_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GNCSearchReconciled), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_search_reconciled_init,
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
- "GNCSearchReconciled",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_reconciled_class_init (GNCSearchReconciledClass *klass)
{
@@ -104,8 +78,6 @@ gnc_search_reconciled_class_init (GNCSearchReconciledClass *klass)
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
gnc_search_core_type->clone = gncs_clone;
-
- g_type_class_add_private(klass, sizeof(GNCSearchReconciledPrivate));
}
static void
diff --git a/gnucash/gnome-search/search-string.c b/gnucash/gnome-search/search-string.c
index 6ccfe4e4b..8f698d11a 100644
--- a/gnucash/gnome-search/search-string.c
+++ b/gnucash/gnome-search/search-string.c
@@ -57,39 +57,13 @@ struct _GNCSearchStringPrivate
GtkWindow *parent;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchString, gnc_search_string, GNC_TYPE_SEARCH_CORE_TYPE)
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_STRING, GNCSearchStringPrivate))
static GNCSearchCoreTypeClass *parent_class;
-GType
-gnc_search_string_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCSearchStringClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_search_string_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GNCSearchString), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_search_string_init,
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
- "GNCSearchString",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_string_class_init (GNCSearchStringClass *klass)
{
@@ -109,8 +83,6 @@ gnc_search_string_class_init (GNCSearchStringClass *klass)
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
gnc_search_core_type->clone = gncs_clone;
-
- g_type_class_add_private(klass, sizeof(GNCSearchStringPrivate));
}
static void
diff --git a/gnucash/gnome/gnc-budget-view.c b/gnucash/gnome/gnc-budget-view.c
index 0b36e96c1..0ef33e266 100644
--- a/gnucash/gnome/gnc-budget-view.c
+++ b/gnucash/gnome/gnc-budget-view.c
@@ -170,11 +170,11 @@ struct GncBudgetViewPrivate
Account* rootAcct;
};
+G_DEFINE_TYPE_WITH_PRIVATE(GncBudgetView, gnc_budget_view, GTK_TYPE_BOX)
+
#define GNC_BUDGET_VIEW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), GNC_TYPE_BUDGET_VIEW, GncBudgetViewPrivate))
-G_DEFINE_TYPE(GncBudgetView, gnc_budget_view, GTK_TYPE_BOX)
-
/** \brief Create new gnc budget view.
As the name suggests, this creates a new gnc budget view.
@@ -212,8 +212,6 @@ gnc_budget_view_class_init(GncBudgetViewClass *klass)
g_signal_new("account-activated", GNC_TYPE_BUDGET_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL,
G_TYPE_NONE, 1, GNC_TYPE_ACCOUNT);
-
- g_type_class_add_private(klass, sizeof(GncBudgetViewPrivate));
}
static void
diff --git a/gnucash/gnome/gnc-plugin-account-tree.c b/gnucash/gnome/gnc-plugin-account-tree.c
index ef7d62101..31b92f139 100644
--- a/gnucash/gnome/gnc-plugin-account-tree.c
+++ b/gnucash/gnome/gnc-plugin-account-tree.c
@@ -73,43 +73,14 @@ 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) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_ACCOUNT_TREE, GncPluginAccountTreePrivate))
/** A pointer to the parent class of a plugin page. */
static GObjectClass *parent_class = NULL;
-
-/* Get the type of the account tree menu plugin. */
-GType
-gnc_plugin_account_tree_get_type (void)
-{
- static GType gnc_plugin_account_tree_type = 0;
-
- if (gnc_plugin_account_tree_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginAccountTreeClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_account_tree_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginAccountTree),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_account_tree_init
- };
-
- gnc_plugin_account_tree_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginAccountTree",
- &our_info, 0);
- }
-
- return gnc_plugin_account_tree_type;
-}
-
-
/* Create a new account tree menu plugin. */
GncPlugin *
gnc_plugin_account_tree_new (void)
@@ -126,7 +97,6 @@ gnc_plugin_account_tree_new (void)
return GNC_PLUGIN (plugin);
}
-
static void
gnc_plugin_account_tree_main_window_page_changed (GncMainWindow *window,
GncPluginPage *plugin_page, gpointer user_data)
@@ -148,7 +118,6 @@ gnc_plugin_account_tree_main_window_page_changed (GncMainWindow *window,
}
}
-
/** Initialize the class for a new account tree plugin. This will set
* up any function pointers that override functions in the parent
* class, and also configure the private data storage for this
@@ -177,8 +146,6 @@ gnc_plugin_account_tree_class_init (GncPluginAccountTreeClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginAccountTreePrivate));
}
diff --git a/gnucash/gnome/gnc-plugin-page-budget.c b/gnucash/gnome/gnc-plugin-page-budget.c
index f17249ef8..12d980b70 100644
--- a/gnucash/gnome/gnc-plugin-page-budget.c
+++ b/gnucash/gnome/gnc-plugin-page-budget.c
@@ -206,41 +206,13 @@ typedef struct GncPluginPageBudgetPrivate
gint sigFigs;
} GncPluginPageBudgetPrivate;
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPageBudget, gnc_plugin_page_budget, GNC_TYPE_PLUGIN_PAGE)
+
#define GNC_PLUGIN_PAGE_BUDGET_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_BUDGET, GncPluginPageBudgetPrivate))
static GObjectClass *parent_class = NULL;
-
-GType
-gnc_plugin_page_budget_get_type (void)
-{
- static GType gnc_plugin_page_budget_type = 0;
-
- if (gnc_plugin_page_budget_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginPageBudgetClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_plugin_page_budget_class_init,
- NULL,
- NULL,
- sizeof (GncPluginPageBudget),
- 0,
- (GInstanceInitFunc) gnc_plugin_page_budget_init
- };
-
- gnc_plugin_page_budget_type =
- g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
- "GncPluginPageBudget", &our_info, 0);
- }
-
- return gnc_plugin_page_budget_type;
-}
-
-
GncPluginPage *
gnc_plugin_page_budget_new (GncBudget *budget)
{
@@ -295,8 +267,6 @@ gnc_plugin_page_budget_class_init (GncPluginPageBudgetClass *klass)
gnc_plugin_class->destroy_widget = gnc_plugin_page_budget_destroy_widget;
gnc_plugin_class->save_page = gnc_plugin_page_budget_save_page;
gnc_plugin_class->recreate_page = gnc_plugin_page_budget_recreate_page;
-
- g_type_class_add_private(klass, sizeof(GncPluginPageBudgetPrivate));
}
diff --git a/gnucash/gnome/gnc-plugin-page-invoice.c b/gnucash/gnome/gnc-plugin-page-invoice.c
index 77cd420f3..cbd4b8497 100644
--- a/gnucash/gnome/gnc-plugin-page-invoice.c
+++ b/gnucash/gnome/gnc-plugin-page-invoice.c
@@ -283,6 +283,8 @@ typedef struct GncPluginPageInvoicePrivate
gint component_manager_id;
} GncPluginPageInvoicePrivate;
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPageInvoice, gnc_plugin_page_invoice, GNC_TYPE_PLUGIN_PAGE)
+
#define GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_INVOICE, GncPluginPageInvoicePrivate))
@@ -292,34 +294,6 @@ static GObjectClass *parent_class = NULL;
/* Implementation */
/************************************************************/
-GType
-gnc_plugin_page_invoice_get_type (void)
-{
- static GType gnc_plugin_page_invoice_type = 0;
-
- if (gnc_plugin_page_invoice_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginPageInvoiceClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_plugin_page_invoice_class_init,
- NULL,
- NULL,
- sizeof (GncPluginPageInvoice),
- 0,
- (GInstanceInitFunc) gnc_plugin_page_invoice_init
- };
-
- gnc_plugin_page_invoice_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
- "GncPluginPageInvoice",
- &our_info, 0);
- }
-
- return gnc_plugin_page_invoice_type;
-}
-
GncPluginPage *
gnc_plugin_page_invoice_new (InvoiceWindow *iw)
{
@@ -367,8 +341,6 @@ gnc_plugin_page_invoice_class_init (GncPluginPageInvoiceClass *klass)
gnc_plugin_class->save_page = gnc_plugin_page_invoice_save_page;
gnc_plugin_class->recreate_page = gnc_plugin_page_invoice_recreate_page;
gnc_plugin_class->window_changed = gnc_plugin_page_invoice_window_changed;
-
- g_type_class_add_private(klass, sizeof(GncPluginPageInvoicePrivate));
}
static void
diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c
index cf90aafbb..47c7a2ca7 100644
--- a/gnucash/gnome/gnc-plugin-page-register.c
+++ b/gnucash/gnome/gnc-plugin-page-register.c
@@ -588,6 +588,8 @@ typedef struct GncPluginPageRegisterPrivate
} fd;
} GncPluginPageRegisterPrivate;
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPageRegister, gnc_plugin_page_register, GNC_TYPE_PLUGIN_PAGE)
+
#define GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REGISTER, GncPluginPageRegisterPrivate))
@@ -597,34 +599,6 @@ static GObjectClass *parent_class = NULL;
/* Implementation */
/************************************************************/
-GType
-gnc_plugin_page_register_get_type (void)
-{
- static GType gnc_plugin_page_register_type = 0;
-
- if (gnc_plugin_page_register_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginPageRegisterClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_plugin_page_register_class_init,
- NULL,
- NULL,
- sizeof (GncPluginPageRegister),
- 0,
- (GInstanceInitFunc) gnc_plugin_page_register_init
- };
-
- gnc_plugin_page_register_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
- GNC_PLUGIN_PAGE_REGISTER_NAME,
- &our_info, 0);
- }
-
- return gnc_plugin_page_register_type;
-}
-
static GncPluginPage *
gnc_plugin_page_register_new_common (GNCLedgerDisplay *ledger)
{
@@ -762,8 +736,6 @@ gnc_plugin_page_register_class_init (GncPluginPageRegisterClass *klass)
gnc_plugin_class->update_edit_menu_actions = gnc_plugin_page_register_update_edit_menu;
gnc_plugin_class->finish_pending = gnc_plugin_page_register_finish_pending;
- g_type_class_add_private(klass, sizeof(GncPluginPageRegisterPrivate));
-
gnc_ui_register_account_destroy_callback (gppr_account_destroy_cb);
}
diff --git a/gnucash/gnome/gnc-plugin-register.c b/gnucash/gnome/gnc-plugin-register.c
index 5a9716071..810c6da1c 100644
--- a/gnucash/gnome/gnc-plugin-register.c
+++ b/gnucash/gnome/gnc-plugin-register.c
@@ -68,6 +68,8 @@ 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) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_REGISTER, GncPluginRegisterPrivate))
@@ -103,34 +105,6 @@ gnc_plugin_register_pref_changed (gpointer prefs, gchar *pref,
* Object Implementation *
************************************************************/
-GType
-gnc_plugin_register_get_type (void)
-{
- static GType gnc_plugin_register_type = 0;
-
- if (gnc_plugin_register_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginRegisterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_register_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginRegister),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_register_init
- };
-
- gnc_plugin_register_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginRegister",
- &our_info, 0);
- }
-
- return gnc_plugin_register_type;
-}
-
GncPlugin *
gnc_plugin_register_new (void)
{
@@ -190,8 +164,6 @@ gnc_plugin_register_class_init (GncPluginRegisterClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginRegisterPrivate));
}
static void
diff --git a/gnucash/gnome/gnc-plugin-register2.c b/gnucash/gnome/gnc-plugin-register2.c
index 1eaafb6ec..955394574 100644
--- a/gnucash/gnome/gnc-plugin-register2.c
+++ b/gnucash/gnome/gnc-plugin-register2.c
@@ -75,6 +75,8 @@ typedef struct GncPluginRegister2Private
gpointer dummy;
} GncPluginRegister2Private;
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginRegister2, gnc_plugin_register2, GNC_TYPE_PLUGIN)
+
#define GNC_PLUGIN_REGISTER2_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_REGISTER2, GncPluginRegister2Private))
@@ -110,34 +112,6 @@ gnc_plugin_register2_pref_changed (gpointer prefs, gchar *pref,
* Object Implementation *
************************************************************/
-GType
-gnc_plugin_register2_get_type (void)
-{
- static GType gnc_plugin_register2_type = 0;
-
- if (gnc_plugin_register2_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginRegister2Class),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_register2_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginRegister2),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_register2_init
- };
-
- gnc_plugin_register2_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginRegister2",
- &our_info, 0);
- }
-
- return gnc_plugin_register2_type;
-}
-
GncPlugin *
gnc_plugin_register2_new (void)
{
@@ -176,8 +150,6 @@ gnc_plugin_register2_class_init (GncPluginRegister2Class *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginRegister2Private));
}
static void
diff --git a/gnucash/gnome/search-owner.c b/gnucash/gnome/search-owner.c
index d33f693b7..fbd375106 100644
--- a/gnucash/gnome/search-owner.c
+++ b/gnucash/gnome/search-owner.c
@@ -59,6 +59,8 @@ typedef struct _GNCSearchOwnerPrivate
GtkWidget * owner_choice;
} GNCSearchOwnerPrivate;
+G_DEFINE_TYPE_WITH_PRIVATE(GNCSearchOwner, gnc_search_owner, GNC_TYPE_SEARCH_CORE_TYPE);
+
#define _PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_SEARCH_OWNER, GNCSearchOwnerPrivate))
@@ -73,34 +75,6 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
#endif
-GType
-gnc_search_owner_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- GTypeInfo type_info =
- {
- sizeof(GNCSearchOwnerClass), /* class_size */
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc)gnc_search_owner_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GNCSearchOwner), /* */
- 0, /* n_preallocs */
- (GInstanceInitFunc)gnc_search_owner_init,
- };
-
- type = g_type_register_static (GNC_TYPE_SEARCH_CORE_TYPE,
- "GNCSearchOwner",
- &type_info, 0);
- }
-
- return type;
-}
-
static void
gnc_search_owner_class_init (GNCSearchOwnerClass *klass)
{
@@ -118,8 +92,6 @@ gnc_search_owner_class_init (GNCSearchOwnerClass *klass)
gnc_search_core_type->get_widget = gncs_get_widget;
gnc_search_core_type->get_predicate = gncs_get_predicate;
gnc_search_core_type->clone = gncs_clone;
-
- g_type_class_add_private(klass, sizeof(GNCSearchOwnerPrivate));
}
static void
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 0b5192531..3092e968f 100644
--- a/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
+++ b/gnucash/import-export/csv-exp/gnc-plugin-csv-export.c
@@ -73,39 +73,13 @@ 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) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_CSV_EXPORT, GncPluginCsvExportPrivate))
static GObjectClass *parent_class = NULL;
-GType
-gnc_plugin_csv_export_get_type (void)
-{
- static GType gnc_plugin_csv_export_type = 0;
-
- if (gnc_plugin_csv_export_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginCsvExportClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_csv_export_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginCsvExport),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_csv_export_init,
- };
-
- gnc_plugin_csv_export_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginCsvExport",
- &our_info, 0);
- }
-
- return gnc_plugin_csv_export_type;
-}
-
GncPlugin *
gnc_plugin_csv_export_new (void)
{
@@ -130,8 +104,6 @@ gnc_plugin_csv_export_class_init (GncPluginCsvExportClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginCsvExportPrivate));
}
static 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 3cecf66fe..df144d115 100644
--- a/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
+++ b/gnucash/import-export/csv-imp/gnc-plugin-csv-import.c
@@ -69,39 +69,13 @@ 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) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_CSV_IMPORT, GncPluginCsvImportPrivate))
static GObjectClass *parent_class = NULL;
-GType
-gnc_plugin_csv_import_get_type (void)
-{
- static GType gnc_plugin_csv_import_type = 0;
-
- if (gnc_plugin_csv_import_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginCsvImportClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_csv_import_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginCsvImport),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_csv_import_init,
- };
-
- gnc_plugin_csv_import_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginCsvImport",
- &our_info, 0);
- }
-
- return gnc_plugin_csv_import_type;
-}
-
GncPlugin *
gnc_plugin_csv_import_new (void)
{
@@ -126,8 +100,6 @@ gnc_plugin_csv_import_class_init (GncPluginCsvImportClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginCsvImportPrivate));
}
static 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 87b54ce1c..b55bfaa19 100644
--- a/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
+++ b/gnucash/import-export/log-replay/gnc-plugin-log-replay.c
@@ -57,39 +57,13 @@ 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) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_LOG_REPLAY, GncPluginLogreplayPrivate))
static GObjectClass *parent_class = NULL;
-GType
-gnc_plugin_log_replay_get_type (void)
-{
- static GType gnc_plugin_log_replay_type = 0;
-
- if (gnc_plugin_log_replay_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginLogreplayClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_log_replay_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginLogreplay),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_log_replay_init,
- };
-
- gnc_plugin_log_replay_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginLogreplay",
- &our_info, 0);
- }
-
- return gnc_plugin_log_replay_type;
-}
-
GncPlugin *
gnc_plugin_log_replay_new (void)
{
@@ -114,8 +88,6 @@ gnc_plugin_log_replay_class_init (GncPluginLogreplayClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginLogreplayPrivate));
}
static void
diff --git a/gnucash/import-export/ofx/gnc-plugin-ofx.c b/gnucash/import-export/ofx/gnc-plugin-ofx.c
index c456261a6..867583296 100644
--- a/gnucash/import-export/ofx/gnc-plugin-ofx.c
+++ b/gnucash/import-export/ofx/gnc-plugin-ofx.c
@@ -55,39 +55,13 @@ 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) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_OFX, GncPluginOfxPrivate))
static GObjectClass *parent_class = NULL;
-GType
-gnc_plugin_ofx_get_type (void)
-{
- static GType gnc_plugin_ofx_type = 0;
-
- if (gnc_plugin_ofx_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginOfxClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_ofx_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginOfx),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_ofx_init,
- };
-
- gnc_plugin_ofx_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginOfx",
- &our_info, 0);
- }
-
- return gnc_plugin_ofx_type;
-}
-
GncPlugin *
gnc_plugin_ofx_new (void)
{
@@ -112,8 +86,6 @@ gnc_plugin_ofx_class_init (GncPluginOfxClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginOfxPrivate));
}
static 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 c1ffd01b7..a2c6a6780 100644
--- a/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
+++ b/gnucash/import-export/qif-imp/gnc-plugin-qif-import.c
@@ -56,39 +56,13 @@ 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) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_QIF_IMPORT, GncPluginQifImportPrivate))
static GObjectClass *parent_class = NULL;
-GType
-gnc_plugin_qif_import_get_type (void)
-{
- static GType gnc_plugin_qif_import_type = 0;
-
- if (gnc_plugin_qif_import_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginQifImportClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_qif_import_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginQifImport),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_qif_import_init,
- };
-
- gnc_plugin_qif_import_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginQifImport",
- &our_info, 0);
- }
-
- return gnc_plugin_qif_import_type;
-}
-
GncPlugin *
gnc_plugin_qif_import_new (void)
{
@@ -113,8 +87,6 @@ gnc_plugin_qif_import_class_init (GncPluginQifImportClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginQifImportPrivate));
}
static void
diff --git a/gnucash/report/report-gnome/gnc-plugin-page-report.c b/gnucash/report/report-gnome/gnc-plugin-page-report.c
index 40cbc58aa..07602873b 100644
--- a/gnucash/report/report-gnome/gnc-plugin-page-report.c
+++ b/gnucash/report/report-gnome/gnc-plugin-page-report.c
@@ -132,6 +132,8 @@ typedef struct GncPluginPageReportPrivate
GtkContainer *container;
} GncPluginPageReportPrivate;
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginPageReport, gnc_plugin_page_report, GNC_TYPE_PLUGIN_PAGE)
+
#define GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_PAGE_REPORT, GncPluginPageReportPrivate))
@@ -180,34 +182,6 @@ static void gnc_plugin_page_report_print_cb(GtkAction *action, GncPluginPageRepo
static void gnc_plugin_page_report_exportpdf_cb(GtkAction *action, GncPluginPageReport *rep);
static void gnc_plugin_page_report_copy_cb(GtkAction *action, GncPluginPageReport *rep);
-GType
-gnc_plugin_page_report_get_type (void)
-{
- static GType gnc_plugin_page_report_type = 0;
-
- if (gnc_plugin_page_report_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginPageReportClass),
- NULL,
- NULL,
- (GClassInitFunc) gnc_plugin_page_report_class_init,
- NULL,
- NULL,
- sizeof (GncPluginPageReport),
- 0,
- (GInstanceInitFunc) gnc_plugin_page_report_init
- };
-
- gnc_plugin_page_report_type = g_type_register_static (GNC_TYPE_PLUGIN_PAGE,
- "GncPluginPageReport",
- &our_info, 0);
- }
-
- return gnc_plugin_page_report_type;
-}
-
static void
gnc_plugin_page_report_get_property( GObject *obj,
guint prop_id,
@@ -326,8 +300,6 @@ gnc_plugin_page_report_class_init (GncPluginPageReportClass *klass)
gnc_plugin_page_class->update_edit_menu_actions = gnc_plugin_page_report_update_edit_menu;
gnc_plugin_page_class->finish_pending = gnc_plugin_page_report_finish_pending;
- g_type_class_add_private(klass, sizeof(GncPluginPageReportPrivate));
-
// create the "reportId" property
g_object_class_install_property( object_class,
PROP_REPORT_ID,
diff --git a/gnucash/report/stylesheets/gnc-plugin-stylesheets.c b/gnucash/report/stylesheets/gnc-plugin-stylesheets.c
index 923a0a4be..ab5c4ed62 100644
--- a/gnucash/report/stylesheets/gnc-plugin-stylesheets.c
+++ b/gnucash/report/stylesheets/gnc-plugin-stylesheets.c
@@ -61,6 +61,8 @@ typedef struct GncPluginStylesheetsPrivate
gpointer dummy;
} GncPluginStylesheetsPrivate;
+G_DEFINE_TYPE_WITH_PRIVATE(GncPluginStylesheets, gnc_plugin_stylesheets, GNC_TYPE_PLUGIN)
+
#define GNC_PLUGIN_STYLESHEETS_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_STYLESHEETS, GncPluginStylesheetsPrivate))
@@ -70,34 +72,6 @@ static GObjectClass *parent_class = NULL;
* Object Implementation *
************************************************************/
-GType
-gnc_plugin_stylesheets_get_type (void)
-{
- static GType gnc_plugin_stylesheets_type = 0;
-
- if (gnc_plugin_stylesheets_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (GncPluginStylesheetsClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gnc_plugin_stylesheets_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GncPluginStylesheets),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gnc_plugin_stylesheets_init,
- };
-
- gnc_plugin_stylesheets_type = g_type_register_static (GNC_TYPE_PLUGIN,
- "GncPluginStylesheets",
- &our_info, 0);
- }
-
- return gnc_plugin_stylesheets_type;
-}
-
GncPlugin *
gnc_plugin_stylesheets_new (void)
{
@@ -122,8 +96,6 @@ gnc_plugin_stylesheets_class_init (GncPluginStylesheetsClass *klass)
plugin_class->actions = gnc_plugin_actions;
plugin_class->n_actions = gnc_plugin_n_actions;
plugin_class->ui_filename = PLUGIN_UI_FILENAME;
-
- g_type_class_add_private(klass, sizeof(GncPluginStylesheetsPrivate));
}
static void
commit 2ab6650e9a4bd53508572cd9494f1adc4d82be92
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Wed Dec 5 21:50:15 2018 +0100
Replace deprecated g_type_class_add_private
use G_DEFINE_TYPE_WITH_PRIVATE
and adapt name of private property to work with G_DEFINE_TYPE_WITH_PRIVATE
diff --git a/libgnucash/engine/gnc-budget.c b/libgnucash/engine/gnc-budget.c
index 9619dbcd2..ab49be6c5 100644
--- a/libgnucash/engine/gnc-budget.c
+++ b/libgnucash/engine/gnc-budget.c
@@ -58,7 +58,7 @@ typedef struct
QofInstanceClass parent_class;
} BudgetClass;
-typedef struct BudgetPrivate
+typedef struct GncBudgetPrivate
{
/* The name is an arbitrary string assigned by the user. */
gchar* name;
@@ -71,10 +71,10 @@ typedef struct BudgetPrivate
/* Number of periods */
guint num_periods;
-} BudgetPrivate;
+} GncBudgetPrivate;
#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GNC_TYPE_BUDGET, BudgetPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE((o), GNC_TYPE_BUDGET, GncBudgetPrivate))
struct _GncBudgetClass
{
@@ -82,12 +82,12 @@ struct _GncBudgetClass
};
/* GObject Initialization */
-G_DEFINE_TYPE(GncBudget, gnc_budget, QOF_TYPE_INSTANCE)
+G_DEFINE_TYPE_WITH_PRIVATE(GncBudget, gnc_budget, QOF_TYPE_INSTANCE)
static void
gnc_budget_init(GncBudget* budget)
{
- BudgetPrivate* priv;
+ GncBudgetPrivate* priv;
GDate *date;
priv = GET_PRIVATE(budget);
@@ -120,7 +120,7 @@ gnc_budget_get_property( GObject* object,
GParamSpec* pspec)
{
GncBudget* budget;
- BudgetPrivate* priv;
+ GncBudgetPrivate* priv;
g_return_if_fail(GNC_IS_BUDGET(object));
@@ -191,8 +191,6 @@ gnc_budget_class_init(GncBudgetClass* klass)
gobject_class->get_property = gnc_budget_get_property;
gobject_class->set_property = gnc_budget_set_property;
- g_type_class_add_private(klass, sizeof(BudgetPrivate));
-
g_object_class_install_property(
gobject_class,
PROP_NAME,
@@ -248,7 +246,7 @@ static void
gnc_budget_free(QofInstance *inst)
{
GncBudget *budget;
- BudgetPrivate* priv;
+ GncBudgetPrivate* priv;
if (inst == NULL)
return;
@@ -370,7 +368,7 @@ gnc_budget_clone(const GncBudget* old_b)
void
gnc_budget_set_name(GncBudget* budget, const gchar* name)
{
- BudgetPrivate* priv;
+ GncBudgetPrivate* priv;
g_return_if_fail(GNC_IS_BUDGET(budget) && name);
@@ -395,7 +393,7 @@ gnc_budget_get_name(const GncBudget* budget)
void
gnc_budget_set_description(GncBudget* budget, const gchar* description)
{
- BudgetPrivate* priv;
+ GncBudgetPrivate* priv;
g_return_if_fail(GNC_IS_BUDGET(budget));
g_return_if_fail(description);
@@ -420,7 +418,7 @@ gnc_budget_get_description(const GncBudget* budget)
void
gnc_budget_set_recurrence(GncBudget *budget, const Recurrence *r)
{
- BudgetPrivate* priv;
+ GncBudgetPrivate* priv;
g_return_if_fail(budget && r);
priv = GET_PRIVATE(budget);
@@ -451,7 +449,7 @@ gnc_budget_get_guid(const GncBudget* budget)
void
gnc_budget_set_num_periods(GncBudget* budget, guint num_periods)
{
- BudgetPrivate* priv;
+ GncBudgetPrivate* priv;
g_return_if_fail(GNC_IS_BUDGET(budget));
diff --git a/libgnucash/engine/gnc-commodity.c b/libgnucash/engine/gnc-commodity.c
index 2a028cedf..7d775a7ad 100644
--- a/libgnucash/engine/gnc-commodity.c
+++ b/libgnucash/engine/gnc-commodity.c
@@ -66,7 +66,7 @@ struct gnc_commodity_s
QofInstance inst;
};
-typedef struct CommodityPrivate
+typedef struct gnc_commodityPrivate
{
gnc_commodity_namespace *name_space;
@@ -87,10 +87,10 @@ typedef struct CommodityPrivate
/* the default display_symbol, set in iso-4217-currencies at start-up */
const char * default_symbol;
-} CommodityPrivate;
+} gnc_commodityPrivate;
#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GNC_TYPE_COMMODITY, CommodityPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE((o), GNC_TYPE_COMMODITY, gnc_commodityPrivate))
struct _GncCommodityClass
{
@@ -629,7 +629,7 @@ mark_commodity_dirty (gnc_commodity *cm)
}
static void
-reset_printname(CommodityPrivate *priv)
+reset_printname(gnc_commodityPrivate *priv)
{
g_free(priv->printname);
priv->printname = g_strdup_printf("%s (%s)",
@@ -638,7 +638,7 @@ reset_printname(CommodityPrivate *priv)
}
static void
-reset_unique_name(CommodityPrivate *priv)
+reset_unique_name(gnc_commodityPrivate *priv)
{
gnc_commodity_namespace *ns;
@@ -650,12 +650,12 @@ reset_unique_name(CommodityPrivate *priv)
}
/* GObject Initialization */
-G_DEFINE_TYPE(gnc_commodity, gnc_commodity, QOF_TYPE_INSTANCE);
+G_DEFINE_TYPE_WITH_PRIVATE(gnc_commodity, gnc_commodity, QOF_TYPE_INSTANCE);
static void
gnc_commodity_init(gnc_commodity* com)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
priv = GET_PRIVATE(com);
@@ -696,7 +696,7 @@ gnc_commodity_get_property (GObject *object,
GParamSpec *pspec)
{
gnc_commodity *commodity;
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
g_return_if_fail(GNC_IS_COMMODITY(object));
@@ -794,8 +794,6 @@ gnc_commodity_class_init(struct _GncCommodityClass* klass)
gobject_class->set_property = gnc_commodity_set_property;
gobject_class->get_property = gnc_commodity_get_property;
- g_type_class_add_private(klass, sizeof(CommodityPrivate));
-
g_object_class_install_property(gobject_class,
PROP_NAMESPACE,
g_param_spec_object ("namespace",
@@ -925,7 +923,7 @@ commodity_free(gnc_commodity * cm)
{
QofBook *book;
gnc_commodity_table *table;
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
if (!cm) return;
@@ -980,8 +978,8 @@ gnc_commodity_destroy(gnc_commodity * cm)
void
gnc_commodity_copy(gnc_commodity * dest, const gnc_commodity *src)
{
- CommodityPrivate* src_priv = GET_PRIVATE(src);
- CommodityPrivate* dest_priv = GET_PRIVATE(dest);
+ gnc_commodityPrivate* src_priv = GET_PRIVATE(src);
+ gnc_commodityPrivate* dest_priv = GET_PRIVATE(dest);
gnc_commodity_set_fullname (dest, src_priv->fullname);
gnc_commodity_set_mnemonic (dest, src_priv->mnemonic);
@@ -997,8 +995,8 @@ gnc_commodity_copy(gnc_commodity * dest, const gnc_commodity *src)
gnc_commodity *
gnc_commodity_clone(const gnc_commodity *src, QofBook *dest_book)
{
- CommodityPrivate* src_priv;
- CommodityPrivate* dest_priv;
+ gnc_commodityPrivate* src_priv;
+ gnc_commodityPrivate* dest_priv;
gnc_commodity * dest = g_object_new(GNC_TYPE_COMMODITY, NULL);
qof_instance_init_data (&dest->inst, GNC_ID_COMMODITY, dest_book);
@@ -1147,7 +1145,7 @@ gnc_commodity_get_quote_flag(const gnc_commodity *cm)
gnc_quote_source*
gnc_commodity_get_quote_source(const gnc_commodity *cm)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
if (!cm) return NULL;
priv = GET_PRIVATE(cm);
@@ -1233,7 +1231,7 @@ gnc_commodity_get_nice_symbol (const gnc_commodity *cm)
void
gnc_commodity_set_mnemonic(gnc_commodity * cm, const char * mnemonic)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
if (!cm) return;
priv = GET_PRIVATE(cm);
@@ -1259,7 +1257,7 @@ gnc_commodity_set_namespace(gnc_commodity * cm, const char * name_space)
QofBook *book;
gnc_commodity_table *table;
gnc_commodity_namespace *nsp;
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
if (!cm) return;
priv = GET_PRIVATE(cm);
@@ -1286,7 +1284,7 @@ gnc_commodity_set_namespace(gnc_commodity * cm, const char * name_space)
void
gnc_commodity_set_fullname(gnc_commodity * cm, const char * fullname)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
if (!cm) return;
priv = GET_PRIVATE(cm);
@@ -1309,7 +1307,7 @@ void
gnc_commodity_set_cusip(gnc_commodity * cm,
const char * cusip)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
if (!cm) return;
@@ -1374,7 +1372,7 @@ gnc_commodity_set_auto_quote_control_flag(gnc_commodity *cm,
void
gnc_commodity_user_set_quote_flag(gnc_commodity *cm, const gboolean flag)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
ENTER ("(cm=%p, flag=%d)", cm, flag);
@@ -1444,7 +1442,7 @@ gnc_commodity_set_quote_source(gnc_commodity *cm, gnc_quote_source *src)
void
gnc_commodity_set_quote_tz(gnc_commodity *cm, const char *tz)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
if (!cm) return;
@@ -1525,7 +1523,7 @@ gnc_commodity_set_default_symbol(gnc_commodity * cm,
void
gnc_commodity_increment_usage_count(gnc_commodity *cm)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
ENTER("(cm=%p)", cm);
@@ -1560,7 +1558,7 @@ gnc_commodity_increment_usage_count(gnc_commodity *cm)
void
gnc_commodity_decrement_usage_count(gnc_commodity *cm)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
ENTER("(cm=%p)", cm);
@@ -1603,8 +1601,8 @@ gnc_commodity_decrement_usage_count(gnc_commodity *cm)
gboolean
gnc_commodity_equiv(const gnc_commodity * a, const gnc_commodity * b)
{
- CommodityPrivate* priv_a;
- CommodityPrivate* priv_b;
+ gnc_commodityPrivate* priv_a;
+ gnc_commodityPrivate* priv_b;
if (a == b) return TRUE;
if (!a || !b) return FALSE;
@@ -1619,8 +1617,8 @@ gnc_commodity_equiv(const gnc_commodity * a, const gnc_commodity * b)
gboolean
gnc_commodity_equal(const gnc_commodity * a, const gnc_commodity * b)
{
- CommodityPrivate* priv_a;
- CommodityPrivate* priv_b;
+ gnc_commodityPrivate* priv_a;
+ gnc_commodityPrivate* priv_b;
gboolean same_book;
if (a == b) return TRUE;
@@ -1935,7 +1933,7 @@ gnc_commodity_table_insert(gnc_commodity_table * table,
gnc_commodity_namespace * nsp = NULL;
gnc_commodity *c;
const char *ns_name;
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
QofBook *book;
if (!table) return NULL;
@@ -2015,7 +2013,7 @@ gnc_commodity_table_remove(gnc_commodity_table * table,
{
gnc_commodity_namespace * nsp;
gnc_commodity *c;
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
const char *ns_name;
if (!table) return;
@@ -2125,7 +2123,7 @@ gnc_commodity_table_get_namespaces_list(const gnc_commodity_table * table)
gboolean
gnc_commodity_is_iso(const gnc_commodity * cm)
{
- CommodityPrivate* priv;
+ gnc_commodityPrivate* priv;
if (!cm) return FALSE;
@@ -2196,7 +2194,7 @@ static void
get_quotables_helper1(gpointer key, gpointer value, gpointer data)
{
gnc_commodity *comm = value;
- CommodityPrivate* priv = GET_PRIVATE(comm);
+ gnc_commodityPrivate* priv = GET_PRIVATE(comm);
GList ** l = data;
if (!priv->quote_flag ||
@@ -2209,7 +2207,7 @@ static gboolean
get_quotables_helper2 (gnc_commodity *comm, gpointer data)
{
GList ** l = data;
- CommodityPrivate* priv = GET_PRIVATE(comm);
+ gnc_commodityPrivate* priv = GET_PRIVATE(comm);
if (!priv->quote_flag ||
!priv->quote_source || !priv->quote_source->supported)
diff --git a/libgnucash/engine/gnc-lot.c b/libgnucash/engine/gnc-lot.c
index 7df4483db..a0afc0481 100644
--- a/libgnucash/engine/gnc-lot.c
+++ b/libgnucash/engine/gnc-lot.c
@@ -75,7 +75,7 @@ enum
PROP_MARKER, /* Runtime */
};
-typedef struct LotPrivate
+typedef struct GNCLotPrivate
{
/* Account to which this lot applies. All splits in the lot must
* belong to this account.
@@ -92,22 +92,22 @@ typedef struct LotPrivate
/* traversal marker, handy for preventing recursion */
unsigned char marker;
-} LotPrivate;
+} GNCLotPrivate;
#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE((o), GNC_TYPE_LOT, LotPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE((o), GNC_TYPE_LOT, GNCLotPrivate))
#define gnc_lot_set_guid(L,G) qof_instance_set_guid(QOF_INSTANCE(L),&(G))
/* ============================================================= */
/* GObject Initialization */
-G_DEFINE_TYPE(GNCLot, gnc_lot, QOF_TYPE_INSTANCE)
+G_DEFINE_TYPE_WITH_PRIVATE(GNCLot, gnc_lot, QOF_TYPE_INSTANCE)
static void
gnc_lot_init(GNCLot* lot)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
priv = GET_PRIVATE(lot);
priv->account = NULL;
@@ -132,7 +132,7 @@ static void
gnc_lot_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
{
GNCLot* lot;
- LotPrivate* priv;
+ GNCLotPrivate* priv;
gchar *key;
g_return_if_fail(GNC_IS_LOT(object));
@@ -169,7 +169,7 @@ gnc_lot_set_property (GObject* object,
GParamSpec* pspec)
{
GNCLot* lot;
- LotPrivate* priv;
+ GNCLotPrivate* priv;
gchar *key = NULL;
g_return_if_fail(GNC_IS_LOT(object));
@@ -212,8 +212,6 @@ gnc_lot_class_init(GNCLotClass* klass)
gobject_class->get_property = gnc_lot_get_property;
gobject_class->set_property = gnc_lot_set_property;
- g_type_class_add_private(klass, sizeof(LotPrivate));
-
g_object_class_install_property(
gobject_class,
PROP_IS_CLOSED,
@@ -277,7 +275,7 @@ static void
gnc_lot_free(GNCLot* lot)
{
GList *node;
- LotPrivate* priv;
+ GNCLotPrivate* priv;
if (!lot) return;
ENTER ("(lot=%p)", lot);
@@ -364,7 +362,7 @@ gnc_lot_get_book (GNCLot *lot)
gboolean
gnc_lot_is_closed (GNCLot *lot)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
if (!lot) return TRUE;
priv = GET_PRIVATE(lot);
if (0 > priv->is_closed) gnc_lot_get_balance (lot);
@@ -374,7 +372,7 @@ gnc_lot_is_closed (GNCLot *lot)
Account *
gnc_lot_get_account (const GNCLot *lot)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
if (!lot) return NULL;
priv = GET_PRIVATE(lot);
return priv->account;
@@ -385,7 +383,7 @@ gnc_lot_set_account(GNCLot* lot, Account* account)
{
if (lot != NULL)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
priv = GET_PRIVATE(lot);
priv->account = account;
}
@@ -394,7 +392,7 @@ gnc_lot_set_account(GNCLot* lot, Account* account)
void
gnc_lot_set_closed_unknown(GNCLot* lot)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
if (lot != NULL)
{
priv = GET_PRIVATE(lot);
@@ -405,7 +403,7 @@ gnc_lot_set_closed_unknown(GNCLot* lot)
SplitList *
gnc_lot_get_split_list (const GNCLot *lot)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
if (!lot) return NULL;
priv = GET_PRIVATE(lot);
return priv->splits;
@@ -413,7 +411,7 @@ gnc_lot_get_split_list (const GNCLot *lot)
gint gnc_lot_count_splits (const GNCLot *lot)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
if (!lot) return 0;
priv = GET_PRIVATE(lot);
return g_list_length (priv->splits);
@@ -475,7 +473,7 @@ gnc_lot_set_notes (GNCLot *lot, const char *str)
gnc_numeric
gnc_lot_get_balance (GNCLot *lot)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
GList *node;
gnc_numeric zero = gnc_numeric_zero();
gnc_numeric baln = zero;
@@ -518,7 +516,7 @@ void
gnc_lot_get_balance_before (const GNCLot *lot, const Split *split,
gnc_numeric *amount, gnc_numeric *value)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
GList *node;
gnc_numeric zero = gnc_numeric_zero();
gnc_numeric amt = zero;
@@ -567,7 +565,7 @@ gnc_lot_get_balance_before (const GNCLot *lot, const Split *split,
void
gnc_lot_add_split (GNCLot *lot, Split *split)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
Account * acc;
if (!lot || !split) return;
priv = GET_PRIVATE(lot);
@@ -619,7 +617,7 @@ gnc_lot_add_split (GNCLot *lot, Split *split)
void
gnc_lot_remove_split (GNCLot *lot, Split *split)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
if (!lot || !split) return;
priv = GET_PRIVATE(lot);
@@ -646,7 +644,7 @@ gnc_lot_remove_split (GNCLot *lot, Split *split)
Split *
gnc_lot_get_earliest_split (GNCLot *lot)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
if (!lot) return NULL;
priv = GET_PRIVATE(lot);
if (! priv->splits) return NULL;
@@ -658,7 +656,7 @@ gnc_lot_get_earliest_split (GNCLot *lot)
Split *
gnc_lot_get_latest_split (GNCLot *lot)
{
- LotPrivate* priv;
+ GNCLotPrivate* priv;
SplitList *node;
if (!lot) return NULL;
commit 2cfc61182e9e5cc3863560fbf15581736f5e9a03
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Wed Dec 5 20:56:11 2018 +0100
directly use G_DEFINE_TYPE instead of QOF_GOBJECT_GET_TYPE
diff --git a/libgnucash/engine/qofbook.cpp b/libgnucash/engine/qofbook.cpp
index 2df7bf608..3991e96d6 100644
--- a/libgnucash/engine/qofbook.cpp
+++ b/libgnucash/engine/qofbook.cpp
@@ -107,7 +107,7 @@ qof_book_option_num_autoreadonly_changed_cb (GObject *gobject,
#define PARAM_NAME_NUM_FIELD_SOURCE "split-action-num-field"
#define PARAM_NAME_NUM_AUTOREAD_ONLY "autoreadonly-days"
-QOF_GOBJECT_GET_TYPE(QofBook, qof_book, QOF_TYPE_INSTANCE, {});
+G_DEFINE_TYPE(QofBook, qof_book, QOF_TYPE_INSTANCE);
QOF_GOBJECT_DISPOSE(qof_book);
QOF_GOBJECT_FINALIZE(qof_book);
commit 1bfcc959988c642f59235dfb786d69b5b119f1f7
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Wed Dec 5 19:46:34 2018 +0100
directly use G_DEFINE_TYPE_WITH_PRIVATE instead of QOF_GOBJECT_GET_TYPE
diff --git a/libgnucash/engine/qofinstance.cpp b/libgnucash/engine/qofinstance.cpp
index c9588e89f..34a6c5bbc 100644
--- a/libgnucash/engine/qofinstance.cpp
+++ b/libgnucash/engine/qofinstance.cpp
@@ -114,7 +114,7 @@ typedef struct QofInstancePrivate
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), QOF_TYPE_INSTANCE, QofInstancePrivate))
-QOF_GOBJECT_GET_TYPE(QofInstance, qof_instance, G_TYPE_OBJECT, G_ADD_PRIVATE(QofInstance));
+G_DEFINE_TYPE_WITH_PRIVATE(QofInstance, qof_instance, G_TYPE_OBJECT);
QOF_GOBJECT_FINALIZE(qof_instance);
#undef G_PARAM_READWRITE
#define G_PARAM_READWRITE static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_WRITABLE)
commit 658da08008b1fdce90054ae3e9bda304de10cc8c
Author: Christoph Holtermann <c.holtermann at gmx.de>
Date: Tue Dec 4 19:57:11 2018 +0100
replace deprecated g_type_class_add_private
diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp
index 3d60cdfd0..b6eed3b98 100644
--- a/libgnucash/engine/Account.cpp
+++ b/libgnucash/engine/Account.cpp
@@ -252,7 +252,7 @@ mark_account (Account *acc)
\********************************************************************/
/* GObject Initialization */
-G_DEFINE_TYPE(Account, gnc_account, QOF_TYPE_INSTANCE)
+G_DEFINE_TYPE_WITH_PRIVATE(Account, gnc_account, QOF_TYPE_INSTANCE)
static void
gnc_account_init(Account* acc)
@@ -577,8 +577,6 @@ gnc_account_class_init (AccountClass *klass)
gobject_class->set_property = gnc_account_set_property;
gobject_class->get_property = gnc_account_get_property;
- g_type_class_add_private(klass, sizeof(AccountPrivate));
-
g_object_class_install_property
(gobject_class,
PROP_NAME,
diff --git a/libgnucash/engine/qofinstance.cpp b/libgnucash/engine/qofinstance.cpp
index 9b3058dcc..c9588e89f 100644
--- a/libgnucash/engine/qofinstance.cpp
+++ b/libgnucash/engine/qofinstance.cpp
@@ -114,7 +114,7 @@ typedef struct QofInstancePrivate
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), QOF_TYPE_INSTANCE, QofInstancePrivate))
-QOF_GOBJECT_GET_TYPE(QofInstance, qof_instance, G_TYPE_OBJECT, {});
+QOF_GOBJECT_GET_TYPE(QofInstance, qof_instance, G_TYPE_OBJECT, G_ADD_PRIVATE(QofInstance));
QOF_GOBJECT_FINALIZE(qof_instance);
#undef G_PARAM_READWRITE
#define G_PARAM_READWRITE static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_WRITABLE)
@@ -136,8 +136,6 @@ static void qof_instance_class_init(QofInstanceClass *klass)
object_class->set_property = qof_instance_set_property;
object_class->get_property = qof_instance_get_property;
- g_type_class_add_private(klass, sizeof(QofInstancePrivate));
-
klass->get_display_name = NULL;
klass->refers_to_object = NULL;
klass->get_typed_referring_object_list = NULL;
Summary of changes:
gnucash/gnome-search/gnc-general-search.c | 38 +----
gnucash/gnome-search/search-account.c | 33 +---
gnucash/gnome-search/search-boolean.c | 32 +---
gnucash/gnome-search/search-core-type.c | 30 +---
gnucash/gnome-search/search-date.c | 32 +---
gnucash/gnome-search/search-double.c | 32 +---
gnucash/gnome-search/search-int64.c | 32 +---
gnucash/gnome-search/search-numeric.c | 32 +---
gnucash/gnome-search/search-reconciled.c | 32 +---
gnucash/gnome-search/search-string.c | 32 +---
gnucash/gnome-utils/gnc-combott.c | 88 ++++------
gnucash/gnome-utils/gnc-currency-edit.c | 38 +----
gnucash/gnome-utils/gnc-date-format.c | 73 +++-----
gnucash/gnome-utils/gnc-embedded-window.c | 60 ++-----
gnucash/gnome-utils/gnc-gobject-utils.h | 56 +++++++
gnucash/gnome-utils/gnc-main-window.c | 183 +++++++--------------
gnucash/gnome-utils/gnc-period-select.c | 35 +---
gnucash/gnome-utils/gnc-plugin-file-history.c | 34 +---
gnucash/gnome-utils/gnc-plugin-manager.c | 31 +---
gnucash/gnome-utils/gnc-plugin-menu-additions.c | 30 +---
gnucash/gnome-utils/gnc-plugin-page.c | 45 +----
gnucash/gnome-utils/gnc-plugin.c | 43 +----
gnucash/gnome-utils/gnc-query-view.c | 45 +----
gnucash/gnome-utils/gnc-tree-model-account-types.c | 44 +----
gnucash/gnome-utils/gnc-tree-model-account.c | 44 +----
gnucash/gnome-utils/gnc-tree-model-commodity.c | 44 +----
gnucash/gnome-utils/gnc-tree-model-owner.c | 46 +-----
gnucash/gnome-utils/gnc-tree-model-price.c | 44 +----
gnucash/gnome-utils/gnc-tree-model-selection.c | 44 +----
gnucash/gnome-utils/gnc-tree-model.c | 53 ++----
gnucash/gnome-utils/gnc-tree-view-account.c | 30 +---
gnucash/gnome-utils/gnc-tree-view-commodity.c | 30 +---
gnucash/gnome-utils/gnc-tree-view-owner.c | 30 +---
gnucash/gnome-utils/gnc-tree-view-price.c | 30 +---
gnucash/gnome-utils/gnc-tree-view-split-reg.c | 30 +---
gnucash/gnome-utils/gnc-tree-view-sx-list.c | 30 +---
gnucash/gnome-utils/gnc-tree-view.c | 49 ++----
gnucash/gnome-utils/search-param.c | 84 +---------
gnucash/gnome/gnc-budget-view.c | 6 +-
gnucash/gnome/gnc-plugin-account-tree.c | 37 +----
gnucash/gnome/gnc-plugin-basic-commands.c | 35 +---
gnucash/gnome/gnc-plugin-budget.c | 30 +---
gnucash/gnome/gnc-plugin-business.c | 32 +---
gnucash/gnome/gnc-plugin-page-account-tree.c | 37 +----
gnucash/gnome/gnc-plugin-page-budget.c | 34 +---
gnucash/gnome/gnc-plugin-page-invoice.c | 32 +---
gnucash/gnome/gnc-plugin-page-owner-tree.c | 31 +---
gnucash/gnome/gnc-plugin-page-register.c | 32 +---
gnucash/gnome/gnc-plugin-page-register2.c | 32 +---
gnucash/gnome/gnc-plugin-page-sx-list.c | 33 +---
gnucash/gnome/gnc-plugin-register.c | 32 +---
gnucash/gnome/gnc-plugin-register2.c | 32 +---
gnucash/gnome/search-owner.c | 32 +---
.../import-export/csv-exp/gnc-plugin-csv-export.c | 32 +---
.../import-export/csv-imp/gnc-plugin-csv-import.c | 32 +---
.../log-replay/gnc-plugin-log-replay.c | 32 +---
gnucash/import-export/ofx/gnc-plugin-ofx.c | 32 +---
.../import-export/qif-imp/gnc-plugin-qif-import.c | 32 +---
.../report/report-gnome/gnc-plugin-page-report.c | 32 +---
.../report/stylesheets/gnc-plugin-stylesheets.c | 32 +---
libgnucash/engine/Account.cpp | 4 +-
libgnucash/engine/gnc-budget.c | 24 ++-
libgnucash/engine/gnc-commodity.c | 64 ++++---
libgnucash/engine/gnc-lot.c | 42 +++--
libgnucash/engine/qofbook.cpp | 2 +-
libgnucash/engine/qofinstance.cpp | 4 +-
66 files changed, 384 insertions(+), 2165 deletions(-)
More information about the gnucash-changes
mailing list