diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/Makefile.am | 2 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 8 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 6 | ||||
-rw-r--r-- | mail/em-folder-selection-button.c | 6 | ||||
-rw-r--r-- | mail/em-folder-selection.c | 77 | ||||
-rw-r--r-- | mail/em-folder-selection.h | 40 | ||||
-rw-r--r-- | mail/em-folder-selector.c | 25 | ||||
-rw-r--r-- | mail/em-folder-selector.h | 52 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 1 | ||||
-rw-r--r-- | mail/em-folder-utils.c | 45 | ||||
-rw-r--r-- | mail/em-folder-utils.h | 3 | ||||
-rw-r--r-- | mail/em-vfolder-rule.c | 10 |
12 files changed, 106 insertions, 169 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am index 043ffeebed..9bcc6ef056 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -58,7 +58,6 @@ mailinclude_HEADERS = \ em-filter-rule.h \ em-filter-source-element.h \ em-folder-properties.h \ - em-folder-selection.h \ em-folder-selector.h \ em-folder-selection-button.h \ em-folder-tree.h \ @@ -116,7 +115,6 @@ libevolution_mail_la_SOURCES = \ em-filter-rule.c \ em-filter-source-element.c \ em-folder-properties.c \ - em-folder-selection.c \ em-folder-selector.c \ em-folder-selection-button.c \ em-folder-tree.c \ diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 175a01e131..eb3fe06f2a 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -192,9 +192,11 @@ action_mail_copy_cb (GtkAction *action, CamelFolder *folder; GtkWidget *folder_tree; GtkWidget *dialog; + GtkWindow *parent; GPtrArray *selected; const gchar *uri; + parent = e_mail_reader_get_window (reader); message_list = e_mail_reader_get_message_list (reader); folder_tree = em_folder_tree_new (); @@ -208,7 +210,7 @@ action_mail_copy_cb (GtkAction *action, EMFT_EXCLUDE_VTRASH); dialog = em_folder_selector_new ( - EM_FOLDER_TREE (folder_tree), + parent, EM_FOLDER_TREE (folder_tree), EM_FOLDER_SELECTOR_CAN_CREATE, _("Select Folder"), NULL, _("C_opy")); @@ -579,9 +581,11 @@ action_mail_move_cb (GtkAction *action, CamelFolder *folder; GtkWidget *folder_tree; GtkWidget *dialog; + GtkWindow *parent; GPtrArray *selected; const gchar *uri; + parent = e_mail_reader_get_window (reader); message_list = e_mail_reader_get_message_list (reader); folder_tree = em_folder_tree_new (); @@ -595,7 +599,7 @@ action_mail_move_cb (GtkAction *action, EMFT_EXCLUDE_VTRASH); dialog = em_folder_selector_new ( - EM_FOLDER_TREE (folder_tree), + parent, EM_FOLDER_TREE (folder_tree), EM_FOLDER_SELECTOR_CAN_CREATE, _("Select Folder"), NULL, _("_Move")); diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index f268b14596..739297f5d7 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -2405,7 +2405,8 @@ em_utils_reply_to_message(CamelFolder *folder, const gchar *uid, CamelMimeMessag } static void -post_header_clicked_cb (EComposerPostHeader *header) +post_header_clicked_cb (EComposerPostHeader *header, + EMsgComposer *composer) { GtkTreeSelection *selection; GtkWidget *folder_tree; @@ -2424,6 +2425,7 @@ post_header_clicked_cb (EComposerPostHeader *header) EMFT_EXCLUDE_VTRASH); dialog = em_folder_selector_new ( + GTK_WINDOW (composer), EM_FOLDER_TREE (folder_tree), EM_FOLDER_SELECTOR_CAN_CREATE, _("Posting destination"), @@ -2503,5 +2505,5 @@ em_configure_new_composer (EMsgComposer *composer) * the folder selector dialog. See the handler function. */ g_signal_connect ( header, "clicked", - G_CALLBACK (post_header_clicked_cb), NULL); + G_CALLBACK (post_header_clicked_cb), composer); } diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c index ec818221b4..d3d44e5c23 100644 --- a/mail/em-folder-selection-button.c +++ b/mail/em-folder-selection-button.c @@ -208,9 +208,13 @@ folder_selection_button_clicked (GtkButton *button) GtkWidget *dialog; GtkTreeSelection *selection; GtkSelectionMode mode; + gpointer parent; priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (button); + parent = gtk_widget_get_toplevel (GTK_WIDGET (button)); + parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; + emft = (EMFolderTree *) em_folder_tree_new (); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (emft)); @@ -225,7 +229,7 @@ folder_selection_button_clicked (GtkButton *button) EMFT_EXCLUDE_VIRTUAL | EMFT_EXCLUDE_VTRASH); dialog = em_folder_selector_new ( - emft, EM_FOLDER_SELECTOR_CAN_CREATE, + parent, emft, EM_FOLDER_SELECTOR_CAN_CREATE, priv->title, priv->caption, NULL); if (priv->multiple_select) diff --git a/mail/em-folder-selection.c b/mail/em-folder-selection.c deleted file mode 100644 index 1e77525c9b..0000000000 --- a/mail/em-folder-selection.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> - -#include <gtk/gtk.h> - -#include "em-folder-tree.h" -#include "em-folder-selector.h" -#include "em-folder-selection.h" - -/* TODO: rmeove this file, it could just go on em-folder-selection or em-utils */ - -void -em_select_folder (const gchar *title, - const gchar *oklabel, - const gchar *default_uri, - EMFTExcludeFunc exclude, - void (*done) (const gchar *uri, gpointer user_data), - gpointer user_data) -{ - GtkWidget *dialog; - EMFolderTree *emft; - - g_return_if_fail (done != NULL); - - /* XXX Do we leak this reference? */ - emft = (EMFolderTree *) em_folder_tree_new (); - - if (exclude) - em_folder_tree_set_excluded_func (emft, exclude, user_data); - else - em_folder_tree_set_excluded ( - emft, EMFT_EXCLUDE_NOSELECT | - EMFT_EXCLUDE_VIRTUAL | EMFT_EXCLUDE_VTRASH); - - dialog = em_folder_selector_new ( - emft, EM_FOLDER_SELECTOR_CAN_CREATE, title, NULL, oklabel); - - if (default_uri != NULL) - em_folder_selector_set_selected ( - EM_FOLDER_SELECTOR (dialog), default_uri); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - const gchar *uri; - - uri = em_folder_selector_get_selected_uri ( - EM_FOLDER_SELECTOR (dialog)); - done (uri, user_data); - } - - gtk_widget_destroy (dialog); -} diff --git a/mail/em-folder-selection.h b/mail/em-folder-selection.h deleted file mode 100644 index 3f6b4b3a3b..0000000000 --- a/mail/em-folder-selection.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Jeffrey Stedfast <fejj@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef EM_FOLDER_SELECTION_H -#define EM_FOLDER_SELECTION_H - -#include <glib.h> - -G_BEGIN_DECLS - -void em_select_folder (const gchar *title, - const gchar *oklabel, - const gchar *default_uri, - EMFTExcludeFunc exclude, - void (*done)(const gchar *uri, gpointer data), - gpointer data); - -G_END_DECLS - -#endif /* EM_FOLDER_SELECTION_H */ diff --git a/mail/em-folder-selector.c b/mail/em-folder-selector.c index 198264e62b..693c0969f1 100644 --- a/mail/em-folder-selector.c +++ b/mail/em-folder-selector.c @@ -124,8 +124,7 @@ emfs_response (GtkWidget *dialog, gint response, EMFolderSelector *emfs) g_object_set_data ((GObject *)emfs->emft, "select", GUINT_TO_POINTER (1)); - /* FIXME Pass a parent window. */ - em_folder_utils_create_folder (NULL, emfs->emft, NULL); + em_folder_utils_create_folder (NULL, emfs->emft, GTK_WINDOW (dialog)); g_signal_stop_emission_by_name (emfs, "response"); } @@ -167,7 +166,6 @@ em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint3 { GtkWidget *widget; - gtk_window_set_modal (GTK_WINDOW (emfs), FALSE); gtk_window_set_default_size (GTK_WINDOW (emfs), 350, 300); gtk_window_set_title (GTK_WINDOW (emfs), title); gtk_container_set_border_width (GTK_CONTAINER (emfs), 6); @@ -216,11 +214,18 @@ em_folder_selector_construct (EMFolderSelector *emfs, EMFolderTree *emft, guint3 } GtkWidget * -em_folder_selector_new (EMFolderTree *emft, guint32 flags, const gchar *title, const gchar *text, const gchar *oklabel) +em_folder_selector_new (GtkWindow *parent, + EMFolderTree *emft, + guint32 flags, + const gchar *title, + const gchar *text, + const gchar *oklabel) { EMFolderSelector *emfs; - emfs = g_object_new (em_folder_selector_get_type (), NULL); + emfs = g_object_new ( + EM_TYPE_FOLDER_SELECTOR, + "transient-for", parent, NULL); em_folder_selector_construct (emfs, emft, flags, title, text, oklabel); return (GtkWidget *) emfs; @@ -243,7 +248,11 @@ emfs_create_name_activate (GtkEntry *entry, EMFolderSelector *emfs) } GtkWidget * -em_folder_selector_create_new (EMFolderTree *emft, guint32 flags, const gchar *title, const gchar *text) +em_folder_selector_create_new (GtkWindow *parent, + EMFolderTree *emft, + guint32 flags, + const gchar *title, + const gchar *text) { EMFolderSelector *emfs; GtkWidget *hbox, *w; @@ -252,7 +261,9 @@ em_folder_selector_create_new (EMFolderTree *emft, guint32 flags, const gchar *t * whole purpose of this dialog */ flags &= ~EM_FOLDER_SELECTOR_CAN_CREATE; - emfs = g_object_new (em_folder_selector_get_type (), NULL); + emfs = g_object_new ( + EM_TYPE_FOLDER_SELECTOR, + "transient-for", parent, NULL); em_folder_selector_construct (emfs, emft, flags, title, text, _("C_reate")); em_folder_tree_set_excluded(emft, EMFT_EXCLUDE_NOINFERIORS); diff --git a/mail/em-folder-selector.h b/mail/em-folder-selector.h index 131c4a4574..ca31d21623 100644 --- a/mail/em-folder-selector.h +++ b/mail/em-folder-selector.h @@ -25,6 +25,7 @@ #define EM_FOLDER_SELECTOR_H #include <gtk/gtk.h> +#include <mail/em-folder-tree.h> /* Standard GObject macros */ #define EM_TYPE_FOLDER_SELECTOR \ @@ -55,7 +56,7 @@ struct _EMFolderSelector { GtkDialog parent; guint32 flags; - struct _EMFolderTree *emft; + EMFolderTree *emft; GtkEntry *name_entry; gchar *selected_path; @@ -78,24 +79,37 @@ enum { EM_FOLDER_SELECTOR_RESPONSE_NEW = 1 }; -GType em_folder_selector_get_type (void); - -void em_folder_selector_construct (EMFolderSelector *emfs, struct _EMFolderTree *emft, guint32 flags, const gchar *title, const gchar *text, const gchar *oklabel); - -/* for selecting folders */ -GtkWidget *em_folder_selector_new (struct _EMFolderTree *emft, guint32 flags, const gchar *title, const gchar *text, const gchar *oklabel); - -/* for creating folders */ -GtkWidget *em_folder_selector_create_new (struct _EMFolderTree *emft, guint32 flags, const gchar *title, const gchar *text); - -void em_folder_selector_set_selected (EMFolderSelector *emfs, const gchar *uri); -void em_folder_selector_set_selected_list (EMFolderSelector *emfs, GList *list); - -const gchar *em_folder_selector_get_selected_uri (EMFolderSelector *emfs); -const gchar *em_folder_selector_get_selected_path (EMFolderSelector *emfs); - -GList *em_folder_selector_get_selected_uris (EMFolderSelector *emfs); -GList *em_folder_selector_get_selected_paths (EMFolderSelector *emfs); +GType em_folder_selector_get_type (void); +void em_folder_selector_construct (EMFolderSelector *emfs, + EMFolderTree *emft, + guint32 flags, + const gchar *title, + const gchar *text, + const gchar *oklabel); +GtkWidget * em_folder_selector_new (GtkWindow *parent, + EMFolderTree *emft, + guint32 flags, + const gchar *title, + const gchar *text, + const gchar *oklabel); +GtkWidget * em_folder_selector_create_new (GtkWindow *parent, + EMFolderTree *emft, + guint32 flags, + const gchar *title, + const gchar *text); +void em_folder_selector_set_selected (EMFolderSelector *emfs, + const gchar *uri); +void em_folder_selector_set_selected_list + (EMFolderSelector *emfs, + GList *list); +const gchar * em_folder_selector_get_selected_uri + (EMFolderSelector *emfs); +const gchar * em_folder_selector_get_selected_path + (EMFolderSelector *emfs); +GList * em_folder_selector_get_selected_uris + (EMFolderSelector *emfs); +GList * em_folder_selector_get_selected_paths + (EMFolderSelector *emfs); G_END_DECLS diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 568bf490e5..5772378f67 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -68,7 +68,6 @@ #include "em-folder-tree.h" #include "em-folder-utils.h" #include "em-folder-selector.h" -#include "em-folder-selection.h" #include "em-folder-properties.h" #include "em-event.h" diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c index 0379607bc0..3a4636a87b 100644 --- a/mail/em-folder-utils.c +++ b/mail/em-folder-utils.c @@ -65,7 +65,6 @@ #include "em-folder-tree-model.h" #include "em-folder-utils.h" #include "em-folder-selector.h" -#include "em-folder-selection.h" #include "em-folder-properties.h" #include "e-mail-local.h" @@ -365,9 +364,13 @@ emfu_copy_folder_exclude(EMFolderTree *tree, GtkTreeModel *model, GtkTreeIter *i /* FIXME: this interface references the folderinfo without copying it */ /* FIXME: these functions must be documented */ void -em_folder_utils_copy_folder (CamelFolderInfo *folderinfo, +em_folder_utils_copy_folder (GtkWindow *parent, + CamelFolderInfo *folderinfo, gint delete) { + GtkWidget *dialog; + EMFolderTree *emft; + const gchar *label; struct _copy_folder_data *cfd; g_return_if_fail (folderinfo != NULL); @@ -376,11 +379,28 @@ em_folder_utils_copy_folder (CamelFolderInfo *folderinfo, cfd->fi = folderinfo; cfd->delete = delete; - em_select_folder ( - _("Select folder"), - delete ? _("_Move") : _("C_opy"), - NULL, emfu_copy_folder_exclude, - emfu_copy_folder_selected, cfd); + /* XXX Do we leak this reference. */ + emft = (EMFolderTree *) em_folder_tree_new (); + + em_folder_tree_set_excluded_func ( + emft, emfu_copy_folder_exclude, cfd); + + label = delete ? _("_Move") : _("C_opy"); + + dialog = em_folder_selector_new ( + parent, emft, + EM_FOLDER_SELECTOR_CAN_CREATE, + _("Select Folder"), NULL, label); + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { + const gchar *uri; + + uri = em_folder_selector_get_selected_uri ( + EM_FOLDER_SELECTOR (dialog)); + emfu_copy_folder_selected (uri, cfd); + } + + gtk_widget_destroy (dialog); } static void @@ -732,15 +752,12 @@ em_folder_utils_create_folder (CamelFolderInfo *folderinfo, EMFolderTree *emft, folder_tree = (EMFolderTree *) em_folder_tree_new (); - dialog = em_folder_selector_create_new (folder_tree, 0, _("Create Folder"), _("Specify where to create the folder:")); + dialog = em_folder_selector_create_new ( + parent, folder_tree, 0, + _("Create Folder"), + _("Specify where to create the folder:")); if (folderinfo != NULL) em_folder_selector_set_selected ((EMFolderSelector *) dialog, folderinfo->uri); - if (parent) { - gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); - gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); - if (gtk_window_get_modal (parent)) - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - } g_signal_connect (dialog, "response", G_CALLBACK (emfu_popup_new_folder_response), emft); gtk_widget_show (dialog); } diff --git a/mail/em-folder-utils.h b/mail/em-folder-utils.h index d0db789b96..78c2f81a34 100644 --- a/mail/em-folder-utils.h +++ b/mail/em-folder-utils.h @@ -40,7 +40,8 @@ gint em_folder_utils_copy_folders (CamelStore *fromstore, /* FIXME These API's are really busted. There is no consistency and * most rely on the wrong data. */ -void em_folder_utils_copy_folder (CamelFolderInfo *folderinfo, +void em_folder_utils_copy_folder (GtkWindow *parent, + CamelFolderInfo *folderinfo, gboolean delete); void em_folder_utils_delete_folder (CamelFolder *folder); void em_folder_utils_rename_folder (CamelFolder *folder); diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c index c357065414..5f58c1eb52 100644 --- a/mail/em-vfolder-rule.c +++ b/mail/em-vfolder-rule.c @@ -506,13 +506,17 @@ source_add(GtkWidget *widget, struct _source_data *data) { EMFolderTree *emft; GtkWidget *dialog; + gpointer parent; + + parent = gtk_widget_get_toplevel (widget); + parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; emft =(EMFolderTree *) em_folder_tree_new (); em_folder_tree_set_excluded (emft, EMFT_EXCLUDE_NOSELECT); - dialog = em_folder_selector_new(emft, EM_FOLDER_SELECTOR_CAN_CREATE, _("Select Folder"), NULL, _("_Add")); - gtk_window_set_transient_for ((GtkWindow *)dialog, (GtkWindow *)gtk_widget_get_toplevel(widget)); - gtk_window_set_modal((GtkWindow *)dialog, TRUE); + dialog = em_folder_selector_new ( + parent, emft, EM_FOLDER_SELECTOR_CAN_CREATE, + _("Select Folder"), NULL, _("_Add")); g_signal_connect(dialog, "response", G_CALLBACK(vfr_folder_response), data); gtk_widget_show(dialog); } |