From f5bed9bf7b143fff9bd258ea31fdac192e00a0d9 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 27 Nov 2007 20:24:44 +0000 Subject: ** Fixes bug #495123 2007-11-27 Matthew Barnes ** Fixes bug #495123 * composer/Makefile.am: Add a bunch of files for managing composer headers. * composer/e-msg-composer.c (build_message), (from_changed_cb), (set_editor_signature), (e_msg_composer_set_body), (e_msg_composer_get_preferred_account): * plugins/exchange-operations/exchange-mail-send-options.c (append_to_header): Use e_msg_composer_hdrs_get_from_account() to obtain the EAccount. * composer/e-msg-composer-hdrs.c: * composer/e-msg-composer-hdrs.h: Massive refactoring to use new EComposerHeader classes. * composer/e-composer-header.c: * composer/e-composer-header.h: * composer/e-composer-from-header.c: * composer/e-composer-from-header.h: * composer/e-composer-name-header.c: * composer/e-composer-name-header.h: * composer/e-composer-post-header.c: * composer/e-composer-post-header.h: * composer/e-composer-text-header.c: * composer/e-composer-text-header.h: New GObject classes manage different types of composer headers. See bug #495123 for a more detailed description of each class. * mail/mail-session.c (mail_session_init): Pass the CamelSession to the EAccountComboBox class (ugly hack). * widgets/misc/Makefile.am: Add e-account-combo-box.[ch]. * widgets/misc/e-account-combo-box.c: * widgets/misc/e-account-combo-box.h: New widget renders an EAccountList as a combo box. Also listens for changes to the EAccountList and updates itself accordingly. svn path=/trunk/; revision=34600 --- composer/e-msg-composer-hdrs.h | 85 ++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 37 deletions(-) (limited to 'composer/e-msg-composer-hdrs.h') diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h index 919400167d..1e983272a5 100644 --- a/composer/e-msg-composer-hdrs.h +++ b/composer/e-msg-composer-hdrs.h @@ -21,11 +21,10 @@ * Author: Ettore Perazzoli */ - #ifndef ___E_MSG_COMPOSER_HDRS_H__ #define ___E_MSG_COMPOSER_HDRS_H__ -#include +#include #include @@ -33,20 +32,28 @@ #include #include -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_MSG_COMPOSER_HDRS (e_msg_composer_hdrs_get_type ()) -#define E_MSG_COMPOSER_HDRS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MSG_COMPOSER_HDRS, EMsgComposerHdrs)) -#define E_MSG_COMPOSER_HDRS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_HDRS, EMsgComposerHdrsClass)) -#define E_IS_MSG_COMPOSER_HDRS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MSG_COMPOSER_HDRS)) -#define E_IS_MSG_COMPOSER_HDRS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_HDRS)) - - -typedef struct _EMsgComposerHdrs EMsgComposerHdrs; -typedef struct _EMsgComposerHdrsClass EMsgComposerHdrsClass; +#define E_TYPE_MSG_COMPOSER_HDRS \ + (e_msg_composer_hdrs_get_type ()) +#define E_MSG_COMPOSER_HDRS(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MSG_COMPOSER_HDRS, EMsgComposerHdrs)) +#define E_MSG_COMPOSER_HDRS_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MSG_COMPOSER_HDRS, EMsgComposerHdrsClass)) +#define E_IS_MSG_COMPOSER_HDRS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MSG_COMPOSER_HDRS)) +#define E_IS_MSG_COMPOSER_HDRS_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MSG_COMPOSER_HDRS)) +#define E_MSG_COMPOSER_HDRS_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MSG_COMPOSER_HDRS, EMsgComposerHdrsClass)) + +G_BEGIN_DECLS + +typedef struct _EMsgComposerHdrs EMsgComposerHdrs; +typedef struct _EMsgComposerHdrsClass EMsgComposerHdrsClass; typedef struct _EMsgComposerHdrsPrivate EMsgComposerHdrsPrivate; struct _EMsgComposerHdrs { @@ -54,18 +61,12 @@ struct _EMsgComposerHdrs { EMsgComposerHdrsPrivate *priv; - EAccount *account; - guint32 visible_mask; - - gboolean has_changed; }; struct _EMsgComposerHdrsClass { GtkTableClass parent_class; - void (* show_address_dialog) (EMsgComposerHdrs *hdrs); - void (* subject_changed) (EMsgComposerHdrs *hdrs, gchar *subject); void (* hdrs_changed) (EMsgComposerHdrs *hdrs); @@ -79,19 +80,32 @@ typedef enum { E_MSG_COMPOSER_VISIBLE_TO = (1 << 2), E_MSG_COMPOSER_VISIBLE_CC = (1 << 3), E_MSG_COMPOSER_VISIBLE_BCC = (1 << 4), - E_MSG_COMPOSER_VISIBLE_POSTTO = (1 << 5), /* for posting to folders */ + E_MSG_COMPOSER_VISIBLE_POSTTO = (1 << 5), E_MSG_COMPOSER_VISIBLE_SUBJECT = (1 << 7) } EMsgComposerHeaderVisibleFlags; -#define E_MSG_COMPOSER_VISIBLE_MASK_SENDER (E_MSG_COMPOSER_VISIBLE_FROM | E_MSG_COMPOSER_VISIBLE_REPLYTO) -#define E_MSG_COMPOSER_VISIBLE_MASK_BASIC (E_MSG_COMPOSER_VISIBLE_MASK_SENDER | E_MSG_COMPOSER_VISIBLE_SUBJECT) -#define E_MSG_COMPOSER_VISIBLE_MASK_RECIPIENTS (E_MSG_COMPOSER_VISIBLE_TO | E_MSG_COMPOSER_VISIBLE_CC | E_MSG_COMPOSER_VISIBLE_BCC) +#define E_MSG_COMPOSER_VISIBLE_MASK_SENDER \ + (E_MSG_COMPOSER_VISIBLE_FROM | \ + E_MSG_COMPOSER_VISIBLE_REPLYTO) + +#define E_MSG_COMPOSER_VISIBLE_MASK_BASIC \ + (E_MSG_COMPOSER_VISIBLE_MASK_SENDER | \ + E_MSG_COMPOSER_VISIBLE_SUBJECT) + +#define E_MSG_COMPOSER_VISIBLE_MASK_RECIPIENTS \ + (E_MSG_COMPOSER_VISIBLE_TO | \ + E_MSG_COMPOSER_VISIBLE_CC | \ + E_MSG_COMPOSER_VISIBLE_BCC) -#define E_MSG_COMPOSER_VISIBLE_MASK_MAIL (E_MSG_COMPOSER_VISIBLE_MASK_BASIC | E_MSG_COMPOSER_VISIBLE_MASK_RECIPIENTS) -#define E_MSG_COMPOSER_VISIBLE_MASK_POST (E_MSG_COMPOSER_VISIBLE_MASK_BASIC | E_MSG_COMPOSER_VISIBLE_POSTTO) +#define E_MSG_COMPOSER_VISIBLE_MASK_MAIL \ + (E_MSG_COMPOSER_VISIBLE_MASK_BASIC | \ + E_MSG_COMPOSER_VISIBLE_MASK_RECIPIENTS) +#define E_MSG_COMPOSER_VISIBLE_MASK_POST \ + (E_MSG_COMPOSER_VISIBLE_MASK_BASIC | \ + E_MSG_COMPOSER_VISIBLE_POSTTO) -GtkType e_msg_composer_hdrs_get_type (void); +GType e_msg_composer_hdrs_get_type (void); GtkWidget *e_msg_composer_hdrs_new (BonoboUIComponent *uic, int visible_mask, int visible_flags); void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, @@ -101,7 +115,8 @@ void e_msg_composer_hdrs_to_redirect (EMsgComposerHdrs *hdrs, CamelMimeMessage *msg); -void e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs, +EAccount * e_msg_composer_hdrs_get_from_account (EMsgComposerHdrs *hdrs); +gboolean e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs, const char *account_name); void e_msg_composer_hdrs_set_reply_to (EMsgComposerHdrs *hdrs, const char *reply_to); @@ -116,8 +131,8 @@ void e_msg_composer_hdrs_set_post_to (EMsgComposerHdrs *hdrs, void e_msg_composer_hdrs_set_post_to_list (EMsgComposerHdrs *hdrs, GList *urls); void e_msg_composer_hdrs_set_post_to_base (EMsgComposerHdrs *hdrs, - const char *base, - const char *post_to); + const gchar *base, + const gchar *post_to); void e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs, const char *subject); @@ -134,7 +149,6 @@ const char *e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs); GList *e_msg_composer_hdrs_get_post_to (EMsgComposerHdrs *hdrs); GtkWidget *e_msg_composer_hdrs_get_from_hbox (EMsgComposerHdrs *hdrs); -GtkWidget *e_msg_composer_hdrs_get_from_omenu (EMsgComposerHdrs *hdrs); GtkWidget *e_msg_composer_hdrs_get_reply_to_entry (EMsgComposerHdrs *hdrs); GtkWidget *e_msg_composer_hdrs_get_to_entry (EMsgComposerHdrs *hdrs); GtkWidget *e_msg_composer_hdrs_get_cc_entry (EMsgComposerHdrs *hdrs); @@ -147,9 +161,6 @@ void e_msg_composer_hdrs_set_visible_mask (EMsgComposerHdrs *hdrs, void e_msg_composer_hdrs_set_visible (EMsgComposerHdrs *hdrs, int visible_flags); -#ifdef _cplusplus -} -#endif /* _cplusplus */ - +G_END_DECLS #endif /* __E_MSG_COMPOSER_HDRS_H__ */ -- cgit v1.2.3