diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-05-16 22:42:37 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-05-16 22:42:37 +0800 |
commit | 9b864ecd40139b61c89c459e4feb093c5b49d14b (patch) | |
tree | 8de9ea52ac3d2a646bb6190655e1bcc615a6925c | |
parent | 442cb01bee426d4a716485759ea093c773f5321a (diff) | |
download | gsoc2013-evolution-9b864ecd40139b61c89c459e4feb093c5b49d14b.tar gsoc2013-evolution-9b864ecd40139b61c89c459e4feb093c5b49d14b.tar.gz gsoc2013-evolution-9b864ecd40139b61c89c459e4feb093c5b49d14b.tar.bz2 gsoc2013-evolution-9b864ecd40139b61c89c459e4feb093c5b49d14b.tar.lz gsoc2013-evolution-9b864ecd40139b61c89c459e4feb093c5b49d14b.tar.xz gsoc2013-evolution-9b864ecd40139b61c89c459e4feb093c5b49d14b.tar.zst gsoc2013-evolution-9b864ecd40139b61c89c459e4feb093c5b49d14b.zip |
New. (create_component): Pass it as the @request_quit_fn to
* component-factory.c (request_quit): New.
(create_component): Pass it as the @request_quit_fn to
evolution_shell_component_new().
* e-msg-composer.c: New local `all_composers'; keeps a list of all
the composer windows created. Changed type of `parent_class' to
BonoboWindowClass *.
(do_exit): Cleaned up a bit. Raise the composer window before
showing the message box dialog.
(exit_dialog_cb): Removed.
(e_msg_composer_request_close_all): New.
(create_composer): Add the composer to the all_composers list and
weakref it.
(msg_composer_destroy_notify): GtkDestroyNotify function for the
composer's weakref; remove the composer from the all_composers
list.
svn path=/trunk/; revision=16930
-rw-r--r-- | composer/ChangeLog | 15 | ||||
-rw-r--r-- | composer/Makefile.am | 2 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 108 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 3 | ||||
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/component-factory.c | 10 | ||||
-rw-r--r-- | mail/main.c | 9 |
7 files changed, 108 insertions, 45 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index b9f8904f78..ec42f9287a 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,18 @@ +2002-05-16 Ettore Perazzoli <ettore@ximian.com> + + * e-msg-composer.c: New local `all_composers'; keeps a list of all + the composer windows created. Changed type of `parent_class' to + BonoboWindowClass *. + (do_exit): Cleaned up a bit. Raise the composer window before + showing the message box dialog. + (exit_dialog_cb): Removed. + (e_msg_composer_request_close_all): New. + (create_composer): Add the composer to the all_composers list and + weakref it. + (msg_composer_destroy_notify): GtkDestroyNotify function for the + composer's weakref; remove the composer from the all_composers + list. + 2002-05-15 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer-attachment.c (e_msg_composer_attachment_new): diff --git a/composer/Makefile.am b/composer/Makefile.am index 505c0c130e..0b9f4a2f7b 100644 --- a/composer/Makefile.am +++ b/composer/Makefile.am @@ -22,7 +22,7 @@ $(IDL_GENERATED): $(IDLS) $(selectnamesdir)/Evolution-Addressbook-SelectNames.id $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ -I $(selectnamesdir) $(srcdir)/Composer.idl -Editor-commmon.c: $(GTKHTML_DATADIR)/Editor.idl +Editor-commmon.c: $(GTKHTML_DATADIR)/Editor.idl $(HTML_EDITOR_GENERATED): $(GTKHTML_DATADIR)/Editor.idl $(ORBIT_IDL) -I $(srcdir) `$(GNOME_CONFIG) --cflags idl` -I $(GTKHTML_DATADIR)/gtkhtml $(GTKHTML_DATADIR)/Editor.idl diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index bf93b80762..368797a2ad 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -50,8 +50,10 @@ #include <sys/stat.h> #include <sys/wait.h> #include <unistd.h> + #include <gal/unicode/gunicode.h> #include <gal/util/e-unicode-i18n.h> + #include <libgnome/gnome-defs.h> #include <libgnome/gnome-exec.h> #include <libgnomeui/gnome-app.h> @@ -60,23 +62,25 @@ #include <libgnomeui/gnome-dialog-util.h> #include <libgnomeui/gnome-stock.h> #include <libgnomeui/gnome-window-icon.h> + #include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-moniker-util.h> #include <bonobo/bonobo-object-client.h> #include <bonobo/bonobo-stream-memory.h> #include <bonobo/bonobo-ui-util.h> #include <bonobo/bonobo-widget.h> + #include <libgnomevfs/gnome-vfs.h> #include <glade/glade.h> + #include <gal/widgets/e-gui-utils.h> #include <gal/widgets/e-scroll-frame.h> #include <gal/e-text/e-entry.h> + #include <gtkhtml/gtkhtml.h> #include <gtkhtml/htmlselection.h> -/*#include <addressbook/backend/ebook/e-card.h>*/ - #include "widgets/misc/e-charset-picker.h" #include "camel/camel.h" @@ -133,8 +137,14 @@ static GtkTargetEntry drop_types[] = { static int num_drop_types = sizeof (drop_types) / sizeof (drop_types[0]); -static GnomeAppClass *parent_class = NULL; + +/* The parent class. */ +static BonoboWindowClass *parent_class = NULL; + +/* All the composer windows open, for bookkeeping purposes. */ +static GSList *all_composers = NULL; + /* local prototypes */ static GList *add_recipients (GList *list, const char *recips, gboolean decode); @@ -1306,46 +1316,43 @@ menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path) /* Exit dialog. (Displays a "Save composition to 'Drafts' before exiting?" warning before actually exiting.) */ -enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL }; - -static void -exit_dialog_cb (int reply, EMsgComposer *composer) -{ - switch (reply) { - case REPLY_YES: - gtk_signal_emit (GTK_OBJECT (composer), signals[SAVE_DRAFT], TRUE); - e_msg_composer_unset_changed (composer); - break; - case REPLY_NO: - gtk_widget_destroy (GTK_WIDGET (composer)); - break; - case REPLY_CANCEL: - default: - } -} - static void do_exit (EMsgComposer *composer) { GtkWidget *dialog; gint button; - if (e_msg_composer_is_dirty (composer)) { - dialog = gnome_message_box_new (_("This message has not been sent.\n\nDo you wish to save your changes?"), - GNOME_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, /* Save */ - GNOME_STOCK_BUTTON_NO, /* Don't save */ - GNOME_STOCK_BUTTON_CANCEL, /* Cancel */ - NULL); - - gtk_window_set_title (GTK_WINDOW (dialog), _("Warning: Modified Message")); - gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (composer)); - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + if (! e_msg_composer_is_dirty (composer)) { + gtk_widget_destroy (GTK_WIDGET (composer)); + return; + } + + gdk_window_raise (GTK_WIDGET (composer)->window); + + dialog = gnome_message_box_new (_("This message has not been sent.\n\nDo you wish to save your changes?"), + GNOME_MESSAGE_BOX_QUESTION, + GNOME_STOCK_BUTTON_YES, /* Save */ + GNOME_STOCK_BUTTON_NO, /* Don't save */ + GNOME_STOCK_BUTTON_CANCEL, /* Cancel */ + NULL); + + gtk_window_set_title (GTK_WINDOW (dialog), _("Warning: Modified Message")); + gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (composer)); + gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); + button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - exit_dialog_cb (button, composer); - } else { + switch (button) { + case 0: /* Save */ + gtk_signal_emit (GTK_OBJECT (composer), signals[SAVE_DRAFT], TRUE); + e_msg_composer_unset_changed (composer); + break; + case 1: /* Don't save */ gtk_widget_destroy (GTK_WIDGET (composer)); + break; + case 2: /* Cancel */ + break; + default: + g_assert_not_reached (); } } @@ -2628,6 +2635,14 @@ map_default_cb (EMsgComposer *composer, gpointer user_data) CORBA_exception_free (&ev); } +static void +msg_composer_destroy_notify (void *data) +{ + EMsgComposer *composer = E_MSG_COMPOSER (data); + + all_composers = g_slist_remove (all_composers, composer); +} + static EMsgComposer * create_composer (void) { @@ -2640,6 +2655,12 @@ create_composer (void) composer = gtk_type_new (E_TYPE_MSG_COMPOSER); + all_composers = g_slist_prepend (all_composers, composer); + + gtk_object_weakref (GTK_OBJECT (composer), + msg_composer_destroy_notify, + composer); + gtk_window_set_default_size (GTK_WINDOW (composer), DEFAULT_WIDTH, DEFAULT_HEIGHT); gnome_window_icon_set_from_file (GTK_WINDOW (composer), EVOLUTION_DATADIR @@ -4321,3 +4342,20 @@ e_msg_composer_drop_editor_undo (EMsgComposer *composer) GNOME_GtkHTML_Editor_Engine_dropUndo (composer->editor_engine, &ev); CORBA_exception_free (&ev); } + + +gboolean +e_msg_composer_request_close_all (void) +{ + GSList *p, *pnext; + + for (p = all_composers; p != NULL; p = pnext) { + pnext = p->next; + do_exit (E_MSG_COMPOSER (p->data)); + } + + if (all_composers == NULL) + return TRUE; + else + return FALSE; +} diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 921dfc2ee1..b92713bb93 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -194,6 +194,9 @@ void e_msg_composer_add_message_attachments (EMsgCo void e_msg_composer_ignore (EMsgComposer *composer, const gchar *str); void e_msg_composer_drop_editor_undo (EMsgComposer *composer); + +gboolean e_msg_composer_request_close_all (void); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/mail/ChangeLog b/mail/ChangeLog index 2f682983a9..1a04992f4f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2002-05-16 Ettore Perazzoli <ettore@ximian.com> + + * component-factory.c (request_quit): New. + (create_component): Pass it as the @request_quit_fn to + evolution_shell_component_new(). + 2002-05-15 Ettore Perazzoli <ettore@ximian.com> * component-factory.c (create_component): Pass NULL as diff --git a/mail/component-factory.c b/mail/component-factory.c index 439e11ccf5..8f6a8b9565 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -936,6 +936,13 @@ send_receive_cb (EvolutionShellComponent *shell_component, mail_send_receive (); } +static gboolean +request_quit (EvolutionShellComponent *shell_component, + void *closure) +{ + return e_msg_composer_request_close_all (); +} + static BonoboObject * create_component (void) { @@ -952,7 +959,8 @@ create_component (void) xfer_folder, populate_folder_context_menu, get_dnd_selection, - NULL, NULL); + request_quit, + NULL); gtk_signal_connect (GTK_OBJECT (shell_component), "send_receive", GTK_SIGNAL_FUNC (send_receive_cb), NULL); diff --git a/mail/main.c b/mail/main.c index d6c2e7ffcb..5abc160999 100644 --- a/mail/main.c +++ b/mail/main.c @@ -88,15 +88,8 @@ main (int argc, char *argv []) CORBA_ORB orb; struct sigaction sa, osa; -#ifdef DO_MCHECK - /* used to make elfence work */ -#if 0 free (malloc (10)); -#else - /*mtrace();*/ - mcheck(blowup); -#endif -#endif + bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); textdomain (PACKAGE); |