diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/Makefile.am | 349 | ||||
-rw-r--r-- | mail/e-mail-shell-content.c | 347 | ||||
-rw-r--r-- | mail/e-mail-shell-content.h | 77 | ||||
-rw-r--r-- | mail/e-mail-shell-module-migrate.c (renamed from mail/em-migrate.c) | 501 | ||||
-rw-r--r-- | mail/e-mail-shell-module-migrate.h (renamed from mail/em-migrate.h) | 29 | ||||
-rw-r--r-- | mail/e-mail-shell-module.c | 175 | ||||
-rw-r--r-- | mail/e-mail-shell-module.h | 41 | ||||
-rw-r--r-- | mail/e-mail-shell-sidebar.c | 139 | ||||
-rw-r--r-- | mail/e-mail-shell-sidebar.h | 67 | ||||
-rw-r--r-- | mail/e-mail-shell-view-actions.c | 1713 | ||||
-rw-r--r-- | mail/e-mail-shell-view-actions.h | 255 | ||||
-rw-r--r-- | mail/e-mail-shell-view-private.c | 126 | ||||
-rw-r--r-- | mail/e-mail-shell-view-private.h | 126 | ||||
-rw-r--r-- | mail/e-mail-shell-view.c | 135 | ||||
-rw-r--r-- | mail/e-mail-shell-view.h | 71 |
15 files changed, 3727 insertions, 424 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am index 23778d569c..e029968a0f 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = default importers +#SUBDIRS = default importers mailincludedir = $(privincludedir)/mail @@ -31,159 +31,159 @@ INCLUDES = \ -DPREFIX=\""$(prefix)"\" \ -DG_LOG_DOMAIN=\"evolution-mail\" -component_LTLIBRARIES = libevolution-mail.la - -# Mail.idl -MAIL_IDL = Evolution-Mail.idl -MAIL_IDL_GENERATED_H = \ - Evolution-Mail.h -MAIL_IDL_GENERATED_C = \ - Evolution-Mail-common.c \ - Evolution-Mail-skels.c \ - Evolution-Mail-stubs.c -MAIL_IDL_GENERATED = $(MAIL_IDL_GENERATED_C) $(MAIL_IDL_GENERATED_H) - -$(MAIL_IDL_GENERATED_H): $(MAIL_IDL) - $(ORBIT_IDL) -I $(top_srcdir) -I $(datadir)/idl $(IDL_INCLUDES) $^ -$(MAIL_IDL_GENERATED_C): $(MAIL_IDL_GENERATED_H) - -# IDL install - -idl_DATA = $(MAIL_IDL) +module_LTLIBRARIES = \ + libevolution-module-mail.la + +libevolution_module_mail_la_SOURCES = \ + e-mail-shell-module.c \ + e-mail-shell-module.h \ + e-mail-shell-module-migrate.c \ + e-mail-shell-module-migrate.h \ + e-mail-shell-content.c \ + e-mail-shell-content.h \ + e-mail-shell-sidebar.c \ + e-mail-shell-sidebar.h \ + e-mail-shell-view.c \ + e-mail-shell-view.h \ + e-mail-shell-view-actions.c \ + e-mail-shell-view-actions.h \ + e-mail-shell-view-private.c \ + e-mail-shell-view-private.h + +libevolution_module_mail_la_LIBADD = \ + $(top_builddir)/shell/libeshell.la # plugin mail api -mailinclude_HEADERS = \ - $(MAIL_IDL_GENERATED_H) \ - em-composer-utils.h \ - em-config.h \ - em-event.h \ - em-folder-browser.h \ - em-folder-tree-model.h \ - em-folder-tree.h \ - em-folder-utils.h \ - em-folder-view.h \ - em-format-hook.h \ - em-format-html-display.h \ - em-format-html-print.h \ - em-format-html.h \ - em-format-quote.h \ - em-format.h \ - em-html-stream.h \ - em-icon-stream.h \ - em-inline-filter.h \ - em-junk-hook.h \ - em-menu.h \ - em-message-browser.h \ - em-popup.h \ - em-stripsig-filter.h \ - em-sync-stream.h \ - em-utils.h \ - mail-autofilter.h \ - mail-component.h \ - mail-config.h \ - mail-mt.h \ - mail-ops.h \ - mail-session.h \ - mail-tools.h \ - message-list.h \ - mail-vfolder.h +#mailinclude_HEADERS = \ +# em-composer-utils.h \ +# em-config.h \ +# em-event.h \ +# em-folder-browser.h \ +# em-folder-tree-model.h \ +# em-folder-tree.h \ +# em-folder-utils.h \ +# em-folder-view.h \ +# em-format-hook.h \ +# em-format-html-display.h \ +# em-format-html-print.h \ +# em-format-html.h \ +# em-format-quote.h \ +# em-format.h \ +# em-html-stream.h \ +# em-icon-stream.h \ +# em-inline-filter.h \ +# em-junk-hook.h \ +# em-menu.h \ +# em-message-browser.h \ +# em-popup.h \ +# em-stripsig-filter.h \ +# em-sync-stream.h \ +# em-utils.h \ +# mail-autofilter.h \ +# mail-component.h \ +# mail-config.h \ +# mail-mt.h \ +# mail-ops.h \ +# mail-session.h \ +# mail-tools.h \ +# message-list.h \ +# mail-vfolder.h # libevolution-mail -libevolution_mail_la_SOURCES = \ - $(MAIL_IDL_GENERATED) \ - $(mailinclude_HEADERS) \ - e-searching-tokenizer.c \ - e-searching-tokenizer.h \ - em-account-editor.c \ - em-account-editor.h \ - em-account-prefs.c \ - em-account-prefs.h \ - em-composer-prefs.c \ - em-composer-prefs.h \ - em-composer-utils.c \ - em-config.c \ - em-event.c \ - em-filter-context.c \ - em-filter-context.h \ - em-filter-editor.c \ - em-filter-editor.h \ - em-filter-folder-element.c \ - em-filter-folder-element.h \ - em-filter-rule.c \ - em-filter-rule.h \ - em-filter-source-element.c \ - em-filter-source-element.h \ - em-folder-browser.c \ - em-folder-properties.c \ - em-folder-properties.h \ - em-folder-selection-button.c \ - em-folder-selection-button.h \ - em-folder-selection.c \ - em-folder-selection.h \ - em-folder-selector.c \ - em-folder-selector.h \ - em-folder-tree-model.c \ - em-folder-tree.c \ - em-folder-utils.c \ - em-folder-view.c \ - em-format-hook.c \ - em-format-html-display.c \ - em-format-html-print.c \ - em-format-html.c \ - em-format-quote.c \ - em-format.c \ - em-html-stream.c \ - em-icon-stream.c \ - em-inline-filter.c \ - em-junk-hook.c \ - em-mailer-prefs.c \ - em-mailer-prefs.h \ - em-menu.c \ - em-message-browser.c \ - em-migrate.c \ - em-migrate.h \ - em-network-prefs.c \ - em-network-prefs.h \ - em-popup.c \ - em-search-context.c \ - em-search-context.h \ - em-stripsig-filter.c \ - em-subscribe-editor.c \ - em-subscribe-editor.h \ - em-sync-stream.c \ - em-utils.c \ - em-vfolder-context.c \ - em-vfolder-context.h \ - em-vfolder-editor.c \ - em-vfolder-editor.h \ - em-vfolder-rule.c \ - em-vfolder-rule.h \ - mail-autofilter.c \ - mail-component-factory.c \ - mail-component.c \ - mail-config-factory.c \ - mail-config-factory.h \ - mail-config.c \ - mail-crypto.c \ - mail-crypto.h \ - mail-folder-cache.c \ - mail-folder-cache.h \ - mail-mt.c \ - mail-ops.c \ - mail-send-recv.c \ - mail-send-recv.h \ - mail-session.c \ - mail-signature-editor.c \ - mail-signature-editor.h \ - mail-tools.c \ - mail-types.h \ - mail-vfolder.c \ - message-list.c \ - message-tag-editor.c \ - message-tag-editor.h \ - message-tag-followup.c \ - message-tag-followup.h +#libevolution_mail_la_SOURCES = \ +# $(mailinclude_HEADERS) \ +# e-searching-tokenizer.c \ +# e-searching-tokenizer.h \ +# em-account-editor.c \ +# em-account-editor.h \ +# em-account-prefs.c \ +# em-account-prefs.h \ +# em-composer-prefs.c \ +# em-composer-prefs.h \ +# em-composer-utils.c \ +# em-config.c \ +# em-event.c \ +# em-filter-context.c \ +# em-filter-context.h \ +# em-filter-editor.c \ +# em-filter-editor.h \ +# em-filter-folder-element.c \ +# em-filter-folder-element.h \ +# em-filter-rule.c \ +# em-filter-rule.h \ +# em-filter-source-element.c \ +# em-filter-source-element.h \ +# em-folder-browser.c \ +# em-folder-properties.c \ +# em-folder-properties.h \ +# em-folder-selection-button.c \ +# em-folder-selection-button.h \ +# em-folder-selection.c \ +# em-folder-selection.h \ +# em-folder-selector.c \ +# em-folder-selector.h \ +# em-folder-tree-model.c \ +# em-folder-tree.c \ +# em-folder-utils.c \ +# em-folder-view.c \ +# em-format-hook.c \ +# em-format-html-display.c \ +# em-format-html-print.c \ +# em-format-html.c \ +# em-format-quote.c \ +# em-format.c \ +# em-html-stream.c \ +# em-icon-stream.c \ +# em-inline-filter.c \ +# em-junk-hook.c \ +# em-mailer-prefs.c \ +# em-mailer-prefs.h \ +# em-menu.c \ +# em-message-browser.c \ +# em-migrate.c \ +# em-migrate.h \ +# em-network-prefs.c \ +# em-network-prefs.h \ +# em-popup.c \ +# em-search-context.c \ +# em-search-context.h \ +# em-stripsig-filter.c \ +# em-subscribe-editor.c \ +# em-subscribe-editor.h \ +# em-sync-stream.c \ +# em-utils.c \ +# em-vfolder-context.c \ +# em-vfolder-context.h \ +# em-vfolder-editor.c \ +# em-vfolder-editor.h \ +# em-vfolder-rule.c \ +# em-vfolder-rule.h \ +# mail-autofilter.c \ +# mail-component-factory.c \ +# mail-component.c \ +# mail-config-factory.c \ +# mail-config-factory.h \ +# mail-config.c \ +# mail-crypto.c \ +# mail-crypto.h \ +# mail-folder-cache.c \ +# mail-folder-cache.h \ +# mail-mt.c \ +# mail-ops.c \ +# mail-send-recv.c \ +# mail-send-recv.h \ +# mail-session.c \ +# mail-signature-editor.c \ +# mail-signature-editor.h \ +# mail-tools.c \ +# mail-types.h \ +# mail-vfolder.c \ +# message-list.c \ +# message-tag-editor.c \ +# message-tag-editor.h \ +# message-tag-followup.c \ +# message-tag-followup.h if ENABLE_SMIME SMIME_LIBS = \ @@ -191,30 +191,30 @@ SMIME_LIBS = \ $(top_builddir)/smime/gui/libevolution-smime.la endif -libevolution_mail_la_LIBADD = \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/shell/libeshell.la \ - $(top_builddir)/composer/libcomposer.la \ - $(top_builddir)/widgets/table/libetable.la \ - $(top_builddir)/widgets/text/libetext.la \ - $(top_builddir)/widgets/misc/libemiscwidgets.la \ - $(top_builddir)/widgets/misc/libefilterbar.la \ - $(top_builddir)/filter/libfilter.la \ - $(top_builddir)/widgets/menus/libmenus.la \ - $(top_builddir)/addressbook/util/libeabutil.la \ - $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \ - $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \ - $(top_builddir)/mail/importers/libevolution-mail-importers.la \ - $(SMIME_LIBS) \ - $(EVOLUTION_MAIL_LIBS) \ - $(GTKHTML_LIBS) \ - $(REGEX_LIBS) \ - $(THREADS_LIBS) - -libevolution_mail_la_LDFLAGS = \ - -avoid-version -module $(NO_UNDEFINED) - -libevolution_mail_la_DEPENDENCIES = em-filter-i18n.h +#libevolution_mail_la_LIBADD = \ +# $(top_builddir)/e-util/libeutil.la \ +# $(top_builddir)/shell/libeshell.la \ +# $(top_builddir)/composer/libcomposer.la \ +# $(top_builddir)/widgets/table/libetable.la \ +# $(top_builddir)/widgets/text/libetext.la \ +# $(top_builddir)/widgets/misc/libemiscwidgets.la \ +# $(top_builddir)/widgets/misc/libefilterbar.la \ +# $(top_builddir)/filter/libfilter.la \ +# $(top_builddir)/widgets/menus/libmenus.la \ +# $(top_builddir)/addressbook/util/libeabutil.la \ +# $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \ +# $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \ +# $(top_builddir)/mail/importers/libevolution-mail-importers.la \ +# $(SMIME_LIBS) \ +# $(EVOLUTION_MAIL_LIBS) \ +# $(GTKHTML_LIBS) \ +# $(REGEX_LIBS) \ +# $(THREADS_LIBS) + +#libevolution_mail_la_LDFLAGS = \ +# -avoid-version -module $(NO_UNDEFINED) + +#libevolution_mail_la_DEPENDENCIES = em-filter-i18n.h # .server files @@ -246,7 +246,6 @@ etspec_DATA = message-list.etspec EXTRA_DIST = \ ChangeLog.pre-1-4 \ README.async \ - $(MAIL_IDL) \ mail.error.xml \ $(glade_DATA) \ $(schema_in_files) \ @@ -302,7 +301,7 @@ endif dist-hook: cd $(distdir); rm -f $(BUILT_SOURCES) -BUILT_SOURCES = $(MAIL_IDL_GENERATED) $(server_DATA) $(error_DATA) +BUILT_SOURCES = $(server_DATA) $(error_DATA) CLEANFILES = $(BUILT_SOURCES) diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c new file mode 100644 index 0000000000..d0c773d470 --- /dev/null +++ b/mail/e-mail-shell-content.c @@ -0,0 +1,347 @@ +/* + * e-mail-shell-content.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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-mail-shell-content.h" + +#include <glib/gi18n.h> + +#include "e-util/gconf-bridge.h" + +#define E_MAIL_SHELL_CONTENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentPrivate)) + +struct _EMailShellContentPrivate { + GtkWidget *paned; + + guint paned_binding_id; + + guint preview_visible : 1; + guint vertical_view : 1; +}; + +enum { + PROP_0, + PROP_PREVIEW_VISIBLE, + PROP_VERTICAL_VIEW +}; + +static gpointer parent_class; + +static void +mail_shell_content_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_PREVIEW_VISIBLE: + e_mail_shell_content_set_preview_visible ( + E_MAIL_SHELL_CONTENT (object), + g_value_get_boolean (value)); + return; + + case PROP_VERTICAL_VIEW: + e_mail_shell_content_set_vertical_view ( + E_MAIL_SHELL_CONTENT (object), + g_value_get_boolean (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +mail_shell_content_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_PREVIEW_VISIBLE: + g_value_set_boolean ( + value, + e_mail_shell_content_get_preview_visible ( + E_MAIL_SHELL_CONTENT (object))); + return; + + case PROP_VERTICAL_VIEW: + g_value_set_boolean ( + value, + e_mail_shell_content_get_vertical_view ( + E_MAIL_SHELL_CONTENT (object))); + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +mail_shell_content_dispose (GObject *object) +{ + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); + + if (priv->paned != NULL) { + g_object_unref (priv->paned); + priv->paned = NULL; + } + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +mail_shell_content_finalize (GObject *object) +{ + EMailShellContentPrivate *priv; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); + + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +mail_shell_content_constructed (GObject *object) +{ + EMailShellContentPrivate *priv; + GConfBridge *bridge; + GtkWidget *container; + GtkWidget *widget; + const gchar *key; + + priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object); + + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); + + /* Build content widgets. */ + + container = GTK_WIDGET (object); + + widget = gtk_vpaned_new (); + gtk_container_add (GTK_CONTAINER (container), widget); + priv->paned = g_object_ref (widget); + gtk_widget_show (widget); + + container = widget; + + widget = gtk_label_new ("Message List"); + gtk_paned_add1 (GTK_PANED (container), widget); + gtk_widget_show (widget); + + widget = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy ( + GTK_SCROLLED_WINDOW (widget), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type ( + GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN); + gtk_paned_add2 (GTK_PANED (container), widget); + gtk_widget_show (widget); + + /* Bind GObject properties to GConf keys. */ + + bridge = gconf_bridge_get (); + + object = G_OBJECT (priv->paned); + key = "/apps/evolution/mail/display/paned_size"; + gconf_bridge_bind_property_delayed (bridge, key, object, "position"); +} + +static void +mail_shell_content_class_init (EMailShellContentClass *class) +{ + GObjectClass *object_class; + + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (EMailShellContentPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->set_property = mail_shell_content_set_property; + object_class->get_property = mail_shell_content_get_property; + object_class->dispose = mail_shell_content_dispose; + object_class->finalize = mail_shell_content_finalize; + object_class->constructed = mail_shell_content_constructed; + + g_object_class_install_property ( + object_class, + PROP_PREVIEW_VISIBLE, + g_param_spec_boolean ( + "preview-visible", + _("Preview is Visible"), + _("Whether the preview pane is visible"), + TRUE, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_VERTICAL_VIEW, + g_param_spec_boolean ( + "vertical-view", + _("Vertical View"), + _("Whether vertical view is enabled"), + FALSE, + G_PARAM_READWRITE)); +} + +static void +mail_shell_content_init (EMailShellContent *mail_shell_content) +{ + mail_shell_content->priv = + E_MAIL_SHELL_CONTENT_GET_PRIVATE (mail_shell_content); + + mail_shell_content->priv->preview_visible = TRUE; + + /* Postpone widget construction until we have a shell view. */ +} + +GType +e_mail_shell_content_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) { + static const GTypeInfo type_info = { + sizeof (EMailShellContentClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) mail_shell_content_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EMailShellContent), + 0, /* n_preallocs */ + (GInstanceInitFunc) mail_shell_content_init, + NULL /* value_table */ + }; + + type = g_type_register_static ( + E_TYPE_SHELL_CONTENT, "EMailShellContent", + &type_info, 0); + } + + return type; +} + +GtkWidget * +e_mail_shell_content_new (EShellView *shell_view) +{ + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); + + return g_object_new ( + E_TYPE_MAIL_SHELL_CONTENT, + "shell-view", shell_view, NULL); +} + +gboolean +e_mail_shell_content_get_preview_visible (EMailShellContent *mail_shell_content) +{ + g_return_val_if_fail ( + E_IS_MAIL_SHELL_CONTENT (mail_shell_content), FALSE); + + return mail_shell_content->priv->preview_visible; +} + +void +e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content, + gboolean preview_visible) +{ + GtkPaned *paned; + GtkWidget *child; + + g_return_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content)); + + if (preview_visible == mail_shell_content->priv->preview_visible) + return; + + paned = GTK_PANED (mail_shell_content->priv->paned); + child = gtk_paned_get_child2 (paned); + + if (preview_visible) + gtk_widget_show (child); + else + gtk_widget_hide (child); + + mail_shell_content->priv->preview_visible = preview_visible; + + g_object_notify (G_OBJECT (mail_shell_content), "preview-visible"); +} + +gboolean +e_mail_shell_content_get_vertical_view (EMailShellContent *mail_shell_content) +{ + g_return_val_if_fail ( + E_IS_MAIL_SHELL_CONTENT (mail_shell_content), FALSE); + + return mail_shell_content->priv->vertical_view; +} + +void +e_mail_shell_content_set_vertical_view (EMailShellContent *mail_shell_content, + gboolean vertical_view) +{ + GConfBridge *bridge; + GtkWidget *old_paned; + GtkWidget *new_paned; + GtkWidget *child1; + GtkWidget *child2; + guint binding_id; + const gchar *key; + + g_return_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content)); + + if (vertical_view == mail_shell_content->priv->vertical_view) + return; + + bridge = gconf_bridge_get (); + old_paned = mail_shell_content->priv->paned; + binding_id = mail_shell_content->priv->paned_binding_id; + + child1 = gtk_paned_get_child1 (GTK_PANED (old_paned)); + child2 = gtk_paned_get_child2 (GTK_PANED (old_paned)); + + if (binding_id > 0) + gconf_bridge_unbind (bridge, binding_id); + + if (vertical_view) { + new_paned = gtk_hpaned_new (); + key = "/apps/evolution/mail/display/hpaned_size"; + } else { + new_paned = gtk_vpaned_new (); + key = "/apps/evolution/mail/display/paned_size"; + } + + gtk_widget_reparent (child1, new_paned); + gtk_widget_reparent (child2, new_paned); + gtk_widget_show (new_paned); + + gtk_widget_destroy (old_paned); + gtk_container_add (GTK_CONTAINER (mail_shell_content), new_paned); + + binding_id = gconf_bridge_bind_property_delayed ( + bridge, key, G_OBJECT (new_paned), "position"); + + mail_shell_content->priv->vertical_view = vertical_view; + mail_shell_content->priv->paned_binding_id = binding_id; + mail_shell_content->priv->paned = g_object_ref (new_paned); + + g_object_notify (G_OBJECT (mail_shell_content), "vertical-view"); +} diff --git a/mail/e-mail-shell-content.h b/mail/e-mail-shell-content.h new file mode 100644 index 0000000000..dddaf589d7 --- /dev/null +++ b/mail/e-mail-shell-content.h @@ -0,0 +1,77 @@ +/* + * e-mail-shell-content.h + * + * 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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MAIL_SHELL_CONTENT_H +#define E_MAIL_SHELL_CONTENT_H + +#include <shell/e-shell-content.h> +#include <shell/e-shell-view.h> + +/* Standard GObject macros */ +#define E_TYPE_MAIL_SHELL_CONTENT \ + (e_mail_shell_content_get_type ()) +#define E_MAIL_SHELL_CONTENT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContent)) +#define E_MAIL_SHELL_CONTENT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentClass)) +#define E_IS_MAIL_SHELL_CONTENT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_SHELL_CONTENT)) +#define E_IS_MAIL_SHELL_CONTENT_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_SHELL_CONTENT)) +#define E_MAIL_SHELL_CONTENT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_SHELL_CONTENT, EMailShellContentClass)) + +G_BEGIN_DECLS + +typedef struct _EMailShellContent EMailShellContent; +typedef struct _EMailShellContentClass EMailShellContentClass; +typedef struct _EMailShellContentPrivate EMailShellContentPrivate; + +struct _EMailShellContent { + EShellContent parent; + EMailShellContentPrivate *priv; +}; + +struct _EMailShellContentClass { + EShellContentClass parent_class; +}; + +GType e_mail_shell_content_get_type (void); +GtkWidget * e_mail_shell_content_new (EShellView *shell_view); +gboolean e_mail_shell_content_get_preview_visible + (EMailShellContent *mail_shell_content); +void e_mail_shell_content_set_preview_visible + (EMailShellContent *mail_shell_content, + gboolean preview_visible); +gboolean e_mail_shell_content_get_vertical_view + (EMailShellContent *mail_shell_content); +void e_mail_shell_content_set_vertical_view + (EMailShellContent *mail_shell_content, + gboolean vertical_view); + +G_END_DECLS + +#endif /* E_MAIL_SHELL_CONTENT_H */ diff --git a/mail/em-migrate.c b/mail/e-mail-shell-module-migrate.c index e22cbae273..c41ec65e2e 100644 --- a/mail/em-migrate.c +++ b/mail/e-mail-shell-module-migrate.c @@ -1,4 +1,6 @@ /* + * e-mail-shell-module-migrate.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 @@ -10,19 +12,14 @@ * 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/> - * + * License along with the program; if not, see <http://www.gnu.org/licenses/> * - * Authors: - * Jeffrey Stedfast <fejj@ximian.com> * * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif +#include "e-mail-shell-module-migrate.h" #include <stdio.h> #include <stdlib.h> @@ -37,6 +34,7 @@ #include <ctype.h> #include <glib.h> +#include <glib/gi18n.h> #include <glib/gstdio.h> #include <gtk/gtk.h> @@ -54,8 +52,6 @@ #include <libxml/parser.h> #include <libxml/xmlmemory.h> -#include <glib/gi18n.h> - #include <e-util/e-util.h> #include <libedataserver/e-data-server-util.h> #include <e-util/e-xml-utils.h> @@ -67,11 +63,11 @@ #include "e-util/e-util-private.h" #include "e-util/e-plugin.h" -#include "mail-component.h" +#include "e-mail-shell-module.h" +#include "shell/e-shell-migrate.h" + #include "mail-config.h" -#include "mail-session.h" #include "em-utils.h" -#include "em-migrate.h" #define d(x) x @@ -380,7 +376,7 @@ parse_lsub (const char *lsub, char *dir_sep) return NULL; } -static int +static gboolean read_imap_storeinfo (struct _account_info_1_0 *si) { FILE *storeinfo; @@ -433,7 +429,7 @@ read_imap_storeinfo (struct _account_info_1_0 *si) g_free (path); if (storeinfo == NULL) { g_warning ("could not find imap store info '%s'", path); - return -1; + return FALSE; } /* ignore version */ @@ -473,10 +469,10 @@ read_imap_storeinfo (struct _account_info_1_0 *si) fclose (storeinfo); - return 0; + return TRUE; } -static int +static gboolean load_accounts_1_0 (xmlDocPtr doc) { xmlNodePtr source; @@ -485,7 +481,7 @@ load_accounts_1_0 (xmlDocPtr doc) char key[32]; if (!(source = e_bconf_get_path (doc, "/Mail/Accounts"))) - return 0; + return TRUE; if ((val = e_bconf_get_value (source, "num"))) { count = atoi (val); @@ -536,11 +532,11 @@ load_accounts_1_0 (xmlDocPtr doc) g_hash_table_insert (accounts_name_1_0, ai->name, ai); } - return 0; + return TRUE; } -static int -em_migrate_1_0 (const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr filters, xmlDocPtr vfolders, CamelException *ex) +static gboolean +em_migrate_1_0 (const char *data_dir, xmlDocPtr config_xmldb, xmlDocPtr filters, xmlDocPtr vfolders, GError **error) { accounts_1_0 = g_hash_table_new_full ( g_str_hash, g_str_equal, @@ -555,11 +551,11 @@ em_migrate_1_0 (const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr fil g_hash_table_destroy (accounts_1_0); g_hash_table_destroy (accounts_name_1_0); - return 0; + return TRUE; } /* 1.2 upgrade functions */ -static int +static gboolean is_xml1encoded (const char *txt) { const unsigned char *p; @@ -653,7 +649,7 @@ utf8_reencode (const char *txt) } } -static int +static gboolean upgrade_xml_1_2_rec (xmlNodePtr node) { const char *value_tags[] = { "string", "address", "regex", "file", "command", NULL }; @@ -718,29 +714,30 @@ upgrade_xml_1_2_rec (xmlNodePtr node) node = node->next; } - return 0; + return TRUE; } -static int +static gboolean em_upgrade_xml_1_2 (xmlDocPtr doc) { xmlNodePtr root; if (!doc || !(root = xmlDocGetRootElement (doc))) - return 0; + return TRUE; return upgrade_xml_1_2_rec (root); } /* converts passwords from ~/evolution/private/config.xmldb to gnome_private() */ -static int +static gboolean upgrade_passwords_1_2(void) { xmlNodePtr root, entry; char *filename; xmlDocPtr priv_doc = NULL; struct stat st; - int work = 0, res = -1; + int work = 0; + gboolean success = FALSE; filename = g_build_filename(g_get_home_dir(), "evolution/private/config.xmldb", NULL); if (lstat(filename, &st) == 0 && S_ISREG(st.st_mode)) @@ -748,12 +745,12 @@ upgrade_passwords_1_2(void) g_free(filename); if (priv_doc == NULL) - return 0; + return TRUE; root = priv_doc->children; if (strcmp((char *)root->name, "bonobo-config") != 0) { xmlFreeDoc(priv_doc); - return 0; + return TRUE; } root = root->children; @@ -822,12 +819,12 @@ upgrade_passwords_1_2(void) if (work) { if (gnome_config_private_sync_file("/Evolution")) - res = 0; + success = TRUE; } else { - res = 0; + success = TRUE; } - return res; + return success; } /* ********************************************************************** */ @@ -1061,7 +1058,7 @@ static struct { }; /* remaps mail config from bconf to gconf */ -static int +static gboolean bconf_import(GConfClient *gconf, xmlDocPtr config_xmldb) { xmlNodePtr source; @@ -1112,11 +1109,11 @@ bconf_import(GConfClient *gconf, xmlDocPtr config_xmldb) e_bconf_import_xml_blob(gconf, config_xmldb, signature_map, "/Mail/Signatures", "/apps/evolution/mail/signatures", "signature", NULL); - return 0; + return TRUE; } -static int -em_migrate_1_2(const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr filters, xmlDocPtr vfolders, CamelException *ex) +static gboolean +em_migrate_1_2(const char *data_dir, xmlDocPtr config_xmldb, xmlDocPtr filters, xmlDocPtr vfolders, GError **error) { GConfClient *gconf; @@ -1128,7 +1125,7 @@ em_migrate_1_2(const char *evolution_dir, xmlDocPtr config_xmldb, xmlDocPtr filt em_upgrade_xml_1_2(vfolders); upgrade_passwords_1_2(); - return 0; + return TRUE; } /* 1.4 upgrade functions */ @@ -1213,7 +1210,7 @@ em_migrate_setup_progress_dialog (const char *desc) gtk_container_add ((GtkContainer *) window, vbox); w = gtk_label_new (desc); - + gtk_label_set_line_wrap ((GtkLabel *) w, TRUE); gtk_widget_show (w); gtk_box_pack_start_defaults ((GtkBox *) vbox, w); @@ -1317,7 +1314,7 @@ is_mail_folder (const char *metadata) return FALSE; } -static int +static gboolean get_local_et_expanded (const char *dirname) { xmlNodePtr node; @@ -1332,24 +1329,24 @@ get_local_et_expanded (const char *dirname) if (stat (buf, &st) == -1) { g_free (buf); - return -1; + return FALSE; } if (!(doc = xmlParseFile (buf))) { g_free (buf); - return -1; + return FALSE; } g_free (buf); if (!(node = xmlDocGetRootElement (doc)) || strcmp ((char *)node->name, "expanded_state") != 0) { xmlFreeDoc (doc); - return -1; + return FALSE; } if (!(buf = (char *)xmlGetProp (node, (const unsigned char *)"default"))) { xmlFreeDoc (doc); - return -1; + return FALSE; } thread_list = strcmp (buf, "0") == 0 ? 0 : 1; @@ -1435,7 +1432,7 @@ static int open_flags[3] = { O_WRONLY | O_CREAT | O_APPEND, }; -static int +static gboolean cp (const char *src, const char *dest, gboolean show_progress, int mode) { unsigned char readbuf[65536]; @@ -1449,18 +1446,18 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode) * want to corrupt their existing data */ if (g_stat (dest, &st) == 0 && st.st_size > 0 && mode == CP_UNIQUE) { errno = EEXIST; - return -1; + return FALSE; } if (g_stat (src, &st) == -1 || (readfd = g_open (src, O_RDONLY | O_BINARY, 0)) == -1) - return -1; + return FALSE; if ((writefd = g_open (dest, open_flags[mode] | O_BINARY, 0666)) == -1) { errnosav = errno; close (readfd); errno = errnosav; - return -1; + return FALSE; } do { @@ -1497,7 +1494,7 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode) utime (dest, &ut); chmod (dest, st.st_mode); - return 0; + return TRUE; exception: @@ -1512,12 +1509,12 @@ cp (const char *src, const char *dest, gboolean show_progress, int mode) unlink (dest); errno = errnosav; - return -1; + return FALSE; } #ifndef G_OS_WIN32 -static int +static gboolean cp_r (const char *src, const char *dest, const char *pattern, int mode) { GString *srcpath, *destpath; @@ -1527,10 +1524,10 @@ cp_r (const char *src, const char *dest, const char *pattern, int mode) DIR *dir; if (g_mkdir_with_parents (dest, 0777) == -1) - return -1; + return FALSE; if (!(dir = opendir (src))) - return -1; + return FALSE; srcpath = g_string_new (src); g_string_append_c (srcpath, '/'); @@ -1565,7 +1562,7 @@ cp_r (const char *src, const char *dest, const char *pattern, int mode) g_string_free (destpath, TRUE); g_string_free (srcpath, TRUE); - return 0; + return TRUE; } static void @@ -1602,18 +1599,21 @@ mbox_build_filename (GString *path, const char *toplevel_dir, const char *full_n } } -static int -em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *full_name, CamelException *ex) +static gboolean +em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *full_name, GError **error) { CamelFolder *old_folder = NULL, *new_folder = NULL; CamelStore *local_store = NULL; + CamelException ex; char *name, *uri; GPtrArray *uids; struct stat st; - int thread_list; + gboolean thread_list; int index, i; GString *src, *dest; - int res = -1; + gboolean success = FALSE; + + camel_exception_init (&ex); src = g_string_new(""); @@ -1623,7 +1623,7 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu || !is_mail_folder(src->str)) { /* Not an evolution mail folder */ g_string_free(src, TRUE); - return 0; + return TRUE; } dest = g_string_new(""); @@ -1648,16 +1648,18 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu dlen = dest->len; if (g_mkdir_with_parents (dest->str, 0777) == -1 && errno != EEXIST) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to create new folder `%s': %s"), - dest->str, g_strerror(errno)); + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Unable to create new folder `%s': %s"), + dest->str, g_strerror (errno)); goto fatal; } *p = '/'; mode = CP_UNIQUE; retry_copy: - if (cp (src->str, dest->str, TRUE, mode) == -1) { + if (!cp (src->str, dest->str, TRUE, mode)) { if (errno == EEXIST) { int save = errno; @@ -1674,9 +1676,11 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu errno = save; } - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to copy folder `%s' to `%s': %s"), - src->str, dest->str, g_strerror(errno)); + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Unable to copy folder `%s' to `%s': %s"), + src->str, dest->str, g_strerror (errno)); goto fatal; } ignore: @@ -1696,14 +1700,14 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu goto cmeta_err; /* write the meta count */ - if (camel_file_util_encode_uint32 (fp, thread_list != -1 ? 1 : 0) == -1) + if (camel_file_util_encode_uint32 (fp, thread_list ? 1 : 0) == -1) goto cmeta_err; - if (thread_list != -1) { + if (!thread_list) { if (camel_file_util_encode_string (fp, "evolution:thread_list") == -1) goto cmeta_err; - if (camel_file_util_encode_string (fp, thread_list ? "1" : "0") == -1) + if (camel_file_util_encode_string (fp, !thread_list ? "1" : "0") == -1) goto cmeta_err; } @@ -1742,16 +1746,16 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu } else { guint32 flags = CAMEL_STORE_FOLDER_CREATE; - if (!(local_store = camel_session_get_store ((CamelSession *) session, uri, ex)) - || !(old_folder = camel_store_get_folder (local_store, name, 0, ex))) + if (!(local_store = camel_session_get_store ((CamelSession *) session, uri, &ex)) + || !(old_folder = camel_store_get_folder (local_store, name, 0, &ex))) goto fatal; flags |= (index ? CAMEL_STORE_FOLDER_BODY_INDEX : 0); - if (!(new_folder = camel_store_get_folder (session->store, full_name, flags, ex))) + if (!(new_folder = camel_store_get_folder (session->store, full_name, flags, &ex))) goto fatal; - if (thread_list != -1) { - camel_object_meta_set (new_folder, "evolution:thread_list", thread_list ? "1" : "0"); + if (!thread_list) { + camel_object_meta_set (new_folder, "evolution:thread_list", !thread_list ? "1" : "0"); camel_object_state_write (new_folder); } @@ -1763,17 +1767,17 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu if (!(info = camel_folder_get_message_info (old_folder, uids->pdata[i]))) continue; - if (!(message = camel_folder_get_message (old_folder, uids->pdata[i], ex))) { + if (!(message = camel_folder_get_message (old_folder, uids->pdata[i], &ex))) { camel_folder_free_message_info (old_folder, info); camel_folder_free_uids (old_folder, uids); goto fatal; } - camel_folder_append_message (new_folder, message, info, NULL, ex); + camel_folder_append_message (new_folder, message, info, NULL, &ex); camel_folder_free_message_info (old_folder, info); camel_object_unref (message); - if (camel_exception_is_set (ex)) + if (camel_exception_is_set (&ex)) break; em_migrate_set_progress (((double) i + 1) / ((double) uids->len)); @@ -1781,10 +1785,10 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu camel_folder_free_uids (old_folder, uids); - if (camel_exception_is_set (ex)) + if (camel_exception_is_set (&ex)) goto fatal; } - res = 0; + success = TRUE; fatal: g_free (uri); g_free (name); @@ -1797,34 +1801,42 @@ fatal: if (new_folder) camel_object_unref(new_folder); - return res; + if (camel_exception_is_set (&ex)) { + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + "%s", camel_exception_get_description (&ex)); + camel_exception_clear (&ex); + } + + return success; } -static int -em_migrate_dir (EMMigrateSession *session, const char *dirname, const char *full_name, CamelException *ex) +static gboolean +em_migrate_dir (EMMigrateSession *session, const char *dirname, const char *full_name, GError **error) { char *path; DIR *dir; struct stat st; struct dirent *dent; - int res = 0; + gboolean success = TRUE; - if (em_migrate_folder(session, dirname, full_name, ex) == -1) - return -1; + if (!em_migrate_folder(session, dirname, full_name, error)) + return FALSE; /* no subfolders, not readable, don't care */ path = g_strdup_printf ("%s/subfolders", dirname); if (stat (path, &st) == -1 || !S_ISDIR (st.st_mode)) { g_free (path); - return 0; + return TRUE; } if (!(dir = opendir (path))) { g_free (path); - return 0; + return TRUE; } - while (res == 0 && (dent = readdir (dir))) { + while (success && (dent = readdir (dir))) { char *full_path; char *name; @@ -1838,7 +1850,7 @@ em_migrate_dir (EMMigrateSession *session, const char *dirname, const char *full } name = g_strdup_printf ("%s/%s", full_name, dent->d_name); - res = em_migrate_dir (session, full_path, name, ex); + success = em_migrate_dir (session, full_path, name, error); g_free (full_path); g_free (name); } @@ -1847,29 +1859,31 @@ em_migrate_dir (EMMigrateSession *session, const char *dirname, const char *full g_free (path); - return res; + return success; } -static int -em_migrate_local_folders_1_4 (EMMigrateSession *session, CamelException *ex) +static gboolean +em_migrate_local_folders_1_4 (EMMigrateSession *session, GError **error) { struct dirent *dent; struct stat st; DIR *dir; - int res = 0; + gboolean success = TRUE; if (!(dir = opendir (session->srcdir))) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to scan for existing mailboxes at `%s': %s"), - session->srcdir, g_strerror(errno)); - return -1; + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Unable to scan for existing mailboxes at " + "`%s': %s"), session->srcdir, g_strerror (errno)); + return FALSE; } em_migrate_setup_progress_dialog (_("The location and hierarchy of the Evolution mailbox " "folders has changed since Evolution 1.x.\n\nPlease be " "patient while Evolution migrates your folders...")); - while (res == 0 && (dent = readdir (dir))) { + while (success && (dent = readdir (dir))) { char *full_path; if (dent->d_name[0] == '.') @@ -1881,7 +1895,7 @@ em_migrate_local_folders_1_4 (EMMigrateSession *session, CamelException *ex) continue; } - res = em_migrate_dir (session, full_path, dent->d_name, ex); + success = em_migrate_dir (session, full_path, dent->d_name, error); g_free (full_path); } @@ -1889,7 +1903,7 @@ em_migrate_local_folders_1_4 (EMMigrateSession *session, CamelException *ex) em_migrate_close_progress_dialog (); - return res; + return success; } static char * @@ -2045,15 +2059,15 @@ em_upgrade_accounts_1_4 (void) mail_config_save_accounts (); } -static int -em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex) +static gboolean +em_migrate_pop_uid_caches_1_4 (const char *data_dir, GError **error) { GString *oldpath, *newpath; struct dirent *dent; size_t olen, nlen; char *cache_dir; DIR *dir; - int res = 0; + gboolean success = TRUE; /* Sigh, too many unique strings to translate, for cases which shouldn't ever happen */ @@ -2062,14 +2076,16 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex) if (!(dir = opendir (cache_dir))) { if (errno == ENOENT) { g_free(cache_dir); - return 0; + return TRUE; } - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to open old POP keep-on-server data `%s': %s"), - cache_dir, g_strerror (errno)); + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Unable to open old POP keep-on-server data " + "`%s': %s"), cache_dir, g_strerror (errno)); g_free (cache_dir); - return -1; + return FALSE; } oldpath = g_string_new (cache_dir); @@ -2077,15 +2093,18 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex) olen = oldpath->len; g_free (cache_dir); - cache_dir = g_build_filename (evolution_dir, "mail", "pop", NULL); + cache_dir = g_build_filename (data_dir, "pop", NULL); if (g_mkdir_with_parents (cache_dir, 0777) == -1) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to create POP3 keep-on-server data directory `%s': %s"), - cache_dir, g_strerror(errno)); + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Unable to create POP3 keep-on-server data " + "directory `%s': %s"), cache_dir, + g_strerror (errno)); g_string_free (oldpath, TRUE); g_free (cache_dir); closedir (dir); - return -1; + return FALSE; } newpath = g_string_new (cache_dir); @@ -2093,7 +2112,7 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex) nlen = newpath->len; g_free (cache_dir); - while (res == 0 && (dent = readdir (dir))) { + while (success && (dent = readdir (dir))) { if (strncmp (dent->d_name, "cache-pop:__", 12) != 0) continue; @@ -2107,11 +2126,14 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex) g_string_truncate (newpath, newpath->len - 1); if (g_mkdir_with_parents (newpath->str, 0777) == -1 - || cp(oldpath->str, (g_string_append(newpath, "/uid-cache"))->str, FALSE, CP_UNIQUE)) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to copy POP3 keep-on-server data `%s': %s"), - oldpath->str, g_strerror(errno)); - res = -1; + || !cp(oldpath->str, (g_string_append(newpath, "/uid-cache"))->str, FALSE, CP_UNIQUE)) { + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Unable to copy POP3 keep-on-server data " + "`%s': %s"), oldpath->str, + g_strerror (errno)); + success = FALSE; } } @@ -2121,11 +2143,11 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex) closedir (dir); - return res; + return success; } -static int -em_migrate_imap_caches_1_4 (const char *evolution_dir, CamelException *ex) +static gboolean +em_migrate_imap_caches_1_4 (const char *data_dir, GError **error) { char *src, *dest; struct stat st; @@ -2133,10 +2155,10 @@ em_migrate_imap_caches_1_4 (const char *evolution_dir, CamelException *ex) src = g_build_filename (g_get_home_dir (), "evolution", "mail", "imap", NULL); if (stat (src, &st) == -1 || !S_ISDIR (st.st_mode)) { g_free (src); - return 0; + return TRUE; } - dest = g_build_filename (evolution_dir, "mail", "imap", NULL); + dest = g_build_filename (data_dir, "imap", NULL); /* we don't care if this fails, it's only a cache... */ cp_r (src, dest, "summary", CP_OVERWRITE); @@ -2144,11 +2166,11 @@ em_migrate_imap_caches_1_4 (const char *evolution_dir, CamelException *ex) g_free (dest); g_free (src); - return 0; + return TRUE; } -static int -em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *ex) +static gboolean +em_migrate_folder_expand_state_1_4 (const char *data_dir, GError **error) { GString *srcpath, *destpath; size_t slen, dlen, rlen; @@ -2161,15 +2183,15 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e g_string_append (srcpath, "/evolution/config"); if (stat (srcpath->str, &st) == -1 || !S_ISDIR (st.st_mode)) { g_string_free (srcpath, TRUE); - return 0; + return TRUE; } - destpath = g_string_new (evolution_dir); - g_string_append (destpath, "/mail/config"); + destpath = g_string_new (data_dir); + g_string_append (destpath, "/config"); if (g_mkdir_with_parents (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) { g_string_free (destpath, TRUE); g_string_free (srcpath, TRUE); - return 0; + return TRUE; } g_string_append (srcpath, "/et-expanded-"); @@ -2200,7 +2222,7 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e /* this should always be the case afaik... */ inptr += rlen; new = g_string_new ("mbox:"); - g_string_append_printf (new, "%s/mail/local#", evolution_dir); + g_string_append_printf (new, "%s/local#", data_dir); full_name = g_strdup (inptr); inptr = full_name + strlen (full_name) - 12; @@ -2242,11 +2264,11 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e g_string_free (destpath, TRUE); g_string_free (srcpath, TRUE); - return 0; + return TRUE; } -static int -em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException *ex) +static gboolean +em_migrate_folder_view_settings_1_4 (const char *data_dir, GError **error) { GString *srcpath, *destpath; size_t slen, dlen, rlen; @@ -2259,15 +2281,15 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException * g_string_append (srcpath, "/evolution/views/mail"); if (stat (srcpath->str, &st) == -1 || !S_ISDIR (st.st_mode)) { g_string_free (srcpath, TRUE); - return 0; + return TRUE; } - destpath = g_string_new (evolution_dir); - g_string_append (destpath, "/mail/views"); + destpath = g_string_new (data_dir); + g_string_append (destpath, "/views"); if (g_mkdir_with_parents (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) { g_string_free (destpath, TRUE); g_string_free (srcpath, TRUE); - return 0; + return TRUE; } g_string_append_c (srcpath, '/'); @@ -2319,7 +2341,7 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException * /* this should always be the case afaik... */ inptr += rlen; new = g_string_new ("mbox:"); - g_string_append_printf (new, "%s/mail/local#", evolution_dir); + g_string_append_printf (new, "%s/local#", data_dir); full_name = g_strdup (inptr); inptr = full_name + strlen (full_name) - 12; @@ -2364,7 +2386,7 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException * g_string_free (destpath, TRUE); g_string_free (srcpath, TRUE); - return 0; + return TRUE; } #define SUBFOLDER_DIR_NAME "subfolders" @@ -2445,8 +2467,8 @@ e_path_to_physical (const char *prefix, const char *vpath) return ppath; } -static int -em_migrate_imap_cmeta_1_4(const char *evolution_dir, CamelException *ex) +static gboolean +em_migrate_imap_cmeta_1_4(const char *data_dir, GError **error) { GConfClient *gconf; GSList *paths, *p; @@ -2454,7 +2476,7 @@ em_migrate_imap_cmeta_1_4(const char *evolution_dir, CamelException *ex) const EAccount *account; if (!(accounts = mail_config_get_accounts())) - return 0; + return TRUE; gconf = gconf_client_get_default(); paths = gconf_client_get_list(gconf, "/apps/evolution/shell/offline/folder_paths", GCONF_VALUE_STRING, NULL); @@ -2474,8 +2496,8 @@ em_migrate_imap_cmeta_1_4(const char *evolution_dir, CamelException *ex) if (url) { char *dir, *base; - base = g_strdup_printf("%s/mail/imap/%s@%s/folders", - evolution_dir, + base = g_strdup_printf("%s/imap/%s@%s/folders", + data_dir, url->user?url->user:"", url->host?url->host:""); @@ -2519,7 +2541,7 @@ em_migrate_imap_cmeta_1_4(const char *evolution_dir, CamelException *ex) /* we couldn't care less if this doesn't work */ - return 0; + return TRUE; } static void @@ -2558,52 +2580,53 @@ remove_system_searches(xmlDocPtr searches) } } -static int -em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders, CamelException *ex) +static gboolean +em_migrate_1_4 (const char *data_dir, xmlDocPtr filters, xmlDocPtr vfolders, GError **error) { EMMigrateSession *session; CamelException lex; struct stat st; - char *path; + gchar *path; xmlDocPtr searches; - path = g_build_filename (evolution_dir, "mail", NULL); - - camel_init (path, TRUE); + camel_init (data_dir, TRUE); camel_provider_init(); - session = (EMMigrateSession *) em_migrate_session_new (path); - g_free (path); + session = (EMMigrateSession *) em_migrate_session_new (data_dir); session->srcdir = g_build_filename (g_get_home_dir (), "evolution", "local", NULL); path = g_strdup_printf ("mbox:%s/.evolution/mail/local", g_get_home_dir ()); if (stat (path + 5, &st) == -1) { if (errno != ENOENT || g_mkdir_with_parents (path + 5, 0777) == -1) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Failed to create local mail storage `%s': %s"), - path + 5, g_strerror (errno)); + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Failed to create local mail storage " + "`%s': %s"), path + 5, g_strerror (errno)); g_free (session->srcdir); camel_object_unref (session); g_free (path); - return -1; + return FALSE; } } camel_exception_init (&lex); if (!(session->store = camel_session_get_store ((CamelSession *) session, path, &lex))) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Failed to create local mail storage `%s': %s"), - path, lex.desc); + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Failed to create local mail storage `%s': %s"), + path, lex.desc); g_free (session->srcdir); camel_object_unref (session); camel_exception_clear (&lex); g_free (path); - return -1; + return FALSE; } g_free (path); - if (em_migrate_local_folders_1_4 (session, ex) == -1) - return -1; + if (!em_migrate_local_folders_1_4 (session, error)) + return FALSE; camel_object_unref (session->store); g_free (session->srcdir); @@ -2621,26 +2644,24 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders g_free(path); if (searches) { remove_system_searches(searches); - path = g_build_filename(evolution_dir, "mail", NULL); - emm_save_xml(searches, path, "searches.xml"); - g_free(path); + emm_save_xml(searches, data_dir, "searches.xml"); xmlFreeDoc(searches); } - if (em_migrate_pop_uid_caches_1_4 (evolution_dir, ex) == -1) - return -1; + if (!em_migrate_pop_uid_caches_1_4 (data_dir, error)) + return FALSE; /* these are non-fatal */ - em_migrate_imap_caches_1_4 (evolution_dir, ex); - camel_exception_clear(ex); - em_migrate_folder_expand_state_1_4 (evolution_dir, ex); - camel_exception_clear(ex); - em_migrate_folder_view_settings_1_4 (evolution_dir, ex); - camel_exception_clear(ex); - em_migrate_imap_cmeta_1_4(evolution_dir, ex); - camel_exception_clear(ex); - - return 0; + em_migrate_imap_caches_1_4 (data_dir, error); + g_clear_error (error); + em_migrate_folder_expand_state_1_4 (data_dir, error); + g_clear_error (error); + em_migrate_folder_view_settings_1_4 (data_dir, error); + g_clear_error (error); + em_migrate_imap_cmeta_1_4 (data_dir, error); + g_clear_error (error); + + return TRUE; } static void @@ -2678,8 +2699,8 @@ em_update_accounts_2_11 (void) #endif /* !G_OS_WIN32 */ -static int -emm_setup_initial(const char *evolution_dir) +static gboolean +emm_setup_initial(const gchar *data_dir) { GDir *dir; const char *d; @@ -2691,10 +2712,10 @@ emm_setup_initial(const char *evolution_dir) d(printf("Setting up initial mail tree\n")); - base = g_build_filename(evolution_dir, "mail", "local", NULL); + base = g_build_filename(data_dir, "local", NULL); if (g_mkdir_with_parents(base, 0777) == -1 && errno != EEXIST) { g_free(base); - return -1; + return FALSE; } /* e.g. try en-AU then en, etc */ @@ -2710,7 +2731,7 @@ emm_setup_initial(const char *evolution_dir) } /* Make sure we found one. */ - g_return_val_if_fail (*language_names != NULL, 0); + g_return_val_if_fail (*language_names != NULL, FALSE); dir = g_dir_open(local, 0, NULL); if (dir) { @@ -2730,7 +2751,7 @@ emm_setup_initial(const char *evolution_dir) g_free(local); g_free(base); - return 0; + return TRUE; } static gboolean @@ -2861,63 +2882,69 @@ migrate_folders(CamelStore *store, CamelFolderInfo *fi, const char *acc, CamelEx } static CamelStore * -setup_local_store (MailComponent *mc) +setup_local_store (EShellModule *shell_module, + EMMigrateSession *session) { CamelURL *url; + const gchar *data_dir; char *tmp; CamelStore *store; - + url = camel_url_new("mbox:", NULL); - tmp = g_build_filename (mail_component_peek_base_directory(mc), "local", NULL); + data_dir = e_shell_module_get_data_dir (shell_module); + tmp = g_build_filename (data_dir, "local", NULL); camel_url_set_path(url, tmp); g_free(tmp); tmp = camel_url_to_string(url, 0); - store = (CamelStore *)camel_session_get_service(session, tmp, CAMEL_PROVIDER_STORE, NULL); + store = (CamelStore *)camel_session_get_service(CAMEL_SESSION (session), tmp, CAMEL_PROVIDER_STORE, NULL); g_free(tmp); return store; - + } static void -migrate_to_db() +migrate_to_db (EShellModule *shell_module) { + EMMigrateSession *session; EAccountList *accounts; EIterator *iter; int i=0, len; - MailComponent *component = mail_component_peek (); CamelStore *store = NULL; CamelFolderInfo *info; - + const gchar *data_dir; + if (!(accounts = mail_config_get_accounts ())) return; - + iter = e_list_get_iterator ((EList *) accounts); len = e_list_length ((EList *) accounts); - + + data_dir = e_shell_module_get_data_dir (shell_module); + session = (EMMigrateSession *) em_migrate_session_new (data_dir); camel_session_set_online ((CamelSession *) session, FALSE); em_migrate_setup_progress_dialog (_("The summary format of the Evolution mailbox " "folders has been moved to SQLite since Evolution 2.24.\n\nPlease be " "patient while Evolution migrates your folders...")); em_migrate_set_progress ( (double)i/(len+1)); - store = setup_local_store (component); - info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL); + store = setup_local_store (shell_module, session); + info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL); if (info) { migrate_folders(store, info, _("On This Computer"), NULL); } i++; em_migrate_set_progress ( (double)i/(len+1)); - + while (e_iterator_is_valid (iter)) { EAccount *account = (EAccount *) e_iterator_get (iter); EAccountService *service; const char *name; - + service = account->source; name = account->name; - em_migrate_set_progress ( (double)i/(len+1)); + em_migrate_set_progress ( (double)i/(len+1)); if (account->enabled && service->url != NULL && service->url[0] @@ -2926,17 +2953,17 @@ migrate_to_db() CamelException ex; camel_exception_init (&ex); - mail_component_load_store_by_uri (component, service->url, name); + e_mail_shell_module_load_store_by_uri (service->url, name); - store = (CamelStore *) camel_session_get_service (session, service->url, CAMEL_PROVIDER_STORE, &ex); + store = (CamelStore *) camel_session_get_service (CAMEL_SESSION (session), service->url, CAMEL_PROVIDER_STORE, &ex); info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &ex); if (info) { migrate_folders(store, info, account->name, &ex); - + } else printf("%s:%s: failed to get folder infos \n", G_STRLOC, G_STRFUNC); camel_exception_clear(&ex); - + } i++; e_iterator_next (iter); @@ -2947,30 +2974,36 @@ migrate_to_db() g_object_unref (iter); em_migrate_close_progress_dialog (); + + g_object_unref (session); } -int -em_migrate (const char *evolution_dir, int major, int minor, int revision, CamelException *ex) +gboolean +e_mail_shell_module_migrate (EShellModule *shell_module, + gint major, + gint minor, + gint micro, + GError **error) { struct stat st; - char *path; + const gchar *data_dir; + gchar *path; /* make sure ~/.evolution/mail exists */ - path = g_build_filename (evolution_dir, "mail", NULL); - if (g_stat (path, &st) == -1) { - if (errno != ENOENT || g_mkdir_with_parents (path, 0777) == -1) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to create local mail folders at `%s': %s"), - path, g_strerror (errno)); - g_free (path); - return -1; + data_dir = e_shell_module_get_data_dir (shell_module); + if (g_stat (data_dir, &st) == -1) { + if (errno != ENOENT || g_mkdir_with_parents (data_dir, 0777) == -1) { + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Unable to create local mail folders at " + "`%s': %s"), data_dir, g_strerror (errno)); + return FALSE; } } - g_free (path); - if (major == 0) - return emm_setup_initial(evolution_dir); + return emm_setup_initial (data_dir); if (major == 1 && minor < 5) { #ifndef G_OS_WIN32 @@ -2978,46 +3011,46 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel path = g_build_filename (g_get_home_dir (), "evolution", NULL); if (minor <= 2 && !(config_xmldb = emm_load_xml (path, "config.xmldb"))) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to read settings from previous Evolution install, " - "`evolution/config.xmldb' does not exist or is corrupt.")); - g_free (path); - return -1; + g_set_error ( + error, E_SHELL_MIGRATE_ERROR, + E_SHELL_MIGRATE_ERROR_FAILED, + _("Unable to read settings from previous " + "Evolution install, `evolution/config.xmldb' " + "does not exist or is corrupt.")); + return FALSE; } filters = emm_load_xml (path, "filters.xml"); vfolders = emm_load_xml (path, "vfolders.xml"); g_free (path); if (minor == 0) { - if (em_migrate_1_0 (evolution_dir, config_xmldb, filters, vfolders, ex) == -1) { + if (!em_migrate_1_0 (data_dir, config_xmldb, filters, vfolders, error)) { xmlFreeDoc (config_xmldb); xmlFreeDoc (filters); xmlFreeDoc (vfolders); - return -1; + return FALSE; } } if (minor <= 2) { - if (em_migrate_1_2 (evolution_dir, config_xmldb, filters, vfolders, ex) == -1) { + if (!em_migrate_1_2 (data_dir, config_xmldb, filters, vfolders, error)) { xmlFreeDoc (config_xmldb); xmlFreeDoc (filters); xmlFreeDoc (vfolders); - return -1; + return FALSE; } xmlFreeDoc (config_xmldb); } if (minor <= 4) { - if (em_migrate_1_4 (evolution_dir, filters, vfolders, ex) == -1) { + if (!em_migrate_1_4 (data_dir, filters, vfolders, error)) { xmlFreeDoc (filters); xmlFreeDoc (vfolders); - return -1; + return FALSE; } } - path = g_build_filename (evolution_dir, "mail", NULL); - if (filters) { emm_save_xml (filters, path, "filters.xml"); xmlFreeDoc (filters); @@ -3048,8 +3081,8 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel if (major < 2 || (major == 2 && minor < 24)) { em_update_sa_junk_setting_2_23 (); - migrate_to_db(); + migrate_to_db (shell_module); } - return 0; + return TRUE; } diff --git a/mail/em-migrate.h b/mail/e-mail-shell-module-migrate.h index c755ef9b39..e9ec2115c0 100644 --- a/mail/em-migrate.h +++ b/mail/e-mail-shell-module-migrate.h @@ -1,4 +1,6 @@ /* + * e-mail-shell-module-migrate.h + * * 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 @@ -13,27 +15,24 @@ * License along with the program; if not, see <http://www.gnu.org/licenses/> * * - * Authors: - * Jeffrey Stedfast <fejj@ximian.com> - * * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * */ -#ifndef __EM_MIGRATE_H__ -#define __EM_MIGRATE_H__ +#ifndef E_MAIL_SHELL_MODULE_MIGRATE_H +#define E_MAIL_SHELL_MODULE_MIGRATE_H -#include <camel/camel-exception.h> +#include <glib.h> +#include <shell/e-shell-module.h> -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ +G_BEGIN_DECLS -int em_migrate (const char *evolution_dir, int major, int minor, int revision, CamelException *ex); +gboolean e_mail_shell_module_migrate (EShellModule *shell_module, + gint major, + gint minor, + gint micro, + GError **error); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS -#endif /* __EM_MIGRATE_H__ */ +#endif /* E_MAIL_SHELL_MODULE_MIGRATE_H */ diff --git a/mail/e-mail-shell-module.c b/mail/e-mail-shell-module.c new file mode 100644 index 0000000000..cd74a76cd9 --- /dev/null +++ b/mail/e-mail-shell-module.c @@ -0,0 +1,175 @@ +/* + * e-mail-shell-module.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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include <glib/gi18n.h> + +#include "shell/e-shell.h" +#include "shell/e-shell-module.h" +#include "shell/e-shell-window.h" + +#include "e-mail-shell-view.h" +#include "e-mail-shell-module.h" +#include "e-mail-shell-module-migrate.h" + +#define MODULE_NAME "mail" +#define MODULE_ALIASES "" +#define MODULE_SCHEMES "mailto:email" +#define MODULE_SORT_ORDER 200 + +/* Module Entry Point */ +void e_shell_module_init (GTypeModule *type_module); + +static void +action_mail_folder_new_cb (GtkAction *action, + EShellWindow *shell_window) +{ + /* FIXME */ +} + +static void +action_mail_message_new_cb (GtkAction *action, + EShellWindow *shell_window) +{ + /* FIXME */ +} + +static GtkActionEntry item_entries[] = { + + { "mail-message-new", + "mail-message-new", + N_("_Mail Message"), /* XXX C_() here */ + "<Shift><Control>m", + N_("Compose a new mail message"), + G_CALLBACK (action_mail_message_new_cb) } +}; + +static GtkActionEntry source_entries[] = { + + { "mail-folder-new", + "folder-new", + N_("Mail _Folder"), + NULL, + N_("Create a new mail folder"), + G_CALLBACK (action_mail_folder_new_cb) } +}; + +static gboolean +mail_module_handle_uri (EShellModule *shell_module, + const gchar *uri) +{ + /* FIXME */ + return FALSE; +} + +static void +mail_module_window_created (EShellModule *shell_module, + EShellWindow *shell_window) +{ + const gchar *module_name; + + module_name = G_TYPE_MODULE (shell_module)->name; + + e_shell_window_register_new_item_actions ( + shell_window, module_name, + item_entries, G_N_ELEMENTS (item_entries)); + + e_shell_window_register_new_source_actions ( + shell_window, module_name, + source_entries, G_N_ELEMENTS (source_entries)); +} + +static EShellModuleInfo module_info = { + + MODULE_NAME, + MODULE_ALIASES, + MODULE_SCHEMES, + MODULE_SORT_ORDER, + + /* is_busy */ NULL, + /* shutdown */ NULL, + e_mail_shell_module_migrate +}; + +void +e_shell_module_init (GTypeModule *type_module) +{ + EShell *shell; + EShellModule *shell_module; + + shell_module = E_SHELL_MODULE (type_module); + shell = e_shell_module_get_shell (shell_module); + + e_shell_module_set_info ( + shell_module, &module_info, + e_mail_shell_view_get_type (type_module)); + + g_signal_connect_swapped ( + shell, "handle-uri", + G_CALLBACK (mail_module_handle_uri), shell_module); + + g_signal_connect_swapped ( + shell, "window-created", + G_CALLBACK (mail_module_window_created), shell_module); +} + +/** + * e_mail_shell_module_load_store_by_uri: + * @uri: URI of the #CamelStore + * @name: name of the #CamelStore (for display purposes) + * + * Returns the newly added #CamelStore, or %NULL if a store could not + * be loaded for @uri. + * + * Returns: the newly added #CamelStore, or %NULL + **/ +CamelStore * +e_mail_shell_module_load_store_by_uri (const gchar *uri, + const gchar *name) +{ + return NULL; /* FIXME */ +} + +EAccountList * +mail_config_get_accounts (void) +{ + /* XXX Temporary placeholder. */ + return NULL; +} + +void +mail_config_save_accounts (void) +{ + /* XXX Temporary placeholder. */ +} + +ESignatureList * +mail_config_get_signatures (void) +{ + /* XXX Temporary placeholder. */ + return NULL; +} + +gchar * +em_uri_from_camel (const gchar *curi) +{ + /* XXX Temporary placeholder. */ + return NULL; +} diff --git a/mail/e-mail-shell-module.h b/mail/e-mail-shell-module.h new file mode 100644 index 0000000000..4d48adbcd7 --- /dev/null +++ b/mail/e-mail-shell-module.h @@ -0,0 +1,41 @@ +/* + * e-mail-shell-module.h + * + * 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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MAIL_SHELL_MODULE_H +#define E_MAIL_SHELL_MODULE_H + +#include <camel/camel-store.h> +#include <e-util/e-signature-list.h> +#include <libedataserver/e-account-list.h> + +G_BEGIN_DECLS + +CamelStore * e_mail_shell_module_load_store_by_uri + (const gchar *uri, + const gchar *name); +EAccountList * mail_config_get_accounts (void); +void mail_config_save_accounts (void); +ESignatureList *mail_config_get_signatures (void); +gchar * em_uri_from_camel (const gchar *curi); + +G_END_DECLS + +#endif /* E_MAIL_SHELL_MODULE_H */ diff --git a/mail/e-mail-shell-sidebar.c b/mail/e-mail-shell-sidebar.c new file mode 100644 index 0000000000..21dc949f6f --- /dev/null +++ b/mail/e-mail-shell-sidebar.c @@ -0,0 +1,139 @@ +/* + * e-mail-shell-sidebar.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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-mail-shell-sidebar.h" + +#define E_MAIL_SHELL_SIDEBAR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebarPrivate)) + +struct _EMailShellSidebarPrivate { + gint dummy; +}; + +enum { + PROP_0 +}; + +static gpointer parent_class; + +static void +mail_shell_sidebar_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +mail_shell_sidebar_dispose (GObject *object) +{ + EMailShellSidebarPrivate *priv; + + priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (object); + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +mail_shell_sidebar_finalize (GObject *object) +{ + EMailShellSidebarPrivate *priv; + + priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (object); + + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +mail_shell_sidebar_constructed (GObject *object) +{ + EMailShellSidebarPrivate *priv; + + priv = E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (object); + + /* Chain up to parent's constructed method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); +} + +static void +mail_shell_sidebar_class_init (EMailShellSidebarClass *class) +{ + GObjectClass *object_class; + + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (EMailShellSidebarPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->get_property = mail_shell_sidebar_get_property; + object_class->dispose = mail_shell_sidebar_dispose; + object_class->finalize = mail_shell_sidebar_finalize; + object_class->constructed = mail_shell_sidebar_constructed; +} + +static void +mail_shell_sidebar_init (EMailShellSidebar *mail_shell_sidebar) +{ + mail_shell_sidebar->priv = + E_MAIL_SHELL_SIDEBAR_GET_PRIVATE (mail_shell_sidebar); + + /* Postpone widget construction until we have a shell view. */ +} + +GType +e_mail_shell_sidebar_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) { + static const GTypeInfo type_info = { + sizeof (EMailShellSidebarClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) mail_shell_sidebar_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EMailShellSidebar), + 0, /* n_preallocs */ + (GInstanceInitFunc) mail_shell_sidebar_init, + NULL /* value_table */ + }; + + type = g_type_register_static ( + E_TYPE_SHELL_SIDEBAR, "EMailShellSidebar", + &type_info, 0); + } + + return type; +} + +GtkWidget * +e_mail_shell_sidebar_new (EShellView *shell_view) +{ + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); + + return g_object_new ( + E_TYPE_MAIL_SHELL_SIDEBAR, + "shell-view", shell_view, NULL); +} diff --git a/mail/e-mail-shell-sidebar.h b/mail/e-mail-shell-sidebar.h new file mode 100644 index 0000000000..ff35b96c0d --- /dev/null +++ b/mail/e-mail-shell-sidebar.h @@ -0,0 +1,67 @@ +/* + * e-mail-shell-sidebar.h + * + * 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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MAIL_SHELL_SIDEBAR_H +#define E_MAIL_SHELL_SIDEBAR_H + +#include <shell/e-shell-sidebar.h> +#include <shell/e-shell-view.h> + +/* Standard GObject macros */ +#define E_TYPE_MAIL_SHELL_SIDEBAR \ + (e_mail_shell_sidebar_get_type ()) +#define E_MAIL_SHELL_SIDEBAR(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebar)) +#define E_MAIL_SHELL_SIDEBAR_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebarClass)) +#define E_IS_MAIL_SHELL_SIDEBAR(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_SHELL_SIDEBAR)) +#define E_IS_MAIL_SHELL_SIDEBAR_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_SHELL_SIDEBAR)) +#define E_MAIL_SHELL_SIDEBAR_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_SHELL_SIDEBAR, EMailShellSidebarClass)) + +G_BEGIN_DECLS + +typedef struct _EMailShellSidebar EMailShellSidebar; +typedef struct _EMailShellSidebarClass EMailShellSidebarClass; +typedef struct _EMailShellSidebarPrivate EMailShellSidebarPrivate; + +struct _EMailShellSidebar { + EShellSidebar parent; + EMailShellSidebarPrivate *priv; +}; + +struct _EMailShellSidebarClass { + EShellSidebarClass parent_class; +}; + +GType e_mail_shell_sidebar_get_type (void); +GtkWidget * e_mail_shell_sidebar_new (EShellView *shell_view); + +G_END_DECLS + +#endif /* E_MAIL_SHELL_SIDEBAR_H */ diff --git a/mail/e-mail-shell-view-actions.c b/mail/e-mail-shell-view-actions.c new file mode 100644 index 0000000000..fd1abe6b64 --- /dev/null +++ b/mail/e-mail-shell-view-actions.c @@ -0,0 +1,1713 @@ +/* + * e-mail-shell-view-actions.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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-mail-shell-view-private.h" + +static void +action_mail_add_sender_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_caret_mode_cb (GtkToggleAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_check_for_junk_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_clipboard_copy_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_copy_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_create_search_folder_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_delete_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_download_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_empty_trash_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_filter_on_mailing_list_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_filter_on_recipients_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_filter_on_sender_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_filter_on_subject_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_filters_apply_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_find_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_flag_clear_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_flag_completed_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_flag_for_followup_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_copy_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_delete_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_expunge_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_mark_all_as_read_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_move_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_new_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_properties_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_refresh_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_rename_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_select_all_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_select_thread_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_folder_select_subthread_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_forward_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_forward_attached_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_forward_inline_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_forward_quoted_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_hide_deleted_cb (GtkToggleAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_hide_read_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_hide_selected_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_load_images_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_mark_important_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_mark_junk_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_mark_notjunk_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_mark_read_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_mark_unimportant_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_mark_unread_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_message_edit_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_message_new_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_message_open_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_message_post_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_move_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_next_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_next_important_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_next_thread_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_next_unread_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_preview_cb (GtkToggleAction *action, + EMailShellView *mail_shell_view) +{ + EMailShellContent *mail_shell_content; + gboolean preview_visible; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + preview_visible = gtk_toggle_action_get_active (action); + + e_mail_shell_content_set_preview_visible ( + mail_shell_content, preview_visible); +} + +static void +action_mail_previous_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_previous_important_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_previous_unread_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_print_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_print_preview_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_redirect_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_reply_all_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_reply_list_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_reply_post_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_reply_sender_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_save_as_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_search_folder_from_mailing_list_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_search_folder_from_recipients_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_search_folder_from_sender_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_search_folder_from_subject_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_select_all_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_show_all_headers_cb (GtkToggleAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_show_hidden_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_show_source_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_stop_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_threads_collapse_all_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_threads_expand_all_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_threads_group_by_cb (GtkToggleAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_tools_filters_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_tools_search_folders_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_tools_subscriptions_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_undelete_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_zoom_100_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_zoom_in_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_zoom_out_cb (GtkAction *action, + EMailShellView *mail_shell_view) +{ + /* FIXME */ + g_print ("Action: %s\n", gtk_action_get_name (GTK_ACTION (action))); +} + +static void +action_mail_view_cb (GtkRadioAction *action, + GtkRadioAction *current, + EMailShellView *mail_shell_view) +{ + EMailShellContent *mail_shell_content; + gboolean vertical_view; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + vertical_view = (gtk_radio_action_get_current_value (action) == 1); + + e_mail_shell_content_set_vertical_view ( + mail_shell_content, vertical_view); +} + +static GtkActionEntry mail_entries[] = { + + { "mail-add-sender", + NULL, + N_("A_dd Sender to Address Book"), + NULL, + N_("Add sender to address book"), + G_CALLBACK (action_mail_add_sender_cb) }, + + { "mail-check-for-junk", + "mail-mark-junk", + N_("Check for _Junk"), + NULL, + N_("Filter the selected messages for junk status"), + G_CALLBACK (action_mail_check_for_junk_cb) }, + + { "mail-clipboard-copy", + GTK_STOCK_COPY, + NULL, + NULL, + N_("Copy selected messages to the clipboard"), + G_CALLBACK (action_mail_clipboard_copy_cb) }, + + { "mail-copy", + "mail-copy", + N_("_Copy to Folder"), + "<Shift><Control>y", + N_("Copy selected messages to another folder"), + G_CALLBACK (action_mail_copy_cb) }, + + { "mail-create-search-folder" }, + + { "mail-delete", + "user-trash", + N_("_Delete Message"), + "<Control>d", + N_("Mark the selected messages for deletion"), + G_CALLBACK (action_mail_delete_cb) }, + + /* XXX Work around one-accelerator-per-action limit. */ + { "mail-delete-1", + NULL, + NULL, + "Delete", + NULL, + G_CALLBACK (action_mail_delete_cb) }, + + /* XXX Work around one-accelerator-per-action limit. */ + { "mail-delete-2", + NULL, + NULL, + "KP_Delete", + NULL, + G_CALLBACK (action_mail_delete_cb) }, + + { "mail-download", + NULL, + N_("_Download Messages for Offline Usage"), + NULL, + N_("Download messages of accounts and folders marked for offline"), + G_CALLBACK (action_mail_download_cb) }, + + { "mail-empty-trash", + NULL, + N_("Empty _Trash"), + NULL, + N_("Permanently remove all the deleted messages from all folders"), + G_CALLBACK (action_mail_empty_trash_cb) }, + + { "mail-filter-on-mailing-list", + NULL, + N_("Filter on Mailing _List..."), + NULL, + N_("Create a rule to filter messages to this mailing list"), + G_CALLBACK (action_mail_filter_on_mailing_list_cb) }, + + { "mail-filter-on-recipients", + NULL, + N_("Filter on _Recipients..."), + NULL, + N_("Create a rule to filter messages to these recipients"), + G_CALLBACK (action_mail_filter_on_recipients_cb) }, + + { "mail-filter-on-sender", + NULL, + N_("Filter on Se_nder..."), + NULL, + N_("Create a rule to filter messages from this sender"), + G_CALLBACK (action_mail_filter_on_sender_cb) }, + + { "mail-filter-on-subject", + NULL, + N_("Filter on _Subject..."), + NULL, + N_("Create a rule to filter messages with this subject"), + G_CALLBACK (action_mail_filter_on_subject_cb) }, + + { "mail-filters-apply", + "stock_mail-filters-apply", + N_("A_pply filters"), + "<Control>y", + N_("Apply filter rules to the selected messages"), + G_CALLBACK (action_mail_filters_apply_cb) }, + + { "mail-find", + GTK_STOCK_FIND, + N_("_Find in Message..."), + "<Shift><Control>f", + N_("Search for text in the body of the displayed message"), + G_CALLBACK (action_mail_find_cb) }, + + { "mail-flag-clear", + NULL, + N_("_Clear Flag"), + NULL, + N_("Remove the follow-up flag from the selected messages"), + G_CALLBACK (action_mail_flag_clear_cb) }, + + { "mail-flag-completed", + NULL, + N_("_Flag Completed"), + NULL, + N_("Set the follow-up flag to completed on the selected messages"), + G_CALLBACK (action_mail_flag_completed_cb) }, + + { "mail-flag-for-followup", + "stock_mail-flag-for-followup", + N_("Follow _Up..."), + "<Shift><Control>g", + N_("Flag the selected messages for follow-up"), + G_CALLBACK (action_mail_flag_for_followup_cb) }, + + { "mail-folder-copy", + "folder-copy", + N_("_Copy Folder To..."), + NULL, + N_("Copy the selected folder into another folder"), + G_CALLBACK (action_mail_folder_copy_cb) }, + + { "mail-folder-delete", + GTK_STOCK_DELETE, + NULL, + NULL, + N_("Permanently remove this folder"), + G_CALLBACK (action_mail_folder_delete_cb) }, + + { "mail-folder-expunge", + NULL, + N_("E_xpunge"), + "<Control>e", + N_("Permanently remove all deleted messages from this folder"), + G_CALLBACK (action_mail_folder_expunge_cb) }, + + { "mail-folder-mark-all-as-read", + "mail-read", + N_("Mar_k All Messages as Read"), + NULL, + N_("Mark all messages in the folder as read"), + G_CALLBACK (action_mail_folder_mark_all_as_read_cb) }, + + { "mail-folder-move", + "folder-move", + N_("_Move Folder To..."), + NULL, + N_("Move the selected folder into another folder"), + G_CALLBACK (action_mail_folder_move_cb) }, + + { "mail-folder-new", + "folder-new", + N_("_New..."), + NULL, + N_("Create a new folder for storing mail"), + G_CALLBACK (action_mail_folder_new_cb) }, + + { "mail-folder-properties", + GTK_STOCK_PROPERTIES, + NULL, + NULL, + N_("Change the properties of this folder"), + G_CALLBACK (action_mail_folder_properties_cb) }, + + { "mail-folder-refresh", + GTK_STOCK_REFRESH, + NULL, + "F5", + N_("Refresh the folder"), + G_CALLBACK (action_mail_folder_refresh_cb) }, + + { "mail-folder-rename", + NULL, + N_("_Rename..."), + "F2", + N_("Change the name of this folder"), + G_CALLBACK (action_mail_folder_rename_cb) }, + + { "mail-folder-select-all", + NULL, + N_("Select _All Messages"), + "<Control>a", + N_("Select all visible messages"), + G_CALLBACK (action_mail_folder_select_all_cb) }, + + { "mail-folder-select-thread", + NULL, + N_("Select Message _Thread"), + "<Control>h", + N_("Select all messages in the same thread as the selected message"), + G_CALLBACK (action_mail_folder_select_thread_cb) }, + + { "mail-folder-select-subthread", + NULL, + N_("Select Message S_ubthread"), + "<Shift><Control>h", + N_("Select all replies to the currently selected message"), + G_CALLBACK (action_mail_folder_select_subthread_cb) }, + + { "mail-forward", + "mail-forward", + N_("_Forward"), + "<Control>f", + N_("Forward the selected message to someone"), + G_CALLBACK (action_mail_forward_cb) }, + + { "mail-forward-attached", + NULL, + N_("_Attached"), + NULL, + N_("Forward the selected message to someone as an attachment"), + G_CALLBACK (action_mail_forward_attached_cb) }, + + { "mail-forward-inline", + NULL, + N_("_Inline"), + NULL, + N_("Forward the selected message in the body of a new message"), + G_CALLBACK (action_mail_forward_inline_cb) }, + + { "mail-forward-quoted", + NULL, + N_("_Quoted"), + NULL, + N_("Forward the selected message quoted like a reply"), + G_CALLBACK (action_mail_forward_quoted_cb) }, + + { "mail-hide-read", + NULL, + N_("Hide _Read Messages"), + NULL, + N_("Temporarily hide all messages that have already been read"), + G_CALLBACK (action_mail_hide_read_cb) }, + + { "mail-hide-selected", + NULL, + N_("Hide S_elected Messages"), + NULL, + N_("Temporarily hide the selected messages"), + G_CALLBACK (action_mail_hide_selected_cb) }, + + { "mail-load-images", + "image-x-generic", + N_("_Load Images"), + "<Control>i", + N_("Force images in HTML mail to be loaded"), + G_CALLBACK (action_mail_load_images_cb) }, + + { "mail-mark-important", + "mail-mark-important", + N_("_Important"), + NULL, + N_("Mark the selected messages as important"), + G_CALLBACK (action_mail_mark_important_cb) }, + + { "mail-mark-junk", + "mail-mark-junk", + N_("_Junk"), + "<Control>j", + N_("Mark the selected messages as junk"), + G_CALLBACK (action_mail_mark_junk_cb) }, + + { "mail-mark-notjunk", + "mail-mark-notjunk", + N_("_Not Junk"), + "<Shift><Control>j", + N_("Mark the selected messages as not being junk"), + G_CALLBACK (action_mail_mark_notjunk_cb) }, + + { "mail-mark-read", + "mail-mark-read", + N_("_Read"), + "<Control>k", + N_("Mark the selected messages as having been read"), + G_CALLBACK (action_mail_mark_read_cb) }, + + { "mail-mark-unimportant", + NULL, + N_("Uni_mportant"), + NULL, + N_("Mark the selected messages as unimportant"), + G_CALLBACK (action_mail_mark_unimportant_cb) }, + + { "mail-mark-unread", + "mail-mark-unread", + N_("_Unread"), + "<Shift><Control>k", + N_("Mark the selected messages as not having been read"), + G_CALLBACK (action_mail_mark_unread_cb) }, + + { "mail-message-edit", + NULL, + N_("_Edit as New Message..."), + NULL, + N_("Open the selected messages in the composer for editing"), + G_CALLBACK (action_mail_message_edit_cb) }, + + { "mail-message-new", + "mail-message-new", + N_("Compose _New Message"), + "<Shift><Control>m", + N_("Open a window for composing a mail message"), + G_CALLBACK (action_mail_message_new_cb) }, + + { "mail-message-open", + NULL, + N_("_Open in New Window"), + "<Control>o", + N_("Open the selected messages in a new window"), + G_CALLBACK (action_mail_message_open_cb) }, + + { "mail-message-post", + NULL, + N_("Pos_t New Message to Folder"), + NULL, + N_("Post a message to a public folder"), + G_CALLBACK (action_mail_message_post_cb) }, + + { "mail-move", + "mail-move", + N_("_Move to Folder"), + "<Shift><Control>v", + N_("Move selected messages to another folder"), + G_CALLBACK (action_mail_move_cb) }, + + { "mail-next", + GTK_STOCK_GO_FORWARD, + N_("_Next Message"), + "<Control>Page_Down", + N_("Display the next message"), + G_CALLBACK (action_mail_next_cb) }, + + { "mail-next-important", + NULL, + N_("Next _Important Message"), + NULL, + N_("Display the next important message"), + G_CALLBACK (action_mail_next_important_cb) }, + + { "mail-next-thread", + NULL, + N_("Next _Thread"), + NULL, + N_("Display the next thread"), + G_CALLBACK (action_mail_next_thread_cb) }, + + { "mail-next-unread", + NULL, + N_("Next _Unread Message"), + "<Control>bracketright", + N_("Display the next unread message"), + G_CALLBACK (action_mail_next_unread_cb) }, + + /* XXX Work around one-accelerator-per-action limit. */ + { "mail-next-unread-1", + NULL, + NULL, + "period", + NULL, + G_CALLBACK (action_mail_next_unread_cb) }, + + /* XXX Work around one-accelerator-per-action limit. */ + { "mail-next-unread-2", + NULL, + NULL, + "<Control>period", + NULL, + G_CALLBACK (action_mail_next_unread_cb) }, + + { "mail-previous", + GTK_STOCK_GO_BACK, + N_("_Previous Message"), + "<Control>Page_Up", + N_("Display the previous message"), + G_CALLBACK (action_mail_previous_cb) }, + + { "mail-previous-important", + NULL, + N_("Pr_evious Important Message"), + NULL, + N_("Display the previous important message"), + G_CALLBACK (action_mail_previous_important_cb) }, + + { "mail-previous-unread", + NULL, + N_("P_revious Unread Message"), + "<Control>bracketleft", + N_("Display the previous unread message"), + G_CALLBACK (action_mail_previous_unread_cb) }, + + /* XXX Work around one-accelerator-per-action limit. */ + { "mail-previous-unread-1", + NULL, + NULL, + "comma", + NULL, + G_CALLBACK (action_mail_previous_unread_cb) }, + + /* XXX Work around one-accelerator-per-action limit. */ + { "mail-previous-unread-2", + NULL, + NULL, + "<Control>comma", + NULL, + G_CALLBACK (action_mail_previous_unread_cb) }, + + { "mail-print", + GTK_STOCK_PRINT, + NULL, + NULL, + N_("Print this message"), + G_CALLBACK (action_mail_print_cb) }, + + { "mail-print-preview", + GTK_STOCK_PRINT_PREVIEW, + NULL, + NULL, + N_("Preview the message to be printed"), + G_CALLBACK (action_mail_print_preview_cb) }, + + { "mail-redirect", + NULL, + N_("Re_direct"), + NULL, + N_("Redirect (bounce) the selected message to someone"), + G_CALLBACK (action_mail_redirect_cb) }, + + { "mail-reply-all", + "mail-reply-all", + N_("Reply to _All"), + "<Shift><Control>r", + N_("Compose a reply to all the recipients of the selected message"), + G_CALLBACK (action_mail_reply_all_cb) }, + + { "mail-reply-list", + NULL, + N_("Reply to _List"), + "<Control>l", + N_("Compose a reply to the mailing list of the selected message"), + G_CALLBACK (action_mail_reply_list_cb) }, + + { "mail-reply-post", + NULL, + N_("Post a Repl_y"), + NULL, + N_("Post a reply to a message in a public folder"), + G_CALLBACK (action_mail_reply_post_cb) }, + + { "mail-reply-sender", + "mail-reply-sender", + N_("_Reply to Sender"), + "<Control>r", + N_("Compose a reply to the sender of the selected message"), + G_CALLBACK (action_mail_reply_sender_cb) }, + + { "mail-save-as", + GTK_STOCK_SAVE_AS, + N_("_Save As mbox..."), + NULL, + N_("Save selected message as an mbox file"), + G_CALLBACK (action_mail_save_as_cb) }, + + { "mail-search-folder-from-mailing-list", + NULL, + N_("Search Folder from Mailing _List..."), + NULL, + N_("Create a search folder for this mailing list"), + G_CALLBACK (action_mail_search_folder_from_mailing_list_cb) }, + + { "mail-search-folder-from-recipients", + NULL, + N_("Search Folder from Recipien_ts..."), + NULL, + N_("Create a search folder for these recipients"), + G_CALLBACK (action_mail_search_folder_from_recipients_cb) }, + + { "mail-search-folder-from-sender", + NULL, + N_("Search Folder from Sen_der..."), + NULL, + N_("Create a search folder for this sender"), + G_CALLBACK (action_mail_search_folder_from_sender_cb) }, + + { "mail-search-folder-from-subject", + NULL, + N_("Search Folder from S_ubject..."), + NULL, + N_("Create a search folder for this subject"), + G_CALLBACK (action_mail_search_folder_from_subject_cb) }, + + { "mail-select-all", + NULL, + N_("Select _All Text"), + "<Shift><Control>x", + N_("Select all the text in a message"), + G_CALLBACK (action_mail_select_all_cb) }, + + { "mail-show-hidden", + NULL, + N_("Show Hidde_n Messages"), + NULL, + N_("Show messages that have been temporarily hidden"), + G_CALLBACK (action_mail_show_hidden_cb) }, + + { "mail-show-source", + NULL, + N_("_Message Source"), + "<Control>u", + N_("Show the raw email source of the message"), + G_CALLBACK (action_mail_show_source_cb) }, + + { "mail-stop", + GTK_STOCK_STOP, + N_("Cancel"), + NULL, + N_("Cancel the current mail operation"), + G_CALLBACK (action_mail_stop_cb) }, + + { "mail-threads-collapse-all", + NULL, + N_("Collapse All _Threads"), + "<Shift><Control>b", + N_("Collapse all message threads"), + G_CALLBACK (action_mail_threads_collapse_all_cb) }, + + { "mail-threads-expand-all", + NULL, + N_("E_xpand All Threads"), + NULL, + N_("Expand all message threads"), + G_CALLBACK (action_mail_threads_expand_all_cb) }, + + { "mail-tools-filters", + NULL, + N_("_Message Filters"), + NULL, + N_("Create or edit rules for filtering new mail"), + G_CALLBACK (action_mail_tools_filters_cb) }, + + { "mail-tools-search-folders", + NULL, + N_("Search F_olders"), + NULL, + N_("Create or edit search folder definitions"), + G_CALLBACK (action_mail_tools_search_folders_cb) }, + + { "mail-tools-subscriptions", + NULL, + N_("_Subscriptions"), + NULL, + N_("Subscribe or unsubscribe to folders on remote servers"), + G_CALLBACK (action_mail_tools_subscriptions_cb) }, + + { "mail-undelete", + NULL, + N_("_Undelete Message"), + "<Shift><Control>d", + N_("Undelete the selected messages"), + G_CALLBACK (action_mail_undelete_cb) }, + + { "mail-zoom-100", + GTK_STOCK_ZOOM_100, + N_("_Normal Size"), + "<Control>0", + N_("Reset the text to its original size"), + G_CALLBACK (action_mail_zoom_100_cb) }, + + { "mail-zoom-in", + GTK_STOCK_ZOOM_IN, + N_("_Zoom In"), + "<Control>plus", + N_("Increase the text size"), + G_CALLBACK (action_mail_zoom_in_cb) }, + + { "mail-zoom-out", + GTK_STOCK_ZOOM_OUT, + N_("Zoom _Out"), + "<Control>minus", + N_("Decreate the text size"), + G_CALLBACK (action_mail_zoom_out_cb) }, + + /*** Menus ***/ + + { "mail-create-rule-menu", + NULL, + N_("Create R_ule"), + NULL, + NULL, + NULL }, + + { "mail-encoding-menu", + NULL, + N_("Ch_aracter Encoding"), + NULL, + NULL, + NULL }, + + { "mail-folder-menu", + NULL, + N_("F_older"), + NULL, + NULL, + NULL }, + + { "mail-forward-as-menu", + NULL, + N_("F_orward As..."), + NULL, + NULL, + NULL }, + + { "mail-goto-menu", + GTK_STOCK_JUMP_TO, + N_("_Go To"), + NULL, + NULL, + NULL }, + + { "mail-label-menu", + NULL, + N_("_Label"), + NULL, + NULL, + NULL }, + + { "mail-mark-as-menu", + NULL, + N_("Mar_k As"), + NULL, + NULL, + NULL }, + + { "mail-message-menu", + NULL, + N_("_Message"), + NULL, + NULL, + NULL }, + + { "mail-preview-menu", + NULL, + N_("_Preview"), + NULL, + NULL, + NULL }, + + { "mail-zoom-menu", + NULL, + N_("_Zoom"), + NULL, + NULL, + NULL } +}; + +static GtkToggleActionEntry mail_toggle_entries[] = { + + { "mail-caret-mode", + NULL, + N_("_Caret Mode"), + "F7", + N_("Show a blinking cursor in the body of displayed messages"), + G_CALLBACK (action_mail_caret_mode_cb), + FALSE }, + + { "mail-hide-deleted", + NULL, + N_("Hide _Deleted Messages"), + NULL, + N_("Hide deleted messages rather than displaying " + "them with a line through them"), + G_CALLBACK (action_mail_hide_deleted_cb), + TRUE }, + + { "mail-preview", + NULL, + N_("Show Message _Preview"), + "<Control>m", + N_("Show message preview pane"), + G_CALLBACK (action_mail_preview_cb), + TRUE }, + + { "mail-show-all-headers", + NULL, + N_("All Message _Headers"), + NULL, + N_("Show messages with all email headers"), + G_CALLBACK (action_mail_show_all_headers_cb), + FALSE }, + + { "mail-threads-group-by", + NULL, + N_("_Group By Threads"), + "<Control>t", + N_("Threaded message list"), + G_CALLBACK (action_mail_threads_group_by_cb), + FALSE } +}; + +static GtkRadioActionEntry mail_view_entries[] = { + + /* This action represents the initial active mail view. + * It should not be visible in the UI, nor should it be + * possible to switch to it from another shell view. */ + { "mail-view-internal", + NULL, + NULL, + NULL, + NULL, + -1 }, + + { "mail-view-classic", + NULL, + N_("_Classic View"), + NULL, + N_("Show message preview below the message list"), + 0 }, + + { "mail-view-vertical", + NULL, + N_("_Vertical View"), + NULL, + N_("Show message preview alongside the message list"), + 1 } +}; + +static GtkRadioActionEntry mail_filter_entries[] = { + + { "mail-filter-all-messages", + NULL, + N_("All Messages"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_ALL_MESSAGES }, + + { "mail-filter-important-messages", + "emblem-important", + N_("Important Messages"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_IMPORTANT_MESSAGES }, + + { "mail-filter-label-important", + NULL, + N_("Important"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_LABEL_IMPORTANT }, + + { "mail-filter-label-later", + NULL, + N_("Later"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_LABEL_LATER }, + + { "mail-filter-label-personal", + NULL, + N_("Personal"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_LABEL_PERSONAL }, + + { "mail-filter-label-to-do", + NULL, + N_("To Do"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_LABEL_TO_DO }, + + { "mail-filter-label-work", + NULL, + N_("Work"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_LABEL_WORK }, + + { "mail-filter-last-5-days-messages", + NULL, + N_("Last 5 Days' Messages"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_LAST_5_DAYS_MESSAGES }, + + { "mail-filter-messages-not-junk", + "mail-mark-notjunk", + N_("Messages Not Junk"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_MESSAGES_NOT_JUNK }, + + { "mail-filter-messages-with-attachments", + "mail-attachment", + N_("Messages with Attachments"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS }, + + { "mail-filter-no-label", + NULL, + N_("No Label"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_NO_LABEL }, + + { "mail-filter-read-messages", + "mail-read", + N_("Read Messages"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_READ_MESSAGES }, + + { "mail-filter-recent-messages", + NULL, + N_("Recent Messages"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_RECENT_MESSAGES }, + + { "mail-filter-unread-messages", + "mail-unread", + N_("Unread Messages"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_FILTER_UNREAD_MESSAGES } +}; + +static GtkRadioActionEntry mail_search_entries[] = { + + { "mail-search-body-contains", + NULL, + N_("Body contains"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SEARCH_BODY_CONTAINS }, + + { "mail-search-message-contains", + NULL, + N_("Message contains"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SEARCH_MESSAGE_CONTAINS }, + + { "mail-search-recipients-contain", + NULL, + N_("Recipients contain"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SEARCH_RECIPIENTS_CONTAIN }, + + { "mail-search-sender-contains", + NULL, + N_("Sender contains"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SEARCH_SENDER_CONTAINS }, + + { "mail-search-subject-contains", + NULL, + N_("Subject contains"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SEARCH_SUBJECT_CONTAINS }, + + { "mail-search-subject-or-recipients-contains", + NULL, + N_("Subject or Recipients contains"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SEARCH_SUBJECT_OR_RECIPIENTS_CONTAINS }, + + { "mail-search-subject-or-sender-contains", + NULL, + N_("Subject or Sender contains"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS } +}; + +static GtkRadioActionEntry mail_scope_entries[] = { + + { "mail-scope-all-accounts", + NULL, + N_("All Accounts"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SCOPE_ALL_ACCOUNTS }, + + { "mail-scope-current-account", + NULL, + N_("Current Account"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SCOPE_CURRENT_ACCOUNT }, + + { "mail-scope-current-folder", + NULL, + N_("Current Folder"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SCOPE_CURRENT_FOLDER }, + + { "mail-scope-current-message", + NULL, + N_("Current Message"), + NULL, + NULL, /* XXX Add a tooltip! */ + MAIL_SCOPE_CURRENT_MESSAGE } +}; + +void +e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) +{ + EShellView *shell_view; + EShellWindow *shell_window; + GtkActionGroup *action_group; + GtkUIManager *ui_manager; + GConfBridge *bridge; + GtkAction *action; + GObject *object; + const gchar *domain; + const gchar *key; + + shell_view = E_SHELL_VIEW (mail_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + ui_manager = e_shell_window_get_ui_manager (shell_window); + domain = GETTEXT_PACKAGE; + + action_group = mail_shell_view->priv->mail_actions; + gtk_action_group_set_translation_domain (action_group, domain); + gtk_action_group_add_actions ( + action_group, mail_entries, + G_N_ELEMENTS (mail_entries), mail_shell_view); + gtk_action_group_add_toggle_actions ( + action_group, mail_toggle_entries, + G_N_ELEMENTS (mail_toggle_entries), mail_shell_view); + gtk_action_group_add_radio_actions ( + action_group, mail_view_entries, + G_N_ELEMENTS (mail_view_entries), -1, + G_CALLBACK (action_mail_view_cb), mail_shell_view); + gtk_action_group_add_radio_actions ( + action_group, mail_search_entries, + G_N_ELEMENTS (mail_search_entries), + MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS, + NULL, NULL); + gtk_action_group_add_radio_actions ( + action_group, mail_scope_entries, + G_N_ELEMENTS (mail_scope_entries), + MAIL_SCOPE_CURRENT_FOLDER, + NULL, NULL); + gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); + + /* Bind GObject properties for GConf keys. */ + + bridge = gconf_bridge_get (); + + object = G_OBJECT (ACTION (MAIL_PREVIEW)); + key = "/apps/evolution/mail/display/show_preview"; + gconf_bridge_bind_property (bridge, key, object, "active"); + + /* XXX This is ugly. We're binding an integer property to a + * boolean GConf key. But since there's only two possible + * mail views (for now, anyway), it happens to work. */ + object = G_OBJECT (ACTION (MAIL_VIEW_CLASSIC)); + key = "/apps/evolution/mail/display/show_wide"; + gconf_bridge_bind_property (bridge, key, object, "current-value"); + + /* Fine tuning. */ + + action = ACTION (MAIL_DELETE); + g_object_set (action, "short-label", _("Delete"), NULL); + + action = ACTION (MAIL_NEXT); + g_object_set (action, "short-label", _("Next"), NULL); + + action = ACTION (MAIL_PREVIOUS); + g_object_set (action, "short-label", _("Previous"), NULL); + + action = ACTION (MAIL_REPLY_SENDER); + g_object_set (action, "short-label", _("Reply"), NULL); +} diff --git a/mail/e-mail-shell-view-actions.h b/mail/e-mail-shell-view-actions.h new file mode 100644 index 0000000000..98500b40e1 --- /dev/null +++ b/mail/e-mail-shell-view-actions.h @@ -0,0 +1,255 @@ +/* + * e-mail-shell-view-actions.h + * + * 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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MAIL_SHELL_VIEW_ACTIONS_H +#define E_MAIL_SHELL_VIEW_ACTIONS_H + +#include <shell/e-shell-window-actions.h> + +/* Mail Actions */ +#define E_SHELL_WINDOW_ACTION_MAIL_ADD_SENDER(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-add-sender") +#define E_SHELL_WINDOW_ACTION_MAIL_CARET_MODE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-caret-mode") +#define E_SHELL_WINDOW_ACTION_MAIL_CHECK_FOR_JUNK(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-check-for-junk") +#define E_SHELL_WINDOW_ACTION_MAIL_CLIPBOARD_COPY(window) \ + E_SHELL_WINDOw_ACTION ((window), "mail-clipboard-copy") +#define E_SHELL_WINDOW_ACTION_MAIL_COPY(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-copy") +#define E_SHELL_WINDOW_ACTION_MAIL_CREATE_SEARCH_FOLDER(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-create-search-folder") +#define E_SHELL_WINDOW_ACTION_MAIL_DELETE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-delete") +#define E_SHELL_WINDOW_ACTION_MAIL_DOWNLOAD(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-download") +#define E_SHELL_WINDOW_ACTION_MAIL_EMPTY_TRASH(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-empty-trash") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_MAILING_LIST(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-mailing-list") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_RECIPIENTS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-recipients") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_SENDER(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-sender") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ON_SUBJECT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-on-subject") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTERS_APPLY(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filters-apply") +#define E_SHELL_WINDOW_ACTION_MAIL_FIND(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-find") +#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_CLEAR(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-flag-clear") +#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_COMPLETED(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-flag-completed") +#define E_SHELL_WINDOW_ACTION_MAIL_FLAG_FOR_FOLLOWUP(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-flag-for-followup") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_COPY(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-copy") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_DELETE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-delete") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_EXPUNGE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-expunge") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_MARK_ALL_READ(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-mark-all-read") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_MOVE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-move") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_NEW(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-new") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_PROPERTIES(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-properties") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_REFRESH(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-refresh") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_RENAME(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-rename") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_ALL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-all") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_THREAD(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-thread") +#define E_SHELL_WINDOW_ACTION_MAIL_FOLDER_SELECT_SUBTHREAD(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-folder-select-subthread") +#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-forward") +#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_ATTACHED(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-forward-attached") +#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_INLINE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-forward-inline") +#define E_SHELL_WINDOW_ACTION_MAIL_FORWARD_QUOTED(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-forward-quoted") +#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_DELETED(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-hide-deleted") +#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_READ(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-hide-read") +#define E_SHELL_WINDOW_ACTION_MAIL_HIDE_SELECTED(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-hide-selected") +#define E_SHELL_WINDOW_ACTION_MAIL_LOAD_IMAGES(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-load-images") +#define E_SHELL_WINDOW_ACTION_MAIL_MARK_IMPORTANT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-mark-important") +#define E_SHELL_WINDOW_ACTION_MAIL_MARK_JUNK(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-mark-junk") +#define E_SHELL_WINDOW_ACTION_MAIL_MARK_NOTJUNK(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-mark-notjunk") +#define E_SHELL_WINDOW_ACTION_MAIL_MARK_READ(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-mark-read") +#define E_SHELL_WINDOW_ACTION_MAIL_MARK_UNIMPORTANT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-mark-unimportant") +#define E_SHELL_WINDOW_ACTION_MAIL_MARK_UNREAD(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-mark-unread") +#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_EDIT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-message-edit") +#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_NEW(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-message-new") +#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_OPEN(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-message-open") +#define E_SHELL_WINDOW_ACTION_MAIL_MESSAGE_POST(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-message-post") +#define E_SHELL_WINDOW_ACTION_MAIL_MOVE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-move") +#define E_SHELL_WINDOW_ACTION_MAIL_NEXT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-next") +#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_IMPORTANT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-next-important") +#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_THREAD(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-next-thread") +#define E_SHELL_WINDOW_ACTION_MAIL_NEXT_UNREAD(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-next-unread") +#define E_SHELL_WINDOW_ACTION_MAIL_PREVIEW(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-preview") +#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-previous") +#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS_IMPORTANT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-previous-important") +#define E_SHELL_WINDOW_ACTION_MAIL_PREVIOUS_UNREAD(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-previous-unread") +#define E_SHELL_WINDOW_ACTION_MAIL_PRINT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-print") +#define E_SHELL_WINDOW_ACTION_MAIL_PRINT_PREVIEW(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-print-preview") +#define E_SHELL_WINDOW_ACTION_MAIL_REDIRECT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-redirect") +#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_ALL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-reply-all") +#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_LIST(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-reply-list") +#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_POST(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-reply-post") +#define E_SHELL_WINDOW_ACTION_MAIL_REPLY_SENDER(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-reply-sender") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_MAILING_LIST(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-mailing-list") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_RECIPIENTS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-recipients") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_SENDER(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-sender") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_FOLDER_FROM_SUBJECT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-folder-from-subject") +#define E_SHELL_WINDOW_ACTION_MAIL_SELECT_ALL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-select-all") +#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_ALL_HEADERS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-show-all-headers") +#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_HIDDEN(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-show-hidden") +#define E_SHELL_WINDOW_ACTION_MAIL_SHOW_SOURCE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-show-source") +#define E_SHELL_WINDOW_ACTION_MAIL_STOP(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-stop") +#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_COLLAPSE_ALL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-threads-collapse-all") +#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_EXPAND_ALL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-threads-expand-all") +#define E_SHELL_WINDOW_ACTION_MAIL_THREADS_GROUP_BY(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-threads-group-by") +#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_FILTERS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-tools-filters") +#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_SEARCH_FOLDERS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-tools-search-folders") +#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_SUBSCRIPTIONS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-tools-subscriptions") +#define E_SHELL_WINDOW_ACTION_MAIL_UNDELETE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-undelete") +#define E_SHELL_WINDOW_ACTION_MAIL_VIEW_CLASSIC(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-view-classic") +#define E_SHELL_WINDOW_ACTION_MAIL_VIEW_VERTICAL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-view-vertical") +#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_100(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-zoom-100") +#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_IN(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-zoom-in") +#define E_SHELL_WINDOW_ACTION_MAIL_ZOOM_OUT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-zoom-out") + +/* Mail Query Actions */ +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_ALL_MESSAGES(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-all-messages") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_IMPORTANT_MESSAGES(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-important-messages") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_LABEL_IMPORTANT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-label-important") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_LABEL_LATER(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-label-later") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_LABEL_PERSONAL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-label-personal") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_LABEL_TO_DO(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-label-to-do") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_LABEL_WORK(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-label-work") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_LAST_5_DAYS_MESSAGES(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-last-5-days-messages") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_MESSAGES_NOT_JUNK(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-messages-not-junk") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-messages-with-attachments") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_NO_LABEL(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-no-label") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_READ_MESSAGES(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-read-messages") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_RECENT_MESSAGES(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-recent-messages") +#define E_SHELL_WINDOW_ACTION_MAIL_FILTER_UNREAD_MESSAGES(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-filter-unread-messages") +#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_ALL_ACCOUNTS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-scope-all-accounts") +#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_ACCOUNT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-account") +#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_FOLDER(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-folder") +#define E_SHELL_WINDOW_ACTION_MAIL_SCOPE_CURRENT_MESSAGE(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-scope-current-message") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_BODY_CONTAINS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-body-contains") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_MESSAGE_CONTAINS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-message-contains") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_RECIPIENTS_CONTAIN(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-recipients-contain") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SENDER_CONTAINS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-sender-contains") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_CONTAINS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-contains") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_OR_RECIPIENTS_CONTAINS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-or-recipients-contains") +#define E_SHELL_WINDOW_ACTION_MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-search-subject-or-sender-contains") + +/* Action Groups */ +#define E_SHELL_WINDOW_ACTION_GROUP_MAIL(window) \ + E_SHELL_WINDOW_ACTION_GROUP ((window), "mail") + +#endif /* E_MAIL_SHELL_VIEW_ACTIONS_H */ diff --git a/mail/e-mail-shell-view-private.c b/mail/e-mail-shell-view-private.c new file mode 100644 index 0000000000..ebbde76d03 --- /dev/null +++ b/mail/e-mail-shell-view-private.c @@ -0,0 +1,126 @@ +/* + * e-mail-shell-view-private.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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-mail-shell-view-private.h" + +#include <widgets/menus/gal-view-factory-etable.h> + +static void +mail_shell_view_load_view_collection (EShellViewClass *shell_view_class) +{ + GalViewCollection *collection; + GalViewFactory *factory; + ETableSpecification *spec; + const gchar *base_dir; + gchar *filename; + + collection = shell_view_class->view_collection; + + base_dir = EVOLUTION_ETSPECDIR; + spec = e_table_specification_new (); + filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL); + if (!e_table_specification_load_from_file (spec, filename)) + g_critical ("Unable to load ETable specification file " + "for mail"); + g_free (filename); + + factory = gal_view_factory_etable_new (spec); + gal_view_collection_add_factory (collection, factory); + g_object_unref (factory); + g_object_unref (spec); + + gal_view_collection_load (collection); +} + +static void +mail_shell_view_notify_view_id_cb (EMailShellView *mail_shell_view) +{ + EMailShellContent *mail_shell_content; + GalViewInstance *view_instance; + const gchar *view_id; + + mail_shell_content = mail_shell_view->priv->mail_shell_content; + view_instance = NULL; /* FIXME */ + view_id = e_shell_view_get_view_id (E_SHELL_VIEW (mail_shell_view)); + + /* A NULL view ID implies we're in a custom view. But you can + * only get to a custom view via the "Define Views" dialog, which + * would have already modified the view instance appropriately. + * Furthermore, there's no way to refer to a custom view by ID + * anyway, since custom views have no IDs. */ + if (view_id == NULL) + return; + + gal_view_instance_set_current_view_id (view_instance, view_id); +} + +void +e_mail_shell_view_private_init (EMailShellView *mail_shell_view, + EShellViewClass *shell_view_class) +{ + EMailShellViewPrivate *priv = mail_shell_view->priv; + + priv->mail_actions = gtk_action_group_new ("mail"); + priv->filter_actions = gtk_action_group_new ("mail-filter"); + + if (!gal_view_collection_loaded (shell_view_class->view_collection)) + mail_shell_view_load_view_collection (shell_view_class); + + g_signal_connect ( + mail_shell_view, "notify::view-id", + G_CALLBACK (mail_shell_view_notify_view_id_cb), NULL); +} + +void +e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) +{ + EMailShellViewPrivate *priv = mail_shell_view->priv; + EShellView *shell_view; + EShellContent *shell_content; + EShellSidebar *shell_sidebar; + + shell_view = E_SHELL_VIEW (mail_shell_view); + shell_content = e_shell_view_get_shell_content (shell_view); + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + + /* Cache these to avoid lots of awkward casting. */ + priv->mail_shell_content = g_object_ref (shell_content); + priv->mail_shell_sidebar = g_object_ref (shell_content); + + e_mail_shell_view_actions_init (mail_shell_view); +} + +void +e_mail_shell_view_private_dispose (EMailShellView *mail_shell_view) +{ + EMailShellViewPrivate *priv = mail_shell_view->priv; + + DISPOSE (priv->mail_actions); + DISPOSE (priv->filter_actions); + + DISPOSE (priv->mail_shell_content); + DISPOSE (priv->mail_shell_sidebar); +} + +void +e_mail_shell_view_private_finalize (EMailShellView *mail_shell_view) +{ +} diff --git a/mail/e-mail-shell-view-private.h b/mail/e-mail-shell-view-private.h new file mode 100644 index 0000000000..cc5f721d67 --- /dev/null +++ b/mail/e-mail-shell-view-private.h @@ -0,0 +1,126 @@ +/* + * e-mail-shell-view-private.h + * + * 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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MAIL_SHELL_VIEW_PRIVATE_H +#define E_MAIL_SHELL_VIEW_PRIVATE_H + +#include "e-mail-shell-view.h" + +#include <glib/gi18n.h> + +#include "e-util/gconf-bridge.h" + +#include "widgets/menus/gal-view-instance.h" + +#include "e-mail-shell-content.h" +#include "e-mail-shell-sidebar.h" +#include "e-mail-shell-view-actions.h" + +#define E_MAIL_SHELL_VIEW_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_SHELL_VIEW, EMailShellViewPrivate)) + +/* Shorthand, requires a variable named "shell_window". */ +#define ACTION(name) \ + (E_SHELL_WINDOW_ACTION_##name (shell_window)) +#define ACTION_GROUP(name) \ + (E_SHELL_WINDOW_ACTION_GROUP_##name (shell_window)) + +/* For use in dispose() methods. */ +#define DISPOSE(obj) \ + G_STMT_START { \ + if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \ + } G_STMT_END + +/* ETable Specifications */ +#define ETSPEC_FILENAME "message-list.etspec" + +G_BEGIN_DECLS + +/* Filter items are displayed in ascending order. */ +enum { + MAIL_FILTER_ALL_MESSAGES, + MAIL_FILTER_UNREAD_MESSAGES, + MAIL_FILTER_NO_LABEL, + MAIL_FILTER_LABEL_IMPORTANT, + MAIL_FILTER_LABEL_WORK, + MAIL_FILTER_LABEL_PERSONAL, + MAIL_FILTER_LABEL_TO_DO, + MAIL_FILTER_LABEL_LATER, + MAIL_FILTER_READ_MESSAGES, + MAIL_FILTER_RECENT_MESSAGES, + MAIL_FILTER_LAST_5_DAYS_MESSAGES, + MAIL_FILTER_MESSAGES_WITH_ATTACHMENTS, + MAIL_FILTER_IMPORTANT_MESSAGES, + MAIL_FILTER_MESSAGES_NOT_JUNK +}; + +/* Search items are displayed in ascending order. */ +enum { + MAIL_SEARCH_SUBJECT_OR_SENDER_CONTAINS, + MAIL_SEARCH_SUBJECT_OR_RECIPIENTS_CONTAINS, + MAIL_SEARCH_RECIPIENTS_CONTAIN, + MAIL_SEARCH_MESSAGE_CONTAINS, + MAIL_SEARCH_SUBJECT_CONTAINS, + MAIL_SEARCH_SENDER_CONTAINS, + MAIL_SEARCH_BODY_CONTAINS +}; + +/* Scope items are displayed in ascending order. */ +enum { + MAIL_SCOPE_CURRENT_FOLDER, + MAIL_SCOPE_CURRENT_ACCOUNT, + MAIL_SCOPE_ALL_ACCOUNTS, + MAIL_SCOPE_CURRENT_MESSAGE +}; + +struct _EMailShellViewPrivate { + + /*** UI Management ***/ + + GtkActionGroup *mail_actions; + GtkActionGroup *filter_actions; + + /*** Other Stuff ***/ + + /* These are just for convenience. */ + EMailShellContent *mail_shell_content; + EMailShellSidebar *mail_shell_sidebar; +}; + +void e_mail_shell_view_private_init + (EMailShellView *mail_shell_view, + EShellViewClass *shell_view_class); +void e_mail_shell_view_private_constructed + (EMailShellView *mail_shell_view); +void e_mail_shell_view_private_dispose + (EMailShellView *mail_shell_view); +void e_mail_shell_view_private_finalize + (EMailShellView *mail_shell_view); + +/* Private Utilities */ + +void e_mail_shell_view_actions_init + (EMailShellView *mail_shell_view); + +G_END_DECLS + +#endif /* E_MAIL_SHELL_VIEW_PRIVATE_H */ diff --git a/mail/e-mail-shell-view.c b/mail/e-mail-shell-view.c new file mode 100644 index 0000000000..d8c386754f --- /dev/null +++ b/mail/e-mail-shell-view.c @@ -0,0 +1,135 @@ +/* + * e-mail-shell-view.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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-mail-shell-view-private.h" + +enum { + PROP_0 +}; + +GType e_mail_shell_view_type = 0; +static gpointer parent_class; + +static void +mail_shell_view_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +mail_shell_view_dispose (GObject *object) +{ + e_mail_shell_view_private_dispose (E_MAIL_SHELL_VIEW (object)); + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +mail_shell_view_finalize (GObject *object) +{ + e_mail_shell_view_private_finalize (E_MAIL_SHELL_VIEW (object)); + + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +mail_shell_view_constructed (GObject *object) +{ + /* Chain up to parent's constructed() method. */ + G_OBJECT_CLASS (parent_class)->constructed (object); + + e_mail_shell_view_private_constructed (E_MAIL_SHELL_VIEW (object)); +} + +static void +mail_shell_view_update_actions (EShellView *shell_view) +{ + /* FIXME */ +} + +static void +mail_shell_view_class_init (EMailShellViewClass *class, + GTypeModule *type_module) +{ + GObjectClass *object_class; + EShellViewClass *shell_view_class; + + parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (EMailShellViewPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->get_property = mail_shell_view_get_property; + object_class->dispose = mail_shell_view_dispose; + object_class->finalize = mail_shell_view_finalize; + object_class->constructed = mail_shell_view_constructed; + + shell_view_class = E_SHELL_VIEW_CLASS (class); + shell_view_class->label = N_("Mail"); + shell_view_class->icon_name = "evolution-mail"; + shell_view_class->ui_definition = "evolution-mail.ui"; + shell_view_class->search_options = "/mail-search-options"; + shell_view_class->search_rules = "searchtypes.xml"; + shell_view_class->type_module = type_module; + shell_view_class->new_shell_content = e_mail_shell_content_new; + shell_view_class->new_shell_sidebar = e_mail_shell_sidebar_new; + shell_view_class->update_actions = mail_shell_view_update_actions; +} + +static void +mail_shell_view_init (EMailShellView *mail_shell_view, + EShellViewClass *shell_view_class) +{ + mail_shell_view->priv = + E_MAIL_SHELL_VIEW_GET_PRIVATE (mail_shell_view); + + e_mail_shell_view_private_init (mail_shell_view, shell_view_class); +} + +GType +e_mail_shell_view_get_type (GTypeModule *type_module) +{ + if (e_mail_shell_view_type == 0) { + const GTypeInfo type_info = { + sizeof (EMailShellViewClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) mail_shell_view_class_init, + (GClassFinalizeFunc) NULL, + type_module, + sizeof (EMailShellView), + 0, /* n_preallocs */ + (GInstanceInitFunc) mail_shell_view_init, + NULL /* value_table */ + }; + + e_mail_shell_view_type = + g_type_module_register_type ( + type_module, E_TYPE_SHELL_VIEW, + "EMailShellView", &type_info, 0); + } + + return e_mail_shell_view_type; +} diff --git a/mail/e-mail-shell-view.h b/mail/e-mail-shell-view.h new file mode 100644 index 0000000000..62f3f78524 --- /dev/null +++ b/mail/e-mail-shell-view.h @@ -0,0 +1,71 @@ +/* + * e-mail-shell-view.h + * + * 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/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_MAIL_SHELL_VIEW_H +#define E_MAIL_SHELL_VIEW_H + +#include <shell/e-shell-view.h> + +#include <e-mail-shell-content.h> +#include <e-mail-shell-sidebar.h> + +/* Standard GObject macros */ +#define E_TYPE_MAIL_SHELL_VIEW \ + (e_mail_shell_view_type) +#define E_MAIL_SHELL_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_SHELL_VIEW, EMailShellView)) +#define E_MAIL_SHELL_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_SHELL_VIEW, EMailShellViewClass)) +#define E_IS_MAIL_SHELL_VIEW(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_SHELL_VIEW)) +#define E_IS_MAIL_SHELL_VIEW_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_SHELL_VIEW)) +#define E_MAIL_SHELL_VIEW_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_SHELL_VIEW, EMailShellViewClass)) + +G_BEGIN_DECLS + +extern GType e_mail_shell_view_type; + +typedef struct _EMailShellView EMailShellView; +typedef struct _EMailShellViewClass EMailShellViewClass; +typedef struct _EMailShellViewPrivate EMailShellViewPrivate; + +struct _EMailShellView { + EShellView parent; + EMailShellViewPrivate *priv; +}; + +struct _EMailShellViewClass { + EShellViewClass parent_class; +}; + +GType e_mail_shell_view_get_type + (GTypeModule *type_module); + +G_END_DECLS + +#endif /* E_MAIL_SHELL_VIEW_H */ |