[cheese/gnome-2-28] Make CheeseFileUtil a singleton
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [cheese/gnome-2-28] Make CheeseFileUtil a singleton
- Date: Mon, 30 Nov 2009 18:56:31 +0000 (UTC)
commit f241451e34f6c73c6ac67495880ceca5ac787d99
Author: Bastien Nocera <hadess hadess net>
Date: Fri Nov 27 16:53:39 2009 +0000
Make CheeseFileUtil a singleton
And save even more RAM! And polar bears!
https://bugzilla.gnome.org/show_bug.cgi?id=603162
src/cheese-fileutil.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/cheese-fileutil.c b/src/cheese-fileutil.c
index f18e6a5..4a6f410 100644
--- a/src/cheese-fileutil.c
+++ b/src/cheese-fileutil.c
@@ -205,8 +205,13 @@ cheese_fileutil_init (CheeseFileUtil *fileutil)
CheeseFileUtil *
cheese_fileutil_new ()
{
- CheeseFileUtil *fileutil;
+ static CheeseFileUtil *fileutil = NULL;
+
+ if (fileutil != NULL)
+ return g_object_ref (fileutil);
fileutil = g_object_new (CHEESE_TYPE_FILEUTIL, NULL);
+ g_object_add_weak_pointer (G_OBJECT (fileutil),
+ (gpointer) &fileutil);
return fileutil;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]