diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2002-11-04 23:14:52 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2002-11-04 23:14:52 +0800 |
commit | d86aa241f927117975b59835d9ce889ba57a8cc0 (patch) | |
tree | 1b91604b9e4576df3e0f512be41ab98e23257dfc /calendar | |
parent | 427c7a92282a6ee8def483774f8655648d2e6564 (diff) | |
download | gsoc2013-evolution-d86aa241f927117975b59835d9ce889ba57a8cc0.tar.gz gsoc2013-evolution-d86aa241f927117975b59835d9ce889ba57a8cc0.tar.zst gsoc2013-evolution-d86aa241f927117975b59835d9ce889ba57a8cc0.zip |
ported to GObject.
2002-11-04 Rodrigo Moya <rodrigo@ximian.com>
* cal-util/cal-component.[ch]: ported to GObject.
* cal-util/cal-util.c (cal_util_generate_alarms_for_comp): use
g_object_* instead of gtk_object_*.
svn path=/trunk/; revision=18525
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 7 | ||||
-rw-r--r-- | calendar/cal-util/cal-component.c | 59 | ||||
-rw-r--r-- | calendar/cal-util/cal-component.h | 16 | ||||
-rw-r--r-- | calendar/cal-util/cal-util.c | 2 |
4 files changed, 45 insertions, 39 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 62e4553fb8..05191e0326 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2002-11-04 Rodrigo Moya <rodrigo@ximian.com> + + * cal-util/cal-component.[ch]: ported to GObject. + + * cal-util/cal-util.c (cal_util_generate_alarms_for_comp): use + g_object_* instead of gtk_object_*. + 2002-11-03 Rodrigo Moya <rodrigo@ximian.com> * cal-client/cal-client.c (get_default_uri): use EConfigListener diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index b16a5d2f45..50c2ad95d8 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -178,11 +178,11 @@ struct _CalComponentAlarm { -static void cal_component_class_init (CalComponentClass *class); -static void cal_component_init (CalComponent *comp); -static void cal_component_destroy (GtkObject *object); +static void cal_component_class_init (CalComponentClass *klass); +static void cal_component_init (CalComponent *comp, CalComponentClass *klass); +static void cal_component_finalize (GObject *object); -static GtkObjectClass *parent_class; +static GObjectClass *parent_class; @@ -194,24 +194,23 @@ static GtkObjectClass *parent_class; * * Return value: The type ID of the #CalComponent class. **/ -GtkType +GType cal_component_get_type (void) { - static GtkType cal_component_type = 0; + static GType cal_component_type = 0; if (!cal_component_type) { - static const GtkTypeInfo cal_component_info = { - "CalComponent", - sizeof (CalComponent), - sizeof (CalComponentClass), - (GtkClassInitFunc) cal_component_class_init, - (GtkObjectInitFunc) cal_component_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_component_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_component_info); + static GTypeInfo info = { + sizeof (CalComponentClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) cal_component_class_init, + NULL, NULL, + sizeof (CalComponent), + 0, + (GInstanceInitFunc) cal_component_init + }; + cal_component_type = g_type_register_static (G_TYPE_OBJECT, "CalComponent", &info, 0); } return cal_component_type; @@ -219,20 +218,20 @@ cal_component_get_type (void) /* Class initialization function for the calendar component object */ static void -cal_component_class_init (CalComponentClass *class) +cal_component_class_init (CalComponentClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass *) class; + object_class = (GObjectClass *) klass; - parent_class = gtk_type_class (GTK_TYPE_OBJECT); + parent_class = g_type_class_peek_parent (klass); - object_class->destroy = cal_component_destroy; + object_class->finalize = cal_component_finalize; } /* Object initialization function for the calendar component object */ static void -cal_component_init (CalComponent *comp) +cal_component_init (CalComponent *comp, CalComponentClass *klass) { CalComponentPrivate *priv; @@ -355,9 +354,9 @@ free_icalcomponent (CalComponent *comp, gboolean free) priv->need_sequence_inc = FALSE; } -/* Destroy handler for the calendar component object */ +/* Finalize handler for the calendar component object */ static void -cal_component_destroy (GtkObject *object) +cal_component_finalize (GObject *object) { CalComponent *comp; CalComponentPrivate *priv; @@ -375,8 +374,8 @@ cal_component_destroy (GtkObject *object) g_free (priv); comp->priv = NULL; - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -432,7 +431,7 @@ cal_component_gen_uid (void) CalComponent * cal_component_new (void) { - return CAL_COMPONENT (gtk_type_new (CAL_COMPONENT_TYPE)); + return CAL_COMPONENT (g_object_new (CAL_COMPONENT_TYPE, NULL)); } /** @@ -4761,7 +4760,7 @@ cal_component_alarms_free (CalComponentAlarms *alarms) g_return_if_fail (alarms != NULL); g_assert (alarms->comp != NULL); - gtk_object_unref (GTK_OBJECT (alarms->comp)); + g_object_unref (G_OBJECT (alarms->comp)); for (l = alarms->alarms; l; l = l->next) { CalAlarmInstance *instance; diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h index 7a52414ce3..dba2e5a179 100644 --- a/calendar/cal-util/cal-component.h +++ b/calendar/cal-util/cal-component.h @@ -24,7 +24,7 @@ #include <glib/gmacros.h> #include <time.h> -#include <gtk/gtkobject.h> +#include <glib-object.h> #include <ical.h> G_BEGIN_DECLS @@ -32,11 +32,11 @@ G_BEGIN_DECLS #define CAL_COMPONENT_TYPE (cal_component_get_type ()) -#define CAL_COMPONENT(obj) (GTK_CHECK_CAST ((obj), CAL_COMPONENT_TYPE, CalComponent)) -#define CAL_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_COMPONENT_TYPE, \ +#define CAL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_COMPONENT_TYPE, CalComponent)) +#define CAL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_COMPONENT_TYPE, \ CalComponentClass)) -#define IS_CAL_COMPONENT(obj) (GTK_CHECK_TYPE ((obj), CAL_COMPONENT_TYPE)) -#define IS_CAL_COMPONENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_COMPONENT_TYPE)) +#define IS_CAL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_COMPONENT_TYPE)) +#define IS_CAL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_COMPONENT_TYPE)) /* Types of calendar components to be stored by a CalComponent, as per RFC 2445. * We don't put the alarm component type here since we store alarms as separate @@ -184,19 +184,19 @@ typedef struct _CalComponentClass CalComponentClass; typedef struct _CalComponentPrivate CalComponentPrivate; struct _CalComponent { - GtkObject object; + GObject object; /* Private data */ CalComponentPrivate *priv; }; struct _CalComponentClass { - GtkObjectClass parent_class; + GObjectClass parent_class; }; /* Calendar component */ -GtkType cal_component_get_type (void); +GType cal_component_get_type (void); char *cal_component_gen_uid (void); diff --git a/calendar/cal-util/cal-util.c b/calendar/cal-util/cal-util.c index cf7d12be98..9730bfdbc2 100644 --- a/calendar/cal-util/cal-util.c +++ b/calendar/cal-util/cal-util.c @@ -433,7 +433,7 @@ cal_util_generate_alarms_for_comp (CalComponent *comp, alarms = g_new (CalComponentAlarms, 1); alarms->comp = comp; - gtk_object_ref (GTK_OBJECT (alarms->comp)); + g_object_ref (G_OBJECT (alarms->comp)); alarms->alarms = g_slist_sort (aod.triggers, compare_alarm_instance); return alarms; |