aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer/ChangeLog5
-rw-r--r--composer/e-msg-composer.c54
2 files changed, 45 insertions, 14 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index e05826537e..6901941b01 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,8 @@
+2000-07-10 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-msg-composer.c (exit_cb): Use it.
+ (delete_event): New, handler for the "delete_event" signal.
+
2000-07-09 Dan Winship <danw@helixcode.com>
* e-msg-composer.c (set_editor_text): Don't load "" into the
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index fdaece58b1..b71a72bafb 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -497,6 +497,24 @@ load (EMsgComposer *composer,
}
+/* Exit dialog. (Displays a "discard this message?" warning before actually exiting.) */
+
+static void
+exit_dialog_cb (int reply,
+ void *data)
+{
+ if (reply == 0)
+ gtk_widget_destroy (GTK_WIDGET (data));
+}
+
+static void
+do_exit (EMsgComposer *composer)
+{
+ gnome_ok_cancel_dialog_parented (_("Discard this message?"),
+ exit_dialog_cb, composer, GTK_WINDOW (composer));
+}
+
+
/* Address dialog callbacks. */
static void
@@ -592,22 +610,12 @@ send_cb (GtkWidget *widget, gpointer data)
}
static void
-exit_dialog_cb (int reply, gpointer data)
-{
- if (reply == 0)
- gtk_widget_destroy (GTK_WIDGET (data));
-}
-
-static void
exit_cb (GtkWidget *widget, gpointer data)
{
- EMsgComposer *composer = E_MSG_COMPOSER (data);
- GtkWindow *parent =
- GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (data),
- GTK_TYPE_WINDOW));
+ EMsgComposer *composer;
- gnome_ok_cancel_dialog_parented (_("Discard this message?"),
- exit_dialog_cb, composer, parent);
+ composer = E_MSG_COMPOSER (data);
+ do_exit (composer);
}
static void
@@ -779,6 +787,7 @@ create_toolbar (EMsgComposer *composer)
bonobo_ui_handler_toolbar_add_list (uih, "/Toolbar", list);
}
+
/* GtkObject methods. */
static void
@@ -828,15 +837,32 @@ destroy (GtkObject *object)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
+
+/* GtkWidget methods. */
+
+static int
+delete_event (GtkWidget *widget,
+ GdkEventAny *event)
+{
+ do_exit (E_MSG_COMPOSER (widget));
+
+ return TRUE;
+}
+
+
static void
class_init (EMsgComposerClass *klass)
{
GtkObjectClass *object_class;
+ GtkWidgetClass *widget_class;
- object_class = (GtkObjectClass *) klass;
+ object_class = GTK_OBJECT_CLASS (klass);
+ widget_class = GTK_WIDGET_CLASS (klass);
object_class->destroy = destroy;
+ widget_class->delete_event = delete_event;
+
parent_class = gtk_type_class (gnome_app_get_type ());
signals[SEND] =