aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/defaults.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-02-21 15:47:40 -0600
committerTed Gould <ted@gould.cx>2011-02-21 15:47:40 -0600
commit1c1171f7a84e37dd96385cea1600465350217ae0 (patch)
tree2fc20568b3a2217e0bb3674a125074e79d1a98ef /libdbusmenu-glib/defaults.c
parent0d6f893deda7eebefab68be2b7566e8033f2be48 (diff)
downloadlibdbusmenu-1c1171f7a84e37dd96385cea1600465350217ae0.tar.gz
libdbusmenu-1c1171f7a84e37dd96385cea1600465350217ae0.tar.bz2
libdbusmenu-1c1171f7a84e37dd96385cea1600465350217ae0.zip
Fleshing out the ref_default
Diffstat (limited to 'libdbusmenu-glib/defaults.c')
-rw-r--r--libdbusmenu-glib/defaults.c22
1 files changed, 20 insertions, 2 deletions
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;
+}