diff options
author | Michael Zucci <zucchi@src.gnome.org> | 2000-05-02 11:00:56 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-05-02 11:00:56 +0800 |
commit | 0cb506a96abd31962280e8c1f4372c5163489a48 (patch) | |
tree | b07e10f61b942e6f6ff4cb5f9c3e51495b078603 | |
parent | 2cc9dabf78074ba6dfa4f3c84285b607fdf8cc54 (diff) | |
download | gsoc2013-evolution-0cb506a96abd31962280e8c1f4372c5163489a48.tar.gz gsoc2013-evolution-0cb506a96abd31962280e8c1f4372c5163489a48.tar.zst gsoc2013-evolution-0cb506a96abd31962280e8c1f4372c5163489a48.zip |
Ok, you can now delete and expunge messages ... not really pretty
(gui wise), but it works, after a fashion.
> * folder-browser-factory.c: Setup callback for actual delete op.
> (control_activate): Setup a tool menu item to expnge deleted
> messages.
>
> * mail-ops.c (delete_msg): Toggle the delete flag on a message.
> (expunge_folder): New function to expunge deleted messages from
> the current folder.
svn path=/trunk/; revision=2744
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 10 | ||||
-rw-r--r-- | mail/mail-ops.c | 42 | ||||
-rw-r--r-- | mail/mail-ops.h | 2 |
4 files changed, 60 insertions, 2 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 2760e4f3de..0f47f2f001 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,13 @@ 2000-05-01 NotZed <NotZed@HelixCode.com> + * folder-browser-factory.c: Setup callback for actual delete op. + (control_activate): Setup a tool menu item to expnge deleted + messages. + + * mail-ops.c (delete_msg): Toggle the delete flag on a message. + (expunge_folder): New function to expunge deleted messages from + the current folder. + * folder-browser.c (folder_browser_gui_init): A hackish little quick-search entry. (search_activate): Perform a quick-search on the folder subject diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index a485df29d9..10f0e50a88 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -126,7 +126,7 @@ static GnomeUIInfo gnome_toolbar [] = { GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print the selected message"), random_cb, GNOME_STOCK_PIXMAP_PRINT), - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete this message"), random_cb, GNOME_STOCK_PIXMAP_TRASH), + GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete this message"), delete_msg, GNOME_STOCK_PIXMAP_TRASH), GNOMEUIINFO_END }; @@ -141,12 +141,17 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih) remote_uih = bonobo_control_get_remote_ui_handler (control); bonobo_ui_handler_set_container (uih, remote_uih); + folder_browser = bonobo_control_get_widget (control); + bonobo_ui_handler_menu_new_item (uih, "/File/Mail", N_("_Mail"), NULL, -1, BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, 0, 0, send_msg, NULL); - folder_browser = bonobo_control_get_widget (control); + bonobo_ui_handler_menu_new_item (uih, "/Tools/Expunge", N_("_Expunge"), + NULL, -1, + BONOBO_UI_HANDLER_PIXMAP_STOCK, GNOME_STOCK_PIXMAP_TRASH, + 0, 0, expunge_folder, folder_browser); toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); @@ -170,6 +175,7 @@ static void control_deactivate (BonoboControl *control, BonoboUIHandler *uih) { bonobo_ui_handler_menu_remove (uih, "/File/Mail"); + bonobo_ui_handler_menu_remove (uih, "/Tools/Expunge"); bonobo_ui_handler_dock_remove (uih, "/Toolbar"); } diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 961f82304e..d9a5b6c113 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -329,3 +329,45 @@ forward_msg (GtkWidget *button, gpointer user_data) gtk_widget_show (GTK_WIDGET (composer)); } + +void +delete_msg (GtkWidget *button, gpointer user_data) +{ + FolderBrowser *fb = user_data; + + if (fb->mail_display->current_message) { + guint32 flags; + + /* FIXME: table should watch the message with a signal and update display! */ + + flags = camel_mime_message_get_flags(fb->mail_display->current_message); + camel_mime_message_set_flags(fb->mail_display->current_message, CAMEL_MESSAGE_DELETED, ~flags); + printf("Message %s set to %s\n", fb->mail_display->current_message->message_uid, flags&CAMEL_MESSAGE_DELETED?"UNDELETED":"DELETED"); + } +} + +void +expunge_folder (GtkWidget *button, gpointer user_data) +{ + FolderBrowser *fb = FOLDER_BROWSER(user_data); + CamelException ex; + + if (fb->message_list->folder) { + camel_exception_init(&ex); + + camel_folder_expunge(fb->message_list->folder, &ex); + + /* FIXME: is there a better way to force an update? */ + /* FIXME: Folder should raise a signal to say its contents has changed ... */ + e_table_model_changed (fb->message_list->table_model); + +/* this always throws an error, when it shouldn't? */ +#if 0 + if (camel_exception_get_id (&ex) != CAMEL_EXCEPTION_NONE) { + GtkWindow *window = GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb), GTK_TYPE_WINDOW)); + mail_exception_dialog ("Unable to expunge deleted messages", &ex, window); + } +#endif + } +} + diff --git a/mail/mail-ops.h b/mail/mail-ops.h index 6206c252cd..463e74c0ef 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -4,3 +4,5 @@ void send_to_url (const char *url); void forward_msg (GtkWidget *button, gpointer user_data); void reply_to_sender (GtkWidget *button, gpointer user_data); void reply_to_all (GtkWidget *button, gpointer user_data); +void delete_msg (GtkWidget *button, gpointer user_data); +void expunge_folder (GtkWidget *button, gpointer user_data); |