gnome-utils r8156 - trunk/logview



Author: cosimoc
Date: Wed Oct 22 11:24:02 2008
New Revision: 8156
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=8156&view=rev

Log:
Use g_type_class_add_private ().

Modified:
   trunk/logview/calendar.c
   trunk/logview/calendar.h
   trunk/logview/loglist.c
   trunk/logview/logview-findbar.c

Modified: trunk/logview/calendar.c
==============================================================================
--- trunk/logview/calendar.c	(original)
+++ trunk/logview/calendar.c	Wed Oct 22 11:24:02 2008
@@ -25,6 +25,9 @@
 #include "calendar.h"
 
 G_DEFINE_TYPE (Calendar, calendar, GTK_TYPE_CALENDAR);
+#define CALENDAR_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), CALENDAR_TYPE, CalendarPriv))
+
 
 struct CalendarPriv
 {
@@ -162,7 +165,7 @@
     PangoContext *context;
     int size;
 
-    calendar->priv = g_new0 (CalendarPriv, 1);
+    calendar->priv = CALENDAR_GET_PRIVATE (calendar);
     
     context = gtk_widget_get_pango_context (GTK_WIDGET (calendar));
     fontdesc = pango_context_get_font_description (context);
@@ -172,18 +175,9 @@
 }
 
 static void
-calendar_class_finalize (GObject *object)
-{
-    Calendar *calendar = CALENDAR (object);
-    g_free (calendar->priv);
-    G_OBJECT_CLASS (calendar_parent_class)->finalize (object);
-}
-
-static void
 calendar_class_init (CalendarClass *klass)
 {
-    GObjectClass *object_class = (GObjectClass *) klass;
-    object_class->finalize = calendar_class_finalize;
+    g_type_class_add_private (klass, sizeof (CalendarPriv));
 }
 
 GtkWidget *

Modified: trunk/logview/calendar.h
==============================================================================
--- trunk/logview/calendar.h	(original)
+++ trunk/logview/calendar.h	Wed Oct 22 11:24:02 2008
@@ -36,8 +36,6 @@
 {	
 	GtkCalendar parent_instance;
 	CalendarPriv *priv;
-	GSList *days;
-	gboolean first_pass;
 } Calendar;
 
 typedef struct CalendarClass

Modified: trunk/logview/loglist.c
==============================================================================
--- trunk/logview/loglist.c	(original)
+++ trunk/logview/loglist.c	Wed Oct 22 11:24:02 2008
@@ -36,6 +36,9 @@
 };
 
 G_DEFINE_TYPE (LogList, loglist, GTK_TYPE_TREE_VIEW);
+#define LOG_LIST_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOG_LIST_TYPE, LogListPriv))
+
 
 static GtkTreePath *
 loglist_find_directory (LogList *list, gchar *dir)
@@ -275,7 +278,7 @@
     GtkTreeSelection *selection;
     GtkCellRenderer *cell;
 
-    list->priv = g_new0 (LogListPriv, 1);
+    list->priv = LOG_LIST_GET_PRIVATE (list); 
 
     model = gtk_tree_store_new (4, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_BOOLEAN);
     gtk_tree_view_set_model (GTK_TREE_VIEW (list), GTK_TREE_MODEL (model));
@@ -301,18 +304,9 @@
 }
 
 static void
-loglist_finalize (GObject *object)
-{
-	LogList *list = LOG_LIST (object);
-	g_free (list->priv);
-	G_OBJECT_CLASS (loglist_parent_class)->finalize (object);
-}
-
-static void
 loglist_class_init (LogListClass *klass)
 {
-	GObjectClass *object_class = (GObjectClass *) klass;
-	object_class->finalize = loglist_finalize;
+    g_type_class_add_private (klass, sizeof (LogListPriv));
 }
 
 GtkWidget *

Modified: trunk/logview/logview-findbar.c
==============================================================================
--- trunk/logview/logview-findbar.c	(original)
+++ trunk/logview/logview-findbar.c	Wed Oct 22 11:24:02 2008
@@ -32,6 +32,9 @@
 };
 
 G_DEFINE_TYPE (LogviewFindBar, logview_findbar, GTK_TYPE_HBOX);
+#define LOGVIEW_FINDBAR_GET_PRIVATE(o)  \
+   (G_TYPE_INSTANCE_GET_PRIVATE ((o), LOGVIEW_FINDBAR_TYPE, LogviewFindBarPriv))
+
 
 static gboolean
 iter_is_visible (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
@@ -143,8 +146,8 @@
 logview_findbar_init (LogviewFindBar *findbar)
 {
 	GtkWidget *label, *button;
-	
-	findbar->priv = g_new0 (LogviewFindBarPriv, 1);
+
+	findbar->priv = LOGVIEW_FINDBAR_GET_PRIVATE (findbar);
 
 	gtk_container_set_border_width (GTK_CONTAINER (findbar), 3);
 
@@ -163,20 +166,9 @@
 }
 
 static void
-logview_findbar_finalize (GObject *object)
-{
-	LogviewFindBar *findbar = LOGVIEW_FINDBAR (object);
-
-	g_free (findbar->priv);
-	G_OBJECT_CLASS (logview_findbar_parent_class)->finalize (object);
-}
-
-static void
 logview_findbar_class_init (LogviewFindBarClass *klass)
 {
-	GObjectClass *object_class = (GObjectClass *) klass;
-
-	object_class->finalize = logview_findbar_finalize;
+	g_type_class_add_private (klass, sizeof (LogviewFindBarPriv));
 }
 
 GtkWidget *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]