From 2a771c37303b4d56e7c7462c1e7dec68b4508293 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 18 Dec 2008 21:41:00 +0000 Subject: Implement yet more mail actions. svn path=/branches/kill-bonobo/; revision=36918 --- mail/Makefile.am | 2 + mail/e-mail-shell-view-actions.c | 123 +++++++--- mail/e-mail-shell-view-private.h | 1 + mail/em-folder-browser.c | 494 +++++++++++++++++++-------------------- mail/em-subscribe-editor.c | 5 +- mail/em-subscribe-editor.h | 2 +- mail/em-vfolder-editor.c | 4 +- mail/em-vfolder-editor.h | 2 +- mail/mail-vfolder.c | 60 +++-- mail/mail-vfolder.h | 4 +- 10 files changed, 384 insertions(+), 313 deletions(-) (limited to 'mail') diff --git a/mail/Makefile.am b/mail/Makefile.am index 5db45237cc..cebc6ee725 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -125,6 +125,8 @@ libevolution_module_mail_la_SOURCES = \ em-search-context.h \ em-stripsig-filter.c \ em-stripsig-filter.h \ + em-subscribe-editor.c \ + em-subscribe-editor.h \ em-sync-stream.c \ em-sync-stream.h \ em-utils.c \ diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c index 9b857aff83..da4ba4b081 100644 --- a/mail/e-mail-shell-view-actions.c +++ b/mail/e-mail-shell-view-actions.c @@ -322,8 +322,20 @@ static void action_mail_folder_expunge_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EMailShellContent *mail_shell_content; + EMFolderView *folder_view; + EShellWindow *shell_window; + EShellView *shell_view; + + shell_view = E_SHELL_VIEW (mail_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + g_return_if_fail (folder_view->folder != NULL); + + em_utils_expunge_folder ( + GTK_WIDGET (shell_window), folder_view->folder); } static void @@ -439,16 +451,26 @@ static void action_mail_folder_select_thread_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EMailShellContent *mail_shell_content; + EMFolderView *folder_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + + message_list_select_thread (folder_view->list); } static void action_mail_folder_select_subthread_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EMailShellContent *mail_shell_content; + EMFolderView *folder_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + + message_list_select_subthread (folder_view->list); } static void @@ -563,16 +585,32 @@ static void action_mail_hide_read_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EMailShellContent *mail_shell_content; + EMFolderView *folder_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + + message_list_hide_add ( + folder_view->list, + "(match-all (system-flag \"seen\"))", + ML_HIDE_SAME, ML_HIDE_SAME); } static void action_mail_hide_selected_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EMailShellContent *mail_shell_content; + EMFolderView *folder_view; + GPtrArray *uids; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + + uids = message_list_get_selected (folder_view->list); + message_list_hide_uids (folder_view->list, uids); + message_list_free_uids (folder_view->list, uids); } static void @@ -759,8 +797,13 @@ static void action_mail_message_post_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EMailShellContent *mail_shell_content; + EMFolderView *folder_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + + em_utils_post_to_folder (folder_view->folder); } static void @@ -1159,8 +1202,13 @@ static void action_mail_show_hidden_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EMailShellContent *mail_shell_content; + EMFolderView *folder_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + + message_list_hide_clear (folder_view->list); } static void @@ -1175,24 +1223,33 @@ static void action_mail_stop_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + mail_cancel_all (); } static void action_mail_threads_collapse_all_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EMailShellContent *mail_shell_content; + EMFolderView *folder_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + + message_list_set_threaded_collapse_all (folder_view->list); } static void action_mail_threads_expand_all_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EMailShellContent *mail_shell_content; + EMFolderView *folder_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + folder_view = e_mail_shell_content_get_folder_view (mail_shell_content); + + message_list_set_threaded_expand_all (folder_view->list); } static void @@ -1207,24 +1264,38 @@ static void action_mail_tools_filters_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EShellWindow *shell_window; + EShellView *shell_view; + + shell_view = E_SHELL_VIEW (mail_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + em_utils_edit_filters (GTK_WIDGET (shell_window)); } static void action_mail_tools_search_folders_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + vfolder_edit (E_SHELL_VIEW (mail_shell_view)); } static void action_mail_tools_subscriptions_cb (GtkAction *action, EMailShellView *mail_shell_view) { - /* FIXME */ - g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); + EShellWindow *shell_window; + EShellView *shell_view; + GtkWidget *dialog; + + shell_view = E_SHELL_VIEW (mail_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + dialog = em_subscribe_editor_new (); + gtk_window_set_transient_for ( + GTK_WINDOW (dialog), GTK_WINDOW (shell_window)); + gtk_dialog_run (GTK_DIALOG (dialog)); + /* XXX Dialog destroys itself. */ } static void diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h index 4cee370dba..ed379dc9a7 100644 --- a/mail/e-mail-shell-view-private.h +++ b/mail/e-mail-shell-view-private.h @@ -35,6 +35,7 @@ #include "em-folder-properties.h" #include "em-folder-selector.h" #include "em-folder-utils.h" +#include "em-subscribe-editor.h" #include "em-utils.h" #include "mail-autofilter.h" #include "mail-ops.h" diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index 3bfb198c2b..1822d04fcb 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -1459,156 +1459,156 @@ emfb_edit_select_all(BonoboUIComponent *uid, void *data, const char *path) } } -static void -emfb_edit_select_thread(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - - message_list_select_thread(emfv->list); -} - -static void -emfb_edit_select_subthread(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - - message_list_select_subthread (emfv->list); -} - -static void -emfb_folder_properties(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - - if (emfb->view.folder_uri) - em_folder_properties_show(NULL, emfb->view.folder, emfb->view.folder_uri); -} +//static void +//emfb_edit_select_thread(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// +// message_list_select_thread(emfv->list); +//} + +//static void +//emfb_edit_select_subthread(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// +// message_list_select_subthread (emfv->list); +//} + +//static void +//emfb_folder_properties(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// +// if (emfb->view.folder_uri) +// em_folder_properties_show(NULL, emfb->view.folder, emfb->view.folder_uri); +//} /* VIEWTHREADED*/ -static void -emfb_expand_all_threads(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - - message_list_set_threaded_expand_all(emfv->list); - -} - -static void -emfb_collapse_all_threads(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - - message_list_set_threaded_collapse_all(emfv->list); -} - -static void -emfb_folder_copy(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - CamelFolderInfo *fi = NULL; - CamelException ex; - - /* FIXME: This function MUST become multi-threaded. - FIXME: This interface should NOT use a folderinfo */ - - camel_exception_init (&ex); - - if ((fi = camel_store_get_folder_info (emfb->view.folder->parent_store, - emfb->view.folder->full_name, - CAMEL_STORE_FOLDER_INFO_FAST, - &ex)) != NULL) - em_folder_utils_copy_folder(fi, FALSE); - - camel_exception_clear (&ex); - - return; -} - -static void -emfb_folder_move(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - CamelFolderInfo *fi = NULL; - CamelException ex; - - camel_exception_init (&ex); - - /* FIXME: This function MUST become multi-threaded. - FIXME: This interface should NOT use a folderinfo */ - - if ((fi = camel_store_get_folder_info (emfb->view.folder->parent_store, - emfb->view.folder->full_name, - CAMEL_STORE_FOLDER_INFO_FAST, - &ex)) != NULL) - em_folder_utils_copy_folder(fi, TRUE); - - camel_exception_clear (&ex); - - return; -} - -static void -emfb_folder_delete(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - - em_folder_utils_delete_folder (emfb->view.folder); - - return; -} - -static void -emfb_folder_refresh(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - EMFolderTree *tree = g_object_get_data (G_OBJECT (emfb), "foldertree"); - CamelFolder *folder; - - if ((folder = em_folder_tree_get_selected_folder (tree)) != NULL) - mail_refresh_folder(folder, NULL, NULL); -} - - -static void -emfb_folder_rename(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - - em_folder_utils_rename_folder (emfb->view.folder); - - return; -} - -static void -emfb_folder_create(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - CamelFolderInfo *fi = NULL; - EMFolderTree *tree = g_object_get_data (G_OBJECT (emfb), "foldertree"); - - /* FIXME: This function MUST be multithreaded - FIXME: This interface should NOT use a folderinfo */ - if (emfb->view.folder) { - if ((fi = em_folder_tree_get_selected_folder_info (tree)) != NULL) { - em_folder_utils_create_folder(fi, tree); - camel_folder_info_free(fi); - } - } else { - em_folder_utils_create_folder(NULL, tree); - } - - return; -} - -static void -emfb_folder_expunge(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - - if (emfb->view.folder) - em_utils_expunge_folder(gtk_widget_get_toplevel((GtkWidget *)emfb), emfb->view.folder); -} +//static void +//emfb_expand_all_threads(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// +// message_list_set_threaded_expand_all(emfv->list); +// +//} + +//static void +//emfb_collapse_all_threads(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// +// message_list_set_threaded_collapse_all(emfv->list); +//} + +//static void +//emfb_folder_copy(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// CamelFolderInfo *fi = NULL; +// CamelException ex; +// +// /* FIXME: This function MUST become multi-threaded. +// FIXME: This interface should NOT use a folderinfo */ +// +// camel_exception_init (&ex); +// +// if ((fi = camel_store_get_folder_info (emfb->view.folder->parent_store, +// emfb->view.folder->full_name, +// CAMEL_STORE_FOLDER_INFO_FAST, +// &ex)) != NULL) +// em_folder_utils_copy_folder(fi, FALSE); +// +// camel_exception_clear (&ex); +// +// return; +//} + +//static void +//emfb_folder_move(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// CamelFolderInfo *fi = NULL; +// CamelException ex; +// +// camel_exception_init (&ex); +// +// /* FIXME: This function MUST become multi-threaded. +// FIXME: This interface should NOT use a folderinfo */ +// +// if ((fi = camel_store_get_folder_info (emfb->view.folder->parent_store, +// emfb->view.folder->full_name, +// CAMEL_STORE_FOLDER_INFO_FAST, +// &ex)) != NULL) +// em_folder_utils_copy_folder(fi, TRUE); +// +// camel_exception_clear (&ex); +// +// return; +//} + +//static void +//emfb_folder_delete(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// +// em_folder_utils_delete_folder (emfb->view.folder); +// +// return; +//} + +//static void +//emfb_folder_refresh(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// EMFolderTree *tree = g_object_get_data (G_OBJECT (emfb), "foldertree"); +// CamelFolder *folder; +// +// if ((folder = em_folder_tree_get_selected_folder (tree)) != NULL) +// mail_refresh_folder(folder, NULL, NULL); +//} + + +//static void +//emfb_folder_rename(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// +// em_folder_utils_rename_folder (emfb->view.folder); +// +// return; +//} + +//static void +//emfb_folder_create(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// CamelFolderInfo *fi = NULL; +// EMFolderTree *tree = g_object_get_data (G_OBJECT (emfb), "foldertree"); +// +// /* FIXME: This function MUST be multithreaded +// FIXME: This interface should NOT use a folderinfo */ +// if (emfb->view.folder) { +// if ((fi = em_folder_tree_get_selected_folder_info (tree)) != NULL) { +// em_folder_utils_create_folder(fi, tree); +// camel_folder_info_free(fi); +// } +// } else { +// em_folder_utils_create_folder(NULL, tree); +// } +// +// return; +//} + +//static void +//emfb_folder_expunge(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// +// if (emfb->view.folder) +// em_utils_expunge_folder(gtk_widget_get_toplevel((GtkWidget *)emfb), emfb->view.folder); +//} static void emfb_mark_all_read(BonoboUIComponent *uid, void *data, const char *path) @@ -1630,83 +1630,83 @@ emfb_mark_all_read(BonoboUIComponent *uid, void *data, const char *path) } } -static void -emfb_view_hide_read(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - - message_list_hide_add(emfv->list, "(match-all (system-flag \"seen\"))", ML_HIDE_SAME, ML_HIDE_SAME); -} - -static void -emfb_view_hide_selected(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - GPtrArray *uids; - - /* TODO: perhaps this should sit directly on message_list? */ - /* is it worth it, it's so trivial */ - - /* A new flag CAMEL_MESSAGE_HIDDEN is added by Sankar - while extending the CAMEL_MESSAGE_FLAGS for proxy permissions. - This can be used to hide messages. */ - - uids = message_list_get_selected(emfv->list); - message_list_hide_uids(emfv->list, uids); - message_list_free_uids(emfv->list, uids); -} - -static void -emfb_view_show_all(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - - message_list_hide_clear(emfv->list); -} +//static void +//emfb_view_hide_read(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// +// message_list_hide_add(emfv->list, "(match-all (system-flag \"seen\"))", ML_HIDE_SAME, ML_HIDE_SAME); +//} + +//static void +//emfb_view_hide_selected(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// GPtrArray *uids; +// +// /* TODO: perhaps this should sit directly on message_list? */ +// /* is it worth it, it's so trivial */ +// +// /* A new flag CAMEL_MESSAGE_HIDDEN is added by Sankar +// while extending the CAMEL_MESSAGE_FLAGS for proxy permissions. +// This can be used to hide messages. */ +// +// uids = message_list_get_selected(emfv->list); +// message_list_hide_uids(emfv->list, uids); +// message_list_free_uids(emfv->list, uids); +//} + +//static void +//emfb_view_show_all(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// +// message_list_hide_clear(emfv->list); +//} /* ********************************************************************** */ -static void -emfb_mail_stop(BonoboUIComponent *uid, void *data, const char *path) -{ - mail_cancel_all(); -} - -static void -emfb_mail_post(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderView *emfv = data; - em_utils_post_to_folder (emfv->folder); -} - -static void -emfb_tools_filters(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - - em_utils_edit_filters ((GtkWidget *) emfb); -} - -static void -emfb_subscribe_editor_destroy(GtkWidget *w, EMFolderBrowser *emfb) -{ - emfb->priv->subscribe_editor = NULL; -} - -static void -emfb_tools_subscriptions(BonoboUIComponent *uid, void *data, const char *path) -{ - EMFolderBrowser *emfb = data; - - if (emfb->priv->subscribe_editor) { - gdk_window_show(emfb->priv->subscribe_editor->window); - } else { - emfb->priv->subscribe_editor = (GtkWidget *)em_subscribe_editor_new(); - e_dialog_set_transient_for((GtkWindow *)emfb->priv->subscribe_editor, (GtkWidget *)emfb); - g_signal_connect(emfb->priv->subscribe_editor, "destroy", G_CALLBACK(emfb_subscribe_editor_destroy), emfb); - gtk_widget_show(emfb->priv->subscribe_editor); - } -} +//static void +//emfb_mail_stop(BonoboUIComponent *uid, void *data, const char *path) +//{ +// mail_cancel_all(); +//} + +//static void +//emfb_mail_post(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderView *emfv = data; +// em_utils_post_to_folder (emfv->folder); +//} + +//static void +//emfb_tools_filters(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// +// em_utils_edit_filters ((GtkWidget *) emfb); +//} + +//static void +//emfb_subscribe_editor_destroy(GtkWidget *w, EMFolderBrowser *emfb) +//{ +// emfb->priv->subscribe_editor = NULL; +//} + +//static void +//emfb_tools_subscriptions(BonoboUIComponent *uid, void *data, const char *path) +//{ +// EMFolderBrowser *emfb = data; +// +// if (emfb->priv->subscribe_editor) { +// gdk_window_show(emfb->priv->subscribe_editor->window); +// } else { +// emfb->priv->subscribe_editor = (GtkWidget *)em_subscribe_editor_new(); +// e_dialog_set_transient_for((GtkWindow *)emfb->priv->subscribe_editor, (GtkWidget *)emfb); +/ g_signal_connect(emfb->priv->subscribe_editor, "destroy", G_CALLBACK(emfb_subscribe_editor_destroy), emfb); +/// gtk_widget_show(emfb->priv->subscribe_editor); +// } +//} static void emfb_focus_search(BonoboUIComponent *uid, void *data, const char *path) @@ -1722,12 +1722,12 @@ emfb_help_debug (BonoboUIComponent *uid, void *data, const char *path) mail_component_show_logger ((GtkWidget *) data); } -static void -emfb_tools_vfolders(BonoboUIComponent *uid, void *data, const char *path) -{ - /* FIXME: rename/refactor this */ - vfolder_edit(); -} +//static void +//emfb_tools_vfolders(BonoboUIComponent *uid, void *data, const char *path) +//{ +// /* FIXME: rename/refactor this */ +// vfolder_edit(); +//} static BonoboUIVerb emfb_verbs[] = { BONOBO_UI_UNSAFE_VERB ("EditCut", emfb_edit_cut), @@ -1736,33 +1736,33 @@ static BonoboUIVerb emfb_verbs[] = { BONOBO_UI_UNSAFE_VERB ("EditInvertSelection", emfb_edit_invert_selection), BONOBO_UI_UNSAFE_VERB ("EditSelectAll", emfb_edit_select_all), - BONOBO_UI_UNSAFE_VERB ("EditSelectThread", emfb_edit_select_thread), - BONOBO_UI_UNSAFE_VERB ("EditSelectSubthread", emfb_edit_select_subthread), - BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", emfb_folder_properties), - BONOBO_UI_UNSAFE_VERB ("FolderExpunge", emfb_folder_expunge), +// BONOBO_UI_UNSAFE_VERB ("EditSelectThread", emfb_edit_select_thread), +// BONOBO_UI_UNSAFE_VERB ("EditSelectSubthread", emfb_edit_select_subthread), +// BONOBO_UI_UNSAFE_VERB ("ChangeFolderProperties", emfb_folder_properties), +// BONOBO_UI_UNSAFE_VERB ("FolderExpunge", emfb_folder_expunge), /* HideDeleted is a toggle */ BONOBO_UI_UNSAFE_VERB ("MessageMarkAllAsRead", emfb_mark_all_read), - BONOBO_UI_UNSAFE_VERB ("ViewHideRead", emfb_view_hide_read), - BONOBO_UI_UNSAFE_VERB ("ViewHideSelected", emfb_view_hide_selected), - BONOBO_UI_UNSAFE_VERB ("ViewShowAll", emfb_view_show_all), +// BONOBO_UI_UNSAFE_VERB ("ViewHideRead", emfb_view_hide_read), +// BONOBO_UI_UNSAFE_VERB ("ViewHideSelected", emfb_view_hide_selected), +// BONOBO_UI_UNSAFE_VERB ("ViewShowAll", emfb_view_show_all), /* ViewThreaded is a toggle */ - BONOBO_UI_UNSAFE_VERB ("ViewThreadsExpandAll", emfb_expand_all_threads), - BONOBO_UI_UNSAFE_VERB ("ViewThreadsCollapseAll", emfb_collapse_all_threads), +// BONOBO_UI_UNSAFE_VERB ("ViewThreadsExpandAll", emfb_expand_all_threads), +// BONOBO_UI_UNSAFE_VERB ("ViewThreadsCollapseAll", emfb_collapse_all_threads), - BONOBO_UI_UNSAFE_VERB ("FolderCopy", emfb_folder_copy), - BONOBO_UI_UNSAFE_VERB ("FolderMove", emfb_folder_move), - BONOBO_UI_UNSAFE_VERB ("FolderDelete", emfb_folder_delete), - BONOBO_UI_UNSAFE_VERB ("FolderRefresh", emfb_folder_refresh), - BONOBO_UI_UNSAFE_VERB ("FolderRename", emfb_folder_rename), - BONOBO_UI_UNSAFE_VERB ("FolderCreate", emfb_folder_create), +// BONOBO_UI_UNSAFE_VERB ("FolderCopy", emfb_folder_copy), +// BONOBO_UI_UNSAFE_VERB ("FolderMove", emfb_folder_move), +// BONOBO_UI_UNSAFE_VERB ("FolderDelete", emfb_folder_delete), +// BONOBO_UI_UNSAFE_VERB ("FolderRefresh", emfb_folder_refresh), +// BONOBO_UI_UNSAFE_VERB ("FolderRename", emfb_folder_rename), +// BONOBO_UI_UNSAFE_VERB ("FolderCreate", emfb_folder_create), BONOBO_UI_UNSAFE_VERB ("HelpDebug", emfb_help_debug), - BONOBO_UI_UNSAFE_VERB ("MailPost", emfb_mail_post), - BONOBO_UI_UNSAFE_VERB ("MailStop", emfb_mail_stop), - BONOBO_UI_UNSAFE_VERB ("ToolsFilters", emfb_tools_filters), +// BONOBO_UI_UNSAFE_VERB ("MailPost", emfb_mail_post), +// BONOBO_UI_UNSAFE_VERB ("MailStop", emfb_mail_stop), +// BONOBO_UI_UNSAFE_VERB ("ToolsFilters", emfb_tools_filters), BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", emfb_tools_subscriptions), - BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", emfb_tools_vfolders), +// BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", emfb_tools_vfolders), BONOBO_UI_UNSAFE_VERB ("FocusSearch", emfb_focus_search), /* ViewPreview is a toggle */ diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c index 3eb738cd8d..548029e0ba 100644 --- a/mail/em-subscribe-editor.c +++ b/mail/em-subscribe-editor.c @@ -786,7 +786,8 @@ window_size_allocate (GtkWidget *widget, GtkAllocation *allocation) g_object_unref (gconf); } -GtkDialog *em_subscribe_editor_new(void) +GtkWidget * +em_subscribe_editor_new(void) { EMSubscribeEditor *se; EAccountList *accounts; @@ -890,5 +891,5 @@ GtkDialog *em_subscribe_editor_new(void) gtk_window_set_default_size ((GtkWindow *) se->dialog, window_size.width, window_size.height); g_signal_connect (se->dialog, "size-allocate", G_CALLBACK (window_size_allocate), NULL); - return se->dialog; + return GTK_WIDGET (se->dialog); } diff --git a/mail/em-subscribe-editor.h b/mail/em-subscribe-editor.h index aa9c9a2c2d..5e6f4f5e4a 100644 --- a/mail/em-subscribe-editor.h +++ b/mail/em-subscribe-editor.h @@ -23,6 +23,6 @@ #include -GtkDialog *em_subscribe_editor_new(void); +GtkWidget *em_subscribe_editor_new(void); #endif /* ! _EM_SUBSCRIBE_EDITOR_H */ diff --git a/mail/em-vfolder-editor.c b/mail/em-vfolder-editor.c index b0614d937f..9c43b211ed 100644 --- a/mail/em-vfolder-editor.c +++ b/mail/em-vfolder-editor.c @@ -99,7 +99,7 @@ em_vfolder_editor_get_type (void) * * Return value: A new #EMVFolderEditor object. **/ -EMVFolderEditor * +GtkWidget * em_vfolder_editor_new (EMVFolderContext *vc) { EMVFolderEditor *ve = (EMVFolderEditor *) g_object_new (em_vfolder_editor_get_type(), NULL); @@ -116,7 +116,7 @@ em_vfolder_editor_new (EMVFolderContext *vc) gtk_widget_hide(glade_xml_get_widget (gui, "filter_source")); g_object_unref (gui); - return ve; + return GTK_WIDGET (ve); } static FilterRule * diff --git a/mail/em-vfolder-editor.h b/mail/em-vfolder-editor.h index bbdb6ffce8..d46c35fa3d 100644 --- a/mail/em-vfolder-editor.h +++ b/mail/em-vfolder-editor.h @@ -47,6 +47,6 @@ struct _EMVFolderEditorClass { GType em_vfolder_editor_get_type (void); -EMVFolderEditor *em_vfolder_editor_new (EMVFolderContext *vc); +GtkWidget *em_vfolder_editor_new (EMVFolderContext *vc); #endif /* ! _EM_VFOLDER_EDITOR_H */ diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 4498817afa..19d3f23061 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -31,8 +31,8 @@ #include #include #include +#include -#include "libedataserver/e-account-list.h" #include "e-util/e-error.h" #include "e-util/e-util-private.h" @@ -1024,48 +1024,42 @@ vfolder_revert(void) g_free(user); } -static GtkWidget *vfolder_editor = NULL; - -static void -em_vfolder_editor_response (GtkWidget *dialog, int button, void *data) +void +vfolder_edit (EShellView *shell_view) { + EShellModule *shell_module; + EShellWindow *shell_window; + GtkWidget *dialog; const gchar *data_dir; - char *user; + gchar *filename; - data_dir = e_shell_module_get_data_dir (mail_shell_module); - user = g_build_filename (data_dir, "vfolders.xml", NULL); + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - switch(button) { - case GTK_RESPONSE_OK: - rule_context_save((RuleContext *)context, user); - break; - default: - rule_context_revert((RuleContext *)context, user); - } - - vfolder_editor = NULL; + shell_module = e_shell_view_get_shell_module (shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); - gtk_widget_destroy(dialog); - - g_free (user); -} - -void -vfolder_edit (void) -{ - if (vfolder_editor) { - gdk_window_raise (GTK_WIDGET (vfolder_editor)->window); - return; - } + data_dir = e_shell_module_get_data_dir (shell_module); + filename = g_build_filename (data_dir, "vfolders.xml", NULL); /* ensures vfolder is running */ vfolder_load_storage (); - vfolder_editor = GTK_WIDGET (em_vfolder_editor_new (context)); - gtk_window_set_title (GTK_WINDOW (vfolder_editor), _("Search Folders")); - g_signal_connect(vfolder_editor, "response", G_CALLBACK(em_vfolder_editor_response), NULL); + dialog = em_vfolder_editor_new (context); + gtk_window_set_title ( + GTK_WINDOW (dialog), _("Search Folders")); + gtk_window_set_transient_for ( + GTK_WINDOW (dialog), GTK_WINDOW (shell_window)); + + switch (gtk_dialog_run (GTK_DIALOG (dialog))) { + case GTK_RESPONSE_OK: + rule_context_save ((RuleContext *) context, filename); + break; + default: + rule_context_revert ((RuleContext *) context, filename); + break; + } - gtk_widget_show (vfolder_editor); + gtk_widget_destroy (dialog); } static void diff --git a/mail/mail-vfolder.h b/mail/mail-vfolder.h index b0f684e721..2db87654b1 100644 --- a/mail/mail-vfolder.h +++ b/mail/mail-vfolder.h @@ -22,6 +22,8 @@ #ifndef _MAIL_VFOLDER_H #define _MAIL_VFOLDER_H +#include + struct _CamelStore; struct _FilterPart; struct _FilterRule; @@ -32,7 +34,7 @@ struct _CamelInternetAddress; void vfolder_load_storage(void); void vfolder_revert(void); -void vfolder_edit (void); +void vfolder_edit (EShellView *shell_view); void vfolder_edit_rule(const char *name); struct _FilterPart *vfolder_create_part (const char *name); struct _FilterRule *vfolder_clone_rule (struct _FilterRule *in); -- cgit