diff options
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 9 | ||||
-rw-r--r-- | calendar/gui/event-editor.c | 83 |
2 files changed, 74 insertions, 18 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index ad093e5476..f7a0268510 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,14 @@ 2000-06-02 Federico Mena Quintero <federico@helixcode.com> + * gui/event-editor.c (tb_save_and_close_cb): Implemented. + (toolbar): Added an icon for the Save and Close command. + (save_ical_object): Recompute the title of the window here. Maybe + it would be better to do it when we actually get the + "object_changed" signal from the CalClient. + (file_close_cb): Implemented. + +2000-06-02 Federico Mena Quintero <federico@helixcode.com> + * gui/gnome-cal.c (save_ical_object_cb): Implemented. (gnome_calendar_add_object): Removed function, since it was identical to gnome_calendar_update_object(). Modified the rest diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index da56a5e387..5d89517750 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -1041,6 +1041,7 @@ static void save_ical_object (EventEditor *ee) { EventEditorPrivate *priv; + char *title; priv = ee->priv; @@ -1049,10 +1050,41 @@ save_ical_object (EventEditor *ee) dialog_to_ical_object (ee); + title = make_title_from_ico (priv->ico); + gtk_window_set_title (GTK_WINDOW (priv->app), title); + g_free (title); + gtk_signal_emit (GTK_OBJECT (ee), event_editor_signals[SAVE_ICAL_OBJECT], priv->ico); } +/* Closes the dialog box and emits the appropriate signals */ +static void +close_dialog (EventEditor *ee) +{ + EventEditorPrivate *priv; + + priv = ee->priv; + + g_assert (priv->app != NULL); + + free_exception_clist_data (GTK_CLIST (priv->recurrence_exceptions_list)); + + gtk_widget_destroy (priv->app); + priv->app = NULL; + + if (priv->ico) { + gtk_signal_emit (GTK_OBJECT (ee), event_editor_signals[ICAL_OBJECT_RELEASED], + priv->ico->uid); + ical_object_unref (priv->ico); + priv->ico = NULL; + } + + gtk_signal_emit (GTK_OBJECT (ee), event_editor_signals[EDITOR_CLOSED]); +} + + + /* File/Save callback */ static void file_save_cb (GtkWidget *widget, gpointer data) @@ -1063,6 +1095,18 @@ file_save_cb (GtkWidget *widget, gpointer data) save_ical_object (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); + close_dialog (ee); +} + /* Menu bar */ @@ -1108,7 +1152,7 @@ static GnomeUIInfo file_menu[] = { GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_MENU_PROPERTIES_ITEM (NULL, NULL), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CLOSE_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_CLOSE_ITEM (file_close_cb, NULL), GNOMEUIINFO_END }; @@ -1254,10 +1298,26 @@ create_menu (EventEditor *ee) +/* Toolbar/Save and Close callback */ +static void +tb_save_and_close_cb (GtkWidget *widget, gpointer data) +{ + EventEditor *ee; + + ee = EVENT_EDITOR (data); + save_ical_object (ee); + close_dialog (ee); +} + + + /* Toolbar */ static GnomeUIInfo toolbar[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save and Close"), NULL, NULL), + GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Save and Close"), + N_("Saves the appointment and closes the dialog box"), + tb_save_and_close_cb, + GNOME_STOCK_PIXMAP_SAVE), GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print..."), NULL, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."), NULL, NULL), @@ -1309,24 +1369,11 @@ static gint app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) { EventEditor *ee; - EventEditorPrivate *priv; - ee = EVENT_EDITOR (data); - priv = ee->priv; - - free_exception_clist_data (GTK_CLIST (priv->recurrence_exceptions_list)); - - gtk_widget_destroy (priv->app); - priv->app = NULL; - - if (priv->ico) { - gtk_signal_emit (GTK_OBJECT (ee), event_editor_signals[ICAL_OBJECT_RELEASED], - priv->ico->uid); - ical_object_unref (priv->ico); - priv->ico = NULL; - } + /* FIXME: need to check for a dirty object */ - gtk_signal_emit (GTK_OBJECT (ee), event_editor_signals[EDITOR_CLOSED]); + ee = EVENT_EDITOR (data); + close_dialog (ee); return TRUE; } |