[evolution] Convert ECell from a GtkObject to a GObject.



commit 4c13763c5eab1013f6abab234f77fa06e4502652
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Sep 11 08:05:14 2010 -0400

    Convert ECell from a GtkObject to a GObject.
    
    To eliminate the floating-reference-on-finalize run-time warnings.

 widgets/table/e-cell-date-edit.c |   39 +++++++++++++++++--------------------
 widgets/table/e-cell-popup.c     |    3 --
 widgets/table/e-cell-text.c      |    4 +--
 widgets/table/e-cell.c           |    2 +-
 widgets/table/e-cell.h           |    4 +-
 5 files changed, 22 insertions(+), 30 deletions(-)
---
diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c
index cab6c81..c15ccce 100644
--- a/widgets/table/e-cell-date-edit.c
+++ b/widgets/table/e-cell-date-edit.c
@@ -48,7 +48,6 @@
 /* This depends on ECalendar which is why I didn't put it in gal. */
 #include <misc/e-calendar.h>
 
-static void e_cell_date_edit_destroy		(GtkObject	*object);
 static void e_cell_date_edit_get_property	(GObject	*object,
 						 guint		 property_id,
 						 GValue		*value,
@@ -57,6 +56,7 @@ static void e_cell_date_edit_set_property	(GObject	*object,
 						 guint		 property_id,
 						 const GValue	*value,
 						 GParamSpec	*pspec);
+static void e_cell_date_edit_dispose		(GObject	*object);
 
 static gint e_cell_date_edit_do_popup		(ECellPopup	*ecp,
 						 GdkEvent	*event,
@@ -117,15 +117,12 @@ static void
 e_cell_date_edit_class_init (ECellDateEditClass *class)
 {
 	GObjectClass *object_class;
-	GtkObjectClass *gtk_object_class;
 	ECellPopupClass	*ecpc;
 
 	object_class = G_OBJECT_CLASS (class);
 	object_class->get_property = e_cell_date_edit_get_property;
 	object_class->set_property = e_cell_date_edit_set_property;
-
-	gtk_object_class = GTK_OBJECT_CLASS (class);
-	gtk_object_class->destroy = e_cell_date_edit_destroy;
+	object_class->dispose = e_cell_date_edit_dispose;
 
 	ecpc = E_CELL_POPUP_CLASS (class);
 	ecpc->popup = e_cell_date_edit_do_popup;
@@ -355,22 +352,6 @@ e_cell_date_edit_new			(void)
 	return g_object_new (e_cell_date_edit_get_type (), NULL);
 }
 
-/*
- * GtkObject::destroy method
- */
-static void
-e_cell_date_edit_destroy		(GtkObject *object)
-{
-	ECellDateEdit *ecde = E_CELL_DATE_EDIT (object);
-
-	e_cell_date_edit_set_get_time_callback (ecde, NULL, NULL, NULL);
-
-	gtk_widget_destroy (ecde->popup_window);
-	ecde->popup_window = NULL;
-
-	GTK_OBJECT_CLASS (e_cell_date_edit_parent_class)->destroy (object);
-}
-
 static void
 e_cell_date_edit_get_property		(GObject	*object,
 					 guint		 property_id,
@@ -480,6 +461,22 @@ e_cell_date_edit_set_property		(GObject	*object,
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 }
 
+static void
+e_cell_date_edit_dispose (GObject *object)
+{
+	ECellDateEdit *ecde = E_CELL_DATE_EDIT (object);
+
+	e_cell_date_edit_set_get_time_callback (ecde, NULL, NULL, NULL);
+
+	if (ecde->popup_window != NULL) {
+		gtk_widget_destroy (ecde->popup_window);
+		ecde->popup_window = NULL;
+	}
+
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (e_cell_date_edit_parent_class)->dispose (object);
+}
+
 static gint
 e_cell_date_edit_do_popup		(ECellPopup	*ecp,
 					 GdkEvent	*event,
diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c
index 32de41e..e918e7f 100644
--- a/widgets/table/e-cell-popup.c
+++ b/widgets/table/e-cell-popup.c
@@ -156,9 +156,6 @@ e_cell_popup_new		(void)
 	return (ECell*) ecp;
 }
 
-/*
- * GtkObject::destroy method
- */
 static void
 e_cell_popup_dispose (GObject *object)
 {
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 3c9a2c7..1c0cb71 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -1481,9 +1481,6 @@ ect_max_width_by_row (ECellView *ecell_view,
 	return width + 8;
 }
 
-/*
- * GtkObject::destroy method
- */
 static void
 ect_finalize (GObject *object)
 {
@@ -1493,6 +1490,7 @@ ect_finalize (GObject *object)
 
 	G_OBJECT_CLASS (e_cell_text_parent_class)->finalize (object);
 }
+
 /* Set_arg handler for the text item */
 static void
 ect_set_property (GObject *object,
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
index 1c4b64f..6833ccf 100644
--- a/widgets/table/e-cell.c
+++ b/widgets/table/e-cell.c
@@ -28,7 +28,7 @@
 
 #include "e-cell.h"
 
-G_DEFINE_TYPE (ECell, e_cell, GTK_TYPE_OBJECT)
+G_DEFINE_TYPE (ECell, e_cell, G_TYPE_OBJECT)
 
 #define ECVIEW_EC_CLASS(v) (E_CELL_GET_CLASS (v->ecell))
 
diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h
index 63fa8e2..f38e47b 100644
--- a/widgets/table/e-cell.h
+++ b/widgets/table/e-cell.h
@@ -66,7 +66,7 @@ typedef enum {
 } ECellActions;
 
 typedef struct {
-	GtkObject       object;
+	GObject parent;
 } ECell;
 
 typedef struct _ECellView {
@@ -84,7 +84,7 @@ typedef struct _ECellView {
 #define E_CELL_IS_FOCUSED(ecell_view) (ecell_view->focus_x1 != -1)
 
 typedef struct {
-	GtkObjectClass parent_class;
+	GObjectClass parent_class;
 
 	ECellView *(*new_view)         (ECell *ecell, ETableModel *table_model, gpointer e_table_item_view);
 	void       (*kill_view)        (ECellView *ecell_view);



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