diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-06-04 22:26:01 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-06-05 01:42:32 +0800 |
commit | d9e396a8e21580db6ffc6272f76b7a34e6a10d4b (patch) | |
tree | 792d7f2296a62f24d4bc72c6a1eb5833554b65a8 /mail | |
parent | 2424fc184189430b8b33f2f876c0916f12808504 (diff) | |
download | gsoc2013-evolution-d9e396a8e21580db6ffc6272f76b7a34e6a10d4b.tar gsoc2013-evolution-d9e396a8e21580db6ffc6272f76b7a34e6a10d4b.tar.gz gsoc2013-evolution-d9e396a8e21580db6ffc6272f76b7a34e6a10d4b.tar.bz2 gsoc2013-evolution-d9e396a8e21580db6ffc6272f76b7a34e6a10d4b.tar.lz gsoc2013-evolution-d9e396a8e21580db6ffc6272f76b7a34e6a10d4b.tar.xz gsoc2013-evolution-d9e396a8e21580db6ffc6272f76b7a34e6a10d4b.tar.zst gsoc2013-evolution-d9e396a8e21580db6ffc6272f76b7a34e6a10d4b.zip |
EMailDisplay cleanups.
(cherry picked from commit 046816123764f86f1b258195292abcdb7951fca3)
Conflicts:
mail/e-mail-display.h
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-browser.c | 10 | ||||
-rw-r--r-- | mail/e-mail-display.c | 137 | ||||
-rw-r--r-- | mail/e-mail-display.h | 81 |
3 files changed, 117 insertions, 111 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index 349790cc24..fb15ba7c3c 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -520,7 +520,6 @@ mail_browser_constructed (GObject *object) EMailReader *reader; EMailBackend *backend; EMailSession *session; - EMailDisplay *display; EShellBackend *shell_backend; EShell *shell; EFocusTracker *focus_tracker; @@ -530,6 +529,7 @@ mail_browser_constructed (GObject *object) GtkAction *action; GtkUIManager *ui_manager; GtkWidget *container; + GtkWidget *display; GtkWidget *widget; const gchar *domain; const gchar *id; @@ -569,9 +569,11 @@ mail_browser_constructed (GObject *object) browser->priv->message_list, "message-list-built", G_CALLBACK (mail_browser_message_list_built_cb), object); - display = g_object_new ( - E_TYPE_MAIL_DISPLAY, - "display-mode", browser->priv->display_mode, NULL); + display = e_mail_display_new (); + + e_mail_display_set_mode ( + E_MAIL_DISPLAY (display), + browser->priv->display_mode); g_signal_connect_swapped ( display, "popup-event", diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 3e52074def..f8af885517 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -19,22 +19,20 @@ * */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include "e-mail-display.h" +#include <config.h> #include <glib/gi18n.h> -#include <gdk/gdk.h> +#include <gdk/gdk.h> #include <camel/camel.h> -#include "em-format/e-mail-part-utils.h" -#include "em-format/e-mail-formatter-extension.h" -#include "em-format/e-mail-extension-registry.h" -#include "em-format/e-mail-part-attachment.h" -#include "em-format/e-mail-formatter-print.h" +#include <em-format/e-mail-extension-registry.h> +#include <em-format/e-mail-formatter-enumtypes.h> +#include <em-format/e-mail-formatter-extension.h> +#include <em-format/e-mail-formatter-print.h> +#include <em-format/e-mail-part-attachment.h> +#include <em-format/e-mail-part-utils.h> #include "e-http-request.h" #include "e-mail-display-popup-extension.h" @@ -72,11 +70,11 @@ struct _EMailDisplayPrivate { enum { PROP_0, - PROP_MODE, - PROP_PART_LIST, + PROP_FORMATTER, PROP_HEADERS_COLLAPSABLE, PROP_HEADERS_COLLAPSED, - PROP_FORMATTER + PROP_MODE, + PROP_PART_LIST }; static CamelDataCache *emd_global_http_cache = NULL; @@ -1259,26 +1257,29 @@ mail_display_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_PART_LIST: - e_mail_display_set_parts_list ( - E_MAIL_DISPLAY (object), - g_value_get_pointer (value)); - return; - case PROP_MODE: - e_mail_display_set_mode ( - E_MAIL_DISPLAY (object), - g_value_get_int (value)); - return; case PROP_HEADERS_COLLAPSABLE: e_mail_display_set_headers_collapsable ( E_MAIL_DISPLAY (object), g_value_get_boolean (value)); return; + case PROP_HEADERS_COLLAPSED: e_mail_display_set_headers_collapsed ( E_MAIL_DISPLAY (object), g_value_get_boolean (value)); return; + + case PROP_MODE: + e_mail_display_set_mode ( + E_MAIL_DISPLAY (object), + g_value_get_enum (value)); + return; + + case PROP_PART_LIST: + e_mail_display_set_parts_list ( + E_MAIL_DISPLAY (object), + g_value_get_pointer (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -1293,27 +1294,36 @@ mail_display_get_property (GObject *object, switch (property_id) { case PROP_FORMATTER: g_value_set_object ( - value, e_mail_display_get_formatter ( - E_MAIL_DISPLAY (object))); - return; - case PROP_PART_LIST: - g_value_set_pointer ( - value, e_mail_display_get_parts_list ( - E_MAIL_DISPLAY (object))); - return; - case PROP_MODE: - g_value_set_int ( - value, e_mail_display_get_mode ( + value, + e_mail_display_get_formatter ( E_MAIL_DISPLAY (object))); return; + case PROP_HEADERS_COLLAPSABLE: g_value_set_boolean ( - value, e_mail_display_get_headers_collapsable ( + value, + e_mail_display_get_headers_collapsable ( E_MAIL_DISPLAY (object))); return; + case PROP_HEADERS_COLLAPSED: g_value_set_boolean ( - value, e_mail_display_get_headers_collapsed ( + value, + e_mail_display_get_headers_collapsed ( + E_MAIL_DISPLAY (object))); + return; + + case PROP_MODE: + g_value_set_enum ( + value, + e_mail_display_get_mode ( + E_MAIL_DISPLAY (object))); + return; + + case PROP_PART_LIST: + g_value_set_pointer ( + value, + e_mail_display_get_parts_list ( E_MAIL_DISPLAY (object))); return; } @@ -1341,16 +1351,14 @@ mail_display_dispose (GObject *object) priv->widgets = NULL; } - if (priv->settings != NULL) { + if (priv->settings != NULL) g_signal_handlers_disconnect_matched ( priv->settings, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object); - g_object_unref (priv->settings); - priv->settings = NULL; - } g_clear_object (&priv->part_list); g_clear_object (&priv->formatter); + g_clear_object (&priv->settings); /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (e_mail_display_parent_class)->dispose (object); @@ -1512,46 +1520,45 @@ e_mail_display_class_init (EMailDisplayClass *class) g_object_class_install_property ( object_class, - PROP_PART_LIST, - g_param_spec_pointer ( - "part-list", - "Part List", + PROP_HEADERS_COLLAPSABLE, + g_param_spec_boolean ( + "headers-collapsable", + "Headers Collapsable", NULL, + FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, - PROP_MODE, - g_param_spec_int ( - "mode", - "Display Mode", + PROP_HEADERS_COLLAPSED, + g_param_spec_boolean ( + "headers-collapsed", + "Headers Collapsed", NULL, - E_MAIL_FORMATTER_MODE_INVALID, - G_MAXINT, - E_MAIL_FORMATTER_MODE_NORMAL, + FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, - PROP_HEADERS_COLLAPSABLE, - g_param_spec_boolean ( - "headers-collapsable", - "Headers Collapsable", + PROP_MODE, + g_param_spec_enum ( + "mode", + "Mode", NULL, - FALSE, + E_TYPE_MAIL_FORMATTER_MODE, + E_MAIL_FORMATTER_MODE_NORMAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, - PROP_HEADERS_COLLAPSED, - g_param_spec_boolean ( - "headers-collapsed", - "Headers Collapsed", + PROP_PART_LIST, + g_param_spec_pointer ( + "part-list", + "Part List", NULL, - FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } @@ -1653,12 +1660,18 @@ e_mail_display_init (EMailDisplay *display) } } +GtkWidget * +e_mail_display_new (void) +{ + return g_object_new (E_TYPE_MAIL_DISPLAY, NULL); +} + EMailFormatterMode e_mail_display_get_mode (EMailDisplay *display) { g_return_val_if_fail ( E_IS_MAIL_DISPLAY (display), - E_MAIL_FORMATTER_MODE_NORMAL); + E_MAIL_FORMATTER_MODE_INVALID); return display->priv->mode; } diff --git a/mail/e-mail-display.h b/mail/e-mail-display.h index 1acae83c8d..c272c87287 100644 --- a/mail/e-mail-display.h +++ b/mail/e-mail-display.h @@ -61,51 +61,42 @@ struct _EMailDisplayClass { }; -GType e_mail_display_get_type (void); - -void e_mail_display_set_mode (EMailDisplay *display, - EMailFormatterMode mode); -EMailFormatterMode e_mail_display_get_mode (EMailDisplay *display); - -EMailFormatter * e_mail_display_get_formatter (EMailDisplay *display); - -EMailPartList * e_mail_display_get_parts_list (EMailDisplay *display); - -void e_mail_display_set_parts_list (EMailDisplay *display, - EMailPartList *parts_list); - -void e_mail_display_set_headers_collapsable - (EMailDisplay *display, - gboolean collapsable); -gboolean e_mail_display_get_headers_collapsable - (EMailDisplay *display); -void e_mail_display_set_headers_collapsed - (EMailDisplay *display, - gboolean collapsed); -gboolean e_mail_display_get_headers_collapsed - (EMailDisplay *display); - -void e_mail_display_load (EMailDisplay *display, - const gchar *msg_uri); -void e_mail_display_reload (EMailDisplay *display); - -GtkAction * e_mail_display_get_action (EMailDisplay *display, - const gchar *action_name); - -void e_mail_display_set_status (EMailDisplay *display, - const gchar *status); - -gchar * e_mail_display_get_selection_plain_text - (EMailDisplay *display); - -void e_mail_display_load_images (EMailDisplay *display); - -void e_mail_display_set_force_load_images - (EMailDisplay *display, - gboolean force_load_images); - -void e_mail_display_set_charset (EMailDisplay *display, - const gchar *charset); +GType e_mail_display_get_type (void) G_GNUC_CONST; +GtkWidget * e_mail_display_new (void); +EMailFormatterMode + e_mail_display_get_mode (EMailDisplay *display); +void e_mail_display_set_mode (EMailDisplay *display, + EMailFormatterMode mode); +EMailFormatter * + e_mail_display_get_formatter (EMailDisplay *display); +EMailPartList * e_mail_display_get_parts_list (EMailDisplay *display); +void e_mail_display_set_parts_list (EMailDisplay *display, + EMailPartList *parts_list); +gboolean e_mail_display_get_headers_collapsable + (EMailDisplay *display); +void e_mail_display_set_headers_collapsable + (EMailDisplay *display, + gboolean collapsable); +gboolean e_mail_display_get_headers_collapsed + (EMailDisplay *display); +void e_mail_display_set_headers_collapsed + (EMailDisplay *display, + gboolean collapsed); +void e_mail_display_load (EMailDisplay *display, + const gchar *msg_uri); +void e_mail_display_reload (EMailDisplay *display); +GtkAction * e_mail_display_get_action (EMailDisplay *display, + const gchar *action_name); +void e_mail_display_set_status (EMailDisplay *display, + const gchar *status); +gchar * e_mail_display_get_selection_plain_text + (EMailDisplay *display); +void e_mail_display_load_images (EMailDisplay *display); +void e_mail_display_set_force_load_images + (EMailDisplay *display, + gboolean force_load_images); +void e_mail_display_set_charset (EMailDisplay *display, + const gchar *charset); G_END_DECLS |