aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-06-02 12:40:44 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2000-06-02 12:40:44 +0800
commitc91b4c129a05a17a3a4b9861630a9cb43589ca4a (patch)
treefc31f3a9b4719e3b2ce2654e7a557cbe6650ca99 /calendar/gui
parenta161070ec2a2de0527a9b442f11d29a6749db122 (diff)
downloadgsoc2013-evolution-c91b4c129a05a17a3a4b9861630a9cb43589ca4a.tar
gsoc2013-evolution-c91b4c129a05a17a3a4b9861630a9cb43589ca4a.tar.gz
gsoc2013-evolution-c91b4c129a05a17a3a4b9861630a9cb43589ca4a.tar.bz2
gsoc2013-evolution-c91b4c129a05a17a3a4b9861630a9cb43589ca4a.tar.lz
gsoc2013-evolution-c91b4c129a05a17a3a4b9861630a9cb43589ca4a.tar.xz
gsoc2013-evolution-c91b4c129a05a17a3a4b9861630a9cb43589ca4a.tar.zst
gsoc2013-evolution-c91b4c129a05a17a3a4b9861630a9cb43589ca4a.zip
Handler for the "editor_closed" signal of the event editor; we just
2000-06-01 Federico Mena Quintero <federico@helixcode.com> * gui/gnome-cal.c (editor_closed_cb): Handler for the "editor_closed" signal of the event editor; we just destroy it then. * gui/event-editor.c (app_delete_event_cb): Callback used when the dialog is closed. Release the iCalObject here instead of the event editor's destroy handler, and emit the new "editor_closed" signal. svn path=/trunk/; revision=3376
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/event-editor.c77
-rw-r--r--calendar/gui/event-editor.h1
-rw-r--r--calendar/gui/gnome-cal.c10
3 files changed, 63 insertions, 25 deletions
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index 38ed9ad070..9f24fb63cd 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -118,6 +118,7 @@ typedef struct {
/* Signal IDs */
enum {
ICAL_OBJECT_RELEASED,
+ EDITOR_CLOSED,
LAST_SIGNAL
};
@@ -199,6 +200,14 @@ event_editor_class_init (EventEditorClass *class)
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
+ event_editor_signals[EDITOR_CLOSED] =
+ gtk_signal_new ("editor_closed",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EventEditorClass, editor_closed),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
gtk_object_class_add_signals (object_class, event_editor_signals, LAST_SIGNAL);
object_class->destroy = event_editor_destroy;
@@ -227,23 +236,27 @@ event_editor_destroy (GtkObject *object)
ee = EVENT_EDITOR (object);
priv = ee->priv;
- 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;
- }
-
if (priv->uih) {
bonobo_object_unref (BONOBO_OBJECT (priv->uih));
priv->uih = NULL;
}
if (priv->app) {
+ gtk_signal_disconnect_by_data (GTK_OBJECT (priv->app), ee);
gtk_widget_destroy (priv->app);
priv->app = NULL;
}
+ if (priv->ico) {
+ /* We do not emit the "ical_object_released" signal here. If
+ * the user cloased the dialog box, then it has already been
+ * released. If the application just destroyed the event
+ * editor, then it had better clean up after itself.
+ */
+ ical_object_unref (priv->ico);
+ priv->ico = NULL;
+ }
+
if (priv->xml) {
gtk_object_unref (GTK_OBJECT (priv->xml));
priv->xml = NULL;
@@ -495,19 +508,6 @@ free_exception_clist_data (GtkCList *clist)
gtk_clist_clear (clist);
}
-/* Callback used when the exception date GtkCList is destroyed */
-static void
-exception_clist_destroyed (GtkObject *object, gpointer data)
-{
- EventEditor *ee;
- EventEditorPrivate *priv;
-
- ee = EVENT_EDITOR (data);
- priv = ee->priv;
-
- free_exception_clist_data (GTK_CLIST (priv->recurrence_exceptions_list));
-}
-
/* Hooks the widget signals */
static void
init_widgets (EventEditor *ee)
@@ -563,11 +563,6 @@ init_widgets (EventEditor *ee)
GTK_SIGNAL_FUNC (recurrence_exception_deleted), ee);
gtk_signal_connect (GTK_OBJECT (priv->recurrence_exception_change), "clicked",
GTK_SIGNAL_FUNC (recurrence_exception_changed), ee);
-
- /* Exception list */
-
- gtk_signal_connect (GTK_OBJECT (priv->recurrence_exceptions_list), "destroy",
- GTK_SIGNAL_FUNC (exception_clist_destroyed), ee);
}
/* Fills the widgets with default values */
@@ -1061,6 +1056,33 @@ create_toolbar (EventEditor *ee)
bonobo_ui_handler_toolbar_add_list (priv->uih, "/Toolbar", list);
}
+/* Callback used when the dialog box is destroyed */
+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;
+ }
+
+ gtk_signal_emit (GTK_OBJECT (ee), event_editor_signals[EDITOR_CLOSED]);
+
+ return TRUE;
+}
+
/**
* event_editor_construct:
* @ee: An event editor.
@@ -1109,6 +1131,11 @@ event_editor_construct (EventEditor *ee)
create_menu (ee);
create_toolbar (ee);
+ /* Hook to destruction of the dialog */
+
+ gtk_signal_connect (GTK_OBJECT (priv->app), "delete_event",
+ GTK_SIGNAL_FUNC (app_delete_event_cb), ee);
+
/* Show the dialog */
gtk_widget_show (priv->app);
diff --git a/calendar/gui/event-editor.h b/calendar/gui/event-editor.h
index a1d50a0dff..f5b5482e93 100644
--- a/calendar/gui/event-editor.h
+++ b/calendar/gui/event-editor.h
@@ -53,6 +53,7 @@ struct _EventEditorClass {
/* Notification signals */
void (* ical_object_released) (EventEditor *ee, const char *uid);
+ void (* editor_closed) (EventEditor *ee);
};
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 460e0151d6..e97947cbf0 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1327,6 +1327,13 @@ ical_object_released_cb (EventEditor *ee, const char *uid, gpointer data)
g_free (orig_uid);
}
+/* Callback used when an event editor dialog is closed */
+static void
+editor_closed_cb (EventEditor *ee, gpointer data)
+{
+ gtk_object_unref (GTK_OBJECT (ee));
+}
+
void
gnome_calendar_edit_object (GnomeCalendar *gcal, iCalObject *ico)
{
@@ -1353,6 +1360,9 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, iCalObject *ico)
gtk_signal_connect (GTK_OBJECT (ee), "ical_object_released",
GTK_SIGNAL_FUNC (ical_object_released_cb), gcal);
+ gtk_signal_connect (GTK_OBJECT (ee), "editor_closed",
+ GTK_SIGNAL_FUNC (editor_closed_cb), gcal);
+
event_editor_set_ical_object (EVENT_EDITOR (ee), ico);
}