From 1c1171f7a84e37dd96385cea1600465350217ae0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 21 Feb 2011 15:47:40 -0600 Subject: Fleshing out the ref_default --- libdbusmenu-glib/defaults.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/defaults.c') diff --git a/libdbusmenu-glib/defaults.c b/libdbusmenu-glib/defaults.c index af86a90..a6dd4a2 100644 --- a/libdbusmenu-glib/defaults.c +++ b/libdbusmenu-glib/defaults.c @@ -32,8 +32,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "defaults.h" -typedef struct _DbusmenuDefaultsPrivate DbusmenuDefaultsPrivate; - struct _DbusmenuDefaultsPrivate { GHashTable * types; }; @@ -82,3 +80,23 @@ dbusmenu_defaults_finalize (GObject *object) G_OBJECT_CLASS (dbusmenu_defaults_parent_class)->finalize (object); return; } + +static DbusmenuDefaults * default_defaults = NULL; + +/** + * dbusmenu_defaults_ref_default: + * + * Get a reference to the default instance. If it doesn't exist this + * function will create it. + * + * Return value: (transfer full): A reference to the defaults + */ +DbusmenuDefaults * +dbusmenu_defaults_ref_default (void) +{ + if (default_defaults == NULL) { + default_defaults = DBUSMENU_DEFAULTS(g_object_new(DBUSMENU_TYPE_DEFAULTS, NULL)); + } + + return default_defaults; +} -- cgit v1.2.3