diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-11-14 06:53:58 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-11-14 06:53:58 +0800 |
commit | d023f5d548b85095292e2491eda6c9b0a5f83aae (patch) | |
tree | c27e2528ea7e3a47cd27a0b5144bd64ed6637ddb | |
parent | 5bf1afd678c6407c7018ae8addda74e0c4040811 (diff) | |
download | gsoc2013-evolution-d023f5d548b85095292e2491eda6c9b0a5f83aae.tar gsoc2013-evolution-d023f5d548b85095292e2491eda6c9b0a5f83aae.tar.gz gsoc2013-evolution-d023f5d548b85095292e2491eda6c9b0a5f83aae.tar.bz2 gsoc2013-evolution-d023f5d548b85095292e2491eda6c9b0a5f83aae.tar.lz gsoc2013-evolution-d023f5d548b85095292e2491eda6c9b0a5f83aae.tar.xz gsoc2013-evolution-d023f5d548b85095292e2491eda6c9b0a5f83aae.tar.zst gsoc2013-evolution-d023f5d548b85095292e2491eda6c9b0a5f83aae.zip |
menus/gal-view-menus.h GObjectified.
* menus/gal-view-menus.h
* menus/gal-view-menus.c: GObjectified.
* e-timezone-dialog/e-timezone-dialog.h
* e-timezone-dialog/e-timezone-dialog.c: GObjectified.
svn path=/trunk/; revision=18747
-rw-r--r-- | widgets/ChangeLog | 16 | ||||
-rw-r--r-- | widgets/e-timezone-dialog/e-timezone-dialog.c | 103 | ||||
-rw-r--r-- | widgets/e-timezone-dialog/e-timezone-dialog.h | 4 | ||||
-rw-r--r-- | widgets/menus/gal-view-menus.c | 66 | ||||
-rw-r--r-- | widgets/menus/gal-view-menus.h | 7 |
5 files changed, 98 insertions, 98 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog index d07bb2fc78..3ca6f51a1c 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,5 +1,21 @@ 2002-11-13 Ettore Perazzoli <ettore@ximian.com> + * menus/gal-view-menus.h + * menus/gal-view-menus.c: GObjectified. + + * e-timezone-dialog/e-timezone-dialog.h + * e-timezone-dialog/e-timezone-dialog.c: GObjectified. + +2002-11-13 Ettore Perazzoli <ettore@ximian.com> + + * e-timezone-dialog/e-timezone-dialog.c + (e_timezone_dialog_destroy): g_object_unref() instead of + gtk_object_unref() on the GladeXML object. + (e_timezone_dialog_construct): Likewise on the ETimezoneDialog + object. + +2002-11-13 Ettore Perazzoli <ettore@ximian.com> + * e-timezone-dialog/e-timezone-dialog.glade: Converted to Glade 2. 2002-11-13 Not Zed <NotZed@Ximian.com> diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c index 88f2af67de..9821717c29 100644 --- a/widgets/e-timezone-dialog/e-timezone-dialog.c +++ b/widgets/e-timezone-dialog/e-timezone-dialog.c @@ -28,8 +28,11 @@ #include <gnome.h> #include <glade/glade.h> #include <widgets/misc/e-map.h> + #include "e-timezone-dialog.h" +#include <gal/util/e-util.h> + #define E_TIMEZONE_DIALOG_MAP_POINT_NORMAL_RGBA 0xc070a0ff #define E_TIMEZONE_DIALOG_MAP_POINT_HOVER_RGBA 0xffff60ff #define E_TIMEZONE_DIALOG_MAP_POINT_SELECTED_1_RGBA 0xff60e0ff @@ -63,7 +66,8 @@ struct _ETimezoneDialogPrivate { static void e_timezone_dialog_class_init (ETimezoneDialogClass *class); static void e_timezone_dialog_init (ETimezoneDialog *etd); -static void e_timezone_dialog_destroy (GtkObject *object); +static void e_timezone_dialog_dispose (GObject *object); +static void e_timezone_dialog_finalize (GObject *object); static gboolean get_widgets (ETimezoneDialog *etd); static gboolean on_map_timeout (gpointer data); @@ -87,44 +91,20 @@ static void on_combo_changed (GtkEditable *entry, ETimezoneDialog *etd); -static GtkObjectClass *parent_class; - - -GtkType -e_timezone_dialog_get_type (void) -{ - static GtkType e_timezone_dialog_type = 0; - - if (!e_timezone_dialog_type) { - static const GtkTypeInfo e_timezone_dialog_info = { - "ETimezoneDialog", - sizeof (ETimezoneDialog), - sizeof (ETimezoneDialogClass), - (GtkClassInitFunc) e_timezone_dialog_class_init, - (GtkObjectInitFunc) e_timezone_dialog_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_timezone_dialog_type = gtk_type_unique (GTK_TYPE_OBJECT, - &e_timezone_dialog_info); - } +static GObjectClass *parent_class; - return e_timezone_dialog_type; -} /* Class initialization function for the event editor */ static void e_timezone_dialog_class_init (ETimezoneDialogClass *class) { - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; + GObjectClass *object_class; - parent_class = gtk_type_class (GTK_TYPE_OBJECT); + object_class = G_OBJECT_CLASS (class); + object_class->dispose = e_timezone_dialog_dispose; + object_class->finalize = e_timezone_dialog_finalize; - object_class->destroy = e_timezone_dialog_destroy; + parent_class = gtk_type_class (G_TYPE_OBJECT); } /* Object initialization function for the event editor */ @@ -133,8 +113,6 @@ e_timezone_dialog_init (ETimezoneDialog *etd) { ETimezoneDialogPrivate *priv; - GTK_OBJECT_UNSET_FLAGS (etd, GTK_FLOATING); - priv = g_new0 (ETimezoneDialogPrivate, 1); etd->priv = priv; @@ -144,9 +122,9 @@ e_timezone_dialog_init (ETimezoneDialog *etd) priv->timeout_id = 0; } -/* Destroy handler for the event editor */ +/* Dispose handler for the event editor */ static void -e_timezone_dialog_destroy (GtkObject *object) +e_timezone_dialog_dispose (GObject *object) { ETimezoneDialog *etd; ETimezoneDialogPrivate *priv; @@ -159,11 +137,10 @@ e_timezone_dialog_destroy (GtkObject *object) priv = etd->priv; /* Destroy the actual dialog. */ - dialog = e_timezone_dialog_get_toplevel (etd); - gtk_widget_destroy (dialog); - - g_free (priv->tzid); - priv->tzid = NULL; + if (dialog != NULL) { + dialog = e_timezone_dialog_get_toplevel (etd); + gtk_widget_destroy (dialog); + } if (priv->timeout_id) { g_source_remove (priv->timeout_id); @@ -171,15 +148,30 @@ e_timezone_dialog_destroy (GtkObject *object) } if (priv->xml) { - gtk_object_unref (GTK_OBJECT (priv->xml)); + g_object_unref (priv->xml); priv->xml = NULL; } + (* G_OBJECT_CLASS (parent_class)->dispose) (object); +} + +/* Finalize handler for the event editor */ +static void +e_timezone_dialog_finalize (GObject *object) +{ + ETimezoneDialog *etd; + ETimezoneDialogPrivate *priv; + + g_return_if_fail (object != NULL); + g_return_if_fail (E_IS_TIMEZONE_DIALOG (object)); + + etd = E_TIMEZONE_DIALOG (object); + priv = etd->priv; + + g_free (priv->tzid); g_free (priv); - etd->priv = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -270,23 +262,18 @@ e_timezone_dialog_construct (ETimezoneDialog *etd) gtk_container_add (GTK_CONTAINER (priv->map_window), map); gtk_widget_show (map); - gtk_signal_connect (GTK_OBJECT (map), "motion-notify-event", - GTK_SIGNAL_FUNC (on_map_motion), etd); - gtk_signal_connect (GTK_OBJECT (map), "leave-notify-event", - GTK_SIGNAL_FUNC (on_map_leave), etd); - gtk_signal_connect (GTK_OBJECT (map), "visibility-notify-event", - GTK_SIGNAL_FUNC (on_map_visibility_changed), etd); - gtk_signal_connect (GTK_OBJECT (map), "button-press-event", - GTK_SIGNAL_FUNC (on_map_button_pressed), etd); + g_signal_connect (map, "motion-notify-event", G_CALLBACK (on_map_motion), etd); + g_signal_connect (map, "leave-notify-event", G_CALLBACK (on_map_leave), etd); + g_signal_connect (map, "visibility-notify-event", G_CALLBACK (on_map_visibility_changed), etd); + g_signal_connect (map, "button-press-event", G_CALLBACK (on_map_button_pressed), etd); - gtk_signal_connect (GTK_OBJECT (GTK_COMBO (priv->timezone_combo)->entry), "changed", - GTK_SIGNAL_FUNC (on_combo_changed), etd); + g_signal_connect (GTK_COMBO (priv->timezone_combo)->entry, "changed", G_CALLBACK (on_combo_changed), etd); return etd; error: - gtk_object_unref (GTK_OBJECT (etd)); + g_object_unref (etd); return NULL; } @@ -330,7 +317,7 @@ e_timezone_dialog_new (void) { ETimezoneDialog *etd; - etd = E_TIMEZONE_DIALOG (gtk_type_new (E_TYPE_TIMEZONE_DIALOG)); + etd = E_TIMEZONE_DIALOG (g_object_new (E_TYPE_TIMEZONE_DIALOG, NULL)); return e_timezone_dialog_construct (E_TIMEZONE_DIALOG (etd)); } @@ -716,3 +703,7 @@ e_timezone_dialog_get_builtin_timezone (const char *display_name) return NULL; } + + +E_MAKE_TYPE (e_timezone_dialog, "ETimezoneDialog", ETimezoneDialog, + e_timezone_dialog_class_init, e_timezone_dialog_init, G_TYPE_OBJECT) diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.h b/widgets/e-timezone-dialog/e-timezone-dialog.h index d261189588..cdcfc91ef4 100644 --- a/widgets/e-timezone-dialog/e-timezone-dialog.h +++ b/widgets/e-timezone-dialog/e-timezone-dialog.h @@ -40,14 +40,14 @@ typedef struct _ETimezoneDialogClass ETimezoneDialogClass; typedef struct _ETimezoneDialogPrivate ETimezoneDialogPrivate; struct _ETimezoneDialog { - GtkObject object; + GObject object; /* Private data */ ETimezoneDialogPrivate *priv; }; struct _ETimezoneDialogClass { - GtkObjectClass parent_class; + GObjectClass parent_class; }; diff --git a/widgets/menus/gal-view-menus.c b/widgets/menus/gal-view-menus.c index 2be45363cb..0652131f3c 100644 --- a/widgets/menus/gal-view-menus.c +++ b/widgets/menus/gal-view-menus.c @@ -42,9 +42,9 @@ typedef struct { int ref_count; } ListenerClosure; -#define PARENT_TYPE (gtk_object_get_type()) +#define PARENT_TYPE G_TYPE_OBJECT -static GtkObjectClass *gvm_parent_class; +static GObjectClass *gvm_parent_class; static void collection_changed (GalViewCollection *collection, GalViewMenus *gvm); static void instance_changed (GalViewInstance *instance, @@ -61,7 +61,7 @@ closure_free (void *data, void *user_data) closure->ref_count --; if (closure->ref_count == 0) { - gtk_object_unref(GTK_OBJECT(closure->instance)); + g_object_unref (closure->instance); bonobo_ui_component_remove_listener (gvm->priv->component, closure->id); g_free (closure); @@ -80,9 +80,9 @@ closure_copy (const void *data, void *user_data) static void remove_listeners (GalViewMenus *gvm) { - if (gvm->priv->listenerClosures) { - gtk_object_unref (GTK_OBJECT(gvm->priv->listenerClosures)); - } + if (gvm->priv->listenerClosures) + g_object_unref (gvm->priv->listenerClosures); + gvm->priv->listenerClosures = NULL; } @@ -96,17 +96,17 @@ remove_instance (GalViewMenus *gvm) { if (gvm->priv->instance) { if (gvm->priv->instance_changed_id != 0) - gtk_signal_disconnect(GTK_OBJECT(gvm->priv->instance), gvm->priv->instance_changed_id); + g_signal_handler_disconnect (gvm->priv->instance, gvm->priv->instance_changed_id); if (gvm->priv->instance->collection && gvm->priv->collection_changed_id != 0) - gtk_signal_disconnect(GTK_OBJECT(gvm->priv->instance->collection), gvm->priv->collection_changed_id); + g_signal_handler_disconnect (gvm->priv->instance->collection, gvm->priv->collection_changed_id); } gvm->priv->instance_changed_id = 0; gvm->priv->collection_changed_id = 0; if (gvm->priv->instance) - gtk_object_unref(GTK_OBJECT(gvm->priv->instance)); + g_object_unref (gvm->priv->instance); remove_listeners(gvm); remove_xml(gvm); @@ -116,7 +116,7 @@ static void add_instance (GalViewMenus *gvm, GalViewInstance *instance) { - gtk_object_ref(GTK_OBJECT(instance)); + g_object_ref (instance); if (gvm->priv->instance != NULL) remove_instance (gvm); @@ -125,24 +125,22 @@ add_instance (GalViewMenus *gvm, gal_view_instance_load (gvm->priv->instance); - gvm->priv->instance_changed_id = gtk_signal_connect - (GTK_OBJECT(instance), "changed", - GTK_SIGNAL_FUNC(instance_changed), gvm); - gvm->priv->collection_changed_id = gtk_signal_connect - (GTK_OBJECT(instance->collection), "changed", - GTK_SIGNAL_FUNC(collection_changed), gvm); - + gvm->priv->instance_changed_id = g_signal_connect (instance, "changed", + G_CALLBACK (instance_changed), gvm); + gvm->priv->collection_changed_id = g_signal_connect (instance->collection, "changed", + G_CALLBACK (collection_changed), gvm); } static void -clear_define_views_dialog (gpointer data) +clear_define_views_dialog (gpointer data, + GObject *where_the_object_was) { GalViewMenus *gvm = GAL_VIEW_MENUS (data); gvm->priv->define_views_dialog = NULL; } static void -gvm_destroy (GtkObject *object) +gvm_finalize (GObject *object) { GalViewMenus *gvm = GAL_VIEW_MENUS (object); @@ -150,23 +148,20 @@ gvm_destroy (GtkObject *object) gal_view_menus_unmerge (gvm, NULL); - if (gvm->priv->define_views_dialog) { - gtk_object_weakunref (GTK_OBJECT (gvm->priv->define_views_dialog), - clear_define_views_dialog, - gvm); - } + if (gvm->priv->define_views_dialog) + g_object_weak_unref (gvm->priv->define_views_dialog, clear_define_views_dialog, gvm); + g_free(gvm->priv); - gvm->priv = NULL; - GTK_OBJECT_CLASS (gvm_parent_class)->destroy (object); + (* G_OBJECT_CLASS (gvm_parent_class)->finalize) (object); } static void -gvm_class_init (GtkObjectClass *klass) +gvm_class_init (GObjectClass *klass) { gvm_parent_class = gtk_type_class (PARENT_TYPE); - klass->destroy = gvm_destroy; + klass->finalize = gvm_finalize; } static void @@ -192,7 +187,7 @@ gal_view_menus_new (GalViewInstance *instance) g_return_val_if_fail (instance != NULL, NULL); g_return_val_if_fail (GAL_IS_VIEW_INSTANCE (instance), NULL); - gvm = gtk_type_new (GAL_VIEW_MENUS_TYPE); + gvm = g_object_new (GAL_VIEW_MENUS_TYPE, NULL); gal_view_menus_construct(gvm, instance); return gvm; @@ -231,12 +226,9 @@ define_views(BonoboUIComponent *component, } else { GtkWidget *dialog = gal_define_views_dialog_new(menus->priv->instance->collection); - gtk_signal_connect(GTK_OBJECT(dialog), "clicked", - GTK_SIGNAL_FUNC(dialog_clicked), menus); + g_signal_connect (dialog, "clicked", G_CALLBACK (dialog_clicked), menus); menus->priv->define_views_dialog = dialog; - gtk_object_weakref (GTK_OBJECT (dialog), - clear_define_views_dialog, - menus); + g_object_weak_ref (G_OBJECT (dialog), clear_define_views_dialog, menus); gtk_widget_show(dialog); } } @@ -332,7 +324,7 @@ build_menus(GalViewMenus *menus) found = TRUE; } - gtk_object_ref (GTK_OBJECT(closure->instance)); + g_object_ref (closure->instance); bonobo_ui_component_add_listener (menus->priv->component, item->id, toggled_cb, closure); e_list_append (menus->priv->listenerClosures, closure); @@ -433,7 +425,7 @@ build_stuff (GalViewMenus *gvm, { char *xml; - gtk_object_ref (GTK_OBJECT (gvm)); + g_object_ref (gvm); gal_view_menus_unmerge (gvm, ev); @@ -447,7 +439,7 @@ build_stuff (GalViewMenus *gvm, set_radio (gvm, ev); - gtk_object_unref (GTK_OBJECT (gvm)); + g_object_unref (gvm); } void diff --git a/widgets/menus/gal-view-menus.h b/widgets/menus/gal-view-menus.h index 2f113975ac..e4de898187 100644 --- a/widgets/menus/gal-view-menus.h +++ b/widgets/menus/gal-view-menus.h @@ -2,11 +2,12 @@ #ifndef _GAL_VIEW_MENUS_H_ #define _GAL_VIEW_MENUS_H_ -#include <gtk/gtkobject.h> #include <libxml/tree.h> #include <bonobo/bonobo-ui-component.h> #include <gal/menus/gal-view-instance.h> +#include <glib-object.h> + #define GAL_VIEW_MENUS_TYPE (gal_view_menus_get_type ()) #define GAL_VIEW_MENUS(o) (GTK_CHECK_CAST ((o), GAL_VIEW_MENUS_TYPE, GalViewMenus)) #define GAL_VIEW_MENUS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_MENUS_TYPE, GalViewMenusClass)) @@ -16,12 +17,12 @@ typedef struct _GalViewMenusPrivate GalViewMenusPrivate; typedef struct { - GtkObject base; + GObject base; GalViewMenusPrivate *priv; } GalViewMenus; typedef struct { - GtkObjectClass parent_class; + GObjectClass parent_class; } GalViewMenusClass; GtkType gal_view_menus_get_type (void); |