aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--e-util/e-alert.c12
-rw-r--r--e-util/e-marshal.list1
-rw-r--r--mail/Makefile.am44
-rw-r--r--mail/e-mail-attachment-bar.c132
-rw-r--r--mail/e-mail-browser.c143
-rw-r--r--mail/e-mail-display.c65
-rw-r--r--mail/e-mail-folder-pane.c9
-rw-r--r--mail/e-mail-label-action.c41
-rw-r--r--mail/e-mail-label-dialog.c46
-rw-r--r--mail/e-mail-label-list-store.c81
-rw-r--r--mail/e-mail-label-manager.c45
-rw-r--r--mail/e-mail-label-tree-view.c42
-rw-r--r--mail/e-mail-message-pane.c9
-rw-r--r--mail/e-mail-notebook-view.c230
-rw-r--r--mail/e-mail-paned-view.c119
-rw-r--r--mail/e-mail-paned-view.h1
-rw-r--r--mail/e-mail-reader-utils.c32
-rw-r--r--mail/e-mail-reader-utils.h2
-rw-r--r--mail/e-mail-reader.c267
-rw-r--r--mail/e-mail-reader.h13
-rw-r--r--mail/e-mail-tab-picker.c97
-rw-r--r--mail/e-mail-tab-picker.h149
-rw-r--r--mail/e-mail-tab.c93
-rw-r--r--mail/e-mail-tab.h158
-rw-r--r--mail/e-mail-tag-editor.c42
-rw-r--r--mail/e-mail-view.c9
-rw-r--r--mail/em-account-editor.c46
-rw-r--r--mail/em-composer-utils.c263
-rw-r--r--mail/em-composer-utils.h7
-rw-r--r--mail/em-config.c2
-rw-r--r--mail/em-config.h19
-rw-r--r--mail/em-event.c2
-rw-r--r--mail/em-event.h19
-rw-r--r--mail/em-filter-context.c11
-rw-r--r--mail/em-filter-editor.c34
-rw-r--r--mail/em-filter-rule.c104
-rw-r--r--mail/em-folder-selection-button.c2
-rw-r--r--mail/em-folder-tree.c2
-rw-r--r--mail/em-format-hook.c76
-rw-r--r--mail/em-format-html-display.c56
-rw-r--r--mail/em-format-html-print.c40
-rw-r--r--mail/em-format-html.c9
-rw-r--r--mail/em-search-context.c40
-rw-r--r--mail/em-vfolder-context.c11
-rw-r--r--mail/em-vfolder-rule.c10
-rw-r--r--mail/mail-folder-cache.c257
-rw-r--r--mail/mail.error.xml7
-rw-r--r--mail/message-list.c59
-rw-r--r--modules/Makefile.am1
-rw-r--r--modules/mail/e-mail-shell-content.c114
-rw-r--r--modules/mdn/Makefile.am36
-rw-r--r--modules/mdn/evolution-mdn.c569
-rw-r--r--modules/mdn/evolution-mdn.error.xml9
-rw-r--r--modules/offline-alert/evolution-offline-alert.error.xml2
-rw-r--r--plugins/mail-to-task/mail-to-task.c9
-rw-r--r--plugins/save-calendar/csv-format.c2
-rw-r--r--plugins/save-calendar/ical-format.c2
-rw-r--r--plugins/save-calendar/rdf-format.c2
-rw-r--r--po/POTFILES.in2
-rw-r--r--widgets/misc/e-alert-bar.c218
-rw-r--r--widgets/misc/e-alert-bar.h1
-rw-r--r--widgets/misc/e-preview-pane.c70
-rw-r--r--widgets/misc/e-preview-pane.h1
64 files changed, 2125 insertions, 1872 deletions
diff --git a/configure.ac b/configure.ac
index 96c3242cdf..465e496028 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1680,6 +1680,7 @@ modules/mail/Makefile
modules/composer-autosave/Makefile
modules/connman/Makefile
modules/mailto-handler/Makefile
+modules/mdn/Makefile
modules/network-manager/Makefile
modules/online-accounts/Makefile
modules/offline-alert/Makefile
diff --git a/e-util/e-alert.c b/e-util/e-alert.c
index 88dbb7189d..d4a7a9ea13 100644
--- a/e-util/e-alert.c
+++ b/e-util/e-alert.c
@@ -909,18 +909,6 @@ e_alert_peek_actions (EAlert *alert)
{
g_return_val_if_fail (E_IS_ALERT (alert), NULL);
- /* Make sure we have at least one action. Do this on-demand
- * in case the XML definition did not specify any actions but
- * other actions were added via e_alert_add_action(). */
- if (g_queue_is_empty (&alert->priv->actions)) {
- GtkAction *action;
-
- action = gtk_action_new (
- "alert-response-0", _("_Dismiss"), NULL, NULL);
- e_alert_add_action (alert, action, GTK_RESPONSE_CLOSE);
- g_object_unref (action);
- }
-
return g_queue_peek_head_link (&alert->priv->actions);
}
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list
index c42078b2df..884886c83f 100644
--- a/e-util/e-marshal.list
+++ b/e-util/e-marshal.list
@@ -54,6 +54,7 @@ NONE:POINTER,POINTER,INT
NONE:STRING,DOUBLE
NONE:STRING,INT
NONE:STRING,INT,INT
+NONE:STRING,OBJECT
NONE:STRING,POINTER,POINTER
NONE:STRING,STRING
NONE:UINT,STRING
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 0a14a19ee9..0859c55c06 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -46,17 +46,13 @@ libevolution_mail_la_CPPFLAGS = \
mailinclude_HEADERS = \
e-mail.h \
- e-mail-view.h \
- e-mail-folder-pane.h \
- e-mail-message-pane.h \
- e-mail-paned-view.h \
- e-mail-notebook-view.h \
e-mail-attachment-bar.h \
e-mail-backend.h \
e-mail-browser.h \
e-mail-display.h \
e-mail-enums.h \
e-mail-enumtypes.h \
+ e-mail-folder-pane.h \
e-mail-folder-utils.h \
e-mail-junk-filter.h \
e-mail-junk-options.h \
@@ -66,15 +62,19 @@ mailinclude_HEADERS = \
e-mail-label-manager.h \
e-mail-label-tree-view.h \
e-mail-local.h \
+ e-mail-message-pane.h \
e-mail-migrate.h \
- e-mail-reader.h \
+ e-mail-notebook-view.h \
+ e-mail-paned-view.h \
e-mail-reader-utils.h \
- e-mail-session.h \
+ e-mail-reader.h \
e-mail-session-utils.h \
+ e-mail-session.h \
e-mail-sidebar.h \
- e-mail-store.h \
e-mail-store-utils.h \
+ e-mail-store.h \
e-mail-tag-editor.h \
+ e-mail-view.h \
em-account-editor.h \
em-composer-utils.h \
em-config.h \
@@ -85,15 +85,15 @@ mailinclude_HEADERS = \
em-filter-rule.h \
em-filter-source-element.h \
em-folder-properties.h \
- em-folder-selector.h \
em-folder-selection-button.h \
- em-folder-tree.h \
+ em-folder-selector.h \
em-folder-tree-model.h \
+ em-folder-tree.h \
em-folder-utils.h \
em-format-hook.h \
- em-format-html.h \
em-format-html-display.h \
em-format-html-print.h \
+ em-format-html.h \
em-html-stream.h \
em-search-context.h \
em-subscription-editor.h \
@@ -121,16 +121,12 @@ mailinclude_HEADERS += \
endif
libevolution_mail_la_SOURCES = \
- e-mail-view.c \
- e-mail-folder-pane.c \
- e-mail-message-pane.c \
- e-mail-paned-view.c \
- e-mail-notebook-view.c \
e-mail-attachment-bar.c \
e-mail-backend.c \
e-mail-browser.c \
e-mail-display.c \
e-mail-enumtypes.c \
+ e-mail-folder-pane.c \
e-mail-folder-utils.c \
e-mail-junk-filter.c \
e-mail-junk-options.c \
@@ -140,15 +136,19 @@ libevolution_mail_la_SOURCES = \
e-mail-label-manager.c \
e-mail-label-tree-view.c \
e-mail-local.c \
+ e-mail-message-pane.c \
e-mail-migrate.c \
- e-mail-reader.c \
+ e-mail-notebook-view.c \
+ e-mail-paned-view.c \
e-mail-reader-utils.c \
- e-mail-session.c \
+ e-mail-reader.c \
e-mail-session-utils.c \
+ e-mail-session.c \
e-mail-sidebar.c \
- e-mail-store.c \
e-mail-store-utils.c \
+ e-mail-store.c \
e-mail-tag-editor.c \
+ e-mail-view.c \
em-account-editor.c \
em-composer-utils.c \
em-config.c \
@@ -159,15 +159,15 @@ libevolution_mail_la_SOURCES = \
em-filter-rule.c \
em-filter-source-element.c \
em-folder-properties.c \
- em-folder-selector.c \
em-folder-selection-button.c \
- em-folder-tree.c \
+ em-folder-selector.c \
em-folder-tree-model.c \
+ em-folder-tree.c \
em-folder-utils.c \
em-format-hook.c \
- em-format-html.c \
em-format-html-display.c \
em-format-html-print.c \
+ em-format-html.c \
em-html-stream.c \
em-search-context.c \
em-subscription-editor.c \
diff --git a/mail/e-mail-attachment-bar.c b/mail/e-mail-attachment-bar.c
index c07d0e8707..a33f8c98b8 100644
--- a/mail/e-mail-attachment-bar.c
+++ b/mail/e-mail-attachment-bar.c
@@ -31,6 +31,10 @@
#include "e-attachment-icon-view.h"
#include "e-attachment-tree-view.h"
+#define E_MAIL_ATTACHMENT_BAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_ATTACHMENT_BAR, EMailAttachmentBarPrivate))
+
#define NUM_VIEWS 2
struct _EMailAttachmentBarPrivate {
@@ -59,7 +63,17 @@ enum {
PROP_EXPANDED
};
-static gpointer parent_class;
+/* Forward Declarations */
+static void e_mail_attachment_bar_interface_init
+ (EAttachmentViewInterface *interface);
+
+G_DEFINE_TYPE_WITH_CODE (
+ EMailAttachmentBar,
+ e_mail_attachment_bar,
+ GTK_TYPE_VBOX,
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_ATTACHMENT_VIEW,
+ e_mail_attachment_bar_interface_init))
static void
mail_attachment_bar_update_status (EMailAttachmentBar *bar)
@@ -184,10 +198,11 @@ mail_attachment_bar_dispose (GObject *object)
{
EMailAttachmentBarPrivate *priv;
- priv = E_MAIL_ATTACHMENT_BAR (object)->priv;
+ priv = E_MAIL_ATTACHMENT_BAR_GET_PRIVATE (object);
if (priv->model != NULL) {
- e_attachment_store_remove_all (E_ATTACHMENT_STORE (priv->model));
+ e_attachment_store_remove_all (
+ E_ATTACHMENT_STORE (priv->model));
g_object_unref (priv->model);
priv->model = NULL;
}
@@ -248,7 +263,7 @@ mail_attachment_bar_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_mail_attachment_bar_parent_class)->dispose (object);
}
static void
@@ -257,7 +272,7 @@ mail_attachment_bar_constructed (GObject *object)
EMailAttachmentBarPrivate *priv;
GSettings *settings;
- priv = E_MAIL_ATTACHMENT_BAR (object)->priv;
+ priv = E_MAIL_ATTACHMENT_BAR_GET_PRIVATE (object);
/* Set up property-to-property bindings. */
@@ -315,16 +330,16 @@ mail_attachment_bar_constructed (GObject *object)
g_object_unref (settings);
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_mail_attachment_bar_parent_class)->constructed (object);
}
static EAttachmentViewPrivate *
mail_attachment_bar_get_private (EAttachmentView *view)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
return e_attachment_view_get_private (view);
}
@@ -332,10 +347,10 @@ mail_attachment_bar_get_private (EAttachmentView *view)
static EAttachmentStore *
mail_attachment_bar_get_store (EAttachmentView *view)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
return e_attachment_view_get_store (view);
}
@@ -345,10 +360,10 @@ mail_attachment_bar_get_path_at_pos (EAttachmentView *view,
gint x,
gint y)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
return e_attachment_view_get_path_at_pos (view, x, y);
}
@@ -356,10 +371,10 @@ mail_attachment_bar_get_path_at_pos (EAttachmentView *view,
static GList *
mail_attachment_bar_get_selected_paths (EAttachmentView *view)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
return e_attachment_view_get_selected_paths (view);
}
@@ -368,10 +383,10 @@ static gboolean
mail_attachment_bar_path_is_selected (EAttachmentView *view,
GtkTreePath *path)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
return e_attachment_view_path_is_selected (view, path);
}
@@ -380,10 +395,10 @@ static void
mail_attachment_bar_select_path (EAttachmentView *view,
GtkTreePath *path)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
e_attachment_view_select_path (view, path);
}
@@ -392,10 +407,10 @@ static void
mail_attachment_bar_unselect_path (EAttachmentView *view,
GtkTreePath *path)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
e_attachment_view_unselect_path (view, path);
}
@@ -403,10 +418,10 @@ mail_attachment_bar_unselect_path (EAttachmentView *view,
static void
mail_attachment_bar_select_all (EAttachmentView *view)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
e_attachment_view_select_all (view);
}
@@ -414,10 +429,10 @@ mail_attachment_bar_select_all (EAttachmentView *view)
static void
mail_attachment_bar_unselect_all (EAttachmentView *view)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
e_attachment_view_unselect_all (view);
}
@@ -425,20 +440,19 @@ mail_attachment_bar_unselect_all (EAttachmentView *view)
static void
mail_attachment_bar_update_actions (EAttachmentView *view)
{
- EMailAttachmentBarPrivate *priv;
+ EMailAttachmentBar *bar;
- priv = E_MAIL_ATTACHMENT_BAR (view)->priv;
- view = E_ATTACHMENT_VIEW (priv->icon_view);
+ bar = E_MAIL_ATTACHMENT_BAR (view);
+ view = E_ATTACHMENT_VIEW (bar->priv->icon_view);
e_attachment_view_update_actions (view);
}
static void
-mail_attachment_bar_class_init (EMailAttachmentBarClass *class)
+e_mail_attachment_bar_class_init (EMailAttachmentBarClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailAttachmentBarPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -479,7 +493,7 @@ mail_attachment_bar_class_init (EMailAttachmentBarClass *class)
}
static void
-mail_attachment_bar_interface_init (EAttachmentViewInterface *interface)
+e_mail_attachment_bar_interface_init (EAttachmentViewInterface *interface)
{
interface->get_private = mail_attachment_bar_get_private;
interface->get_store = mail_attachment_bar_get_store;
@@ -494,7 +508,7 @@ mail_attachment_bar_interface_init (EAttachmentViewInterface *interface)
}
static void
-mail_attachment_bar_init (EMailAttachmentBar *bar)
+e_mail_attachment_bar_init (EMailAttachmentBar *bar)
{
EAttachmentView *view;
GtkSizeGroup *size_group;
@@ -502,8 +516,7 @@ mail_attachment_bar_init (EMailAttachmentBar *bar)
GtkWidget *widget;
GtkAction *action;
- bar->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- bar, E_TYPE_MAIL_ATTACHMENT_BAR, EMailAttachmentBarPrivate);
+ bar->priv = E_MAIL_ATTACHMENT_BAR_GET_PRIVATE (bar);
bar->priv->model = e_attachment_store_new ();
gtk_box_set_spacing (GTK_BOX (bar), 6);
@@ -639,41 +652,6 @@ mail_attachment_bar_init (EMailAttachmentBar *bar)
g_object_unref (size_group);
}
-GType
-e_mail_attachment_bar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMailAttachmentBarClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_attachment_bar_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailAttachmentBar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_attachment_bar_init,
- NULL /* value_table */
- };
-
- static const GInterfaceInfo interface_info = {
- (GInterfaceInitFunc) mail_attachment_bar_interface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL /* interface_data */
- };
-
- type = g_type_register_static (
- GTK_TYPE_VBOX, "EMailAttachmentBar", &type_info, 0);
-
- g_type_add_interface_static (
- type, E_TYPE_ATTACHMENT_VIEW, &interface_info);
- }
-
- return type;
-}
-
GtkWidget *
e_mail_attachment_bar_new (void)
{
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index 1125510915..ec0e9251e0 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -30,12 +30,10 @@
#include "e-util/e-util.h"
#include "e-util/e-plugin-ui.h"
-#include "e-util/e-alert-dialog.h"
#include "e-util/gconf-bridge.h"
#include "shell/e-shell.h"
#include "shell/e-shell-utils.h"
#include "shell/e-shell-settings.h"
-#include "widgets/misc/e-alert-bar.h"
#include "widgets/misc/e-popup-action.h"
#include "widgets/misc/e-preview-pane.h"
@@ -45,6 +43,10 @@
#include "mail/em-format-html-display.h"
#include "mail/message-list.h"
+#define E_MAIL_BROWSER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_BROWSER, EMailBrowserPrivate))
+
#define MAIL_BROWSER_GCONF_PREFIX "/apps/evolution/mail/mail_browser"
#define ACTION_GROUP_STANDARD "action-group-standard"
@@ -59,8 +61,7 @@ struct _EMailBrowserPrivate {
GtkWidget *main_menu;
GtkWidget *main_toolbar;
GtkWidget *message_list;
- GtkWidget *alert_bar;
- GtkWidget *search_bar;
+ GtkWidget *preview_pane;
GtkWidget *statusbar;
guint show_deleted : 1;
@@ -102,8 +103,6 @@ static const gchar *ui =
" </menubar>"
"</ui>";
-static void e_mail_browser_alert_sink_init
- (EAlertSinkInterface *interface);
static void e_mail_browser_reader_init
(EMailReaderInterface *interface);
@@ -112,8 +111,6 @@ G_DEFINE_TYPE_WITH_CODE (
e_mail_browser,
GTK_TYPE_WINDOW,
G_IMPLEMENT_INTERFACE (
- E_TYPE_ALERT_SINK, e_mail_browser_alert_sink_init)
- G_IMPLEMENT_INTERFACE (
E_TYPE_MAIL_READER, e_mail_browser_reader_init)
G_IMPLEMENT_INTERFACE (
E_TYPE_EXTENSIBLE, NULL))
@@ -482,7 +479,7 @@ mail_browser_dispose (GObject *object)
{
EMailBrowserPrivate *priv;
- priv = E_MAIL_BROWSER (object)->priv;
+ priv = E_MAIL_BROWSER_GET_PRIVATE (object);
if (priv->backend != NULL) {
g_object_unref (priv->backend);
@@ -520,14 +517,9 @@ mail_browser_dispose (GObject *object)
priv->message_list = NULL;
}
- if (priv->alert_bar != NULL) {
- g_object_unref (priv->alert_bar);
- priv->alert_bar = NULL;
- }
-
- if (priv->search_bar != NULL) {
- g_object_unref (priv->search_bar);
- priv->search_bar = NULL;
+ if (priv->preview_pane != NULL) {
+ g_object_unref (priv->preview_pane);
+ priv->preview_pane = NULL;
}
if (priv->statusbar != NULL) {
@@ -542,7 +534,7 @@ mail_browser_dispose (GObject *object)
static void
mail_browser_constructed (GObject *object)
{
- EMailBrowserPrivate *priv;
+ EMailBrowser *browser;
EMFormatHTML *formatter;
EMailReader *reader;
EMailBackend *backend;
@@ -565,7 +557,7 @@ mail_browser_constructed (GObject *object)
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (parent_class)->constructed (object);
- priv = E_MAIL_BROWSER (object)->priv;
+ browser = E_MAIL_BROWSER (object);
reader = E_MAIL_READER (object);
backend = e_mail_reader_get_backend (reader);
@@ -576,7 +568,7 @@ mail_browser_constructed (GObject *object)
ui_manager = e_ui_manager_new ();
e_shell_configure_ui_manager (shell, E_UI_MANAGER (ui_manager));
- priv->ui_manager = ui_manager;
+ browser->priv->ui_manager = ui_manager;
domain = GETTEXT_PACKAGE;
gtk_application_add_window (
@@ -588,15 +580,15 @@ mail_browser_constructed (GObject *object)
/* The message list is a widget, but it is not shown in the browser.
* Unfortunately, the widget is inseparable from its model, and the
* model is all we need. */
- priv->message_list = message_list_new (backend);
- g_object_ref_sink (priv->message_list);
+ browser->priv->message_list = message_list_new (backend);
+ g_object_ref_sink (browser->priv->message_list);
g_signal_connect_swapped (
- priv->message_list, "message-selected",
+ browser->priv->message_list, "message-selected",
G_CALLBACK (mail_browser_message_selected_cb), object);
g_signal_connect_swapped (
- priv->message_list, "message-list-built",
+ browser->priv->message_list, "message-list-built",
G_CALLBACK (mail_browser_message_list_built_cb), object);
g_signal_connect_swapped (
@@ -661,7 +653,7 @@ mail_browser_constructed (GObject *object)
e_focus_tracker_set_paste_clipboard_action (focus_tracker, action);
action = e_mail_reader_get_action (reader, "select-all");
e_focus_tracker_set_select_all_action (focus_tracker, action);
- priv->focus_tracker = focus_tracker;
+ browser->priv->focus_tracker = focus_tracker;
/* Construct window widgets. */
@@ -674,40 +666,36 @@ mail_browser_constructed (GObject *object)
/* Create the status bar before connecting proxy widgets. */
widget = gtk_statusbar_new ();
gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0);
- priv->statusbar = g_object_ref (widget);
+ browser->priv->statusbar = g_object_ref (widget);
gtk_widget_show (widget);
widget = gtk_ui_manager_get_widget (ui_manager, "/main-menu");
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- priv->main_menu = g_object_ref (widget);
+ browser->priv->main_menu = g_object_ref (widget);
gtk_widget_show (widget);
widget = gtk_ui_manager_get_widget (ui_manager, "/main-toolbar");
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- priv->main_toolbar = g_object_ref (widget);
+ browser->priv->main_toolbar = g_object_ref (widget);
gtk_widget_show (widget);
gtk_style_context_add_class (
gtk_widget_get_style_context (widget),
GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
- widget = e_alert_bar_new ();
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- priv->alert_bar = g_object_ref (widget);
- /* EAlertBar controls its own visibility. */
-
gtk_widget_show (GTK_WIDGET (web_view));
widget = e_preview_pane_new (web_view);
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ browser->priv->preview_pane = g_object_ref (widget);
gtk_widget_show (widget);
search_bar = e_preview_pane_get_search_bar (E_PREVIEW_PANE (widget));
- priv->search_bar = g_object_ref (search_bar);
g_signal_connect_swapped (
search_bar, "changed",
- G_CALLBACK (em_format_queue_redraw), priv->formatter);
+ G_CALLBACK (em_format_queue_redraw),
+ browser->priv->formatter);
/* Bind GObject properties to GSettings keys. */
@@ -740,34 +728,6 @@ mail_browser_key_press_event (GtkWidget *widget,
key_press_event (widget, event);
}
-static void
-mail_browser_submit_alert (EAlertSink *alert_sink,
- EAlert *alert)
-{
- EMailBrowserPrivate *priv;
- EAlertBar *alert_bar;
- GtkWidget *dialog;
- GtkWindow *parent;
-
- priv = E_MAIL_BROWSER (alert_sink)->priv;
-
- switch (e_alert_get_message_type (alert)) {
- case GTK_MESSAGE_INFO:
- case GTK_MESSAGE_WARNING:
- case GTK_MESSAGE_ERROR:
- alert_bar = E_ALERT_BAR (priv->alert_bar);
- e_alert_bar_add_alert (alert_bar, alert);
- break;
-
- default:
- parent = GTK_WINDOW (alert_sink);
- dialog = e_alert_dialog_new (parent, alert);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- break;
- }
-}
-
static GtkActionGroup *
mail_browser_get_action_group (EMailReader *reader,
EMailReaderActionGroup group)
@@ -788,20 +748,14 @@ mail_browser_get_action_group (EMailReader *reader,
return g_object_get_data (G_OBJECT (reader), group_name);
}
-static EAlertSink *
-mail_browser_get_alert_sink (EMailReader *reader)
-{
- return E_ALERT_SINK (reader);
-}
-
static EMailBackend *
mail_browser_get_backend (EMailReader *reader)
{
- EMailBrowserPrivate *priv;
+ EMailBrowser *browser;
- priv = E_MAIL_BROWSER (reader)->priv;
+ browser = E_MAIL_BROWSER (reader);
- return priv->backend;
+ return browser->priv->backend;
}
static gboolean
@@ -817,21 +771,21 @@ mail_browser_get_hide_deleted (EMailReader *reader)
static EMFormatHTML *
mail_browser_get_formatter (EMailReader *reader)
{
- EMailBrowserPrivate *priv;
+ EMailBrowser *browser;
- priv = E_MAIL_BROWSER (reader)->priv;
+ browser = E_MAIL_BROWSER (reader);
- return EM_FORMAT_HTML (priv->formatter);
+ return EM_FORMAT_HTML (browser->priv->formatter);
}
static GtkWidget *
mail_browser_get_message_list (EMailReader *reader)
{
- EMailBrowserPrivate *priv;
+ EMailBrowser *browser;
- priv = E_MAIL_BROWSER (reader)->priv;
+ browser = E_MAIL_BROWSER (reader);
- return priv->message_list;
+ return browser->priv->message_list;
}
static GtkMenu *
@@ -848,6 +802,16 @@ mail_browser_get_popup_menu (EMailReader *reader)
return GTK_MENU (widget);
}
+static EPreviewPane *
+mail_browser_get_preview_pane (EMailReader *reader)
+{
+ EMailBrowser *browser;
+
+ browser = E_MAIL_BROWSER (reader);
+
+ return E_PREVIEW_PANE (browser->priv->preview_pane);
+}
+
static GtkWindow *
mail_browser_get_window (EMailReader *reader)
{
@@ -883,16 +847,6 @@ mail_browser_set_message (EMailReader *reader,
}
static void
-mail_browser_show_search_bar (EMailReader *reader)
-{
- EMailBrowserPrivate *priv;
-
- priv = E_MAIL_BROWSER (reader)->priv;
-
- gtk_widget_show (priv->search_bar);
-}
-
-static void
e_mail_browser_class_init (EMailBrowserClass *class)
{
GObjectClass *object_class;
@@ -961,24 +915,17 @@ e_mail_browser_class_init (EMailBrowserClass *class)
}
static void
-e_mail_browser_alert_sink_init (EAlertSinkInterface *interface)
-{
- interface->submit_alert = mail_browser_submit_alert;
-}
-
-static void
e_mail_browser_reader_init (EMailReaderInterface *interface)
{
interface->get_action_group = mail_browser_get_action_group;
- interface->get_alert_sink = mail_browser_get_alert_sink;
interface->get_backend = mail_browser_get_backend;
interface->get_formatter = mail_browser_get_formatter;
interface->get_hide_deleted = mail_browser_get_hide_deleted;
interface->get_message_list = mail_browser_get_message_list;
interface->get_popup_menu = mail_browser_get_popup_menu;
+ interface->get_preview_pane = mail_browser_get_preview_pane;
interface->get_window = mail_browser_get_window;
interface->set_message = mail_browser_set_message;
- interface->show_search_bar = mail_browser_show_search_bar;
}
static void
@@ -987,9 +934,7 @@ e_mail_browser_init (EMailBrowser *browser)
GConfBridge *bridge;
const gchar *prefix;
- browser->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- browser, E_TYPE_MAIL_BROWSER, EMailBrowserPrivate);
-
+ browser->priv = E_MAIL_BROWSER_GET_PRIVATE (browser);
browser->priv->formatter = em_format_html_display_new ();
bridge = gconf_bridge_get ();
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index aa3c4bd3d2..7461e595f3 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -32,6 +32,10 @@
#include "mail/em-composer-utils.h"
#include "mail/em-utils.h"
+#define E_MAIL_DISPLAY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_DISPLAY, EMailDisplayPrivate))
+
struct _EMailDisplayPrivate {
EMFormatHTML *formatter;
};
@@ -41,8 +45,6 @@ enum {
PROP_FORMATTER
};
-static gpointer parent_class;
-
static const gchar *ui =
"<ui>"
" <popup name='context'>"
@@ -99,6 +101,8 @@ static GtkActionEntry mailto_entries[] = {
NULL }
};
+G_DEFINE_TYPE (EMailDisplay, e_mail_display, E_TYPE_WEB_VIEW)
+
static void
mail_display_update_formatter_colors (EMailDisplay *display)
{
@@ -179,7 +183,7 @@ mail_display_dispose (GObject *object)
{
EMailDisplayPrivate *priv;
- priv = E_MAIL_DISPLAY (object)->priv;
+ priv = E_MAIL_DISPLAY_GET_PRIVATE (object);
if (priv->formatter) {
g_object_unref (priv->formatter);
@@ -187,14 +191,14 @@ mail_display_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_mail_display_parent_class)->dispose (object);
}
static void
mail_display_realize (GtkWidget *widget)
{
/* Chain up to parent's realize() method. */
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
+ GTK_WIDGET_CLASS (e_mail_display_parent_class)->realize (widget);
mail_display_update_formatter_colors (E_MAIL_DISPLAY (widget));
}
@@ -205,10 +209,11 @@ mail_display_style_set (GtkWidget *widget,
{
EMailDisplayPrivate *priv;
- priv = E_MAIL_DISPLAY (widget)->priv;
+ priv = E_MAIL_DISPLAY_GET_PRIVATE (widget);
/* Chain up to parent's style_set() method. */
- GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
+ GTK_WIDGET_CLASS (e_mail_display_parent_class)->
+ style_set (widget, previous_style);
mail_display_update_formatter_colors (E_MAIL_DISPLAY (widget));
em_format_queue_redraw (EM_FORMAT (priv->formatter));
@@ -220,14 +225,15 @@ mail_display_load_string (EWebView *web_view,
{
EMailDisplayPrivate *priv;
- priv = E_MAIL_DISPLAY (web_view)->priv;
+ priv = E_MAIL_DISPLAY_GET_PRIVATE (web_view);
g_return_if_fail (priv->formatter != NULL);
if (em_format_busy (EM_FORMAT (priv->formatter)))
return;
/* Chain up to parent's load_string() method. */
- E_WEB_VIEW_CLASS (parent_class)->load_string (web_view, string);
+ E_WEB_VIEW_CLASS (e_mail_display_parent_class)->
+ load_string (web_view, string);
}
static void
@@ -253,7 +259,7 @@ mail_display_process_mailto (EWebView *web_view,
CamelFolder *folder = NULL;
EShell *shell;
- priv = E_MAIL_DISPLAY (web_view)->priv;
+ priv = E_MAIL_DISPLAY_GET_PRIVATE (web_view);
g_return_val_if_fail (priv->formatter != NULL, FALSE);
format = EM_FORMAT (priv->formatter);
@@ -277,7 +283,7 @@ mail_display_link_clicked (GtkHTML *html,
{
EMailDisplayPrivate *priv;
- priv = E_MAIL_DISPLAY (html)->priv;
+ priv = E_MAIL_DISPLAY_GET_PRIVATE (html);
g_return_if_fail (priv->formatter != NULL);
if (g_str_has_prefix (uri, "##")) {
@@ -331,19 +337,19 @@ mail_display_link_clicked (GtkHTML *html,
else {
/* Chain up to parent's link_clicked() method. */
- GTK_HTML_CLASS (parent_class)->link_clicked (html, uri);
+ GTK_HTML_CLASS (e_mail_display_parent_class)->
+ link_clicked (html, uri);
}
}
static void
-mail_display_class_init (EMailDisplayClass *class)
+e_mail_display_class_init (EMailDisplayClass *class)
{
GObjectClass *object_class;
GtkWidgetClass *widget_class;
EWebViewClass *web_view_class;
GtkHTMLClass *html_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailDisplayPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -375,7 +381,7 @@ mail_display_class_init (EMailDisplayClass *class)
}
static void
-mail_display_init (EMailDisplay *display)
+e_mail_display_init (EMailDisplay *display)
{
EWebView *web_view;
GtkUIManager *ui_manager;
@@ -384,8 +390,7 @@ mail_display_init (EMailDisplay *display)
web_view = E_WEB_VIEW (display);
- display->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- display, E_TYPE_MAIL_DISPLAY, EMailDisplayPrivate);
+ display->priv = E_MAIL_DISPLAY_GET_PRIVATE (display);
/* EWebView's action groups are added during its instance
* initialization function (like what we're in now), so it
@@ -407,32 +412,6 @@ mail_display_init (EMailDisplay *display)
g_error ("%s", error->message);
}
-GType
-e_mail_display_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMailDisplayClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_display_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailDisplay),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_display_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_WEB_VIEW, "EMailDisplay", &type_info, 0);
- }
-
- return type;
-}
-
EMFormatHTML *
e_mail_display_get_formatter (EMailDisplay *display)
{
diff --git a/mail/e-mail-folder-pane.c b/mail/e-mail-folder-pane.c
index 4642bd71b1..277228071e 100644
--- a/mail/e-mail-folder-pane.c
+++ b/mail/e-mail-folder-pane.c
@@ -44,6 +44,10 @@
#include "mail/mail-tools.h"
#include "mail/message-list.h"
+#define E_MAIL_FOLDER_PANE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_FOLDER_PANE, EMailFolderPanePrivate))
+
struct _EMailFolderPanePrivate {
gint placeholder;
};
@@ -165,10 +169,9 @@ e_mail_folder_pane_class_init (EMailFolderPaneClass *class)
}
static void
-e_mail_folder_pane_init (EMailFolderPane *browser)
+e_mail_folder_pane_init (EMailFolderPane *folder_pane)
{
- browser->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- browser, E_TYPE_MAIL_FOLDER_PANE, EMailFolderPanePrivate);
+ folder_pane->priv = E_MAIL_FOLDER_PANE_GET_PRIVATE (folder_pane);
}
EMailView *
diff --git a/mail/e-mail-label-action.c b/mail/e-mail-label-action.c
index 0eb1dc9a91..b7d38a99a9 100644
--- a/mail/e-mail-label-action.c
+++ b/mail/e-mail-label-action.c
@@ -25,11 +25,15 @@
#include "e-mail-label-action.h"
+#define E_MAIL_LABEL_ACTION_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_LABEL_ACTION, EMailLabelActionPrivate))
+
struct _EMailLabelActionPrivate {
gint placeholder;
};
-static gpointer parent_class;
+G_DEFINE_TYPE (EMailLabelAction, e_mail_label_action, GTK_TYPE_TOGGLE_ACTION)
static void
mail_label_action_menu_item_realize_cb (GtkWidget *menu_item)
@@ -92,11 +96,10 @@ mail_label_action_create_menu_item (GtkAction *action)
}
static void
-mail_label_action_class_init (EMailLabelActionClass *class)
+e_mail_label_action_class_init (EMailLabelActionClass *class)
{
GtkActionClass *action_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailLabelActionPrivate));
action_class = GTK_ACTION_CLASS (class);
@@ -104,37 +107,9 @@ mail_label_action_class_init (EMailLabelActionClass *class)
}
static void
-mail_label_action_init (EMailLabelAction *action)
-{
- action->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- action, E_TYPE_MAIL_LABEL_ACTION, EMailLabelActionPrivate);
-}
-
-GType
-e_mail_label_action_get_type (void)
+e_mail_label_action_init (EMailLabelAction *action)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMailLabelActionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_label_action_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailLabelAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_label_action_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_TOGGLE_ACTION,
- "EMailLabelAction", &type_info, 0);
- }
-
- return type;
+ action->priv = E_MAIL_LABEL_ACTION_GET_PRIVATE (action);
}
EMailLabelAction *
diff --git a/mail/e-mail-label-dialog.c b/mail/e-mail-label-dialog.c
index cb29cc6932..15222cc7b4 100644
--- a/mail/e-mail-label-dialog.c
+++ b/mail/e-mail-label-dialog.c
@@ -27,6 +27,10 @@
#include <glib/gi18n.h>
+#define E_MAIL_LABEL_DIALOG_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_LABEL_DIALOG, EMailLabelDialogPrivate))
+
struct _EMailLabelDialogPrivate {
GtkWidget *entry;
GtkWidget *colorsel;
@@ -38,7 +42,7 @@ enum {
PROP_LABEL_NAME
};
-static gpointer parent_class;
+G_DEFINE_TYPE (EMailLabelDialog, e_mail_label_dialog, GTK_TYPE_DIALOG)
static void
mail_label_dialog_entry_changed_cb (EMailLabelDialog *dialog)
@@ -106,7 +110,7 @@ mail_label_dialog_dispose (GObject *object)
{
EMailLabelDialogPrivate *priv;
- priv = E_MAIL_LABEL_DIALOG (object)->priv;
+ priv = E_MAIL_LABEL_DIALOG_GET_PRIVATE (object);
if (priv->entry != NULL) {
g_object_unref (priv->entry);
@@ -119,7 +123,7 @@ mail_label_dialog_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_mail_label_dialog_parent_class)->dispose (object);
}
static void
@@ -140,15 +144,14 @@ mail_label_dialog_constructed (GObject *object)
gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_mail_label_dialog_parent_class)->constructed (object);
}
static void
-mail_label_dialog_class_init (EMailLabelDialogClass *class)
+e_mail_label_dialog_class_init (EMailLabelDialogClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailLabelDialogPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -179,14 +182,13 @@ mail_label_dialog_class_init (EMailLabelDialogClass *class)
}
static void
-mail_label_dialog_init (EMailLabelDialog *dialog)
+e_mail_label_dialog_init (EMailLabelDialog *dialog)
{
GtkWidget *content_area;
GtkWidget *container;
GtkWidget *widget;
- dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- dialog, E_TYPE_MAIL_LABEL_DIALOG, EMailLabelDialogPrivate);
+ dialog->priv = E_MAIL_LABEL_DIALOG_GET_PRIVATE (dialog);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
@@ -234,32 +236,6 @@ mail_label_dialog_init (EMailLabelDialog *dialog)
gtk_widget_show (widget);
}
-GType
-e_mail_label_dialog_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMailLabelDialogClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_label_dialog_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailLabelDialog),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_label_dialog_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_DIALOG, "EMailLabelDialog", &type_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
e_mail_label_dialog_new (GtkWindow *parent)
{
diff --git a/mail/e-mail-label-list-store.c b/mail/e-mail-label-list-store.c
index 673893ca87..7e8c6f221a 100644
--- a/mail/e-mail-label-list-store.c
+++ b/mail/e-mail-label-list-store.c
@@ -28,6 +28,10 @@
#include <glib/gi18n.h>
#include <camel/camel.h>
+#define E_MAIL_LABEL_LIST_STORE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_LABEL_LIST_STORE, EMailLabelListStorePrivate))
+
struct _EMailLabelListStorePrivate {
GHashTable *tag_index;
GSettings *mail_settings;
@@ -45,7 +49,17 @@ static struct {
{ N_("_Later"), "#75507B", "$Labellater" } /* purple */
};
-static gpointer parent_class;
+/* Forward Declarations */
+static void e_mail_label_list_store_interface_init
+ (GtkTreeModelIface *interface);
+
+G_DEFINE_TYPE_WITH_CODE (
+ EMailLabelListStore,
+ e_mail_label_list_store,
+ GTK_TYPE_LIST_STORE,
+ G_IMPLEMENT_INTERFACE (
+ GTK_TYPE_TREE_MODEL,
+ e_mail_label_list_store_interface_init))
static gchar *
mail_label_list_store_tag_from_name (const gchar *label_name)
@@ -157,7 +171,7 @@ mail_label_list_store_finalize (GObject *object)
{
EMailLabelListStorePrivate *priv;
- priv = E_MAIL_LABEL_LIST_STORE (object)->priv;
+ priv = E_MAIL_LABEL_LIST_STORE_GET_PRIVATE (object);
g_hash_table_destroy (priv->tag_index);
@@ -167,7 +181,8 @@ mail_label_list_store_finalize (GObject *object)
}
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_mail_label_list_store_parent_class)->
+ finalize (object);
}
@@ -273,7 +288,8 @@ mail_label_list_store_constructed (GObject *object)
mail_label_list_store_ensure_defaults (store);
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_mail_label_list_store_parent_class)->
+ constructed (object);
}
static void
@@ -303,11 +319,10 @@ mail_label_list_store_row_inserted (GtkTreeModel *model,
}
static void
-mail_label_list_store_class_init (EMailLabelListStoreClass *class)
+e_mail_label_list_store_class_init (EMailLabelListStoreClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailLabelListStorePrivate));
object_class = G_OBJECT_CLASS (class);
@@ -319,7 +334,13 @@ mail_label_list_store_class_init (EMailLabelListStoreClass *class)
}
static void
-mail_label_list_store_init (EMailLabelListStore *store)
+e_mail_label_list_store_interface_init (GtkTreeModelIface *interface)
+{
+ interface->row_inserted = mail_label_list_store_row_inserted;
+}
+
+static void
+e_mail_label_list_store_init (EMailLabelListStore *store)
{
GHashTable *tag_index;
GType type = G_TYPE_STRING;
@@ -329,9 +350,7 @@ mail_label_list_store_init (EMailLabelListStore *store)
(GDestroyNotify) g_free,
(GDestroyNotify) gtk_tree_row_reference_free);
- store->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- store, E_TYPE_MAIL_LABEL_LIST_STORE,
- EMailLabelListStorePrivate);
+ store->priv = E_MAIL_LABEL_LIST_STORE_GET_PRIVATE (store);
store->priv->tag_index = tag_index;
/* XXX While it may seem awkward to cram the label name and color
@@ -344,48 +363,6 @@ mail_label_list_store_init (EMailLabelListStore *store)
gtk_list_store_set_column_types (GTK_LIST_STORE (store), 1, &type);
}
-static void
-mail_label_list_store_iface_init (GtkTreeModelIface *iface)
-{
- iface->row_inserted = mail_label_list_store_row_inserted;
-}
-
-GType
-e_mail_label_list_store_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMailLabelListStoreClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_label_list_store_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailLabelListStore),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_label_list_store_init,
- NULL /* vaule_table */
- };
-
- static const GInterfaceInfo iface_info = {
- (GInterfaceInitFunc) mail_label_list_store_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL /* interface_data */
- };
-
- type = g_type_register_static (
- GTK_TYPE_LIST_STORE, "EMailLabelListStore",
- &type_info, 0);
-
- g_type_add_interface_static (
- type, GTK_TYPE_TREE_MODEL, &iface_info);
- }
-
- return type;
-}
-
EMailLabelListStore *
e_mail_label_list_store_new (void)
{
diff --git a/mail/e-mail-label-manager.c b/mail/e-mail-label-manager.c
index e5fd6ebcc2..5b2990bd84 100644
--- a/mail/e-mail-label-manager.c
+++ b/mail/e-mail-label-manager.c
@@ -29,6 +29,10 @@
#include "e-mail-label-dialog.h"
#include "e-mail-label-tree-view.h"
+#define E_MAIL_LABEL_MANAGER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_LABEL_MANAGER, EMailLabelManagerPrivate))
+
struct _EMailLabelManagerPrivate {
GtkWidget *tree_view;
GtkWidget *add_button;
@@ -48,9 +52,10 @@ enum {
LAST_SIGNAL
};
-static gpointer parent_class;
static guint signals[LAST_SIGNAL];
+G_DEFINE_TYPE (EMailLabelManager, e_mail_label_manager, GTK_TYPE_TABLE)
+
static void
mail_label_manager_selection_changed_cb (EMailLabelManager *manager,
GtkTreeSelection *selection)
@@ -121,7 +126,7 @@ mail_label_manager_dispose (GObject *object)
{
EMailLabelManagerPrivate *priv;
- priv = E_MAIL_LABEL_MANAGER (object)->priv;
+ priv = E_MAIL_LABEL_MANAGER_GET_PRIVATE (object);
if (priv->tree_view != NULL) {
g_object_unref (priv->tree_view);
@@ -144,7 +149,7 @@ mail_label_manager_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_mail_label_manager_parent_class)->dispose (object);
}
static void
@@ -248,11 +253,10 @@ mail_label_manager_remove_label (EMailLabelManager *manager)
}
static void
-mail_label_manager_class_init (EMailLabelManagerClass *class)
+e_mail_label_manager_class_init (EMailLabelManagerClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailLabelManagerPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -303,14 +307,13 @@ mail_label_manager_class_init (EMailLabelManagerClass *class)
}
static void
-mail_label_manager_init (EMailLabelManager *manager)
+e_mail_label_manager_init (EMailLabelManager *manager)
{
GtkTreeSelection *selection;
GtkWidget *container;
GtkWidget *widget;
- manager->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- manager, E_TYPE_MAIL_LABEL_MANAGER, EMailLabelManagerPrivate);
+ manager->priv = E_MAIL_LABEL_MANAGER_GET_PRIVATE (manager);
gtk_table_resize (GTK_TABLE (manager), 2, 2);
gtk_table_set_col_spacings (GTK_TABLE (manager), 6);
@@ -394,32 +397,6 @@ mail_label_manager_init (EMailLabelManager *manager)
G_CALLBACK (e_mail_label_manager_remove_label), manager);
}
-GType
-e_mail_label_manager_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMailLabelManagerClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_label_manager_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailLabelManager),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_label_manager_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_TABLE, "EMailLabelManager", &type_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
e_mail_label_manager_new (void)
{
diff --git a/mail/e-mail-label-tree-view.c b/mail/e-mail-label-tree-view.c
index e5a8e50832..62589b4028 100644
--- a/mail/e-mail-label-tree-view.c
+++ b/mail/e-mail-label-tree-view.c
@@ -28,11 +28,15 @@
#include <glib/gi18n.h>
#include "e-mail-label-list-store.h"
+#define E_MAIL_LABEL_TREE_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_LABEL_TREE_VIEW, EMailLabelTreeViewPrivate))
+
struct _EMailLabelTreeViewPrivate {
gint placeholder;
};
-static gpointer parent_class;
+G_DEFINE_TYPE (EMailLabelTreeView, e_mail_label_tree_view, GTK_TYPE_TREE_VIEW)
static void
mail_label_tree_view_render_pixbuf (GtkTreeViewColumn *column,
@@ -67,21 +71,18 @@ mail_label_tree_view_render_text (GtkTreeViewColumn *column,
}
static void
-mail_label_tree_view_class_init (EMailLabelTreeViewClass *class)
+e_mail_label_tree_view_class_init (EMailLabelTreeViewClass *class)
{
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailLabelTreeViewPrivate));
}
static void
-mail_label_tree_view_init (EMailLabelTreeView *tree_view)
+e_mail_label_tree_view_init (EMailLabelTreeView *tree_view)
{
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- tree_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- tree_view, E_TYPE_MAIL_LABEL_TREE_VIEW,
- EMailLabelTreeViewPrivate);
+ tree_view->priv = E_MAIL_LABEL_TREE_VIEW_GET_PRIVATE (tree_view);
column = gtk_tree_view_column_new ();
renderer = gtk_cell_renderer_pixbuf_new ();
@@ -104,33 +105,6 @@ mail_label_tree_view_init (EMailLabelTreeView *tree_view)
mail_label_tree_view_render_text, tree_view, NULL);
}
-GType
-e_mail_label_tree_view_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMailLabelTreeViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_label_tree_view_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailLabelTreeView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_label_tree_view_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_TREE_VIEW, "EMailLabelTreeView",
- &type_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
e_mail_label_tree_view_new (void)
{
diff --git a/mail/e-mail-message-pane.c b/mail/e-mail-message-pane.c
index ed2e3a3337..bae8e85af9 100644
--- a/mail/e-mail-message-pane.c
+++ b/mail/e-mail-message-pane.c
@@ -30,6 +30,10 @@
#include "mail/e-mail-reader.h"
+#define E_MAIL_MESSAGE_PANE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_MESSAGE_PANE, EMailMessagePanePrivate))
+
struct _EMailMessagePanePrivate {
gint placeholder;
};
@@ -76,10 +80,9 @@ e_mail_message_pane_class_init (EMailMessagePaneClass *class)
}
static void
-e_mail_message_pane_init (EMailMessagePane *browser)
+e_mail_message_pane_init (EMailMessagePane *message_pane)
{
- browser->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- browser, E_TYPE_MAIL_MESSAGE_PANE, EMailMessagePanePrivate);
+ message_pane->priv = E_MAIL_MESSAGE_PANE_GET_PRIVATE (message_pane);
}
EMailView *
diff --git a/mail/e-mail-notebook-view.c b/mail/e-mail-notebook-view.c
index e737b88bfe..0232b92423 100644
--- a/mail/e-mail-notebook-view.c
+++ b/mail/e-mail-notebook-view.c
@@ -45,6 +45,10 @@
#include "e-mail-tab-picker.h"
#endif
+#define E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookViewPrivate))
+
struct _EMailNotebookViewPrivate {
GtkNotebook *book;
EMailView *current_view;
@@ -75,7 +79,9 @@ static void e_mail_notebook_view_reader_init (EMailReaderInterface *interface);
G_DEFINE_TYPE_WITH_CODE (
EMailNotebookView, e_mail_notebook_view, E_TYPE_MAIL_VIEW,
G_IMPLEMENT_INTERFACE (
- E_TYPE_MAIL_READER, e_mail_notebook_view_reader_init))
+ E_TYPE_MAIL_READER, e_mail_notebook_view_reader_init)
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_EXTENSIBLE, NULL))
#if HAVE_CLUTTER
static void
@@ -122,7 +128,7 @@ mnv_page_changed (GtkNotebook *book,
EMailView *mview;
CamelFolder *folder;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view);
shell_view = e_mail_view_get_shell_view (view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
@@ -516,7 +522,7 @@ mail_notebook_view_constructed (GObject *object)
ClutterTimeline *timeline;
#endif
- priv = E_MAIL_NOTEBOOK_VIEW (object)->priv;
+ priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (object);
container = GTK_WIDGET (object);
@@ -624,6 +630,8 @@ mail_notebook_view_constructed (GObject *object)
priv->book, "switch-page",
G_CALLBACK (mnv_page_changed), object);
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
+
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_mail_notebook_view_parent_class)->constructed (object);
}
@@ -634,26 +642,28 @@ mail_notebook_view_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (object)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (object);
+ current_view = notebook_view->priv->current_view;
switch (property_id) {
case PROP_FORWARD_STYLE:
e_mail_reader_set_forward_style (
- E_MAIL_READER (priv->current_view),
+ E_MAIL_READER (current_view),
g_value_get_enum (value));
return;
case PROP_GROUP_BY_THREADS:
e_mail_reader_set_group_by_threads (
- E_MAIL_READER (priv->current_view),
+ E_MAIL_READER (current_view),
g_value_get_boolean (value));
return;
case PROP_REPLY_STYLE:
e_mail_reader_set_reply_style (
- E_MAIL_READER (priv->current_view),
+ E_MAIL_READER (current_view),
g_value_get_enum (value));
return;
}
@@ -667,30 +677,32 @@ mail_notebook_view_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (object)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (object);
+ current_view = notebook_view->priv->current_view;
switch (property_id) {
case PROP_FORWARD_STYLE:
g_value_set_enum (
value,
e_mail_reader_get_forward_style (
- E_MAIL_READER (priv->current_view)));
+ E_MAIL_READER (current_view)));
return;
case PROP_GROUP_BY_THREADS:
g_value_set_boolean (
value,
e_mail_reader_get_group_by_threads (
- E_MAIL_READER (priv->current_view)));
+ E_MAIL_READER (current_view)));
return;
case PROP_REPLY_STYLE:
g_value_set_enum (
value,
e_mail_reader_get_reply_style (
- E_MAIL_READER (priv->current_view)));
+ E_MAIL_READER (current_view)));
return;
}
@@ -701,118 +713,136 @@ static void
mail_notebook_view_set_search_strings (EMailView *view,
GSList *search_strings)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (view);
+ current_view = notebook_view->priv->current_view;
- e_mail_view_set_search_strings (priv->current_view, search_strings);
+ e_mail_view_set_search_strings (current_view, search_strings);
}
static GalViewInstance *
mail_notebook_view_get_view_instance (EMailView *view)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (view);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return NULL;
- return e_mail_view_get_view_instance (priv->current_view);
+ return e_mail_view_get_view_instance (current_view);
}
static void
mail_notebook_view_update_view_instance (EMailView *view)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (view);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return;
- e_mail_view_update_view_instance (priv->current_view);
+ e_mail_view_update_view_instance (current_view);
}
static void
mail_notebook_view_set_orientation (EMailView *view,
GtkOrientation orientation)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (view);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return;
- e_mail_view_set_orientation (priv->current_view, orientation);
+ e_mail_view_set_orientation (current_view, orientation);
}
static GtkOrientation
mail_notebook_view_get_orientation (EMailView *view)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (view);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return GTK_ORIENTATION_VERTICAL;
- return e_mail_view_get_orientation (priv->current_view);
+ return e_mail_view_get_orientation (current_view);
}
static gboolean
mail_notebook_view_get_show_deleted (EMailView *view)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (view);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return FALSE;
- return e_mail_view_get_show_deleted (priv->current_view);
+ return e_mail_view_get_show_deleted (current_view);
}
static void
mail_notebook_view_set_show_deleted (EMailView *view,
gboolean show_deleted)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (view);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return;
- e_mail_view_set_show_deleted (priv->current_view, show_deleted);
+ e_mail_view_set_show_deleted (current_view, show_deleted);
}
static gboolean
mail_notebook_view_get_preview_visible (EMailView *view)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (view);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return FALSE;
- return e_mail_view_get_preview_visible (priv->current_view);
+ return e_mail_view_get_preview_visible (current_view);
}
static void
mail_notebook_view_set_preview_visible (EMailView *view,
gboolean preview_visible)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (view)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (view);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return;
- e_mail_view_set_preview_visible (priv->current_view, preview_visible);
+ e_mail_view_set_preview_visible (current_view, preview_visible);
}
static GtkActionGroup *
@@ -873,27 +903,33 @@ mail_notebook_view_get_backend (EMailReader *reader)
static EMFormatHTML *
mail_notebook_view_get_formatter (EMailReader *reader)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (reader);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return NULL;
- return e_mail_reader_get_formatter (E_MAIL_READER (priv->current_view));
+ reader = E_MAIL_READER (current_view);
+
+ return e_mail_reader_get_formatter (reader);
}
static gboolean
mail_notebook_view_get_hide_deleted (EMailReader *reader)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (reader);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return FALSE;
- reader = E_MAIL_READER (priv->current_view);
+ reader = E_MAIL_READER (current_view);
return e_mail_reader_get_hide_deleted (reader);
}
@@ -901,14 +937,16 @@ mail_notebook_view_get_hide_deleted (EMailReader *reader)
static GtkWidget *
mail_notebook_view_get_message_list (EMailReader *reader)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (reader);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return NULL;
- reader = E_MAIL_READER (priv->current_view);
+ reader = E_MAIL_READER (current_view);
return e_mail_reader_get_message_list (reader);
}
@@ -916,18 +954,37 @@ mail_notebook_view_get_message_list (EMailReader *reader)
static GtkMenu *
mail_notebook_view_get_popup_menu (EMailReader *reader)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (reader);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return NULL;
- reader = E_MAIL_READER (priv->current_view);
+ reader = E_MAIL_READER (current_view);
return e_mail_reader_get_popup_menu (reader);
}
+static EPreviewPane *
+mail_notebook_view_get_preview_pane (EMailReader *reader)
+{
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
+
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (reader);
+ current_view = notebook_view->priv->current_view;
+
+ if (current_view == NULL)
+ return NULL;
+
+ reader = E_MAIL_READER (current_view);
+
+ return e_mail_reader_get_preview_pane (reader);
+}
+
static GtkWindow *
mail_notebook_view_get_window (EMailReader *reader)
{
@@ -1162,7 +1219,7 @@ mail_notebook_view_set_folder (EMailReader *reader,
if (folder == NULL)
return;
- priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv;
+ priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (reader);
folder_uri = e_mail_folder_uri_from_folder (folder);
new_view = g_hash_table_lookup (priv->views, folder_uri);
@@ -1311,43 +1368,36 @@ mail_notebook_view_set_folder (EMailReader *reader,
}
}
-static void
-mail_notebook_view_show_search_bar (EMailReader *reader)
-{
- EMailNotebookViewPrivate *priv;
-
- priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv;
-
- if (priv->current_view == NULL)
- return;
-
- reader = E_MAIL_READER (priv->current_view);
-
- e_mail_reader_show_search_bar (reader);
-}
-
static gboolean
mail_notebook_view_enable_show_folder (EMailReader *reader)
{
- EMailNotebookViewPrivate *priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- if (!priv->current_view)
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (reader);
+ current_view = notebook_view->priv->current_view;
+
+ if (current_view == NULL)
return FALSE;
- return e_mail_reader_get_enable_show_folder (E_MAIL_READER (priv->current_view));
+ reader = E_MAIL_READER (current_view);
+
+ return e_mail_reader_get_enable_show_folder (reader);
}
static guint
mail_notebook_view_open_selected_mail (EMailReader *reader)
{
- EMailNotebookViewPrivate *priv;
+ EMailNotebookView *notebook_view;
+ EMailView *current_view;
- priv = E_MAIL_NOTEBOOK_VIEW (reader)->priv;
+ notebook_view = E_MAIL_NOTEBOOK_VIEW (reader);
+ current_view = notebook_view->priv->current_view;
- if (priv->current_view == NULL)
+ if (current_view == NULL)
return 0;
- reader = E_MAIL_READER (priv->current_view);
+ reader = E_MAIL_READER (current_view);
return e_mail_reader_open_selected_mail (reader);
}
@@ -1405,9 +1455,9 @@ e_mail_notebook_view_reader_init (EMailReaderInterface *interface)
interface->get_hide_deleted = mail_notebook_view_get_hide_deleted;
interface->get_message_list = mail_notebook_view_get_message_list;
interface->get_popup_menu = mail_notebook_view_get_popup_menu;
+ interface->get_preview_pane = mail_notebook_view_get_preview_pane;
interface->get_window = mail_notebook_view_get_window;
interface->set_folder = mail_notebook_view_set_folder;
- interface->show_search_bar = mail_notebook_view_show_search_bar;
interface->open_selected_mail = mail_notebook_view_open_selected_mail;
interface->enable_show_folder = mail_notebook_view_enable_show_folder;
}
@@ -1415,9 +1465,7 @@ e_mail_notebook_view_reader_init (EMailReaderInterface *interface)
static void
e_mail_notebook_view_init (EMailNotebookView *view)
{
- view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- view, E_TYPE_MAIL_NOTEBOOK_VIEW, EMailNotebookViewPrivate);
-
+ view->priv = E_MAIL_NOTEBOOK_VIEW_GET_PRIVATE (view);
view->priv->inited = FALSE;
view->priv->views = g_hash_table_new (g_str_hash, g_str_equal);
}
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index 63d0c2ea0a..1634044589 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -45,6 +45,10 @@
#include "e-mail-folder-utils.h"
#include "e-mail-reader-utils.h"
+#define E_MAIL_PANED_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_PANED_VIEW, EMailPanedViewPrivate))
+
#define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \
E_SHELL_WINDOW_ACTION_GROUP ((window), "mail")
@@ -52,8 +56,7 @@ struct _EMailPanedViewPrivate {
GtkWidget *paned;
GtkWidget *scrolled_window;
GtkWidget *message_list;
- GtkWidget *search_bar;
- GtkWidget *preview;
+ GtkWidget *preview_pane;
EMFormatHTMLDisplay *formatter;
GalViewInstance *view_instance;
@@ -85,7 +88,9 @@ static void e_mail_paned_view_reader_init (EMailReaderInterface *interface);
G_DEFINE_TYPE_WITH_CODE (
EMailPanedView, e_mail_paned_view, E_TYPE_MAIL_VIEW,
G_IMPLEMENT_INTERFACE (
- E_TYPE_MAIL_READER, e_mail_paned_view_reader_init))
+ E_TYPE_MAIL_READER, e_mail_paned_view_reader_init)
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_EXTENSIBLE, NULL))
static void
mail_paned_view_save_boolean (EMailView *view,
@@ -126,7 +131,7 @@ mail_paned_view_message_list_built_cb (EMailView *view,
EShellWindow *shell_window;
GKeyFile *key_file;
- priv = E_MAIL_PANED_VIEW (view)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
g_signal_handler_disconnect (
message_list, priv->message_list_built_id);
@@ -326,7 +331,7 @@ mail_paned_view_dispose (GObject *object)
{
EMailPanedViewPrivate *priv;
- priv = E_MAIL_PANED_VIEW (object)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (object);
if (priv->paned != NULL) {
g_object_unref (priv->paned);
@@ -343,9 +348,9 @@ mail_paned_view_dispose (GObject *object)
priv->message_list = NULL;
}
- if (priv->search_bar != NULL) {
- g_object_unref (priv->search_bar);
- priv->search_bar = NULL;
+ if (priv->preview_pane != NULL) {
+ g_object_unref (priv->preview_pane);
+ priv->preview_pane = NULL;
}
if (priv->formatter != NULL) {
@@ -420,11 +425,11 @@ mail_paned_view_get_backend (EMailReader *reader)
static EMFormatHTML *
mail_paned_view_get_formatter (EMailReader *reader)
{
- EMailPanedViewPrivate *priv;
+ EMailPanedView *paned_view;
- priv = E_MAIL_PANED_VIEW (reader)->priv;
+ paned_view = E_MAIL_PANED_VIEW (reader);
- return EM_FORMAT_HTML (priv->formatter);
+ return EM_FORMAT_HTML (paned_view->priv->formatter);
}
static gboolean
@@ -436,11 +441,11 @@ mail_paned_view_get_hide_deleted (EMailReader *reader)
static GtkWidget *
mail_paned_view_get_message_list (EMailReader *reader)
{
- EMailPanedViewPrivate *priv;
+ EMailPanedView *paned_view;
- priv = E_MAIL_PANED_VIEW (reader)->priv;
+ paned_view = E_MAIL_PANED_VIEW (reader);
- return priv->message_list;
+ return paned_view->priv->message_list;
}
static GtkMenu *
@@ -462,6 +467,16 @@ mail_paned_view_get_popup_menu (EMailReader *reader)
return GTK_MENU (widget);
}
+static EPreviewPane *
+mail_paned_view_get_preview_pane (EMailReader *reader)
+{
+ EMailPanedView *paned_view;
+
+ paned_view = E_MAIL_PANED_VIEW (reader);
+
+ return E_PREVIEW_PANE (paned_view->priv->preview_pane);
+}
+
static GtkWindow *
mail_paned_view_get_window (EMailReader *reader)
{
@@ -495,7 +510,7 @@ mail_paned_view_set_folder (EMailReader *reader,
gboolean value;
GError *error = NULL;
- priv = E_MAIL_PANED_VIEW (reader)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (reader);
view = E_MAIL_VIEW (reader);
shell_view = e_mail_view_get_shell_view (view);
@@ -569,31 +584,28 @@ exit:
message_list_thaw (MESSAGE_LIST (message_list));
}
-static void
-mail_paned_view_show_search_bar (EMailReader *reader)
+static guint
+mail_paned_view_reader_open_selected_mail (EMailReader *reader)
{
- EMailPanedViewPrivate *priv;
+ EMailPanedView *paned_view;
+ EMailPanedViewClass *class;
- priv = E_MAIL_PANED_VIEW (reader)->priv;
+ paned_view = E_MAIL_PANED_VIEW (reader);
- gtk_widget_show (priv->search_bar);
-}
+ class = E_MAIL_PANED_VIEW_GET_CLASS (paned_view);
+ g_return_val_if_fail (class->open_selected_mail != NULL, 0);
-static guint
-mail_paned_view_reader_open_selected_mail (EMailReader *reader)
-{
- return E_MAIL_PANED_VIEW_GET_CLASS (reader)->
- open_selected_mail (E_MAIL_PANED_VIEW (reader));
+ return class->open_selected_mail (paned_view);
}
static gboolean
mail_paned_view_enable_show_folder (EMailReader *reader)
{
- EMailPanedViewPrivate *priv;
+ EMailPanedView *paned_view;
- priv = E_MAIL_PANED_VIEW (reader)->priv;
+ paned_view = E_MAIL_PANED_VIEW (reader);
- return priv->enable_show_folder ? TRUE : FALSE;
+ return paned_view->priv->enable_show_folder;
}
static void
@@ -613,7 +625,7 @@ mail_paned_view_constructed (GObject *object)
GtkWidget *widget;
EWebView *web_view;
- priv = E_MAIL_PANED_VIEW (object)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (object);
priv->formatter = em_format_html_display_new ();
view = E_MAIL_VIEW (object);
@@ -624,11 +636,13 @@ mail_paned_view_constructed (GObject *object)
shell_settings = e_shell_get_shell_settings (shell);
/* Make headers collapsable and store state of headers in config file */
- em_format_html_set_headers_collapsable (EM_FORMAT_HTML (priv->formatter), TRUE);
- g_object_bind_property (shell_settings, "paned-view-headers-state",
- EM_FORMAT_HTML (priv->formatter), "headers-state",
- G_BINDING_BIDIRECTIONAL |
- G_BINDING_SYNC_CREATE);
+ em_format_html_set_headers_collapsable (
+ EM_FORMAT_HTML (priv->formatter), TRUE);
+ g_object_bind_property (
+ shell_settings, "paned-view-headers-state",
+ priv->formatter, "headers-state",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE);
web_view = em_format_html_get_web_view (
EM_FORMAT_HTML (priv->formatter));
@@ -671,8 +685,8 @@ mail_paned_view_constructed (GObject *object)
gtk_widget_show (GTK_WIDGET (web_view));
widget = e_preview_pane_new (web_view);
- priv->preview = widget;
gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE);
+ priv->preview_pane = g_object_ref (widget);
gtk_widget_show (widget);
g_object_bind_property (
@@ -681,7 +695,6 @@ mail_paned_view_constructed (GObject *object)
G_BINDING_SYNC_CREATE);
search_bar = e_preview_pane_get_search_bar (E_PREVIEW_PANE (widget));
- priv->search_bar = g_object_ref (search_bar);
g_signal_connect_swapped (
search_bar, "changed",
@@ -716,6 +729,8 @@ mail_paned_view_constructed (GObject *object)
* set_preview_visible() method relies on it. */
e_mail_view_set_preview_visible (view, TRUE);
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
+
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_mail_paned_view_parent_class)->constructed (object);
}
@@ -724,13 +739,14 @@ static void
mail_paned_view_set_search_strings (EMailView *view,
GSList *search_strings)
{
- EMailPanedViewPrivate *priv;
+ EMailReader *reader;
+ EPreviewPane *preview_pane;
ESearchBar *search_bar;
ESearchingTokenizer *tokenizer;
- priv = E_MAIL_PANED_VIEW (view)->priv;
-
- search_bar = E_SEARCH_BAR (priv->search_bar);
+ reader = E_MAIL_READER (view);
+ preview_pane = e_mail_reader_get_preview_pane (reader);
+ search_bar = e_preview_pane_get_search_bar (preview_pane);
tokenizer = e_search_bar_get_tokenizer (search_bar);
e_searching_tokenizer_set_secondary_case_sensitivity (tokenizer, FALSE);
@@ -748,11 +764,11 @@ mail_paned_view_set_search_strings (EMailView *view,
static GalViewInstance *
mail_paned_view_get_view_instance (EMailView *view)
{
- EMailPanedViewPrivate *priv;
+ EMailPanedView *paned_view;
- priv = E_MAIL_PANED_VIEW (view)->priv;
+ paned_view = E_MAIL_PANED_VIEW (view);
- return priv->view_instance;
+ return paned_view->priv->view_instance;
}
static void
@@ -774,7 +790,7 @@ mail_paned_view_update_view_instance (EMailView *view)
gboolean show_vertical_view;
gchar *view_id;
- priv = E_MAIL_PANED_VIEW (view)->priv;
+ priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
shell_view = e_mail_view_get_shell_view (view);
shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
@@ -999,9 +1015,9 @@ e_mail_paned_view_reader_init (EMailReaderInterface *interface)
interface->get_hide_deleted = mail_paned_view_get_hide_deleted;
interface->get_message_list = mail_paned_view_get_message_list;
interface->get_popup_menu = mail_paned_view_get_popup_menu;
+ interface->get_preview_pane = mail_paned_view_get_preview_pane;
interface->get_window = mail_paned_view_get_window;
interface->set_folder = mail_paned_view_set_folder;
- interface->show_search_bar = mail_paned_view_show_search_bar;
interface->open_selected_mail = mail_paned_view_reader_open_selected_mail;
interface->enable_show_folder = mail_paned_view_enable_show_folder;
}
@@ -1009,8 +1025,7 @@ e_mail_paned_view_reader_init (EMailReaderInterface *interface)
static void
e_mail_paned_view_init (EMailPanedView *view)
{
- view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- view, E_TYPE_MAIL_PANED_VIEW, EMailPanedViewPrivate);
+ view->priv = E_MAIL_PANED_VIEW_GET_PRIVATE (view);
view->priv->enable_show_folder = FALSE;
g_signal_connect (
@@ -1041,14 +1056,6 @@ e_mail_paned_view_hide_message_list_pane (EMailPanedView *view,
gtk_widget_hide (view->priv->scrolled_window);
}
-GtkWidget *
-e_mail_paned_view_get_preview (EMailPanedView *view)
-{
- g_return_val_if_fail (E_IS_MAIL_PANED_VIEW (view), NULL);
-
- return view->priv->preview;
-}
-
void
e_mail_paned_view_set_enable_show_folder (EMailPanedView *view,
gboolean set)
diff --git a/mail/e-mail-paned-view.h b/mail/e-mail-paned-view.h
index 5e6879ae94..3226b394f1 100644
--- a/mail/e-mail-paned-view.h
+++ b/mail/e-mail-paned-view.h
@@ -71,7 +71,6 @@ GtkWidget * e_mail_paned_view_new (EShellView *shell_view);
void e_mail_paned_view_hide_message_list_pane
(EMailPanedView *view,
gboolean visible);
-GtkWidget * e_mail_paned_view_get_preview (EMailPanedView *view);
void e_mail_paned_view_set_enable_show_folder
(EMailPanedView *view,
gboolean set);
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 725a0c6d7c..a58eb1f441 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -282,38 +282,6 @@ e_mail_reader_delete_folder (EMailReader *reader,
gtk_widget_destroy (dialog);
}
-void
-e_mail_reader_mark_as_read (EMailReader *reader,
- const gchar *uid)
-{
- EMailBackend *backend;
- EMFormatHTML *formatter;
- CamelFolder *folder;
- guint32 mask, set;
- guint32 flags;
-
- g_return_if_fail (E_IS_MAIL_READER (reader));
- g_return_if_fail (uid != NULL);
-
- folder = e_mail_reader_get_folder (reader);
- backend = e_mail_reader_get_backend (reader);
- formatter = e_mail_reader_get_formatter (reader);
-
- flags = camel_folder_get_message_flags (folder, uid);
-
- if (!(flags & CAMEL_MESSAGE_SEEN)) {
- CamelMimeMessage *message;
-
- message = EM_FORMAT (formatter)->message;
- em_utils_handle_receipt (backend, folder, uid, message);
- }
-
- mask = CAMEL_MESSAGE_SEEN;
- set = CAMEL_MESSAGE_SEEN;
-
- camel_folder_set_message_flags (folder, uid, mask, set);
-}
-
guint
e_mail_reader_mark_selected (EMailReader *reader,
guint32 mask,
diff --git a/mail/e-mail-reader-utils.h b/mail/e-mail-reader-utils.h
index b566da16a7..bb4671ba21 100644
--- a/mail/e-mail-reader-utils.h
+++ b/mail/e-mail-reader-utils.h
@@ -39,8 +39,6 @@ struct _EMailReaderHeader {
gboolean e_mail_reader_confirm_delete (EMailReader *reader);
void e_mail_reader_delete_folder (EMailReader *reader,
CamelFolder *folder);
-void e_mail_reader_mark_as_read (EMailReader *reader,
- const gchar *uid);
guint e_mail_reader_mark_selected (EMailReader *reader,
guint32 mask,
guint32 set);
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 22b1e0e7c6..27af0d2b4b 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -101,6 +101,8 @@ struct _EMailReaderPrivate {
enum {
CHANGED,
FOLDER_LOADED,
+ MESSAGE_LOADED,
+ MESSAGE_SEEN,
SHOW_SEARCH_BAR,
UPDATE_ACTIONS,
SHOW_FOLDER,
@@ -1101,13 +1103,13 @@ action_mail_redirect_cb (GtkAction *action,
EMailReaderClosure *closure;
GtkWidget *message_list;
CamelFolder *folder;
- const gchar *uid;
+ const gchar *message_uid;
folder = e_mail_reader_get_folder (reader);
message_list = e_mail_reader_get_message_list (reader);
- uid = MESSAGE_LIST (message_list)->cursor_uid;
- g_return_if_fail (uid != NULL);
+ message_uid = MESSAGE_LIST (message_list)->cursor_uid;
+ g_return_if_fail (message_uid != NULL);
/* Open the message asynchronously. */
@@ -1119,7 +1121,7 @@ action_mail_redirect_cb (GtkAction *action,
closure->reader = g_object_ref (reader);
camel_folder_get_message (
- folder, uid, G_PRIORITY_DEFAULT,
+ folder, message_uid, G_PRIORITY_DEFAULT,
cancellable, (GAsyncReadyCallback)
mail_reader_redirect_cb, closure);
}
@@ -2464,21 +2466,35 @@ mail_reader_key_press_cb (EMailReader *reader,
}
static gboolean
-mail_reader_message_read_cb (EMailReaderClosure *closure)
+mail_reader_message_seen_cb (EMailReaderClosure *closure)
{
EMailReader *reader;
GtkWidget *message_list;
- const gchar *cursor_uid;
+ EMFormatHTML *formatter;
+ CamelMimeMessage *message;
+ const gchar *current_uid;
const gchar *message_uid;
+ gboolean uid_is_current = TRUE;
reader = closure->reader;
message_uid = closure->message_uid;
+ formatter = e_mail_reader_get_formatter (reader);
message_list = e_mail_reader_get_message_list (reader);
- cursor_uid = MESSAGE_LIST (message_list)->cursor_uid;
- if (g_strcmp0 (cursor_uid, message_uid) == 0)
- e_mail_reader_mark_as_read (reader, message_uid);
+ current_uid = EM_FORMAT (formatter)->uid;
+ uid_is_current &= (g_strcmp0 (current_uid, message_uid) == 0);
+
+ current_uid = MESSAGE_LIST (message_list)->cursor_uid;
+ uid_is_current &= (g_strcmp0 (current_uid, message_uid) == 0);
+
+ message = EM_FORMAT (formatter)->message;
+ g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), FALSE);
+
+ if (uid_is_current)
+ g_signal_emit (
+ reader, signals[MESSAGE_SEEN], 0,
+ message_uid, message);
return FALSE;
}
@@ -2502,7 +2518,7 @@ schedule_timeout_mark_seen (EMailReader *reader)
shell_settings = e_shell_get_shell_settings (shell);
message_uid = message_list->cursor_uid;
- if (!message_uid)
+ if (message_uid == NULL)
return FALSE;
schedule_timeout =
@@ -2527,7 +2543,7 @@ schedule_timeout_mark_seen (EMailReader *reader)
MESSAGE_LIST (message_list)->seen_id = g_timeout_add_full (
G_PRIORITY_DEFAULT, timeout_interval,
- (GSourceFunc) mail_reader_message_read_cb,
+ (GSourceFunc) mail_reader_message_seen_cb,
timeout_closure, (GDestroyNotify)
mail_reader_closure_free);
}
@@ -2543,14 +2559,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
EMailReader *reader;
EMailReaderPrivate *priv;
CamelMimeMessage *message = NULL;
- EMFormatHTML *formatter;
GtkWidget *message_list;
- EMailBackend *backend;
- EShellBackend *shell_backend;
- EShell *shell;
- EWebView *web_view;
- EMEvent *event;
- EMEventTargetMessage *target;
const gchar *message_uid;
GError *error = NULL;
@@ -2576,8 +2585,6 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
goto exit;
}
- backend = e_mail_reader_get_backend (reader);
- formatter = e_mail_reader_get_formatter (reader);
message_list = e_mail_reader_get_message_list (reader);
if (!message_list) {
@@ -2586,49 +2593,8 @@ mail_reader_message_loaded_cb (CamelFolder *folder,
goto exit;
}
- shell_backend = E_SHELL_BACKEND (backend);
- shell = e_shell_backend_get_shell (shell_backend);
-
- web_view = em_format_html_get_web_view (formatter);
-
- /** @Event: message.reading
- * @Title: Viewing a message
- * @Target: EMEventTargetMessage
- *
- * message.reading is emitted whenever a user views a message.
- */
- event = em_event_peek ();
- target = em_event_target_new_message (
- event, folder, message, message_uid, 0, NULL);
- e_event_emit (
- (EEvent *) event, "message.reading",
- (EEventTarget *) target);
-
- /* FIXME Need to pass a GCancellable. */
- em_format_format (
- EM_FORMAT (formatter), folder,
- message_uid, message, NULL);
-
- /* Reset the shell view icon. */
- e_shell_event (shell, "mail-icon", (gpointer) "evolution-mail");
-
- if (MESSAGE_LIST (message_list)->seen_id > 0) {
- g_source_remove (MESSAGE_LIST (message_list)->seen_id);
- MESSAGE_LIST (message_list)->seen_id = 0;
- }
-
- /* Determine whether to mark the message as read. */
- if (message != NULL &&
- !priv->restoring_message_selection &&
- schedule_timeout_mark_seen (reader)) {
- g_clear_error (&error);
- } else if (error != NULL) {
- e_alert_submit (
- E_ALERT_SINK (web_view),
- "mail:no-retrieve-message",
- error->message, NULL);
- g_error_free (error);
- }
+ g_signal_emit (
+ reader, signals[MESSAGE_LOADED], 0, message_uid, message);
exit:
priv->restoring_message_selection = FALSE;
@@ -2645,7 +2611,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
EMailReaderPrivate *priv;
EMFormatHTML *formatter;
GtkWidget *message_list;
- EWebView *web_view;
+ EPreviewPane *preview_pane;
CamelFolder *folder;
const gchar *cursor_uid;
const gchar *format_uid;
@@ -2656,30 +2622,32 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
formatter = e_mail_reader_get_formatter (reader);
message_list = e_mail_reader_get_message_list (reader);
+ preview_pane = e_mail_reader_get_preview_pane (reader);
cursor_uid = MESSAGE_LIST (message_list)->cursor_uid;
format_uid = EM_FORMAT (formatter)->uid;
- web_view = em_format_html_get_web_view (formatter);
+ e_preview_pane_clear_alerts (preview_pane);
if (MESSAGE_LIST (message_list)->last_sel_single) {
- GtkWidget *widget;
- gboolean web_view_visible;
+ gboolean preview_visible;
gboolean selected_uid_changed;
/* Decide whether to download the full message now. */
- widget = GTK_WIDGET (web_view);
-
- web_view_visible = gtk_widget_get_mapped (widget);
+ preview_visible =
+ gtk_widget_get_mapped (GTK_WIDGET (preview_pane));
selected_uid_changed = g_strcmp0 (cursor_uid, format_uid);
- if (web_view_visible && selected_uid_changed) {
+ if (preview_visible && selected_uid_changed) {
EMailReaderClosure *closure;
GCancellable *cancellable;
EActivity *activity;
+ EWebView *web_view;
gchar *string;
+ web_view = e_preview_pane_get_web_view (preview_pane);
+
string = g_strdup_printf (
_("Retrieving message '%s'"), cursor_uid);
#if HAVE_CLUTTER
@@ -2721,7 +2689,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader)
static void
mail_reader_message_selected_cb (EMailReader *reader,
- const gchar *uid)
+ const gchar *message_uid)
{
EMailReaderPrivate *priv;
MessageList *message_list;
@@ -2773,7 +2741,7 @@ mail_reader_message_cursor_change_cb (EMailReader *reader)
message_list = MESSAGE_LIST (e_mail_reader_get_message_list (reader));
g_return_if_fail (message_list != NULL);
- if (!message_list->seen_id &&
+ if (message_list->seen_id == 0 &&
E_IS_MAIL_VIEW (reader) &&
e_mail_view_get_preview_visible (E_MAIL_VIEW (reader)))
schedule_timeout_mark_seen (reader);
@@ -2785,6 +2753,16 @@ mail_reader_emit_folder_loaded (EMailReader *reader)
g_signal_emit (reader, signals[FOLDER_LOADED], 0);
}
+static EAlertSink *
+mail_reader_get_alert_sink (EMailReader *reader)
+{
+ EPreviewPane *preview_pane;
+
+ preview_pane = e_mail_reader_get_preview_pane (reader);
+
+ return E_ALERT_SINK (preview_pane);
+}
+
static GPtrArray *
mail_reader_get_selected_uids (EMailReader *reader)
{
@@ -2859,13 +2837,14 @@ mail_reader_set_folder (EMailReader *reader,
static void
mail_reader_set_message (EMailReader *reader,
- const gchar *uid)
+ const gchar *message_uid)
{
GtkWidget *message_list;
message_list = e_mail_reader_get_message_list (reader);
- message_list_select_uid (MESSAGE_LIST (message_list), uid, FALSE);
+ message_list_select_uid (
+ MESSAGE_LIST (message_list), message_uid, FALSE);
}
static void
@@ -2878,6 +2857,101 @@ mail_reader_folder_loaded (EMailReader *reader)
}
static void
+mail_reader_message_loaded (EMailReader *reader,
+ const gchar *message_uid,
+ CamelMimeMessage *message)
+{
+ EMailReaderPrivate *priv;
+ EMFormatHTML *formatter;
+ GtkWidget *message_list;
+ EMailBackend *backend;
+ CamelFolder *folder;
+ EWebView *web_view;
+ EPreviewPane *preview_pane;
+ EShellBackend *shell_backend;
+ EShell *shell;
+ EMEvent *event;
+ EMEventTargetMessage *target;
+ GError *error = NULL;
+
+ priv = E_MAIL_READER_GET_PRIVATE (reader);
+
+ folder = e_mail_reader_get_folder (reader);
+ backend = e_mail_reader_get_backend (reader);
+ formatter = e_mail_reader_get_formatter (reader);
+ message_list = e_mail_reader_get_message_list (reader);
+ preview_pane = e_mail_reader_get_preview_pane (reader);
+
+ shell_backend = E_SHELL_BACKEND (backend);
+ shell = e_shell_backend_get_shell (shell_backend);
+
+ web_view = e_preview_pane_get_web_view (preview_pane);
+
+ /** @Event: message.reading
+ * @Title: Viewing a message
+ * @Target: EMEventTargetMessage
+ *
+ * message.reading is emitted whenever a user views a message.
+ */
+ event = em_event_peek ();
+ target = em_event_target_new_message (
+ event, folder, message, message_uid, 0, NULL);
+ e_event_emit (
+ (EEvent *) event, "message.reading",
+ (EEventTarget *) target);
+
+ /* FIXME Need to pass a GCancellable. */
+ em_format_format (
+ EM_FORMAT (formatter), folder,
+ message_uid, message, NULL);
+
+ /* Reset the shell view icon. */
+ e_shell_event (shell, "mail-icon", (gpointer) "evolution-mail");
+
+ if (MESSAGE_LIST (message_list)->seen_id > 0) {
+ g_source_remove (MESSAGE_LIST (message_list)->seen_id);
+ MESSAGE_LIST (message_list)->seen_id = 0;
+ }
+
+ /* Determine whether to mark the message as read. */
+ if (message != NULL &&
+ !priv->restoring_message_selection &&
+ schedule_timeout_mark_seen (reader)) {
+ g_clear_error (&error);
+ } else if (error != NULL) {
+ e_alert_submit (
+ E_ALERT_SINK (web_view),
+ "mail:no-retrieve-message",
+ error->message, NULL);
+ g_error_free (error);
+ }
+}
+
+static void
+mail_reader_message_seen (EMailReader *reader,
+ const gchar *message_uid,
+ CamelMimeMessage *message)
+{
+ CamelFolder *folder;
+ guint32 mask, set;
+
+ mask = CAMEL_MESSAGE_SEEN;
+ set = CAMEL_MESSAGE_SEEN;
+
+ folder = e_mail_reader_get_folder (reader);
+ camel_folder_set_message_flags (folder, message_uid, mask, set);
+}
+
+static void
+mail_reader_show_search_bar (EMailReader *reader)
+{
+ EPreviewPane *preview_pane;
+
+ preview_pane = e_mail_reader_get_preview_pane (reader);
+ e_preview_pane_show_search_bar (preview_pane);
+}
+
+static void
mail_reader_update_actions (EMailReader *reader,
guint32 state)
{
@@ -3303,6 +3377,7 @@ e_mail_reader_default_init (EMailReaderInterface *interface)
{
quark_private = g_quark_from_static_string ("e-mail-reader-private");
+ interface->get_alert_sink = mail_reader_get_alert_sink;
interface->get_selected_uids = mail_reader_get_selected_uids;
interface->get_folder = mail_reader_get_folder;
interface->enable_show_folder = mail_reader_get_enable_show_folder;
@@ -3310,6 +3385,9 @@ e_mail_reader_default_init (EMailReaderInterface *interface)
interface->set_message = mail_reader_set_message;
interface->open_selected_mail = e_mail_reader_open_selected;
interface->folder_loaded = mail_reader_folder_loaded;
+ interface->message_loaded = mail_reader_message_loaded;
+ interface->message_seen = mail_reader_message_seen;
+ interface->show_search_bar = mail_reader_show_search_bar;
interface->update_actions = mail_reader_update_actions;
g_object_interface_install_property (
@@ -3358,6 +3436,28 @@ e_mail_reader_default_init (EMailReaderInterface *interface)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ signals[MESSAGE_LOADED] = g_signal_new (
+ "message-loaded",
+ G_OBJECT_CLASS_TYPE (interface),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMailReaderInterface, message_loaded),
+ NULL, NULL,
+ e_marshal_VOID__STRING_OBJECT,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ CAMEL_TYPE_MIME_MESSAGE);
+
+ signals[MESSAGE_SEEN] = g_signal_new (
+ "message-seen",
+ G_OBJECT_CLASS_TYPE (interface),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EMailReaderInterface, message_seen),
+ NULL, NULL,
+ e_marshal_VOID__STRING_OBJECT,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ CAMEL_TYPE_MIME_MESSAGE);
+
signals[SHOW_SEARCH_BAR] = g_signal_new (
"show-search-bar",
G_OBJECT_CLASS_TYPE (interface),
@@ -4013,6 +4113,19 @@ e_mail_reader_get_popup_menu (EMailReader *reader)
return interface->get_popup_menu (reader);
}
+EPreviewPane *
+e_mail_reader_get_preview_pane (EMailReader *reader)
+{
+ EMailReaderInterface *interface;
+
+ g_return_val_if_fail (E_IS_MAIL_READER (reader), NULL);
+
+ interface = E_MAIL_READER_GET_INTERFACE (reader);
+ g_return_val_if_fail (interface->get_preview_pane != NULL, NULL);
+
+ return interface->get_preview_pane (reader);
+}
+
GPtrArray *
e_mail_reader_get_selected_uids (EMailReader *reader)
{
@@ -4068,7 +4181,7 @@ e_mail_reader_set_folder (EMailReader *reader,
void
e_mail_reader_set_message (EMailReader *reader,
- const gchar *uid)
+ const gchar *message_uid)
{
EMailReaderInterface *interface;
@@ -4077,7 +4190,7 @@ e_mail_reader_set_message (EMailReader *reader,
interface = E_MAIL_READER_GET_INTERFACE (reader);
g_return_if_fail (interface->set_message != NULL);
- interface->set_message (reader, uid);
+ interface->set_message (reader, message_uid);
}
guint
diff --git a/mail/e-mail-reader.h b/mail/e-mail-reader.h
index 331837da55..9e362631cc 100644
--- a/mail/e-mail-reader.h
+++ b/mail/e-mail-reader.h
@@ -32,6 +32,7 @@
#include <e-util/e-alert-sink.h>
#include <mail/e-mail-backend.h>
#include <mail/em-format-html.h>
+#include <misc/e-preview-pane.h>
/* Standard GObject macros */
#define E_TYPE_MAIL_READER \
@@ -99,6 +100,7 @@ struct _EMailReaderInterface {
gboolean (*get_hide_deleted) (EMailReader *reader);
GtkWidget * (*get_message_list) (EMailReader *reader);
GtkMenu * (*get_popup_menu) (EMailReader *reader);
+ EPreviewPane * (*get_preview_pane) (EMailReader *reader);
GPtrArray * (*get_selected_uids) (EMailReader *reader);
GtkWindow * (*get_window) (EMailReader *reader);
@@ -106,12 +108,18 @@ struct _EMailReaderInterface {
void (*set_folder) (EMailReader *reader,
CamelFolder *folder);
void (*set_message) (EMailReader *reader,
- const gchar *uid);
+ const gchar *message_uid);
guint (*open_selected_mail) (EMailReader *reader);
gboolean (*enable_show_folder) (EMailReader *reader);
/* Signals */
void (*folder_loaded) (EMailReader *reader);
+ void (*message_loaded) (EMailReader *reader,
+ const gchar *message_uid,
+ CamelMimeMessage *message);
+ void (*message_seen) (EMailReader *reader,
+ const gchar *message_uid,
+ CamelMimeMessage *message);
void (*show_search_bar) (EMailReader *reader);
void (*update_actions) (EMailReader *reader,
guint32 state);
@@ -139,13 +147,14 @@ GtkWidget * e_mail_reader_get_message_list (EMailReader *reader);
guint e_mail_reader_open_selected_mail
(EMailReader *reader);
GtkMenu * e_mail_reader_get_popup_menu (EMailReader *reader);
+EPreviewPane * e_mail_reader_get_preview_pane (EMailReader *reader);
GPtrArray * e_mail_reader_get_selected_uids (EMailReader *reader);
GtkWindow * e_mail_reader_get_window (EMailReader *reader);
CamelFolder * e_mail_reader_get_folder (EMailReader *reader);
void e_mail_reader_set_folder (EMailReader *reader,
CamelFolder *folder);
void e_mail_reader_set_message (EMailReader *reader,
- const gchar *uid);
+ const gchar *message_uid);
EMailForwardStyle
e_mail_reader_get_forward_style (EMailReader *reader);
void e_mail_reader_set_forward_style (EMailReader *reader,
diff --git a/mail/e-mail-tab-picker.c b/mail/e-mail-tab-picker.c
index cc257284dc..8732d4a9c1 100644
--- a/mail/e-mail-tab-picker.c
+++ b/mail/e-mail-tab-picker.c
@@ -22,6 +22,10 @@
#include "e-mail-tab-picker.h"
+#define E_MAIL_TAB_PICKER_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_TAB_PICKER, EMailTabPickerPrivate))
+
static void mx_droppable_iface_init (MxDroppableIface *iface);
static gint e_mail_tab_picker_find_tab_cb (gconstpointer a, gconstpointer b);
@@ -277,8 +281,9 @@ e_mail_tab_picker_paint (ClutterActor *actor)
{
GList *t;
gfloat width, height, offset;
+ EMailTabPickerPrivate *priv;
- EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv;
+ priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor);
CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->paint (actor);
@@ -346,7 +351,9 @@ static void
e_mail_tab_picker_pick (ClutterActor *actor,
const ClutterColor *color)
{
- EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv;
+ EMailTabPickerPrivate *priv;
+
+ priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor);
/* Chain up to paint background */
CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->pick (actor, color);
@@ -363,8 +370,9 @@ e_mail_tab_picker_get_preferred_width (ClutterActor *actor,
{
GList *t;
MxPadding padding;
+ EMailTabPickerPrivate *priv;
- EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv;
+ priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor);
clutter_actor_get_preferred_width (
CLUTTER_ACTOR (priv->chooser_button),
@@ -740,7 +748,9 @@ static void
e_mail_tab_picker_map (ClutterActor *actor)
{
GList *t;
- EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv;
+ EMailTabPickerPrivate *priv;
+
+ priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor);
CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->map (actor);
@@ -758,7 +768,9 @@ static void
e_mail_tab_picker_unmap (ClutterActor *actor)
{
GList *t;
- EMailTabPickerPrivate *priv = E_MAIL_TAB_PICKER (actor)->priv;
+ EMailTabPickerPrivate *priv;
+
+ priv = E_MAIL_TAB_PICKER_GET_PRIVATE (actor);
CLUTTER_ACTOR_CLASS (e_mail_tab_picker_parent_class)->unmap (actor);
@@ -817,7 +829,7 @@ e_mail_tab_picker_class_init (EMailTabPickerClass *class)
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
- E_MAIL_TYPE_TAB);
+ E_TYPE_MAIL_TAB);
signals[CHOOSER_CLICKED] = g_signal_new (
"chooser-clicked",
@@ -831,9 +843,9 @@ e_mail_tab_picker_class_init (EMailTabPickerClass *class)
static void
e_mail_tab_picker_chooser_clicked_cb (ClutterActor *button,
- EMailTabPicker *self)
+ EMailTabPicker *picker)
{
- g_signal_emit (self, signals[CHOOSER_CLICKED], 0);
+ g_signal_emit (picker, signals[CHOOSER_CLICKED], 0);
}
static gboolean
@@ -841,8 +853,8 @@ e_mail_tab_picker_scroll_event_cb (ClutterActor *actor,
ClutterScrollEvent *event,
gpointer user_data)
{
- EMailTabPicker *self = E_MAIL_TAB_PICKER (actor);
- EMailTabPickerPrivate *priv = self->priv;
+ EMailTabPicker *picker = E_MAIL_TAB_PICKER (actor);
+ EMailTabPickerPrivate *priv = picker->priv;
priv->keep_current_visible = FALSE;
@@ -850,13 +862,13 @@ e_mail_tab_picker_scroll_event_cb (ClutterActor *actor,
case CLUTTER_SCROLL_UP :
case CLUTTER_SCROLL_LEFT :
e_mail_tab_picker_scroll_to (
- self, priv->scroll_end - 200, 150);
+ picker, priv->scroll_end - 200, 150);
break;
case CLUTTER_SCROLL_DOWN :
case CLUTTER_SCROLL_RIGHT :
e_mail_tab_picker_scroll_to (
- self, priv->scroll_end + 200, 150);
+ picker, priv->scroll_end + 200, 150);
break;
}
@@ -879,45 +891,48 @@ e_mail_tab_picker_scroll_value_cb (MxAdjustment *adjustment,
}
static void
-e_mail_tab_picker_init (EMailTabPicker *self)
+e_mail_tab_picker_init (EMailTabPicker *picker)
{
- EMailTabPickerPrivate *priv;
-
- priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- self, E_MAIL_TYPE_TAB_PICKER, EMailTabPickerPrivate);
+ picker->priv = E_MAIL_TAB_PICKER_GET_PRIVATE (picker);
- clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
+ clutter_actor_set_reactive (CLUTTER_ACTOR (picker), TRUE);
- priv->chooser_button = mx_button_new ();
+ picker->priv->chooser_button = mx_button_new ();
clutter_actor_set_name (
- CLUTTER_ACTOR (priv->chooser_button), "chooser-button");
+ CLUTTER_ACTOR (picker->priv->chooser_button),
+ "chooser-button");
clutter_actor_set_parent (
- CLUTTER_ACTOR (priv->chooser_button), CLUTTER_ACTOR (self));
+ CLUTTER_ACTOR (picker->priv->chooser_button),
+ CLUTTER_ACTOR (picker));
- priv->close_button = mx_button_new ();
+ picker->priv->close_button = mx_button_new ();
clutter_actor_set_name (
- CLUTTER_ACTOR (priv->close_button), "chooser-close-button");
+ CLUTTER_ACTOR (picker->priv->close_button),
+ "chooser-close-button");
clutter_actor_set_parent (
- CLUTTER_ACTOR (priv->close_button), CLUTTER_ACTOR (self));
- clutter_actor_hide (CLUTTER_ACTOR (priv->close_button));
+ CLUTTER_ACTOR (picker->priv->close_button),
+ CLUTTER_ACTOR (picker));
+ clutter_actor_hide (CLUTTER_ACTOR (picker->priv->close_button));
- priv->scroll_adjustment =
+ picker->priv->scroll_adjustment =
mx_adjustment_new_with_values (0, 0, 0, 100, 200, 200);
- priv->scroll_bar =
- mx_scroll_bar_new_with_adjustment (priv->scroll_adjustment);
- g_object_unref (priv->scroll_adjustment);
+ picker->priv->scroll_bar =
+ mx_scroll_bar_new_with_adjustment (
+ picker->priv->scroll_adjustment);
+ g_object_unref (picker->priv->scroll_adjustment);
clutter_actor_set_parent (
- CLUTTER_ACTOR (priv->scroll_bar), CLUTTER_ACTOR (self));
- clutter_actor_hide (CLUTTER_ACTOR (priv->scroll_bar));
+ CLUTTER_ACTOR (picker->priv->scroll_bar),
+ CLUTTER_ACTOR (picker));
+ clutter_actor_hide (CLUTTER_ACTOR (picker->priv->scroll_bar));
g_signal_connect (
- priv->chooser_button, "clicked",
- G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), self);
+ picker->priv->chooser_button, "clicked",
+ G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), picker);
g_signal_connect (
- priv->close_button, "clicked",
- G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), self);
+ picker->priv->close_button, "clicked",
+ G_CALLBACK (e_mail_tab_picker_chooser_clicked_cb), picker);
g_signal_connect (
- self, "scroll-event",
+ picker, "scroll-event",
G_CALLBACK (e_mail_tab_picker_scroll_event_cb), NULL);
}
@@ -933,9 +948,9 @@ e_mail_tab_picker_find_tab_cb (gconstpointer a,
static void
e_mail_tab_picker_tab_clicked_cb (EMailTab *tab,
- EMailTabPicker *self)
+ EMailTabPicker *picker)
{
- EMailTabPickerPrivate *priv = self->priv;
+ EMailTabPickerPrivate *priv = picker->priv;
EMailTab *old_tab;
GList *new_tab_link;
@@ -953,7 +968,7 @@ e_mail_tab_picker_tab_clicked_cb (EMailTab *tab,
if (tab == old_tab) {
e_mail_tab_set_active (tab, TRUE);
if (priv->preview_mode)
- g_signal_emit (self, signals[TAB_ACTIVATED], 0, tab);
+ g_signal_emit (picker, signals[TAB_ACTIVATED], 0, tab);
return;
}
@@ -962,13 +977,13 @@ e_mail_tab_picker_tab_clicked_cb (EMailTab *tab,
/* Set new tab */
priv->current_tab = g_list_position (priv->tabs, new_tab_link);
- g_signal_emit (self, signals[TAB_ACTIVATED], 0, tab);
+ g_signal_emit (picker, signals[TAB_ACTIVATED], 0, tab);
}
ClutterActor *
e_mail_tab_picker_new (void)
{
- return g_object_new (E_MAIL_TYPE_TAB_PICKER, NULL);
+ return g_object_new (E_TYPE_MAIL_TAB_PICKER, NULL);
}
static void
diff --git a/mail/e-mail-tab-picker.h b/mail/e-mail-tab-picker.h
index 5d6ae61182..56a9b4ac43 100644
--- a/mail/e-mail-tab-picker.h
+++ b/mail/e-mail-tab-picker.h
@@ -16,95 +16,90 @@
* Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef _E_MAIL_TAB_PICKER_H
-#define _E_MAIL_TAB_PICKER_H
+#ifndef E_MAIL_TAB_PICKER_H
+#define E_MAIL_TAB_PICKER_H
#include <clutter/clutter.h>
#include <mx/mx.h>
#include "e-mail-tab.h"
-G_BEGIN_DECLS
-
-#define E_MAIL_TYPE_TAB_PICKER e_mail_tab_picker_get_type()
-
+/* Standard GObject macros */
+#define E_TYPE_MAIL_TAB_PICKER \
+ (e_mail_tab_picker_get_type ())
#define E_MAIL_TAB_PICKER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- E_MAIL_TYPE_TAB_PICKER, EMailTabPicker))
-
-#define E_MAIL_TAB_PICKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- E_MAIL_TYPE_TAB_PICKER, EMailTabPickerClass))
-
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_TAB_PICKER, EMailTabPicker))
+#define E_MAIL_TAB_PICKER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_TAB_PICKER, EMailTabPickerClass))
#define E_MAIL_IS_TAB_PICKER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- E_MAIL_TYPE_TAB_PICKER))
-
-#define E_MAIL_IS_TAB_PICKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- E_MAIL_TYPE_TAB_PICKER))
-
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_TAB_PICKER))
+#define E_MAIL_IS_TAB_PICKER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_TAB_PICKER))
#define E_MAIL_TAB_PICKER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- E_MAIL_TYPE_TAB_PICKER, EMailTabPickerClass))
-
-typedef struct _EMailTabPickerPrivate EMailTabPickerPrivate;
-
-typedef struct {
- MxWidget parent;
-
- EMailTabPickerPrivate *priv;
-} EMailTabPicker;
-
-typedef struct {
- MxWidgetClass parent_class;
-
- void (* tab_activated) (EMailTabPicker *picker, EMailTab *tab);
- void (* chooser_clicked) (EMailTabPicker *picker);
-} EMailTabPickerClass;
-
-GType e_mail_tab_picker_get_type (void);
-
-ClutterActor *e_mail_tab_picker_new (void);
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_TAB_PICKER, EMailTabPickerClass))
-void e_mail_tab_picker_add_tab (EMailTabPicker *picker, EMailTab *tab, gint position);
-
-void e_mail_tab_picker_remove_tab (EMailTabPicker *picker, EMailTab *tab);
-
-GList *e_mail_tab_picker_get_tabs (EMailTabPicker *picker);
-
-gint e_mail_tab_picker_get_n_tabs (EMailTabPicker *picker);
-
-EMailTab *e_mail_tab_picker_get_tab (EMailTabPicker *picker, gint tab);
-
-gint e_mail_tab_picker_get_tab_no (EMailTabPicker *picker, EMailTab *tab);
-
-gint e_mail_tab_picker_get_current_tab (EMailTabPicker *picker);
-
-void e_mail_tab_picker_set_current_tab (EMailTabPicker *picker, gint tab);
-
-void e_mail_tab_picker_reorder (EMailTabPicker *picker,
- gint old_position,
- gint new_position);
-
-void e_mail_tab_picker_set_tab_width (EMailTabPicker *picker,
- gint width);
-
-gint e_mail_tab_picker_get_tab_width (EMailTabPicker *picker);
-
-void
-e_mail_tab_picker_get_preferred_height (EMailTabPicker *tab_picker,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p,
- gboolean with_previews);
-
-void e_mail_tab_picker_set_preview_mode (EMailTabPicker *picker, gboolean preview);
+G_BEGIN_DECLS
-gboolean e_mail_tab_picker_get_preview_mode (EMailTabPicker *picker);
+typedef struct _EMailTabPicker EMailTabPicker;
+typedef struct _EMailTabPickerClass EMailTabPickerClass;
+typedef struct _EMailTabPickerPrivate EMailTabPickerPrivate;
-void e_mail_tab_picker_enable_drop (EMailTabPicker *picker, gboolean enable);
+struct _EMailTabPicker {
+ MxWidget parent;
+ EMailTabPickerPrivate *priv;
+};
+
+struct _EMailTabPickerClass {
+ MxWidgetClass parent_class;
+
+ void (*tab_activated) (EMailTabPicker *picker,
+ EMailTab *tab);
+ void (*chooser_clicked) (EMailTabPicker *picker);
+};
+
+GType e_mail_tab_picker_get_type (void) G_GNUC_CONST;
+ClutterActor * e_mail_tab_picker_new (void);
+void e_mail_tab_picker_add_tab (EMailTabPicker *picker,
+ EMailTab *tab,
+ gint position);
+void e_mail_tab_picker_remove_tab (EMailTabPicker *picker,
+ EMailTab *tab);
+GList * e_mail_tab_picker_get_tabs (EMailTabPicker *picker);
+gint e_mail_tab_picker_get_n_tabs (EMailTabPicker *picker);
+EMailTab * e_mail_tab_picker_get_tab (EMailTabPicker *picker,
+ gint tab);
+gint e_mail_tab_picker_get_tab_no (EMailTabPicker *picker,
+ EMailTab *tab);
+gint e_mail_tab_picker_get_current_tab
+ (EMailTabPicker *picker);
+void e_mail_tab_picker_set_current_tab
+ (EMailTabPicker *picker,
+ gint tab);
+void e_mail_tab_picker_reorder (EMailTabPicker *picker,
+ gint old_position,
+ gint new_position);
+void e_mail_tab_picker_set_tab_width (EMailTabPicker *picker,
+ gint width);
+gint e_mail_tab_picker_get_tab_width (EMailTabPicker *picker);
+void e_mail_tab_picker_get_preferred_height
+ (EMailTabPicker *tab_picker,
+ gfloat for_width,
+ gfloat *min_height_p,
+ gfloat *natural_height_p,
+ gboolean with_previews);
+void e_mail_tab_picker_set_preview_mode
+ (EMailTabPicker *picker,
+ gboolean preview);
+gboolean e_mail_tab_picker_get_preview_mode
+ (EMailTabPicker *picker);
+void e_mail_tab_picker_enable_drop (EMailTabPicker *picker,
+ gboolean enable);
G_END_DECLS
-#endif /* _E_MAIL_TAB_PICKER_H */
+#endif /* E_MAIL_TAB_PICKER_H */
diff --git a/mail/e-mail-tab.c b/mail/e-mail-tab.c
index cb461c28f3..b50b14fe2b 100644
--- a/mail/e-mail-tab.c
+++ b/mail/e-mail-tab.c
@@ -25,6 +25,10 @@
#include <gtk/gtk.h>
#include "e-mail-tab.h"
+#define E_MAIL_TAB_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_TAB, EMailTabPrivate))
+
#define E_MAIL_PIXBOUND(u) ((gfloat)((gint)(u)))
static void mx_draggable_iface_init (MxDraggableIface *iface);
@@ -115,13 +119,13 @@ e_mail_tab_drag_begin (MxDraggable *draggable,
gint event_button,
ClutterModifierType modifiers)
{
- gfloat x, y;
-
- EMailTabPrivate *priv = E_MAIL_TAB (draggable)->priv;
+ EMailTabPrivate *priv;
ClutterActor *self = CLUTTER_ACTOR (draggable);
ClutterActor *actor = mx_draggable_get_drag_actor (draggable);
ClutterActor *stage = clutter_actor_get_stage (self);
+ gfloat x, y;
+ priv = E_MAIL_TAB_GET_PRIVATE (draggable);
priv->in_drag = TRUE;
clutter_actor_get_transformed_position (self, &x, &y);
@@ -489,8 +493,10 @@ e_mail_tab_get_preferred_width (ClutterActor *actor,
gfloat *min_width_p,
gfloat *natural_width_p)
{
+ EMailTabPrivate *priv;
MxPadding padding;
- EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv;
+
+ priv = E_MAIL_TAB_GET_PRIVATE (actor);
/* Get padding */
mx_widget_get_padding (MX_WIDGET (actor), &padding);
@@ -658,6 +664,7 @@ e_mail_tab_allocate (ClutterActor *actor,
const ClutterActorBox *box,
ClutterAllocationFlags flags)
{
+ EMailTabPrivate *priv;
MxPadding padding;
ClutterActorBox child_box;
gfloat icon_width, icon_height;
@@ -665,7 +672,7 @@ e_mail_tab_allocate (ClutterActor *actor,
gfloat close_width, close_height;
gfloat preview_width, preview_height;
- EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv;
+ priv = E_MAIL_TAB_GET_PRIVATE (actor);
/* Chain up to store box */
CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->allocate (actor, box, flags);
@@ -815,7 +822,9 @@ e_mail_tab_allocate (ClutterActor *actor,
static void
e_mail_tab_paint (ClutterActor *actor)
{
- EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv;
+ EMailTabPrivate *priv;
+
+ priv = E_MAIL_TAB_GET_PRIVATE (actor);
/* Chain up to paint background */
CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->paint (actor);
@@ -848,7 +857,9 @@ e_mail_tab_pick (ClutterActor *actor,
static void
e_mail_tab_map (ClutterActor *actor)
{
- EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv;
+ EMailTabPrivate *priv;
+
+ priv = E_MAIL_TAB_GET_PRIVATE (actor);
CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->map (actor);
@@ -866,7 +877,9 @@ e_mail_tab_map (ClutterActor *actor)
static void
e_mail_tab_unmap (ClutterActor *actor)
{
- EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv;
+ EMailTabPrivate *priv;
+
+ priv = E_MAIL_TAB_GET_PRIVATE (actor);
CLUTTER_ACTOR_CLASS (e_mail_tab_parent_class)->unmap (actor);
@@ -885,7 +898,9 @@ static gboolean
e_mail_tab_button_press_event (ClutterActor *actor,
ClutterButtonEvent *event)
{
- EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv;
+ EMailTabPrivate *priv;
+
+ priv = E_MAIL_TAB_GET_PRIVATE (actor);
if (event->button == 1) {
mx_stylable_set_style_pseudo_class (
@@ -956,7 +971,9 @@ static gboolean
e_mail_tab_enter_event (ClutterActor *actor,
ClutterCrossingEvent *event)
{
- EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv;
+ EMailTabPrivate *priv;
+
+ priv = E_MAIL_TAB_GET_PRIVATE (actor);
if (event->source != actor)
return FALSE;
@@ -977,7 +994,9 @@ static gboolean
e_mail_tab_leave_event (ClutterActor *actor,
ClutterCrossingEvent *event)
{
- EMailTabPrivate *priv = E_MAIL_TAB (actor)->priv;
+ EMailTabPrivate *priv;
+
+ priv = E_MAIL_TAB_GET_PRIVATE (actor);
if ((event->source != actor) ||
(event->related == (ClutterActor *) priv->close_button))
@@ -1216,7 +1235,9 @@ e_mail_tab_anim_completed_cb (ClutterAnimation *animation,
static void
e_mail_tab_style_changed_cb (MxWidget *widget)
{
- EMailTabPrivate *priv = E_MAIL_TAB (widget)->priv;
+ EMailTabPrivate *priv;
+
+ priv = E_MAIL_TAB_GET_PRIVATE (widget);
/* Don't transition on hover */
if (g_strcmp0 (mx_stylable_get_style_pseudo_class (
@@ -1284,61 +1305,59 @@ e_mail_tab_dnd_notify_cb (GObject *settings,
}
static void
-e_mail_tab_init (EMailTab *self)
+e_mail_tab_init (EMailTab *tab)
{
ClutterActor *text;
GtkSettings *settings;
- EMailTabPrivate *priv;
- priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- self, E_MAIL_TYPE_TAB, EMailTabPrivate);
+ tab->priv = E_MAIL_TAB_GET_PRIVATE (tab);
- priv->width = -1;
- priv->anim_length = 200;
- priv->spacing = 6.0;
- priv->can_close = TRUE;
+ tab->priv->width = -1;
+ tab->priv->anim_length = 200;
+ tab->priv->spacing = 6.0;
+ tab->priv->can_close = TRUE;
- priv->label = mx_label_new ();
- g_object_set (priv->label, "clip-to-allocation", TRUE, NULL);
- text = mx_label_get_clutter_text (MX_LABEL (priv->label));
+ tab->priv->label = mx_label_new ();
+ g_object_set (tab->priv->label, "clip-to-allocation", TRUE, NULL);
+ text = mx_label_get_clutter_text (MX_LABEL (tab->priv->label));
clutter_text_set_ellipsize (CLUTTER_TEXT (text), PANGO_ELLIPSIZE_END);
clutter_actor_set_parent (
- CLUTTER_ACTOR (priv->label), CLUTTER_ACTOR (self));
+ CLUTTER_ACTOR (tab->priv->label), CLUTTER_ACTOR (tab));
- priv->close_button = mx_button_new ();
+ tab->priv->close_button = mx_button_new ();
clutter_actor_set_name (
- CLUTTER_ACTOR (priv->close_button), "tab-close-button");
+ CLUTTER_ACTOR (tab->priv->close_button), "tab-close-button");
clutter_actor_set_parent (
- CLUTTER_ACTOR (priv->close_button), CLUTTER_ACTOR (self));
+ CLUTTER_ACTOR (tab->priv->close_button), CLUTTER_ACTOR (tab));
g_signal_connect (
- priv->close_button, "clicked",
- G_CALLBACK (e_mail_tab_close_clicked_cb), self);
+ tab->priv->close_button, "clicked",
+ G_CALLBACK (e_mail_tab_close_clicked_cb), tab);
/* Connect up styling signals */
g_signal_connect (
- self, "style-changed",
+ tab, "style-changed",
G_CALLBACK (e_mail_tab_style_changed_cb), NULL);
g_signal_connect (
- self, "stylable-changed",
+ tab, "stylable-changed",
G_CALLBACK (e_mail_tab_stylable_changed_cb), NULL);
- clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
+ clutter_actor_set_reactive (CLUTTER_ACTOR (tab), TRUE);
settings = gtk_settings_get_default ();
- priv->drag_threshold_handler = g_signal_connect (
+ tab->priv->drag_threshold_handler = g_signal_connect (
settings, "notify::gtk-dnd-drag-threshold",
- G_CALLBACK (e_mail_tab_dnd_notify_cb), self);
+ G_CALLBACK (e_mail_tab_dnd_notify_cb), tab);
g_object_get (
G_OBJECT (settings),
- "gtk-dnd-drag-threshold", &priv->drag_threshold,
+ "gtk-dnd-drag-threshold", &tab->priv->drag_threshold,
NULL);
}
ClutterActor *
e_mail_tab_new (void)
{
- return g_object_new (E_MAIL_TYPE_TAB, NULL);
+ return g_object_new (E_TYPE_MAIL_TAB, NULL);
}
ClutterActor *
@@ -1347,7 +1366,7 @@ e_mail_tab_new_full (const gchar *text,
gint width)
{
return g_object_new (
- E_MAIL_TYPE_TAB,
+ E_TYPE_MAIL_TAB,
"text", text,
"icon", icon,
"tab-width", width,
diff --git a/mail/e-mail-tab.h b/mail/e-mail-tab.h
index b8f9abf18e..5f3f8666b8 100644
--- a/mail/e-mail-tab.h
+++ b/mail/e-mail-tab.h
@@ -16,92 +16,100 @@
* Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef _E_MAIL_TAB_H
-#define _E_MAIL_TAB_H
+#ifndef E_MAIL_TAB_H
+#define E_MAIL_TAB_H
#include <clutter/clutter.h>
#include <mx/mx.h>
-G_BEGIN_DECLS
-
-#define E_MAIL_TYPE_TAB e_mail_tab_get_type()
-
+/* Standard GObject macros */
+#define E_TYPE_MAIL_TAB \
+ (e_mail_tab_get_type ())
#define E_MAIL_TAB(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- E_MAIL_TYPE_TAB, EMailTab))
-
-#define E_MAIL_TAB_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- E_MAIL_TYPE_TAB, EMailTabClass))
-
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_TAB, EMailTab))
+#define E_MAIL_TAB_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_TAB, EMailTabClass))
#define E_MAIL_IS_TAB(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- E_MAIL_TYPE_TAB))
-
-#define E_MAIL_IS_TAB_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- E_MAIL_TYPE_TAB))
-
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_TAB))
+#define E_MAIL_IS_TAB_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_TAB))
#define E_MAIL_TAB_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- E_MAIL_TYPE_TAB, EMailTabClass))
-
-typedef struct _EMailTabPrivate EMailTabPrivate;
+ (G_TYPE_INSTANCE_GET_CLASS ( \
+ (obj), E_TYPE_MAIL_TAB, EMailTabClass))
-typedef struct {
- MxWidget parent;
-
- EMailTabPrivate *priv;
-} EMailTab;
-
-typedef struct {
- MxWidgetClass parent_class;
-
- void (* clicked) (EMailTab *tab);
- void (* closed) (EMailTab *tab);
- void (* transition_complete) (EMailTab *tab);
-} EMailTabClass;
-
-GType e_mail_tab_get_type (void);
-
-ClutterActor *e_mail_tab_new (void);
-ClutterActor *e_mail_tab_new_full (const gchar *text,
- ClutterActor *icon,
- gint width);
-
-void e_mail_tab_set_text (EMailTab *tab, const gchar *text);
-void e_mail_tab_set_default_icon (EMailTab *tab, ClutterActor *icon);
-void e_mail_tab_set_icon (EMailTab *tab, ClutterActor *icon);
-void e_mail_tab_set_can_close (EMailTab *tab, gboolean can_close);
-void e_mail_tab_set_width (EMailTab *tab, gint width);
-void e_mail_tab_set_docking (EMailTab *tab, gboolean docking);
-void e_mail_tab_set_preview_actor (EMailTab *tab, ClutterActor *actor);
-void e_mail_tab_set_preview_mode (EMailTab *tab, gboolean preview);
-void e_mail_tab_set_preview_duration (EMailTab *tab, guint duration);
-void e_mail_tab_set_spacing (EMailTab *tab, gfloat spacing);
-void e_mail_tab_set_private (EMailTab *tab, gboolean private);
-void e_mail_tab_set_active (EMailTab *tab, gboolean active);
+G_BEGIN_DECLS
-const gchar *e_mail_tab_get_text (EMailTab *tab);
-ClutterActor *e_mail_tab_get_icon (EMailTab *tab);
-gboolean e_mail_tab_get_can_close (EMailTab *tab);
-gint e_mail_tab_get_width (EMailTab *tab);
-gboolean e_mail_tab_get_docking (EMailTab *tab);
-ClutterActor *e_mail_tab_get_preview_actor (EMailTab *tab);
-gboolean e_mail_tab_get_preview_mode (EMailTab *tab);
-void e_mail_tab_get_height_no_preview (EMailTab *tab,
- gfloat for_width,
- gfloat *min_height_p,
- gfloat *natural_height_p);
-guint e_mail_tab_get_preview_duration (EMailTab *tab);
-gfloat e_mail_tab_get_spacing (EMailTab *tab);
-gboolean e_mail_tab_get_private (EMailTab *tab);
-gboolean e_mail_tab_get_active (EMailTab *tab);
+typedef struct _EMailTab EMailTab;
+typedef struct _EMailTabClass EMailTabClass;
+typedef struct _EMailTabPrivate EMailTabPrivate;
-void e_mail_tab_alert (EMailTab *tab);
-void e_mail_tab_enable_drag (EMailTab *tab, gboolean enable);
+struct _EMailTab {
+ MxWidget parent;
+ EMailTabPrivate *priv;
+};
+
+struct _EMailTabClass {
+ MxWidgetClass parent_class;
+
+ void (*clicked) (EMailTab *tab);
+ void (*closed) (EMailTab *tab);
+ void (*transition_complete) (EMailTab *tab);
+};
+
+GType e_mail_tab_get_type (void) G_GNUC_CONST;
+ClutterActor * e_mail_tab_new (void);
+ClutterActor * e_mail_tab_new_full (const gchar *text,
+ ClutterActor *icon,
+ gint width);
+void e_mail_tab_set_text (EMailTab *tab,
+ const gchar *text);
+void e_mail_tab_set_default_icon (EMailTab *tab,
+ ClutterActor *icon);
+void e_mail_tab_set_icon (EMailTab *tab,
+ ClutterActor *icon);
+void e_mail_tab_set_can_close (EMailTab *tab,
+ gboolean can_close);
+void e_mail_tab_set_width (EMailTab *tab,
+ gint width);
+void e_mail_tab_set_docking (EMailTab *tab,
+ gboolean docking);
+void e_mail_tab_set_preview_actor (EMailTab *tab,
+ ClutterActor *actor);
+void e_mail_tab_set_preview_mode (EMailTab *tab,
+ gboolean preview);
+void e_mail_tab_set_preview_duration (EMailTab *tab,
+ guint duration);
+void e_mail_tab_set_spacing (EMailTab *tab,
+ gfloat spacing);
+void e_mail_tab_set_private (EMailTab *tab,
+ gboolean private_);
+void e_mail_tab_set_active (EMailTab *tab,
+ gboolean active);
+const gchar * e_mail_tab_get_text (EMailTab *tab);
+ClutterActor * e_mail_tab_get_icon (EMailTab *tab);
+gboolean e_mail_tab_get_can_close (EMailTab *tab);
+gint e_mail_tab_get_width (EMailTab *tab);
+gboolean e_mail_tab_get_docking (EMailTab *tab);
+ClutterActor * e_mail_tab_get_preview_actor (EMailTab *tab);
+gboolean e_mail_tab_get_preview_mode (EMailTab *tab);
+void e_mail_tab_get_height_no_preview
+ (EMailTab *tab,
+ gfloat for_width,
+ gfloat *min_height_p,
+ gfloat *natural_height_p);
+guint e_mail_tab_get_preview_duration (EMailTab *tab);
+gfloat e_mail_tab_get_spacing (EMailTab *tab);
+gboolean e_mail_tab_get_private (EMailTab *tab);
+gboolean e_mail_tab_get_active (EMailTab *tab);
+void e_mail_tab_alert (EMailTab *tab);
+void e_mail_tab_enable_drag (EMailTab *tab,
+ gboolean enable);
G_END_DECLS
-#endif /* _E_MAIL_TAB_H */
+#endif /* E_MAIL_TAB_H */
diff --git a/mail/e-mail-tag-editor.c b/mail/e-mail-tag-editor.c
index d1ef428bc3..57db55a5db 100644
--- a/mail/e-mail-tag-editor.c
+++ b/mail/e-mail-tag-editor.c
@@ -33,6 +33,10 @@
#include "e-util/e-util.h"
#include "widgets/misc/e-dateedit.h"
+#define E_MAIL_TAG_EDITOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_TAG_EDITOR, EMailTagEditorPrivate))
+
#define DEFAULT_FLAG 2 /* "Follow-Up" */
struct _EMailTagEditorPrivate {
@@ -60,7 +64,7 @@ enum {
COLUMN_SUBJECT
};
-static gpointer parent_class;
+G_DEFINE_TYPE (EMailTagEditor, e_mail_tag_editor, GTK_TYPE_DIALOG)
static void
mail_tag_editor_clear_clicked_cb (EMailTagEditor *editor)
@@ -138,7 +142,7 @@ mail_tag_editor_realize (GtkWidget *widget)
GtkWidget *content_area;
/* Chain up to parent's realize() method. */
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
+ GTK_WIDGET_CLASS (e_mail_tag_editor_parent_class)->realize (widget);
/* XXX Override GTK's brain-dead border width defaults. */
@@ -219,12 +223,11 @@ mail_tag_editor_set_tag_list (EMailTagEditor *editor,
}
static void
-mail_tag_editor_class_init (EMailTagEditorClass *class)
+e_mail_tag_editor_class_init (EMailTagEditorClass *class)
{
GObjectClass *object_class;
GtkWidgetClass *widget_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMailTagEditorPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -271,7 +274,7 @@ mail_tag_editor_class_init (EMailTagEditorClass *class)
}
static void
-mail_tag_editor_init (EMailTagEditor *editor)
+e_mail_tag_editor_init (EMailTagEditor *editor)
{
GtkBuilder *builder;
GtkDialog *dialog;
@@ -281,8 +284,7 @@ mail_tag_editor_init (EMailTagEditor *editor)
GtkCellRenderer *renderer;
GtkListStore *store;
- editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- editor, E_TYPE_MAIL_TAG_EDITOR, EMailTagEditorPrivate);
+ editor->priv = E_MAIL_TAG_EDITOR_GET_PRIVATE (editor);
dialog = GTK_DIALOG (editor);
window = GTK_WINDOW (editor);
@@ -360,32 +362,6 @@ mail_tag_editor_init (EMailTagEditor *editor)
g_object_unref (builder);
}
-GType
-e_mail_tag_editor_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMailTagEditorClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) mail_tag_editor_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMailTagEditor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) mail_tag_editor_init,
- NULL /* valute_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_DIALOG, "EMailTagEditor", &type_info, 0);
- }
-
- return type;
-}
-
GtkWidget *
e_mail_tag_editor_new (void)
{
diff --git a/mail/e-mail-view.c b/mail/e-mail-view.c
index 90c74d7299..72884dcc4b 100644
--- a/mail/e-mail-view.c
+++ b/mail/e-mail-view.c
@@ -28,6 +28,10 @@
#include <glib/gi18n-lib.h>
+#define E_MAIL_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_VIEW, EMailViewPrivate))
+
struct _EMailViewPrivate {
EShellView *shell_view;
GtkOrientation orientation;
@@ -154,7 +158,7 @@ mail_view_dispose (GObject *object)
{
EMailViewPrivate *priv;
- priv = E_MAIL_VIEW (object)->priv;
+ priv = E_MAIL_VIEW_GET_PRIVATE (object);
if (priv->shell_view != NULL) {
g_object_unref (priv->shell_view);
@@ -319,8 +323,7 @@ e_mail_view_class_init (EMailViewClass *class)
static void
e_mail_view_init (EMailView *view)
{
- view->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- view, E_TYPE_MAIL_VIEW, EMailViewPrivate);
+ view->priv = E_MAIL_VIEW_GET_PRIVATE (view);
}
EShellView *
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 6331044b16..cca18a8310 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -75,6 +75,10 @@
#include "smime/gui/e-cert-selector.h"
#endif
+#define EM_ACCOUNT_EDITOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_ACCOUNT_EDITOR, EMAccountEditorPrivate))
+
/* Option widgets whose sensitivity depends on another widget, such
* as a checkbox being active, are indented to the right slightly for
* better visual clarity. This specifies how far to the right. */
@@ -262,7 +266,7 @@ enum {
static void em_account_editor_construct (EMAccountEditor *emae, EMAccountEditorType type, const gchar *id);
static void emae_account_folder_changed (EMFolderSelectionButton *folder, EMAccountEditor *emae);
-static gpointer parent_class;
+G_DEFINE_TYPE (EMAccountEditor, em_account_editor, G_TYPE_OBJECT)
static void
emae_config_target_changed_cb (EMAccountEditor *emae)
@@ -843,7 +847,7 @@ emae_dispose (GObject *object)
{
EMAccountEditorPrivate *priv;
- priv = EM_ACCOUNT_EDITOR (object)->priv;
+ priv = EM_ACCOUNT_EDITOR_GET_PRIVATE (object);
if (priv->backend != NULL) {
g_object_unref (priv->backend);
@@ -880,7 +884,7 @@ emae_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (em_account_editor_parent_class)->dispose (object);
}
static void
@@ -901,15 +905,14 @@ emae_finalize (GObject *object)
g_list_free (priv->providers);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (em_account_editor_parent_class)->finalize (object);
}
static void
-emae_class_init (GObjectClass *class)
+em_account_editor_class_init (EMAccountEditorClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMAccountEditorPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -1141,10 +1144,9 @@ emae_class_init (GObjectClass *class)
}
static void
-emae_init (EMAccountEditor *emae)
+em_account_editor_init (EMAccountEditor *emae)
{
- emae->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- emae, EM_TYPE_ACCOUNT_EDITOR, EMAccountEditorPrivate);
+ emae->priv = EM_ACCOUNT_EDITOR_GET_PRIVATE (emae);
emae->priv->selected_server = NULL;
emae->priv->source.emae = emae;
@@ -1159,32 +1161,6 @@ emae_init (EMAccountEditor *emae)
emae->priv->is_yahoo = FALSE;
}
-GType
-em_account_editor_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMAccountEditorClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) emae_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMAccountEditor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) emae_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EMAccountEditor", &type_info, 0);
- }
-
- return type;
-}
-
/**
* em_account_editor_new:
* @account:
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index e571e84f60..2897b37ef6 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1849,269 +1849,6 @@ em_utils_redirect_message (EShell *shell,
composer_set_no_change (composer);
}
-/* Message disposition notifications, rfc 2298 */
-void
-em_utils_handle_receipt (EMailBackend *backend,
- CamelFolder *folder,
- const gchar *message_uid,
- CamelMimeMessage *message)
-{
- EAccount *account;
- const gchar *addr;
- CamelMessageInfo *info;
-
- g_return_if_fail (E_IS_MAIL_BACKEND (backend));
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
-
- info = camel_folder_get_message_info (folder, message_uid);
- if (info == NULL)
- return;
-
- if (camel_message_info_user_flag (info, "receipt-handled")) {
- camel_folder_free_message_info (folder, info);
- return;
- }
-
- addr = camel_medium_get_header (
- CAMEL_MEDIUM (message), "Disposition-Notification-To");
- if (addr == NULL) {
- camel_folder_free_message_info (folder, info);
- return;
- }
-
- camel_message_info_set_user_flag (info, "receipt-handled", TRUE);
- camel_folder_free_message_info (folder, info);
-
- account = em_utils_guess_account_with_recipients (message, folder);
-
- /* TODO Should probably decode/format the address,
- * since it could be in rfc2047 format. */
- if (addr == NULL) {
- addr = "";
- } else {
- while (camel_mime_is_lwsp (*addr))
- addr++;
- }
-
- if (account == NULL)
- return;
-
- if (account->receipt_policy == E_ACCOUNT_RECEIPT_NEVER)
- return;
-
- if (account->receipt_policy == E_ACCOUNT_RECEIPT_ASK) {
- GtkWindow *window;
- const gchar *subject;
- gint response;
-
- /* FIXME Parent window should be passed in. */
- window = e_shell_get_active_window (NULL);
- subject = camel_mime_message_get_subject (message);
-
- response = e_alert_run_dialog_for_args (
- window, "mail:ask-receipt", addr, subject, NULL);
-
- if (response != GTK_RESPONSE_YES)
- return;
- }
-
- em_utils_send_receipt (backend, folder, message);
-}
-
-static void
-em_utils_receipt_done (CamelFolder *folder,
- GAsyncResult *result,
- EMailBackend *backend)
-{
- /* FIXME Poor error handling. */
- if (!e_mail_folder_append_message_finish (folder, result, NULL, NULL))
- return;
-
- mail_send (backend);
-}
-
-void
-em_utils_send_receipt (EMailBackend *backend,
- CamelFolder *folder,
- CamelMimeMessage *message)
-{
- /* See RFC #3798 for a description of message receipts */
- EAccount *account = em_utils_guess_account_with_recipients (message, folder);
- CamelMimeMessage *receipt = camel_mime_message_new ();
- CamelMultipart *body = camel_multipart_new ();
- CamelMimePart *part;
- CamelDataWrapper *receipt_text, *receipt_data;
- CamelContentType *type;
- CamelInternetAddress *addr;
- CamelStream *stream;
- CamelFolder *out_folder;
- CamelMessageInfo *info;
- const gchar *message_id;
- const gchar *message_date;
- const gchar *message_subject;
- const gchar *receipt_address;
- gchar *fake_msgid;
- gchar *hostname;
- gchar *self_address, *receipt_subject;
- gchar *ua, *recipient;
- gchar *transport_uid;
- gchar *content;
-
- message_id = camel_medium_get_header (
- CAMEL_MEDIUM (message), "Message-ID");
- message_date = camel_medium_get_header (
- CAMEL_MEDIUM (message), "Date");
- message_subject = camel_mime_message_get_subject (message);
- receipt_address = camel_medium_get_header (
- CAMEL_MEDIUM (message), "Disposition-Notification-To");
-
- if (!receipt_address)
- return;
-
- /* the 'account' should be always set */
- g_return_if_fail (account != NULL);
-
- /* Collect information for the receipt */
-
- /* We use camel_header_msgid_generate () to get a canonical
- * hostname, then skip the part leading to '@' */
- hostname = strchr ((fake_msgid = camel_header_msgid_generate ()), '@');
- hostname++;
-
- self_address = account->id->address;
-
- if (!message_id)
- message_id = "";
- if (!message_date)
- message_date ="";
-
- /* Create toplevel container */
- camel_data_wrapper_set_mime_type (
- CAMEL_DATA_WRAPPER (body),
- "multipart/report;"
- "report-type=\"disposition-notification\"");
- camel_multipart_set_boundary (body, NULL);
-
- /* Create textual receipt */
- receipt_text = camel_data_wrapper_new ();
- type = camel_content_type_new ("text", "plain");
- camel_content_type_set_param (type, "format", "flowed");
- camel_content_type_set_param (type, "charset", "UTF-8");
- camel_data_wrapper_set_mime_type_field (receipt_text, type);
- camel_content_type_unref (type);
- content = g_strdup_printf (
- /* Translators: First %s is an email address, second %s
- * is the subject of the email, third %s is the date. */
- _("Your message to %s about \"%s\" on %s has been read."),
- self_address, message_subject, message_date);
- stream = camel_stream_mem_new ();
- camel_stream_write_string (stream, content, NULL, NULL);
- camel_data_wrapper_construct_from_stream_sync (
- receipt_text, stream, NULL, NULL);
- g_object_unref (stream);
- g_free (content);
-
- part = camel_mime_part_new ();
- camel_medium_set_content (CAMEL_MEDIUM (part), receipt_text);
- camel_mime_part_set_encoding (
- part, CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE);
- g_object_unref (receipt_text);
- camel_multipart_add_part (body, part);
- g_object_unref (part);
-
- /* Create the machine-readable receipt */
- receipt_data = camel_data_wrapper_new ();
- part = camel_mime_part_new ();
-
- ua = g_strdup_printf (
- "%s; %s", hostname, "Evolution "
- VERSION SUB_VERSION " " VERSION_COMMENT);
- recipient = g_strdup_printf ("rfc822; %s", self_address);
-
- type = camel_content_type_new ("message", "disposition-notification");
- camel_data_wrapper_set_mime_type_field (receipt_data, type);
- camel_content_type_unref (type);
-
- content = g_strdup_printf (
- "Reporting-UA: %s\n"
- "Final-Recipient: %s\n"
- "Original-Message-ID: %s\n"
- "Disposition: manual-action/MDN-sent-manually; displayed\n",
- ua, recipient, message_id);
- stream = camel_stream_mem_new ();
- camel_stream_write_string (stream, content, NULL, NULL);
- camel_data_wrapper_construct_from_stream_sync (
- receipt_data, stream, NULL, NULL);
- g_object_unref (stream);
- g_free (content);
-
- g_free (ua);
- g_free (recipient);
- g_free (fake_msgid);
-
- camel_medium_set_content (CAMEL_MEDIUM (part), receipt_data);
- camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_7BIT);
- g_object_unref (receipt_data);
- camel_multipart_add_part (body, part);
- g_object_unref (part);
-
- /* Finish creating the message */
- camel_medium_set_content (
- CAMEL_MEDIUM (receipt), CAMEL_DATA_WRAPPER (body));
- g_object_unref (body);
-
- /* Translators: %s is the subject of the email message */
- receipt_subject = g_strdup_printf (
- _("Delivery Notification for: \"%s\""), message_subject);
- camel_mime_message_set_subject (receipt, receipt_subject);
- g_free (receipt_subject);
-
- addr = camel_internet_address_new ();
- camel_address_decode (CAMEL_ADDRESS (addr), self_address);
- camel_mime_message_set_from (receipt, addr);
- g_object_unref (addr);
-
- addr = camel_internet_address_new ();
- camel_address_decode (CAMEL_ADDRESS (addr), receipt_address);
- camel_mime_message_set_recipients (
- receipt, CAMEL_RECIPIENT_TYPE_TO, addr);
- g_object_unref (addr);
-
- transport_uid = g_strconcat (account->uid, "-transport", NULL);
-
- camel_medium_set_header (
- CAMEL_MEDIUM (receipt),
- "Return-Path", "<>");
- camel_medium_set_header (
- CAMEL_MEDIUM (receipt),
- "X-Evolution-Account",
- account->uid);
- camel_medium_set_header (
- CAMEL_MEDIUM (receipt),
- "X-Evolution-Transport",
- transport_uid);
- camel_medium_set_header (
- CAMEL_MEDIUM (receipt),
- "X-Evolution-Fcc",
- account->sent_folder_uri);
-
- g_free (transport_uid);
-
- /* Send the receipt */
- info = camel_message_info_new (NULL);
- out_folder = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX);
- camel_message_info_set_flags (
- info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
-
- /* FIXME Pass a GCancellable. */
- e_mail_folder_append_message (
- out_folder, receipt, info, G_PRIORITY_DEFAULT, NULL,
- (GAsyncReadyCallback) em_utils_receipt_done, backend);
-
- camel_message_info_free (info);
-}
-
/* Replying to messages... */
EDestination **
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index bd6eb7cffd..215e6bb2bc 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -58,13 +58,6 @@ void em_utils_forward_messages (EMailReader *reader,
GtkWidget *destroy_when_done);
void em_utils_redirect_message (EShell *shell,
CamelMimeMessage *message);
-void em_utils_handle_receipt (EMailBackend *backend,
- CamelFolder *folder,
- const gchar *message_uid,
- CamelMimeMessage *message);
-void em_utils_send_receipt (EMailBackend *backend,
- CamelFolder *folder,
- CamelMimeMessage *message);
gchar * em_utils_construct_composer_text
(CamelMimeMessage *message,
EMFormat *source_formatter);
diff --git a/mail/em-config.c b/mail/em-config.c
index e9c1105c85..6a133f1c56 100644
--- a/mail/em-config.c
+++ b/mail/em-config.c
@@ -138,7 +138,7 @@ em_config_new (gint type,
{
EMConfig *emp;
- emp = g_object_new (em_config_get_type (), NULL);
+ emp = g_object_new (EM_TYPE_CONFIG, NULL);
e_config_construct (&emp->config, type, menuid);
return emp;
diff --git a/mail/em-config.h b/mail/em-config.h
index 24a75fb511..a90ecf3262 100644
--- a/mail/em-config.h
+++ b/mail/em-config.h
@@ -29,6 +29,25 @@
#include "e-util/e-config.h"
+/* Standard GObject macros */
+#define EM_TYPE_CONFIG \
+ (em_config_get_type ())
+#define EM_CONFIG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_CONFIG, EMConfig))
+#define EM_CONFIG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_CONFIG, EMConfigClass))
+#define EM_IS_CONFIG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_CONFIG))
+#define EM_IS_CONFIG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_CONFIG, EMConfigClass))
+#define EM_CONFIG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_CONFIG, EMConfigClass))
+
G_BEGIN_DECLS
typedef struct _EMConfig EMConfig;
diff --git a/mail/em-event.c b/mail/em-event.c
index 7a99618727..a89069f360 100644
--- a/mail/em-event.c
+++ b/mail/em-event.c
@@ -98,7 +98,7 @@ EMEvent *
em_event_peek (void)
{
if (em_event == NULL) {
- em_event = g_object_new (em_event_get_type (), NULL);
+ em_event = g_object_new (EM_TYPE_EVENT, NULL);
e_event_construct (
&em_event->popup,
"org.gnome.evolution.mail.events");
diff --git a/mail/em-event.h b/mail/em-event.h
index 3fc5ac0fc3..d48341a0b8 100644
--- a/mail/em-event.h
+++ b/mail/em-event.h
@@ -27,6 +27,25 @@
#include "e-util/e-event.h"
#include "composer/e-msg-composer.h"
+/* Standard GObject macros */
+#define EM_TYPE_EVENT \
+ (em_event_get_type ())
+#define EM_EVENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), EM_TYPE_EVENT, EMEvent))
+#define EM_EVENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), EM_TYPE_EVENT, EMEventClass))
+#define EM_IS_EVENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), EM_TYPE_EVENT))
+#define EM_IS_EVENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), EM_TYPE_EVENT))
+#define EM_EVENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), EM_TYPE_EVENT, EMEventClass))
+
G_BEGIN_DECLS
typedef struct _EMEvent EMEvent;
diff --git a/mail/em-filter-context.c b/mail/em-filter-context.c
index 2885a4c20a..085c32dbd0 100644
--- a/mail/em-filter-context.c
+++ b/mail/em-filter-context.c
@@ -36,6 +36,10 @@
/* For poking into filter-folder guts */
#include "em-filter-folder-element.h"
+#define EM_FILTER_CONTEXT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_FILTER_CONTEXT, EMFilterContextPrivate))
+
struct _EMFilterContextPrivate {
EMailBackend *backend;
GList *actions;
@@ -101,7 +105,7 @@ filter_context_dispose (GObject *object)
{
EMFilterContextPrivate *priv;
- priv = EM_FILTER_CONTEXT (object)->priv;
+ priv = EM_FILTER_CONTEXT_GET_PRIVATE (object);
if (priv->backend != NULL) {
g_object_unref (priv->backend);
@@ -229,7 +233,7 @@ filter_context_new_element (ERuleContext *context,
{
EMFilterContextPrivate *priv;
- priv = EM_FILTER_CONTEXT (context)->priv;
+ priv = EM_FILTER_CONTEXT_GET_PRIVATE (context);
if (strcmp (type, "folder") == 0)
return em_filter_folder_element_new (priv->backend);
@@ -280,8 +284,7 @@ em_filter_context_class_init (EMFilterContextClass *class)
static void
em_filter_context_init (EMFilterContext *context)
{
- context->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- context, EM_TYPE_FILTER_CONTEXT, EMFilterContextPrivate);
+ context->priv = EM_FILTER_CONTEXT_GET_PRIVATE (context);
e_rule_context_add_part_set (
E_RULE_CONTEXT (context),
diff --git a/mail/em-filter-editor.c b/mail/em-filter-editor.c
index b92e202b96..06bb8d33c9 100644
--- a/mail/em-filter-editor.c
+++ b/mail/em-filter-editor.c
@@ -35,7 +35,7 @@
#include "em-filter-editor.h"
#include "em-filter-rule.h"
-static gpointer parent_class;
+G_DEFINE_TYPE (EMFilterEditor, em_filter_editor, E_TYPE_RULE_EDITOR)
static EFilterRule *
filter_editor_create_rule (ERuleEditor *rule_editor)
@@ -56,18 +56,16 @@ filter_editor_create_rule (ERuleEditor *rule_editor)
}
static void
-filter_editor_class_init (EMFilterEditorClass *class)
+em_filter_editor_class_init (EMFilterEditorClass *class)
{
ERuleEditorClass *rule_editor_class;
- parent_class = g_type_class_peek_parent (class);
-
rule_editor_class = E_RULE_EDITOR_CLASS (class);
rule_editor_class->create_rule = filter_editor_create_rule;
}
static void
-filter_editor_init (EMFilterEditor *filter_editor)
+em_filter_editor_init (EMFilterEditor *filter_editor)
{
GConfBridge *bridge;
const gchar *key_prefix;
@@ -79,32 +77,6 @@ filter_editor_init (EMFilterEditor *filter_editor)
bridge, key_prefix, GTK_WINDOW (filter_editor));
}
-GType
-em_filter_editor_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMFilterEditorClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) filter_editor_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMFilterEditor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) filter_editor_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_RULE_EDITOR, "EMFilterEditor", &type_info, 0);
- }
-
- return type;
-}
-
/**
* em_filter_editor_new:
*
diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c
index 6cd287b0ea..90e82e5744 100644
--- a/mail/em-filter-rule.c
+++ b/mail/em-filter-rule.c
@@ -40,83 +40,42 @@ static gint filter_eq (EFilterRule *fr, EFilterRule *cm);
static xmlNodePtr xml_encode (EFilterRule *fr);
static gint xml_decode (EFilterRule *fr, xmlNodePtr, ERuleContext *rc);
static void rule_copy (EFilterRule *dest, EFilterRule *src);
-/*static void build_code(EFilterRule *, GString *out);*/
static GtkWidget *get_widget (EFilterRule *fr, ERuleContext *rc);
-static void em_filter_rule_class_init (EMFilterRuleClass *klass);
-static void em_filter_rule_init (EMFilterRule *ff);
-static void em_filter_rule_finalize (GObject *obj);
+G_DEFINE_TYPE (EMFilterRule, em_filter_rule, E_TYPE_FILTER_RULE)
-static EFilterRuleClass *parent_class = NULL;
-
-GType
-em_filter_rule_get_type (void)
+static void
+em_filter_rule_finalize (GObject *object)
{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMFilterRuleClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) em_filter_rule_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMFilterRule),
- 0, /* n_preallocs */
- (GInstanceInitFunc) em_filter_rule_init,
- };
-
- type = g_type_register_static(E_TYPE_FILTER_RULE, "EMFilterRule", &info, 0);
- }
+ EMFilterRule *ff =(EMFilterRule *) object;
- return type;
+ g_list_free_full (ff->actions, (GDestroyNotify) g_object_unref);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (em_filter_rule_parent_class)->finalize (object);
}
static void
-em_filter_rule_class_init (EMFilterRuleClass *klass)
+em_filter_rule_class_init (EMFilterRuleClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- EFilterRuleClass *fr_class =(EFilterRuleClass *) klass;
-
- parent_class = g_type_class_ref (E_TYPE_FILTER_RULE);
+ GObjectClass *object_class;
+ EFilterRuleClass *filter_rule_class;
+ object_class = G_OBJECT_CLASS (class);
object_class->finalize = em_filter_rule_finalize;
- /* override methods */
- fr_class->validate = validate;
- fr_class->eq = filter_eq;
- fr_class->xml_encode = xml_encode;
- fr_class->xml_decode = xml_decode;
- /*fr_class->build_code = build_code;*/
- fr_class->copy = rule_copy;
- fr_class->get_widget = get_widget;
+ filter_rule_class = E_FILTER_RULE_CLASS (class);
+ filter_rule_class->validate = validate;
+ filter_rule_class->eq = filter_eq;
+ filter_rule_class->xml_encode = xml_encode;
+ filter_rule_class->xml_decode = xml_decode;
+ filter_rule_class->copy = rule_copy;
+ filter_rule_class->get_widget = get_widget;
}
static void
em_filter_rule_init (EMFilterRule *ff)
{
- ;
-}
-
-static void
-unref_list (GList *l)
-{
- while (l) {
- g_object_unref (l->data);
- l = l->next;
- }
-}
-
-static void
-em_filter_rule_finalize (GObject *obj)
-{
- EMFilterRule *ff =(EMFilterRule *) obj;
-
- unref_list (ff->actions);
- g_list_free (ff->actions);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
}
/**
@@ -184,7 +143,8 @@ validate (EFilterRule *fr,
GList *parts;
gint valid;
- valid = E_FILTER_RULE_CLASS (parent_class)->validate (fr, alert);
+ valid = E_FILTER_RULE_CLASS (em_filter_rule_parent_class)->
+ validate (fr, alert);
/* validate rule actions */
parts = ff->actions;
@@ -217,8 +177,10 @@ static gint
filter_eq (EFilterRule *fr,
EFilterRule *cm)
{
- return E_FILTER_RULE_CLASS (parent_class)->eq (fr, cm)
- && list_eq (((EMFilterRule *) fr)->actions,((EMFilterRule *) cm)->actions);
+ return E_FILTER_RULE_CLASS (em_filter_rule_parent_class)->eq (fr, cm)
+ && list_eq (
+ ((EMFilterRule *) fr)->actions,
+ ((EMFilterRule *) cm)->actions);
}
static xmlNodePtr
@@ -228,7 +190,8 @@ xml_encode (EFilterRule *fr)
xmlNodePtr node, set, work;
GList *l;
- node = E_FILTER_RULE_CLASS (parent_class)->xml_encode (fr);
+ node = E_FILTER_RULE_CLASS (em_filter_rule_parent_class)->
+ xml_encode (fr);
g_return_val_if_fail (node != NULL, NULL);
set = xmlNewNode(NULL, (const guchar *)"actionset");
xmlAddChild (node, set);
@@ -281,7 +244,8 @@ xml_decode (EFilterRule *fr,
xmlNodePtr work;
gint result;
- result = E_FILTER_RULE_CLASS (parent_class)->xml_decode (fr, node, rc);
+ result = E_FILTER_RULE_CLASS (em_filter_rule_parent_class)->
+ xml_decode (fr, node, rc);
if (result != 0)
return result;
@@ -321,14 +285,9 @@ rule_copy (EFilterRule *dest,
node = node->next;
}
- E_FILTER_RULE_CLASS (parent_class)->copy (dest, src);
+ E_FILTER_RULE_CLASS (em_filter_rule_parent_class)->copy (dest, src);
}
-/*static void build_code(EFilterRule *fr, GString *out)
-{
- return FILTER_RULE_CLASS (parent_class)->build_code (fr, out);
-}*/
-
struct _part_data {
EFilterRule *fr;
EMFilterContext *f;
@@ -555,7 +514,8 @@ get_widget (EFilterRule *fr,
gint rows, i = 0;
gchar *msg;
- widget = E_FILTER_RULE_CLASS (parent_class)->get_widget (fr, rc);
+ widget = E_FILTER_RULE_CLASS (em_filter_rule_parent_class)->
+ get_widget (fr, rc);
/* and now for the action area */
msg = g_strdup_printf("<b>%s</b>", _("Then"));
diff --git a/mail/em-folder-selection-button.c b/mail/em-folder-selection-button.c
index 9aa198fa8e..1b8ef6cd71 100644
--- a/mail/em-folder-selection-button.c
+++ b/mail/em-folder-selection-button.c
@@ -262,7 +262,7 @@ folder_selection_button_clicked (GtkButton *button)
GtkTreeSelection *selection;
gpointer parent;
- priv = EM_FOLDER_SELECTION_BUTTON (button)->priv;
+ priv = EM_FOLDER_SELECTION_BUTTON_GET_PRIVATE (button);
parent = gtk_widget_get_toplevel (GTK_WIDGET (button));
parent = gtk_widget_is_toplevel (parent) ? parent : NULL;
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 79e9a04288..59f936d9d8 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -437,7 +437,7 @@ folder_tree_select_func (GtkTreeSelection *selection,
tree_view = gtk_tree_selection_get_tree_view (selection);
- priv = EM_FOLDER_TREE (tree_view)->priv;
+ priv = EM_FOLDER_TREE_GET_PRIVATE (tree_view);
if (selected)
return TRUE;
diff --git a/mail/em-format-hook.c b/mail/em-format-hook.c
index 51608ca07d..7777914577 100644
--- a/mail/em-format-hook.c
+++ b/mail/em-format-hook.c
@@ -31,7 +31,7 @@
#include <glib/gi18n.h>
-/* class name -> klass map for EMFormat and subclasses */
+/* class name -> class map for EMFormat and subclasses */
static GHashTable *emfh_types;
/* ********************************************************************** */
@@ -48,7 +48,6 @@ static GHashTable *emfh_types;
* </hook>
*/
-static gpointer emfh_parent_class;
#define emfh ((EMFormatHook *)eph)
#define d(x)
@@ -59,6 +58,8 @@ static const EPluginHookTargetKey emfh_flag_map[] = {
{ NULL }
};
+G_DEFINE_TYPE (EMFormatHook, em_format_hook, E_TYPE_PLUGIN_HOOK)
+
static void
emfh_format_format (EMFormat *md,
CamelStream *stream,
@@ -171,7 +172,7 @@ emfh_construct (EPluginHook *eph,
d(printf("loading format hook\n"));
- if (((EPluginHookClass *) emfh_parent_class)->construct (eph, ep, root) == -1)
+ if (((EPluginHookClass *) em_format_hook_parent_class)->construct (eph, ep, root) == -1)
return -1;
node = root->children;
@@ -181,10 +182,10 @@ emfh_construct (EPluginHook *eph,
group = emfh_construct_group (eph, node);
if (group) {
- EMFormatClass *klass;
+ EMFormatClass *class;
if (emfh_types
- && (klass = g_hash_table_lookup (emfh_types, group->id))) {
+ && (class = g_hash_table_lookup (emfh_types, group->id))) {
GSList *l = group->items;
for (; l; l = g_slist_next (l)) {
@@ -194,7 +195,7 @@ emfh_construct (EPluginHook *eph,
* if we leave as is, then we can enable the
* plugin after startup and it will start
* working automagically */
- em_format_class_add_handler (klass, &item->handler);
+ em_format_class_add_handler (class, &item->handler);
}
}
/* We don't actually need to keep this
@@ -217,7 +218,7 @@ emfh_enable (EPluginHook *eph,
gint state)
{
GSList *g, *l;
- EMFormatClass *klass;
+ EMFormatClass *class;
g = emfh->groups;
if (emfh_types == NULL)
@@ -226,75 +227,60 @@ emfh_enable (EPluginHook *eph,
for (; g; g = g_slist_next (g)) {
struct _EMFormatHookGroup *group = g->data;
- klass = g_hash_table_lookup (emfh_types, group->id);
+ class = g_hash_table_lookup (emfh_types, group->id);
for (l = group->items; l; l = g_slist_next (l)) {
EMFormatHookItem *item = l->data;
if (state)
- em_format_class_add_handler (klass, &item->handler);
+ em_format_class_add_handler (class, &item->handler);
else
- em_format_class_remove_handler (klass, &item->handler);
+ em_format_class_remove_handler (class, &item->handler);
}
}
}
static void
-emfh_finalize (GObject *o)
+format_hook_finalize (GObject *object)
{
- EPluginHook *eph = (EPluginHook *) o;
+ EPluginHook *eph = (EPluginHook *) object;
g_slist_foreach (emfh->groups, (GFunc) emfh_free_group, NULL);
g_slist_free (emfh->groups);
- ((GObjectClass *) emfh_parent_class)->finalize (o);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (em_format_hook_parent_class)->finalize (object);
}
static void
-emfh_class_init (EPluginHookClass *klass)
+em_format_hook_class_init (EMFormatHookClass *class)
{
- ((GObjectClass *) klass)->finalize = emfh_finalize;
- klass->construct = emfh_construct;
- klass->enable = emfh_enable;
- klass->id = "org.gnome.evolution.mail.format:1.0";
-}
+ GObjectClass *object_class;
+ EPluginHookClass *hook_class;
-GType
-em_format_hook_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMFormatHookClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) emfh_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMFormatHook),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
+ object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = format_hook_finalize;
- emfh_parent_class = g_type_class_ref (E_TYPE_PLUGIN_HOOK);
- type = g_type_register_static (
- E_TYPE_PLUGIN_HOOK, "EMFormatHook", &info, 0);
- }
+ hook_class = E_PLUGIN_HOOK_CLASS (class);
+ hook_class->construct = emfh_construct;
+ hook_class->enable = emfh_enable;
+ hook_class->id = "org.gnome.evolution.mail.format:1.0";
+}
- return type;
+static void
+em_format_hook_init (EMFormatHook *hook)
+{
}
void
em_format_hook_register_type (GType type)
{
- EMFormatClass *klass;
+ EMFormatClass *class;
if (emfh_types == NULL)
emfh_types = g_hash_table_new (g_str_hash, g_str_equal);
d(printf("registering formatter type '%s'\n", g_type_name(type)));
- klass = g_type_class_ref (type);
- g_hash_table_insert (emfh_types, (gpointer) g_type_name (type), klass);
+ class = g_type_class_ref (type);
+ g_hash_table_insert (emfh_types, (gpointer) g_type_name (type), class);
}
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 158b647641..48b62b7960 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -66,6 +66,10 @@
#include "widgets/misc/e-attachment-button.h"
#include "widgets/misc/e-attachment-view.h"
+#define EM_FORMAT_HTML_DISPLAY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_FORMAT_HTML_DISPLAY, EMFormatHTMLDisplayPrivate))
+
#define d(x)
struct _EMFormatHTMLDisplayPrivate {
@@ -156,7 +160,10 @@ static void efhd_message_prefix (EMFormat *emf,
static void efhd_builtin_init (EMFormatHTMLDisplayClass *efhc);
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EMFormatHTMLDisplay,
+ em_format_html_display,
+ EM_TYPE_FORMAT_HTML)
static void
efhd_xpkcs7mime_free (EMFormatHTMLPObject *o)
@@ -439,7 +446,7 @@ efhd_format_clone (EMFormat *emf,
EM_FORMAT_HTML (emf)->header_wrap_flags = 0;
/* Chain up to parent's format_clone() method. */
- EM_FORMAT_CLASS (parent_class)->
+ EM_FORMAT_CLASS (em_format_html_display_parent_class)->
format_clone (emf, folder, uid, msg, src, cancellable);
}
@@ -835,17 +842,17 @@ efhd_finalize (GObject *object)
}
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (em_format_html_display_parent_class)->
+ finalize (object);
}
static void
-efhd_class_init (EMFormatHTMLDisplayClass *class)
+em_format_html_display_class_init (EMFormatHTMLDisplayClass *class)
{
GObjectClass *object_class;
EMFormatClass *format_class;
EMFormatHTMLClass *format_html_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMFormatHTMLDisplayPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -864,7 +871,7 @@ efhd_class_init (EMFormatHTMLDisplayClass *class)
}
static void
-efhd_init (EMFormatHTMLDisplay *efhd)
+em_format_html_display_init (EMFormatHTMLDisplay *efhd)
{
EWebView *web_view;
GtkActionGroup *image_actions;
@@ -873,9 +880,9 @@ efhd_init (EMFormatHTMLDisplay *efhd)
web_view = em_format_html_get_web_view (EM_FORMAT_HTML (efhd));
- efhd->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- efhd, EM_TYPE_FORMAT_HTML_DISPLAY, EMFormatHTMLDisplayPrivate);
- efhd->priv->attachment_views = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ efhd->priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (efhd);
+ efhd->priv->attachment_views = g_hash_table_new_full (
+ g_str_hash, g_str_equal, g_free, NULL);
efhd->priv->attachment_expanded = FALSE;
e_mail_display_set_formatter (
@@ -906,33 +913,6 @@ efhd_init (EMFormatHTMLDisplay *efhd)
G_CALLBACK (efhd_web_view_update_actions_cb), efhd);
}
-GType
-em_format_html_display_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMFormatHTMLDisplayClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) efhd_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMFormatHTMLDisplay),
- 0, /* n_preallocs */
- (GInstanceInitFunc) efhd_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- EM_TYPE_FORMAT_HTML, "EMFormatHTMLDisplay",
- &type_info, 0);
- }
-
- return type;
-}
-
EMFormatHTMLDisplay *
em_format_html_display_new (void)
{
@@ -1253,7 +1233,7 @@ efhd_bar_resize (EMFormatHTML *efh,
GtkWidget *widget;
gint width;
- priv = EM_FORMAT_HTML_DISPLAY (efh)->priv;
+ priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (efh);
web_view = em_format_html_get_web_view (efh);
@@ -1281,7 +1261,7 @@ efhd_add_bar (EMFormatHTML *efh,
g_return_val_if_fail (pobject != NULL && pobject->classid != NULL, FALSE);
g_return_val_if_fail (g_str_has_prefix (pobject->classid, "attachment-bar:"), FALSE);
- priv = EM_FORMAT_HTML_DISPLAY (efh)->priv;
+ priv = EM_FORMAT_HTML_DISPLAY_GET_PRIVATE (efh);
widget = e_mail_attachment_bar_new ();
gtk_container_add (GTK_CONTAINER (eb), widget);
diff --git a/mail/em-format-html-print.c b/mail/em-format-html-print.c
index dbfe011759..fd47275e30 100644
--- a/mail/em-format-html-print.c
+++ b/mail/em-format-html-print.c
@@ -35,7 +35,10 @@
#include "em-format-html-print.h"
#include <e-util/e-print.h>
-static gpointer parent_class = NULL;
+G_DEFINE_TYPE (
+ EMFormatHTMLPrint,
+ em_format_html_print,
+ EM_TYPE_FORMAT_HTML)
static void
efhp_finalize (GObject *object)
@@ -47,7 +50,7 @@ efhp_finalize (GObject *object)
g_object_unref (efhp->source);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (em_format_html_print_parent_class)->finalize (object);
}
static gboolean
@@ -61,13 +64,11 @@ efhp_is_inline (EMFormat *emf,
}
static void
-efhp_class_init (EMFormatHTMLPrintClass *class)
+em_format_html_print_class_init (EMFormatHTMLPrintClass *class)
{
GObjectClass *object_class;
EMFormatClass *format_class;
- parent_class = g_type_class_peek_parent (class);
-
object_class = G_OBJECT_CLASS (class);
object_class->finalize = efhp_finalize;
@@ -76,9 +77,8 @@ efhp_class_init (EMFormatHTMLPrintClass *class)
}
static void
-efhp_init (GObject *o)
+em_format_html_print_init (EMFormatHTMLPrint *efhp)
{
- EMFormatHTMLPrint *efhp = (EMFormatHTMLPrint *) o;
EWebView *web_view;
web_view = em_format_html_get_web_view (EM_FORMAT_HTML (efhp));
@@ -92,32 +92,6 @@ efhp_init (GObject *o)
((EMFormat *) efhp)->print = TRUE;
}
-GType
-em_format_html_print_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMFormatHTMLPrintClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) efhp_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMFormatHTMLPrint),
- 0, /* n_preallocs */
- (GInstanceInitFunc) efhp_init
- };
-
- type = g_type_register_static (
- EM_TYPE_FORMAT_HTML, "EMFormatHTMLPrint",
- &type_info, 0);
- }
-
- return type;
-}
-
EMFormatHTMLPrint *
em_format_html_print_new (EMFormatHTML *source,
GtkPrintOperationAction action)
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 9a7c87f105..960cdc1267 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -64,6 +64,10 @@
#include "mail-config.h"
#include "mail-mt.h"
+#define EM_FORMAT_HTML_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_FORMAT_HTML, EMFormatHTMLPrivate))
+
#define d(x)
#define EFM_MESSAGE_START_ANAME "evolution#message#start"
@@ -811,7 +815,7 @@ efh_busy (EMFormat *emf)
{
EMFormatHTMLPrivate *priv;
- priv = EM_FORMAT_HTML (emf)->priv;
+ priv = EM_FORMAT_HTML_GET_PRIVATE (emf);
return (priv->format_id != -1);
}
@@ -1009,8 +1013,7 @@ efh_init (EMFormatHTML *efh,
EWebView *web_view;
GdkColor *color;
- efh->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- efh, EM_TYPE_FORMAT_HTML, EMFormatHTMLPrivate);
+ efh->priv = EM_FORMAT_HTML_GET_PRIVATE (efh);
g_queue_init (&efh->pending_object_list);
g_queue_init (&efh->priv->pending_jobs);
diff --git a/mail/em-search-context.c b/mail/em-search-context.c
index f4b817b6b6..2a900752aa 100644
--- a/mail/em-search-context.c
+++ b/mail/em-search-context.c
@@ -33,7 +33,7 @@
#include "filter/e-filter-option.h"
#include "filter/e-filter-int.h"
-static gpointer parent_class;
+G_DEFINE_TYPE (EMSearchContext, em_search_context, E_TYPE_RULE_CONTEXT)
static EFilterElement *
search_context_new_element (ERuleContext *context,
@@ -46,53 +46,29 @@ search_context_new_element (ERuleContext *context,
return (EFilterElement *) e_filter_int_new_type ("score", -3, 3);
/* Chain up to parent's new_element() method. */
- return E_RULE_CONTEXT_CLASS (parent_class)->new_element (context, type);
+ return E_RULE_CONTEXT_CLASS (em_search_context_parent_class)->
+ new_element (context, type);
}
static void
-search_context_class_init (EMSearchContextClass *class)
+em_search_context_class_init (EMSearchContextClass *class)
{
ERuleContextClass *rule_context_class;
- parent_class = g_type_class_peek_parent (class);
-
rule_context_class = E_RULE_CONTEXT_CLASS (class);
rule_context_class->new_element = search_context_new_element;
}
static void
-search_context_init (EMSearchContext *vc)
+em_search_context_init (EMSearchContext *vc)
{
ERuleContext *rule_context;
rule_context = E_RULE_CONTEXT (vc);
- rule_context->flags = E_RULE_CONTEXT_THREADING | E_RULE_CONTEXT_GROUPING;
-}
-
-GType
-em_search_context_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EMSearchContextClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) search_context_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMSearchContext),
- 0, /* n_preallocs */
- (GInstanceInitFunc) search_context_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- E_TYPE_RULE_CONTEXT, "EMSearchContext", &type_info, 0);
- }
- return type;
+ rule_context->flags =
+ E_RULE_CONTEXT_THREADING |
+ E_RULE_CONTEXT_GROUPING;
}
ERuleContext *
diff --git a/mail/em-vfolder-context.c b/mail/em-vfolder-context.c
index 371914c886..6ac2cb62f2 100644
--- a/mail/em-vfolder-context.c
+++ b/mail/em-vfolder-context.c
@@ -35,6 +35,10 @@
#include "em-filter-folder-element.h"
+#define EM_VFOLDER_CONTEXT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_VFOLDER_CONTEXT, EMVFolderContextPrivate))
+
struct _EMVFolderContextPrivate {
EMailBackend *backend;
};
@@ -99,7 +103,7 @@ vfolder_context_dispose (GObject *object)
{
EMVFolderContextPrivate *priv;
- priv = EM_VFOLDER_CONTEXT (object)->priv;
+ priv = EM_VFOLDER_CONTEXT_GET_PRIVATE (object);
if (priv->backend != NULL) {
g_object_unref (priv->backend);
@@ -116,7 +120,7 @@ vfolder_context_new_element (ERuleContext *context,
{
EMVFolderContextPrivate *priv;
- priv = EM_VFOLDER_CONTEXT (context)->priv;
+ priv = EM_VFOLDER_CONTEXT_GET_PRIVATE (context);
if (strcmp (type, "system-flag") == 0)
return e_filter_option_new ();
@@ -166,8 +170,7 @@ em_vfolder_context_class_init (EMVFolderContextClass *class)
static void
em_vfolder_context_init (EMVFolderContext *context)
{
- context->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- context, EM_TYPE_VFOLDER_CONTEXT, EMVFolderContextPrivate);
+ context->priv = EM_VFOLDER_CONTEXT_GET_PRIVATE (context);
e_rule_context_add_part_set (
E_RULE_CONTEXT (context), "partset", E_TYPE_FILTER_PART,
diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c
index 04c009bc00..831059910c 100644
--- a/mail/em-vfolder-rule.c
+++ b/mail/em-vfolder-rule.c
@@ -43,6 +43,10 @@
#include "e-util/e-alert.h"
#include "e-util/e-util-private.h"
+#define EM_VFOLDER_RULE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), EM_TYPE_VFOLDER_RULE, EMVFolderRulePrivate))
+
struct _EMVFolderRulePrivate {
EMailBackend *backend;
};
@@ -131,7 +135,7 @@ vfolder_rule_dispose (GObject *object)
{
EMVFolderRulePrivate *priv;
- priv = EM_VFOLDER_RULE (object)->priv;
+ priv = EM_VFOLDER_RULE_GET_PRIVATE (object);
if (priv->backend != NULL) {
g_object_unref (priv->backend);
@@ -192,9 +196,7 @@ em_vfolder_rule_class_init (EMVFolderRuleClass *class)
static void
em_vfolder_rule_init (EMVFolderRule *rule)
{
- rule->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- rule, EM_TYPE_VFOLDER_RULE, EMVFolderRulePrivate);
-
+ rule->priv = EM_VFOLDER_RULE_GET_PRIVATE (rule);
rule->with = EM_VFOLDER_RULE_WITH_SPECIFIC;
rule->rule.source = g_strdup ("incoming");
}
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index 5dd215a156..dbb8ef8bfc 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -56,6 +56,10 @@
#define w(x)
#define d(x)
+#define MAIL_FOLDER_CACHE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), MAIL_TYPE_FOLDER_CACHE, MailFolderCachePrivate))
+
/* This code is a mess, there is no reason it should be so complicated. */
struct _MailFolderCachePrivate {
@@ -141,51 +145,51 @@ free_update (struct _folder_update *up)
}
static gboolean
-flush_updates_idle_cb (MailFolderCache *self)
+flush_updates_idle_cb (MailFolderCache *cache)
{
struct _folder_update *up;
- g_mutex_lock (self->priv->stores_mutex);
- while ((up = g_queue_pop_head (&self->priv->updates)) != NULL) {
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_lock (cache->priv->stores_mutex);
+ while ((up = g_queue_pop_head (&cache->priv->updates)) != NULL) {
+ g_mutex_unlock (cache->priv->stores_mutex);
if (up->remove) {
if (up->delete) {
g_signal_emit (
- self, signals[FOLDER_DELETED], 0,
+ cache, signals[FOLDER_DELETED], 0,
up->store, up->full_name);
} else
g_signal_emit (
- self, signals[FOLDER_UNAVAILABLE], 0,
+ cache, signals[FOLDER_UNAVAILABLE], 0,
up->store, up->full_name);
} else {
if (up->oldfull && up->add) {
g_signal_emit (
- self, signals[FOLDER_RENAMED], 0,
+ cache, signals[FOLDER_RENAMED], 0,
up->store, up->oldfull, up->full_name);
}
if (!up->oldfull && up->add)
g_signal_emit (
- self, signals[FOLDER_AVAILABLE], 0,
+ cache, signals[FOLDER_AVAILABLE], 0,
up->store, up->full_name);
}
/* update unread counts */
- g_signal_emit (self, signals[FOLDER_UNREAD_UPDATED], 0,
+ g_signal_emit (cache, signals[FOLDER_UNREAD_UPDATED], 0,
up->store, up->full_name, up->unread);
/* indicate that the folder has changed (new mail received, etc) */
if (up->store != NULL && up->full_name != NULL) {
g_signal_emit (
- self, signals[FOLDER_CHANGED], 0, up->store,
+ cache, signals[FOLDER_CHANGED], 0, up->store,
up->full_name, up->new, up->msg_uid,
up->msg_sender, up->msg_subject);
}
if (CAMEL_IS_VEE_STORE (up->store) && !up->remove) {
/* Normally the vfolder store takes care of the
- * folder_opened event itself, but we add folder to
+ * folder_opened event itcache, but we add folder to
* the noting system later, thus we do not know about
* search folders to update them in a tree, thus
* ensure their changes will be tracked correctly. */
@@ -196,32 +200,32 @@ flush_updates_idle_cb (MailFolderCache *self)
up->store, up->full_name, 0, NULL, NULL);
if (folder) {
- mail_folder_cache_note_folder (self, folder);
+ mail_folder_cache_note_folder (cache, folder);
g_object_unref (folder);
}
}
free_update (up);
- g_mutex_lock (self->priv->stores_mutex);
+ g_mutex_lock (cache->priv->stores_mutex);
}
- self->priv->update_id = 0;
- g_mutex_unlock (self->priv->stores_mutex);
+ cache->priv->update_id = 0;
+ g_mutex_unlock (cache->priv->stores_mutex);
return FALSE;
}
static void
-flush_updates (MailFolderCache *self)
+flush_updates (MailFolderCache *cache)
{
- if (self->priv->update_id > 0)
+ if (cache->priv->update_id > 0)
return;
- if (g_queue_is_empty (&self->priv->updates))
+ if (g_queue_is_empty (&cache->priv->updates))
return;
- self->priv->update_id = g_idle_add (
- (GSourceFunc) flush_updates_idle_cb, self);
+ cache->priv->update_id = g_idle_add (
+ (GSourceFunc) flush_updates_idle_cb, cache);
}
/* This is how unread counts work (and don't work):
@@ -247,7 +251,7 @@ flush_updates (MailFolderCache *self)
* it's correct. */
static void
-update_1folder (MailFolderCache *self,
+update_1folder (MailFolderCache *cache,
struct _folder_info *mfi,
gint new,
const gchar *msg_uid,
@@ -274,8 +278,8 @@ update_1folder (MailFolderCache *self,
folder_is_vtrash = CAMEL_IS_VTRASH_FOLDER (folder);
special_case =
- (self->priv->count_trash && folder_is_vtrash) ||
- (self->priv->count_sent && folder_is_sent) ||
+ (cache->priv->count_trash && folder_is_vtrash) ||
+ (cache->priv->count_sent && folder_is_sent) ||
folder_is_drafts || folder_is_outbox;
if (special_case) {
@@ -313,14 +317,14 @@ update_1folder (MailFolderCache *self,
up->msg_uid = g_strdup (msg_uid);
up->msg_sender = g_strdup (msg_sender);
up->msg_subject = g_strdup (msg_subject);
- g_queue_push_tail (&self->priv->updates, up);
- flush_updates (self);
+ g_queue_push_tail (&cache->priv->updates, up);
+ flush_updates (cache);
}
static void
folder_changed_cb (CamelFolder *folder,
CamelFolderChangeInfo *changes,
- MailFolderCache *self)
+ MailFolderCache *cache)
{
static GHashTable *last_newmail_per_folder = NULL;
time_t latest_received, new_latest_received;
@@ -395,14 +399,14 @@ folder_changed_cb (CamelFolder *folder,
last_newmail_per_folder, folder,
GINT_TO_POINTER (new_latest_received));
- g_mutex_lock (self->priv->stores_mutex);
- if (self->priv->stores != NULL
- && (si = g_hash_table_lookup (self->priv->stores, parent_store)) != NULL
+ g_mutex_lock (cache->priv->stores_mutex);
+ if (cache->priv->stores != NULL
+ && (si = g_hash_table_lookup (cache->priv->stores, parent_store)) != NULL
&& (mfi = g_hash_table_lookup (si->folders, full_name)) != NULL
&& mfi->folder == folder) {
- update_1folder (self, mfi, new, uid, sender, subject, NULL);
+ update_1folder (cache, mfi, new, uid, sender, subject, NULL);
}
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
g_free (uid);
g_free (sender);
@@ -410,7 +414,7 @@ folder_changed_cb (CamelFolder *folder,
}
static void
-unset_folder_info (MailFolderCache *self,
+unset_folder_info (MailFolderCache *cache,
struct _folder_info *mfi,
gint delete,
gint unsub)
@@ -423,7 +427,7 @@ unset_folder_info (MailFolderCache *self,
CamelFolder *folder = mfi->folder;
g_signal_handlers_disconnect_by_func (
- folder, folder_changed_cb, self);
+ folder, folder_changed_cb, cache);
g_object_remove_weak_pointer (
G_OBJECT (mfi->folder), &mfi->folder);
@@ -438,8 +442,8 @@ unset_folder_info (MailFolderCache *self,
up->store = g_object_ref (mfi->store_info->store);
up->full_name = g_strdup (mfi->full_name);
- g_queue_push_tail (&self->priv->updates, up);
- flush_updates (self);
+ g_queue_push_tail (&cache->priv->updates, up);
+ flush_updates (cache);
}
}
@@ -451,7 +455,7 @@ free_folder_info (struct _folder_info *mfi)
}
static void
-setup_folder (MailFolderCache *self,
+setup_folder (MailFolderCache *cache,
CamelFolderInfo *fi,
struct _store_info *si)
{
@@ -460,7 +464,7 @@ setup_folder (MailFolderCache *self,
mfi = g_hash_table_lookup (si->folders, fi->full_name);
if (mfi) {
- update_1folder (self, mfi, 0, NULL, NULL, NULL, fi);
+ update_1folder (cache, mfi, 0, NULL, NULL, NULL, fi);
} else {
mfi = g_malloc0 (sizeof (*mfi));
mfi->full_name = g_strdup (fi->full_name);
@@ -478,21 +482,21 @@ setup_folder (MailFolderCache *self,
if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0)
up->add = TRUE;
- g_queue_push_tail (&self->priv->updates, up);
- flush_updates (self);
+ g_queue_push_tail (&cache->priv->updates, up);
+ flush_updates (cache);
}
}
static void
-create_folders (MailFolderCache *self,
+create_folders (MailFolderCache *cache,
CamelFolderInfo *fi,
struct _store_info *si)
{
while (fi) {
- setup_folder (self, fi, si);
+ setup_folder (cache, fi, si);
if (fi->child)
- create_folders (self, fi->child, si);
+ create_folders (cache, fi->child, si);
fi = fi->next;
}
@@ -501,15 +505,15 @@ create_folders (MailFolderCache *self,
static void
store_folder_subscribed_cb (CamelStore *store,
CamelFolderInfo *info,
- MailFolderCache *self)
+ MailFolderCache *cache)
{
struct _store_info *si;
- g_mutex_lock (self->priv->stores_mutex);
- si = g_hash_table_lookup (self->priv->stores, store);
+ g_mutex_lock (cache->priv->stores_mutex);
+ si = g_hash_table_lookup (cache->priv->stores, store);
if (si)
- setup_folder (self, info, si);
- g_mutex_unlock (self->priv->stores_mutex);
+ setup_folder (cache, info, si);
+ g_mutex_unlock (cache->priv->stores_mutex);
}
static void
@@ -526,45 +530,45 @@ store_folder_created_cb (CamelStore *store,
static void
store_folder_opened_cb (CamelStore *store,
CamelFolder *folder,
- MailFolderCache *self)
+ MailFolderCache *cache)
{
- mail_folder_cache_note_folder (self, folder);
+ mail_folder_cache_note_folder (cache, folder);
}
static void
store_folder_unsubscribed_cb (CamelStore *store,
CamelFolderInfo *info,
- MailFolderCache *self)
+ MailFolderCache *cache)
{
struct _store_info *si;
struct _folder_info *mfi;
- g_mutex_lock (self->priv->stores_mutex);
- si = g_hash_table_lookup (self->priv->stores, store);
+ g_mutex_lock (cache->priv->stores_mutex);
+ si = g_hash_table_lookup (cache->priv->stores, store);
if (si) {
mfi = g_hash_table_lookup (si->folders, info->full_name);
if (mfi) {
g_hash_table_remove (si->folders, mfi->full_name);
- unset_folder_info (self, mfi, TRUE, TRUE);
+ unset_folder_info (cache, mfi, TRUE, TRUE);
free_folder_info (mfi);
}
}
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
}
static void
store_folder_deleted_cb (CamelStore *store,
CamelFolderInfo *info,
- MailFolderCache *self)
+ MailFolderCache *cache)
{
/* We only want deleted events to do more work
* if we dont support subscriptions. */
if (!CAMEL_IS_SUBSCRIBABLE (store))
- store_folder_unsubscribed_cb (store, info, self);
+ store_folder_unsubscribed_cb (store, info, cache);
}
static void
-rename_folders (MailFolderCache *self,
+rename_folders (MailFolderCache *cache,
struct _store_info *si,
const gchar *oldbase,
const gchar *newbase,
@@ -610,13 +614,13 @@ rename_folders (MailFolderCache *self,
if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0)
up->add = TRUE;
- g_queue_push_tail (&self->priv->updates, up);
- flush_updates (self);
+ g_queue_push_tail (&cache->priv->updates, up);
+ flush_updates (cache);
#if 0
if (fi->sibling)
- rename_folders (self, si, oldbase, newbase, fi->sibling, folders);
+ rename_folders (cache, si, oldbase, newbase, fi->sibling, folders);
if (fi->child)
- rename_folders (self, si, oldbase, newbase, fi->child, folders);
+ rename_folders (cache, si, oldbase, newbase, fi->child, folders);
#endif
/* rename the meta-data we maintain ourselves */
@@ -669,12 +673,12 @@ static void
store_folder_renamed_cb (CamelStore *store,
const gchar *old_name,
CamelFolderInfo *info,
- MailFolderCache *self)
+ MailFolderCache *cache)
{
struct _store_info *si;
- g_mutex_lock (self->priv->stores_mutex);
- si = g_hash_table_lookup (self->priv->stores, store);
+ g_mutex_lock (cache->priv->stores_mutex);
+ si = g_hash_table_lookup (cache->priv->stores, store);
if (si) {
GPtrArray *folders = g_ptr_array_new ();
CamelFolderInfo *top;
@@ -687,13 +691,13 @@ store_folder_renamed_cb (CamelStore *store,
top = folders->pdata[0];
for (i = 0; i < folders->len; i++) {
- rename_folders (self, si, old_name, top->full_name, folders->pdata[i]);
+ rename_folders (cache, si, old_name, top->full_name, folders->pdata[i]);
}
g_ptr_array_free (folders, TRUE);
}
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
}
struct _update_data {
@@ -708,8 +712,8 @@ unset_folder_info_hash (gchar *path,
struct _folder_info *mfi,
gpointer data)
{
- MailFolderCache *self = (MailFolderCache *) data;
- unset_folder_info (self, mfi, FALSE, FALSE);
+ MailFolderCache *cache = (MailFolderCache *) data;
+ unset_folder_info (cache, mfi, FALSE, FALSE);
}
static void
@@ -842,13 +846,13 @@ ping_store (CamelStore *store)
}
static gboolean
-ping_cb (MailFolderCache *self)
+ping_cb (MailFolderCache *cache)
{
- g_mutex_lock (self->priv->stores_mutex);
+ g_mutex_lock (cache->priv->stores_mutex);
- g_hash_table_foreach (self->priv->stores, (GHFunc) ping_store, NULL);
+ g_hash_table_foreach (cache->priv->stores, (GHFunc) ping_store, NULL);
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
return TRUE;
}
@@ -1064,26 +1068,25 @@ mail_folder_cache_class_init (MailFolderCacheClass *class)
}
static void
-mail_folder_cache_init (MailFolderCache *self)
+mail_folder_cache_init (MailFolderCache *cache)
{
const gchar *buf;
guint timeout;
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- self, MAIL_TYPE_FOLDER_CACHE, MailFolderCachePrivate);
+ cache->priv = MAIL_FOLDER_CACHE_GET_PRIVATE (cache);
/* initialize values */
- self->priv->stores = g_hash_table_new (NULL, NULL);
- self->priv->stores_mutex = g_mutex_new ();
+ cache->priv->stores = g_hash_table_new (NULL, NULL);
+ cache->priv->stores_mutex = g_mutex_new ();
- g_queue_init (&self->priv->updates);
- self->priv->count_sent = getenv("EVOLUTION_COUNT_SENT") != NULL;
- self->priv->count_trash = getenv("EVOLUTION_COUNT_TRASH") != NULL;
+ g_queue_init (&cache->priv->updates);
+ cache->priv->count_sent = getenv("EVOLUTION_COUNT_SENT") != NULL;
+ cache->priv->count_trash = getenv("EVOLUTION_COUNT_TRASH") != NULL;
buf = getenv ("EVOLUTION_PING_TIMEOUT");
timeout = buf ? strtoul (buf, NULL, 10) : 600;
- self->priv->ping_id = g_timeout_add_seconds (
- timeout, (GSourceFunc) ping_cb, self);
+ cache->priv->ping_id = g_timeout_add_seconds (
+ timeout, (GSourceFunc) ping_cb, cache);
}
MailFolderCache *
@@ -1100,7 +1103,7 @@ mail_folder_cache_new (void)
* @done function returns if we can free folder info.
*/
void
-mail_folder_cache_note_store (MailFolderCache *self,
+mail_folder_cache_note_store (MailFolderCache *cache,
CamelSession *session,
CamelStore *store,
GCancellable *cancellable,
@@ -1114,14 +1117,14 @@ mail_folder_cache_note_store (MailFolderCache *self,
g_return_if_fail (CAMEL_IS_STORE (store));
g_return_if_fail (mail_in_main_thread ());
- g_mutex_lock (self->priv->stores_mutex);
+ g_mutex_lock (cache->priv->stores_mutex);
- si = g_hash_table_lookup (self->priv->stores, store);
+ si = g_hash_table_lookup (cache->priv->stores, store);
if (si == NULL) {
si = g_malloc0 (sizeof (*si));
si->folders = g_hash_table_new (g_str_hash, g_str_equal);
si->store = g_object_ref (store);
- g_hash_table_insert (self->priv->stores, store, si);
+ g_hash_table_insert (cache->priv->stores, store, si);
g_queue_init (&si->folderinfo_updates);
hook = TRUE;
}
@@ -1129,7 +1132,7 @@ mail_folder_cache_note_store (MailFolderCache *self,
ud = g_malloc0 (sizeof (*ud));
ud->done = done;
ud->data = data;
- ud->cache = self;
+ ud->cache = cache;
if (G_IS_CANCELLABLE (cancellable))
ud->cancellable = g_object_ref (cancellable);
@@ -1170,32 +1173,32 @@ mail_folder_cache_note_store (MailFolderCache *self,
g_queue_push_tail (&si->folderinfo_updates, ud);
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
/* there is potential for race here, but it is safe as we check
* for the store anyway */
if (hook) {
g_signal_connect (
store, "folder-opened",
- G_CALLBACK (store_folder_opened_cb), self);
+ G_CALLBACK (store_folder_opened_cb), cache);
g_signal_connect (
store, "folder-created",
- G_CALLBACK (store_folder_created_cb), self);
+ G_CALLBACK (store_folder_created_cb), cache);
g_signal_connect (
store, "folder-deleted",
- G_CALLBACK (store_folder_deleted_cb), self);
+ G_CALLBACK (store_folder_deleted_cb), cache);
g_signal_connect (
store, "folder-renamed",
- G_CALLBACK (store_folder_renamed_cb), self);
+ G_CALLBACK (store_folder_renamed_cb), cache);
}
if (hook && CAMEL_IS_SUBSCRIBABLE (store)) {
g_signal_connect (
store, "folder-subscribed",
- G_CALLBACK (store_folder_subscribed_cb), self);
+ G_CALLBACK (store_folder_subscribed_cb), cache);
g_signal_connect (
store, "folder-unsubscribed",
- G_CALLBACK (store_folder_unsubscribed_cb), self);
+ G_CALLBACK (store_folder_unsubscribed_cb), cache);
}
}
@@ -1205,31 +1208,31 @@ mail_folder_cache_note_store (MailFolderCache *self,
* Notify the cache that the specified @store can be removed from the cache
*/
void
-mail_folder_cache_note_store_remove (MailFolderCache *self,
+mail_folder_cache_note_store_remove (MailFolderCache *cache,
CamelStore *store)
{
struct _store_info *si;
g_return_if_fail (CAMEL_IS_STORE (store));
- if (self->priv->stores == NULL)
+ if (cache->priv->stores == NULL)
return;
d(printf("store removed!!\n"));
- g_mutex_lock (self->priv->stores_mutex);
- si = g_hash_table_lookup (self->priv->stores, store);
+ g_mutex_lock (cache->priv->stores_mutex);
+ si = g_hash_table_lookup (cache->priv->stores, store);
if (si) {
GList *link;
- g_hash_table_remove (self->priv->stores, store);
+ g_hash_table_remove (cache->priv->stores, store);
g_signal_handlers_disconnect_matched (
store, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, self);
+ 0, 0, NULL, NULL, cache);
g_hash_table_foreach (
si->folders, (GHFunc)
- unset_folder_info_hash, self);
+ unset_folder_info_hash, cache);
link = g_queue_peek_head_link (&si->folderinfo_updates);
@@ -1245,7 +1248,7 @@ mail_folder_cache_note_store_remove (MailFolderCache *self,
g_free (si);
}
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
}
/**
@@ -1256,7 +1259,7 @@ mail_folder_cache_note_store_remove (MailFolderCache *self,
* folder can be opened
*/
void
-mail_folder_cache_note_folder (MailFolderCache *self,
+mail_folder_cache_note_folder (MailFolderCache *cache,
CamelFolder *folder)
{
CamelStore *parent_store;
@@ -1267,18 +1270,18 @@ mail_folder_cache_note_folder (MailFolderCache *self,
full_name = camel_folder_get_full_name (folder);
parent_store = camel_folder_get_parent_store (folder);
- g_mutex_lock (self->priv->stores_mutex);
- if (self->priv->stores == NULL
- || (si = g_hash_table_lookup (self->priv->stores, parent_store)) == NULL
+ g_mutex_lock (cache->priv->stores_mutex);
+ if (cache->priv->stores == NULL
+ || (si = g_hash_table_lookup (cache->priv->stores, parent_store)) == NULL
|| (mfi = g_hash_table_lookup (si->folders, full_name)) == NULL) {
w(g_warning("Noting folder before store initialised"));
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
return;
}
/* dont do anything if we already have this */
if (mfi->folder == folder) {
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
return;
}
@@ -1286,13 +1289,13 @@ mail_folder_cache_note_folder (MailFolderCache *self,
g_object_add_weak_pointer (G_OBJECT (folder), &mfi->folder);
- update_1folder (self, mfi, 0, NULL, NULL, NULL, NULL);
+ update_1folder (cache, mfi, 0, NULL, NULL, NULL, NULL);
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
g_signal_connect (
folder, "changed",
- G_CALLBACK (folder_changed_cb), self);
+ G_CALLBACK (folder_changed_cb), cache);
}
/**
@@ -1304,18 +1307,18 @@ mail_folder_cache_note_folder (MailFolderCache *self,
* folder if the folder has also already been opened
*/
gboolean
-mail_folder_cache_get_folder_from_uri (MailFolderCache *self,
+mail_folder_cache_get_folder_from_uri (MailFolderCache *cache,
const gchar *uri,
CamelFolder **folderp)
{
struct _find_info fi = { uri, NULL };
- if (self->priv->stores == NULL)
+ if (cache->priv->stores == NULL)
return FALSE;
- g_mutex_lock (self->priv->stores_mutex);
+ g_mutex_lock (cache->priv->stores_mutex);
g_hash_table_foreach (
- self->priv->stores, (GHFunc)
+ cache->priv->stores, (GHFunc)
storeinfo_find_folder_info, &fi);
if (folderp) {
if (fi.fi && fi.fi->folder)
@@ -1323,28 +1326,28 @@ mail_folder_cache_get_folder_from_uri (MailFolderCache *self,
else
*folderp = NULL;
}
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
return fi.fi != NULL;
}
gboolean
-mail_folder_cache_get_folder_info_flags (MailFolderCache *self,
+mail_folder_cache_get_folder_info_flags (MailFolderCache *cache,
CamelFolder *folder,
CamelFolderInfoFlags *flags)
{
struct _find_info fi = { NULL, NULL };
gchar *folder_uri;
- if (self->priv->stores == NULL)
+ if (cache->priv->stores == NULL)
return FALSE;
folder_uri = e_mail_folder_uri_from_folder (folder);
fi.folder_uri = folder_uri;
- g_mutex_lock (self->priv->stores_mutex);
+ g_mutex_lock (cache->priv->stores_mutex);
g_hash_table_foreach (
- self->priv->stores, (GHFunc)
+ cache->priv->stores, (GHFunc)
storeinfo_find_folder_info, &fi);
if (flags) {
if (fi.fi)
@@ -1352,7 +1355,7 @@ mail_folder_cache_get_folder_info_flags (MailFolderCache *self,
else
*flags = 0;
}
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
g_free (folder_uri);
@@ -1362,29 +1365,29 @@ mail_folder_cache_get_folder_info_flags (MailFolderCache *self,
/* Returns whether folder 'folder' has children based on folder_info->child property.
* If not found returns FALSE and sets 'found' to FALSE, if not NULL. */
gboolean
-mail_folder_cache_get_folder_has_children (MailFolderCache *self,
+mail_folder_cache_get_folder_has_children (MailFolderCache *cache,
CamelFolder *folder,
gboolean *found)
{
struct _find_info fi = { NULL, NULL };
gchar *folder_uri;
- g_return_val_if_fail (self != NULL, FALSE);
+ g_return_val_if_fail (cache != NULL, FALSE);
g_return_val_if_fail (folder != NULL, FALSE);
- if (self->priv->stores == NULL)
+ if (cache->priv->stores == NULL)
return FALSE;
folder_uri = e_mail_folder_uri_from_folder (folder);
fi.folder_uri = folder_uri;
- g_mutex_lock (self->priv->stores_mutex);
+ g_mutex_lock (cache->priv->stores_mutex);
g_hash_table_foreach (
- self->priv->stores, (GHFunc)
+ cache->priv->stores, (GHFunc)
storeinfo_find_folder_info, &fi);
if (found)
*found = fi.fi != NULL;
- g_mutex_unlock (self->priv->stores_mutex);
+ g_mutex_unlock (cache->priv->stores_mutex);
g_free (folder_uri);
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index f811abb9fd..118acc1522 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -396,13 +396,6 @@ An mbox account will be created to preserve the old mbox folders. You can delete
<_secondary xml:space="preserve">Please check your account settings and try again.</_secondary>
</error>
- <error id="ask-receipt" type="question" default="GTK_RESPONSE_NO">
- <_primary>Read receipt requested.</_primary>
- <_secondary xml:space="preserve">A read receipt notification has been requested for "{1}". Send the receipt notification to {0}?</_secondary>
- <button _label="Do _Not Send" response="GTK_RESPONSE_NO"/>
- <button _label="_Send Receipt" response="GTK_RESPONSE_YES"/>
- </error>
-
<error id="ask-quick-offline" type="question" default="GTK_RESPONSE_NO">
<_primary>Synchronize folders locally for offline usage?</_primary>
<_secondary xml:space="preserve">Do you want to locally synchronize the folders that are marked for offline usage?</_secondary>
diff --git a/mail/message-list.c b/mail/message-list.c
index 1b8f0d16fd..c322f56af1 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -95,6 +95,10 @@
#define d(x)
#define t(x)
+#define MESSAGE_LIST_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), MESSAGE_LIST_TYPE, MessageListPrivate))
+
struct _MLSelection {
GPtrArray *uids;
CamelFolder *folder;
@@ -133,7 +137,17 @@ enum {
PROP_PASTE_TARGET_LIST
};
-static gpointer parent_class;
+/* Forward Declarations */
+static void message_list_selectable_init
+ (ESelectableInterface *interface);
+
+G_DEFINE_TYPE_WITH_CODE (
+ MessageList,
+ message_list,
+ E_TYPE_TREE,
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_SELECTABLE,
+ message_list_selectable_init))
static struct {
const gchar *target;
@@ -2548,8 +2562,7 @@ message_list_init (MessageList *message_list)
GtkTargetList *target_list;
GdkAtom matom;
- message_list->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- message_list, MESSAGE_LIST_TYPE, MessageListPrivate);
+ message_list->priv = MESSAGE_LIST_GET_PRIVATE (message_list);
#if HAVE_CLUTTER
message_list->priv->timeline = NULL;
@@ -2707,7 +2720,7 @@ message_list_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (message_list_parent_class)->dispose (object);
}
static void
@@ -2736,7 +2749,7 @@ message_list_finalize (GObject *object)
clear_selection (message_list, &priv->clipboard);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (message_list_parent_class)->finalize (object);
}
static void
@@ -2769,7 +2782,6 @@ message_list_class_init (MessageListClass *class)
for (i = 0; i < G_N_ELEMENTS (ml_drag_info); i++)
ml_drag_info[i].atom = gdk_atom_intern (ml_drag_info[i].target, FALSE);
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (MessageListPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -2935,41 +2947,6 @@ message_list_construct (MessageList *message_list)
G_CALLBACK (ml_tree_sorting_changed), message_list);
}
-GType
-message_list_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (MessageListClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) message_list_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (MessageList),
- 0, /* n_preallocs */
- (GInstanceInitFunc) message_list_init,
- NULL /* value_table */
- };
-
- static const GInterfaceInfo selectable_info = {
- (GInterfaceInitFunc) message_list_selectable_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL /* interface_data */
- };
-
- type = g_type_register_static (
- E_TYPE_TREE, "MessageList", &type_info, 0);
-
- g_type_add_interface_static (
- type, E_TYPE_SELECTABLE, &selectable_info);
- }
-
- return type;
-}
-
/**
* message_list_new:
*
diff --git a/modules/Makefile.am b/modules/Makefile.am
index dd363d27a3..ee3cdfdb1a 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -29,6 +29,7 @@ SUBDIRS = \
mail \
composer-autosave \
mailto-handler \
+ mdn \
offline-alert \
plugin-lib \
plugin-manager \
diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c
index 7918930736..e3b9f1f5ff 100644
--- a/modules/mail/e-mail-shell-content.c
+++ b/modules/mail/e-mail-shell-content.c
@@ -46,6 +46,10 @@
#include "e-mail-shell-backend.h"
#include "e-mail-shell-view-actions.h"
+#define E_MAIL_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentPrivate))
+
struct _EMailShellContentPrivate {
EMailView *mail_view;
};
@@ -153,7 +157,7 @@ mail_shell_content_dispose (GObject *object)
{
EMailShellContentPrivate *priv;
- priv = E_MAIL_SHELL_CONTENT (object)->priv;
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object);
if (priv->mail_view != NULL) {
g_object_unref (priv->mail_view);
@@ -173,7 +177,7 @@ mail_shell_content_constructed (GObject *object)
GtkWidget *container;
GtkWidget *widget;
- priv = E_MAIL_SHELL_CONTENT (object)->priv;
+ priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object);
/* Chain up to parent's constructed () method. */
G_OBJECT_CLASS (parent_class)->constructed (object);
@@ -209,14 +213,14 @@ mail_shell_content_constructed (GObject *object)
static guint32
mail_shell_content_check_state (EShellContent *shell_content)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
EMailReader *reader;
- priv = E_MAIL_SHELL_CONTENT (shell_content)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
return e_mail_reader_check_state (reader);
}
@@ -224,13 +228,13 @@ mail_shell_content_check_state (EShellContent *shell_content)
static void
mail_shell_content_focus_search_results (EShellContent *shell_content)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
GtkWidget *message_list;
EMailReader *reader;
- priv = E_MAIL_SHELL_CONTENT (shell_content)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content);
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
message_list = e_mail_reader_get_message_list (reader);
gtk_widget_grab_focus (message_list);
@@ -239,13 +243,13 @@ mail_shell_content_focus_search_results (EShellContent *shell_content)
static guint
mail_shell_content_open_selected_mail (EMailReader *reader)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
return e_mail_reader_open_selected_mail (reader);
}
@@ -277,30 +281,16 @@ mail_shell_content_get_action_group (EMailReader *reader,
return e_shell_window_get_action_group (shell_window, group_name);
}
-static EAlertSink *
-mail_shell_content_get_alert_sink (EMailReader *reader)
-{
- EMailShellContentPrivate *priv;
-
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
-
- /* Forward this to our internal EMailView, which
- * also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
-
- return e_mail_reader_get_alert_sink (reader);
-}
-
static EMailBackend *
mail_shell_content_get_backend (EMailReader *reader)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
return e_mail_reader_get_backend (reader);
}
@@ -308,13 +298,13 @@ mail_shell_content_get_backend (EMailReader *reader)
static EMFormatHTML *
mail_shell_content_get_formatter (EMailReader *reader)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
return e_mail_reader_get_formatter (reader);
}
@@ -322,13 +312,13 @@ mail_shell_content_get_formatter (EMailReader *reader)
static gboolean
mail_shell_content_get_hide_deleted (EMailReader *reader)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
return e_mail_reader_get_hide_deleted (reader);
}
@@ -336,13 +326,13 @@ mail_shell_content_get_hide_deleted (EMailReader *reader)
static GtkWidget *
mail_shell_content_get_message_list (EMailReader *reader)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
return e_mail_reader_get_message_list (reader);
}
@@ -350,58 +340,58 @@ mail_shell_content_get_message_list (EMailReader *reader)
static GtkMenu *
mail_shell_content_get_popup_menu (EMailReader *reader)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
return e_mail_reader_get_popup_menu (reader);
}
-static GtkWindow *
-mail_shell_content_get_window (EMailReader *reader)
+static EPreviewPane *
+mail_shell_content_get_preview_pane (EMailReader *reader)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
- return e_mail_reader_get_window (reader);
+ return e_mail_reader_get_preview_pane (reader);
}
-static void
-mail_shell_content_set_folder (EMailReader *reader,
- CamelFolder *folder)
+static GtkWindow *
+mail_shell_content_get_window (EMailReader *reader)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
- return e_mail_reader_set_folder (reader, folder);
+ return e_mail_reader_get_window (reader);
}
static void
-mail_shell_content_show_search_bar (EMailReader *reader)
+mail_shell_content_set_folder (EMailReader *reader,
+ CamelFolder *folder)
{
- EMailShellContentPrivate *priv;
+ EMailShellContent *mail_shell_content;
- priv = E_MAIL_SHELL_CONTENT (reader)->priv;
+ mail_shell_content = E_MAIL_SHELL_CONTENT (reader);
/* Forward this to our internal EMailView, which
* also implements the EMailReader interface. */
- reader = E_MAIL_READER (priv->mail_view);
+ reader = E_MAIL_READER (mail_shell_content->priv->mail_view);
- e_mail_reader_show_search_bar (reader);
+ return e_mail_reader_set_folder (reader, folder);
}
static void
@@ -456,9 +446,8 @@ mail_shell_content_class_init (EMailShellContentClass *class)
static void
mail_shell_content_init (EMailShellContent *mail_shell_content)
{
- mail_shell_content->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- mail_shell_content, E_TYPE_MAIL_SHELL_CONTENT,
- EMailShellContentPrivate);
+ mail_shell_content->priv =
+ E_MAIL_SHELL_CONTENT_GET_PRIVATE (mail_shell_content);
/* Postpone widget construction until we have a shell view. */
}
@@ -473,15 +462,14 @@ static void
mail_shell_content_reader_init (EMailReaderInterface *interface)
{
interface->get_action_group = mail_shell_content_get_action_group;
- interface->get_alert_sink = mail_shell_content_get_alert_sink;
interface->get_backend = mail_shell_content_get_backend;
interface->get_formatter = mail_shell_content_get_formatter;
interface->get_hide_deleted = mail_shell_content_get_hide_deleted;
interface->get_message_list = mail_shell_content_get_message_list;
interface->get_popup_menu = mail_shell_content_get_popup_menu;
+ interface->get_preview_pane = mail_shell_content_get_preview_pane;
interface->get_window = mail_shell_content_get_window;
interface->set_folder = mail_shell_content_set_folder;
- interface->show_search_bar = mail_shell_content_show_search_bar;
interface->open_selected_mail = mail_shell_content_open_selected_mail;
}
diff --git a/modules/mdn/Makefile.am b/modules/mdn/Makefile.am
new file mode 100644
index 0000000000..16976b54c1
--- /dev/null
+++ b/modules/mdn/Makefile.am
@@ -0,0 +1,36 @@
+module_LTLIBRARIES = libevolution-module-mdn.la
+
+libevolution_module_mdn_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/widgets \
+ -DG_LOG_DOMAIN=\"evolution-mdn\" \
+ $(EVOLUTION_DATA_SERVER_CFLAGS) \
+ $(GNOME_PLATFORM_CFLAGS) \
+ $(GTKHTML_CFLAGS)
+
+libevolution_module_mdn_la_SOURCES = \
+ evolution-mdn.c
+
+libevolution_module_mdn_la_LIBADD = \
+ $(top_builddir)/mail/libevolution-mail.la \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/shell/libeshell.la \
+ $(EVOLUTION_DATA_SERVER_LIBS) \
+ $(GNOME_PLATFORM_LIBS) \
+ $(GTKHTML_LIBS)
+
+libevolution_module_mdn_la_LDFLAGS = \
+ -module -avoid-version $(NO_UNDEFINED)
+
+error_DATA = evolution-mdn.error
+errordir = $(privdatadir)/errors
+@EVO_PLUGIN_RULE@
+
+BUILT_SOURCES = $(error_DATA)
+
+CLEANFILES = $(BUILT_SOURCES)
+
+EXTRA_DIST = evolution-mdn.error.xml
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/mdn/evolution-mdn.c b/modules/mdn/evolution-mdn.c
new file mode 100644
index 0000000000..4311ab73bf
--- /dev/null
+++ b/modules/mdn/evolution-mdn.c
@@ -0,0 +1,569 @@
+/*
+ * evolution-mdn.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include <config.h>
+#include <string.h>
+#include <glib/gi18n-lib.h>
+
+#include <libebackend/e-extension.h>
+
+#include <e-util/e-alert-dialog.h>
+#include <e-util/e-account-utils.h>
+
+#include <mail/em-utils.h>
+#include <mail/e-mail-local.h>
+#include <mail/e-mail-reader.h>
+#include <mail/mail-send-recv.h>
+#include <mail/em-composer-utils.h>
+#include <mail/e-mail-folder-utils.h>
+
+#define MDN_USER_FLAG "receipt-handled"
+
+typedef EExtension EMdn;
+typedef EExtensionClass EMdnClass;
+
+typedef struct _MdnContext MdnContext;
+
+struct _MdnContext {
+ EAccount *account;
+ EMailReader *reader;
+ CamelFolder *folder;
+ CamelMessageInfo *info;
+ CamelMimeMessage *message;
+ gchar *notify_to;
+};
+
+typedef enum {
+ MDN_ACTION_MODE_MANUAL,
+ MDN_ACTION_MODE_AUTOMATIC
+} MdnActionMode;
+
+typedef enum {
+ MDN_SENDING_MODE_MANUAL,
+ MDN_SENDING_MODE_AUTOMATIC
+} MdnSendingMode;
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType e_mdn_get_type (void);
+
+G_DEFINE_DYNAMIC_TYPE (EMdn, e_mdn, E_TYPE_EXTENSION)
+
+static void
+mdn_context_free (MdnContext *context)
+{
+ if (context->info != NULL)
+ camel_folder_free_message_info (
+ context->folder, context->info);
+
+ g_object_unref (context->account);
+ g_object_unref (context->reader);
+ g_object_unref (context->folder);
+ g_object_unref (context->message);
+
+ g_free (context->notify_to);
+
+ g_slice_free (MdnContext, context);
+}
+
+static void
+mdn_submit_alert (EMailReader *reader,
+ EAlert *alert)
+{
+ EPreviewPane *preview_pane;
+
+ /* Make sure alerts are shown in the preview pane and not
+ * wherever e_mail_reader_get_alert_sink() might show it. */
+ preview_pane = e_mail_reader_get_preview_pane (reader);
+ e_alert_sink_submit_alert (E_ALERT_SINK (preview_pane), alert);
+}
+
+static gchar *
+mdn_get_notify_to (CamelMimeMessage *message)
+{
+ CamelMedium *medium;
+ const gchar *address;
+ const gchar *header_name;
+
+ medium = CAMEL_MEDIUM (message);
+ header_name = "Disposition-Notification-To";
+ address = camel_medium_get_header (medium, header_name);
+
+ /* TODO Should probably decode/format the address,
+ * since it could be in RFC 2047 format. */
+ if (address != NULL)
+ while (camel_mime_is_lwsp (*address))
+ address++;
+
+ return g_strdup (address);
+}
+
+static gchar *
+mdn_get_disposition (MdnActionMode action_mode,
+ MdnSendingMode sending_mode)
+{
+ GString *string;
+
+ string = g_string_sized_new (64);
+
+ switch (action_mode) {
+ case MDN_ACTION_MODE_MANUAL:
+ g_string_append (string, "manual-action");
+ break;
+ case MDN_ACTION_MODE_AUTOMATIC:
+ g_string_append (string, "automatic-action");
+ break;
+ default:
+ g_warn_if_reached ();
+ }
+
+ g_string_append_c (string, '/');
+
+ switch (sending_mode) {
+ case MDN_SENDING_MODE_MANUAL:
+ g_string_append (string, "MDN-sent-manually");
+ break;
+ case MDN_SENDING_MODE_AUTOMATIC:
+ g_string_append (string, "MDN-sent-automatically");
+ break;
+ default:
+ g_warn_if_reached ();
+ }
+
+ g_string_append (string, ";displayed");
+
+ return g_string_free (string, FALSE);
+}
+
+static void
+mdn_receipt_done (CamelFolder *folder,
+ GAsyncResult *result,
+ EMailBackend *backend)
+{
+ /* FIXME Poor error handling. */
+ if (e_mail_folder_append_message_finish (folder, result, NULL, NULL))
+ mail_send (backend);
+
+ g_object_unref (backend);
+}
+
+static void
+mdn_notify_sender (EAccount *account,
+ EMailReader *reader,
+ CamelFolder *folder,
+ CamelMimeMessage *message,
+ CamelMessageInfo *info,
+ const gchar *notify_to,
+ MdnActionMode action_mode,
+ MdnSendingMode sending_mode)
+{
+ /* See RFC 3798 for a description of message receipts. */
+
+ CamelMimeMessage *receipt;
+ CamelMultipart *body;
+ CamelMimePart *part;
+ CamelMedium *medium;
+ CamelDataWrapper *receipt_text, *receipt_data;
+ CamelContentType *type;
+ CamelInternetAddress *address;
+ CamelStream *stream;
+ CamelFolder *out_folder;
+ CamelMessageInfo *receipt_info;
+ EMailBackend *backend;
+ const gchar *message_id;
+ const gchar *message_date;
+ const gchar *message_subject;
+ gchar *fake_msgid;
+ gchar *hostname;
+ gchar *self_address;
+ gchar *receipt_subject;
+ gchar *transport_uid;
+ gchar *disposition;
+ gchar *recipient;
+ gchar *content;
+ gchar *ua;
+
+ backend = e_mail_reader_get_backend (reader);
+
+ /* Tag the message immediately even though we haven't actually sent
+ * the read receipt yet. Not a big deal if we fail to send it, and
+ * we don't want to keep badgering the user about it. */
+ camel_message_info_set_user_flag (info, MDN_USER_FLAG, TRUE);
+
+ receipt = camel_mime_message_new ();
+ body = camel_multipart_new ();
+
+ medium = CAMEL_MEDIUM (message);
+ message_id = camel_medium_get_header (medium, "Message-ID");
+ message_date = camel_medium_get_header (medium, "Date");
+ message_subject = camel_mime_message_get_subject (message);
+
+ if (message_id == NULL)
+ message_id = "";
+
+ if (message_date == NULL)
+ message_date = "";
+
+ /* Collect information for the receipt. */
+
+ /* We use camel_header_msgid_generate() to get a canonical
+ * hostname, then skip the part leading to '@' */
+ fake_msgid = camel_header_msgid_generate ();
+ hostname = strchr (fake_msgid, '@');
+ hostname++;
+
+ self_address = account->id->address;
+
+ /* Create toplevel container. */
+ camel_data_wrapper_set_mime_type (
+ CAMEL_DATA_WRAPPER (body),
+ "multipart/report;"
+ "report-type=\"disposition-notification\"");
+ camel_multipart_set_boundary (body, NULL);
+
+ /* Create textual receipt. */
+
+ receipt_text = camel_data_wrapper_new ();
+
+ type = camel_content_type_new ("text", "plain");
+ camel_content_type_set_param (type, "format", "flowed");
+ camel_content_type_set_param (type, "charset", "UTF-8");
+ camel_data_wrapper_set_mime_type_field (receipt_text, type);
+ camel_content_type_unref (type);
+
+ content = g_strdup_printf (
+ /* Translators: First %s is an email address, second %s
+ * is the subject of the email, third %s is the date. */
+ _("Your message to %s about \"%s\" on %s has been read."),
+ self_address, message_subject, message_date);
+ stream = camel_stream_mem_new ();
+ camel_stream_write_string (stream, content, NULL, NULL);
+ camel_data_wrapper_construct_from_stream_sync (
+ receipt_text, stream, NULL, NULL);
+ g_object_unref (stream);
+ g_free (content);
+
+ part = camel_mime_part_new ();
+ camel_medium_set_content (CAMEL_MEDIUM (part), receipt_text);
+ camel_mime_part_set_encoding (
+ part, CAMEL_TRANSFER_ENCODING_QUOTEDPRINTABLE);
+ camel_multipart_add_part (body, part);
+ g_object_unref (part);
+
+ g_object_unref (receipt_text);
+
+ /* Create the machine-readable receipt. */
+
+ receipt_data = camel_data_wrapper_new ();
+
+ ua = g_strdup_printf (
+ "%s; %s", hostname, "Evolution "
+ VERSION SUB_VERSION " " VERSION_COMMENT);
+ recipient = g_strdup_printf ("rfc822; %s", self_address);
+ disposition = mdn_get_disposition (action_mode, sending_mode);
+
+ type = camel_content_type_new ("message", "disposition-notification");
+ camel_data_wrapper_set_mime_type_field (receipt_data, type);
+ camel_content_type_unref (type);
+
+ content = g_strdup_printf (
+ "Reporting-UA: %s\n"
+ "Final-Recipient: %s\n"
+ "Original-Message-ID: %s\n"
+ "Disposition: %s\n",
+ ua, recipient, message_id, disposition);
+ stream = camel_stream_mem_new ();
+ camel_stream_write_string (stream, content, NULL, NULL);
+ camel_data_wrapper_construct_from_stream_sync (
+ receipt_data, stream, NULL, NULL);
+ g_object_unref (stream);
+ g_free (content);
+
+ g_free (ua);
+ g_free (recipient);
+ g_free (fake_msgid);
+ g_free (disposition);
+
+ part = camel_mime_part_new ();
+ camel_medium_set_content (CAMEL_MEDIUM (part), receipt_data);
+ camel_mime_part_set_encoding (part, CAMEL_TRANSFER_ENCODING_7BIT);
+ camel_multipart_add_part (body, part);
+ g_object_unref (part);
+
+ g_object_unref (receipt_data);
+
+ /* Finish creating the message. */
+
+ camel_medium_set_content (
+ CAMEL_MEDIUM (receipt), CAMEL_DATA_WRAPPER (body));
+ g_object_unref (body);
+
+ receipt_subject = g_strdup_printf (
+ /* Translators: %s is the subject of the email message. */
+ _("Delivery Notification for \"%s\""), message_subject);
+ camel_mime_message_set_subject (receipt, receipt_subject);
+ g_free (receipt_subject);
+
+ address = camel_internet_address_new ();
+ camel_address_decode (CAMEL_ADDRESS (address), self_address);
+ camel_mime_message_set_from (receipt, address);
+ g_object_unref (address);
+
+ address = camel_internet_address_new ();
+ camel_address_decode (CAMEL_ADDRESS (address), notify_to);
+ camel_mime_message_set_recipients (
+ receipt, CAMEL_RECIPIENT_TYPE_TO, address);
+ g_object_unref (address);
+
+ transport_uid = g_strconcat (
+ account->uid, "-transport", NULL);
+
+ camel_medium_set_header (
+ CAMEL_MEDIUM (receipt),
+ "Return-Path", "<>");
+ camel_medium_set_header (
+ CAMEL_MEDIUM (receipt),
+ "X-Evolution-Account",
+ account->uid);
+ camel_medium_set_header (
+ CAMEL_MEDIUM (receipt),
+ "X-Evolution-Transport",
+ transport_uid);
+ camel_medium_set_header (
+ CAMEL_MEDIUM (receipt),
+ "X-Evolution-Fcc",
+ account->sent_folder_uri);
+
+ /* RFC 3834, Section 5 describes this header. */
+ camel_medium_set_header (
+ CAMEL_MEDIUM (receipt),
+ "Auto-Submitted", "auto-replied");
+
+ g_free (transport_uid);
+
+ /* Send the receipt. */
+ receipt_info = camel_message_info_new (NULL);
+ out_folder = e_mail_local_get_folder (E_MAIL_LOCAL_FOLDER_OUTBOX);
+ camel_message_info_set_flags (
+ receipt_info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
+
+ /* FIXME Pass a GCancellable. */
+ e_mail_folder_append_message (
+ out_folder, receipt, receipt_info, G_PRIORITY_DEFAULT,
+ NULL, (GAsyncReadyCallback) mdn_receipt_done,
+ g_object_ref (backend));
+
+ camel_message_info_free (receipt_info);
+}
+
+static void
+mdn_notify_action_cb (GtkAction *action,
+ MdnContext *context)
+{
+ mdn_notify_sender (
+ context->account,
+ context->reader,
+ context->folder,
+ context->message,
+ context->info,
+ context->notify_to,
+ MDN_ACTION_MODE_MANUAL,
+ MDN_SENDING_MODE_MANUAL);
+
+ /* Make sure the newly-added user flag gets saved. */
+ camel_folder_free_message_info (context->folder, context->info);
+ context->info = NULL;
+}
+
+static void
+mdn_message_loaded_cb (EMailReader *reader,
+ const gchar *message_uid,
+ CamelMimeMessage *message,
+ EMdn *extension)
+{
+ EAlert *alert;
+ EAccount *account;
+ CamelFolder *folder;
+ CamelMessageInfo *info;
+ gchar *notify_to = NULL;
+
+ folder = e_mail_reader_get_folder (reader);
+
+ info = camel_folder_get_message_info (folder, message_uid);
+ if (info == NULL)
+ return;
+
+ if (camel_message_info_user_flag (info, MDN_USER_FLAG)) {
+ alert = e_alert_new ("mdn:sender-notified", NULL);
+ mdn_submit_alert (reader, alert);
+ g_object_unref (alert);
+ goto exit;
+ }
+
+ notify_to = mdn_get_notify_to (message);
+ if (notify_to == NULL)
+ goto exit;
+
+ account = em_utils_guess_account_with_recipients (message, folder);
+ if (account == NULL)
+ goto exit;
+
+ if (account->receipt_policy == E_ACCOUNT_RECEIPT_ASK) {
+ MdnContext *context;
+ GtkAction *action;
+ gchar *tooltip;
+
+ context = g_slice_new0 (MdnContext);
+ context->account = g_object_ref (account);
+ context->reader = g_object_ref (reader);
+ context->folder = g_object_ref (folder);
+ context->message = g_object_ref (message);
+ context->info = camel_message_info_ref (info);
+
+ context->notify_to = notify_to;
+ notify_to = NULL;
+
+ tooltip = g_strdup_printf (
+ _("Send a read receipt to '%s'"),
+ context->notify_to);
+
+ action = gtk_action_new (
+ "notify-sender", /* name doesn't matter */
+ _("_Notify Sender"),
+ tooltip, NULL);
+
+ g_signal_connect_data (
+ action, "activate",
+ G_CALLBACK (mdn_notify_action_cb),
+ context,
+ (GClosureNotify) mdn_context_free,
+ (GConnectFlags) 0);
+
+ alert = e_alert_new ("mdn:notify-sender", NULL);
+ e_alert_add_action (alert, action, GTK_RESPONSE_APPLY);
+ mdn_submit_alert (reader, alert);
+ g_object_unref (alert);
+
+ g_object_unref (action);
+ g_free (tooltip);
+ }
+
+exit:
+ camel_folder_free_message_info (folder, info);
+ g_free (notify_to);
+}
+
+static void
+mdn_message_seen_cb (EMailReader *reader,
+ const gchar *message_uid,
+ CamelMimeMessage *message,
+ EMdn *extension)
+{
+ EAccount *account;
+ CamelFolder *folder;
+ CamelMessageInfo *info;
+ gchar *notify_to = NULL;
+
+ folder = e_mail_reader_get_folder (reader);
+
+ info = camel_folder_get_message_info (folder, message_uid);
+ if (info == NULL)
+ return;
+
+ if (camel_message_info_user_flag (info, MDN_USER_FLAG))
+ goto exit;
+
+ notify_to = mdn_get_notify_to (message);
+ if (notify_to == NULL)
+ goto exit;
+
+ account = em_utils_guess_account_with_recipients (message, folder);
+ if (account == NULL)
+ goto exit;
+
+ if (account->receipt_policy == E_ACCOUNT_RECEIPT_ALWAYS)
+ mdn_notify_sender (
+ account, reader, folder,
+ message, info, notify_to,
+ MDN_ACTION_MODE_AUTOMATIC,
+ MDN_SENDING_MODE_AUTOMATIC);
+
+exit:
+ camel_folder_free_message_info (folder, info);
+ g_free (notify_to);
+}
+
+static void
+mdn_constructed (GObject *object)
+{
+ EExtension *extension;
+ EExtensible *extensible;
+
+ extension = E_EXTENSION (object);
+ extensible = e_extension_get_extensible (extension);
+ g_return_if_fail (E_IS_MAIL_READER (extensible));
+
+ g_signal_connect (
+ extensible, "message-loaded",
+ G_CALLBACK (mdn_message_loaded_cb), extension);
+
+ g_signal_connect (
+ extensible, "message-seen",
+ G_CALLBACK (mdn_message_seen_cb), extension);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_mdn_parent_class)->constructed (object);
+}
+
+static void
+e_mdn_class_init (EMdnClass *class)
+{
+ GObjectClass *object_class;
+ EExtensionClass *extension_class;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = mdn_constructed;
+
+ extension_class = E_EXTENSION_CLASS (class);
+ extension_class->extensible_type = E_TYPE_MAIL_READER;
+}
+
+static void
+e_mdn_class_finalize (EMdnClass *class)
+{
+}
+
+static void
+e_mdn_init (EMdn *extension)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ e_mdn_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
+
diff --git a/modules/mdn/evolution-mdn.error.xml b/modules/mdn/evolution-mdn.error.xml
new file mode 100644
index 0000000000..4607d5be7a
--- /dev/null
+++ b/modules/mdn/evolution-mdn.error.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<error-list domain="mdn">
+ <error id="notify-sender" type="question">
+ <_primary>Sender wants to be notified when you have read this message.</_primary>
+ </error>
+ <error id="sender-notified" type="info">
+ <_primary>Sender has been notified that you have read this message.</_primary>
+ </error>
+</error-list>
diff --git a/modules/offline-alert/evolution-offline-alert.error.xml b/modules/offline-alert/evolution-offline-alert.error.xml
index a6362da42e..782ee8d635 100644
--- a/modules/offline-alert/evolution-offline-alert.error.xml
+++ b/modules/offline-alert/evolution-offline-alert.error.xml
@@ -3,11 +3,9 @@
<error id="offline" type="info">
<_primary>Evolution is currently offline.</_primary>
<_secondary>Click 'Work Online' to return to online mode.</_secondary>
- <button _label="_Dismiss" response="GTK_RESPONSE_OK"/>
</error>
<error id="no-network" type="info">
<_primary>Evolution is currently offline due to a network outage.</_primary>
<_secondary>Evolution will return to online mode once a network connection is established.</_secondary>
- <button _label="_Dismiss" response="GTK_RESPONSE_OK"/>
</error>
</error-list>
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index f028528575..29329d284e 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -1070,7 +1070,6 @@ mail_to_event (ECalClientSourceType source_type,
CamelFolder *folder;
GPtrArray *uids;
ESourceList *source_list = NULL;
- gboolean done = FALSE;
GSList *groups, *p;
ESource *source = NULL, *default_source = NULL;
GError *error = NULL;
@@ -1103,7 +1102,7 @@ mail_to_event (ECalClientSourceType source_type,
/* Find 'Default' source. When no source is default, ask user to pick one */
groups = e_source_list_peek_groups (source_list);
- for (p = groups; p != NULL && !done; p = p->next) {
+ for (p = groups; p != NULL; p = p->next) {
ESourceGroup *group = E_SOURCE_GROUP (p->data);
GSList *sources, *q;
@@ -1113,8 +1112,6 @@ mail_to_event (ECalClientSourceType source_type,
if (s && e_source_get_property (s, "default") && !e_source_get_readonly (s)) {
default_source = s;
- done = TRUE;
- break;
}
if (s && !e_source_get_readonly (s)) {
@@ -1124,7 +1121,7 @@ mail_to_event (ECalClientSourceType source_type,
}
}
- if (!default_source && writable_sources > 1) {
+ if (writable_sources > 1) {
GtkWidget *dialog;
/* ask the user which tasks list to save to */
@@ -1142,7 +1139,7 @@ mail_to_event (ECalClientSourceType source_type,
gtk_widget_destroy (dialog);
} else if (!source && default_source) {
source = default_source;
- } else {
+ } else if (!source) {
e_notice (NULL, GTK_MESSAGE_ERROR, _("No writable calendar is available."));
g_object_unref (source_list);
diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c
index d80ee25753..f9d97fcf68 100644
--- a/plugins/save-calendar/csv-format.c
+++ b/plugins/save-calendar/csv-format.c
@@ -414,7 +414,7 @@ do_save_calendar_csv (FormatHandler *handler,
}
for (iter = objects; iter; iter = iter->next) {
- ECalComponent *comp = objects->data;
+ ECalComponent *comp = iter->data;
gchar *delimiter_temp = NULL;
const gchar *temp_constchar;
GSList *temp_list;
diff --git a/plugins/save-calendar/ical-format.c b/plugins/save-calendar/ical-format.c
index f323fed99a..1be8ff1147 100644
--- a/plugins/save-calendar/ical-format.c
+++ b/plugins/save-calendar/ical-format.c
@@ -128,7 +128,7 @@ do_save_calendar_ical (FormatHandler *handler,
tdata.client = source_client;
for (iter = objects; iter; iter = iter->next) {
- icalcomponent *icalcomp = objects->data;
+ icalcomponent *icalcomp = iter->data;
icalcomponent_foreach_tzid (icalcomp, insert_tz_comps, &tdata);
icalcomponent_add_component (top_level, icalcomp);
diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c
index fe2e6d0a1a..d840177dfe 100644
--- a/plugins/save-calendar/rdf-format.c
+++ b/plugins/save-calendar/rdf-format.c
@@ -255,7 +255,7 @@ do_save_calendar_rdf (FormatHandler *handler,
xmlNewChild (fnode, NULL, (const guchar *)"version", (const guchar *)"2.0");
for (iter = objects; iter; iter = iter->next) {
- ECalComponent *comp = objects->data;
+ ECalComponent *comp = iter->data;
const gchar *temp_constchar;
gchar *tmp_str = NULL;
GSList *temp_list;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d8953dbfe9..8632377caf 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -272,6 +272,8 @@ modules/mail/em-composer-prefs.c
modules/mail/em-mailer-prefs.c
modules/mailto-handler/apps-evolution-mail-prompts-checkdefault.schemas.in
modules/mailto-handler/evolution-mailto-handler.c
+modules/mdn/evolution-mdn.c
+modules/mdn/evolution-mdn.error.xml
modules/offline-alert/evolution-offline-alert.error.xml
modules/online-accounts/camel-sasl-xoauth.c
modules/online-accounts/e-online-accounts-google.c
diff --git a/widgets/misc/e-alert-bar.c b/widgets/misc/e-alert-bar.c
index 7ec731e90d..75bf55ff25 100644
--- a/widgets/misc/e-alert-bar.c
+++ b/widgets/misc/e-alert-bar.c
@@ -16,14 +16,15 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include "e-alert-bar.h"
+#include <config.h>
#include <glib/gi18n-lib.h>
+#define E_ALERT_BAR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_ALERT_BAR, EAlertBarPrivate))
+
/* GTK_ICON_SIZE_DIALOG is a tad too big. */
#define ICON_SIZE GTK_ICON_SIZE_DND
@@ -43,19 +44,30 @@ G_DEFINE_TYPE (
GTK_TYPE_INFO_BAR)
static void
+alert_bar_response_close (EAlert *alert)
+{
+ e_alert_response (alert, GTK_RESPONSE_CLOSE);
+}
+
+static void
alert_bar_show_alert (EAlertBar *alert_bar)
{
GtkImage *image;
- GtkLabel *label;
GtkInfoBar *info_bar;
GtkWidget *action_area;
+ GtkWidget *widget;
EAlert *alert;
GList *actions;
GList *children;
GtkMessageType message_type;
+ const gchar *primary_text;
+ const gchar *secondary_text;
const gchar *stock_id;
- const gchar *text;
+ gboolean have_primary_text;
+ gboolean have_secondary_text;
+ gboolean visible;
gint response_id;
+ gchar *markup;
info_bar = GTK_INFO_BAR (alert_bar);
action_area = gtk_info_bar_get_action_area (info_bar);
@@ -71,48 +83,94 @@ alert_bar_show_alert (EAlertBar *alert_bar)
children = g_list_delete_link (children, children);
}
- /* Add new buttons. */
+ /* Add alert-specific buttons. */
actions = e_alert_peek_actions (alert);
while (actions != NULL) {
- GtkWidget *button;
-
/* These actions are already wired to trigger an
* EAlert::response signal when activated, which
* will in turn call gtk_info_bar_response(), so
* we can add buttons directly to the action
* area without knowning their response IDs. */
- button = gtk_button_new ();
+ widget = gtk_button_new ();
gtk_activatable_set_related_action (
- GTK_ACTIVATABLE (button),
+ GTK_ACTIVATABLE (widget),
GTK_ACTION (actions->data));
gtk_box_pack_end (
- GTK_BOX (action_area),
- button, FALSE, FALSE, 0);
+ GTK_BOX (action_area), widget, FALSE, FALSE, 0);
actions = g_list_next (actions);
}
+ /* Add a dismiss button. */
+ widget = gtk_button_new ();
+ gtk_button_set_image (
+ GTK_BUTTON (widget),
+ gtk_image_new_from_stock (
+ GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU));
+ gtk_button_set_relief (
+ GTK_BUTTON (widget), GTK_RELIEF_NONE);
+ gtk_widget_set_tooltip_text (
+ widget, _("Close this message"));
+ gtk_box_pack_end (
+ GTK_BOX (action_area), widget, FALSE, FALSE, 0);
+ gtk_button_box_set_child_non_homogeneous (
+ GTK_BUTTON_BOX (action_area), widget, TRUE);
+ gtk_widget_show (widget);
+
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (alert_bar_response_close), alert);
+
+ primary_text = e_alert_get_primary_text (alert);
+ secondary_text = e_alert_get_secondary_text (alert);
+
+ if (primary_text == NULL)
+ primary_text = "";
+
+ if (secondary_text == NULL)
+ secondary_text = "";
+
+ have_primary_text = (*primary_text != '\0');
+ have_secondary_text = (*secondary_text != '\0');
+
response_id = e_alert_get_default_response (alert);
gtk_info_bar_set_default_response (info_bar, response_id);
message_type = e_alert_get_message_type (alert);
gtk_info_bar_set_message_type (info_bar, message_type);
- text = e_alert_get_primary_text (alert);
- label = GTK_LABEL (alert_bar->priv->primary_label);
- gtk_label_set_text (label, text);
-
- text = e_alert_get_secondary_text (alert);
- label = GTK_LABEL (alert_bar->priv->secondary_label);
- gtk_label_set_text (label, text);
+ widget = alert_bar->priv->primary_label;
+ if (have_primary_text && have_secondary_text)
+ markup = g_markup_printf_escaped (
+ "<b>%s</b>", primary_text);
+ else
+ markup = g_markup_escape_text (primary_text, -1);
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ gtk_widget_set_visible (widget, have_primary_text);
+ g_free (markup);
+
+ widget = alert_bar->priv->secondary_label;
+ if (have_primary_text && have_secondary_text)
+ markup = g_markup_printf_escaped (
+ "<small>%s</small>", secondary_text);
+ else
+ markup = g_markup_escape_text (secondary_text, -1);
+ gtk_label_set_markup (GTK_LABEL (widget), markup);
+ gtk_widget_set_visible (widget, have_secondary_text);
+ g_free (markup);
stock_id = e_alert_get_stock_id (alert);
image = GTK_IMAGE (alert_bar->priv->image);
gtk_image_set_from_stock (image, stock_id, ICON_SIZE);
+ /* Avoid showing an image for one-line alerts,
+ * which are usually questions or informational. */
+ visible = have_primary_text && have_secondary_text;
+ gtk_widget_set_visible (alert_bar->priv->image, visible);
+
gtk_widget_show (GTK_WIDGET (alert_bar));
/* Warnings are generally meant for transient errors.
@@ -130,7 +188,6 @@ alert_bar_response_cb (EAlert *alert,
{
GQueue *queue;
EAlert *head;
- GList *link;
gboolean was_head;
queue = &alert_bar->priv->alerts;
@@ -140,12 +197,8 @@ alert_bar_response_cb (EAlert *alert,
g_signal_handlers_disconnect_by_func (
alert, alert_bar_response_cb, alert_bar);
- /* XXX Would be easier if g_queue_remove() returned a boolean. */
- link = g_queue_find (queue, alert);
- if (link != NULL) {
- g_queue_delete_link (queue, link);
+ if (g_queue_remove (queue, alert))
g_object_unref (alert);
- }
if (g_queue_is_empty (queue))
gtk_widget_hide (GTK_WIDGET (alert_bar));
@@ -161,7 +214,7 @@ alert_bar_dispose (GObject *object)
{
EAlertBarPrivate *priv;
- priv = E_ALERT_BAR (object)->priv;
+ priv = E_ALERT_BAR_GET_PRIVATE (object);
while (!g_queue_is_empty (&priv->alerts)) {
EAlert *alert = g_queue_pop_head (&priv->alerts);
@@ -174,48 +227,37 @@ alert_bar_dispose (GObject *object)
G_OBJECT_CLASS (e_alert_bar_parent_class)->dispose (object);
}
-static GtkSizeRequestMode
-alert_bar_get_request_mode (GtkWidget *widget)
-{
- /* GtkHBox does width-for-height by default. But we
- * want the alert bar to be as short as possible. */
- return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
-}
-
static void
-e_alert_bar_class_init (EAlertBarClass *class)
+alert_bar_constructed (GObject *object)
{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
+ EAlertBarPrivate *priv;
+ GtkInfoBar *info_bar;
+ GtkWidget *action_area;
+ GtkWidget *content_area;
+ GtkWidget *container;
+ GtkWidget *widget;
- g_type_class_add_private (class, sizeof (EAlertBarPrivate));
+ priv = E_ALERT_BAR_GET_PRIVATE (object);
- object_class = G_OBJECT_CLASS (class);
- object_class->dispose = alert_bar_dispose;
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_alert_bar_parent_class)->constructed (object);
- widget_class = GTK_WIDGET_CLASS (class);
- widget_class->get_request_mode = alert_bar_get_request_mode;
-}
+ g_queue_init (&priv->alerts);
-static void
-e_alert_bar_init (EAlertBar *alert_bar)
-{
- GtkWidget *container;
- GtkWidget *widget;
- PangoAttribute *attr;
- PangoAttrList *attr_list;
-
- alert_bar->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- alert_bar, E_TYPE_ALERT_BAR, EAlertBarPrivate);
+ info_bar = GTK_INFO_BAR (object);
+ action_area = gtk_info_bar_get_action_area (info_bar);
+ content_area = gtk_info_bar_get_content_area (info_bar);
- g_queue_init (&alert_bar->priv->alerts);
+ gtk_orientable_set_orientation (
+ GTK_ORIENTABLE (action_area), GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_set_valign (action_area, GTK_ALIGN_START);
- container = gtk_info_bar_get_content_area (GTK_INFO_BAR (alert_bar));
+ container = content_area;
widget = gtk_image_new ();
gtk_misc_set_alignment (GTK_MISC (widget), 0.5, 0.0);
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- alert_bar->priv->image = widget;
+ priv->image = widget;
gtk_widget_show (widget);
widget = gtk_vbox_new (FALSE, 12);
@@ -224,35 +266,53 @@ e_alert_bar_init (EAlertBar *alert_bar)
container = widget;
- attr_list = pango_attr_list_new ();
- attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
- pango_attr_list_insert (attr_list, attr);
-
widget = gtk_label_new (NULL);
- gtk_label_set_attributes (GTK_LABEL (widget), attr_list);
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
gtk_label_set_selectable (GTK_LABEL (widget), TRUE);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- alert_bar->priv->primary_label = widget;
+ priv->primary_label = widget;
gtk_widget_show (widget);
- pango_attr_list_unref (attr_list);
-
- attr_list = pango_attr_list_new ();
- attr = pango_attr_scale_new (PANGO_SCALE_SMALL);
- pango_attr_list_insert (attr_list, attr);
-
widget = gtk_label_new (NULL);
- gtk_label_set_attributes (GTK_LABEL (widget), attr_list);
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
gtk_label_set_selectable (GTK_LABEL (widget), TRUE);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
- alert_bar->priv->secondary_label = widget;
+ priv->secondary_label = widget;
gtk_widget_show (widget);
- pango_attr_list_unref (attr_list);
+ container = action_area;
+}
+
+static GtkSizeRequestMode
+alert_bar_get_request_mode (GtkWidget *widget)
+{
+ /* GtkHBox does width-for-height by default. But we
+ * want the alert bar to be as short as possible. */
+ return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
+}
+
+static void
+e_alert_bar_class_init (EAlertBarClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ g_type_class_add_private (class, sizeof (EAlertBarPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = alert_bar_dispose;
+ object_class->constructed = alert_bar_constructed;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->get_request_mode = alert_bar_get_request_mode;
+}
+
+static void
+e_alert_bar_init (EAlertBar *alert_bar)
+{
+ alert_bar->priv = E_ALERT_BAR_GET_PRIVATE (alert_bar);
}
GtkWidget *
@@ -261,6 +321,20 @@ e_alert_bar_new (void)
return g_object_new (E_TYPE_ALERT_BAR, NULL);
}
+void
+e_alert_bar_clear (EAlertBar *alert_bar)
+{
+ GQueue *queue;
+ EAlert *alert;
+
+ g_return_if_fail (E_IS_ALERT_BAR (alert_bar));
+
+ queue = &alert_bar->priv->alerts;
+
+ while ((alert = g_queue_pop_head (queue)) != NULL)
+ alert_bar_response_close (alert);
+}
+
typedef struct {
gboolean found;
EAlert *looking_for;
diff --git a/widgets/misc/e-alert-bar.h b/widgets/misc/e-alert-bar.h
index fc23dec8bf..f1e84b5016 100644
--- a/widgets/misc/e-alert-bar.h
+++ b/widgets/misc/e-alert-bar.h
@@ -58,6 +58,7 @@ struct _EAlertBarClass {
GType e_alert_bar_get_type (void);
GtkWidget * e_alert_bar_new (void);
+void e_alert_bar_clear (EAlertBar *alert_bar);
void e_alert_bar_add_alert (EAlertBar *alert_bar,
EAlert *alert);
diff --git a/widgets/misc/e-preview-pane.c b/widgets/misc/e-preview-pane.c
index 1a7a319ea4..42f338c75b 100644
--- a/widgets/misc/e-preview-pane.c
+++ b/widgets/misc/e-preview-pane.c
@@ -27,7 +27,13 @@
#include <gdk/gdkkeysyms.h>
+#include <e-util/e-alert-sink.h>
+#include <e-util/e-alert-dialog.h>
+
+#include "e-alert-bar.h"
+
struct _EPreviewPanePrivate {
+ GtkWidget *alert_bar;
GtkWidget *web_view;
GtkWidget *search_bar;
};
@@ -45,10 +51,17 @@ enum {
static guint signals[LAST_SIGNAL];
-G_DEFINE_TYPE (
+/* Forward Declarations */
+static void e_preview_pane_alert_sink_init
+ (EAlertSinkInterface *interface);
+
+G_DEFINE_TYPE_WITH_CODE (
EPreviewPane,
e_preview_pane,
- GTK_TYPE_VBOX)
+ GTK_TYPE_VBOX,
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_ALERT_SINK,
+ e_preview_pane_alert_sink_init))
static void
preview_pane_set_web_view (EPreviewPane *preview_pane,
@@ -107,6 +120,11 @@ preview_pane_dispose (GObject *object)
priv = E_PREVIEW_PANE (object)->priv;
+ if (priv->alert_bar != NULL) {
+ g_object_unref (priv->alert_bar);
+ priv->alert_bar = NULL;
+ }
+
if (priv->search_bar != NULL) {
g_object_unref (priv->search_bar);
priv->search_bar = NULL;
@@ -129,6 +147,11 @@ preview_pane_constructed (GObject *object)
priv = E_PREVIEW_PANE (object)->priv;
+ widget = e_alert_bar_new ();
+ gtk_box_pack_start (GTK_BOX (object), widget, FALSE, FALSE, 0);
+ priv->alert_bar = g_object_ref (widget);
+ /* EAlertBar controls its own visibility. */
+
widget = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (widget),
@@ -160,6 +183,35 @@ preview_pane_show_search_bar (EPreviewPane *preview_pane)
}
static void
+preview_pane_submit_alert (EAlertSink *alert_sink,
+ EAlert *alert)
+{
+ EPreviewPane *preview_pane;
+ EAlertBar *alert_bar;
+ GtkWidget *dialog;
+ GtkWindow *parent;
+
+ preview_pane = E_PREVIEW_PANE (alert_sink);
+ alert_bar = E_ALERT_BAR (preview_pane->priv->alert_bar);
+
+ switch (e_alert_get_message_type (alert)) {
+ case GTK_MESSAGE_INFO:
+ case GTK_MESSAGE_WARNING:
+ case GTK_MESSAGE_QUESTION:
+ case GTK_MESSAGE_ERROR:
+ e_alert_bar_add_alert (alert_bar, alert);
+ break;
+
+ default:
+ parent = GTK_WINDOW (alert_sink);
+ dialog = e_alert_dialog_new (parent, alert);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ break;
+ }
+}
+
+static void
e_preview_pane_class_init (EPreviewPaneClass *class)
{
GObjectClass *object_class;
@@ -213,6 +265,12 @@ e_preview_pane_class_init (EPreviewPaneClass *class)
}
static void
+e_preview_pane_alert_sink_init (EAlertSinkInterface *interface)
+{
+ interface->submit_alert = preview_pane_submit_alert;
+}
+
+static void
e_preview_pane_init (EPreviewPane *preview_pane)
{
preview_pane->priv = G_TYPE_INSTANCE_GET_PRIVATE (
@@ -248,6 +306,14 @@ e_preview_pane_get_search_bar (EPreviewPane *preview_pane)
}
void
+e_preview_pane_clear_alerts (EPreviewPane *preview_pane)
+{
+ g_return_if_fail (E_IS_PREVIEW_PANE (preview_pane));
+
+ e_alert_bar_clear (E_ALERT_BAR (preview_pane->priv->alert_bar));
+}
+
+void
e_preview_pane_show_search_bar (EPreviewPane *preview_pane)
{
g_return_if_fail (E_IS_PREVIEW_PANE (preview_pane));
diff --git a/widgets/misc/e-preview-pane.h b/widgets/misc/e-preview-pane.h
index bd965ed307..1313193d97 100644
--- a/widgets/misc/e-preview-pane.h
+++ b/widgets/misc/e-preview-pane.h
@@ -67,6 +67,7 @@ GType e_preview_pane_get_type (void);
GtkWidget * e_preview_pane_new (EWebView *web_view);
EWebView * e_preview_pane_get_web_view (EPreviewPane *preview_pane);
ESearchBar * e_preview_pane_get_search_bar (EPreviewPane *preview_pane);
+void e_preview_pane_clear_alerts (EPreviewPane *preview_pane);
void e_preview_pane_show_search_bar (EPreviewPane *preview_pane);
G_END_DECLS