aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-11-07 19:58:34 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-11-07 19:58:34 +0800
commitdd5ab1f16800794a475a8c0d8b7cf74641bc9a7f (patch)
tree201953aa42d12af1c2f23c375b8274443874003c /calendar
parentb89320e2f3d0a8c69dd6ecfd33b125481cd837d8 (diff)
downloadgsoc2013-evolution-dd5ab1f16800794a475a8c0d8b7cf74641bc9a7f.tar
gsoc2013-evolution-dd5ab1f16800794a475a8c0d8b7cf74641bc9a7f.tar.gz
gsoc2013-evolution-dd5ab1f16800794a475a8c0d8b7cf74641bc9a7f.tar.bz2
gsoc2013-evolution-dd5ab1f16800794a475a8c0d8b7cf74641bc9a7f.tar.lz
gsoc2013-evolution-dd5ab1f16800794a475a8c0d8b7cf74641bc9a7f.tar.xz
gsoc2013-evolution-dd5ab1f16800794a475a8c0d8b7cf74641bc9a7f.tar.zst
gsoc2013-evolution-dd5ab1f16800794a475a8c0d8b7cf74641bc9a7f.zip
GObjectify.
2002-11-07 Rodrigo Moya <rodrigo@ximian.com> * pcs/cal-backend-file.[ch]: * pcs/cal-backend.[ch]: GObjectify. svn path=/trunk/; revision=18629
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/TODO.port5
-rw-r--r--calendar/pcs/cal-backend-file.c65
-rw-r--r--calendar/pcs/cal-backend-file.h10
-rw-r--r--calendar/pcs/cal-backend.c137
-rw-r--r--calendar/pcs/cal-backend.h14
6 files changed, 122 insertions, 114 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 078f08bc2e..fcc4a16f09 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,8 @@
+2002-11-07 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal-backend-file.[ch]:
+ * pcs/cal-backend.[ch]: GObjectify.
+
2002-11-06 Rodrigo Moya <rodrigo@ximian.com>
* gui/cal-prefs-dialog.c: #include gtkoptionmenu.h.
diff --git a/calendar/TODO.port b/calendar/TODO.port
index abbd6b42b1..1d680fdb72 100644
--- a/calendar/TODO.port
+++ b/calendar/TODO.port
@@ -3,3 +3,8 @@
* gui/dialogs/comp-editor-util.c
there's a comment in comp_editor_create_contacts_component about OAF being broken.
Check if it's true with BonoboActivation.
+* pcs/cal-backend-file.c
+ remove usage of BonoboConf
+* */*
+ remove the G_OBJECT macro in the calls to g_object_ref/_unref, since those functions
+ already do the type checking, and it's a heavy operation.
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 2def3bb57b..3f457a0a57 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -21,7 +21,6 @@
*/
#include <config.h>
-#include <gtk/gtksignal.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <libgnomevfs/gnome-vfs.h>
@@ -87,8 +86,8 @@ struct _CalBackendFilePrivate {
static void cal_backend_file_class_init (CalBackendFileClass *class);
-static void cal_backend_file_init (CalBackendFile *cbfile);
-static void cal_backend_file_destroy (GtkObject *object);
+static void cal_backend_file_init (CalBackendFile *cbfile, CalBackendFileClass *class);
+static void cal_backend_file_finalize (GObject *object);
static const char *cal_backend_file_get_uri (CalBackend *backend);
static gboolean cal_backend_file_is_read_only (CalBackend *backend);
@@ -151,24 +150,24 @@ static CalBackendClass *parent_class;
*
* Return value: The type ID of the #CalBackendFile class.
**/
-GtkType
+GType
cal_backend_file_get_type (void)
{
- static GtkType cal_backend_file_type = 0;
+ static GType cal_backend_file_type = 0;
if (!cal_backend_file_type) {
- static const GtkTypeInfo cal_backend_file_info = {
- "CalBackendFile",
- sizeof (CalBackendFile),
- sizeof (CalBackendFileClass),
- (GtkClassInitFunc) cal_backend_file_class_init,
- (GtkObjectInitFunc) cal_backend_file_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- cal_backend_file_type = gtk_type_unique (CAL_BACKEND_TYPE, &cal_backend_file_info);
+ static GTypeInfo info = {
+ sizeof (CalBackendFileClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cal_backend_file_class_init,
+ NULL, NULL,
+ sizeof (CalBackendFile),
+ 0,
+ (GInstanceInitFunc) cal_backend_file_init
+ };
+ cal_backend_file_type = g_type_register_static (CAL_BACKEND_TYPE,
+ "CalBackendFile", &info, 0);
}
return cal_backend_file_type;
@@ -178,15 +177,15 @@ cal_backend_file_get_type (void)
static void
cal_backend_file_class_init (CalBackendFileClass *class)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
CalBackendClass *backend_class;
- object_class = (GtkObjectClass *) class;
+ object_class = (GObjectClass *) class;
backend_class = (CalBackendClass *) class;
- parent_class = gtk_type_class (CAL_BACKEND_TYPE);
+ parent_class = (CalBackendClass *) g_type_class_peek_parent (class);
- object_class->destroy = cal_backend_file_destroy;
+ object_class->finalize = cal_backend_file_finalize;
backend_class->get_uri = cal_backend_file_get_uri;
backend_class->is_read_only = cal_backend_file_is_read_only;
@@ -241,7 +240,7 @@ cal_added_cb (CalBackend *backend, gpointer user_data)
/* Object initialization function for the file backend */
static void
-cal_backend_file_init (CalBackendFile *cbfile)
+cal_backend_file_init (CalBackendFile *cbfile, CalBackendFileClass *class)
{
CalBackendFilePrivate *priv;
@@ -263,8 +262,8 @@ cal_backend_file_init (CalBackendFile *cbfile)
priv->db = load_db ();
- gtk_signal_connect (GTK_OBJECT (cbfile), "cal_added",
- GTK_SIGNAL_FUNC (cal_added_cb), NULL);
+ g_signal_connect (G_OBJECT (cbfile), "cal_added",
+ G_CALLBACK (cal_added_cb), NULL);
}
/* g_hash_table_foreach() callback to destroy a CalComponent */
@@ -274,7 +273,7 @@ free_cal_component (gpointer key, gpointer value, gpointer data)
CalComponent *comp;
comp = CAL_COMPONENT (value);
- gtk_object_unref (GTK_OBJECT (comp));
+ g_object_unref (comp);
}
/* Saves the calendar data */
@@ -359,9 +358,9 @@ free_category_cb (gpointer key, gpointer value, gpointer data)
g_free (c);
}
-/* Destroy handler for the file backend */
+/* Finalize handler for the file backend */
static void
-cal_backend_file_destroy (GtkObject *object)
+cal_backend_file_finalize (GObject *object)
{
CalBackendFile *cbfile;
CalBackendFilePrivate *priv;
@@ -424,8 +423,8 @@ cal_backend_file_destroy (GtkObject *object)
g_free (priv);
cbfile->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);
}
@@ -764,7 +763,7 @@ remove_component (CalBackendFile *cbfile, CalComponent *comp)
update_categories_from_comp (cbfile, comp, FALSE);
- gtk_object_unref (GTK_OBJECT (comp));
+ g_object_unref (comp);
}
/* Scans the toplevel VCALENDAR component and stores the objects it finds */
@@ -1466,7 +1465,7 @@ cal_backend_file_compute_changes_foreach_key (const char *key, gpointer data)
be_data->change_ids = g_list_prepend (be_data->change_ids, g_strdup (key));
g_free (calobj);
- gtk_object_unref (GTK_OBJECT (comp));
+ g_object_unref (comp);
}
}
@@ -1784,14 +1783,14 @@ cal_backend_file_update_object (CalBackendFile *cbfile,
/* Create a CalComponent wrapper for the icalcomponent. */
comp = cal_component_new ();
if (!cal_component_set_icalcomponent (comp, icalcomp)) {
- gtk_object_unref (GTK_OBJECT (comp));
+ g_object_unref (comp);
return NULL;
}
/* Get the UID, and check it isn't empty. */
cal_component_get_uid (comp, &comp_uid);
if (!comp_uid || !comp_uid[0]) {
- gtk_object_unref (GTK_OBJECT (comp));
+ g_object_unref (comp);
return NULL;
}
diff --git a/calendar/pcs/cal-backend-file.h b/calendar/pcs/cal-backend-file.h
index 0dd2c1fde1..4f79da66de 100644
--- a/calendar/pcs/cal-backend-file.h
+++ b/calendar/pcs/cal-backend-file.h
@@ -29,12 +29,12 @@ G_BEGIN_DECLS
#define CAL_BACKEND_FILE_TYPE (cal_backend_file_get_type ())
-#define CAL_BACKEND_FILE(obj) (GTK_CHECK_CAST ((obj), CAL_BACKEND_FILE_TYPE, \
+#define CAL_BACKEND_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_BACKEND_FILE_TYPE, \
CalBackendFile))
-#define CAL_BACKEND_FILE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_BACKEND_FILE_TYPE, \
+#define CAL_BACKEND_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_BACKEND_FILE_TYPE, \
CalBackendFileClass))
-#define IS_CAL_BACKEND_FILE(obj) (GTK_CHECK_TYPE ((obj), CAL_BACKEND_FILE_TYPE))
-#define IS_CAL_BACKEND_FILE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_FILE_TYPE))
+#define IS_CAL_BACKEND_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_BACKEND_FILE_TYPE))
+#define IS_CAL_BACKEND_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_FILE_TYPE))
typedef struct _CalBackendFile CalBackendFile;
typedef struct _CalBackendFileClass CalBackendFileClass;
@@ -52,7 +52,7 @@ struct _CalBackendFileClass {
CalBackendClass parent_class;
};
-GtkType cal_backend_file_get_type (void);
+GType cal_backend_file_get_type (void);
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index ed14c33f71..876ef0d5ec 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -23,8 +23,6 @@
*/
#include <config.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlmemory.h>
@@ -61,25 +59,23 @@ static guint cal_backend_signals[LAST_SIGNAL];
*
* Return value: The type ID of the #CalBackend class.
**/
-GtkType
+GType
cal_backend_get_type (void)
{
- static GtkType cal_backend_type = 0;
+ static GType cal_backend_type = 0;
if (!cal_backend_type) {
- static const GtkTypeInfo cal_backend_info = {
- "CalBackend",
- sizeof (CalBackend),
- sizeof (CalBackendClass),
- (GtkClassInitFunc) cal_backend_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- cal_backend_type =
- gtk_type_unique (GTK_TYPE_OBJECT, &cal_backend_info);
+ static GTypeInfo info = {
+ sizeof (CalBackendClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cal_backend_class_init,
+ NULL, NULL,
+ sizeof (CalBackend),
+ 0,
+ (GInstanceInitFunc) NULL
+ };
+ cal_backend_type = g_type_register_static (G_TYPE_OBJECT, "CalBackend", &info, 0);
}
return cal_backend_type;
@@ -89,51 +85,54 @@ cal_backend_get_type (void)
static void
cal_backend_class_init (CalBackendClass *class)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
- object_class = (GtkObjectClass *) class;
+ object_class = (GObjectClass *) class;
cal_backend_signals[LAST_CLIENT_GONE] =
- gtk_signal_new ("last_client_gone",
- GTK_RUN_FIRST,
- G_TYPE_FROM_CLASS (object_class),
- GTK_SIGNAL_OFFSET (CalBackendClass, last_client_gone),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("last_client_gone",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (CalBackendClass, last_client_gone),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
cal_backend_signals[CAL_ADDED] =
- gtk_signal_new ("cal_added",
- GTK_RUN_FIRST,
- G_TYPE_FROM_CLASS (object_class),
- GTK_SIGNAL_OFFSET (CalBackendClass, cal_added),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
+ g_signal_new ("cal_added",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (CalBackendClass, cal_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
cal_backend_signals[OPENED] =
- gtk_signal_new ("opened",
- GTK_RUN_FIRST,
- G_TYPE_FROM_CLASS (object_class),
- GTK_SIGNAL_OFFSET (CalBackendClass, opened),
- gtk_marshal_NONE__ENUM,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_ENUM);
+ g_signal_new ("opened",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (CalBackendClass, opened),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__ENUM,
+ G_TYPE_NONE, 1,
+ G_TYPE_ENUM);
cal_backend_signals[OBJ_UPDATED] =
- gtk_signal_new ("obj_updated",
- GTK_RUN_FIRST,
- G_TYPE_FROM_CLASS (object_class),
- GTK_SIGNAL_OFFSET (CalBackendClass, obj_updated),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_STRING);
+ g_signal_new ("obj_updated",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (CalBackendClass, obj_updated),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
cal_backend_signals[OBJ_REMOVED] =
- gtk_signal_new ("obj_removed",
- GTK_RUN_FIRST,
- G_TYPE_FROM_CLASS (object_class),
- GTK_SIGNAL_OFFSET (CalBackendClass, obj_removed),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_STRING);
-
- gtk_object_class_add_signals (object_class, cal_backend_signals, LAST_SIGNAL);
+ g_signal_new ("obj_removed",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (CalBackendClass, obj_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
class->last_client_gone = NULL;
class->opened = NULL;
@@ -205,7 +204,7 @@ cal_backend_get_email_address (CalBackend *backend)
/* Callback used when a Cal is destroyed */
static void
-cal_destroy_cb (GtkObject *object, gpointer data)
+cal_destroy_cb (GObject *object, gpointer data)
{
Cal *cal;
Cal *lcal;
@@ -256,16 +255,16 @@ cal_backend_add_cal (CalBackend *backend, Cal *cal)
/* we do not keep a reference to the Cal since the Calendar
* user agent owns it */
- gtk_signal_connect (GTK_OBJECT (cal), "destroy",
- GTK_SIGNAL_FUNC (cal_destroy_cb),
- backend);
+ g_signal_connect (G_OBJECT (cal), "destroy",
+ G_CALLBACK (cal_destroy_cb),
+ backend);
backend->clients = g_list_prepend (backend->clients, cal);
/* notify backend that a new Cal has been added */
- gtk_signal_emit (GTK_OBJECT (backend),
- cal_backend_signals[CAL_ADDED],
- cal);
+ g_signal_emit (G_OBJECT (backend),
+ cal_backend_signals[CAL_ADDED],
+ 0, cal);
}
/**
@@ -778,7 +777,7 @@ cal_backend_last_client_gone (CalBackend *backend)
g_return_if_fail (backend != NULL);
g_return_if_fail (IS_CAL_BACKEND (backend));
- gtk_signal_emit (GTK_OBJECT (backend), cal_backend_signals[LAST_CLIENT_GONE]);
+ g_signal_emit (G_OBJECT (backend), cal_backend_signals[LAST_CLIENT_GONE], 0);
}
/**
@@ -795,8 +794,8 @@ cal_backend_opened (CalBackend *backend, CalBackendOpenStatus status)
g_return_if_fail (backend != NULL);
g_return_if_fail (IS_CAL_BACKEND (backend));
- gtk_signal_emit (GTK_OBJECT (backend), cal_backend_signals[OPENED],
- status);
+ g_signal_emit (G_OBJECT (backend), cal_backend_signals[OPENED],
+ 0, status);
}
/**
@@ -814,8 +813,8 @@ cal_backend_obj_updated (CalBackend *backend, const char *uid)
g_return_if_fail (IS_CAL_BACKEND (backend));
g_return_if_fail (uid != NULL);
- gtk_signal_emit (GTK_OBJECT (backend), cal_backend_signals[OBJ_UPDATED],
- uid);
+ g_signal_emit (G_OBJECT (backend), cal_backend_signals[OBJ_UPDATED],
+ 0, uid);
}
/**
@@ -833,8 +832,8 @@ cal_backend_obj_removed (CalBackend *backend, const char *uid)
g_return_if_fail (IS_CAL_BACKEND (backend));
g_return_if_fail (uid != NULL);
- gtk_signal_emit (GTK_OBJECT (backend), cal_backend_signals[OBJ_REMOVED],
- uid);
+ g_signal_emit (G_OBJECT (backend), cal_backend_signals[OBJ_REMOVED],
+ 0, uid);
}
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index c0e969165a..b0790e8e73 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -36,11 +36,11 @@ G_BEGIN_DECLS
#define CAL_BACKEND_TYPE (cal_backend_get_type ())
-#define CAL_BACKEND(obj) (GTK_CHECK_CAST ((obj), CAL_BACKEND_TYPE, CalBackend))
-#define CAL_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_BACKEND_TYPE, \
+#define CAL_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_BACKEND_TYPE, CalBackend))
+#define CAL_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_BACKEND_TYPE, \
CalBackendClass))
-#define IS_CAL_BACKEND(obj) (GTK_CHECK_TYPE ((obj), CAL_BACKEND_TYPE))
-#define IS_CAL_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_TYPE))
+#define IS_CAL_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_BACKEND_TYPE))
+#define IS_CAL_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_TYPE))
/* Open status values */
typedef enum {
@@ -74,12 +74,12 @@ typedef enum {
} CalBackendGetAlarmsForObjectResult;
struct _CalBackend {
- GtkObject object;
+ GObject object;
GList *clients;
};
struct _CalBackendClass {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/* Notification signals */
void (* last_client_gone) (CalBackend *backend);
@@ -144,7 +144,7 @@ struct _CalBackendClass {
gboolean (* set_default_timezone) (CalBackend *backend, const char *tzid);
};
-GtkType cal_backend_get_type (void);
+GType cal_backend_get_type (void);
const char *cal_backend_get_uri (CalBackend *backend);