diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-08-09 09:09:55 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-08-09 09:09:55 +0800 |
commit | b9a9cd3a8699c350dc6746c595e4de3e030545c4 (patch) | |
tree | 525676e7afd76aa1babe4fdf6dfe8ab8d16a1feb /mail | |
parent | 4b65801638f2d6b4cfefb9cc13966a7557e2f946 (diff) | |
download | gsoc2013-evolution-b9a9cd3a8699c350dc6746c595e4de3e030545c4.tar.gz gsoc2013-evolution-b9a9cd3a8699c350dc6746c595e4de3e030545c4.tar.zst gsoc2013-evolution-b9a9cd3a8699c350dc6746c595e4de3e030545c4.zip |
New convenience function with params of a normal Gtk callback function. We
2000-08-08 Jeffrey Stedfast <fejj@helixcode.com>
* mail-ops.c (view_msg): New convenience function with params of a
normal Gtk callback function. We also now create a new
FolderBrowser object so that the message-view window isn't tied to
the display in the main window
(view_message): Now calls view_msg (this function is a bonobo
callback and can't be used with gtk widgets)
(edit_msg): Same idea as view_msg()
(edit_message): Again, same as view_message()
* message-list.c (on_right_click): Callback for creating an
e-popup-menu
(message_list_init): Added a right_click event to trigger a pop-up
menu to be displayed
svn path=/trunk/; revision=4619
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 16 | ||||
-rw-r--r-- | mail/folder-browser.h | 12 | ||||
-rw-r--r-- | mail/mail-ops.c | 37 | ||||
-rw-r--r-- | mail/mail-view.c | 3 | ||||
-rw-r--r-- | mail/mail.h | 18 | ||||
-rw-r--r-- | mail/message-list.c | 49 | ||||
-rw-r--r-- | mail/message-list.h | 3 |
7 files changed, 99 insertions, 39 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index da283d361e..dfed8018b3 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,19 @@ +2000-08-08 Jeffrey Stedfast <fejj@helixcode.com> + + * mail-ops.c (view_msg): New convenience function with params of a + normal Gtk callback function. We also now create a new + FolderBrowser object so that the message-view window isn't tied to + the display in the main window + (view_message): Now calls view_msg (this function is a bonobo + callback and can't be used with gtk widgets) + (edit_msg): Same idea as view_msg() + (edit_message): Again, same as view_message() + + * message-list.c (on_right_click): Callback for creating an + e-popup-menu + (message_list_init): Added a right_click event to trigger a pop-up + menu to be displayed + 2000-08-08 Dan Winship <danw@helixcode.com> * mail-config-gui.c: Add "Don't delete messages from server" diff --git a/mail/folder-browser.h b/mail/folder-browser.h index ae16b64153..0bc3edf9c8 100644 --- a/mail/folder-browser.h +++ b/mail/folder-browser.h @@ -22,14 +22,14 @@ struct _FolderBrowser { GtkTable parent; - + BonoboPropertyBag *properties; - + Evolution_Shell shell; - + /* This is a kludge for the toolbar problem. */ int serial; - + /* * The current URI being displayed by the FolderBrowser */ @@ -42,9 +42,9 @@ struct _FolderBrowser { GtkWidget *vpaned; GtkWidget *search_menu; GtkWidget *search_entry; - + gboolean preview_shown; - + }; diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 70d0c0b82d..be8fd3ee5d 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -720,13 +720,13 @@ reply (FolderBrowser *fb, gboolean to_all) } void -reply_to_sender (GtkWidget *button, gpointer user_data) +reply_to_sender (GtkWidget *widget, gpointer user_data) { reply (FOLDER_BROWSER (user_data), FALSE); } void -reply_to_all (GtkWidget *button, gpointer user_data) +reply_to_all (GtkWidget *widget, gpointer user_data) { reply (FOLDER_BROWSER (user_data), TRUE); } @@ -739,7 +739,7 @@ attach_msg (MessageList *ml, const char *uid, gpointer data) CamelMimePart *part; const char *subject; char *desc; - + message = camel_folder_get_message (ml->folder, uid, NULL); if (!message) return; @@ -748,23 +748,23 @@ attach_msg (MessageList *ml, const char *uid, gpointer data) desc = g_strdup_printf ("Forwarded message - %s", subject); else desc = g_strdup ("Forwarded message"); - + part = camel_mime_part_new (); camel_mime_part_set_disposition (part, "inline"); camel_mime_part_set_description (part, desc); camel_medium_set_content_object (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (message)); camel_mime_part_set_content_type (part, "message/rfc822"); - + e_msg_composer_attach (composer, part); - + gtk_object_unref (GTK_OBJECT (part)); gtk_object_unref (GTK_OBJECT (message)); g_free (desc); } void -forward_msg (GtkWidget *button, gpointer user_data) +forward_msg (GtkWidget *widget, gpointer user_data) { FolderBrowser *fb = FOLDER_BROWSER (user_data); EMsgComposer *composer; @@ -818,7 +818,7 @@ real_move_msg (MessageList *ml, const char *uid, gpointer user_data) } void -move_msg (GtkWidget *button, gpointer user_data) +move_msg (GtkWidget *widget, gpointer user_data) { FolderBrowser *fb = user_data; MessageList *ml = fb->message_list; @@ -894,7 +894,7 @@ real_edit_msg (MessageList *ml, const char *uid, gpointer user_data) } void -edit_message (BonoboUIHandler *uih, void *user_data, const char *path) +edit_msg (GtkWidget *widget, gpointer user_data) { FolderBrowser *fb = FOLDER_BROWSER (user_data); MessageList *ml = fb->message_list; @@ -918,6 +918,12 @@ edit_message (BonoboUIHandler *uih, void *user_data, const char *path) } } +void +edit_message (BonoboUIHandler *uih, void *user_data, const char *path) +{ + edit_msg (NULL, user_data); +} + static void real_delete_msg (MessageList *ml, const char *uid, gpointer user_data) { @@ -1094,16 +1100,20 @@ real_view_msg (MessageList *ml, const char *uid, gpointer user_data) } void -view_message (BonoboUIHandler *uih, void *user_data, const char *path) +view_msg (GtkWidget *widget, gpointer user_data) { struct view_msg_data data; FolderBrowser *fb = user_data; + FolderBrowser *folder_browser; CamelException ex; MessageList *ml; camel_exception_init (&ex); - data.fb = fb; + folder_browser = FOLDER_BROWSER (folder_browser_new ()); + folder_browser_set_uri (folder_browser, fb->uri); + + data.fb = folder_browser; data.ex = &ex; ml = fb->message_list; @@ -1115,3 +1125,8 @@ view_message (BonoboUIHandler *uih, void *user_data, const char *path) } } +void +view_message (BonoboUIHandler *uih, void *user_data, const char *path) +{ + view_msg (NULL, user_data); +} diff --git a/mail/mail-view.c b/mail/mail-view.c index 9db0194ce7..b86284e250 100644 --- a/mail/mail-view.c +++ b/mail/mail-view.c @@ -94,6 +94,7 @@ mail_view_create (CamelMimeMessage *msg, FolderBrowser *folder_browser) subject = ""; window = gnome_app_new ("Evolution", subject); + toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar), @@ -127,5 +128,3 @@ mail_view_create (CamelMimeMessage *msg, FolderBrowser *folder_browser) return window; } - - diff --git a/mail/mail.h b/mail/mail.h index bb28ae1e15..60d444bd78 100644 --- a/mail/mail.h +++ b/mail/mail.h @@ -61,15 +61,17 @@ char *mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, char *mail_identify_mime_part (CamelMimePart *part); /* mail-ops */ -void fetch_mail (GtkWidget *button, gpointer user_data); -void compose_msg (GtkWidget *button, gpointer user_data); +void fetch_mail (GtkWidget *widget, gpointer user_data); +void compose_msg (GtkWidget *widget, gpointer user_data); 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 move_msg (GtkWidget *button, gpointer user_data); -void print_msg (GtkWidget *button, gpointer user_data); +void forward_msg (GtkWidget *widget, gpointer user_data); +void reply_to_sender (GtkWidget *widget, gpointer user_data); +void reply_to_all (GtkWidget *widget, gpointer user_data); +void delete_msg (GtkWidget *widget, gpointer user_data); +void move_msg (GtkWidget *widget, gpointer user_data); +void print_msg (GtkWidget *widget, gpointer user_data); +void edit_msg (GtkWidget *widget, gpointer user_data); +void view_msg (GtkWidget *widget, gpointer user_data); void mark_all_seen (BonoboUIHandler *uih, void *user_data, const char *path); void edit_message (BonoboUIHandler *uih, void *user_data, const char *path); diff --git a/mail/message-list.c b/mail/message-list.c index 2a390530e4..eb6a163bcc 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -12,12 +12,14 @@ #include <config.h> #include <gnome.h> #include <bonobo/bonobo-main.h> -#include "e-util/e-util.h" -#include "e-util/e-gui-utils.h" -#include "camel/camel-exception.h" +#include <e-util/e-util.h> +#include <e-util/e-gui-utils.h> +#include <e-util/e-popup-menu.h> +#include <camel/camel-exception.h> #include <camel/camel-folder.h> #include "message-list.h" #include "message-thread.h" +#include "mail.h" #include "Mail.h" #include "widgets/e-table/e-table-header-item.h" #include "widgets/e-table/e-table-item.h" @@ -58,6 +60,7 @@ static POA_Evolution_MessageList__vepv evolution_message_list_vepv; static void on_cursor_change_cmd (ETableScrolled *table, int row, gpointer user_data); static void select_row (ETableScrolled *table, gpointer user_data); +static gint on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, MessageList *list); static void select_msg (MessageList *message_list, gint row); static char *filter_date (const void *data); @@ -553,38 +556,41 @@ message_list_init (GtkObject *object) { MessageList *message_list = MESSAGE_LIST (object); char *spec; - + message_list->table_model = (ETableModel *) e_tree_simple_new (ml_tree_icon_at, ml_tree_value_at, ml_tree_set_value_at, ml_tree_is_cell_editable, message_list); e_tree_model_root_node_set_visible ((ETreeModel *)message_list->table_model, FALSE); - + message_list_init_renderers (message_list); message_list_init_header (message_list); - + /* * The etable */ - + spec = message_list_get_layout (message_list); message_list->etable = e_table_scrolled_new ( message_list->header_model, message_list->table_model, spec); g_free (spec); - + gtk_object_set(GTK_OBJECT(message_list->etable), "cursor_mode", E_TABLE_CURSOR_LINE, "drawfocus", FALSE, "drawgrid", FALSE, NULL); - + gtk_signal_connect (GTK_OBJECT (message_list->etable), "realize", GTK_SIGNAL_FUNC (select_row), message_list); gtk_signal_connect (GTK_OBJECT (message_list->etable), "cursor_change", GTK_SIGNAL_FUNC (on_cursor_change_cmd), message_list); - + + gtk_signal_connect (GTK_OBJECT (message_list->etable), "right_click", + GTK_SIGNAL_FUNC (on_right_click), message_list); + gtk_widget_show (message_list->etable); gtk_object_ref (GTK_OBJECT (message_list->table_model)); @@ -967,6 +973,29 @@ select_row (ETableScrolled *table, gpointer user_data) gtk_idle_add (idle_select_row, message_list->etable); } +static gint +on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, MessageList *list) +{ + FolderBrowser *fb = list->parent_folder_browser; + extern CamelFolder *drafts_folder; + EPopupMenu menu[] = { + { "View Message", NULL, GTK_SIGNAL_FUNC (view_msg), 0 }, + { "Edit Message", NULL, GTK_SIGNAL_FUNC (edit_msg), 1 }, + { "Print Message", NULL, GTK_SIGNAL_FUNC (print_msg), 0 }, + { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, + { "Reply to Sender", NULL, GTK_SIGNAL_FUNC (reply_to_sender), 0 }, + { "Reply to All", NULL, GTK_SIGNAL_FUNC (reply_to_all), 0 }, + { "Forward Message", NULL, GTK_SIGNAL_FUNC (forward_msg), 0 }, + { "", NULL, GTK_SIGNAL_FUNC (NULL), 0 }, + { "Delete Message", NULL, GTK_SIGNAL_FUNC (delete_msg), 0 }, + { "Move Message", NULL, GTK_SIGNAL_FUNC (move_msg), 0 }, + { NULL, NULL, NULL, 0 } + }; + + e_popup_menu_run (menu, (GdkEventButton *)event, (fb->folder == drafts_folder) ? 0 : 1, fb); + + return TRUE; +} struct message_list_foreach_data { MessageList *message_list; diff --git a/mail/message-list.h b/mail/message-list.h index 4406536110..f21361ef17 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -2,11 +2,11 @@ #ifndef _MESSAGE_LIST_H_ #define _MESSAGE_LIST_H_ +#include <gnome.h> #include "mail-types.h" #include <bonobo/bonobo-main.h> #include <bonobo/bonobo-object.h> #include <bonobo/bonobo-ui-handler.h> -#include "camel/camel-folder.h" #include "e-table/e-table-scrolled.h" #include "e-table/e-table-simple.h" #include "e-table/e-tree-simple.h" @@ -116,4 +116,3 @@ void message_list_toggle_threads (BonoboUIHandler *uih, const char *path); #endif /* _MESSAGE_LIST_H_ */ - |