[cheese] Make CheeseGConf a singleton object
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [cheese] Make CheeseGConf a singleton object
- Date: Mon, 30 Nov 2009 18:57:04 +0000 (UTC)
commit 7bb031c3c848c5b6fe4ffb78b30542db86e250fe
Author: Bastien Nocera <hadess hadess net>
Date: Fri Nov 27 16:49:43 2009 +0000
Make CheeseGConf a singleton object
Thus saving us some RAM by avoiding 2 copies of an object that
does the exact same thing.
https://bugzilla.gnome.org/show_bug.cgi?id=603161
src/cheese-gconf.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/cheese-gconf.c b/src/cheese-gconf.c
index 015e8e1..b3e2c64 100644
--- a/src/cheese-gconf.c
+++ b/src/cheese-gconf.c
@@ -493,8 +493,14 @@ cheese_gconf_init (CheeseGConf *gconf)
CheeseGConf *
cheese_gconf_new ()
{
- CheeseGConf *gconf;
+ static CheeseGConf *gconf = NULL;
+
+ if (gconf != NULL)
+ return g_object_ref (gconf);
gconf = g_object_new (CHEESE_TYPE_GCONF, NULL);
+ g_object_add_weak_pointer (G_OBJECT (gconf),
+ (gpointer) &gconf);
+
return gconf;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]