diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 28 | ||||
-rw-r--r-- | mail/folder-browser.c | 21 | ||||
-rw-r--r-- | mail/folder-browser.h | 2 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 18 | ||||
-rw-r--r-- | mail/mail-local.c | 2 | ||||
-rw-r--r-- | mail/message-list.c | 217 | ||||
-rw-r--r-- | mail/message-list.h | 40 |
7 files changed, 129 insertions, 199 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 4c583db0c9..184b72ead3 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,31 @@ +2000-12-11 Dan Winship <danw@helixcode.com> + + * message-list.c: Remove the never-once-used BonoboObject stuff + and make MessageList be a GtkWidget instead. Also, keep track of + the ETable directly rather than repeatedly calling + e_table_scrolled_get_table. + + * folder-browser.c (folder_browser_destroy): Use gtk methods + rather than bonobo methods to destroy the message list. + (on_right_click, on_double_click): These are being attached to the + ETable directly now, so fix the first argument (which isn't being + used anyway, but...) + (folder_browser_gui_init): simplify now that MessageList itself is + a widget. Also use message_list->table rather than + e_table_scrolled_get_table. + + * mail-local.c (mail_local_reconfigure_folder): Add "mail_" to + the beginning of this function name to match its prototype and the + other vague namespace conventions in the mailer. + + * mail-callbacks.c (select_all, invert_selection): Use ml->table. + (configure_folder): s/local_reconfigure_folder/mail_&/ + + * mail-ops.c (do_flag_messages): clean up the cleanup a bit + + * mail-tools.c (mail_tool_quote_message): Remove an unused + variable. + 2000-12-11 Not Zed <NotZed@HelixCode.com> * local-config.glade: reordered the options and added maildir, diff --git a/mail/folder-browser.c b/mail/folder-browser.c index f5180d3134..a557f64a98 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -70,7 +70,7 @@ folder_browser_destroy (GtkObject *object) } if (folder_browser->message_list) - bonobo_object_unref (BONOBO_OBJECT (folder_browser->message_list)); + gtk_widget_destroy (GTK_WIDGET (folder_browser->message_list)); if (folder_browser->mail_display) gtk_widget_destroy (GTK_WIDGET (folder_browser->mail_display)); @@ -441,7 +441,7 @@ filter_mlist (GtkWidget *w, FolderBrowser *fb) /* handle context menu over message-list */ static gint -on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, FolderBrowser *fb) +on_right_click (ETable *table, gint row, gint col, GdkEvent *event, FolderBrowser *fb) { extern CamelFolder *drafts_folder; const CamelMessageInfo *info; @@ -631,7 +631,7 @@ etable_key (ETable *table, int row, int col, GdkEvent *ev, FolderBrowser *fb) } static void -on_double_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, FolderBrowser *fb) +on_double_click (ETable *table, gint row, gint col, GdkEvent *event, FolderBrowser *fb) { view_msg (NULL, fb); } @@ -665,11 +665,10 @@ folder_browser_gui_init (FolderBrowser *fb) 0, 0, 0); - fb->message_list_w = message_list_get_widget (fb->message_list); - e_paned_add1 (E_PANED (fb->vpaned), fb->message_list_w); - gtk_widget_show (fb->message_list_w); + e_paned_add1 (E_PANED (fb->vpaned), GTK_WIDGET (fb->message_list)); + gtk_widget_show (GTK_WIDGET (fb->message_list)); - gtk_signal_connect (GTK_OBJECT (fb->message_list_w), "size_allocate", + gtk_signal_connect (GTK_OBJECT (fb->message_list), "size_allocate", GTK_SIGNAL_FUNC (fb_resize_cb), NULL); e_paned_add2 (E_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display)); @@ -723,13 +722,13 @@ my_folder_browser_init (GtkObject *object) fb->message_list = (MessageList *)message_list_new (); fb->mail_display = (MailDisplay *)mail_display_new (); - gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table(E_TABLE_SCROLLED(fb->message_list->etable))), + gtk_signal_connect (GTK_OBJECT (fb->message_list->table), "key_press", GTK_SIGNAL_FUNC (etable_key), fb); - gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table(E_TABLE_SCROLLED(fb->message_list->etable))), + gtk_signal_connect (GTK_OBJECT (fb->message_list->table), "right_click", GTK_SIGNAL_FUNC (on_right_click), fb); - - gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table(E_TABLE_SCROLLED(fb->message_list->etable))), + + gtk_signal_connect (GTK_OBJECT (fb->message_list->table), "double_click", GTK_SIGNAL_FUNC (on_double_click), fb); gtk_signal_connect (GTK_OBJECT(fb->message_list), "message_selected", diff --git a/mail/folder-browser.h b/mail/folder-browser.h index d2b6c8b317..fd1d6f2ac7 100644 --- a/mail/folder-browser.h +++ b/mail/folder-browser.h @@ -8,6 +8,7 @@ #include <gtk/gtktable.h> #include "camel/camel-stream.h" #include <bonobo/bonobo-property-bag.h> +#include <bonobo/bonobo-ui-component.h> #include "filter/e-search-bar.h" #include "filter/filter-rule.h" #include "filter/filter-context.h" /*eek*/ @@ -36,7 +37,6 @@ struct _FolderBrowser { CamelFolder *folder; MessageList *message_list; - GtkWidget *message_list_w; MailDisplay *mail_display; GtkWidget *vpaned; diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 9432ce3ce7..deaabb00ac 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -592,13 +592,11 @@ select_all (BonoboUIComponent *uih, void *user_data, const char *path) { FolderBrowser *fb = FOLDER_BROWSER (user_data); MessageList *ml = fb->message_list; - ETableScrolled *scrolled; - + if (ml->folder == NULL) return; - - scrolled = E_TABLE_SCROLLED (ml->etable); - e_table_select_all (scrolled->table); + + e_table_select_all (ml->table); } void @@ -606,13 +604,11 @@ invert_selection (BonoboUIComponent *uih, void *user_data, const char *path) { FolderBrowser *fb = FOLDER_BROWSER (user_data); MessageList *ml = fb->message_list; - ETableScrolled *scrolled; - + if (ml->folder == NULL) return; - - scrolled = E_TABLE_SCROLLED (ml->etable); - e_table_invert_selection (scrolled->table); + + e_table_invert_selection (ml->table); } void @@ -1009,7 +1005,7 @@ configure_folder (BonoboUIComponent *uih, void *user_data, const char *path) { FolderBrowser *fb = FOLDER_BROWSER(user_data); - local_reconfigure_folder(fb); + mail_local_reconfigure_folder(fb); } void diff --git a/mail/mail-local.c b/mail/mail-local.c index 1a03b649fd..dac7cbb2b8 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -421,7 +421,7 @@ reconfigure_clicked(GnomeDialog *d, int button, reconfigure_folder_input_t *data void local_reconfigure_folder(FolderBrowser *fb); void -local_reconfigure_folder(FolderBrowser *fb) +mail_local_reconfigure_folder(FolderBrowser *fb) { CamelStore *store; GladeXML *gui; diff --git a/mail/message-list.c b/mail/message-list.c index 08b6fe73d2..6507394414 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -13,7 +13,6 @@ #include <config.h> #include <gnome.h> -#include <bonobo/bonobo-main.h> #include <camel/camel-exception.h> #include <camel/camel-folder.h> #include <e-util/ename/e-name-western.h> @@ -81,7 +80,7 @@ #define COL_SIZE_EXPANSION (6.0) #define COL_SIZE_WIDTH_MIN (32) -#define PARENT_TYPE (bonobo_object_get_type ()) +#define PARENT_TYPE (e_table_scrolled_get_type ()) struct _EMailAddress { ENameWestern *wname; @@ -90,8 +89,7 @@ struct _EMailAddress { typedef struct _EMailAddress EMailAddress; -static BonoboObjectClass *message_list_parent_class; -static POA_GNOME_Evolution_MessageList__vepv evolution_message_list_vepv; +static ETableScrolledClass *message_list_parent_class; static void on_cursor_change_cmd (ETableScrolled *table, int row, gpointer user_data); static gint on_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, MessageList *list); @@ -365,7 +363,7 @@ message_list_select (MessageList *message_list, int base_row, { const CamelMessageInfo *info; int vrow, mrow, last; - ETable *et = e_table_scrolled_get_table(E_TABLE_SCROLLED (message_list->etable)); + ETable *et = message_list->table; switch (direction) { case MESSAGE_LIST_SELECT_PREVIOUS: @@ -1014,12 +1012,11 @@ save_header_state(MessageList *ml) { char *filename; - if (ml->folder == NULL - || ml->etable == NULL) + if (ml->folder == NULL || ml->table == NULL) return; filename = mail_config_folder_to_cachename(ml->folder, "et-header-"); - e_table_save_state(e_table_scrolled_get_table(E_TABLE_SCROLLED(ml->etable)), filename); + e_table_save_state(ml->table, filename); g_free(filename); } @@ -1060,7 +1057,7 @@ message_list_setup_etable(MessageList *message_list) if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) { /* build based on saved file */ - e_table_load_state (e_table_scrolled_get_table(E_TABLE_SCROLLED (message_list->etable)), path); + e_table_load_state (message_list->table, path); } else if (strstr (name, "/Drafts") || strstr (name, "/Outbox") || strstr (name, "/Sent")) { /* these folders have special defaults */ char *state = "<ETableState>" @@ -1068,7 +1065,7 @@ message_list_setup_etable(MessageList *message_list) "<column source=\"8\"/> <column source=\"5\"/> " "<column source=\"6\"/> <grouping> </grouping> </ETableState>"; - e_table_set_state (e_table_scrolled_get_table(E_TABLE_SCROLLED (message_list->etable)), state); + e_table_set_state (message_list->table, state); } g_free (path); @@ -1082,67 +1079,10 @@ message_list_setup_etable(MessageList *message_list) static void message_list_init (GtkObject *object) { - ETableExtras *extras; MessageList *message_list = MESSAGE_LIST (object); - char *spec; - - message_list->table_model = (ETableModel *) - e_tree_simple_new (ml_col_count, - ml_duplicate_value, - ml_free_value, - ml_initialize_value, - ml_value_is_empty, - ml_value_to_string, - 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); - - /* - * The etable - */ - - spec = message_list_get_layout (message_list); - extras = message_list_create_extras(); - message_list->etable = e_table_scrolled_new (message_list->table_model, extras, spec, NULL); - g_free (spec); - gtk_object_sink(GTK_OBJECT(extras)); - - e_scroll_frame_set_policy (E_SCROLL_FRAME (message_list->etable), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - - gtk_object_set(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(message_list->etable))), - "drawfocus", FALSE, - NULL); - - /* - *gtk_signal_connect (GTK_OBJECT (message_list->etable), "realize", - * GTK_SIGNAL_FUNC (select_row), message_list); - */ - gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table(E_TABLE_SCROLLED(message_list->etable))), "cursor_change", - GTK_SIGNAL_FUNC (on_cursor_change_cmd), message_list); - - gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table(E_TABLE_SCROLLED(message_list->etable))), "click", - GTK_SIGNAL_FUNC (on_click), message_list); - - /* drag & drop */ - e_table_drag_source_set (e_table_scrolled_get_table(E_TABLE_SCROLLED (message_list->etable)), GDK_BUTTON1_MASK, - drag_types, num_drag_types, GDK_ACTION_MOVE); - - gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table(E_TABLE_SCROLLED(message_list->etable))), "drag_data_get", - GTK_SIGNAL_FUNC (message_list_drag_data_get), message_list); - - gtk_widget_show (message_list->etable); - - gtk_object_ref (GTK_OBJECT (message_list->table_model)); - gtk_object_sink (GTK_OBJECT (message_list->table_model)); - - /* - * We do own the Etable, not some widget container - */ - gtk_object_ref (GTK_OBJECT (message_list->etable)); - gtk_object_sink (GTK_OBJECT (message_list->etable)); + e_scroll_frame_set_policy (E_SCROLL_FRAME (message_list), + GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); message_list->uid_rowmap = g_hash_table_new (g_str_hash, g_str_equal); message_list->uid_pool = e_mempool_new(1024, 512, E_MEMPOOL_ALIGN_BYTE); @@ -1159,7 +1099,6 @@ message_list_destroy (GtkObject *object) } gtk_object_unref (GTK_OBJECT (message_list->table_model)); - gtk_object_unref (GTK_OBJECT (message_list->etable)); g_hash_table_destroy (message_list->uid_rowmap); e_mempool_destroy(message_list->uid_pool); @@ -1182,48 +1121,6 @@ message_list_destroy (GtkObject *object) } /* - * CORBA method: Evolution::MessageList::select_message - */ -static void -MessageList_select_message (PortableServer_Servant _servant, - const CORBA_long message_number, - CORBA_Environment *ev) -{ - printf ("FIXME: select message method\n"); -} - -/* - * CORBA method: Evolution::MessageList::open_message - */ -static void -MessageList_open_message (PortableServer_Servant _servant, - const CORBA_long message_number, - CORBA_Environment *ev) -{ - printf ("FIXME: open message method\n"); -} - -static POA_GNOME_Evolution_MessageList__epv * -evolution_message_list_get_epv (void) -{ - POA_GNOME_Evolution_MessageList__epv *epv; - - epv = g_new0 (POA_GNOME_Evolution_MessageList__epv, 1); - - epv->selectMessage = MessageList_select_message; - epv->openMessage = MessageList_open_message; - - return epv; -} - -static void -message_list_corba_class_init (void) -{ - evolution_message_list_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - evolution_message_list_vepv.GNOME_Evolution_MessageList_epv = evolution_message_list_get_epv (); -} - -/* * GtkObjectClass::init */ static void @@ -1233,8 +1130,6 @@ message_list_class_init (GtkObjectClass *object_class) object_class->destroy = message_list_destroy; - message_list_corba_class_init (); - message_list_signals[MESSAGE_SELECTED] = gtk_signal_new ("message_selected", GTK_RUN_LAST, @@ -1249,51 +1144,71 @@ message_list_class_init (GtkObjectClass *object_class) } static void -message_list_construct (MessageList *message_list, GNOME_Evolution_MessageList corba_message_list) +message_list_construct (MessageList *message_list) { - bonobo_object_construct (BONOBO_OBJECT (message_list), corba_message_list); -} + ETableExtras *extras; + char *spec; -static GNOME_Evolution_MessageList -create_corba_message_list (BonoboObject *object) -{ - POA_GNOME_Evolution_MessageList *servant; - CORBA_Environment ev; + message_list->table_model = (ETableModel *) + e_tree_simple_new (ml_col_count, + ml_duplicate_value, + ml_free_value, + ml_initialize_value, + ml_value_is_empty, + ml_value_to_string, + ml_tree_icon_at, ml_tree_value_at, + ml_tree_set_value_at, + ml_tree_is_cell_editable, + message_list); + gtk_object_ref (GTK_OBJECT (message_list->table_model)); + gtk_object_sink (GTK_OBJECT (message_list->table_model)); + + e_tree_model_root_node_set_visible ((ETreeModel *)message_list->table_model, FALSE); - servant = (POA_GNOME_Evolution_MessageList *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &evolution_message_list_vepv; + /* + * The etable + */ + spec = message_list_get_layout (message_list); + extras = message_list_create_extras (); + e_table_scrolled_construct (E_TABLE_SCROLLED (message_list), + message_list->table_model, + extras, spec, NULL); + message_list->table = + e_table_scrolled_get_table (E_TABLE_SCROLLED (message_list)); + g_free (spec); + gtk_object_sink (GTK_OBJECT (extras)); - CORBA_exception_init (&ev); - POA_GNOME_Evolution_MessageList__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION){ - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } + gtk_object_set (GTK_OBJECT (message_list->table), "drawfocus", + FALSE, NULL); + + gtk_signal_connect (GTK_OBJECT (message_list->table), "cursor_change", + GTK_SIGNAL_FUNC (on_cursor_change_cmd), + message_list); - CORBA_exception_free (&ev); - return (GNOME_Evolution_MessageList) bonobo_object_activate_servant (object, servant); + gtk_signal_connect (GTK_OBJECT (message_list->table), "click", + GTK_SIGNAL_FUNC (on_click), message_list); + + /* drag & drop */ + e_table_drag_source_set (message_list->table, GDK_BUTTON1_MASK, + drag_types, num_drag_types, GDK_ACTION_MOVE); + + gtk_signal_connect (GTK_OBJECT (message_list->table), "drag_data_get", + GTK_SIGNAL_FUNC (message_list_drag_data_get), + message_list); } -BonoboObject * +GtkWidget * message_list_new (void) { - GNOME_Evolution_MessageList corba_object; MessageList *message_list; - message_list = gtk_type_new (message_list_get_type ()); + message_list = MESSAGE_LIST (gtk_widget_new (message_list_get_type (), + "hadjustment", NULL, + "vadjustment", NULL, + NULL)); + message_list_construct (message_list); - corba_object = create_corba_message_list (BONOBO_OBJECT (message_list)); - if (corba_object == CORBA_OBJECT_NIL){ - gtk_object_destroy (GTK_OBJECT (message_list)); - return NULL; - } - - message_list->idle_id = 0; - - message_list_construct (message_list, corba_object); - - return BONOBO_OBJECT (message_list); + return GTK_WIDGET (message_list); } static void @@ -2004,12 +1919,6 @@ message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) mail_do_regenerate_messagelist (message_list, message_list->search, NULL); } -GtkWidget * -message_list_get_widget (MessageList *message_list) -{ - return message_list->etable; -} - E_MAKE_TYPE (message_list, "MessageList", MessageList, message_list_class_init, message_list_init, PARENT_TYPE); static gboolean @@ -2104,7 +2013,7 @@ message_list_foreach (MessageList *message_list, mlfe_data.message_list = message_list; mlfe_data.callback = callback; mlfe_data.user_data = user_data; - e_table_selected_row_foreach (e_table_scrolled_get_table(E_TABLE_SCROLLED (message_list->etable)), + e_table_selected_row_foreach (message_list->table, mlfe_callback, &mlfe_data); } diff --git a/mail/message-list.h b/mail/message-list.h index 400da181c7..d377384732 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -4,9 +4,6 @@ #include <gnome.h> #include "mail-types.h" -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-object.h> -#include <bonobo/bonobo-ui-component.h> #include <gal/e-table/e-table-scrolled.h> #include <gal/e-table/e-table-simple.h> #include <gal/e-table/e-tree-simple.h> @@ -21,8 +18,6 @@ #define IS_MESSAGE_LIST(o) (GTK_CHECK_TYPE ((o), MESSAGE_LIST_TYPE)) #define IS_MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MESSAGE_LIST_TYPE)) -typedef struct _Renderer Renderer; - enum { COL_MESSAGE_STATUS, COL_FLAGGED, @@ -44,35 +39,39 @@ enum { }; struct _MessageList { - BonoboObject parent; - + ETableScrolled parent; + + /* The table */ ETableModel *table_model; - + ETable *table; ETreePath *tree_root; - - GtkWidget *etable; + /* The folder */ CamelFolder *folder; - GHashTable *uid_rowmap; /* key is the uid, value is the row number. - Note: The key string is owned by table_model (in uid_pool) */ - struct _EMemPool *uid_pool; /* mempool to hold uid strings */ + /* UID to model row hash table. Keys owned by the mempool. */ + GHashTable *uid_rowmap; + struct _EMemPool *uid_pool; + + /* Current search string, or %NULL */ + char *search; - char *search; /* current search string */ + /* Are we displaying threaded view? */ + gboolean threaded; - gboolean threaded; /* are we displaying threaded view? */ + /* Where the ETable cursor is. */ int cursor_row; const char *cursor_uid; - - /* row-selection and seen-marking timers */ + + /* Row-selection and seen-marking timers */ guint idle_id, seen_id; }; typedef struct { - BonoboObjectClass parent_class; + ETableScrolledClass parent_class; /* signals - select a message */ - void (*message_selected)(MessageList *ml, const char *uid); + void (*message_selected) (MessageList *ml, const char *uid); } MessageListClass; typedef void (*MessageListForeachFunc) (MessageList *message_list, @@ -85,10 +84,9 @@ typedef enum { } MessageListSelectDirection; GtkType message_list_get_type (void); -BonoboObject *message_list_new (void); +GtkWidget *message_list_new (void); void message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder); -GtkWidget *message_list_get_widget (MessageList *message_list); void message_list_foreach (MessageList *message_list, MessageListForeachFunc callback, |