diff options
Diffstat (limited to 'calendar/gui/dialogs/event-editor.c')
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 103 |
1 files changed, 56 insertions, 47 deletions
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 4253ba8889..9bef6c6c13 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -58,7 +58,7 @@ static void event_editor_init (EventEditor *ee); static void event_editor_set_cal_client (CompEditor *editor, CalClient *client); static void event_editor_edit_comp (CompEditor *editor, CalComponent *comp); static gboolean event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method); -static void event_editor_finalize (GObject *object); +static void event_editor_destroy (GtkObject *object); static void schedule_meeting_cmd (GtkWidget *widget, gpointer data); static void refresh_meeting_cmd (GtkWidget *widget, gpointer data); @@ -94,27 +94,47 @@ static CompEditorClass *parent_class; * * Return value: The type ID of the #EventEditor class. **/ +GtkType +event_editor_get_type (void) +{ + static GtkType event_editor_type = 0; + + if (!event_editor_type) { + static const GtkTypeInfo event_editor_info = { + "EventEditor", + sizeof (EventEditor), + sizeof (EventEditorClass), + (GtkClassInitFunc) event_editor_class_init, + (GtkObjectInitFunc) event_editor_init, + NULL, /* reserved_1 */ + NULL, /* reserved_2 */ + (GtkClassInitFunc) NULL + }; + + event_editor_type = gtk_type_unique (TYPE_COMP_EDITOR, + &event_editor_info); + } -E_MAKE_TYPE (event_editor, "EventEditor", EventEditor, event_editor_class_init, - event_editor_init, TYPE_COMP_EDITOR); + return event_editor_type; +} /* Class initialization function for the event editor */ static void event_editor_class_init (EventEditorClass *klass) { - GObjectClass *gobject_class; + GtkObjectClass *object_class; CompEditorClass *editor_class; - gobject_class = (GObjectClass *) klass; + object_class = (GtkObjectClass *) klass; editor_class = (CompEditorClass *) klass; - parent_class = g_type_class_ref(TYPE_COMP_EDITOR); + parent_class = gtk_type_class (TYPE_COMP_EDITOR); editor_class->set_cal_client = event_editor_set_cal_client; editor_class->edit_comp = event_editor_edit_comp; editor_class->send_comp = event_editor_send_comp; - gobject_class->finalize = event_editor_finalize; + object_class->destroy = event_editor_destroy; } static void @@ -162,12 +182,12 @@ init_widgets (EventEditor *ee) priv = ee->priv; - g_signal_connect((priv->model), "model_row_changed", - G_CALLBACK (model_row_changed_cb), ee); - g_signal_connect((priv->model), "model_rows_inserted", - G_CALLBACK (row_count_changed_cb), ee); - g_signal_connect((priv->model), "model_rows_deleted", - G_CALLBACK (row_count_changed_cb), ee); + gtk_signal_connect (GTK_OBJECT (priv->model), "model_row_changed", + GTK_SIGNAL_FUNC (model_row_changed_cb), ee); + gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_inserted", + GTK_SIGNAL_FUNC (row_count_changed_cb), ee); + gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_deleted", + GTK_SIGNAL_FUNC (row_count_changed_cb), ee); } /* Object initialization function for the event editor */ @@ -192,36 +212,26 @@ event_editor_construct (EventEditor *ee, CalClient *client) priv = ee->priv; priv->event_page = event_page_new (); - g_object_ref (priv->event_page); - gtk_object_sink (GTK_OBJECT (priv->event_page)); comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->event_page), _("Appointment")); priv->alarm_page = alarm_page_new (); - g_object_ref (priv->alarm_page); - gtk_object_sink (GTK_OBJECT (priv->alarm_page)); comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->alarm_page), _("Reminder")); priv->recur_page = recurrence_page_new (); - g_object_ref (priv->recur_page); - gtk_object_sink (GTK_OBJECT (priv->recur_page)); comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->recur_page), _("Recurrence")); priv->sched_page = schedule_page_new (priv->model); - g_object_ref (priv->sched_page); - gtk_object_sink (GTK_OBJECT (priv->sched_page)); comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->sched_page), _("Scheduling")); priv->meet_page = meeting_page_new (priv->model, client); - g_object_ref (priv->meet_page); - gtk_object_sink (GTK_OBJECT (priv->meet_page)); comp_editor_append_page (COMP_EDITOR (ee), COMP_EDITOR_PAGE (priv->meet_page), _("Meeting")); @@ -284,6 +294,7 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) priv->meeting_shown = FALSE; } else { GSList *l; + GList *addresses, *ll; int row; if (!priv->meeting_shown) { @@ -303,27 +314,22 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) if (!comp_editor_get_user_org (editor)) e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); e_meeting_model_add_attendee (priv->model, ia); - - g_object_unref(ia); + + gtk_object_unref (GTK_OBJECT (ia)); } /* If we aren't the organizer we can still change our own status */ if (!comp_editor_get_user_org (editor)) { - EAccountList *accounts; - EAccount *account; - EIterator *it; - - accounts = itip_addresses_get (); - for (it = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(it);e_iterator_next(it)) { + addresses = itip_addresses_get (); + for (ll = addresses; ll != NULL; ll = ll->next) { EMeetingAttendee *ia; - - account = (EAccount*)e_iterator_get(it); - - ia = e_meeting_model_find_attendee (priv->model, account->id->address, &row); + ItipAddress *a = ll->data; + + ia = e_meeting_model_find_attendee (priv->model, a->address, &row); if (ia != NULL) e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_STATUS); } - g_object_unref(it); + itip_addresses_free (addresses); } else if (cal_client_get_organizer_must_attend (client)) { EMeetingAttendee *ia; @@ -363,7 +369,7 @@ event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) client = e_meeting_model_get_cal_client (priv->model); result = itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL); - g_object_unref((comp)); + gtk_object_unref (GTK_OBJECT (comp)); if (!result) return FALSE; @@ -378,7 +384,7 @@ event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) /* Destroy handler for the event editor */ static void -event_editor_finalize (GObject *object) +event_editor_destroy (GtkObject *object) { EventEditor *ee; EventEditorPrivate *priv; @@ -389,16 +395,19 @@ event_editor_finalize (GObject *object) ee = EVENT_EDITOR (object); priv = ee->priv; - g_object_unref((priv->event_page)); - g_object_unref((priv->alarm_page)); - g_object_unref((priv->recur_page)); - g_object_unref((priv->meet_page)); - g_object_unref((priv->sched_page)); + gtk_object_unref (GTK_OBJECT (priv->event_page)); + gtk_object_unref (GTK_OBJECT (priv->alarm_page)); + gtk_object_unref (GTK_OBJECT (priv->recur_page)); + gtk_object_unref (GTK_OBJECT (priv->meet_page)); + gtk_object_unref (GTK_OBJECT (priv->sched_page)); + + gtk_object_destroy (GTK_OBJECT (priv->model)); + gtk_object_unref (GTK_OBJECT (priv->model)); - g_object_unref((priv->model)); + g_free (priv); - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } /** @@ -415,7 +424,7 @@ event_editor_new (CalClient *client) { EventEditor *ee; - ee = EVENT_EDITOR (g_object_new (TYPE_EVENT_EDITOR, NULL)); + ee = EVENT_EDITOR (gtk_type_new (TYPE_EVENT_EDITOR)); return event_editor_construct (ee, client); } |