diff options
-rw-r--r-- | calendar/ChangeLog | 12 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.c | 31 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.h | 1 | ||||
-rw-r--r-- | calendar/gui/event-editor.c | 70 |
4 files changed, 95 insertions, 19 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index dfe2f7f91e..e7a2c75733 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,17 @@ 2000-08-31 JP Rosevear <jpr@helixcode.com> + * gui/event-editor.c (file_delete_cb): Implement delete option + (recurrence_toggled): Make an ugly hack to get the recurrence + pages showing properly since we don't yet implement all of the + recurrence rule stuff. + + * cal-client/cal-client.c (cal_client_object_exists): New function + to see if an object exists and is obtainable from the backend + + * cal-client/cal-client.h: Add prototype + +2000-08-31 JP Rosevear <jpr@helixcode.com> + * gui/gnome-cal.c (editor_closed_cb): Event editor destroyed callback to do hash cleanup (gnome_calendar_edit_object): Set event editor calendar client. diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 65c0c4aea4..d64026d6b2 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -605,6 +605,37 @@ cal_client_get_n_objects (CalClient *client, CalObjType type) } /** + * cal_client_object_exists: + * @client: A calendar client + * @uid: Unique identifier for a calendar component + * + * Checks to see if a uid exists in the backend + * + * Return value: True or false if uid exists and can be obtained + **/ +gboolean +cal_client_object_exists (CalClient *client, const char *uid) +{ + CalComponent *comp; + CalClientGetStatus status; + + status = cal_client_get_object (client, uid, &comp); + + switch (status) { + case CAL_CLIENT_GET_SUCCESS: + gtk_object_unref (GTK_OBJECT (comp)); + return TRUE; + + case CAL_CLIENT_GET_SYNTAX_ERROR: + case CAL_CLIENT_GET_NOT_FOUND: + return FALSE; + + default: + g_assert_not_reached (); + } +} + +/** * cal_client_get_object: * @client: A calendar client. * @uid: Unique identifier for a calendar component. diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index 6747c7488e..bc08b2497a 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -88,6 +88,7 @@ gboolean cal_client_is_loaded (CalClient *client); int cal_client_get_n_objects (CalClient *client, CalObjType type); +gboolean cal_client_object_exists (CalClient *client, const char *uid); CalClientGetStatus cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp); diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 6163cb9d12..615395fdc1 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -966,8 +966,7 @@ dialog_to_comp_object (EventEditor *ee) recur.interval = e_dialog_spin_get_int (priv->recurrence_rule_daily_days); break; - case ICAL_WEEKLY_RECURRENCE: - + case ICAL_WEEKLY_RECURRENCE: recur.interval = e_dialog_spin_get_int (priv->recurrence_rule_weekly_weeks); if (e_dialog_toggle_get (priv->recurrence_rule_weekly_sun)) @@ -994,7 +993,8 @@ dialog_to_comp_object (EventEditor *ee) recur.by_month_day[0] = e_dialog_spin_get_int (priv->recurrence_rule_monthly_day_nth); } else if (e_dialog_toggle_get (priv->recurrence_rule_monthly_weekday)) { - /* "recurrence-rule-monthly-weekday" is TRUE */ + +/* "recurrence-rule-monthly-weekday" is TRUE */ /* by position on the calender (ex: 2nd monday) */ /* libical does not handle this yet */ /* ico->recur->u.month_pos = e_dialog_option_menu_get ( */ @@ -1116,15 +1116,40 @@ file_save_cb (GtkWidget *widget, gpointer data) save_event_object (ee); } +/* File/Delete callback */ +static void +file_delete_cb (GtkWidget *widget, gpointer data) +{ + EventEditor *ee; + EventEditorPrivate *priv; + const char *uid; + + ee = EVENT_EDITOR (data); + + g_return_if_fail (IS_EVENT_EDITOR (ee)); + + priv = ee->priv; + + g_return_if_fail (priv->comp); + + cal_component_get_uid (priv->comp, &uid); + if (cal_client_object_exists (priv->client, uid)) + if (!cal_client_remove_object (priv->client, uid)) + g_message ("file_delete_cb (): Could not remove the object!"); + + close_dialog (ee); +} + /* File/Close callback */ static void file_close_cb (GtkWidget *widget, gpointer data) { EventEditor *ee; - /* FIXME: need to check for a dirty object */ - ee = EVENT_EDITOR (data); + + g_return_if_fail (IS_EVENT_EDITOR (ee)); + close_dialog (ee); } @@ -1163,7 +1188,8 @@ static GnomeUIInfo file_menu[] = { GNOMEUIINFO_MENU_SAVE_AS_ITEM (NULL, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Delete"), NULL, NULL), + GNOMEUIINFO_ITEM_STOCK (N_("_Delete"), NULL, + file_delete_cb, GNOME_STOCK_PIXMAP_TRASH), GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Move to Folder..."), NULL, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: Cop_y to Folder..."), NULL, NULL), GNOMEUIINFO_SEPARATOR, @@ -1323,32 +1349,38 @@ create_menu (EventEditor *ee) static GnomeUIInfo toolbar[] = { GNOMEUIINFO_ITEM_STOCK (N_("Save"), - N_("Save the appointment"), + N_("Save this appointment"), file_save_cb, GNOME_STOCK_PIXMAP_SAVE), + GNOMEUIINFO_ITEM_STOCK (N_("Delete"), + N_("Delete this appointment"), + file_delete_cb, + GNOME_STOCK_PIXMAP_TRASH), + + GNOMEUIINFO_ITEM_STOCK (N_("Close"), + N_("Close this appointment"), + file_close_cb, + GNOME_STOCK_PIXMAP_CLOSE), + GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Print..."), N_("Print this item"), NULL, GNOME_STOCK_PIXMAP_PRINT), - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Insert File..."), - N_("Insert a file as an attachment"), NULL, - GNOME_STOCK_PIXMAP_ATTACH), GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Insert File..."), + N_("Insert a file as an attachment"), NULL, + GNOME_STOCK_PIXMAP_ATTACH), +#if 0 GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Invite Attendees..."), N_("Invite attendees to a meeting"), NULL, GNOME_STOCK_PIXMAP_MULTIPLE), - +#endif GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Delete"), - N_("Delete this item"), NULL, - GNOME_STOCK_PIXMAP_TRASH), - - GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Previous"), N_("Go to the previous item"), NULL, @@ -1505,7 +1537,6 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data) EventEditorPrivate *priv; CalComponent *comp; CalClientGetStatus status; - gint day, event_num; ee = EVENT_EDITOR (data); @@ -1602,7 +1633,6 @@ void event_editor_set_event_object (EventEditor *ee, CalComponent *comp) { EventEditorPrivate *priv; - CalClientGetStatus status; char *title; g_return_if_fail (ee != NULL); @@ -1874,7 +1904,9 @@ recurrence_toggled (GtkWidget *radio, EventEditor *ee) rf = e_dialog_radio_get (radio, recur_options_map); - gtk_notebook_set_page (GTK_NOTEBOOK (priv->recurrence_rule_notebook), (int) rf); + /* This is a hack to get things working */ + gtk_notebook_set_page (GTK_NOTEBOOK (priv->recurrence_rule_notebook), + (int) (rf - ICAL_HOURLY_RECURRENCE)); } |