diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-07-11 01:24:57 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-07-11 01:24:57 +0800 |
commit | b3e9f04b6890752b93be5df169c56ecc3ec44cee (patch) | |
tree | 04ca750bab7bec5139e0fde2e7830422c1f4053e | |
parent | eb1d4e360b436cf61214a24efae44b2a418058aa (diff) | |
download | gsoc2013-evolution-b3e9f04b6890752b93be5df169c56ecc3ec44cee.tar.gz gsoc2013-evolution-b3e9f04b6890752b93be5df169c56ecc3ec44cee.tar.zst gsoc2013-evolution-b3e9f04b6890752b93be5df169c56ecc3ec44cee.zip |
Make the wm close button in the message composer work the same as
"File/Close".
svn path=/trunk/; revision=4040
-rw-r--r-- | composer/ChangeLog | 5 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 54 |
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] = |