# Copyright (c) 2006,2007 Nokia Corporation
# All rights reserved.
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
-#
+#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# * Neither the name of the Nokia Corporation nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
if test "x$with_toolkit" == "xgtk"; then
PKG_CHECK_MODULES(MODEST_TOOLKIT,glib-2.0 >= 2.8 gtk+-2.0 >= 2.10 libnotify gtksourceview-2.0)
AC_DEFINE_UNQUOTED(MODEST_TOOLKIT_GTK, 1, ["Whether modest is being build for the gtk toolkit."])
- MODEST_TOOLKIT_DIR=gnome
+ MODEST_TOOLKIT_DIR=gtke
else
if test "$with_toolkit" = "hildon2"; then
AC_DEFINE_UNQUOTED(MODEST_TOOLKIT_HILDON2, 1, ["Whether modest is being build for the hildon2 toolkit."])
src/Makefile
src/modest-plugin-1.0.pc
src/dbus_api/Makefile
-src/gnome/Makefile
+src/gtk/Makefile
src/hildon2/Makefile
src/widgets/Makefile
docs/Makefile
+++ /dev/null
-#
-# Makefile.am
-# Time-stamp: <2007-06-23 15:41:18 (djcb)>
-#
-#
-# use Automake 'trick' ==> convenience static libraries, which
-# won't be installed, just for linking
-#
-INCLUDES=\
- $(MODEST_GSTUFF_CFLAGS) \
- $(MODEST_PLATFORM_CFLAGS) \
- $(MODEST_TOOLKIT_CFLAGS) \
- $(MODEST_PLUGIN_DEFINES) \
- -I ${top_srcdir}/src \
- -DPREFIX=\"@prefix@\" \
- -DPIXMAP_PREFIX=\"${datadir}/pixmaps/modest/\" \
- -DMODEST_UIDIR=\""$(datadir)/modest/ui/"\" \
- -Wall
-
-noinst_LTLIBRARIES=\
- libmodest-ui.la
-
-PIXMAP_FILES=\
- pixmaps/*.png
-
-libmodest_ui_la_SOURCES= \
- modest-account-assistant.c \
- modest-account-assistant.h \
- modest-default-account-settings-dialog.c \
- modest-account-view-window.c \
- modest-msg-edit-window.c \
- modest-icon-names.h \
- modest-gnome-global-settings-dialog.c \
- modest-gnome-global-settings-dialog.h \
- modest-gnome-sort-dialog.c \
- modest-gnome-sort-dialog.h \
- modest-gnome-utils.h \
- modest-gnome-utils.c \
- modest-main-window.c \
- modest-main-window-ui.h \
- modest-msg-view-window.c \
- modest-platform.c \
- modest-platform.c \
- modest-store-widget.c \
- modest-store-widget.h \
- modest-transport-widget.c \
- modest-transport-widget.h
-
-LDADD = \
- $(MODEST_GSTUFF_LIBS) \
- $(MODEST_PLATFORM_LIBS) \
- $(MODEST_TOOKIT_LIBS)
-
-pixmapdir = $(datadir)/pixmaps/modest
-pixmap_DATA = $(PIXMAP_FILES)
-
-UI_FILES=\
- ui/modest-main-window-ui.xml \
- ui/modest-msg-view-window-ui.xml \
- ui/modest-msg-edit-window-ui.xml
-
-uidir = $(datadir)/modest/ui
-ui_DATA = $(UI_FILES)
-
-EXTRA_DIST=\
- $(UI_FILES) \
- $(PIXMAP_FILES)
-
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <camel/camel-url.h>
-#include <widgets/modest-combo-box.h>
-#include "modest-account-assistant.h"
-#include "modest-store-widget.h"
-#include "modest-transport-widget.h"
-#include "modest-text-utils.h"
-#include "modest-runtime.h"
-#include "modest-utils.h"
-#include "modest-protocol-registry.h"
-#include "modest-platform.h"
-#include "gnome/modest-gnome-utils.h"
-
-#include <string.h>
-
-/* 'private'/'protected' functions */
-static void modest_account_assistant_class_init (ModestAccountAssistantClass *klass);
-static void modest_account_assistant_init (ModestAccountAssistant *obj);
-static void modest_account_assistant_finalize (GObject *obj);
-static gboolean on_before_next (ModestWizardDialog *dialog, GtkWidget *current_page, GtkWidget *next_page);
-static void on_response (ModestWizardDialog *wizard_dialog,
- gint response_id,
- gpointer user_data);
-static void on_response_before (ModestWizardDialog *wizard_dialog,
- gint response_id,
- gpointer user_data);
-
-/* list my signals */
-enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
- LAST_SIGNAL
-};
-
-typedef struct _ModestAccountAssistantPrivate ModestAccountAssistantPrivate;
-struct _ModestAccountAssistantPrivate {
-
- ModestAccountMgr *account_mgr;
- ModestAccountSettings *settings;
- gboolean dirty;
-
- GtkWidget *notebook;
-
- GtkWidget *account_name;
- GtkWidget *fullname;
- GtkWidget *email;
-
- GtkWidget *username;
- GtkWidget *password;
- GtkWidget *store_server_widget;
- GtkWidget *store_protocol_combo;
- GtkWidget *store_security_combo;
- GtkWidget *store_secure_auth;
- GtkWidget *transport_server_widget;
- GtkWidget *transport_security_combo;
- GtkWidget *transport_secure_auth_combo;
-
- GtkWidget *transport_widget;
-
- GtkWidget *transport_holder;
-
- ModestPairList *receiving_transport_store_protos;
- ModestPairList *sending_transport_store_protos;
- ModestPairList *security_protos;
- ModestPairList *transport_security_protos;
- ModestPairList *transport_auth_protos;
-};
-
-#define MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_ACCOUNT_ASSISTANT, \
- ModestAccountAssistantPrivate))
-/* globals */
-static GtkAssistantClass *parent_class = NULL;
-
-/* uncomment the following if you have defined any signals */
-/* static guint signals[LAST_SIGNAL] = {0}; */
-
-static void save_to_settings (ModestAccountAssistant *self);
-
-GType
-modest_account_assistant_get_type (void)
-{
- static GType my_type = 0;
- if (!my_type) {
- static const GTypeInfo my_info = {
- sizeof(ModestAccountAssistantClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc) modest_account_assistant_class_init,
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof(ModestAccountAssistant),
- 1, /* n_preallocs */
- (GInstanceInitFunc) modest_account_assistant_init,
- NULL
- };
- my_type = g_type_register_static (MODEST_TYPE_WIZARD_DIALOG,
- "ModestAccountAssistant",
- &my_info, 0);
- }
- return my_type;
-}
-
-static void
-modest_account_assistant_class_init (ModestAccountAssistantClass *klass)
-{
- GObjectClass *gobject_class;
- gobject_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_peek_parent (klass);
- gobject_class->finalize = modest_account_assistant_finalize;
-
- g_type_class_add_private (gobject_class, sizeof(ModestAccountAssistantPrivate));
-
- ModestWizardDialogClass *base_klass = (ModestWizardDialogClass*)(klass);
- base_klass->before_next = on_before_next;
-}
-
-static gboolean
-on_delete_event (GtkWidget *widget,
- GdkEvent *event,
- ModestAccountAssistant *assistant)
-{
- gtk_dialog_response (GTK_DIALOG (assistant), GTK_RESPONSE_CANCEL);
- return TRUE;
-}
-
-static void
-on_assistant_changed(GtkWidget* widget, ModestAccountAssistant* assistant)
-{
- ModestAccountAssistantPrivate* priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(assistant);
- g_return_if_fail (priv != NULL);
- priv->dirty = TRUE;
-}
-
-static void
-on_incoming_security_changed(GtkWidget* widget, ModestAccountAssistant* assistant)
-{
- ModestAccountAssistantPrivate* priv;
- ModestProtocolType protocol_id;
- ModestProtocol *protocol_security_incoming;
- const gchar *name;
- ModestProtocolRegistry *registry;
- gboolean is_secure;
-
- g_return_if_fail (MODEST_IS_ACCOUNT_ASSISTANT (assistant));
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(assistant);
- registry = modest_runtime_get_protocol_registry ();
- name = (const gchar *) modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->store_security_combo));
- protocol_security_incoming = modest_protocol_registry_get_protocol_by_name (registry,
- MODEST_PROTOCOL_REGISTRY_SECURE_PROTOCOLS,
- name);
- protocol_id = modest_protocol_get_type_id (protocol_security_incoming);
- is_secure = modest_protocol_registry_protocol_type_is_secure (registry, protocol_id);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->store_secure_auth), is_secure);
- gtk_widget_set_sensitive (priv->store_secure_auth, !is_secure);
-
- on_assistant_changed (widget, assistant);
-}
-
-static void
-invoke_enable_buttons_vfunc (ModestAccountAssistant *assistant)
-{
- ModestWizardDialogClass *klass = MODEST_WIZARD_DIALOG_GET_CLASS (assistant);
-
- /* Call the vfunc, which may be overridden by derived classes: */
- if (klass->enable_buttons) {
- GtkNotebook *notebook = NULL;
- g_object_get (assistant, "wizard-notebook", ¬ebook, NULL);
-
- const gint current_page_num = gtk_notebook_get_current_page (notebook);
- if (current_page_num == -1)
- return;
-
- GtkWidget* current_page_widget = gtk_notebook_get_nth_page (notebook, current_page_num);
- (*(klass->enable_buttons))(MODEST_WIZARD_DIALOG (assistant), current_page_widget);
- }
-}
-
-static void
-on_entry_changed (GtkEditable *editable, gpointer userdata)
-{
- on_assistant_changed (NULL, MODEST_ACCOUNT_ASSISTANT (userdata));
- invoke_enable_buttons_vfunc(MODEST_ACCOUNT_ASSISTANT (userdata));
-}
-
-static void
-on_combo_changed (GtkComboBox *combo, gpointer userdata)
-{
- on_assistant_changed (NULL, MODEST_ACCOUNT_ASSISTANT (userdata));
- invoke_enable_buttons_vfunc(MODEST_ACCOUNT_ASSISTANT (userdata));
-}
-
-static void
-add_intro_page (ModestAccountAssistant *assistant)
-{
- GtkWidget *page, *label;
- ModestAccountAssistantPrivate *priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE (assistant);
-
- page = gtk_vbox_new (FALSE, 12);
-
- label = gtk_label_new (_("mcen_ia_emailsetup_intro"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
- gtk_misc_set_padding (GTK_MISC (label), 12, 12);
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_box_pack_start (GTK_BOX(page), label, FALSE, FALSE, 0);
- gtk_widget_set_size_request (label, 400, -1);
- gtk_widget_show_all (page);
-
- gtk_notebook_append_page (GTK_NOTEBOOK(priv->notebook), page, NULL);
-
- gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(priv->notebook), page,
- _("mcen_ti_emailsetup_welcome"));
- /* gtk_notebook_set_page_type (GTK_NOTEBOOK(assistant), page, */
- /* GTK_ASSISTANT_PAGE_INTRO); */
- /* gtk_notebook_set_page_complete (GTK_ASSISTANT(assistant), */
- /* page, TRUE); */
-}
-
-
-static void
-set_current_page_complete (ModestAccountAssistant *self, gboolean complete)
-{
- GtkWidget *page;
- gint pageno;
- ModestAccountAssistantPrivate *priv;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE (self);
-
- pageno = gtk_notebook_get_current_page (GTK_NOTEBOOK(priv->notebook));
-
- if (pageno != -1) {
- page = gtk_notebook_get_nth_page (GTK_NOTEBOOK(priv->notebook), pageno);
- /* gtk_assistant_set_page_complete (GTK_NOTEBOOK(priv->notebook), page, complete); */
- }
-}
-
-
-static GtkWidget *
-field_name_label (const gchar *text)
-{
- GtkWidget *label;
- gchar *fixed_text;
-
- fixed_text = g_strconcat (text, ":", NULL);
- label = gtk_label_new (fixed_text);
- g_free (fixed_text);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-
- return label;
-}
-
-static void
-add_identity_page (ModestAccountAssistant *self)
-{
- GtkWidget *page, *label, *table, *frame;
- GtkWidget *alignment;
- ModestAccountAssistantPrivate *priv;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- priv->account_name = gtk_entry_new ();
- gtk_entry_set_max_length (GTK_ENTRY (priv->account_name), 40);
- g_signal_connect (G_OBJECT (priv->account_name), "changed", G_CALLBACK (on_entry_changed), self);
- priv->fullname = gtk_entry_new ();
- gtk_entry_set_max_length (GTK_ENTRY (priv->fullname), 40);
- g_signal_connect (G_OBJECT (priv->fullname), "changed", G_CALLBACK (on_entry_changed), self);
- priv->email = gtk_entry_new ();
- gtk_entry_set_width_chars (GTK_ENTRY (priv->email), 40);
- g_signal_connect (G_OBJECT (priv->email), "changed", G_CALLBACK (on_entry_changed), self);
- priv->username = gtk_entry_new ();
- gtk_entry_set_width_chars (GTK_ENTRY (priv->username), 40);
- g_signal_connect (G_OBJECT (priv->username), "changed", G_CALLBACK (on_entry_changed), self);
- priv->password = gtk_entry_new ();
- gtk_entry_set_width_chars (GTK_ENTRY (priv->password), 40);
- gtk_entry_set_visibility (GTK_ENTRY (priv->password), FALSE);
-
- page = gtk_vbox_new (FALSE, 24);
-
- label = gtk_label_new (
- _("Please enter below the name for the account you're creating."));
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 0, 12, 12);
- gtk_container_add (GTK_CONTAINER (alignment), label);
- gtk_box_pack_start (GTK_BOX(page), alignment, FALSE, FALSE, 0);
-
- table = gtk_table_new (1,2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_table_set_row_spacings (GTK_TABLE (table), 1);
- gtk_table_attach_defaults (GTK_TABLE(table),field_name_label (_("Account name")),
- 0,1,0,1);
- gtk_table_attach_defaults (GTK_TABLE(table),priv->account_name,
- 1,2,0,1);
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 0, 12, 0);
- gtk_box_pack_start (GTK_BOX(page), alignment, FALSE, FALSE, 0);
-
- frame = gtk_frame_new (NULL);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), _("<b>Public information </b>"));
- gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- table = gtk_table_new (2,2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
- gtk_table_attach_defaults (GTK_TABLE(table),field_name_label (_("Full name")),
- 0,1,0,1);
- gtk_table_attach_defaults (GTK_TABLE(table),field_name_label (_("Email address")),
- 0,1,1,2);
- gtk_table_attach_defaults (GTK_TABLE(table),priv->fullname,
- 1,2,0,1);
- gtk_table_attach_defaults (GTK_TABLE(table),priv->email,
- 1,2,1,2);
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
- gtk_container_add (GTK_CONTAINER (frame), alignment);
- gtk_box_pack_start (GTK_BOX(page), frame, FALSE, FALSE, 0);
-
-
- frame = gtk_frame_new (NULL);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), _("<b>Server account </b>"));
- gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- table = gtk_table_new (2,2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
- gtk_table_attach_defaults (GTK_TABLE(table),field_name_label (_("User name")),
- 0,1,0,1);
- gtk_table_attach_defaults (GTK_TABLE(table),field_name_label (_("Password")),
- 0,1,1,2);
- gtk_table_attach_defaults (GTK_TABLE(table),priv->username,
- 1,2,0,1);
- gtk_table_attach_defaults (GTK_TABLE(table),priv->password,
- 1,2,1,2);
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
- gtk_container_add (GTK_CONTAINER (frame), alignment);
- gtk_box_pack_start (GTK_BOX(page), frame, FALSE, FALSE, 0);
-
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_container_add (GTK_CONTAINER (alignment), page);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 12, 12, 12);
- gtk_widget_show_all (alignment);
- gtk_notebook_append_page (GTK_NOTEBOOK(priv->notebook), alignment, NULL);
-
- gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(priv->notebook), alignment,
- _("Identity"));
- /* gtk_assistant_set_page_type (GTK_ASSISTANT(self), alignment, */
- /* GTK_ASSISTANT_PAGE_CONTENT); */
- /* gtk_assistant_set_page_complete (GTK_ASSISTANT(self), */
- /* alignment, FALSE); */
-}
-
-
-static void
-receiving_page_update_completeness (GtkEditable *editable,
- ModestAccountAssistant *self)
-{
- ModestAccountAssistantPrivate *priv;
- const gchar *txt;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- txt = gtk_entry_get_text (GTK_ENTRY (priv->store_server_widget));
- if (!txt || strlen(txt) == 0) {
- set_current_page_complete (self, FALSE);
- return;
- }
- set_current_page_complete (self, TRUE);
-}
-
-static void
-add_receiving_page (ModestAccountAssistant *self)
-{
- GtkWidget *page, *vbox;
- GtkWidget *table, *frame;
- GtkWidget *alignment;
- ModestAccountAssistantPrivate *priv;
- GtkWidget *label;
- const gchar *tag = MODEST_PROTOCOL_REGISTRY_STORE_PROTOCOLS;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
- page = gtk_alignment_new (0.5, 0.0, 1.0, 0.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (page), 12, 12, 12, 12);
- vbox = gtk_vbox_new (FALSE, 24);
- gtk_container_add (GTK_CONTAINER (page), vbox);
-
- /* Warning label on top */
- label = gtk_label_new (_("Setting details for the incoming mail server."));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_box_pack_start (GTK_BOX(vbox),
- label,
- FALSE, FALSE, 0);
-
- /* Note: This ModestPairList* must exist for as long as the combo
- * that uses it, because the ModestComboBox uses the ID opaquely,
- * so it can't know how to manage its memory. */
- priv->receiving_transport_store_protos = modest_gnome_utils_get_protocols_pair_list (tag);
- priv->store_protocol_combo = modest_combo_box_new (priv->receiving_transport_store_protos, g_str_equal);
- priv->store_server_widget = gtk_entry_new ();
-
- /* Setup incoming server frame */
- frame = gtk_frame_new (NULL);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), _("<b>Incoming server</b>"));
- gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
- gtk_table_attach (GTK_TABLE (table), field_name_label (_("Account type")),
- 0, 1, 0, 1,
- GTK_FILL, 0, 0, 0);
- alignment = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
- gtk_container_add (GTK_CONTAINER (alignment), priv->store_protocol_combo);
- gtk_table_attach (GTK_TABLE (table), alignment,
- 1, 2, 0, 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
- gtk_table_attach (GTK_TABLE (table), field_name_label (_("Incoming server")),
- 0, 1, 1, 2,
- GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach (GTK_TABLE (table), priv->store_server_widget,
- 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
- alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
- gtk_container_add (GTK_CONTAINER (frame), alignment);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
-
- /* Setup security information widgets */
- tag = MODEST_PROTOCOL_REGISTRY_CONNECTION_PROTOCOLS;
- priv->security_protos = modest_gnome_utils_get_protocols_pair_list (tag);
- priv->store_security_combo = modest_combo_box_new (priv->security_protos, g_str_equal);
- priv->store_secure_auth = gtk_check_button_new ();
-
- /* Setup security frame */
- frame = gtk_frame_new (NULL);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), _("<b>Security options</b>"));
- gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
- gtk_table_attach (GTK_TABLE (table), field_name_label (_("Secure connection")),
- 0, 1, 0, 1,
- GTK_FILL, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), priv->store_security_combo,
- 1, 2, 0, 1,
- GTK_FILL | GTK_EXPAND, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), field_name_label (_("Use secure authentication")),
- 0, 1, 1, 2,
- GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach_defaults (GTK_TABLE (table), priv->store_secure_auth,
- 1, 2, 1, 2);
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
- gtk_container_add (GTK_CONTAINER (frame), alignment);
- gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, FALSE, 0);
-
- /* Setup assistant page */
- gtk_notebook_append_page (GTK_NOTEBOOK(priv->notebook), page, NULL);
-
- gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(priv->notebook), page,
- _("Incoming details"));
- gtk_widget_show_all (page);
-}
-
-
-
-
-static void
-on_sending_combo_box_changed (GtkComboBox *combo, ModestAccountAssistant *self)
-{
- ModestAccountAssistantPrivate *priv;
- gchar *chosen;
- ModestProtocol *proto;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- chosen = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combo));
-
- if (priv->transport_widget)
- gtk_container_remove (GTK_CONTAINER(priv->transport_holder),
- priv->transport_widget);
-
- proto = modest_protocol_registry_get_protocol_by_name (modest_runtime_get_protocol_registry (),
- MODEST_PROTOCOL_REGISTRY_TRANSPORT_PROTOCOLS,
- chosen);
- priv->transport_widget = modest_transport_widget_new (modest_protocol_get_type_id (proto));
-
- gtk_container_add (GTK_CONTAINER(priv->transport_holder),
- priv->transport_widget);
-
- gtk_widget_show_all (priv->transport_holder);
- on_assistant_changed (NULL, MODEST_ACCOUNT_ASSISTANT (self));
-}
-
-
-
-static void
-add_sending_page (ModestAccountAssistant *self)
-{
- GtkWidget *page, *vbox;
- GtkWidget *table, *frame;
- GtkWidget *alignment;
- ModestAccountAssistantPrivate *priv;
- GtkWidget *label;
- const gchar *tag = MODEST_PROTOCOL_REGISTRY_CONNECTION_PROTOCOLS;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
- page = gtk_alignment_new (0.5, 0.0, 1.0, 0.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (page), 12, 12, 12, 12);
- vbox = gtk_vbox_new (FALSE, 24);
- gtk_container_add (GTK_CONTAINER (page), vbox);
-
- /* Warning label on top */
- label = gtk_label_new (_("Settings for the outgoing mail server"));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_box_pack_start (GTK_BOX(vbox),
- label,
- FALSE, FALSE, 0);
-
- priv->transport_server_widget = gtk_entry_new ();
- /* Setup incoming server frame */
- frame = gtk_frame_new (NULL);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), _("<b>Outgoing server</b>"));
- gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
- gtk_table_attach (GTK_TABLE (table), field_name_label (_("Outgoing server (SMTP)")),
- 0, 1, 0, 1,
- GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach (GTK_TABLE (table), priv->transport_server_widget,
- 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
- alignment = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
- gtk_container_add (GTK_CONTAINER (frame), alignment);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
-
- /* Setup security information widgets */
- priv->transport_security_protos = modest_gnome_utils_get_protocols_pair_list (tag);
- priv->transport_security_combo = modest_combo_box_new (priv->security_protos, g_str_equal);
- tag = MODEST_PROTOCOL_REGISTRY_AUTH_PROTOCOLS;
- priv->transport_auth_protos = modest_gnome_utils_get_protocols_pair_list (tag);
- priv->transport_secure_auth_combo = GTK_WIDGET (modest_combo_box_new (priv->transport_auth_protos, g_str_equal));
-
- /* Setup security frame */
- frame = gtk_frame_new (NULL);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), _("<b>Security options</b>"));
- gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
- gtk_table_attach (GTK_TABLE (table), field_name_label (_("Secure connection")),
- 0, 1, 0, 1,
- GTK_FILL, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), priv->transport_security_combo,
- 1, 2, 0, 1,
- GTK_FILL | GTK_EXPAND, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), field_name_label (_("Secure authentication")),
- 0, 1, 1, 2,
- GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach_defaults (GTK_TABLE (table), priv->transport_secure_auth_combo,
- 1, 2, 1, 2);
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 0.0);
- gtk_container_add (GTK_CONTAINER (alignment), table);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
- gtk_container_add (GTK_CONTAINER (frame), alignment);
- gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, FALSE, 0);
-
- /* Setup assistant page */
- gtk_notebook_append_page (GTK_NOTEBOOK(priv->notebook), page, NULL);
-
- gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(priv->notebook), page,
- _("Outgoing details"));
- gtk_widget_show_all (page);
-
-}
-
-static void
-modest_account_assistant_init (ModestAccountAssistant *obj)
-{
- ModestAccountAssistantPrivate *priv;
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(obj);
-
- priv->account_mgr = NULL;
-
- priv->store_server_widget = NULL;
- priv->transport_widget = NULL;
- priv->settings = modest_account_settings_new ();
- priv->dirty = FALSE;
-
- priv->notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
-
- g_object_set (obj, "wizard-notebook", priv->notebook, NULL);
- g_object_set (obj, "wizard-name", _("Account wizard"), NULL);
-
- add_intro_page (obj);
- add_identity_page (obj);
- add_receiving_page (obj);
- add_sending_page (obj);
-
- gtk_notebook_set_current_page (GTK_NOTEBOOK(priv->notebook), 0);
- gtk_window_set_resizable (GTK_WINDOW(obj), TRUE);
- gtk_window_set_default_size (GTK_WINDOW(obj), 400, 400);
-
- gtk_window_set_modal (GTK_WINDOW(obj), TRUE);
-
- g_signal_connect_after (G_OBJECT (obj), "response",
- G_CALLBACK (on_response), obj);
-
- /* This is to show a confirmation dialog when the user hits cancel */
- g_signal_connect (G_OBJECT (obj), "response",
- G_CALLBACK (on_response_before), obj);
-
- g_signal_connect (G_OBJECT (obj), "delete-event",
- G_CALLBACK (on_delete_event), obj);
-}
-
-static void
-modest_account_assistant_finalize (GObject *obj)
-{
- ModestAccountAssistantPrivate *priv;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(obj);
-
- if (priv->account_mgr) {
- g_object_unref (G_OBJECT(priv->account_mgr));
- priv->account_mgr = NULL;
- }
-
- if (priv->settings) {
- g_object_unref (G_OBJECT (priv->settings));
- priv->settings = NULL;
- }
-
- /* These had to stay alive for as long as the comboboxes that used them: */
- modest_pair_list_free (priv->receiving_transport_store_protos);
- modest_pair_list_free (priv->sending_transport_store_protos);
-
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-static const gchar*
-get_account_name (ModestAccountAssistant *self)
-{
- ModestAccountAssistantPrivate *priv;
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- return gtk_entry_get_text (GTK_ENTRY(priv->account_name));
-}
-
-static const gchar*
-get_fullname (ModestAccountAssistant *self)
-{
- ModestAccountAssistantPrivate *priv;
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- return gtk_entry_get_text (GTK_ENTRY(priv->fullname));
-}
-
-
-
-static const gchar*
-get_email (ModestAccountAssistant *self)
-{
- ModestAccountAssistantPrivate *priv;
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- return gtk_entry_get_text (GTK_ENTRY(priv->email));
-}
-
-
-
-/*
- * FIXME: hmmmm this a Camel internal thing, should move this
- * somewhere else
- */
-static gchar*
-get_account_uri (ModestProtocolType proto, const gchar* path)
-{
- CamelURL *url;
- gchar *uri;
-
- if (proto == modest_protocol_registry_get_mbox_type_id ()) {
- url = camel_url_new ("mbox:", NULL);
- } else {
- if (proto == modest_protocol_registry_get_maildir_type_id ())
- url = camel_url_new ("maildir:", NULL);
- else
- g_return_val_if_reached (NULL);
- }
-
- camel_url_set_path (url, path);
- uri = camel_url_to_string (url, 0);
- camel_url_free (url);
-
- return uri;
-}
-
-static gchar*
-get_new_server_account_name (ModestAccountMgr* acc_mgr,
- ModestProtocolType proto_id,
- const gchar *username,
- const gchar *servername)
-{
- gchar *name;
- const gchar *proto_name;
- gint i = 0;
- ModestProtocolRegistry *registry;
- ModestProtocol *proto;
-
- registry = modest_runtime_get_protocol_registry ();
- proto = modest_protocol_registry_get_protocol_by_type (registry, proto_id);
- proto_name = modest_protocol_get_name (proto);
-
- while (TRUE) {
- name = g_strdup_printf ("%s:%d", proto_name, i++);
-
- if (modest_account_mgr_account_exists (acc_mgr, name, TRUE))
- g_free (name);
- else
- break;
- }
- return name;
-}
-
-
-
-GtkWidget*
-modest_account_assistant_new (ModestAccountMgr *account_mgr)
-{
- GObject *obj;
- ModestAccountAssistant *self;
- ModestAccountAssistantPrivate *priv;
-
- g_return_val_if_fail (account_mgr, NULL);
-
- obj = g_object_new(MODEST_TYPE_ACCOUNT_ASSISTANT, NULL);
- self = MODEST_ACCOUNT_ASSISTANT(obj);
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- g_object_ref (account_mgr);
- priv->account_mgr = account_mgr;
-
- return GTK_WIDGET(self);
-}
-
-static gchar*
-get_entered_account_title (ModestAccountAssistant *self)
-{
- ModestAccountAssistantPrivate *priv;
- const gchar* account_title;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
- account_title = gtk_entry_get_text (GTK_ENTRY (priv->account_name));
-
- if (!account_title || (strlen (account_title) == 0)) {
- return NULL;
- } else {
- /* Strip it of whitespace at the start and end: */
- gchar *result = g_strdup (account_title);
- result = g_strstrip (result);
-
- if (!result)
- return NULL;
-
- if (strlen (result) == 0) {
- g_free (result);
- return NULL;
- }
-
- return result;
- }
-}
-
-static gboolean
-on_before_next (ModestWizardDialog *dialog, GtkWidget *current_page, GtkWidget *next_page)
-{
- ModestAccountAssistant *self = MODEST_ACCOUNT_ASSISTANT (dialog);
- ModestAccountAssistantPrivate *priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE (self);
-
- /* Do extra validation that couldn't be done for every key press,
- * either because it was too slow,
- * or because it requires interaction:
- */
- if(!next_page) /* This is NULL when this is a click on Finish. */
- {
- save_to_settings (self);
- modest_account_mgr_add_account_from_settings (modest_runtime_get_account_mgr (), priv->settings);
- }
-
-
- return TRUE;
-}
-
-static gint
-get_serverport_incoming(ModestProtocolType protocol,
- ModestProtocolType security)
-{
- int serverport_incoming = 0;
-
- /* We don't check for SMTP here as that is impossible for an incoming server. */
- if ((security == modest_protocol_registry_get_none_connection_type_id ()) ||
- (security == modest_protocol_registry_get_tls_connection_type_id ()) ||
- (security == modest_protocol_registry_get_tlsop_connection_type_id ())) {
-
- if (protocol == MODEST_PROTOCOLS_STORE_IMAP) {
- serverport_incoming = 143;
- } else if (protocol == MODEST_PROTOCOLS_STORE_POP) {
- serverport_incoming = 110;
- }
- } else if (security == modest_protocol_registry_get_ssl_connection_type_id ()) {
- if (protocol == MODEST_PROTOCOLS_STORE_IMAP) {
- serverport_incoming = 993;
- } else if (protocol == MODEST_PROTOCOLS_STORE_POP) {
- serverport_incoming = 995;
- }
- }
-
- return serverport_incoming;
-}
-
-static GList*
-check_for_supported_auth_methods (ModestAccountAssistant* self)
-{
- GError *error = NULL;
- ModestProtocolType protocol;
- const gchar* hostname;
- const gchar* username;
- gchar *store_protocol_name, *store_security_name;
- ModestProtocolType security_protocol;
- int port_num;
- GList *list_auth_methods;
- ModestAccountAssistantPrivate *priv;
- ModestProtocolRegistry *registry;
- ModestProtocol *proto;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE (self);
- hostname = gtk_entry_get_text(GTK_ENTRY(priv->store_server_widget));
- username = gtk_entry_get_text(GTK_ENTRY(priv->username));
- store_protocol_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (priv->store_protocol_combo));
- registry = modest_runtime_get_protocol_registry ();
- proto = modest_protocol_registry_get_protocol_by_name (registry,
- MODEST_PROTOCOL_REGISTRY_STORE_PROTOCOLS,
- store_protocol_name);
- protocol = modest_protocol_get_type_id (proto);
-
- g_free (store_protocol_name);
- store_security_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (priv->store_security_combo));
-
- proto = modest_protocol_registry_get_protocol_by_name (registry,
- MODEST_PROTOCOL_REGISTRY_CONNECTION_PROTOCOLS,
- store_security_name);
- security_protocol = modest_protocol_get_type_id (proto);
- g_free (store_security_name);
- port_num = get_serverport_incoming(protocol, security_protocol);
- list_auth_methods = modest_utils_get_supported_secure_authentication_methods (protocol, hostname, port_num,
- username, GTK_WINDOW (self), &error);
-
- if (list_auth_methods) {
- /* TODO: Select the correct method */
- GList* list = NULL;
- GList* method;
- for (method = list_auth_methods; method != NULL; method = g_list_next(method)) {
- ModestProtocolType auth = (ModestProtocolType) (GPOINTER_TO_INT(method->data));
- if (modest_protocol_registry_protocol_type_is_secure (registry, auth)) {
- list = g_list_append(list, GINT_TO_POINTER(auth));
- }
- }
-
- g_list_free(list_auth_methods);
-
- if (list)
- return list;
- }
-
- if(error != NULL)
- g_error_free(error);
-
- return NULL;
-}
-
-static ModestProtocolType check_first_supported_auth_method(ModestAccountAssistant* self)
-{
- ModestProtocolType result = MODEST_PROTOCOLS_AUTH_PASSWORD;
-
- GList* methods = check_for_supported_auth_methods(self);
- if (methods)
- {
- /* Use the first one: */
- result = (ModestProtocolType) (GPOINTER_TO_INT(methods->data));
- g_list_free(methods);
- }
-
- return result;
-}
-
-/**
- * save_to_settings:
- * @self: a #ModestEasysetupWizardDialog
- *
- * takes information from all the wizard and stores it in settings
- */
-static void
-save_to_settings (ModestAccountAssistant *self)
-{
- ModestAccountAssistantPrivate *priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE (self);
- gchar* display_name;
- const gchar *username, *password;
- gchar *store_hostname, *transport_hostname;
- guint store_port, transport_port;
- ModestProtocolType store_protocol, transport_protocol;
- ModestProtocolType store_security, transport_security;
- ModestProtocolType store_auth_protocol, transport_auth_protocol;
- ModestServerAccountSettings *store_settings, *transport_settings;
- const gchar *fullname, *email_address;
-
- /* username and password (for both incoming and outgoing): */
- username = gtk_entry_get_text (GTK_ENTRY (priv->username));
- password = gtk_entry_get_text (GTK_ENTRY (priv->password));
-
- /* Incoming server: */
- /* Note: We need something as default for the ModestTransportStoreProtocol* values,
- * or modest_account_mgr_add_server_account will fail. */
- store_port = 0;
- store_protocol = MODEST_PROTOCOLS_STORE_POP;
- store_security = MODEST_PROTOCOLS_CONNECTION_NONE;
- store_auth_protocol = MODEST_PROTOCOLS_AUTH_NONE;
-
- /* Use custom pages because no preset was specified: */
- store_hostname = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->store_server_widget) ));
- store_protocol = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->store_protocol_combo));
- store_security = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->store_security_combo));
-
- /* The UI spec says:
- * If secure authentication is unchecked, allow sending username and password also as plain text.
- * If secure authentication is checked, require one of the secure methods during
- * connection: SSL, TLS, CRAM-MD5 etc. */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->store_secure_auth)) &&
- !modest_protocol_registry_protocol_type_is_secure(modest_runtime_get_protocol_registry (),
- store_security)) {
- store_auth_protocol = check_first_supported_auth_method (self);
- } else {
- store_auth_protocol = MODEST_PROTOCOLS_AUTH_PASSWORD;
- }
-
- /* now we store the store account settings */
- store_settings = modest_account_settings_get_store_settings (priv->settings);
- modest_server_account_settings_set_hostname (store_settings, store_hostname);
- modest_server_account_settings_set_username (store_settings, username);
- modest_server_account_settings_set_password (store_settings, password);
- modest_server_account_settings_set_protocol (store_settings, store_protocol);
- modest_server_account_settings_set_security_protocol (store_settings, store_security);
- modest_server_account_settings_set_auth_protocol (store_settings, store_auth_protocol);
- if (store_port != 0)
- modest_server_account_settings_set_port (store_settings, store_port);
-
- g_object_unref (store_settings);
- g_free (store_hostname);
-
- /* Outgoing server: */
- transport_hostname = NULL;
- transport_protocol = MODEST_PROTOCOLS_STORE_POP;
- transport_security = MODEST_PROTOCOLS_CONNECTION_NONE;
- transport_auth_protocol = MODEST_PROTOCOLS_AUTH_NONE;
- transport_port = 0;
-
- transport_hostname = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->transport_server_widget) ));
- transport_protocol = MODEST_PROTOCOLS_TRANSPORT_SMTP; /* It's always SMTP for outgoing. */
- transport_security = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->transport_security_combo));
- transport_auth_protocol = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->transport_secure_auth_combo));
-
- /* now we transport the transport account settings */
- transport_settings = modest_account_settings_get_transport_settings (priv->settings);
- modest_server_account_settings_set_hostname (transport_settings, transport_hostname);
- modest_server_account_settings_set_username (transport_settings, username);
- modest_server_account_settings_set_password (transport_settings, password);
- modest_server_account_settings_set_protocol (transport_settings, transport_protocol);
- modest_server_account_settings_set_security_protocol (transport_settings, transport_security);
- modest_server_account_settings_set_auth_protocol (transport_settings, transport_auth_protocol);
- if (transport_port != 0)
- modest_server_account_settings_set_port (transport_settings, transport_port);
-
- g_object_unref (transport_settings);
- g_free (transport_hostname);
-
- fullname = gtk_entry_get_text (GTK_ENTRY (priv->fullname));
- email_address = gtk_entry_get_text (GTK_ENTRY (priv->email));
- modest_account_settings_set_fullname (priv->settings, fullname);
- modest_account_settings_set_email_address (priv->settings, email_address);
- /* we don't set retrieve type to preserve advanced settings if any. By default account settings
- are set to headers only */
-
- display_name = get_entered_account_title (self);
- modest_account_settings_set_display_name (priv->settings, display_name);
- g_free (display_name);
-
-}
-
-static void
-on_response (ModestWizardDialog *wizard_dialog,
- gint response_id,
- gpointer user_data)
-{
- ModestAccountAssistant *self = MODEST_ACCOUNT_ASSISTANT (wizard_dialog);
-
- invoke_enable_buttons_vfunc (self);
-}
-
-static void
-on_response_before (ModestWizardDialog *wizard_dialog,
- gint response_id,
- gpointer user_data)
-{
- ModestAccountAssistant *self = MODEST_ACCOUNT_ASSISTANT (wizard_dialog);
- ModestAccountAssistantPrivate *priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(wizard_dialog);
-
- if (response_id == GTK_RESPONSE_CANCEL) {
- /* This is mostly copied from
- * src/maemo/modest-account-settings-dialog.c */
- if (priv->dirty) {
- gint dialog_response = modest_platform_run_confirmation_dialog (GTK_WINDOW (self),
- _("imum_nc_wizard_confirm_lose_changes"));
-
- if (dialog_response != GTK_RESPONSE_OK) {
- /* Don't let the dialog close */
- g_signal_stop_emission_by_name (wizard_dialog, "response");
- }
- }
- }
-}
-
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MODEST_ACCOUNT_ASSISTANT_H__
-#define __MODEST_ACCOUNT_ASSISTANT_H__
-
-#include <modest-account-mgr.h>
-#include <widgets/modest-wizard-dialog.h>
-
-G_BEGIN_DECLS
-
-/* standard convenience macros */
-#define MODEST_TYPE_ACCOUNT_ASSISTANT (modest_account_assistant_get_type())
-#define MODEST_ACCOUNT_ASSISTANT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_ACCOUNT_ASSISTANT,ModestAccountAssistant))
-#define MODEST_ACCOUNT_ASSISTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_ACCOUNT_ASSISTANT,ModestAccountAssistantClass))
-#define MODEST_IS_ACCOUNT_ASSISTANT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_ACCOUNT_ASSISTANT))
-#define MODEST_IS_ACCOUNT_ASSISTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_ACCOUNT_ASSISTANT))
-#define MODEST_ACCOUNT_ASSISTANT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_ACCOUNT_ASSISTANT,ModestAccountAssistantClass))
-
-typedef struct _ModestAccountAssistant ModestAccountAssistant;
-typedef struct _ModestAccountAssistantClass ModestAccountAssistantClass;
-
-struct _ModestAccountAssistant {
- ModestWizardDialog parent;
- /* insert public members, if any */
-};
-
-struct _ModestAccountAssistantClass {
- ModestWizardDialogClass parent_class;
- /* insert signal callback declarations, eg. */
- /* void (* my_event) (ModestAccountAssistant* obj); */
-};
-
-GType modest_account_assistant_get_type (void) G_GNUC_CONST;
-
-GtkWidget* modest_account_assistant_new (ModestAccountMgr* account_mgr);
-
-
-G_END_DECLS
-
-#endif /* __MODEST_ACCOUNT_ASSISTANT_H__ */
-
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include <widgets/modest-account-view-window.h>
-#include <widgets/modest-account-view.h>
-#include "modest-ui-actions.h"
-#include <modest-runtime.h>
-#include <modest-account-mgr-helpers.h>
-#include <string.h>
-#include "modest-account-assistant.h"
-#include "modest-account-protocol.h"
-#include "modest-tny-platform-factory.h"
-#include "modest-platform.h"
-
-/* 'private'/'protected' functions */
-static void modest_account_view_window_class_init (ModestAccountViewWindowClass *klass);
-static void modest_account_view_window_init (ModestAccountViewWindow *obj);
-static void modest_account_view_window_finalize (GObject *obj);
-/* list my signals */
-enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
- LAST_SIGNAL
-};
-
-typedef struct _ModestAccountViewWindowPrivate ModestAccountViewWindowPrivate;
-struct _ModestAccountViewWindowPrivate {
- GtkWidget *add_button;
- GtkWidget *edit_button;
- GtkWidget *remove_button;
- GtkWidget *default_button;
- ModestAccountView *account_view;
-};
-#define MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_ACCOUNT_VIEW_WINDOW, \
- ModestAccountViewWindowPrivate))
-/* globals */
-static GtkDialogClass *parent_class = NULL;
-
-/* uncomment the following if you have defined any signals */
-/* static guint signals[LAST_SIGNAL] = {0}; */
-
-GType
-modest_account_view_window_get_type (void)
-{
- static GType my_type = 0;
- if (!my_type) {
- static const GTypeInfo my_info = {
- sizeof(ModestAccountViewWindowClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc) modest_account_view_window_class_init,
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof(ModestAccountViewWindow),
- 1, /* n_preallocs */
- (GInstanceInitFunc) modest_account_view_window_init,
- NULL
- };
- my_type = g_type_register_static (GTK_TYPE_DIALOG,
- "ModestAccountViewWindow",
- &my_info, 0);
- }
- return my_type;
-}
-
-static void
-modest_account_view_window_class_init (ModestAccountViewWindowClass *klass)
-{
- GObjectClass *gobject_class;
- gobject_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_peek_parent (klass);
- gobject_class->finalize = modest_account_view_window_finalize;
-
- g_type_class_add_private (gobject_class, sizeof(ModestAccountViewWindowPrivate));
-}
-
-static void
-modest_account_view_window_init (ModestAccountViewWindow *obj)
-{
- /* empty */
-}
-
-static void
-modest_account_view_window_finalize (GObject *obj)
-{
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-
-static void
-on_selection_changed (GtkTreeSelection *sel, ModestAccountViewWindow *self)
-{
- ModestAccountViewWindowPrivate *priv;
- GtkTreeModel *model;
- GtkTreeIter iter;
- gboolean has_selection;
- gchar *account_name;
- gchar *default_account_name;
-
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
-
- has_selection =
- gtk_tree_selection_get_selected (sel, &model, &iter);
-
- gtk_widget_set_sensitive (priv->edit_button, has_selection);
- gtk_widget_set_sensitive (priv->remove_button, has_selection);
-
- account_name = modest_account_view_get_selected_account (priv->account_view);
- default_account_name = modest_account_mgr_get_default_account(
- modest_runtime_get_account_mgr());
- gtk_widget_set_sensitive (priv->default_button,
- default_account_name == NULL || account_name == NULL ||
- strcmp (default_account_name, account_name) != 0);
- g_free (account_name);
- g_free (default_account_name);
-}
-
-static void
-on_remove_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
-{
- ModestAccountViewWindowPrivate *priv;
- ModestAccountMgr *account_mgr;
- gchar *account_name, *account_title;
-
-
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
-
- account_mgr = modest_runtime_get_account_mgr();
- account_name = modest_account_view_get_selected_account (priv->account_view);
-
- if (!account_name)
- return;
-
- account_title = modest_account_mgr_get_display_name(account_mgr, account_name);
- if (!account_title)
- return;
-
- if (modest_ui_actions_check_for_active_account (self, account_name)) {
- gboolean removed;
- gchar *txt;
- gint response;
-
- if (modest_account_mgr_get_store_protocol (account_mgr, account_name)
- == MODEST_PROTOCOLS_STORE_POP) {
- txt = g_strdup_printf (_("emev_nc_delete_mailbox"),
- account_title);
- } else {
- txt = g_strdup_printf (_("emev_nc_delete_mailboximap"),
- account_title);
- }
-
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (self), txt);
- g_free (txt);
- txt = NULL;
-
- if (response == GTK_RESPONSE_OK) {
- /* Remove account. If succeeded it removes also
- the account from the ModestAccountView */
- removed = modest_account_mgr_remove_account (account_mgr,
- account_name);
- if (removed) {
- /* Show confirmation dialog ??? */
- } else {
- /* Show error dialog ??? */
- g_warning ("Error removing account %s", account_name);
- }
- }
- g_free (account_name);
- }
-}
-
-static void
-on_edit_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
-{
- ModestAccountViewWindowPrivate *priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE (self);
-
- gchar* account_name = modest_account_view_get_selected_account (priv->account_view);
- if (!account_name)
- return;
-
- /* Check whether any connections are active, and cancel them if
- * the user wishes.
- */
- if (modest_ui_actions_check_for_active_account (self, account_name)) {
- ModestAccountProtocol *proto;
- ModestProtocolType proto_type;
-
- /* Get proto */
- proto_type = modest_account_mgr_get_store_protocol (modest_runtime_get_account_mgr (),
- account_name);
- proto = (ModestAccountProtocol *)
- modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (),
- proto_type);
-
- /* Create and show the dialog */
- if (proto && MODEST_IS_ACCOUNT_PROTOCOL (proto)) {
- ModestAccountSettingsDialog *dialog =
- modest_account_protocol_get_account_settings_dialog (proto, account_name);
- gtk_widget_show (GTK_WIDGET (dialog));
- }
- }
- g_free (account_name);
-}
-
-static void
-on_wizard_response (GtkDialog *dialog,
- gint response,
- gpointer user_data)
-{
- /* The response has already been handled by the wizard dialog itself,
- * creating the new account.
- */
- if (dialog)
- gtk_widget_destroy (GTK_WIDGET (dialog));
-
- /* Re-focus the account list view widget */
- if (MODEST_IS_ACCOUNT_VIEW_WINDOW (user_data)) {
- ModestAccountViewWindowPrivate *priv;
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE (user_data);
- gtk_widget_grab_focus (GTK_WIDGET (priv->account_view));
- }
-}
-
-static void
-on_add_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
-{
- GtkDialog *wizard;
- GtkWindow *dialog;
-
- /* Show the easy-setup wizard: */
- dialog = modest_window_mgr_get_modal (modest_runtime_get_window_mgr());
- if (dialog && MODEST_IS_ACCOUNT_ASSISTANT (dialog)) {
- /* old wizard is active already;
- */
- gtk_window_present (dialog);
- return;
- }
-
- /* there is no such wizard yet */
- wizard = GTK_DIALOG (modest_account_assistant_new (modest_runtime_get_account_mgr ()));
- modest_window_mgr_set_modal (modest_runtime_get_window_mgr(),
- GTK_WINDOW (wizard), self);
-
- /* if there is already another modal dialog, make it non-modal */
- if (dialog)
- gtk_window_set_modal (GTK_WINDOW(dialog), FALSE);
-
- gtk_window_set_modal (GTK_WINDOW (wizard), TRUE);
- gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (self));
- /* Destroy the dialog when it is closed: */
- g_signal_connect (G_OBJECT (wizard), "response", G_CALLBACK
- (on_wizard_response), self);
- gtk_widget_show (GTK_WIDGET (wizard));
-}
-
-
-static void
-on_default_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
-{
- ModestAccountViewWindowPrivate *priv;
- ModestAccountMgr *account_mgr;
- gchar *account_name;
-
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
-
- account_mgr = modest_runtime_get_account_mgr();
- account_name = modest_account_view_get_selected_account (priv->account_view);
-
- modest_account_mgr_set_default_account (account_mgr, account_name);
-
- g_free (account_name);
-}
-
-
-static GtkWidget*
-button_box_new (ModestAccountViewWindow *self)
-{
-
- GtkWidget *button_box;
- ModestAccountViewWindowPrivate *priv;
-
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
-
- button_box = gtk_vbutton_box_new ();
- gtk_button_box_set_spacing (GTK_BUTTON_BOX (button_box), 6);
- gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box),
- GTK_BUTTONBOX_START);
-
- priv->add_button = gtk_button_new_from_stock(GTK_STOCK_ADD);
- priv->default_button = gtk_button_new_with_label(_("Make default"));
- priv->remove_button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
- priv->edit_button = gtk_button_new_from_stock(GTK_STOCK_EDIT);
-
- g_signal_connect (G_OBJECT(priv->add_button), "clicked",
- G_CALLBACK(on_add_button_clicked),
- self);
- g_signal_connect (G_OBJECT(priv->remove_button), "clicked",
- G_CALLBACK(on_remove_button_clicked),
- self);
- g_signal_connect (G_OBJECT(priv->edit_button), "clicked",
- G_CALLBACK(on_edit_button_clicked),
- self);
- g_signal_connect (G_OBJECT(priv->default_button), "clicked",
- G_CALLBACK(on_default_button_clicked),
- self);
-
- gtk_box_pack_start (GTK_BOX(button_box), priv->add_button, FALSE, FALSE,2);
- gtk_box_pack_start (GTK_BOX(button_box), priv->default_button, FALSE, FALSE,2);
- gtk_box_pack_start (GTK_BOX(button_box), priv->remove_button, FALSE, FALSE,2);
- gtk_box_pack_start (GTK_BOX(button_box), priv->edit_button, FALSE, FALSE,2);
-
- gtk_widget_set_sensitive (priv->edit_button, FALSE);
- gtk_widget_set_sensitive (priv->remove_button, FALSE);
- gtk_widget_set_sensitive (priv->default_button, FALSE);
-
- return button_box;
-}
-
-static GtkWidget*
-window_vbox_new (ModestAccountViewWindow *self)
-{
- ModestAccountViewWindowPrivate *priv;
- GtkTreeSelection *sel;
- GtkWidget *main_hbox, *main_vbox, *button_box;
- GtkWidget *scrolled_window;
-
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
-
- main_vbox = gtk_vbox_new (FALSE, 0);
- main_hbox = gtk_hbox_new (FALSE, 12);
-
- button_box = button_box_new (self);
-
- priv->account_view = modest_account_view_new (modest_runtime_get_account_mgr());
- gtk_widget_set_size_request (GTK_WIDGET(priv->account_view), 300, 400);
-
- sel = gtk_tree_view_get_selection (GTK_TREE_VIEW(priv->account_view));
- on_selection_changed (sel, self);
- g_signal_connect (G_OBJECT(sel), "changed", G_CALLBACK(on_selection_changed),
- self);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (priv->account_view));
- gtk_box_pack_start (GTK_BOX(main_hbox), scrolled_window, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX(main_hbox), button_box, FALSE, FALSE,0);
-
- gtk_box_pack_start (GTK_BOX(main_vbox), main_hbox, TRUE, TRUE, 0);
-
- gtk_widget_show_all (main_vbox);
- return main_vbox;
-}
-
-
-GtkWidget*
-modest_account_view_window_new (void)
-{
- GObject *obj;
- ModestAccountViewWindowPrivate *priv;
-
- obj = g_object_new(MODEST_TYPE_ACCOUNT_VIEW_WINDOW, NULL);
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(obj);
-
- gtk_window_set_resizable (GTK_WINDOW(obj), TRUE);
- gtk_window_set_title (GTK_WINDOW(obj), _("mcen_ti_emailsetup_accounts"));
- gtk_window_set_type_hint (GTK_WINDOW(obj), GDK_WINDOW_TYPE_HINT_DIALOG);
- gtk_window_set_default_size (GTK_WINDOW (obj), 640, 480);
-
- gtk_window_set_modal (GTK_WINDOW(obj), TRUE);
-
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(obj)->vbox),
- window_vbox_new (MODEST_ACCOUNT_VIEW_WINDOW(obj)),
- TRUE, TRUE, 12);
-
- gtk_dialog_add_button (GTK_DIALOG (obj), GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
-
- return GTK_WIDGET(obj);
-}
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#include "widgets/modest-account-settings-dialog.h"
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-
-#include "widgets/modest-serversecurity-combo-box.h"
-#include "widgets/modest-secureauth-combo-box.h"
-#include "widgets/modest-validating-entry.h"
-#include "widgets/modest-retrieve-combo-box.h"
-#include "widgets/modest-limit-retrieve-combo-box.h"
-#include "modest-defs.h"
-#include "modest-text-utils.h"
-#include "modest-account-mgr.h"
-#include "modest-account-mgr-helpers.h" /* For modest_account_mgr_get_account_data(). */
-#include "modest-runtime.h" /* For modest_runtime_get_account_mgr(). */
-#include "modest-protocol-registry.h"
-#include <modest-utils.h>
-#include <modest-platform.h>
-#include "widgets/modest-ui-constants.h"
-#include "widgets/modest-default-account-settings-dialog.h"
-#include <tny-account.h>
-#include <tny-status.h>
-#include <tny-simple-list.h>
-
-#include <gconf/gconf-client.h>
-#include <string.h> /* For strlen(). */
-
-/* Include config.h so that _() works: */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#define PORT_MIN 1
-#define PORT_MAX 65535
-
-static void modest_account_settings_dialog_init (gpointer g, gpointer iface_data);
-
-G_DEFINE_TYPE_EXTENDED (ModestDefaultAccountSettingsDialog,
- modest_default_account_settings_dialog,
- GTK_TYPE_DIALOG,
- 0,
- G_IMPLEMENT_INTERFACE (MODEST_TYPE_ACCOUNT_SETTINGS_DIALOG,
- modest_account_settings_dialog_init));
-
-#define MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
- MODEST_TYPE_DEFAULT_ACCOUNT_SETTINGS_DIALOG, \
- ModestDefaultAccountSettingsDialogPrivate))
-
-typedef struct _ModestDefaultAccountSettingsDialogPrivate ModestDefaultAccountSettingsDialogPrivate;
-
-struct _ModestDefaultAccountSettingsDialogPrivate
-{
- /* Used by derived widgets to query existing accounts,
- * and to create new accounts: */
- ModestAccountMgr *account_manager;
- ModestAccountSettings *settings;
-
- gboolean modified;
- gchar * account_name; /* This may not change. It is not user visible. */
- ModestProtocolType incoming_protocol; /* This may not change. */
- ModestProtocolType outgoing_protocol; /* This may not change. */
- gchar * original_account_title;
-
- ModestProtocolType protocol_authentication_incoming;
-
- GtkNotebook *notebook;
-
- GtkWidget *page_account_details;
- GtkWidget *entry_account_title;
- GtkWidget *combo_retrieve;
- GtkWidget *combo_limit_retrieve;
- GtkWidget *caption_leave_messages;
- GtkWidget *checkbox_leave_messages;
-
- GtkWidget *page_user_details;
- GtkWidget *entry_user_name;
- GtkWidget *entry_user_username;
- GtkWidget *entry_user_password;
- GtkWidget *entry_user_email;
- GtkWidget *entry_incoming_port;
- GtkWidget *button_signature;
-
- GtkWidget *page_complete_easysetup;
-
- GtkWidget *page_incoming;
- GtkWidget *caption_incoming;
- GtkWidget *entry_incomingserver;
- GtkWidget *combo_incoming_security;
- GtkWidget *checkbox_incoming_auth;
-
- GtkWidget *page_outgoing;
- GtkWidget *entry_outgoingserver;
- GtkWidget *caption_outgoing_username;
- GtkWidget *entry_outgoing_username;
- GtkWidget *caption_outgoing_password;
- GtkWidget *entry_outgoing_password;
- GtkWidget *combo_outgoing_security;
- GtkWidget *combo_outgoing_auth;
- GtkWidget *entry_outgoing_port;
- GtkWidget *checkbox_outgoing_smtp_specific;
- GtkWidget *button_outgoing_smtp_servers;
-
- GtkWidget *signature_dialog;
-};
-
-static void enable_buttons (ModestAccountSettingsDialog *self);
-static gboolean save_configuration (ModestAccountSettingsDialog *dialog);
-static void modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialog *dialog,
- ModestAccountSettings *settings);
-
-static const gchar *
-null_means_empty (const gchar * str)
-{
- return str ? str : "";
-}
-
-
-static void
-modest_account_settings_dialog_get_property (GObject *object, guint property_id,
- GValue *value, GParamSpec *pspec)
-{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-modest_account_settings_dialog_set_property (GObject *object, guint property_id,
- const GValue *value, GParamSpec *pspec)
-{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
-}
-
-static void
-modest_account_settings_dialog_dispose (GObject *object)
-{
- if (G_OBJECT_CLASS (modest_default_account_settings_dialog_parent_class)->dispose)
- G_OBJECT_CLASS (modest_default_account_settings_dialog_parent_class)->dispose (object);
-}
-
-static void
-modest_account_settings_dialog_finalize (GObject *object)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (object);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- if (priv->account_name)
- g_free (priv->account_name);
-
- if (priv->original_account_title)
- g_free (priv->original_account_title);
-
- if (priv->account_manager)
- g_object_unref (G_OBJECT (priv->account_manager));
-
- if (priv->signature_dialog)
- gtk_widget_destroy (priv->signature_dialog);
-
- if (priv->settings) {
- g_object_unref (priv->settings);
- priv->settings = NULL;
- }
-
- G_OBJECT_CLASS (modest_default_account_settings_dialog_parent_class)->finalize (object);
-}
-
-static void
-on_combo_incoming_security_changed (GtkComboBox *widget, gpointer user_data);
-
-static void
-on_combo_outgoing_security_changed (GtkComboBox *widget, gpointer user_data);
-
-static void
-on_modified_combobox_changed (GtkComboBox *widget, gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
- priv->modified = TRUE;
-}
-
-static void
-on_modified_entry_changed (GtkEditable *editable, gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
- priv->modified = TRUE;
-}
-
-static void
-on_modified_checkbox_toggled (GtkToggleButton *togglebutton, gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
- priv->modified = TRUE;
-}
-
-static void
-on_modified_spin_button_changed (GtkSpinButton *spin_button, gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
- gint value = gtk_spin_button_get_value_as_int (spin_button);
-
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, value > 0);
- priv->modified = TRUE;
-}
-
-/* Set a modified boolean whenever the widget is changed,
- * so we can check for it later.
- */
-static void
-connect_for_modified (ModestDefaultAccountSettingsDialog *self,
- GtkWidget *widget)
-{
- if (GTK_SPIN_BUTTON (widget)) {
- g_signal_connect (G_OBJECT (widget), "value_changed",
- G_CALLBACK (on_modified_spin_button_changed), self);
- }
- else if (GTK_IS_ENTRY (widget)) {
- g_signal_connect (G_OBJECT (widget), "changed",
- G_CALLBACK (on_modified_entry_changed), self);
- } else if (GTK_IS_COMBO_BOX (widget)) {
- g_signal_connect (G_OBJECT (widget), "changed",
- G_CALLBACK (on_modified_combobox_changed), self);
- } else if (GTK_IS_TOGGLE_BUTTON (widget)) {
- g_signal_connect (G_OBJECT (widget), "toggled",
- G_CALLBACK (on_modified_checkbox_toggled), self);
- }
-}
-
-static void
-on_field_entry_changed (GtkEditable *editable, gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
- g_assert(self);
- enable_buttons(self);
-}
-
-static void
-on_field_combobox_changed (GtkComboBox *widget, gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
- g_assert(self);
- enable_buttons(self);
-}
-
-/** This is a convenience function to create a field containing a mandatory widget.
- * When the widget is edited, the enable_buttons() vfunc will be called.
- */
-static GtkWidget*
-create_field(ModestDefaultAccountSettingsDialog *self,
- GtkSizeGroup *group,
- const gchar *value,
- GtkWidget *control,
- GtkWidget *icon,
- gboolean mandatory)
-{
- GtkWidget *hbox;
- gchar *title;
- GtkWidget *label;
-
- hbox = gtk_hbox_new (FALSE, 12);
- if (mandatory)
- title = g_strdup_printf("%s*:", value);
- else
- title = g_strdup_printf ("%s:", value);
- label = gtk_label_new (title);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- g_free (title);
-
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), control, TRUE, TRUE, 0);
- gtk_size_group_add_widget (group, label);
-
- /* Connect to the appropriate changed signal for the widget,
- * so we can ask for the prev/next buttons to be enabled/disabled appropriately:
- */
- if (GTK_IS_ENTRY (control)) {
- g_signal_connect (G_OBJECT (control), "changed",
- G_CALLBACK (on_field_entry_changed), self);
-
- }
- else if (GTK_IS_COMBO_BOX (control)) {
- g_signal_connect (G_OBJECT (control), "changed",
- G_CALLBACK (on_field_combobox_changed), self);
- }
- gtk_widget_show_all (hbox);
-
- return hbox;
-}
-
-static void
-on_entry_invalid_account_title_character (ModestValidatingEntry *self, const gchar* character, gpointer user_data)
-{
- gchar *tmp, *msg;
-
- tmp = g_strndup (account_title_forbidden_chars, ACCOUNT_TITLE_FORBIDDEN_CHARS_LENGTH);
- msg = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"), tmp);
-
- modest_platform_information_banner (GTK_WIDGET (self), NULL, msg);
-
- g_free (msg);
- g_free (tmp);
-}
-
-static void
-on_entry_invalid_fullname_character (ModestValidatingEntry *self, const gchar* character, gpointer user_data)
-{
- gchar *tmp, *msg;
-
- tmp = g_strndup (user_name_forbidden_chars, USER_NAME_FORBIDDEN_CHARS_LENGTH);
- msg = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"), tmp);
-
- modest_platform_information_banner(GTK_WIDGET (self), NULL, msg);
-
- g_free (msg);
- g_free (tmp);
-}
-
-
-static void
-on_entry_max (ModestValidatingEntry *self, gpointer user_data)
-{
- modest_platform_information_banner(GTK_WIDGET (self), NULL,
- _CS("ckdg_ib_maximum_characters_reached"));
-}
-
-static GtkWidget*
-create_page_account_details (ModestDefaultAccountSettingsDialog *self)
-{
- GtkWidget *box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
- GtkWidget *alignment;
- GtkSizeGroup* sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- /* The description widgets: */
- priv->entry_account_title = GTK_WIDGET (modest_validating_entry_new ());
- GtkWidget *field = create_field (self, sizegroup, _("mcen_fi_account_title"),
- priv->entry_account_title, NULL, TRUE);
- gtk_widget_show (priv->entry_account_title);
- connect_for_modified (self, priv->entry_account_title);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* Prevent the use of some characters in the account title,
- * as required by our UI specification: */
- GList *list_prevent = NULL;
- list_prevent = g_list_append (list_prevent, "\\");
- list_prevent = g_list_append (list_prevent, "/");
- list_prevent = g_list_append (list_prevent, ":");
- list_prevent = g_list_append (list_prevent, "*");
- list_prevent = g_list_append (list_prevent, "?");
- list_prevent = g_list_append (list_prevent, "\"");
- list_prevent = g_list_append (list_prevent, "<");
- list_prevent = g_list_append (list_prevent, ">");
- list_prevent = g_list_append (list_prevent, "|");
- list_prevent = g_list_append (list_prevent, "^");
- modest_validating_entry_set_unallowed_characters (
- MODEST_VALIDATING_ENTRY (priv->entry_account_title), list_prevent);
- g_list_free (list_prevent);
- modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(priv->entry_account_title),
- on_entry_invalid_account_title_character, self);
-
- /* Set max length as in the UI spec:
- * The UI spec seems to want us to show a dialog if we hit the maximum. */
- gtk_entry_set_max_length (GTK_ENTRY (priv->entry_account_title), 64);
- modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (priv->entry_account_title),
- on_entry_max, self);
-
- /* The retrieve combobox: */
- priv->combo_retrieve = GTK_WIDGET (modest_retrieve_combo_box_new ());
- field = create_field (self, sizegroup, _("mcen_fi_advsetup_retrievetype"),
- priv->combo_retrieve, NULL, TRUE);
- gtk_widget_show (priv->combo_retrieve);
- connect_for_modified (self, priv->combo_retrieve);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* The limit-retrieve combobox: */
- priv->combo_limit_retrieve = GTK_WIDGET (modest_limit_retrieve_combo_box_new ());
- field = create_field (self, sizegroup, _("mcen_fi_advsetup_limit_retrieve"),
- priv->combo_limit_retrieve, NULL, TRUE);
- gtk_widget_show (priv->combo_limit_retrieve);
- connect_for_modified (self, priv->combo_limit_retrieve);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* The leave-messages widgets: */
- if(!priv->checkbox_leave_messages)
- priv->checkbox_leave_messages = gtk_check_button_new ();
- if (!priv->caption_leave_messages) {
- priv->caption_leave_messages = create_field (self, sizegroup, _("mcen_fi_advsetup_leave_on_server"),
- priv->checkbox_leave_messages, NULL, TRUE);
- }
-
- gtk_widget_show (priv->checkbox_leave_messages);
- connect_for_modified (self, priv->checkbox_leave_messages);
- gtk_box_pack_start (GTK_BOX (box), priv->caption_leave_messages, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (priv->caption_leave_messages);
-
- gtk_widget_show (GTK_WIDGET (box));
-
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 12, 12, 12);
- gtk_container_add (GTK_CONTAINER (alignment), box);
- gtk_widget_show (alignment);
-
- return GTK_WIDGET (alignment);
-}
-
-static gchar*
-get_entered_account_title (ModestAccountSettingsDialog *dialog)
-{
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (dialog);
-
- const gchar* account_title =
- gtk_entry_get_text (GTK_ENTRY (priv->entry_account_title));
- if (!account_title || (strlen (account_title) == 0))
- return NULL;
- else {
- /* Strip it of whitespace at the start and end: */
- gchar *result = g_strdup (account_title);
- result = g_strstrip (result);
-
- if (!result)
- return NULL;
-
- if (strlen (result) == 0) {
- g_free (result);
- return NULL;
- }
-
- return result;
- }
-}
-
-
-static void
-on_button_signature (GtkButton *button, gpointer user_data)
-{
-/* ModestAccountSettingsDialog * self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data); */
-
-/* /\* Create the window, if necessary: *\/ */
-/* if (!(priv->signature_dialog)) { */
-/* priv->signature_dialog = GTK_WIDGET (modest_signature_editor_dialog_new ()); */
-
-/* gboolean use_signature = modest_account_settings_get_use_signature (priv->settings); */
-/* const gchar *signature = modest_account_settings_get_signature(priv->settings); */
-/* gchar* account_title = get_entered_account_title (self); */
-/* modest_signature_editor_dialog_set_settings ( */
-/* MODEST_SIGNATURE_EDITOR_DIALOG (priv->signature_dialog), */
-/* use_signature, signature, account_title); */
-
-/* g_free (account_title); */
-/* account_title = NULL; */
-/* signature = NULL; */
-/* } */
-
-/* /\* Show the window: *\/ */
-/* gtk_window_set_transient_for (GTK_WINDOW (priv->signature_dialog), GTK_WINDOW (self)); */
-/* gtk_window_set_modal (GTK_WINDOW (priv->signature_dialog), TRUE); */
-/* const gint response = gtk_dialog_run (GTK_DIALOG (priv->signature_dialog)); */
-/* gtk_widget_hide (priv->signature_dialog); */
-/* if (response != GTK_RESPONSE_OK) { */
-/* /\* Destroy the widget now, and its data: *\/ */
-/* gtk_widget_destroy (priv->signature_dialog); */
-/* priv->signature_dialog = NULL; */
-/* } */
-/* else { */
-/* /\* Mark modified, so we use the dialog's data later: *\/ */
-/* priv->modified = TRUE; */
-/* } */
-}
-
-static GtkWidget*
-create_page_user_details (ModestDefaultAccountSettingsDialog *self)
-{
- GtkWidget *box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
- GtkWidget *alignment;
- GtkSizeGroup* sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- /* The name widgets: */
- priv->entry_user_name = GTK_WIDGET (modest_validating_entry_new ());
-
- /* Set max length as in the UI spec:
- * The UI spec seems to want us to show a dialog if we hit the maximum. */
- gtk_entry_set_max_length (GTK_ENTRY (priv->entry_user_name), 64);
- modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (priv->entry_user_name),
- on_entry_max, self);
- GtkWidget *field = create_field (self, sizegroup,
- _("mcen_li_emailsetup_name"), priv->entry_user_name, NULL, FALSE);
- gtk_widget_show (priv->entry_user_name);
- connect_for_modified (self, priv->entry_user_name);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
-
- /* Prevent the use of some characters in the name,
- * as required by our UI specification: */
- GList *list_prevent = NULL;
- list_prevent = g_list_append (list_prevent, "<");
- list_prevent = g_list_append (list_prevent, ">");
- modest_validating_entry_set_unallowed_characters (
- MODEST_VALIDATING_ENTRY (priv->entry_user_name), list_prevent);
- g_list_free (list_prevent);
- modest_validating_entry_set_func(MODEST_VALIDATING_ENTRY(priv->entry_user_name),
- on_entry_invalid_fullname_character, self);
-
- /* The username widgets: */
- priv->entry_user_username = GTK_WIDGET (modest_validating_entry_new ());
- field = create_field (self, sizegroup, _("mail_fi_username"),
- priv->entry_user_username, NULL, TRUE);
- gtk_widget_show (priv->entry_user_username);
- connect_for_modified (self, priv->entry_user_username);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* Prevent the use of some characters in the username,
- * as required by our UI specification: */
- modest_validating_entry_set_unallowed_characters_whitespace (
- MODEST_VALIDATING_ENTRY (priv->entry_user_username));
-
- /* Set max length as in the UI spec:
- * The UI spec seems to want us to show a dialog if we hit the maximum. */
- gtk_entry_set_max_length (GTK_ENTRY (priv->entry_user_username), 64);
- modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (priv->entry_user_username),
- on_entry_max, self);
-
- /* The password widgets: */
- priv->entry_user_password = gtk_entry_new ();
- gtk_entry_set_visibility (GTK_ENTRY (priv->entry_user_password), FALSE);
- /* gtk_entry_set_invisible_char (GTK_ENTRY (priv->entry_user_password), '*'); */
- field = create_field (self, sizegroup,
- _("mail_fi_password"), priv->entry_user_password, NULL, FALSE);
- gtk_widget_show (priv->entry_user_password);
- connect_for_modified (self, priv->entry_user_password);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* The email address widgets: */
- priv->entry_user_email = GTK_WIDGET (modest_validating_entry_new ());
- field = create_field (self, sizegroup,
- _("mcen_li_emailsetup_email_address"), priv->entry_user_email, NULL, TRUE);
- gtk_entry_set_text (GTK_ENTRY (priv->entry_user_email), MODEST_EXAMPLE_EMAIL_ADDRESS); /* Default text. */
- gtk_widget_show (priv->entry_user_email);
- connect_for_modified (self, priv->entry_user_email);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* Set max length as in the UI spec:
- * The UI spec seems to want us to show a dialog if we hit the maximum. */
- gtk_entry_set_max_length (GTK_ENTRY (priv->entry_user_email), 64);
- modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (priv->entry_user_email),
- on_entry_max, self);
-
- /* Signature button: */
- if (!priv->button_signature)
- priv->button_signature = gtk_button_new_with_label (_("mcen_bd_edit"));
- field = create_field (self, sizegroup, _("mcen_fi_email_signature"),
- priv->button_signature, NULL, FALSE);
- gtk_widget_show (priv->button_signature);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- g_signal_connect (G_OBJECT (priv->button_signature), "clicked",
- G_CALLBACK (on_button_signature), self);
-
- gtk_widget_show (GTK_WIDGET (box));
-
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 12, 12, 12);
- gtk_container_add (GTK_CONTAINER (alignment), box);
- gtk_widget_show (alignment);
-
- return GTK_WIDGET (alignment);
-}
-
-/** Change the field title for the incoming server,
- * as specified in the UI spec:
- */
-static void
-update_incoming_server_title (ModestAccountSettingsDialog *self,
- ModestProtocolType protocol)
-{
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- const gchar* type =
- (protocol == MODEST_PROTOCOLS_STORE_POP ?
- _("mail_fi_emailtype_pop3") :
- _("mail_fi_emailtype_imap") );
-
-
- /* Note that this produces a compiler warning,
- * because the compiler does not know that the translated string will have a %s in it.
- * I do not see a way to avoid the warning while still using these Logical IDs. murrayc. */
- gchar* incomingserver_title = g_strdup_printf(_("mcen_li_emailsetup_servertype"), type);
-
- /* This is a mandatory field, so add a *. This is usually done by
- * create_field() but we can't use that here. */
- gchar *with_asterisk = g_strconcat (incomingserver_title, "*", NULL);
- g_free (incomingserver_title);
-
- g_object_set (G_OBJECT (priv->caption_incoming), "label", with_asterisk, NULL);
- g_free(with_asterisk);
-}
-
-/** Change the field title for the incoming server,
- * as specified in the UI spec:
- */
-static void
-update_incoming_server_security_choices (ModestAccountSettingsDialog *self,
- ModestProtocolType protocol)
-{
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- /* Fill the combo with appropriately titled choices for POP or IMAP. */
- /* The choices are the same, but the titles are different, as in the UI spec. */
- modest_serversecurity_combo_box_fill (
- MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_incoming_security), protocol);
-}
-
-static GtkWidget*
-create_page_incoming (ModestDefaultAccountSettingsDialog *self)
-{
- GtkWidget *box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
- GtkWidget *alignment;
- GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- /* The incoming server widgets: */
- if(!priv->entry_incomingserver)
- priv->entry_incomingserver = gtk_entry_new ();
-
- if (priv->caption_incoming)
- gtk_widget_destroy (priv->caption_incoming);
-
- /* The field title will be updated in update_incoming_server_title().
- * so this default text will never be seen: */
- /* (Note: Changing the title seems pointless. murrayc) */
- priv->caption_incoming = create_field (self, sizegroup,
- "Incoming Server", priv->entry_incomingserver, NULL, TRUE);
- gtk_widget_show (priv->entry_incomingserver);
- connect_for_modified (self, priv->entry_incomingserver);
- gtk_box_pack_start (GTK_BOX (box), priv->caption_incoming, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (priv->caption_incoming);
-
- /* The secure connection widgets: */
- /* This will be filled by update_incoming_server_security_choices(). */
- if (!priv->combo_incoming_security)
- priv->combo_incoming_security = GTK_WIDGET (modest_serversecurity_combo_box_new ());
- GtkWidget *field = create_field (self, sizegroup, _("mcen_li_emailsetup_secure_connection"),
- priv->combo_incoming_security, NULL, FALSE);
- gtk_widget_show (priv->combo_incoming_security);
- connect_for_modified (self, priv->combo_incoming_security);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* Show a default port number when the security method changes, as per the UI spec: */
- g_signal_connect (G_OBJECT (priv->combo_incoming_security), "changed", (GCallback)on_combo_incoming_security_changed, self);
-
-
- /* The port widgets: */
- if (!priv->entry_incoming_port)
- priv->entry_incoming_port = GTK_WIDGET (gtk_spin_button_new_with_range ((gdouble) PORT_MIN, (gdouble) PORT_MAX, 1.0));
- field = create_field (self, sizegroup, _("mcen_fi_emailsetup_port"),
- priv->entry_incoming_port, NULL, FALSE);
- gtk_widget_show (priv->entry_incoming_port);
- connect_for_modified (self, priv->entry_incoming_port);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* The secure authentication widgets: */
- if(!priv->checkbox_incoming_auth)
- priv->checkbox_incoming_auth = gtk_check_button_new ();
- field = create_field (self, sizegroup, _("mcen_li_emailsetup_secure_authentication"),
- priv->checkbox_incoming_auth, NULL, FALSE);
- gtk_widget_show (priv->checkbox_incoming_auth);
- connect_for_modified (self, priv->checkbox_incoming_auth);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- gtk_widget_show (GTK_WIDGET (box));
-
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 12, 12, 12);
- gtk_container_add (GTK_CONTAINER (alignment), box);
- gtk_widget_show (alignment);
-
- return GTK_WIDGET (alignment);
-}
-
-static void
-on_toggle_button_changed (GtkToggleButton *togglebutton, gpointer user_data)
-{
- GtkWidget *widget = GTK_WIDGET (user_data);
-
- /* Enable the widget only if the toggle button is active: */
- const gboolean enable = gtk_toggle_button_get_active (togglebutton);
- gtk_widget_set_sensitive (widget, enable);
-}
-
-/* Make the sensitivity of a widget depend on a toggle button.
- */
-static void
-enable_widget_for_togglebutton (GtkWidget *widget, GtkToggleButton* button)
-{
- g_signal_connect (G_OBJECT (button), "toggled",
- G_CALLBACK (on_toggle_button_changed), widget);
-
- /* Set the starting sensitivity: */
- on_toggle_button_changed (button, widget);
-}
-
-static void
-on_button_outgoing_smtp_servers (GtkButton *button, gpointer user_data)
-{
-/* ModestAccountSettingsDialog * self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data); */
-
-/* /\* Create the window if necessary: *\/ */
-/* if (!(priv->specific_window)) { */
-/* priv->specific_window = GTK_WIDGET (modest_connection_specific_smtp_window_new ()); */
-/* modest_connection_specific_smtp_window_fill_with_connections ( */
-/* MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (priv->specific_window), priv->account_manager); */
-/* } */
-
-/* /\* Show the window: *\/ */
-/* gtk_window_set_transient_for (GTK_WINDOW (priv->specific_window), GTK_WINDOW (self)); */
-/* gtk_window_set_modal (GTK_WINDOW (priv->specific_window), TRUE); */
-/* gtk_widget_show (priv->specific_window); */
-/* priv->modified = TRUE; */
-}
-
-static void
-on_combo_outgoing_auth_changed (GtkComboBox *widget, gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- ModestProtocolType protocol_security =
- modest_secureauth_combo_box_get_active_secureauth (
- MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth));
- const gboolean secureauth_used = protocol_security != MODEST_PROTOCOLS_AUTH_NONE;
-
- gtk_widget_set_sensitive (priv->caption_outgoing_username, secureauth_used);
- gtk_widget_set_sensitive (priv->caption_outgoing_password, secureauth_used);
-}
-
-static void
-on_combo_outgoing_security_changed (GtkComboBox *widget, gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- const gint port_number =
- modest_serversecurity_combo_box_get_active_serversecurity_port (
- MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security));
-
- if(port_number != 0) {
- gtk_spin_button_set_value (
- GTK_SPIN_BUTTON (priv->entry_outgoing_port), (gdouble) port_number);
- }
-}
-
-static void
-on_combo_incoming_security_changed (GtkComboBox *widget, gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (user_data);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- const gint port_number =
- modest_serversecurity_combo_box_get_active_serversecurity_port (
- MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_incoming_security));
-
- if(port_number != 0) {
- gtk_spin_button_set_value (
- GTK_SPIN_BUTTON (priv->entry_incoming_port), (gdouble) port_number);
- }
-}
-
-
-static GtkWidget*
-create_page_outgoing (ModestDefaultAccountSettingsDialog *self)
-{
- GtkWidget *box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
- GtkWidget *alignment;
- GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- /* The outgoing server widgets: */
- if (!priv->entry_outgoingserver)
- priv->entry_outgoingserver = gtk_entry_new ();
- GtkWidget *field = create_field (self, sizegroup,
- _("mcen_li_emailsetup_smtp"), priv->entry_outgoingserver, NULL, FALSE);
- gtk_widget_show (priv->entry_outgoingserver);
- connect_for_modified (self, priv->entry_outgoingserver);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* The secure authentication widgets: */
- if (!priv->combo_outgoing_auth)
- priv->combo_outgoing_auth = GTK_WIDGET (modest_secureauth_combo_box_new ());
- field = create_field (self, sizegroup, _("mcen_li_emailsetup_secure_authentication"),
- priv->combo_outgoing_auth, NULL, FALSE);
- gtk_widget_show (priv->combo_outgoing_auth);
- connect_for_modified (self, priv->combo_outgoing_auth);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* Dim the outgoing username and password when no secure authentication is used, as per the UI spec: */
- g_signal_connect (G_OBJECT (priv->combo_outgoing_auth), "changed", (GCallback)on_combo_outgoing_auth_changed, self);
-
- /* The username widgets: */
- priv->entry_outgoing_username = GTK_WIDGET (modest_validating_entry_new ());
- priv->caption_outgoing_username = create_field (self, sizegroup, _("mail_fi_username"),
- priv->entry_outgoing_username, NULL, TRUE);
- gtk_widget_show (priv->entry_outgoing_username);
- connect_for_modified (self, priv->entry_outgoing_username);
- gtk_box_pack_start (GTK_BOX (box), priv->caption_outgoing_username, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (priv->caption_outgoing_username);
-
- /* Prevent the use of some characters in the username,
- * as required by our UI specification: */
- modest_validating_entry_set_unallowed_characters_whitespace (
- MODEST_VALIDATING_ENTRY (priv->entry_outgoing_username));
-
- /* Set max length as in the UI spec:
- * The UI spec seems to want us to show a dialog if we hit the maximum. */
- gtk_entry_set_max_length (GTK_ENTRY (priv->entry_outgoing_username), 64);
- modest_validating_entry_set_max_func (MODEST_VALIDATING_ENTRY (priv->entry_outgoing_username),
- on_entry_max, self);
-
- /* The password widgets: */
- priv->entry_outgoing_password = gtk_entry_new ();
- gtk_entry_set_visibility (GTK_ENTRY (priv->entry_outgoing_password), FALSE);
- /* gtk_entry_set_invisible_char (GTK_ENTRY (priv->entry_outgoing_password), '*'); */
- priv->caption_outgoing_password = create_field (self, sizegroup,
- _("mail_fi_password"), priv->entry_outgoing_password, NULL, FALSE);
- gtk_widget_show (priv->entry_outgoing_password);
- connect_for_modified (self, priv->entry_outgoing_password);
- gtk_box_pack_start (GTK_BOX (box), priv->caption_outgoing_password, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (priv->caption_outgoing_password);
-
- /* The secure connection widgets: */
- /* This will be filled and set with modest_serversecurity_combo_box_fill()
- * and modest_serversecurity_combo_box_set_active_serversecurity().
- */
- if (!priv->combo_outgoing_security)
-
- priv->combo_outgoing_security = GTK_WIDGET (modest_serversecurity_combo_box_new ());
- field = create_field (self, sizegroup, _("mcen_li_emailsetup_secure_connection"),
- priv->combo_outgoing_security, NULL, FALSE);
- gtk_widget_show (priv->combo_outgoing_security);
- connect_for_modified (self, priv->combo_outgoing_security);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* Show a default port number when the security method changes, as per the UI spec: */
- g_signal_connect (G_OBJECT (priv->combo_outgoing_security), "changed", (GCallback)on_combo_outgoing_security_changed, self);
-
- /* The port widgets: */
- if (!priv->entry_outgoing_port)
- priv->entry_outgoing_port = GTK_WIDGET (gtk_spin_button_new_with_range ((gdouble)PORT_MIN, (gdouble) PORT_MAX, 1.0));
- field = create_field (self, sizegroup, _("mcen_fi_emailsetup_port"),
- priv->entry_outgoing_port, NULL, FALSE);
- gtk_widget_show (priv->entry_outgoing_port);
- connect_for_modified (self, priv->entry_outgoing_port);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- GtkWidget *separator = gtk_hseparator_new ();
- gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (separator);
-
- /* connection-specific checkbox: */
- if (!priv->checkbox_outgoing_smtp_specific) {
- priv->checkbox_outgoing_smtp_specific = gtk_check_button_new ();
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->checkbox_outgoing_smtp_specific),
- FALSE);
- }
- field = create_field (self, sizegroup, _("mcen_fi_advsetup_connection_smtp"),
- priv->checkbox_outgoing_smtp_specific, NULL, FALSE);
- gtk_widget_show (priv->checkbox_outgoing_smtp_specific);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
- connect_for_modified (self, priv->checkbox_outgoing_smtp_specific);
-
- /* Connection-specific SMTP-Severs Edit button: */
- if (!priv->button_outgoing_smtp_servers)
- priv->button_outgoing_smtp_servers = gtk_button_new_with_label (_("mcen_bd_edit"));
- field = create_field (self, sizegroup, _("mcen_fi_advsetup_optional_smtp"),
- priv->button_outgoing_smtp_servers, NULL, FALSE);
- gtk_widget_show (priv->button_outgoing_smtp_servers);
- gtk_box_pack_start (GTK_BOX (box), field, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_widget_show (field);
-
- /* Only enable the button when the checkbox is checked: */
- enable_widget_for_togglebutton (priv->button_outgoing_smtp_servers,
- GTK_TOGGLE_BUTTON (priv->checkbox_outgoing_smtp_specific));
-
- g_signal_connect (G_OBJECT (priv->button_outgoing_smtp_servers), "clicked",
- G_CALLBACK (on_button_outgoing_smtp_servers), self);
-
- gtk_widget_show (GTK_WIDGET (box));
-
- alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 12, 12, 12);
- gtk_container_add (GTK_CONTAINER (alignment), box);
- gtk_widget_show (alignment);
-
- return GTK_WIDGET (alignment);
-}
-
-static gboolean
-check_data (ModestAccountSettingsDialog *self)
-{
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- /* Check that the title is not already in use: */
- gchar* account_title = get_entered_account_title (self);
- if (!account_title)
- return FALSE; /* Should be prevented already anyway. */
-
- if (g_strcmp0 (account_title, priv->original_account_title) != 0) {
- /* Check the changed title: */
- const gboolean name_in_use = modest_account_mgr_account_with_display_name_exists (priv->account_manager,
- account_title);
-
- if (name_in_use) {
- /* Warn the user via a dialog: */
- modest_platform_information_banner(NULL, NULL, _("mail_ib_account_name_already_existing"));
-
- g_free (account_title);
- return FALSE;
- }
- }
-
- g_free (account_title);
- account_title = NULL;
-
- /* Check that the email address is valid: */
- const gchar* email_address = gtk_entry_get_text (GTK_ENTRY (priv->entry_user_email));
- if ((!email_address) || (strlen(email_address) == 0)) {
- return FALSE;
- }
-
- if (!modest_text_utils_validate_email_address (email_address, NULL)) {
- /* Warn the user via a dialog: */
- modest_platform_information_banner (NULL, NULL, _("mcen_ib_invalid_email"));
-
- /* Return focus to the email address entry: */
- gtk_widget_grab_focus (priv->entry_user_email);
- gtk_editable_select_region (GTK_EDITABLE (priv->entry_user_email), 0, -1);
- return FALSE;
- }
-
- /* make sure the domain name for the incoming server is valid */
- const gchar* hostname = gtk_entry_get_text (GTK_ENTRY (priv->entry_incomingserver));
- if ((!hostname) || (strlen(hostname) == 0)) {
- return FALSE;
- }
-
- if (!modest_text_utils_validate_domain_name (hostname)) {
- /* Warn the user via a dialog: */
- modest_platform_information_banner (NULL, NULL, _("mcen_ib_invalid_servername"));
-
- /* Return focus to the email address entry: */
- gtk_widget_grab_focus (priv->entry_incomingserver);
- gtk_editable_select_region (GTK_EDITABLE (priv->entry_incomingserver), 0, -1);
- return FALSE;
- }
-
- /* make sure the domain name for the outgoing server is valid */
- const gchar* hostname2 = gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoingserver));
- if ((!hostname2) || (strlen(hostname2) == 0)) {
- return FALSE;
- }
-
- if (!modest_text_utils_validate_domain_name (hostname2)) {
- /* Warn the user via a dialog: */
- modest_platform_information_banner (priv->entry_outgoingserver, NULL, _("mcen_ib_invalid_servername"));
-
- /* Return focus to the email address entry: */
- gtk_widget_grab_focus (priv->entry_outgoingserver);
- gtk_editable_select_region (GTK_EDITABLE (priv->entry_outgoingserver), 0, -1);
- return FALSE;
- }
-
- /* Find a suitable authentication method when secure authentication is desired */
-
- const gint port_num = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (priv->entry_incoming_port));
- const gchar* username = gtk_entry_get_text (GTK_ENTRY (priv->entry_user_username));
-
- /*
- const ModestProtocolType protocol_security_incoming = modest_serversecurity_combo_box_get_active_serversecurity (
- MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_incoming_security));
- */
- /* If we use an encrypted protocol then there is no need to encrypt the password */
- /* I don't think this is a good assumption. It overrides the user's request. murrayc:
- * if (!modest_protocol_info_is_secure(protocol_security_incoming)) */
- if (TRUE)
- {
- if (gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON (priv->checkbox_incoming_auth))) {
- GError *error = NULL;
-
- GList *list_auth_methods =
- modest_utils_get_supported_secure_authentication_methods (priv->incoming_protocol,
- hostname, port_num, username, GTK_WINDOW (self), &error);
- if (list_auth_methods) {
- /* Use the first supported method.
- * TODO: Should we prioritize them, to prefer a particular one? */
- GList* method;
- for (method = list_auth_methods; method != NULL; method = g_list_next(method))
- {
- ModestProtocolType proto = (ModestProtocolType)(GPOINTER_TO_INT(method->data));
- // Allow secure methods, e.g MD5 only
- if (modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (), proto))
- {
- priv->protocol_authentication_incoming = proto;
- break;
- }
- }
- g_list_free (list_auth_methods);
- }
-
- if (list_auth_methods == NULL ||
- !modest_protocol_registry_protocol_type_is_secure (modest_runtime_get_protocol_registry (),
- priv->protocol_authentication_incoming)) {
- if(error == NULL || error->domain != modest_utils_get_supported_secure_authentication_error_quark() ||
- error->code != MODEST_UTILS_GET_SUPPORTED_SECURE_AUTHENTICATION_ERROR_CANCELED)
- modest_platform_information_banner(GTK_WIDGET (self), NULL,
- _("Could not discover supported secure authentication methods."));
-
- if(error != NULL)
- g_error_free(error);
-
- /* This is a nasty hack. jschmid. */
- /* Don't let the dialog close */
- /*g_signal_stop_emission_by_name (dialog, "response");*/
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-/*
- */
-static void
-on_response (GtkDialog *wizard_dialog,
- gint response_id,
- gpointer user_data)
-{
- ModestAccountSettingsDialog *self = MODEST_ACCOUNT_SETTINGS_DIALOG (wizard_dialog);
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- enable_buttons (self);
-
- gboolean prevent_response = FALSE;
-
- /* Warn about unsaved changes: */
- if (response_id == GTK_RESPONSE_CANCEL && priv->modified) {
- GtkDialog *dialog = GTK_DIALOG (modest_platform_run_confirmation_dialog (GTK_WINDOW (self),
- _("imum_nc_wizard_confirm_lose_changes")));
- /* TODO: These button names will be ambiguous, and not specified in the UI specification. */
-
- const gint dialog_response = gtk_dialog_run (dialog);
- gtk_widget_destroy (GTK_WIDGET (dialog));
-
- if (dialog_response != GTK_RESPONSE_OK)
- prevent_response = TRUE;
- }
- /* Check for invalid input: */
- else if (response_id != GTK_RESPONSE_CANCEL && !check_data (self)) {
- prevent_response = TRUE;
- }
-
- if (prevent_response) {
- /* This is a nasty hack. murrayc. */
- /* Don't let the dialog close */
- g_signal_stop_emission_by_name (wizard_dialog, "response");
- return;
- }
-
- if (response_id == GTK_RESPONSE_OK) {
- /* Try to save the changes if modified (NB #59251): */
- if (priv->modified)
- {
- const gboolean saved = save_configuration (self);
- if (saved) {
- /* Do not show the account-saved dialog if we are just saving this
- * temporarily, because from the user's point of view it will not
- * really be saved (saved + enabled) until later
- */
- if (modest_account_settings_get_account_name (priv->settings) != NULL) {
- ModestServerAccountSettings *store_settings;
- ModestServerAccountSettings *transport_settings;
- const gchar *store_account_name;
- const gchar *transport_account_name;
-
-
- store_settings = modest_account_settings_get_store_settings (priv->settings);
- transport_settings = modest_account_settings_get_transport_settings (priv->settings);
- store_account_name = modest_server_account_settings_get_account_name (store_settings);
- transport_account_name = modest_server_account_settings_get_account_name (transport_settings);
-
- if (store_account_name) {
- modest_account_mgr_notify_account_update (priv->account_manager,
- store_account_name);
- }
- if (transport_account_name) {
- modest_account_mgr_notify_account_update (priv->account_manager,
- transport_account_name);
- }
- g_object_unref (store_settings);
- g_object_unref (transport_settings);
-
- modest_platform_information_banner(NULL, NULL, _("mcen_ib_advsetup_settings_saved"));
- }
- } else {
- modest_platform_information_banner (NULL, NULL, _("mail_ib_setting_failed"));
- }
- }
- }
-}
-
-static void
-modest_account_settings_dialog_init (gpointer g, gpointer iface_data)
-{
- ModestAccountSettingsDialogClass *iface = (ModestAccountSettingsDialogClass *) g;
-
- iface->load_settings = modest_default_account_settings_dialog_load_settings;
-}
-
-static void
-modest_default_account_settings_dialog_init (ModestDefaultAccountSettingsDialog *self)
-{
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- /* Create the notebook to be used by the GtkDialog base class:
- * Each page of the notebook will be a page of the wizard: */
- priv->notebook = GTK_NOTEBOOK (gtk_notebook_new());
- priv->settings = modest_account_settings_new ();
-
- /* Get the account manager object,
- * so we can check for existing accounts,
- * and create new accounts: */
- priv->account_manager = modest_runtime_get_account_mgr ();
- g_assert (priv->account_manager);
- g_object_ref (priv->account_manager);
-
- priv->protocol_authentication_incoming = MODEST_PROTOCOLS_AUTH_PASSWORD;
-
- /* Create the common pages,
- */
- priv->page_account_details = create_page_account_details (self);
- priv->page_user_details = create_page_user_details (self);
- priv->page_incoming = create_page_incoming (self);
- priv->page_outgoing = create_page_outgoing (self);
-
- /* Add the notebook pages: */
- gtk_notebook_append_page (priv->notebook, priv->page_account_details,
- gtk_label_new (_("mcen_ti_account_settings_account")));
- gtk_notebook_append_page (priv->notebook, priv->page_user_details,
- gtk_label_new (_("mcen_ti_account_settings_userinfo")));
- gtk_notebook_append_page (priv->notebook, priv->page_incoming,
- gtk_label_new (_("mcen_ti_advsetup_retrieval")));
- gtk_notebook_append_page (priv->notebook, priv->page_outgoing,
- gtk_label_new (_("mcen_ti_advsetup_sending")));
-
- GtkDialog *dialog = GTK_DIALOG (self);
- gtk_container_add (GTK_CONTAINER (dialog->vbox), GTK_WIDGET (priv->notebook));
- gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), MODEST_MARGIN_HALF);
- gtk_widget_show (GTK_WIDGET (priv->notebook));
-
- /* Add the buttons: */
- gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_SAVE, GTK_RESPONSE_OK);
-
- /* Connect to the dialog's response signal: */
- /* We use connect-before
- * so we can stop the signal emission,
- * to stop the default signal handler from closing the dialog.
- */
- g_signal_connect (G_OBJECT (self), "response",
- G_CALLBACK (on_response), self);
-
- priv->modified = FALSE;
-
- /* When this window is shown, hibernation should not be possible,
- * because there is no sensible way to save the state: */
- modest_window_mgr_prevent_hibernation_while_window_is_shown (
- modest_runtime_get_window_mgr (), GTK_WINDOW (self));
-
- gtk_window_set_default_size (GTK_WINDOW (self), 600, 400);
-
-/* hildon_help_dialog_help_enable (GTK_DIALOG(self), "applications_email_accountsettings", */
-/* modest_maemo_utils_get_osso_context()); */
-}
-
-ModestAccountSettingsDialog*
-modest_default_account_settings_dialog_new (void)
-{
- return g_object_new (MODEST_TYPE_ACCOUNT_SETTINGS_DIALOG, NULL);
-}
-
-/** Update the UI with the stored account details, so they can be edited.
- * @account_name: Name of the account, which should contain incoming and outgoing server accounts.
- */
-static void
-modest_default_account_settings_dialog_load_settings (ModestAccountSettingsDialog *dialog,
- ModestAccountSettings *settings)
-{
- ModestServerAccountSettings *incoming_account;
- ModestServerAccountSettings *outgoing_account;
- const gchar *account_name;
-
- g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS (settings));
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (dialog);
-
- incoming_account = modest_account_settings_get_store_settings (settings);
- outgoing_account = modest_account_settings_get_transport_settings (settings);
-
- account_name = modest_account_settings_get_account_name (settings);
-
- /* Save the account name so we can refer to it later: */
- if (priv->account_name)
- g_free (priv->account_name);
- priv->account_name = g_strdup (account_name);
-
- if (priv->settings)
- g_object_unref (priv->settings);
- priv->settings = g_object_ref (settings);
-
- /* Save the account title so we can refer to it if the user changes it: */
- if (priv->original_account_title)
- g_free (priv->original_account_title);
- priv->original_account_title = g_strdup (modest_account_settings_get_display_name (settings));
-
- /* Show the account data in the widgets: */
-
- /* Note that we never show the non-display name in the UI.
- * (Though the display name defaults to the non-display name at the start.) */
- gtk_entry_set_text( GTK_ENTRY (priv->entry_account_title),
- null_means_empty (modest_account_settings_get_display_name (settings)));
- gtk_entry_set_text( GTK_ENTRY (priv->entry_user_name),
- null_means_empty (modest_account_settings_get_fullname (settings)));
- gtk_entry_set_text( GTK_ENTRY (priv->entry_user_email),
- null_means_empty (modest_account_settings_get_email_address (settings)));
- modest_retrieve_combo_box_fill (MODEST_RETRIEVE_COMBO_BOX (priv->combo_retrieve),
- modest_server_account_settings_get_protocol (incoming_account));
- modest_retrieve_combo_box_set_active_retrieve_conf (MODEST_RETRIEVE_COMBO_BOX (priv->combo_retrieve),
- modest_account_settings_get_retrieve_type (settings));
- modest_limit_retrieve_combo_box_set_active_limit_retrieve (
- MODEST_LIMIT_RETRIEVE_COMBO_BOX (priv->combo_limit_retrieve),
- modest_account_settings_get_retrieve_limit (settings));
-
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->checkbox_leave_messages),
- modest_account_settings_get_leave_messages_on_server (settings));
-
- /* Only show the leave-on-server checkbox for POP,
- * as per the UI spec: */
- if (modest_server_account_settings_get_protocol (incoming_account) != MODEST_PROTOCOLS_STORE_POP) {
- gtk_widget_hide (priv->caption_leave_messages);
- } else {
- gtk_widget_show (priv->caption_leave_messages);
- }
-
- update_incoming_server_security_choices (dialog, modest_server_account_settings_get_protocol (incoming_account));
- if (incoming_account) {
- const gchar *username;
- const gchar *password;
- const gchar *hostname;
- /* Remember this for later: */
- priv->incoming_protocol = modest_server_account_settings_get_protocol (incoming_account);;
-
- hostname = modest_server_account_settings_get_hostname (incoming_account);
- username = modest_server_account_settings_get_username (incoming_account);
- password = modest_server_account_settings_get_password (incoming_account);
- gtk_entry_set_text( GTK_ENTRY (priv->entry_user_username),
- null_means_empty (username));
- gtk_entry_set_text( GTK_ENTRY (priv->entry_user_password),
- null_means_empty (password));
-
- gtk_entry_set_text( GTK_ENTRY (priv->entry_incomingserver),
- null_means_empty (hostname));
-
- /* The UI spec says:
- * If secure authentication is unchecked, allow sending username and password also as plain text.
- * If secure authentication is checked, require one of the secure methods during connection: SSL, TLS, CRAM-MD5 etc.
- * TODO: Do we need to discover which of these (SSL, TLS, CRAM-MD5) is supported?
- */
- modest_serversecurity_combo_box_set_active_serversecurity (
- MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_incoming_security),
- modest_server_account_settings_get_security_protocol (incoming_account));
-
- /* Check if we have
- - a secure protocol
- OR
- - use encrypted passwords
- */
- const ModestProtocolType secure_auth = modest_server_account_settings_get_auth_protocol (incoming_account);
- priv->protocol_authentication_incoming = (secure_auth != MODEST_PROTOCOLS_AUTH_NONE)?
- secure_auth:MODEST_PROTOCOLS_AUTH_PASSWORD;
- if (modest_protocol_registry_protocol_type_is_secure(modest_runtime_get_protocol_registry (),
- secure_auth))
- {
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (priv->checkbox_incoming_auth),
- TRUE);
- }
- else
- {
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (priv->checkbox_incoming_auth),
- FALSE);
- };
-
- update_incoming_server_title (dialog, priv->incoming_protocol);
-
- const gint port_num = modest_server_account_settings_get_port (incoming_account);
- if (port_num == 0) {
- /* Show the appropriate port number: */
- on_combo_incoming_security_changed (
- GTK_COMBO_BOX (priv->combo_incoming_security), dialog);
- } else {
- /* Keep the user-entered port-number,
- * or the already-appropriate automatic port number: */
- gtk_spin_button_set_value (
- GTK_SPIN_BUTTON (priv->entry_incoming_port), (gdouble) port_num);
- }
- g_object_unref (incoming_account);
- }
-
- outgoing_account = modest_account_settings_get_transport_settings (settings);
- if (outgoing_account) {
- const gchar *hostname;
- const gchar *username;
- const gchar *password;
-
- /* Remember this for later: */
- priv->outgoing_protocol =
- modest_server_account_settings_get_protocol (outgoing_account);
-
- hostname = modest_server_account_settings_get_hostname (outgoing_account);
- username = modest_server_account_settings_get_username (outgoing_account);
- password = modest_server_account_settings_get_password (outgoing_account);
- gtk_entry_set_text( GTK_ENTRY (priv->entry_outgoingserver),
- null_means_empty (hostname));
-
- gtk_entry_set_text( GTK_ENTRY (priv->entry_outgoing_username),
- null_means_empty (username));
- gtk_entry_set_text( GTK_ENTRY (priv->entry_outgoing_password),
- null_means_empty (password));
-
- /* Get the secure-auth setting: */
- const ModestProtocolType secure_auth = modest_server_account_settings_get_auth_protocol (outgoing_account);
- modest_secureauth_combo_box_set_active_secureauth (
- MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth), secure_auth);
- on_combo_outgoing_auth_changed (GTK_COMBO_BOX (priv->combo_outgoing_auth), dialog);
-
- modest_serversecurity_combo_box_fill (
- MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security),
- priv->outgoing_protocol);
-
- /* Get the security setting: */
- const ModestProtocolType security =
- modest_server_account_settings_get_security_protocol (outgoing_account);
- modest_serversecurity_combo_box_set_active_serversecurity (
- MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security), security);
-
- const gint port_num = modest_server_account_settings_get_port (outgoing_account);
- if (port_num == 0) {
- /* Show the appropriate port number: */
- on_combo_outgoing_security_changed (
- GTK_COMBO_BOX (priv->combo_outgoing_security), dialog);
- }
- else {
- /* Keep the user-entered port-number,
- * or the already-appropriate automatic port number: */
- gtk_spin_button_set_value (
- GTK_SPIN_BUTTON (priv->entry_outgoing_port), (gdouble) port_num);
- }
-
- const gboolean has_specific =
- modest_account_settings_get_use_connection_specific_smtp (settings);
- gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON (priv->checkbox_outgoing_smtp_specific),
- has_specific);
- g_object_unref (outgoing_account);
- }
-
- /* Set window title according to account: */
- /* TODO: Is this the correct way to find a human-readable name for
- * the protocol used? */
- ModestProtocol *proto =
- modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (),
- priv->incoming_protocol);
-
- const gchar* proto_str = modest_protocol_get_display_name (proto);
- gchar *proto_name = g_utf8_strup(proto_str, -1);
- const gchar *account_title = modest_account_settings_get_display_name(settings);
-
- gchar *title = g_strdup_printf(_("mcen_ti_account_settings"), proto_name, account_title);
- g_free (proto_name);
-
- gtk_window_set_title (GTK_WINDOW (dialog), title);
- g_free (title);
-
- /* account_data->is_enabled, */
- /*account_data->is_default, */
-
- /* Unset the modified flag so we can detect changes later: */
- priv->modified = FALSE;
-}
-
-/** Show the User Info tab.
- */
-void
-modest_account_settings_dialog_switch_to_user_info (ModestAccountSettingsDialog *dialog)
-{
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (dialog);
-
- const gint page_num = gtk_notebook_page_num (priv->notebook, priv->page_user_details);
- if (page_num == -1) {
- g_warning ("%s: notebook page not found.\n", __FUNCTION__);
- }
-
- /* Ensure that the widget is visible so that gtk_notebook_set_current_page() works: */
- /* TODO: even this hack (recommened by the GTK+ documentation) doesn't seem to work. */
-
- gtk_widget_show (priv->page_user_details);
- gtk_widget_show (GTK_WIDGET (priv->notebook));
- gtk_widget_show (GTK_WIDGET (dialog));
- gtk_notebook_set_current_page (priv->notebook, page_num);
-}
-
-static gboolean
-save_configuration (ModestAccountSettingsDialog *dialog)
-{
- ModestServerAccountSettings *store_settings;
- ModestServerAccountSettings *transport_settings;
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (dialog);
-
- /* Set the account data from the widgets: */
- const gchar* account_name = priv->account_name;
- const gchar* user_fullname = gtk_entry_get_text (GTK_ENTRY (priv->entry_user_name));
- modest_account_settings_set_fullname (priv->settings, user_fullname);
-
- const gchar* emailaddress = gtk_entry_get_text (GTK_ENTRY (priv->entry_user_email));
- modest_account_settings_set_email_address (priv->settings, emailaddress);
-
-/* /\* Signature: *\/ */
-/* if (priv->signature_dialog) { */
-/* gboolean use_signature = FALSE; */
-/* gchar *signature = */
-/* modest_signature_editor_dialog_get_settings (MODEST_SIGNATURE_EDITOR_DIALOG (priv->signature_dialog), */
-/* &use_signature); */
-
-/* modest_account_settings_set_use_signature (priv->settings, use_signature); */
-/* modest_account_settings_set_signature (priv->settings, signature); */
-/* } */
-
- ModestAccountRetrieveType retrieve_type = modest_retrieve_combo_box_get_active_retrieve_conf (
- MODEST_RETRIEVE_COMBO_BOX (priv->combo_retrieve));
- modest_account_settings_set_retrieve_type (priv->settings, retrieve_type);
-
- gint retrieve_limit = modest_limit_retrieve_combo_box_get_active_limit_retrieve (
- MODEST_LIMIT_RETRIEVE_COMBO_BOX (priv->combo_limit_retrieve));
- modest_account_settings_set_retrieve_limit (priv->settings, retrieve_limit);
-
- const gboolean leave_on_server = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->checkbox_leave_messages));
- modest_account_settings_set_leave_messages_on_server (priv->settings, leave_on_server);
-
- store_settings = modest_account_settings_get_store_settings (priv->settings);
-
- const gchar* hostname = gtk_entry_get_text (GTK_ENTRY (priv->entry_incomingserver));
- modest_server_account_settings_set_hostname (store_settings, hostname);
-
- const gchar* username = gtk_entry_get_text (GTK_ENTRY (priv->entry_user_username));
- modest_server_account_settings_set_username (store_settings, username);
-
- const gchar* password = gtk_entry_get_text (GTK_ENTRY (priv->entry_user_password));
- modest_server_account_settings_set_password (store_settings, password);
-
- /* port: */
- gint port_num = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (priv->entry_incoming_port));
- modest_server_account_settings_set_port (store_settings, port_num);
-
- /* The UI spec says:
- * If secure authentication is unchecked, allow sending username and password also as plain text.
- * If secure authentication is checked, require one of the secure
- * methods during connection: SSL, TLS, CRAM-MD5 etc.
- */
-
- const ModestProtocolType protocol_security_incoming = modest_serversecurity_combo_box_get_active_serversecurity (
- MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_incoming_security));
- modest_server_account_settings_set_security_protocol (store_settings,
- protocol_security_incoming);
- modest_server_account_settings_set_auth_protocol (store_settings,
- priv->protocol_authentication_incoming);
-
- g_object_unref (store_settings);
-
- /* Outgoing: */
- transport_settings = modest_account_settings_get_transport_settings (priv->settings);
-
- hostname = gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoingserver));
- modest_server_account_settings_set_hostname (transport_settings, hostname);
-
- username = gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoing_username));
- modest_server_account_settings_set_username (transport_settings, username);
-
- password = gtk_entry_get_text (GTK_ENTRY (priv->entry_outgoing_password));
- modest_server_account_settings_set_password (transport_settings, password);
-
- const ModestProtocolType protocol_security_outgoing = modest_serversecurity_combo_box_get_active_serversecurity (
- MODEST_SERVERSECURITY_COMBO_BOX (priv->combo_outgoing_security));
- modest_server_account_settings_set_security_protocol (transport_settings,
- protocol_security_outgoing);
-
- const ModestProtocolType protocol_authentication_outgoing = modest_secureauth_combo_box_get_active_secureauth (
- MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth));
- modest_server_account_settings_set_auth_protocol (transport_settings, protocol_authentication_outgoing);
-
- /* port: */
- port_num = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (priv->entry_outgoing_port));
- modest_server_account_settings_set_port (transport_settings, port_num);
- g_object_unref (transport_settings);
-
-
- /* Set the changed account title last, to simplify the previous code: */
- gchar* account_title = get_entered_account_title (dialog);
- if (!account_title)
- return FALSE; /* Should be prevented already anyway. */
-
-/* if (strcmp (account_title, account_name) != 0) { */
- modest_account_settings_set_display_name (priv->settings, account_title);
-/* } */
- g_free (account_title);
- account_title = NULL;
-
- /* Save connection-specific SMTP server accounts: */
- modest_account_settings_set_use_connection_specific_smtp
- (priv->settings,
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->checkbox_outgoing_smtp_specific)));
-
- /* this configuration is not persistent, we should not save */
- if (account_name != NULL)
- modest_account_mgr_save_account_settings (priv->account_manager, priv->settings);
-
-/* if (priv->specific_window) { */
-/* return modest_connection_specific_smtp_window_save_server_accounts ( */
-/* MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (priv->specific_window)); */
-/* } else { */
- return TRUE;
-/* } */
-
-}
-
-static gboolean entry_is_empty (GtkWidget *entry)
-{
- if (!entry)
- return FALSE;
-
- const gchar* text = gtk_entry_get_text (GTK_ENTRY (entry));
- if ((!text) || (strlen(text) == 0))
- return TRUE;
- else {
- /* Strip it of whitespace at the start and end: */
- gchar *stripped = g_strdup (text);
- stripped = g_strstrip (stripped);
-
- if (!stripped)
- return TRUE;
-
- const gboolean result = (strlen (stripped) == 0);
-
- g_free (stripped);
- return result;
- }
-}
-
-static void
-enable_buttons (ModestAccountSettingsDialog *self)
-{
- gboolean enable_ok = TRUE;
- ModestProtocolType outgoing_auth_protocol;
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);;
-
- /* The account details title is mandatory: */
- if (entry_is_empty(priv->entry_account_title))
- enable_ok = FALSE;
-
- /* The user details username is mandatory: */
- if (enable_ok && entry_is_empty(priv->entry_user_username))
- enable_ok = FALSE;
-
- /* The user details email address is mandatory: */
- if (enable_ok && entry_is_empty (priv->entry_user_email))
- enable_ok = FALSE;
-
- /* The custom incoming server is mandatory: */
- if (enable_ok && entry_is_empty(priv->entry_incomingserver))
- enable_ok = FALSE;
-
- /* The custom incoming server is mandatory: */
- if (enable_ok && entry_is_empty(priv->entry_outgoingserver))
- enable_ok = FALSE;
-
- /* Outgoing username is mandatory if outgoing auth is secure */
- if (priv->combo_outgoing_auth) {
- outgoing_auth_protocol = modest_secureauth_combo_box_get_active_secureauth (
- MODEST_SECUREAUTH_COMBO_BOX (priv->combo_outgoing_auth));
- if (enable_ok &&
- outgoing_auth_protocol != MODEST_PROTOCOLS_AUTH_NONE &&
- entry_is_empty (priv->entry_outgoing_username))
- enable_ok = FALSE;
- }
-
- /* Enable the buttons,
- * identifying them via their associated response codes:
- */
- GtkDialog *dialog_base = GTK_DIALOG (self);
- gtk_dialog_set_response_sensitive (dialog_base,
- GTK_RESPONSE_OK,
- enable_ok);
-}
-
-void
-modest_account_settings_dialog_check_allow_changes (ModestAccountSettingsDialog *self)
-{
- ModestServerAccountSettings *incoming_settings;
- const gchar *server_account_name;
- gboolean username_known;
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);;
-
- if (!G_IS_OBJECT (priv->settings))
- return;
-
- incoming_settings = modest_account_settings_get_store_settings (priv->settings);
- server_account_name = modest_server_account_settings_get_account_name (incoming_settings);
-
- username_known = modest_account_mgr_get_server_account_username_has_succeeded (priv->account_manager,
- server_account_name);
-
- /* Enable or disable widgets */
- gtk_widget_set_sensitive (priv->entry_user_username, !username_known);
- gtk_widget_set_sensitive (priv->entry_incomingserver, !username_known);
- gtk_widget_set_sensitive (priv->entry_incoming_port, !username_known);
- gtk_widget_set_sensitive (priv->combo_incoming_security, !username_known);
-}
-
-void
-modest_account_settings_dialog_save_password (ModestAccountSettingsDialog *dialog)
-{
- ModestDefaultAccountSettingsDialogPrivate *priv;
-
- g_return_if_fail (MODEST_IS_ACCOUNT_SETTINGS_DIALOG (dialog));
-
- priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (dialog);
- priv->modified = TRUE;
-}
-
-static void
-modest_default_account_settings_dialog_class_init (ModestDefaultAccountSettingsDialogClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ModestDefaultAccountSettingsDialogPrivate));
-
- object_class->get_property = modest_account_settings_dialog_get_property;
- object_class->set_property = modest_account_settings_dialog_set_property;
- object_class->dispose = modest_account_settings_dialog_dispose;
- object_class->finalize = modest_account_settings_dialog_finalize;
-}
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /*HAVE_CONFIG_H*/
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include "widgets/modest-global-settings-dialog-priv.h"
-#include "widgets/modest-combo-box.h"
-#include "modest-runtime.h"
-#include "modest-defs.h"
-#include "gnome/modest-gnome-global-settings-dialog.h"
-#include "widgets/modest-ui-constants.h"
-
-
-/* include other impl specific header files */
-
-/* 'private'/'protected' functions */
-static void modest_gnome_global_settings_dialog_class_init (ModestGnomeGlobalSettingsDialogClass *klass);
-static void modest_gnome_global_settings_dialog_init (ModestGnomeGlobalSettingsDialog *obj);
-static void modest_gnome_global_settings_dialog_finalize (GObject *obj);
-
-/* list my signals */
-enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
- LAST_SIGNAL
-};
-
-static void modest_gnome_global_settings_dialog_load_settings (ModestGlobalSettingsDialog *self);
-static GtkWidget* create_updating_page (ModestGnomeGlobalSettingsDialog *self);
-static GtkWidget* create_composing_page (ModestGnomeGlobalSettingsDialog *self);
-static ModestConnectedVia current_connection (void);
-
-typedef struct _ModestGnomeGlobalSettingsDialogPrivate ModestGnomeGlobalSettingsDialogPrivate;
-struct _ModestGnomeGlobalSettingsDialogPrivate {
-};
-#define MODEST_GNOME_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_GNOME_GLOBAL_SETTINGS_DIALOG, \
- ModestGnomeGlobalSettingsDialogPrivate))
-/* globals */
-static GtkDialogClass *parent_class = NULL;
-
-/* uncomment the following if you have defined any signals */
-/* static guint signals[LAST_SIGNAL] = {0}; */
-
-GType
-modest_gnome_global_settings_dialog_get_type (void)
-{
- static GType my_type = 0;
- if (!my_type) {
- static const GTypeInfo my_info = {
- sizeof(ModestGnomeGlobalSettingsDialogClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc) modest_gnome_global_settings_dialog_class_init,
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof(ModestGnomeGlobalSettingsDialog),
- 1, /* n_preallocs */
- (GInstanceInitFunc) modest_gnome_global_settings_dialog_init,
- NULL
- };
- my_type = g_type_register_static (MODEST_TYPE_GLOBAL_SETTINGS_DIALOG,
- "ModestGnomeGlobalSettingsDialog",
- &my_info, 0);
- }
- return my_type;
-}
-
-static void
-modest_gnome_global_settings_dialog_class_init (ModestGnomeGlobalSettingsDialogClass *klass)
-{
- GObjectClass *gobject_class;
- gobject_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_peek_parent (klass);
- gobject_class->finalize = modest_gnome_global_settings_dialog_finalize;
-
- g_type_class_add_private (gobject_class, sizeof(ModestGnomeGlobalSettingsDialogPrivate));
-
- MODEST_GLOBAL_SETTINGS_DIALOG_CLASS (klass)->current_connection_func = current_connection;
-}
-
-static void
-modest_gnome_global_settings_dialog_init (ModestGnomeGlobalSettingsDialog *self)
-{
- ModestGlobalSettingsDialogPrivate *ppriv;
-/* GdkGeometry *geometry; */
-
- ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
-
- ppriv->updating_page = create_updating_page (self);
- ppriv->composing_page = NULL;
-
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (self)->vbox), ppriv->updating_page);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (self)->vbox), 12);
- gtk_container_set_border_width (GTK_CONTAINER (self), 12);
- gtk_window_set_default_size (GTK_WINDOW (self), 480, -1);
-
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (self)->action_area), 0);
-
- /* Add the buttons: */
- gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_SAVE, GTK_RESPONSE_OK);
-
- gtk_widget_show_all (ppriv->updating_page);
-}
-
-static void
-modest_gnome_global_settings_dialog_finalize (GObject *obj)
-{
-/* free/unref instance resources here */
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-GtkWidget*
-modest_gnome_global_settings_dialog_new (void)
-{
- GtkWidget *self = GTK_WIDGET(g_object_new(MODEST_TYPE_GNOME_GLOBAL_SETTINGS_DIALOG, NULL));
-
- /* Load settings */
- modest_gnome_global_settings_dialog_load_settings (MODEST_GLOBAL_SETTINGS_DIALOG (self));
-
- return self;
-}
-
-
-/*
- * Adds the two widgets to a new row in the table
- */
-static void
-add_to_table (GtkTable *table,
- GtkWidget *left,
- GtkWidget *right)
-{
- guint n_rows = 0;
-
- g_object_get (G_OBJECT (table), "n-rows", &n_rows,NULL);
-
- /* Attach label and value */
- gtk_table_attach (table,
- left, 0, 1,
- n_rows, n_rows + 1,
- GTK_FILL,
- GTK_FILL,
- 0, 0);
- gtk_table_attach (table,
- right, 1, 2,
- n_rows, n_rows + 1,
- GTK_EXPAND | GTK_FILL,
- GTK_FILL,
- 0, 0);
-}
-
-/*
- * We need this because the translations are comming without ":"
- */
-static GtkWidget *
-create_label (const gchar *text)
-{
- gchar *label_name;
- GtkWidget *label;
-
- label_name = g_strdup_printf ("%s:", text);
- label = gtk_label_new (label_name);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- g_free (label_name);
-
- return label;
-}
-
-/*
- * Creates the updating page
- */
-static GtkWidget*
-create_updating_page (ModestGnomeGlobalSettingsDialog *self)
-{
- GtkWidget *vbox, *table_update, *table_limit;
- GtkWidget *label;
- ModestGlobalSettingsDialogPrivate *ppriv;
-
- ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- vbox = gtk_vbox_new (FALSE, 0);
- table_update = gtk_table_new (3, 2, FALSE);
- table_limit = gtk_table_new (2, 2, FALSE);
- /* FIXME: set proper values (HIG) */
- gtk_table_set_row_spacings (GTK_TABLE (table_update), 3);
- gtk_table_set_col_spacings (GTK_TABLE (table_update), 12);
- gtk_table_set_row_spacings (GTK_TABLE (table_limit), 3);
- gtk_table_set_col_spacings (GTK_TABLE (table_limit), 12);
-
- /* Autoupdate */
- label = create_label (_("mcen_fi_options_autoupdate"));
- ppriv->auto_update = gtk_check_button_new ();
- add_to_table (GTK_TABLE (table_update), label, ppriv->auto_update);
-
- /* Connected via */
- label = create_label (_("mcen_fi_options_connectiontype"));
-
- /* Note: This ModestPairList* must exist for as long as the combo
- * that uses it, because the ModestComboBox uses the ID opaquely,
- * so it can't know how to manage its memory. */
- ppriv->connect_via_list = _modest_global_settings_dialog_get_connected_via ();
- ppriv->connect_via = modest_combo_box_new (ppriv->connect_via_list, g_int_equal);
-
- add_to_table (GTK_TABLE (table_update), label, ppriv->connect_via);
-
- /* Update interval */
- label = create_label (_("mcen_fi_options_updateinterval"));
-
- /* Note: This ModestPairList* must exist for as long as the combo
- * that uses it, because the ModestComboBox uses the ID opaquely,
- * so it can't know how to manage its memory. */
- ppriv->update_interval_list = _modest_global_settings_dialog_get_update_interval ();
- ppriv->update_interval = modest_combo_box_new (ppriv->update_interval_list, g_int_equal);
-
- add_to_table (GTK_TABLE (table_update), label, ppriv->update_interval);
-
- /* Add to vbox */
- gtk_box_pack_start (GTK_BOX (vbox), table_update, FALSE, FALSE, MODEST_MARGIN_HALF);
-
- /* Separator */
- gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, MODEST_MARGIN_HALF);
-
- /* Limits */
- label = create_label (_("mcen_fi_advsetup_sizelimit"));
- ppriv->size_limit = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1000, 1, 5000, 1, 1, 16)),
- 1, 0);
- add_to_table (GTK_TABLE (table_limit), label, ppriv->size_limit);
-
- label = create_label (_("mcen_fi_options_playsound"));
- ppriv->play_sound = gtk_check_button_new ();
- add_to_table (GTK_TABLE (table_limit), label, ppriv->play_sound);
-
- /* Add to vbox */
- gtk_box_pack_start (GTK_BOX (vbox), table_limit, FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
-
- return vbox;
-}
-
-/*
- * Creates the composing page
- */
-static GtkWidget*
-create_composing_page (ModestGnomeGlobalSettingsDialog *self)
-{
- GtkWidget *vbox, *table;
- GtkWidget *label;
-
- vbox = gtk_vbox_new (FALSE, MODEST_MARGIN_DEFAULT);
- table = gtk_table_new (2, 2, FALSE);
- /* FIXME: set proper values */
- gtk_table_set_row_spacings (GTK_TABLE (table), 3);
- gtk_table_set_col_spacings (GTK_TABLE (table), 12);
-
- /* Update interval */
- label = create_label (_("mcen_fi_options_messageformat"));
-
- ModestGlobalSettingsDialogPrivate *ppriv =
- MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- /* Note: This ModestPairList* must exist for as long as the combo
- * that uses it, because the ModestComboBox uses the ID opaquely,
- * so it can't know how to manage its memory. */
- ppriv->msg_format_list = _modest_global_settings_dialog_get_msg_formats ();
- ppriv->msg_format = modest_combo_box_new (ppriv->msg_format_list, g_int_equal);
-
- add_to_table (GTK_TABLE (table), label, ppriv->msg_format);
-
- /* Add to vbox */
- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
-
- return vbox;
-}
-
-static ModestConnectedVia
-current_connection (void)
-{
- return MODEST_CONNECTED_VIA_ANY;
-}
-
-static void
-modest_gnome_global_settings_dialog_load_settings (ModestGlobalSettingsDialog *self)
-{
- ModestConf *conf;
- gboolean checked;
- gint combo_id, value;
- GError *error = NULL;
- ModestGlobalSettingsDialogPrivate *priv;
-
- priv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
- conf = modest_runtime_get_conf ();
-
- /* Autoupdate */
- checked = modest_conf_get_bool (conf, MODEST_CONF_AUTO_UPDATE, &error);
- if (error) {
- g_clear_error (&error);
- error = NULL;
- checked = FALSE;
- }
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->auto_update), checked);
- priv->initial_state.auto_update = checked;
-
- /* Connected by */
- combo_id = modest_conf_get_int (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- combo_id = MODEST_CONNECTED_VIA_WLAN_OR_WIMAX;
- }
- modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->connect_via),
- (gpointer) &combo_id);
- priv->initial_state.connect_via = combo_id;
-
- /* Update interval */
- combo_id = modest_conf_get_int (conf, MODEST_CONF_UPDATE_INTERVAL, &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- combo_id = MODEST_UPDATE_INTERVAL_15_MIN;
- }
- modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->update_interval),
- (gpointer) &combo_id);
- priv->initial_state.update_interval = combo_id;
-
- /* Size limit */
- value = modest_conf_get_int (conf, MODEST_CONF_MSG_SIZE_LIMIT, &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- value = 1000;
- }
- /* It's better to do this in the subclasses, but it's just one
- line, so we'll leave it here for the moment */
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->size_limit), value);
- priv->initial_state.size_limit = value;
-
- /* Play sound */
- checked = modest_conf_get_bool (conf, MODEST_CONF_PLAY_SOUND_MSG_ARRIVE, &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- checked = FALSE;
- }
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->play_sound), checked);
- priv->initial_state.play_sound = checked;
-
- /* Msg format */
- checked = modest_conf_get_bool (conf, MODEST_CONF_PREFER_FORMATTED_TEXT, &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- combo_id = MODEST_FILE_FORMAT_FORMATTED_TEXT;
- }
- combo_id = (checked) ? MODEST_FILE_FORMAT_FORMATTED_TEXT : MODEST_FILE_FORMAT_PLAIN_TEXT;
- modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->msg_format),
- (gpointer) &combo_id);
- priv->initial_state.prefer_formatted_text = checked;
-}
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MODEST_GNOME_GLOBAL_SETTINGS_DIALOG_H__
-#define __MODEST_GNOME_GLOBAL_SETTINGS_DIALOG_H__
-
-#include "widgets/modest-global-settings-dialog.h"
-
-G_BEGIN_DECLS
-
-/* convenience macros */
-#define MODEST_TYPE_GNOME_GLOBAL_SETTINGS_DIALOG (modest_gnome_global_settings_dialog_get_type())
-#define MODEST_GNOME_GLOBAL_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_GNOME_GLOBAL_SETTINGS_DIALOG,ModestGnomeGlobalSettingsDialog))
-#define MODEST_GNOME_GLOBAL_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_GNOME_GLOBAL_SETTINGS_DIALOG,ModestGnomeGlobalSettingsDialogClass))
-#define MODEST_IS_GNOME_GLOBAL_SETTINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_GNOME_GLOBAL_SETTINGS_DIALOG))
-#define MODEST_IS_GNOME_GLOBAL_SETTINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_GNOME_GLOBAL_SETTINGS_DIALOG))
-#define MODEST_GNOME_GLOBAL_SETTINGS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_GNOME_GLOBAL_SETTINGS_DIALOG,ModestGnomeGlobalSettingsDialogClass))
-
-typedef struct _ModestGnomeGlobalSettingsDialog ModestGnomeGlobalSettingsDialog;
-typedef struct _ModestGnomeGlobalSettingsDialogClass ModestGnomeGlobalSettingsDialogClass;
-
-struct _ModestGnomeGlobalSettingsDialog {
- ModestGlobalSettingsDialog parent;
-};
-
-struct _ModestGnomeGlobalSettingsDialogClass {
- ModestGlobalSettingsDialogClass parent_class;
-};
-
-/* member functions */
-GType modest_gnome_global_settings_dialog_get_type (void) G_GNUC_CONST;
-
-GtkWidget* modest_gnome_global_settings_dialog_new (void);
-
-G_END_DECLS
-
-#endif /* __MODEST_GNOME_GLOBAL_SETTINGS_DIALOG_H__ */
-
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <glib/gi18n.h>
-#include "modest-gnome-sort-dialog.h"
-#include "widgets/modest-sort-criterium-view.h"
-#include <gtk/gtk.h>
-
-static gint modest_gnome_sort_dialog_add_sort_key (ModestSortCriteriumView *self,
- const gchar *sort_key);
-static void modest_gnome_sort_dialog_set_sort_key (ModestSortCriteriumView *self, gint key);
-static void modest_gnome_sort_dialog_set_sort_order (ModestSortCriteriumView *self, GtkSortType sort_type);
-static gint modest_gnome_sort_dialog_get_sort_key (ModestSortCriteriumView *self);
-static GtkSortType modest_gnome_sort_dialog_get_sort_order (ModestSortCriteriumView *self);
-static void modest_sort_criterium_view_init (gpointer g_iface, gpointer iface_data);
-
-typedef struct _ModestGnomeSortDialogPrivate ModestGnomeSortDialogPrivate;
-struct _ModestGnomeSortDialogPrivate {
- GtkWidget *sort_field_combo;
- GtkWidget *sort_type_combo;
- gint sort_field_next;
-};
-
-#define MODEST_GNOME_SORT_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_GNOME_SORT_DIALOG, \
- ModestGnomeSortDialogPrivate))
-
-
-G_DEFINE_TYPE_EXTENDED (ModestGnomeSortDialog,
- modest_gnome_sort_dialog,
- GTK_TYPE_DIALOG,
- 0,
- G_IMPLEMENT_INTERFACE (MODEST_TYPE_SORT_CRITERIUM_VIEW, modest_sort_criterium_view_init));
-
-static void
-modest_gnome_sort_dialog_finalize (GObject *object)
-{
- G_OBJECT_CLASS (modest_gnome_sort_dialog_parent_class)->finalize (object);
-}
-
-static void
-modest_gnome_sort_dialog_class_init (ModestGnomeSortDialogClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = modest_gnome_sort_dialog_finalize;
-
- g_type_class_add_private (object_class, sizeof(ModestGnomeSortDialogPrivate));
-
-}
-
-static void
-modest_gnome_sort_dialog_init (ModestGnomeSortDialog *self)
-{
- GtkWidget *vbox;
- GtkStockItem item;
- ModestGnomeSortDialogPrivate *priv = MODEST_GNOME_SORT_DIALOG_GET_PRIVATE (self);
-
- gtk_dialog_add_buttons (GTK_DIALOG (self),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
- vbox = gtk_vbox_new (FALSE, 3);
- priv->sort_field_combo = gtk_combo_box_new_text ();
- priv->sort_field_next = 0;
- priv->sort_type_combo = gtk_combo_box_new_text ();
- gtk_stock_lookup (GTK_STOCK_SORT_ASCENDING, &item);
- gtk_combo_box_insert_text (GTK_COMBO_BOX (priv->sort_type_combo), GTK_SORT_ASCENDING, _(item.label));
- gtk_stock_lookup (GTK_STOCK_SORT_DESCENDING, &item);
- gtk_combo_box_insert_text (GTK_COMBO_BOX (priv->sort_type_combo), GTK_SORT_DESCENDING, _(item.label));
-
- gtk_box_pack_start (GTK_BOX (vbox), priv->sort_field_combo, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), priv->sort_type_combo, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->vbox), vbox, FALSE, FALSE, 0);
- gtk_window_set_title (GTK_WINDOW (self), _("mcen_me_inbox_sort"));
-
- gtk_widget_show_all (vbox);
-}
-
-static gint
-modest_gnome_sort_dialog_add_sort_key (ModestSortCriteriumView *self,
- const gchar *sort_key)
-{
- ModestGnomeSortDialogPrivate *priv;
- gint retval;
-
- g_return_val_if_fail (MODEST_IS_GNOME_SORT_DIALOG (self), 0);
- priv = MODEST_GNOME_SORT_DIALOG_GET_PRIVATE (self);
-
- retval = priv->sort_field_next;
- priv->sort_field_next++;
-
- gtk_combo_box_insert_text (GTK_COMBO_BOX (priv->sort_field_combo), retval, sort_key);
-
- return retval;
-}
-
-static void
-modest_gnome_sort_dialog_set_sort_key (ModestSortCriteriumView *self, gint key)
-{
- ModestGnomeSortDialogPrivate *priv;
-
- g_return_if_fail (MODEST_IS_GNOME_SORT_DIALOG (self));
- priv = MODEST_GNOME_SORT_DIALOG_GET_PRIVATE (self);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->sort_field_combo), key);
-}
-
-static void
-modest_gnome_sort_dialog_set_sort_order (ModestSortCriteriumView *self, GtkSortType sort_type)
-{
- ModestGnomeSortDialogPrivate *priv;
-
- g_return_if_fail (MODEST_IS_GNOME_SORT_DIALOG (self));
- priv = MODEST_GNOME_SORT_DIALOG_GET_PRIVATE (self);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (priv->sort_type_combo), sort_type);
-}
-
-static gint
-modest_gnome_sort_dialog_get_sort_key (ModestSortCriteriumView *self)
-{
- ModestGnomeSortDialogPrivate *priv;
-
- g_return_val_if_fail (MODEST_IS_GNOME_SORT_DIALOG (self), 0);
- priv = MODEST_GNOME_SORT_DIALOG_GET_PRIVATE (self);
-
- return gtk_combo_box_get_active (GTK_COMBO_BOX (priv->sort_field_combo));
-}
-
-static GtkSortType
-modest_gnome_sort_dialog_get_sort_order (ModestSortCriteriumView *self)
-{
- ModestGnomeSortDialogPrivate *priv;
-
- g_return_val_if_fail (MODEST_IS_GNOME_SORT_DIALOG (self), GTK_SORT_ASCENDING);
- priv = MODEST_GNOME_SORT_DIALOG_GET_PRIVATE (self);
-
- return gtk_combo_box_get_active (GTK_COMBO_BOX (priv->sort_type_combo));
-}
-
-static void
-modest_sort_criterium_view_init (gpointer g_iface,
- gpointer iface_data)
-{
- ModestSortCriteriumViewIface *iface = (ModestSortCriteriumViewIface *) g_iface;
-
- iface->add_sort_key_func = modest_gnome_sort_dialog_add_sort_key;
- iface->get_sort_key_func = modest_gnome_sort_dialog_get_sort_key;
- iface->set_sort_key_func = modest_gnome_sort_dialog_set_sort_key;
- iface->get_sort_order_func = modest_gnome_sort_dialog_get_sort_order;
- iface->set_sort_order_func = modest_gnome_sort_dialog_set_sort_order;
-}
-
-GtkWidget*
-modest_gnome_sort_dialog_new (GtkWindow *parent)
-{
- GtkWidget *result = g_object_new (MODEST_TYPE_GNOME_SORT_DIALOG, NULL);
-
-
- if (parent)
- gtk_window_set_transient_for(GTK_WINDOW(result), parent);
-
- return result;
-}
-
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MODEST_GNOME_SORT_DIALOG
-#define __MODEST_GNOME_SORT_DIALOG
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <widgets/modest-sort-criterium-view.h>
-
-G_BEGIN_DECLS
-
-#define MODEST_TYPE_GNOME_SORT_DIALOG modest_gnome_sort_dialog_get_type()
-
-#define MODEST_GNOME_SORT_DIALOG(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MODEST_TYPE_GNOME_SORT_DIALOG, ModestGnomeSortDialog))
-
-#define MODEST_GNOME_SORT_DIALOG_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MODEST_TYPE_GNOME_SORT_DIALOG, ModestGnomeSortDialogClass))
-
-#define MODEST_IS_GNOME_SORT_DIALOG(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MODEST_TYPE_GNOME_SORT_DIALOG))
-
-#define MODEST_IS_GNOME_SORT_DIALOG_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MODEST_TYPE_GNOME_SORT_DIALOG))
-
-#define MODEST_GNOME_SORT_DIALOG_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MODEST_TYPE_GNOME_SORT_DIALOG, ModestGnomeSortDialogClass))
-
-typedef struct {
- GtkDialog parent;
-
-} ModestGnomeSortDialog;
-
-typedef struct {
- GtkDialogClass parent_class;
-
-} ModestGnomeSortDialogClass;
-
-GType modest_gnome_sort_dialog_get_type (void);
-
-GtkWidget* modest_gnome_sort_dialog_new (GtkWindow *parent);
-
-G_END_DECLS
-
-#endif /* __MODEST_GNOME_SORT_DIALOG */
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "modest-runtime.h"
-
-ModestPairList *
-modest_gnome_utils_get_protocols_pair_list (const gchar *tag)
-{
- GSList *protos, *list, *iter;
- ModestProtocolRegistry *registry;
-
- registry = modest_runtime_get_protocol_registry ();
- protos = modest_protocol_registry_get_by_tag (registry, tag);
-
- /* This should never happen */
- g_return_val_if_fail (protos, NULL);
-
- list = NULL;
- iter = protos;
- while (iter) {
- ModestProtocol *proto;
- ModestPair *pair;
-
- proto = MODEST_PROTOCOL (iter->data);
- pair = modest_pair_new (modest_protocol_get_type_id (proto),
- modest_protocol_get_display_name (proto),
- FALSE);
- list = g_slist_append (list, pair);
-
- iter = g_slist_next (iter);
- }
- g_slist_free (protos);
-
- return (ModestPairList *) list;
-}
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MODEST_GNOME_UTILS_H__
-#define __MODEST_GNOME_UTILS_H__
-
-#include "modest-pair.h"
-
-G_BEGIN_DECLS
-
-ModestPairList *modest_gnome_utils_get_protocols_pair_list (const gchar *tag);
-
-G_END_DECLS
-
-#endif /* __MODEST_GNOME_UTILS_H__ */
-
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-/* modest-icon-names.h */
-
-/*
- * FIXME: this should go the front-end dirs,
- * with specific icons
- */
-
-#ifndef __MODEST_ICON_NAMES_H__
-#define __MODEST_ICON_NAMES_H__
-
-
-/* icons */
-
-#define MODEST_APP_ICON PIXMAP_PREFIX "modest-icon.png"
-
-#define MODEST_HEADER_ICON_READ PIXMAP_PREFIX "qgn_list_messagin_mail.png"
-#define MODEST_HEADER_ICON_UNREAD PIXMAP_PREFIX "qgn_list_messagin_mail_unread.png"
-#define MODEST_HEADER_ICON_DELETED PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png"
-/* #define MODEST_HEADER_ICON_ATTACH PIXMAP_PREFIX "qgn_list_gene_attacpap.png" */
-#define MODEST_HEADER_ICON_ATTACH "stock_attach"
-
-
-/*
- * until we have the custom cell renderer, we use the hacked icons below;
- * don't remove!!!
- */
-#define MODEST_HEADER_ICON_ATTACH_HIGH_PRIORITY PIXMAP_PREFIX"modest_high_attachment.png"
-#define MODEST_HEADER_ICON_ATTACH_LOW_PRIORITY PIXMAP_PREFIX"modest_low_attachment.png"
-#define MODEST_HEADER_ICON_ATTACH_NORM_PRIORITY PIXMAP_PREFIX"modest_normal_attachment.png"
-#define MODEST_HEADER_ICON_HIGH_PRIORITY PIXMAP_PREFIX"modest_high_no_attachment.png"
-#define MODEST_HEADER_ICON_LOW_PRIORITY PIXMAP_PREFIX"modest_low_no_attachment.png"
-#define MODEST_HEADER_ICON_NORM_PRIORITY PIXMAP_PREFIX"modest_normal_no_attachment.png"
-#define MODEST_HEADER_ICON_HIGH "stock_mail-priority-high"
-#define MODEST_HEADER_ICON_LOW "stock_mail-priority-low"
-/*
- *
- */
-
-#define MODEST_FOLDER_ICON_OPEN "folder_open"
-#define MODEST_FOLDER_ICON_CLOSED "folder"
-
-#define MODEST_FOLDER_ICON_ACCOUNT "network-server"
-#define MODEST_FOLDER_ICON_INBOX "stock_inbox"
-#define MODEST_FOLDER_ICON_OUTBOX "stock_outbox"
-#define MODEST_FOLDER_ICON_SENT "stock_sent-mail"
-#define MODEST_FOLDER_ICON_TRASH "user-trash"
-#define MODEST_FOLDER_ICON_JUNK "stock_spam"
-#define MODEST_FOLDER_ICON_DRAFTS "stock_new-text"
-#define MODEST_FOLDER_ICON_NORMAL "folder"
-/* #define MODEST_FOLDER_ICON_LOCAL_FOLDERS PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png" */
-#define MODEST_FOLDER_ICON_LOCAL_FOLDERS "computer"
-#define MODEST_FOLDER_ICON_MMC "media-flash"
-#define MODEST_FOLDER_ICON_MMC_FOLDER MODEST_FOLDER_ICON_NORMAL
-
-/* toolbar */
-#define MODEST_TOOLBAR_ICON_MAIL_SEND "mail_send"
-#define MODEST_TOOLBAR_ICON_NEW_MAIL "mail_new"
-/* #define MODEST_TOOLBAR_ICON_SEND_RECEIVE PIXMAP_PREFIX "gtk-refresh.png" */
-#define MODEST_TOOLBAR_ICON_REPLY "mail_reply"
-#define MODEST_TOOLBAR_ICON_REPLY_ALL "mail-reply-all"
-#define MODEST_TOOLBAR_ICON_FORWARD "mail-forward"
-#define MODEST_TOOLBAR_ICON_DELETE GTK_STOCK_DELETE
-/* #define MODEST_TOOLBAR_ICON_NEXT PIXMAP_PREFIX "forward.png" */
-/* #define MODEST_TOOLBAR_ICON_PREV PIXMAP_PREFIX "back.png" */
-#define MODEST_TOOLBAR_ICON_STOP GTK_STOCK_STOP
-#define MODEST_TOOLBAR_ICON_FORMAT_BULLETS GTK_STOCK_INDENT
-#define MODEST_TOOLBAR_ICON_SPLIT_VIEW PIXMAP_PREFIX "folder"
-#define MODEST_TOOLBAR_ICON_BOLD GTK_STOCK_BOLD
-#define MODEST_TOOLBAR_ICON_ITALIC GTK_STOCK_ITALIC
-
-/* Stock icon names */
-#define MODEST_STOCK_MAIL_SEND "modest-stock-mail-send"
-#define MODEST_STOCK_NEW_MAIL "modest-stock-new-mail"
-#define MODEST_STOCK_SEND_RECEIVE "modest-stock-send-receive"
-#define MODEST_STOCK_REPLY "modest-stock-reply"
-#define MODEST_STOCK_REPLY_ALL "modest-stock-reply-all"
-#define MODEST_STOCK_FORWARD "modest-stock-forward"
-#define MODEST_STOCK_DELETE "modest-stock-delete"
-#define MODEST_STOCK_NEXT "modest-stock-next"
-#define MODEST_STOCK_PREV "modest-stock-prev"
-#define MODEST_STOCK_STOP "modest-stock-stop"
-#define MODEST_STOCK_SPLIT_VIEW "modest-stock-split-view"
-
-#endif /*__MODEST_ICON_NAMES_H__*/
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#ifndef __MODEST_MAIN_WINDOW_UI_DIMMING_PRIV_H__
-#define __MODEST_MAIN_WINDOW_UI_DIMMING_PRIV_H__
-
-#include "modest-dimming-rules-group.h"
-#include "modest-ui-dimming-rules.h"
-
-G_BEGIN_DECLS
-
-
-/* Menu Dimming rules entries */
-static const ModestDimmingEntry modest_main_window_menu_dimming_entries [] = {
-
- /* Email Menu */
- { "/MenuBar/EmailMenu/EmailNewMainMenu", NULL },
- { "/MenuBar/EmailMenu/EmailNewMainMenu/EmailNewMessageMenu", G_CALLBACK(modest_ui_dimming_rules_on_new_msg) },
- { "/MenuBar/EmailMenu/EmailNewMainMenu/EmailNewFolderMenu", G_CALLBACK(modest_ui_dimming_rules_on_new_folder) },
- { "/MenuBar/EmailMenu/EmailOpenMenu", G_CALLBACK(modest_ui_dimming_rules_on_open_msg) },
- { "/MenuBar/EmailMenu/EmailReplyMenu", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) },
- { "/MenuBar/EmailMenu/EmailReplyAllMenu", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) },
- { "/MenuBar/EmailMenu/EmailForwardMenu", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) },
- { "/MenuBar/EmailMenu/EmailContentsMenu", G_CALLBACK(modest_ui_dimming_rules_on_contents_msg) },
- { "/MenuBar/EmailMenu/EmailPurgeAttachmentsMenu", G_CALLBACK(modest_ui_dimming_rules_on_remove_attachments) },
- { "/MenuBar/EmailMenu/EmailRenameMenu", G_CALLBACK(modest_ui_dimming_rules_on_rename_folder) },
- { "/MenuBar/EmailMenu/EmailDeleteMenu", G_CALLBACK(modest_ui_dimming_rules_on_delete) },
- { "/MenuBar/EmailMenu/EmailDetailsMenu", G_CALLBACK(modest_ui_dimming_rules_on_details) },
-
-/* /\* Edit Menu *\/ */
-/* { "/MenuBar/EditMenu", NULL }, */
-/* { "/MenuBar/EditMenu/EditSelectAllMenu", G_CALLBACK(modest_ui_dimming_rules_on_select_all)}, */
-/* { "/MenuBar/EditMenu/EditMarkAsReadMenu", G_CALLBACK(modest_ui_dimming_rules_on_mark_as_read_msg) }, */
-/* { "/MenuBar/EditMenu/EditMarkAsUnreadMenu", G_CALLBACK(modest_ui_dimming_rules_on_mark_as_unread_msg) }, */
-/* { "/MenuBar/EditMenu/EditMoveToMenu", G_CALLBACK(modest_ui_dimming_rules_on_move_to) }, */
-
-/* /\* View Menu *\/ */
-/* { "/MenuBar/ViewMenu", NULL }, */
-/* { "/MenuBar/ViewMenu/ViewSortMenu", G_CALLBACK(modest_ui_dimming_rules_on_sort) }, */
-/* { "/MenuBar/ViewMenu/ViewToggleFoldersMenu", NULL }, */
-/* { "/MenuBar/ViewMenu/ViewToggleFullscreenMenu", NULL }, */
-/* { "/MenuBar/ViewMenu/ViewShowToolbarMainMenu", NULL }, */
-/* { "/MenuBar/ViewMenu/ViewShowToolbarMainMenu/ViewShowToolbarNormalScreenMenu", NULL }, */
-/* { "/MenuBar/ViewMenu/ViewShowToolbarMainMenu/ViewShowToolbarFullScreenMenu", NULL }, */
-
-/* /\* Tools Menu *\/ */
-/* { "/MenuBar/ToolsMenu", NULL }, */
-/* { "/MenuBar/ToolsMenu/ToolsSettingsMenu", NULL }, */
-/* { "/MenuBar/ToolsMenu/ToolsAccountsMenu", NULL }, */
-/* { "/MenuBar/ToolsMenu/ToolsSMTPServersMenu", G_CALLBACK(modest_ui_dimming_rules_on_tools_smtp_servers) }, */
-/* { "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu", NULL }, */
-/* { "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveAllMenu", G_CALLBACK(modest_ui_dimming_rules_on_send_receive_all) }, */
-/* { "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveCancelSendingMenu", G_CALLBACK(modest_ui_dimming_rules_on_cancel_sending) }, */
-/* { "/MenuBar/ToolsMenu/ToolsContactsMenu", NULL }, */
-/* { "/MenuBar/ToolsMenu/ToolsSearchMessagesMenu", NULL }, */
-/* { "/MenuBar/ToolsMenu/ToolsHelpMenu", NULL }, */
-
-/* /\* Close Menu *\/ */
-/* { "/MenuBar/CloseMenu", NULL }, */
-/* { "/MenuBar/ToolsMenu/CloseWindowMenu", NULL }, */
-/* { "/MenuBar/ToolsMenu/CloseAllWindowsMenu", NULL }, */
-
-/* /\* Contextual Menus (Header View) *\/ */
-/* { "/HeaderViewCSM/HeaderViewCSMOpen", G_CALLBACK(modest_ui_dimming_rules_on_open_msg) }, */
-/* { "/HeaderViewCSM/HeaderViewCSMReply", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) }, */
-/* { "/HeaderViewCSM/HeaderViewCSMReplyAll", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) }, */
-/* { "/HeaderViewCSM/HeaderViewCSMForward", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) }, */
-/* { "/HeaderViewCSM/HeaderViewCSMDelete", G_CALLBACK(modest_ui_dimming_rules_on_delete_msg) }, */
-/* { "/HeaderViewCSM/HeaderViewCSMCancelSending", G_CALLBACK(modest_ui_dimming_rules_on_csm_cancel_sending) }, */
-/* { "/HeaderViewCSM/HeaderViewCSMHelp", NULL }, */
-
-/* /\* Contextual Menus (Folder View) *\/ */
-/* { "/FolderViewCSM/FolderViewCSMNewFolder", G_CALLBACK(modest_ui_dimming_rules_on_new_folder) }, */
-/* { "/FolderViewCSM/FolderViewCSMRenameFolder", G_CALLBACK(modest_ui_dimming_rules_on_rename_folder) }, */
-/* { "/FolderViewCSM/FolderViewCSMPasteMsgs", G_CALLBACK(modest_ui_dimming_rules_on_paste) }, */
-/* { "/FolderViewCSM/FolderViewCSMDeleteFolder", G_CALLBACK(modest_ui_dimming_rules_on_delete_folder) }, */
-/* { "/FolderViewCSM/FolderViewCSMSearchMessages", NULL }, */
-/* { "/FolderViewCSM/FolderViewCSMHelp", NULL }, */
-
-/* /\* Contextual Menus (Toolbar) *\/ */
-/* { "/ToolbarReplyCSM/ToolbarMessageForward", NULL }, */
-/* { "/ToolbarReplyCSM/ToolbarMessageReplyAll", NULL }, */
-/* { "/ToolbarReplyCSM/ToolbarMessageReply", NULL }, */
-
-};
-
-/* Toolbar Dimming rules entries */
-static const ModestDimmingEntry modest_main_window_toolbar_dimming_entries [] = {
-
- /* Toolbar */
- { "/ToolBar/ToolbarMessageNew", G_CALLBACK(modest_ui_dimming_rules_on_new_msg) },
- { "/ToolBar/ToolbarMessageReply", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) },
- { "/ToolBar/ToolbarDeleteMessage", G_CALLBACK(modest_ui_dimming_rules_on_delete) },
- { "/ToolBar/ToolbarToggleView", NULL },
- { "/ToolBar/ToolbarSort", G_CALLBACK(modest_ui_dimming_rules_on_sort) },
- { "/ToolBar/ToolbarSendReceive", G_CALLBACK(modest_ui_dimming_rules_on_send_receive) },
- { "/ToolBar/ToolbarCancel", NULL },
-};
-
-G_END_DECLS
-#endif /* __MODEST_MAIN_WINDOW_UI_PRIV_H__ */
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MODEST_MAIN_WINDOW_UI_PRIV_H__
-#define __MODEST_MAIN_WINDOW_UI_PRIV_H__
-
-#include <glib/gi18n.h>
-#include "modest-icon-names.h"
-#include "modest-ui-actions.h"
-
-G_BEGIN_DECLS
-
-
-/* Action entries */
-static const GtkActionEntry modest_action_entries [] = {
-
- /* Toplevel menus */
- { "Email", NULL, N_("mcen_me_inbox_email"), NULL, NULL, NULL },
- { "Edit", NULL, N_("mcen_me_inbox_edit"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_edit_menu_activated) },
- { "View", NULL, N_("mcen_me_inbox_view"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_view_menu_activated) },
- { "Tools", NULL, N_("mcen_me_inbox_tools"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_tools_menu_activated) },
- { "Attachments", NULL, N_("mcen_me_viewer_attachments"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_attachment_menu_activated) },
- { "Options", NULL, N_("_Options") },
- { "Zoom", NULL, N_("Zoom") },
- { "Help", NULL, N_("_Help") },
-
- /* Email */
- { "EmailNew", NULL, N_("mcen_me_inbox_new") }, /* submenu */
- { "EmailNewMessage", NULL, N_("mcen_me_inbox_message"), "<CTRL>N", NULL, G_CALLBACK (modest_ui_actions_on_new_msg) },
- { "EmailNewDefault", NULL, N_("mcen_me_viewer_newemail"), "<CTRL>N", NULL, G_CALLBACK (modest_ui_actions_on_new_msg) },
- { "EmailNewFolder", NULL, N_("mcen_me_inbox_folder"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_new_folder) },
- { "EmailOpen", NULL, N_("mcen_me_inbox_open"), "<CTRL>O", NULL, G_CALLBACK (modest_ui_actions_on_open) },
- { "EmailReply", NULL, N_("mcen_me_inbox_reply"), "<CTRL>R", NULL, G_CALLBACK (modest_ui_actions_on_reply) },
- { "EmailReplyAll", NULL, N_("mcen_me_inbox_replytoall"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_reply_all) },
- { "EmailForward", NULL, N_("mcen_me_inbox_forward"), "<CTRL>D", NULL, G_CALLBACK (modest_ui_actions_on_forward) },
- { "EmailRenameFolder", NULL, N_("mcen_me_user_renamefolder"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_rename_folder) },
- { "EmailDelete", NULL, N_("mcen_me_inbox_delete"), "BackSpace", NULL, G_CALLBACK (modest_ui_actions_on_delete_message_or_folder) },
- { "EmailContents", NULL, N_("mcen_me_inbox_retrieve_contents"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_retrieve_msg_contents) },
- { "EmailDetails", NULL, N_("mcen_me_inbox_messagedetails"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_details) },
- { "EmailPurgeAttachments", NULL, N_("mcen_me_inbox_remove_attachments"), NULL, NULL, G_CALLBACK (modest_ui_actions_remove_attachments) },
- { "CloseWindow", NULL, N_("mcen_me_inbox_close_window"), "<CTRL>W", NULL, G_CALLBACK (modest_ui_actions_on_close_window) },
- { "CloseAllWindows", NULL, N_("mcen_me_inbox_close_windows"), "<CTRL>Q", NULL, G_CALLBACK (modest_ui_actions_on_quit) },
-
- /* EDIT */
- { "EditCut", NULL, N_("mcen_me_inbox_cut"), "<CTRL>X", NULL, G_CALLBACK (modest_ui_actions_on_cut) },
- { "EditCopy", NULL, N_("mcen_me_inbox_copy"), "<CTRL>C", NULL, G_CALLBACK (modest_ui_actions_on_copy) },
- { "EditPaste", NULL, N_("mcen_me_inbox_paste"), "<CTRL>V", NULL, G_CALLBACK (modest_ui_actions_on_paste) },
- { "EditSelectAll", NULL, N_("mcen_me_viewer_selectall"), "<CTRL>A", NULL, G_CALLBACK (modest_ui_actions_on_select_all) },
- { "EditMarkAsRead", NULL, N_("mcen_me_inbox_mark_as_read"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_mark_as_read) },
- { "EditMarkAsUnread", NULL, N_("mcen_me_inbox_mark_as_unread"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_mark_as_unread) },
- { "EditMoveTo", NULL, N_("mcen_me_inbox_moveto"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_move_to) },
-
- /* View */
- { "ViewSort", NULL, N_("mcen_me_inbox_sort"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_sort) },
- { "ViewPreviousMessage", NULL, N_("mcen_me_viewer_previousmessage"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_prev) },
- { "ViewNextMessage", NULL, N_("mcen_me_viewer_nextmessage"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_next) },
-
- /* VIEW */
-/* { "ToggleView", GTK_STOCK_CDROM, N_("_Toggle view"), NULL, N_("Toggle the list view"), G_CALLBACK(modest_ui_actions_toggle_header_list_view) }, */
-
- /* GOTO */
- { "GotoPrevious", GTK_STOCK_GO_BACK, N_("Previous"), NULL, N_("Go to previous message"), G_CALLBACK (modest_ui_actions_on_prev) },
- { "GotoNext", GTK_STOCK_GO_FORWARD, N_("Next"), NULL, N_("Go to next message"), G_CALLBACK (modest_ui_actions_on_next) },
-
- /* Tools */
- { "ToolsSettings", NULL, N_("mcen_me_inbox_options"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_settings) },
- { "ToolsAccounts", NULL, N_("mcen_me_inbox_accounts"), NULL, NULL, G_CALLBACK(modest_ui_actions_on_accounts) },
- { "ToolsSMTPServers", NULL, N_("mcen_me_inbox_globalsmtpservers"), NULL, NULL, G_CALLBACK(modest_ui_actions_on_smtp_servers) },
- { "ToolsSendReceive", NULL, N_("mcen_me_inbox_sendandreceive") }, /* submenu */
- { "ToolsSendReceiveAll", NULL, N_("mcen_me_inbox_sendandreceive_all"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_send_receive) },
- { "ToolsSendReceiveCancelSending", NULL, N_("mcen_me_outbox_cancelsend"), NULL, NULL, G_CALLBACK (modest_ui_actions_cancel_send) },
- { "ToolsContacts", NULL, N_("mcen_me_inbox_open_addressbook"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_open_addressbook) },
- { "ToolsAddToContacts", NULL, N_("mcen_me_viewer_addtocontacts"), NULL, NULL, G_CALLBACK (modest_ui_actions_add_to_contacts) },
- { "ToolsSearchMessages", NULL, N_("mcen_me_inbox_search"), "<CTRL>E", NULL, G_CALLBACK (modest_ui_actions_on_search_messages) },
- { "ToolsHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) },
-
- /* Attachments */
- { "ViewAttachment", NULL, N_("mcen_me_viewer_view_attachment"), NULL, NULL, G_CALLBACK (modest_ui_actions_view_attachment) },
- { "SaveAttachment", NULL, N_("mcen_me_viewer_save_attachments"), NULL, NULL, G_CALLBACK (modest_ui_actions_save_attachments) },
- { "RemoveAttachment", NULL, N_("mcen_me_inbox_remove_attachments"), NULL, NULL, G_CALLBACK (modest_ui_actions_remove_attachments) },
-
- /* OPTIONS */
- { "OptionsAddToContacts", NULL, N_("A_dd to accounts"), NULL, N_("Add selection to accounts"), G_CALLBACK (modest_ui_actions_on_add_to_contacts) },
- { "OptionsAccounts", NULL, N_("_Accounts"), NULL, N_("Manage accounts"), G_CALLBACK (modest_ui_actions_on_accounts) },
- { "OptionsContacts", NULL, N_("_Contacts"), NULL, N_("Manage contacts"), NULL },
- { "OptionsSettings", NULL, N_("mcen_me_inbox_options"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_settings) },
-
- /* HELP */
- { "HelpAbout", GTK_STOCK_ABOUT, N_("About"), NULL, N_("About Modest"), G_CALLBACK (modest_ui_actions_on_about) },
-
- /* Headers Toolbar */
- { "ToolbarMessageNew", MODEST_STOCK_NEW_MAIL, N_("mcen_me_inbox_new"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_new_msg) },
- { "ToolbarMessageReply", MODEST_STOCK_REPLY, N_("mcen_me_inbox_reply"), "<CTRL>R", NULL, G_CALLBACK (modest_ui_actions_on_reply) },
- { "ToolbarMessageReplyAll", MODEST_STOCK_REPLY_ALL, N_("mcen_me_inbox_replytoall"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_reply_all) },
- { "ToolbarMessageForward", MODEST_STOCK_FORWARD, N_("mcen_me_inbox_forward"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_forward) },
- { "ToolbarSendReceive", GTK_STOCK_REFRESH, N_("mcen_me_inbox_sendandreceive"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_send_receive) },
- { "ToolbarDeleteMessage", MODEST_STOCK_DELETE, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_message_or_folder) },
- { "ToolbarMessageBack", GTK_STOCK_GO_BACK, N_("qgn_toolb_gene_back"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_prev) },
- { "ToolbarMessageNext", GTK_STOCK_GO_FORWARD, N_("qgn_toolb_gene_forward"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_next) },
-
-};
-
-static const GtkToggleActionEntry modest_toggle_action_entries [] = {
- { "ViewToggleFullscreen", GTK_STOCK_FULLSCREEN, N_("mcen_me_inbox_fullscreen"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_fullscreen), FALSE },
-};
-
-
-G_END_DECLS
-#endif /* __MODEST_MAIN_WINDOW_UI_PRIV_H__ */
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <tny-account-store-view.h>
-#include <tny-simple-list.h>
-#include <tny-error.h>
-
-#include <widgets/modest-main-window.h>
-#include <widgets/modest-window-priv.h>
-#include <widgets/modest-msg-edit-window.h>
-#include <widgets/modest-account-view-window.h>
-#include "widgets/modest-progress-bar.h"
-
-#include <modest-runtime.h>
-#include "modest-widget-memory.h"
-#include "modest-ui-actions.h"
-#include "modest-main-window-ui.h"
-#include "modest-main-window-ui-dimming.h"
-#include "modest-account-mgr.h"
-#include "modest-defs.h"
-#include <modest-tny-msg.h>
-#include "modest-mail-operation.h"
-#include "modest-icon-names.h"
-
-/* 'private'/'protected' functions */
-static void modest_main_window_class_init (ModestMainWindowClass *klass);
-static void modest_main_window_init (ModestMainWindow *obj);
-static void modest_main_window_finalize (GObject *obj);
-
-static void restore_settings (ModestMainWindow *self);
-
-static gboolean on_header_view_button_press_event (ModestHeaderView *header_view,
- GdkEventButton *event,
- ModestMainWindow *self);
-
-static gboolean on_folder_view_button_press_event (ModestFolderView *folder_view,
- GdkEventButton *event,
- ModestMainWindow *self);
-
-static gboolean show_context_popup_menu (ModestMainWindow *window,
- GtkTreeView *tree_view,
- GdkEventButton *event,
- GtkWidget *menu);
-
-static void connect_signals (ModestMainWindow *self);
-static void setup_toolbar (ModestMainWindow *window);
-
-static void on_queue_changed (ModestMailOperationQueue *queue,
- ModestMailOperation *mail_op,
- ModestMailOperationQueueNotification type,
- ModestMainWindow *self);
-
-static void on_header_selected (ModestHeaderView *header_view,
- TnyHeader *header,
- ModestMainWindow *main_window);
-
-static void save_state (ModestWindow *window);
-
-/* list my signals */
-enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
- LAST_SIGNAL
-};
-
-typedef struct _ModestMainWindowPrivate ModestMainWindowPrivate;
-struct _ModestMainWindowPrivate {
-
- GtkWidget *folder_paned;
- GtkWidget *msg_paned;
- GtkWidget *main_paned;
- GtkWidget *main_vbox;
- GtkWidget *header_win;
-
- GtkWidget *online_toggle;
- GtkWidget *folder_info_label;
-
- ModestHeaderView *header_view;
- ModestFolderView *folder_view;
- ModestMsgView *msg_preview;
-
- ModestMainWindowStyle style;
-
- GtkWidget *status_bar;
- GtkWidget *progress_bar;
-
- GSList *progress_widgets;
- GtkWidget *main_bar;
-};
-
-
-#define MODEST_MAIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_MAIN_WINDOW, \
- ModestMainWindowPrivate))
-
-/* globals */
-static GtkWindowClass *parent_class = NULL;
-
-static const GtkActionEntry modest_folder_view_action_entries [] = {
-
- /* Folder View CSM actions */
- { "FolderViewCSMNewFolder", NULL, N_("mcen_ti_new_folder"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_new_folder) },
- { "FolderViewCSMRenameFolder", NULL, N_("mcen_me_user_renamefolder"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_rename_folder) },
- { "FolderViewCSMPasteMsgs", NULL, N_("mcen_me_inbox_paste"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_paste)},
- { "FolderViewCSMDeleteFolder", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_folder) },
- { "FolderViewCSMSearchMessages", NULL, N_("mcen_me_inbox_search"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_search_messages) },
- { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_csm_help) },
-};
-
-static const GtkActionEntry modest_header_view_action_entries [] = {
-
- /* Header View CSM actions */
- { "HeaderViewCSMOpen", NULL, N_("mcen_me_inbox_open"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_open) },
- { "HeaderViewCSMReply", NULL, N_("mcen_me_inbox_reply"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_reply) },
- { "HeaderViewCSMReplyAll", NULL, N_("mcen_me_inbox_replytoall"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_reply_all) },
- { "HeaderViewCSMForward", NULL, N_("mcen_me_inbox_forward"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_forward) },
- { "HeaderViewCSMCut", NULL, N_("mcen_me_inbox_cut"), "<CTRL>X", NULL, G_CALLBACK (modest_ui_actions_on_cut) },
- { "HeaderViewCSMCopy", NULL, N_("mcen_me_inbox_copy"), "<CTRL>C", NULL, G_CALLBACK (modest_ui_actions_on_copy) },
- { "HeaderViewCSMPaste", NULL, N_("mcen_me_inbox_paste"), "<CTRL>V", NULL, G_CALLBACK (modest_ui_actions_on_paste) },
- { "HeaderViewCSMDelete", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_message) },
- { "HeaderViewCSMCancelSending", NULL, N_("mcen_me_outbox_cancelsend"), NULL, NULL, G_CALLBACK (modest_ui_actions_cancel_send) },
- { "HeaderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) },
-};
-
-static const GtkToggleActionEntry modest_main_window_toggle_action_entries [] = {
- { "ToggleFolders", MODEST_STOCK_SPLIT_VIEW, N_("mcen_me_inbox_hidefolders"), "<CTRL>t", NULL, G_CALLBACK (modest_ui_actions_toggle_folders_view), TRUE },
-};
-
-
-/* uncomment the following if you have defined any signals */
-/* static guint signals[LAST_SIGNAL] = {0}; */
-
-GType
-modest_main_window_get_type (void)
-{
- static GType my_type = 0;
- if (!my_type) {
- static const GTypeInfo my_info = {
- sizeof(ModestMainWindowClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc) modest_main_window_class_init,
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof(ModestMainWindow),
- 1, /* n_preallocs */
- (GInstanceInitFunc) modest_main_window_init,
- NULL
- };
- my_type = g_type_register_static (MODEST_TYPE_WINDOW,
- "ModestMainWindow",
- &my_info, 0);
- }
- return my_type;
-}
-
-static void
-modest_main_window_class_init (ModestMainWindowClass *klass)
-{
- GObjectClass *gobject_class;
- gobject_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_peek_parent (klass);
- gobject_class->finalize = modest_main_window_finalize;
-
- ((ModestWindowClass *)(klass))->save_state_func = save_state;
-
- g_type_class_add_private (gobject_class, sizeof(ModestMainWindowPrivate));
-}
-
-static GtkWidget *
-create_main_bar (GtkWidget *progress_bar)
-{
- GtkWidget *status_bar, *main_bar;
-
- main_bar = gtk_hbox_new (FALSE, 6);
-
- /* Status bar */
- status_bar = gtk_statusbar_new ();
- gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (status_bar), FALSE);
-
- /* Pack */
- gtk_box_pack_start (GTK_BOX (main_bar), status_bar, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (main_bar), progress_bar, FALSE, FALSE, 0);
-
- return main_bar;
-}
-
-static void
-modest_main_window_init (ModestMainWindow *obj)
-{
- TnyAccountStore *account_store;
- ModestMainWindowPrivate *priv;
- TnyFolderStoreQuery *query;
- GtkWidget *icon;
- gboolean online;
- GtkWidget *progress_bar;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(obj);
-
- priv->folder_paned = NULL;
- priv->msg_paned = NULL;
- priv->main_paned = NULL;
- priv->progress_widgets = NULL;
-
- account_store = TNY_ACCOUNT_STORE (modest_runtime_get_account_store ());
-
- /* online/offline toggle */
- priv->online_toggle = gtk_toggle_button_new ();
- online = tny_device_is_online (modest_runtime_get_device());
- icon = gtk_image_new_from_icon_name (online ? GTK_STOCK_CONNECT : GTK_STOCK_DISCONNECT,
- GTK_ICON_SIZE_BUTTON);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->online_toggle), online);
- gtk_button_set_image (GTK_BUTTON(priv->online_toggle),icon);
-
- priv->style = MODEST_MAIN_WINDOW_STYLE_SPLIT;
-
- /* Paned */
- priv->folder_paned = gtk_vpaned_new ();
- priv->main_paned = gtk_hpaned_new ();
- priv->msg_paned = gtk_vpaned_new ();
-
- /* Main bar */
- priv->folder_info_label = gtk_label_new (NULL);
- progress_bar = modest_progress_bar_new ();
- priv->main_bar = create_main_bar (progress_bar);
- priv->progress_widgets = g_slist_prepend (priv->progress_widgets,
- progress_bar);
-
- /* msg preview */
- priv->msg_preview = MODEST_MSG_VIEW(tny_platform_factory_new_msg_view
- (modest_tny_platform_factory_get_instance ()));
- if (!priv->msg_preview)
- g_printerr ("modest: cannot instantiate msgpreiew\n");
-
- /* header view */
- priv->header_view =
- MODEST_HEADER_VIEW(modest_header_view_new (NULL, MODEST_HEADER_VIEW_STYLE_TWOLINES));
- if (!priv->header_view)
- g_printerr ("modest: cannot instantiate header view\n");
-
- /* folder view */
- query = tny_folder_store_query_new ();
- tny_folder_store_query_add_item (query, NULL,
- TNY_FOLDER_STORE_QUERY_OPTION_SUBSCRIBED);
-
- priv->folder_view = MODEST_FOLDER_VIEW (modest_folder_view_new (query));
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->folder_view), FALSE);
- if (!priv->folder_view)
- g_printerr ("modest: cannot instantiate folder view\n");
- g_object_unref (G_OBJECT (query));
-}
-
-static void
-modest_main_window_finalize (GObject *obj)
-{
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-
-GtkWidget*
-modest_main_window_get_child_widget (ModestMainWindow *self,
- ModestMainWindowWidgetType widget_type)
-{
- ModestMainWindowPrivate *priv;
- GtkWidget *widget;
-
- g_return_val_if_fail (self, NULL);
- g_return_val_if_fail (widget_type >= 0 && widget_type < MODEST_MAIN_WINDOW_WIDGET_TYPE_NUM,
- NULL);
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-
- switch (widget_type) {
- case MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW:
- widget = (GtkWidget*)priv->header_view; break;
- case MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW:
- widget = (GtkWidget*)priv->folder_view; break;
- case MODEST_MAIN_WINDOW_WIDGET_TYPE_MSG_PREVIEW:
- widget = (GtkWidget*)priv->msg_preview; break;
- default:
- g_return_val_if_reached (NULL);
- return NULL;
- }
-
- return widget ? GTK_WIDGET(widget) : NULL;
-}
-
-
-static void
-restore_settings (ModestMainWindow *self)
-{
- ModestConf *conf;
- ModestMainWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
-
- conf = modest_runtime_get_conf ();
-
- modest_widget_memory_restore (conf, G_OBJECT(priv->folder_paned),
- MODEST_CONF_FOLDER_PANED_KEY);
- modest_widget_memory_restore (conf, G_OBJECT(priv->msg_paned),
- MODEST_CONF_MSG_PANED_KEY);
- modest_widget_memory_restore (conf, G_OBJECT(priv->main_paned),
- MODEST_CONF_MAIN_PANED_KEY);
- modest_widget_memory_restore (conf, G_OBJECT(priv->header_view),
- MODEST_CONF_HEADER_VIEW_KEY);
- modest_widget_memory_restore (conf, G_OBJECT(self),
- MODEST_CONF_MAIN_WINDOW_KEY);
-}
-
-void
-on_online_toggle_toggled (GtkToggleButton *toggle, ModestMainWindow *self)
-{
- gboolean online;
- TnyDevice *device;
- ModestMainWindowPrivate *priv;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-
- device = modest_runtime_get_device ();
- online = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->online_toggle));
-
- if (online) {
- /* TODO: Just attempt to go online, instead of forcing the online status: */
- tny_device_force_online (device);
- }
- else
- tny_device_force_offline (device);
-}
-
-static void
-modest_main_window_on_show (GtkWidget *widget, gpointer user_data)
-{
- ModestMainWindow *self = MODEST_MAIN_WINDOW (widget);
-
- /* Connect signals */
- connect_signals (self);
-
- /* Restore window & widget settings */
- restore_settings (self);
-}
-
-static void
-connect_signals (ModestMainWindow *self)
-{
- ModestWindowPrivate *parent_priv;
- ModestMainWindowPrivate *priv;
- ModestTnyAccountStore *account_store;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
-
- account_store = modest_runtime_get_account_store ();
-
- /* folder view */
- g_signal_connect (G_OBJECT(priv->folder_view), "button-press-event",
- G_CALLBACK (on_folder_view_button_press_event),self);
- g_signal_connect (G_OBJECT(priv->folder_view), "folder_selection_changed",
- G_CALLBACK(modest_ui_actions_on_folder_selection_changed), self);
- g_signal_connect (G_OBJECT(priv->folder_view), "folder-display-name-changed",
- G_CALLBACK(modest_ui_actions_on_folder_display_name_changed), self);
-
- /* header view */
- g_signal_connect (G_OBJECT(priv->header_view), "header_selected",
- G_CALLBACK(modest_ui_actions_on_header_selected), self);
- g_signal_connect (G_OBJECT(priv->header_view), "header_selected",
- G_CALLBACK(on_header_selected), self);
- g_signal_connect (G_OBJECT(priv->header_view), "header_activated",
- G_CALLBACK(modest_ui_actions_on_header_activated), self);
- g_signal_connect (G_OBJECT(priv->header_view), "item_not_found",
- G_CALLBACK(modest_ui_actions_on_item_not_found), self);
- g_signal_connect (G_OBJECT(priv->header_view), "button-press-event",
- G_CALLBACK (on_header_view_button_press_event), self);
- g_signal_connect (G_OBJECT(priv->header_view),"popup-menu",
- G_CALLBACK (on_header_view_button_press_event), self);
-
- /* msg preview */
- g_signal_connect (G_OBJECT(priv->msg_preview), "link_clicked",
- G_CALLBACK(modest_ui_actions_on_msg_link_clicked), self);
- g_signal_connect (G_OBJECT(priv->msg_preview), "link_hover",
- G_CALLBACK(modest_ui_actions_on_msg_link_hover), self);
- g_signal_connect (G_OBJECT(priv->msg_preview), "attachment_clicked",
- G_CALLBACK(modest_ui_actions_on_msg_attachment_clicked), self);
- g_signal_connect (G_OBJECT(priv->msg_preview), "recpt-activated",
- G_CALLBACK(modest_ui_actions_on_msg_recpt_activated), self);
-
- /* Device */
- g_signal_connect (G_OBJECT(priv->online_toggle), "toggled",
- G_CALLBACK(on_online_toggle_toggled), self);
-
- /* Mail Operation Queue */
- g_signal_connect (G_OBJECT (modest_runtime_get_mail_operation_queue ()),
- "queue-changed",
- G_CALLBACK (on_queue_changed),
- self);
-}
-
-
-static GtkWidget*
-wrapped_in_scrolled_window (GtkWidget *widget, gboolean needs_viewport)
-{
- GtkWidget *win;
-
- win = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy
- (GTK_SCROLLED_WINDOW (win),GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (win),
- GTK_SHADOW_IN);
-
- if (needs_viewport)
- gtk_scrolled_window_add_with_viewport
- (GTK_SCROLLED_WINDOW(win), widget);
- else
- gtk_container_add (GTK_CONTAINER(win),
- widget);
-
- return win;
-}
-
-static void
-setup_toolbar (ModestMainWindow *self)
-{
- ModestMainWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- GtkWidget *item;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
-
- item = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/ToolbarMessageNew");
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
- item = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/ToolbarMessageReply");
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
- item = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/ToolbarSendReceive");
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
-
-}
-
-
-ModestWindow *
-modest_main_window_new (void)
-{
- GObject *obj;
- ModestMainWindow *self;
- ModestMainWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- GtkWidget *status_hbox;
- GtkWidget *folder_win;
- GtkWidget *preview_scroll;
- GtkActionGroup *action_group;
- GError *error = NULL;
- ModestDimmingRulesGroup *menu_rules_group = NULL;
- ModestDimmingRulesGroup *toolbar_rules_group = NULL;
-
- obj = g_object_new(MODEST_TYPE_MAIN_WINDOW, NULL);
- self = MODEST_MAIN_WINDOW(obj);
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
-
-
- parent_priv->ui_manager = gtk_ui_manager_new();
- parent_priv->ui_dimming_manager = modest_ui_dimming_manager_new ();
- action_group = gtk_action_group_new ("ModestMainWindowActions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
-
- menu_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_MENU, FALSE);
- toolbar_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_TOOLBAR, TRUE);
-
- /* Add common actions */
- gtk_action_group_add_actions (action_group,
- modest_action_entries,
- G_N_ELEMENTS (modest_action_entries),
- obj);
-
- gtk_action_group_add_actions (action_group,
- modest_header_view_action_entries,
- G_N_ELEMENTS (modest_header_view_action_entries),
- self);
-
- gtk_action_group_add_actions (action_group,
- modest_folder_view_action_entries,
- G_N_ELEMENTS (modest_folder_view_action_entries),
- self);
-
- gtk_action_group_add_toggle_actions (action_group,
- modest_toggle_action_entries,
- G_N_ELEMENTS (modest_toggle_action_entries),
- self);
- gtk_action_group_add_toggle_actions (action_group,
- modest_main_window_toggle_action_entries,
- G_N_ELEMENTS (modest_toggle_action_entries),
- self);
-
- gtk_ui_manager_insert_action_group (parent_priv->ui_manager, action_group, 0);
- g_object_unref (action_group);
-
- /* Load the UI definition */
- gtk_ui_manager_add_ui_from_file (parent_priv->ui_manager,
- MODEST_UIDIR "modest-main-window-ui.xml", &error);
- if (error != NULL) {
- g_printerr ("modest: could not merge modest-main-window-ui.xml: %s", error->message);
- g_error_free (error);
- error = NULL;
- }
-
- /* Add common dimming rules */
- modest_dimming_rules_group_add_rules (menu_rules_group,
- modest_main_window_menu_dimming_entries,
- G_N_ELEMENTS (modest_main_window_menu_dimming_entries),
- MODEST_WINDOW (self));
- modest_dimming_rules_group_add_rules (toolbar_rules_group,
- modest_main_window_toolbar_dimming_entries,
- G_N_ELEMENTS (modest_main_window_toolbar_dimming_entries),
- MODEST_WINDOW (self));
-
- /* Insert dimming rules group for this window */
- modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, menu_rules_group);
- modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, toolbar_rules_group);
- g_object_unref (menu_rules_group);
- g_object_unref (toolbar_rules_group);
-
- /* Add accelerators */
- gtk_window_add_accel_group (GTK_WINDOW (obj),
- gtk_ui_manager_get_accel_group (parent_priv->ui_manager));
-
- /* Toolbar / Menubar */
- parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar");
- parent_priv->menubar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/MenuBar");
-
- setup_toolbar (MODEST_MAIN_WINDOW (obj));
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (parent_priv->toolbar), TRUE);
- folder_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->folder_view), FALSE);
- priv->header_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->header_view), FALSE);
-
- /* Paned */
- preview_scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (preview_scroll),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_paned_add1 (GTK_PANED(priv->main_paned), folder_win);
- gtk_paned_add2 (GTK_PANED(priv->main_paned), priv->msg_paned);
- gtk_paned_add1 (GTK_PANED(priv->msg_paned), priv->header_win);
- gtk_container_add (GTK_CONTAINER (preview_scroll),
- GTK_WIDGET(priv->msg_preview));
- gtk_paned_add2 (GTK_PANED(priv->msg_paned), preview_scroll);
-
- /* Main Bar */
- status_hbox = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX(status_hbox), priv->folder_info_label, FALSE,FALSE, 6);
- gtk_box_pack_start (GTK_BOX(status_hbox), priv->main_bar, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX(status_hbox), priv->online_toggle,FALSE, FALSE, 0);
-
- /* putting it all together... */
- priv->main_vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX(priv->main_vbox), parent_priv->menubar, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(priv->main_vbox), parent_priv->toolbar, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(priv->main_vbox), priv->main_paned, TRUE, TRUE,0);
- gtk_box_pack_start (GTK_BOX(priv->main_vbox), status_hbox, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER(obj), priv->main_vbox);
-
- gtk_window_set_title (GTK_WINDOW(obj), _("Modest"));
- gtk_window_set_icon_from_file (GTK_WINDOW(obj), MODEST_APP_ICON, NULL);
- gtk_widget_show_all (priv->main_vbox);
-
- /* Do some tasks on show */
- g_signal_connect (G_OBJECT(self), "show", G_CALLBACK (modest_main_window_on_show), NULL);
-
- /* Set account store */
- tny_account_store_view_set_account_store (TNY_ACCOUNT_STORE_VIEW (priv->folder_view),
- TNY_ACCOUNT_STORE (modest_runtime_get_account_store ()));
-
- gtk_window_set_default_size (GTK_WINDOW (obj), 800, 600);
-
- return (ModestWindow *) obj;
-}
-
-static gboolean
-on_header_view_button_press_event (ModestHeaderView *header_view,
- GdkEventButton *event,
- ModestMainWindow *self)
-{
- if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
- GtkWidget *menu;
- ModestWindowPrivate *parent_priv;
-
- parent_priv = MODEST_WINDOW_GET_PRIVATE (self);
- menu = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/HeaderViewCSM");
-
- return show_context_popup_menu (self,
- GTK_TREE_VIEW (header_view),
- event,
- menu);
- }
-
- return FALSE;
-}
-
-static gboolean
-on_folder_view_button_press_event (ModestFolderView *folder_view,
- GdkEventButton *event,
- ModestMainWindow *self)
-{
- if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
- GtkWidget *menu;
- ModestWindowPrivate *parent_priv;
-
- parent_priv = MODEST_WINDOW_GET_PRIVATE (self);
- menu = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/FolderViewCSM");
-
- return show_context_popup_menu (self,
- GTK_TREE_VIEW (folder_view),
- event,
- menu);
- }
-
- return FALSE;
-}
-
-static gboolean
-show_context_popup_menu (ModestMainWindow *window,
- GtkTreeView *tree_view,
- GdkEventButton *event,
- GtkWidget *menu)
-{
- g_return_val_if_fail (menu, FALSE);
-
- if (event != NULL) {
- /* Ensure that the header is selected */
- GtkTreeSelection *selection;
-
- selection = gtk_tree_view_get_selection (tree_view);
-
- if (gtk_tree_selection_count_selected_rows (selection) <= 1) {
- GtkTreePath *path;
-
- /* Get tree path for row that was clicked */
- if (gtk_tree_view_get_path_at_pos (tree_view,
- (gint) event->x,
- (gint) event->y,
- &path,
- NULL, NULL, NULL)) {
- gtk_tree_selection_unselect_all (selection);
- gtk_tree_selection_select_path (selection, path);
- gtk_tree_path_free (path);
- }
- }
-
- /* Show popup */
- if (gtk_tree_selection_count_selected_rows(selection) == 1)
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
- NULL, NULL,
- event->button, event->time);
- }
- return TRUE;
-}
-
-static void
-on_queue_changed (ModestMailOperationQueue *queue,
- ModestMailOperation *mail_op,
- ModestMailOperationQueueNotification type,
- ModestMainWindow *self)
-{
- GSList *tmp;
- ModestMainWindowPrivate *priv;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-
- tmp = priv->progress_widgets;
-
- switch (type) {
- case MODEST_MAIL_OPERATION_QUEUE_OPERATION_ADDED:
- while (tmp) {
- modest_progress_object_add_operation (MODEST_PROGRESS_OBJECT (tmp->data),
- mail_op);
- tmp = g_slist_next (tmp);
- }
- break;
- case MODEST_MAIL_OPERATION_QUEUE_OPERATION_REMOVED:
- while (tmp) {
- modest_progress_object_remove_operation (MODEST_PROGRESS_OBJECT (tmp->data),
- mail_op);
- tmp = g_slist_next (tmp);
- }
- break;
- }
-}
-
-void
-modest_main_window_set_style (ModestMainWindow *self,
- ModestMainWindowStyle style)
-{
- ModestMainWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- GtkAction *action;
- gboolean active;
-
- g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
-
- /* no change -> nothing to do */
- if (priv->style == style)
- return;
-
- /* Get toggle button and update the state if needed. This will
- happen only when the set_style is not invoked from the UI,
- for example when it's called from widget memory */
- action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ToggleFolders");
- active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- if ((active && style == MODEST_MAIN_WINDOW_STYLE_SIMPLE) ||
- (!active && style == MODEST_MAIN_WINDOW_STYLE_SPLIT)) {
- g_signal_handlers_block_by_func (action, modest_ui_actions_toggle_folders_view, self);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !active);
- g_signal_handlers_unblock_by_func (action, modest_ui_actions_toggle_folders_view, self);
- }
-
- priv->style = style;
- switch (style) {
- case MODEST_MAIN_WINDOW_STYLE_SIMPLE:
- /* Remove main paned */
- g_object_ref (priv->main_paned);
- gtk_container_remove (GTK_CONTAINER (priv->main_vbox), priv->main_paned);
-
- /* Reparent the contents widget to the main vbox */
- gtk_widget_reparent (priv->header_win, priv->main_vbox);
-
- break;
- case MODEST_MAIN_WINDOW_STYLE_SPLIT:
- /* Remove header view */
- g_object_ref (priv->header_win);
- gtk_container_remove (GTK_CONTAINER (priv->main_vbox), priv->header_win);
-
- /* Reparent the main paned */
- gtk_paned_add2 (GTK_PANED (priv->main_paned), priv->header_win);
- gtk_container_add (GTK_CONTAINER (priv->main_vbox), priv->main_paned);
-
- break;
- default:
- g_return_if_reached ();
- }
-
-/* /\* Let header view grab the focus if it's being shown *\/ */
-/* if (priv->contents_style == MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS) */
-/* gtk_widget_grab_focus (GTK_WIDGET (priv->header_view)); */
-/* else */
-/* gtk_widget_grab_focus (GTK_WIDGET (priv->contents_widget)); */
-
- /* Show changes */
- gtk_widget_show_all (GTK_WIDGET (priv->main_vbox));
-}
-
-
-ModestMainWindowStyle
-modest_main_window_get_style (ModestMainWindow *self)
-{
- /* TODO */
- return MODEST_MAIN_WINDOW_STYLE_SPLIT;
-}
-
-void
-modest_main_window_set_contents_style (ModestMainWindow *self,
- ModestMainWindowContentsStyle style)
-{
- /* TODO */
-}
-
-ModestMainWindowContentsStyle
-modest_main_window_get_contents_style (ModestMainWindow *self)
-{
- /* TODO */
- return MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS;
-}
-
-
-static void
-get_msg_callback (TnyFolder *folder,
- gboolean cancelled,
- TnyMsg *msg,
- GError **err,
- gpointer user_data)
-{
- if (!err ||!(*err)) {
- ModestMsgView *msg_preview;
-
- msg_preview = MODEST_MSG_VIEW (user_data);
- tny_msg_view_set_msg (TNY_MSG_VIEW (msg_preview), msg);
- }
-
- /* Frees */
- g_object_unref (folder);
-}
-
-static void
-on_header_selected (ModestHeaderView *header_view,
- TnyHeader *header,
- ModestMainWindow *main_window)
-{
- TnyFolder *folder;
- ModestMainWindowPrivate *priv;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE (main_window);
-
- if (!header)
- return;
-
- folder = tny_header_get_folder (header);
-
- /* FIXME: do not use this directly. Use a mail operation
- instead in order to get progress info */
- tny_folder_get_msg_async (folder,
- header,
- (TnyGetMsgCallback) get_msg_callback,
- NULL,
- priv->msg_preview);
-}
-
-void
-modest_main_window_notify_send_receive_initied (ModestMainWindow *self)
-{
- g_warning("NOT IMPLEMENTED %s", __FUNCTION__);
-}
-void
-modest_main_window_notify_send_receive_completed (ModestMainWindow *self)
-{
- g_warning("NOT IMPLEMENTED %s", __FUNCTION__);
-}
-
-gboolean
-modest_main_window_transfer_mode_enabled (ModestMainWindow *self)
-{
- g_warning("NOT IMPLEMENTED %s", __FUNCTION__);
- return FALSE;
-}
-
-gboolean
-modest_main_window_on_msg_view_window_msg_changed (ModestMsgViewWindow *view_window,
- GtkTreeModel *model,
- GtkTreeRowReference *row_reference,
- ModestMainWindow *self)
-{
- g_warning("NOT IMPLEMENTED %s", __FUNCTION__);
- return FALSE;
-}
-
-gboolean
-modest_main_window_screen_is_on (ModestMainWindow *self)
-{
- g_warning("NOT IMPLEMENTED %s", __FUNCTION__);
- return TRUE;
-}
-
-static void
-save_state (ModestWindow *window)
-{
- ModestConf *conf;
- ModestMainWindow* self = MODEST_MAIN_WINDOW(window);
- ModestMainWindowPrivate *priv;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
- conf = modest_runtime_get_conf ();
-
- modest_widget_memory_save (conf, G_OBJECT(self),
- MODEST_CONF_MAIN_WINDOW_KEY);
- modest_widget_memory_save (conf, G_OBJECT(priv->main_paned),
- MODEST_CONF_MAIN_PANED_KEY);
- modest_widget_memory_save (conf, G_OBJECT(priv->msg_paned),
- MODEST_CONF_MSG_PANED_KEY);
- modest_widget_memory_save (conf, G_OBJECT(priv->folder_view),
- MODEST_CONF_FOLDER_VIEW_KEY);
-}
+++ /dev/null
-#ifndef __MODEST_MSG_EDIT_WINDOW_UI_DIMMING_PRIV_H__
-#define __MODEST_MSG_EDIT_WINDOW_UI_DIMMING_PRIV_H__
-
-#include "modest-dimming-rules-group.h"
-#include "modest-ui-dimming-rules.h"
-
-G_BEGIN_DECLS
-
-
-/* Menu Dimming rules entries */
-static const ModestDimmingEntry modest_msg_edit_window_menu_dimming_entries [] = {
-
- /* Format Menu */
- { "/MenuBar/FormatMenu/SelectFontMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) },
- { "/MenuBar/FormatMenu/AlignmentMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) },
- { "/MenuBar/FormatMenu/AlignmentLeftMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) },
- { "/MenuBar/FormatMenu/AlignmentRightMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) },
- { "/MenuBar/FormatMenu/AlignmentCenterMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) },
- { "/MenuBar/FormatMenu/InsertImageMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) },
- { "/MenuBar/EditMenu/SelectAllMenu", G_CALLBACK (modest_ui_dimming_rules_on_select_all) },
- { "/MenuBar/EditMenu/UndoMenu", G_CALLBACK (modest_ui_dimming_rules_on_undo) },
- { "/MenuBar/EditMenu/RedoMenu", G_CALLBACK (modest_ui_dimming_rules_on_redo) },
- { "/MenuBar/EditMenu/PasteMenu", G_CALLBACK (modest_ui_dimming_rules_on_editor_paste) },
- { "/MenuBar/AttachmentsMenu/RemoveAttachmentsMenu", G_CALLBACK (modest_ui_dimming_rules_on_editor_remove_attachment) },
- { "/MenuBar/AttachmentsMenu/InsertImageMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) },
- { "/MenuBar/EmailMenu/SendMenu", G_CALLBACK (modest_ui_dimming_rules_on_send) },
- { "/MenuBar/EmailMenu/SaveToDraftsMenu", G_CALLBACK (modest_ui_dimming_rules_on_save_to_drafts) },
-
-};
-
-/* Menu Dimming rules entries */
-static const ModestDimmingEntry modest_msg_edit_window_toolbar_dimming_entries [] = {
-
- /* Toolbar */
- { "/ToolBar/ToolbarSend", G_CALLBACK(modest_ui_dimming_rules_on_send) },
- { "/ToolBar/ActionsBold", G_CALLBACK(modest_ui_dimming_rules_on_set_style) },
- { "/ToolBar/ActionsItalics", G_CALLBACK(modest_ui_dimming_rules_on_set_style) },
-};
-
-/* Clipboard Dimming rules entries */
-static const ModestDimmingEntry modest_msg_edit_window_clipboard_dimming_entries [] = {
-
- /* Toolbar */
- { "/MenuBar/EditMenu/CutMenu", G_CALLBACK(modest_ui_dimming_rules_on_cut) },
- { "/MenuBar/EditMenu/CopyMenu", G_CALLBACK(modest_ui_dimming_rules_on_copy) },
- { "/MenuBar/EditMenu/PasteMenu", G_CALLBACK(modest_ui_dimming_rules_on_editor_paste) },
-};
-
-G_END_DECLS
-#endif /* __MODEST_MSG_VIEW_WINDOW_UI_PRIV_H__ */
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <glib/gi18n.h>
-#include <string.h>
-#include <tny-account-store.h>
-#include <tny-simple-list.h>
-#include <modest-conf.h>
-#include <modest-runtime.h>
-#include <modest-tny-msg.h>
-
-#include <widgets/modest-window-priv.h>
-#include <widgets/modest-msg-edit-window.h>
-#include <widgets/modest-msg-edit-window-ui.h>
-#include <widgets/modest-combo-box.h>
-#include <widgets/modest-attachments-view.h>
-
-#include <modest-widget-memory.h>
-#include <modest-account-mgr-helpers.h>
-#include <modest-tny-folder.h>
-#include <gtkhtml/gtkhtml.h>
-#include "modest-msg-edit-window-ui-dimming.h"
-#include <modest-platform.h>
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <tny-vfs-stream.h>
-#include <tny-gtk-text-buffer-stream.h>
-#include <gtksourceview/gtksourceview.h>
-#include <modest-utils.h>
-#include <widgets/modest-recpt-editor.h>
-#include <modest-tny-account.h>
-
-static void modest_msg_edit_window_class_init (ModestMsgEditWindowClass *klass);
-static void modest_msg_edit_window_init (ModestMsgEditWindow *obj);
-static void modest_msg_edit_window_finalize (GObject *obj);
-
-static void update_next_cid (ModestMsgEditWindow *self, TnyList *attachments);
-
-/* list my signals */
-enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
- LAST_SIGNAL
-};
-
-typedef struct _ModestMsgEditWindowPrivate ModestMsgEditWindowPrivate;
-struct _ModestMsgEditWindowPrivate {
-
- GtkWidget *menubar;
-
- GtkWidget *msg_body;
- GtkTextBuffer *text_buffer;
-
- ModestPairList *from_field_protos;
- GtkWidget *from_field;
-
- GtkWidget *to_field;
- GtkWidget *cc_field;
- GtkWidget *bcc_field;
- GtkWidget *subject_field;
-
- GtkWidget *attachments_view;
- TnyList *attachments;
- guint next_cid;
-
- TnyMsg *draft_msg;
- TnyMsg *outbox_msg;
- gchar *msg_uid;
-
- gchar *references;
- gchar *in_reply_to;
-
- gboolean sent;
- gboolean can_undo, can_redo;
- gchar *original_account_name;
- GtkWidget *priority_icon;
- TnyHeaderFlags priority_flags;
- gulong account_removed_handler_id;
-};
-
-#define MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_MSG_EDIT_WINDOW, \
- ModestMsgEditWindowPrivate))
-/* globals */
-static GtkWindowClass *parent_class = NULL;
-
-/* uncomment the following if you have defined any signals */
-/* static guint signals[LAST_SIGNAL] = {0}; */
-
-GType
-modest_msg_edit_window_get_type (void)
-{
- static GType my_type = 0;
- if (!my_type) {
- static const GTypeInfo my_info = {
- sizeof(ModestMsgEditWindowClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc) modest_msg_edit_window_class_init,
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof(ModestMsgEditWindow),
- 1, /* n_preallocs */
- (GInstanceInitFunc) modest_msg_edit_window_init,
- NULL
- };
- my_type = g_type_register_static (MODEST_TYPE_WINDOW,
- "ModestMsgEditWindow",
- &my_info, 0);
- }
- return my_type;
-}
-
-
-static void
-save_state (ModestWindow *self)
-{
- modest_widget_memory_save (modest_runtime_get_conf (),
- G_OBJECT(self), MODEST_CONF_EDIT_WINDOW_KEY);
-}
-
-
-static void
-restore_settings (ModestMsgEditWindow *self)
-{
- ModestConf *conf = NULL;
- GtkAction *action;
- ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (self);
-
- conf = modest_runtime_get_conf ();
-
- /* Dim at start clipboard actions */
- action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/CutMenu");
- gtk_action_set_sensitive (action, FALSE);
- action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/CopyMenu");
- gtk_action_set_sensitive (action, FALSE);
- action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/AttachmentsMenu/RemoveAttachmentsMenu");
- gtk_action_set_sensitive (action, FALSE);
-
- modest_widget_memory_restore (conf,
- G_OBJECT(self), MODEST_CONF_EDIT_WINDOW_KEY);
-}
-
-static void
-modest_msg_edit_window_class_init (ModestMsgEditWindowClass *klass)
-{
- GObjectClass *gobject_class;
- ModestWindowClass *modest_window_class;
-
- gobject_class = (GObjectClass*) klass;
- modest_window_class = (ModestWindowClass*) klass;
-
- parent_class = g_type_class_peek_parent (klass);
- gobject_class->finalize = modest_msg_edit_window_finalize;
-
- g_type_class_add_private (gobject_class, sizeof(ModestMsgEditWindowPrivate));
-
- modest_window_class->save_state_func = save_state;
-}
-
-static void
-modest_msg_edit_window_init (ModestMsgEditWindow *obj)
-{
- ModestMsgEditWindowPrivate *priv;
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj);
-
- priv->menubar = NULL;
- priv->msg_body = NULL;
- priv->from_field = NULL;
- priv->to_field = NULL;
- priv->cc_field = NULL;
- priv->bcc_field = NULL;
- priv->subject_field = NULL;
- priv->attachments_view = NULL;
- priv->attachments = TNY_LIST (tny_simple_list_new ());
- priv->sent = FALSE;
- priv->next_cid = 0;
- priv->draft_msg = NULL;
- priv->outbox_msg = NULL;
- priv->msg_uid = NULL;
- priv->references = NULL;
- priv->in_reply_to = NULL;
- priv->can_undo = FALSE;
- priv->can_redo = FALSE;
- priv->priority_flags = 0;
- priv->account_removed_handler_id = 0;
-}
-
-/**
- * @result: A ModestPairList, which must be freed with modest_pair_list_free().
- */
-static ModestPairList*
-get_transports (void)
-{
- ModestAccountMgr *account_mgr;
- GSList *transports = NULL;
- GSList *cursor, *accounts;
-
- account_mgr = modest_runtime_get_account_mgr();
- cursor = accounts = modest_account_mgr_account_names (account_mgr, TRUE);
- while (cursor) {
- gchar *account_name = cursor->data ? g_strdup((gchar*)cursor->data) : NULL;
- gchar *from_string = modest_account_mgr_get_from_string (account_mgr,
- account_name, NULL);
- if (!from_string) {
- /* something went wrong: ignore this one */
- g_free (account_name);
- cursor->data = NULL;
- } else {
- ModestPair *pair;
- pair = modest_pair_new ((gpointer) account_name,
- (gpointer) from_string , TRUE);
- transports = g_slist_prepend (transports, pair);
- } /* don't free account name; it's freed when the transports list is freed */
- cursor = cursor->next;
- }
- g_slist_free (accounts);
- return transports;
-}
-
-
-static void
-on_from_combo_changed (ModestComboBox *combo, ModestWindow *win)
-{
- modest_window_set_active_account (
- win, modest_combo_box_get_active_id(combo));
-}
-
-static void
-attachment_deleted (ModestAttachmentsView *attachments_view,
- gpointer user_data)
-{
- modest_msg_edit_window_remove_attachments (MODEST_MSG_EDIT_WINDOW (user_data),
- NULL);
-}
-
-static void
-text_buffer_can_undo (GtkTextBuffer *buffer, GParamSpec *param_spec, ModestMsgEditWindow *window)
-{
- ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- g_object_get (G_OBJECT (buffer), "can-undo", &(priv->can_undo), NULL);
-}
-
-static void
-text_buffer_can_redo (GtkTextBuffer *buffer, GParamSpec *param_spec, ModestMsgEditWindow *window)
-{
- ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- g_object_get (G_OBJECT (buffer), "can-redo", &(priv->can_redo), NULL);
-}
-
-gboolean
-modest_msg_edit_window_can_undo (ModestMsgEditWindow *window)
-{
- ModestMsgEditWindowPrivate *priv;
- g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), FALSE);
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- return priv->can_undo;
-}
-
-gboolean
-modest_msg_edit_window_can_redo (ModestMsgEditWindow *window)
-{
- ModestMsgEditWindowPrivate *priv;
- g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), FALSE);
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- return priv->can_redo;
-}
-
-static void
-body_changed (GtkTextBuffer *buffer, ModestMsgEditWindow *editor)
-{
- modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (editor));
- modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (editor));
-}
-
-static void
-recpt_field_changed (GtkTextBuffer *buffer,
- ModestMsgEditWindow *editor)
-{
- modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (editor));
- modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (editor));
-}
-
-static void
-connect_signals (ModestMsgEditWindow *obj)
-{
- ModestMsgEditWindowPrivate *priv;
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj);
-
- g_signal_connect (G_OBJECT (priv->text_buffer), "notify::can-undo",
- G_CALLBACK (text_buffer_can_undo), obj);
- g_signal_connect (G_OBJECT (priv->text_buffer), "notify::can-redo",
- G_CALLBACK (text_buffer_can_redo), obj);
- g_signal_connect (G_OBJECT (priv->text_buffer), "changed",
- G_CALLBACK (body_changed), obj);
- g_signal_connect (G_OBJECT (priv->text_buffer), "modified-changed",
- G_CALLBACK (body_changed), obj);
-
- g_signal_connect (G_OBJECT (modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR (priv->to_field))),
- "changed", G_CALLBACK (recpt_field_changed), obj);
- g_signal_connect (G_OBJECT (modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR (priv->cc_field))),
- "changed", G_CALLBACK (recpt_field_changed), obj);
- g_signal_connect (G_OBJECT (modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR (priv->bcc_field))),
- "changed", G_CALLBACK (recpt_field_changed), obj);
-
- g_signal_connect (G_OBJECT (priv->attachments_view), "delete", G_CALLBACK (attachment_deleted), obj);
-}
-
-
-
-static void
-init_window (ModestMsgEditWindow *obj, const gchar* account)
-{
- GtkWidget *to_button, *cc_button, *bcc_button;
- GtkWidget *subject_box;
- GtkWidget *header_table;
- GtkWidget *main_vbox;
- GtkWidget *msg_vbox;
- GtkWidget *scrolled_window;
- ModestMsgEditWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
-
- to_button = gtk_button_new_with_label (_("To..."));
- cc_button = gtk_button_new_with_label (_("Cc..."));
- bcc_button = gtk_button_new_with_label (_("Bcc..."));
-
- /* Note: This ModestPairList* must exist for as long as the combo
- * that uses it, because the ModestComboBox uses the ID opaquely,
- * so it can't know how to manage its memory. */
- priv->from_field_protos = get_transports ();
- priv->from_field = modest_combo_box_new (priv->from_field_protos, g_str_equal);
-
- if (account) {
- modest_combo_box_set_active_id (MODEST_COMBO_BOX(priv->from_field),
- (gpointer)account);
- modest_window_set_active_account (MODEST_WINDOW(obj), account);
- }
- /* auto-update the active account */
- g_signal_connect (G_OBJECT(priv->from_field), "changed", G_CALLBACK(on_from_combo_changed), obj);
-
- priv->to_field = modest_recpt_editor_new ();
- modest_recpt_editor_set_show_abook_button (MODEST_RECPT_EDITOR (priv->to_field), FALSE);
- priv->cc_field = modest_recpt_editor_new ();
- modest_recpt_editor_set_show_abook_button (MODEST_RECPT_EDITOR (priv->cc_field), FALSE);
- priv->bcc_field = modest_recpt_editor_new ();
- modest_recpt_editor_set_show_abook_button (MODEST_RECPT_EDITOR (priv->bcc_field), FALSE);
-
- subject_box = gtk_hbox_new (FALSE, 0);
- priv->priority_icon = gtk_image_new ();
- gtk_box_pack_start (GTK_BOX (subject_box), priv->priority_icon, FALSE, FALSE, 0);
- priv->subject_field = gtk_entry_new_with_max_length (80);
- gtk_box_pack_start (GTK_BOX (subject_box), priv->subject_field, TRUE, TRUE, 0);
- g_object_set (G_OBJECT (priv->subject_field), "truncate-multiline", TRUE, NULL);
- priv->attachments_view = modest_attachments_view_new (NULL);
-
- header_table = gtk_table_new (6,2, FALSE);
-
- gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("From:")),
- 0,1,0,1, GTK_FILL, 0, 0, 0);
- gtk_table_attach (GTK_TABLE(header_table), to_button, 0,1,1,2, GTK_FILL, 0, 0, 0);
- gtk_table_attach (GTK_TABLE(header_table), cc_button, 0,1,2,3, GTK_FILL, 0, 0, 0);
- gtk_table_attach (GTK_TABLE(header_table), bcc_button, 0,1,3,4, GTK_FILL, 0, 0, 0);
- gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("Subject:")),
- 0,1,4,5, GTK_FILL, 0, 0, 0);
-
- gtk_table_attach_defaults (GTK_TABLE(header_table), priv->from_field, 1,2,0,1);
- gtk_table_attach_defaults (GTK_TABLE(header_table), priv->to_field, 1,2,1,2);
- gtk_table_attach_defaults (GTK_TABLE(header_table), priv->cc_field, 1,2,2,3);
- gtk_table_attach_defaults (GTK_TABLE(header_table), priv->bcc_field, 1,2,3,4);
- gtk_table_attach_defaults (GTK_TABLE(header_table), subject_box,1,2,4,5);
- gtk_table_attach_defaults (GTK_TABLE(header_table), priv->attachments_view,1,2,5,6);
-
- priv->msg_body = gtk_source_view_new ();
- priv->text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
- gtk_source_view_set_highlight_current_line (GTK_SOURCE_VIEW (priv->msg_body), TRUE);
- gtk_source_view_set_right_margin_position (GTK_SOURCE_VIEW (priv->msg_body), 78);
- gtk_source_view_set_show_right_margin (GTK_SOURCE_VIEW (priv->msg_body), TRUE);
- gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->msg_body), TRUE);
- gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->msg_body), GTK_WRAP_WORD_CHAR);
-
- PangoFontDescription *font_desc;
- font_desc = pango_font_description_from_string ("Monospace");
- gtk_widget_modify_font (priv->msg_body, font_desc);
- pango_font_description_free (font_desc);
-
- main_vbox = gtk_vbox_new (FALSE, 0);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
-
- gtk_box_pack_start (GTK_BOX(main_vbox), priv->menubar, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(main_vbox), parent_priv->toolbar, FALSE, FALSE, 0);
-
- msg_vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (main_vbox), msg_vbox, TRUE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX(msg_vbox), header_table, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (scrolled_window), priv->msg_body);
-
- gtk_box_pack_start (GTK_BOX(msg_vbox), scrolled_window, TRUE, TRUE, 0);
-
- gtk_widget_show_all (GTK_WIDGET(main_vbox));
- gtk_container_add (GTK_CONTAINER(obj), main_vbox);
-
-}
-
-
-static void
-modest_msg_edit_window_disconnect_signals (ModestWindow *window)
-{
- ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- if (priv->account_removed_handler_id &&
- g_signal_handler_is_connected (modest_runtime_get_account_store (),
- priv->account_removed_handler_id))
- g_signal_handler_disconnect(modest_runtime_get_account_store (),
- priv->account_removed_handler_id);
-}
-
-static void
-modest_msg_edit_window_finalize (GObject *obj)
-{
- ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj);
-
- modest_msg_edit_window_disconnect_signals (MODEST_WINDOW (obj));
-
- /* These had to stay alive for as long as the comboboxes that used them: */
- modest_pair_list_free (priv->from_field_protos);
- g_object_unref (priv->attachments);
- priv->attachments = NULL;
-
- if (priv->draft_msg != NULL) {
- TnyHeader *header = tny_msg_get_header (priv->draft_msg);
- if (TNY_IS_HEADER (header)) {
- ModestWindowMgr *mgr = modest_runtime_get_window_mgr ();
- modest_window_mgr_unregister_header (mgr, header);
- }
- g_object_unref (priv->draft_msg);
- priv->draft_msg = NULL;
- }
- if (priv->outbox_msg != NULL) {
- TnyHeader *header = tny_msg_get_header (priv->outbox_msg);
- if (TNY_IS_HEADER (header)) {
- ModestWindowMgr *mgr = modest_runtime_get_window_mgr ();
- modest_window_mgr_unregister_header (mgr, header);
- }
- g_object_unref (priv->outbox_msg);
- priv->outbox_msg = NULL;
- }
- if (priv->original_account_name)
- g_free (priv->original_account_name);
- g_free (priv->msg_uid);
- g_free (priv->references);
- g_free (priv->in_reply_to);
-
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-static void
-update_next_cid (ModestMsgEditWindow *self, TnyList *attachments)
-{
- TnyIterator *iter;
- ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
-
- for (iter = tny_list_create_iterator (attachments) ;
- !tny_iterator_is_done (iter);
- tny_iterator_next (iter)) {
- TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (iter);
- const gchar *cid = tny_mime_part_get_content_id (part);
- if (cid != NULL) {
- char *invalid = NULL;
- gint int_cid = strtol (cid, &invalid, 10);
- if ((invalid != NULL) && (*invalid == '\0') && (int_cid >= priv->next_cid)) {
- priv->next_cid = int_cid + 1;
- }
- }
- g_object_unref (part);
- }
- g_object_unref (iter);
-}
-
-
-
-static gboolean
-on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgEditWindow *self)
-{
- modest_window_save_state (MODEST_WINDOW(self));
- return FALSE;
-}
-
-
-static void
-set_msg (ModestMsgEditWindow *self, TnyMsg *msg)
-{
- TnyHeader *header;
- TnyFolder *msg_folder;
- gchar *to, *cc, *bcc, *subject;
- ModestMsgEditWindowPrivate *priv;
- TnyMimePart *body_part;
- GtkTextBuffer *buffer;
- TnyHeaderFlags priority_flags;
-
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (self));
- g_return_if_fail (TNY_IS_MSG (msg));
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
-
- header = tny_msg_get_header (msg);
- to = tny_header_dup_to (header);
- cc = tny_header_dup_cc (header);
- bcc = tny_header_dup_bcc (header);
- subject = tny_header_dup_subject (header);
- priority_flags = tny_header_get_priority (header);
-
- if (to)
- modest_recpt_editor_set_recipients (MODEST_RECPT_EDITOR (priv->to_field), to);
- if (cc)
- modest_recpt_editor_set_recipients (MODEST_RECPT_EDITOR (priv->cc_field), cc);
- if (bcc)
- modest_recpt_editor_set_recipients (MODEST_RECPT_EDITOR (priv->bcc_field), bcc);
- if (subject)
- gtk_entry_set_text (GTK_ENTRY(priv->subject_field), subject);
-
- modest_msg_edit_window_set_priority_flags (MODEST_MSG_EDIT_WINDOW(self),
- priority_flags);
- modest_tny_msg_get_references (TNY_MSG (msg), NULL, &(priv->references), &(priv->in_reply_to));
-
- modest_attachments_view_set_message (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), msg);
- priv->attachments = modest_attachments_view_get_attachments (MODEST_ATTACHMENTS_VIEW (priv->attachments_view));
- update_next_cid (self, priv->attachments);
-
- body_part = modest_tny_msg_find_body_part (msg, FALSE);
- if (body_part) {
- TnyStream *stream;
- gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->msg_body), FALSE);
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
- stream = TNY_STREAM (tny_gtk_text_buffer_stream_new (buffer));
- tny_stream_reset (stream);
- tny_mime_part_decode_to_stream (body_part, stream, NULL);
- tny_stream_reset (stream);
- gtk_text_view_set_editable (GTK_TEXT_VIEW (priv->msg_body), TRUE);
- }
-
- /* Set the default focus depending on having already a To: field or not */
- if ((!to)||(*to == '\0')) {
- modest_recpt_editor_grab_focus (MODEST_RECPT_EDITOR (priv->to_field));
- } else {
- gtk_widget_grab_focus (priv->msg_body);
- }
-
-
- modest_msg_edit_window_set_modified (self, FALSE);
- text_buffer_can_undo (priv->text_buffer, FALSE, self);
- text_buffer_can_redo (priv->text_buffer, FALSE, self);
-
- if (priv->msg_uid) {
- g_free (priv->msg_uid);
- priv->msg_uid = NULL;
- }
-
- /* we should set a reference to the incoming message if it is a draft */
- msg_folder = tny_msg_get_folder (msg);
- if (msg_folder) {
- if (modest_tny_folder_is_local_folder (msg_folder)) {
- TnyFolderType type = modest_tny_folder_get_local_or_mmc_folder_type (msg_folder);
- if (type == TNY_FOLDER_TYPE_INVALID)
- g_warning ("%s: BUG: TNY_FOLDER_TYPE_INVALID", __FUNCTION__);
-
- if (type == TNY_FOLDER_TYPE_DRAFTS)
- priv->draft_msg = g_object_ref(msg);
- if (type == TNY_FOLDER_TYPE_OUTBOX)
- priv->outbox_msg = g_object_ref(msg);
- priv->msg_uid = modest_tny_folder_get_header_unique_id (header);
- }
- g_object_unref (msg_folder);
- }
-
- g_free (subject);
- g_free (to);
- g_free (cc);
- g_free (bcc);
-}
-
-static void
-modest_msg_edit_window_setup_toolbar (ModestMsgEditWindow *window)
-{
- ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
- GtkWidget *tool_item;
-
- /* Toolbar */
- parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar");
-
- /* Set expand and homogeneous for remaining items */
- tool_item = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/ToolbarSend");
- gtk_tool_item_set_expand (GTK_TOOL_ITEM (tool_item), FALSE);
- gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (tool_item), FALSE);
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (tool_item), TRUE);
- tool_item = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/ToolbarAttach");
- gtk_tool_item_set_expand (GTK_TOOL_ITEM (tool_item), FALSE);
- gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (tool_item), FALSE);
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (tool_item), TRUE);
-
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (parent_priv->toolbar), TRUE);
-
-}
-
-static void
-on_account_removed (TnyAccountStore *account_store,
- TnyAccount *account,
- gpointer user_data)
-{
- /* Do nothing if it's a store account, because we use the
- transport to send the messages */
- if (tny_account_get_account_type(account) == TNY_ACCOUNT_TYPE_TRANSPORT) {
- const gchar *parent_acc = NULL;
- const gchar *our_acc = NULL;
-
- our_acc = modest_window_get_active_account (MODEST_WINDOW (user_data));
- parent_acc = modest_tny_account_get_parent_modest_account_name_for_server_account (account);
- /* Close this window if I'm showing a message of the removed account */
- if (strcmp (parent_acc, our_acc) == 0)
- modest_ui_actions_on_close_window (NULL, MODEST_WINDOW (user_data));
- }
-}
-
-
-
-ModestWindow *
-modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name,
- const gchar *mailbox,
- gboolean preserve_is_rich)
-{
- ModestMsgEditWindow *self;
- ModestMsgEditWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- GtkActionGroup *action_group;
- ModestDimmingRulesGroup *menu_rules_group = NULL;
- ModestDimmingRulesGroup *toolbar_rules_group = NULL;
- ModestDimmingRulesGroup *clipboard_rules_group = NULL;
- GError *error = NULL;
-
- g_return_val_if_fail (msg, NULL);
- g_return_val_if_fail (account_name, NULL);
-
- self = MODEST_MSG_EDIT_WINDOW(g_object_new(MODEST_TYPE_MSG_EDIT_WINDOW, NULL));
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(self);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
-
- parent_priv->ui_manager = gtk_ui_manager_new();
- action_group = gtk_action_group_new ("ModestMsgEditWindowActions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
-
- /* Add common actions */
- gtk_action_group_add_actions (action_group,
- modest_msg_edit_action_entries,
- G_N_ELEMENTS (modest_msg_edit_action_entries),
- self);
- gtk_action_group_add_toggle_actions (action_group,
- modest_msg_edit_toggle_action_entries,
- G_N_ELEMENTS (modest_msg_edit_toggle_action_entries),
- self);
- gtk_action_group_add_radio_actions (action_group,
- modest_msg_edit_priority_action_entries,
- G_N_ELEMENTS (modest_msg_edit_priority_action_entries),
- 0,
- G_CALLBACK (modest_ui_actions_msg_edit_on_change_priority),
- self);
- gtk_ui_manager_insert_action_group (parent_priv->ui_manager, action_group, 0);
- g_object_unref (action_group);
-
- /* Load the UI definition */
- gtk_ui_manager_add_ui_from_file (parent_priv->ui_manager,
- MODEST_UIDIR "modest-msg-edit-window-ui.xml",
- &error);
- if (error) {
- g_printerr ("modest: could not merge modest-msg-edit-window-ui.xml: %s\n", error->message);
- g_error_free (error);
- error = NULL;
- }
- /* ****** */
-
- /* Add accelerators */
- gtk_window_add_accel_group (GTK_WINDOW (self),
- gtk_ui_manager_get_accel_group (parent_priv->ui_manager));
-
- /* Toolbar / Menubar */
- modest_msg_edit_window_setup_toolbar (MODEST_MSG_EDIT_WINDOW (self));
- priv->menubar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/MenuBar");
- modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->from_field), (gpointer) account_name);
-
- /* Init window */
- init_window (MODEST_MSG_EDIT_WINDOW(self), account_name);
-
- connect_signals (MODEST_MSG_EDIT_WINDOW (self));
- restore_settings (MODEST_MSG_EDIT_WINDOW (self));
-
- gtk_window_set_title (GTK_WINDOW(self), "Modest");
- gtk_window_set_icon_from_file (GTK_WINDOW(self), MODEST_APP_ICON, NULL);
-
- g_signal_connect (G_OBJECT(self), "delete-event",
- G_CALLBACK(on_delete_event), self);
-
- modest_window_set_active_account (MODEST_WINDOW(self), account_name);
- priv->original_account_name = (account_name) ? g_strdup (account_name) : NULL;
-
- parent_priv->ui_dimming_manager = modest_ui_dimming_manager_new ();
- menu_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_MENU, FALSE);
- toolbar_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_TOOLBAR, TRUE);
- clipboard_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_CLIPBOARD, FALSE);
-
- /* Add common dimming rules */
- modest_dimming_rules_group_add_rules (menu_rules_group,
- modest_msg_edit_window_menu_dimming_entries,
- G_N_ELEMENTS (modest_msg_edit_window_menu_dimming_entries),
- MODEST_WINDOW (self));
- modest_dimming_rules_group_add_rules (toolbar_rules_group,
- modest_msg_edit_window_toolbar_dimming_entries,
- G_N_ELEMENTS (modest_msg_edit_window_toolbar_dimming_entries),
- MODEST_WINDOW (self));
-/* modest_dimming_rules_group_add_widget_rule (toolbar_rules_group, priv->font_color_button, */
-/* G_CALLBACK (modest_ui_dimming_rules_on_set_style), */
-/* MODEST_WINDOW (self)); */
-/* modest_dimming_rules_group_add_widget_rule (toolbar_rules_group, priv->font_size_toolitem, */
-/* G_CALLBACK (modest_ui_dimming_rules_on_set_style), */
-/* MODEST_WINDOW (self)); */
-/* modest_dimming_rules_group_add_widget_rule (toolbar_rules_group, priv->font_face_toolitem, */
-/* G_CALLBACK (modest_ui_dimming_rules_on_set_style), */
-/* MODEST_WINDOW (self)); */
- modest_dimming_rules_group_add_rules (clipboard_rules_group,
- modest_msg_edit_window_clipboard_dimming_entries,
- G_N_ELEMENTS (modest_msg_edit_window_clipboard_dimming_entries),
- MODEST_WINDOW (self));
- /* Insert dimming rules group for this window */
- modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, menu_rules_group);
- modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, toolbar_rules_group);
- modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, clipboard_rules_group);
- /* Checks the dimming rules */
- g_object_unref (menu_rules_group);
- g_object_unref (toolbar_rules_group);
- g_object_unref (clipboard_rules_group);
-
- set_msg (self, msg);
-
- modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (self));
- modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (self));
- modest_window_check_dimming_rules_group (MODEST_WINDOW (self), MODEST_DIMMING_RULES_CLIPBOARD);
-
- modest_msg_edit_window_set_modified (MODEST_MSG_EDIT_WINDOW (self), FALSE);
-
- /* Track account-removed signal, this window should be closed
- in the case we're creating a mail associated to the account
- that is deleted */
- priv->account_removed_handler_id =
- g_signal_connect (G_OBJECT (modest_runtime_get_account_store ()),
- "account_removed",
- G_CALLBACK(on_account_removed),
- self);
-
- return MODEST_WINDOW(self);
-}
-
-
-MsgData *
-modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window)
-{
- MsgData *data;
-
- const gchar *account_name;
- gchar *from_string = NULL;
- ModestMsgEditWindowPrivate *priv;
- TnyIterator *att_iter;
-
- g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (edit_window), NULL);
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (edit_window);
-
- account_name = (gchar*)modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->from_field));
- if (account_name)
- from_string = modest_account_mgr_get_from_string (modest_runtime_get_account_mgr(),
- account_name, NULL);
- if (!from_string) {
- g_printerr ("modest: cannot get from string\n");
- return NULL;
- }
-
-
-
- data = g_slice_new0 (MsgData);
- data->account_name = g_strdup (account_name);
- data->from = from_string; /* will be freed when data is freed */
- data->to = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->to_field)));
- data->cc = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->cc_field)));
- data->bcc = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->bcc_field)));
- data->subject = g_strdup ( gtk_entry_get_text (GTK_ENTRY(priv->subject_field)));
- data->references = g_strdup (priv->references);
- data->in_reply_to = g_strdup (priv->in_reply_to);
- if (priv->draft_msg) {
- data->draft_msg = g_object_ref (priv->draft_msg);
- } else if (priv->outbox_msg) {
- data->draft_msg = g_object_ref (priv->outbox_msg);
- } else {
- data->draft_msg = NULL;
- }
-
- GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
- GtkTextIter b, e;
- gtk_text_buffer_get_bounds (buf, &b, &e);
- gtk_text_buffer_set_modified (priv->text_buffer, TRUE);
- data->plain_body = gtk_text_buffer_get_text (buf, &b, &e, FALSE); /* Returns a copy. */
- data->html_body = NULL;
-
- /* deep-copy the attachment data */
- att_iter = tny_list_create_iterator (priv->attachments);
- data->attachments = NULL;
- while (!tny_iterator_is_done (att_iter)) {
- TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (att_iter);
- if (!(TNY_IS_MIME_PART(part))) {
- g_warning ("strange data in attachment list");
- g_object_unref (part);
- tny_iterator_next (att_iter);
- continue;
- }
- data->attachments = g_list_append (data->attachments,
- part);
- tny_iterator_next (att_iter);
- }
- g_object_unref (att_iter);
-
-
- if (priv->draft_msg) {
- data->draft_msg = g_object_ref (priv->draft_msg);
- } else if (priv->outbox_msg) {
- data->draft_msg = g_object_ref (priv->outbox_msg);
- } else {
- data->draft_msg = NULL;
- }
-
- data->priority_flags = priv->priority_flags;
-
- return data;
-}
-
-static void
-unref_gobject (GObject *obj, gpointer data)
-{
- if (!G_IS_OBJECT(obj))
- return;
- g_object_unref (obj);
-}
-
-void
-modest_msg_edit_window_free_msg_data (ModestMsgEditWindow *edit_window,
- MsgData *data)
-{
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (edit_window));
-
- if (!data)
- return;
-
- g_free (data->to);
- g_free (data->cc);
- g_free (data->bcc);
- g_free (data->subject);
- g_free (data->plain_body);
- g_free (data->html_body);
- g_free (data->account_name);
- g_free (data->references);
- g_free (data->in_reply_to);
-
- if (data->draft_msg != NULL) {
- g_object_unref (data->draft_msg);
- data->draft_msg = NULL;
- }
-
- g_list_foreach (data->attachments, (GFunc)unref_gobject, NULL);
- g_list_free (data->attachments);
-
- g_slice_free (MsgData, data);
-}
-
-/* Rich formatting API functions */
-ModestMsgEditFormat
-modest_msg_edit_window_get_format (ModestMsgEditWindow *self)
-{
- return MODEST_MSG_EDIT_FORMAT_TEXT;
-}
-
-void
-modest_msg_edit_window_set_format (ModestMsgEditWindow *self,
- ModestMsgEditFormat format)
-{
- switch (format) {
- case MODEST_MSG_EDIT_FORMAT_TEXT:
- break;
- case MODEST_MSG_EDIT_FORMAT_HTML:
- g_warning ("HTML format not supported in Gnome ModestMsgEditWindow");
- break;
- default:
- break;
- }
-}
-
-ModestMsgEditFormatState *
-modest_msg_edit_window_get_format_state (ModestMsgEditWindow *self)
-{
- ModestMsgEditFormatState *format_state;
-
- g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (self), NULL);
-
- format_state = g_new0 (ModestMsgEditFormatState, 1);
-
- return format_state;
-}
-
-void
-modest_msg_edit_window_set_format_state (ModestMsgEditWindow *self,
- const ModestMsgEditFormatState *format_state)
-{
- g_return_if_fail (MODEST_MSG_EDIT_WINDOW (self));
-
- /* Ends silently as set_format_state should do nothing when edit window format
- is not HTML */
- return;
-}
-
-void
-modest_msg_edit_window_select_color (ModestMsgEditWindow *window)
-{
- g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
-
- g_warning ("Select color operation is not supported");
-}
-
-void
-modest_msg_edit_window_select_file_format (ModestMsgEditWindow *window,
- gint file_format)
-{
- g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
-
- g_warning ("Select file format operation is not supported");
-}
-
-void
-modest_msg_edit_window_select_font (ModestMsgEditWindow *window)
-{
- g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
-
- g_warning ("Select font operation is not supported");
-}
-
-void
-modest_msg_edit_window_select_background_color (ModestMsgEditWindow *window)
-{
- g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
-
- g_warning ("Select background color operation is not supported");
-}
-
-void
-modest_msg_edit_window_insert_image (ModestMsgEditWindow *window)
-{
- g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
-
- g_warning ("Insert image operation is not supported");
-}
-
-void
-modest_msg_edit_window_attach_file (ModestMsgEditWindow *window)
-{
- g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
-
- g_warning ("Attach file operation is not supported");
-}
-
-void
-modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window,
- TnyList *att_list)
-{
- ModestMsgEditWindowPrivate *priv;
- TnyIterator *iter;
-
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- if (att_list == NULL) {
- att_list = modest_attachments_view_get_selection (MODEST_ATTACHMENTS_VIEW (priv->attachments_view));
- } else {
- g_object_ref (att_list);
- }
-
- if (tny_list_get_length (att_list) == 0) {
- modest_platform_information_banner (NULL, NULL, _("TODO: no attachments selected to remove"));
- } else {
- GtkWidget *confirmation_dialog = NULL;
- gboolean dialog_response;
- gchar *message = NULL;
- gchar *filename = NULL;
-
- if (tny_list_get_length (att_list) == 1) {
- TnyMimePart *part;
- iter = tny_list_create_iterator (att_list);
- part = (TnyMimePart *) tny_iterator_get_current (iter);
- g_object_unref (iter);
- if (TNY_IS_MSG (part)) {
- TnyHeader *header = tny_msg_get_header (TNY_MSG (part));
- if (header) {
- filename = tny_header_dup_subject (header);
- g_object_unref (header);
- }
- if (filename == NULL) {
- filename = g_strdup (_("mail_va_no_subject"));
- }
- } else {
- filename = g_strdup (tny_mime_part_get_filename (TNY_MIME_PART (part)));
- }
- g_object_unref (part);
- } else {
- filename = g_strdup ("");
- }
- message = g_strdup_printf (ngettext("emev_nc_delete_attachment", "emev_nc_delete_attachments",
- (tny_list_get_length (att_list) == 1)), filename);
- g_free (filename);
- confirmation_dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_OK_CANCEL,
- "%s", message);
- g_free (message);
- dialog_response = (gtk_dialog_run (GTK_DIALOG (confirmation_dialog))==GTK_RESPONSE_OK);
- gtk_widget_destroy (confirmation_dialog);
- if (!dialog_response) {
- g_object_unref (att_list);
- return;
- }
- modest_platform_information_banner (NULL, NULL, _("mcen_ib_removing_attachment"));
-
- for (iter = tny_list_create_iterator (att_list);
- !tny_iterator_is_done (iter);
- tny_iterator_next (iter)) {
- TnyMimePart *mime_part = (TnyMimePart *) tny_iterator_get_current (iter);
- tny_list_remove (priv->attachments, (GObject *) mime_part);
-
- modest_attachments_view_remove_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view),
- mime_part);
- gtk_text_buffer_set_modified (priv->text_buffer, TRUE);
- g_object_unref (mime_part);
- }
- g_object_unref (iter);
- }
-
- g_object_unref (att_list);
-
-}
-
-void
-modest_msg_edit_window_get_parts_size (ModestMsgEditWindow *window,
- gint *parts_count,
- guint64 *parts_size)
-{
- ModestMsgEditWindowPrivate *priv;
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- modest_attachments_view_get_sizes (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), parts_count, parts_size);
-
-}
-
-void
-modest_msg_edit_window_show_cc (ModestMsgEditWindow *window,
- gboolean show)
-{
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
-
- g_warning ("not implemented yet %s", __FUNCTION__);
-}
-void
-modest_msg_edit_window_show_bcc (ModestMsgEditWindow *window,
- gboolean show)
-{
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
-
- g_warning ("not implemented yet %s", __FUNCTION__);
-}
-void
-modest_msg_edit_window_undo (ModestMsgEditWindow *window)
-{
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
-
- g_warning ("not implemented yet %s", __FUNCTION__);
-}
-void
-modest_msg_edit_window_toggle_fullscreen (ModestMsgEditWindow *window)
-{
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
-
- g_warning ("not implemented yet %s", __FUNCTION__);
-}
-void
-modest_msg_edit_window_set_priority_flags (ModestMsgEditWindow *window,
- TnyHeaderFlags priority_flags)
-{
- ModestMsgEditWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
-
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
- parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
-
- if (priv->priority_flags != priority_flags) {
- GtkAction *priority_action = NULL;
-
- priv->priority_flags = priority_flags;
-
- switch (priority_flags) {
- case TNY_HEADER_FLAG_HIGH_PRIORITY:
- gtk_image_set_from_icon_name (GTK_IMAGE (priv->priority_icon), "qgn_list_messaging_high", GTK_ICON_SIZE_MENU);
- gtk_widget_show (priv->priority_icon);
- priority_action = gtk_ui_manager_get_action (parent_priv->ui_manager,
- "/MenuBar/ToolsMenu/MessagePriorityMenu/MessagePriorityHighMenu");
- break;
- case TNY_HEADER_FLAG_LOW_PRIORITY:
- gtk_image_set_from_icon_name (GTK_IMAGE (priv->priority_icon), "qgn_list_messaging_low", GTK_ICON_SIZE_MENU);
- gtk_widget_show (priv->priority_icon);
- priority_action = gtk_ui_manager_get_action (parent_priv->ui_manager,
- "/MenuBar/ToolsMenu/MessagePriorityMenu/MessagePriorityLowMenu");
- break;
- default:
- gtk_widget_hide (priv->priority_icon);
- priority_action = gtk_ui_manager_get_action (parent_priv->ui_manager,
- "/MenuBar/ToolsMenu/MessagePriorityMenu/MessagePriorityNormalMenu");
- break;
- }
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priority_action), TRUE);
- gtk_text_buffer_set_modified (priv->text_buffer, TRUE);
- }
-}
-
-void
-modest_msg_edit_window_select_contacts (ModestMsgEditWindow *window)
-{
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
-
- g_warning ("not implemented yet %s", __FUNCTION__);
-}
-
-gboolean
-modest_msg_edit_window_check_names (ModestMsgEditWindow *window, gboolean add_to_addressbook)
-{
- g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), FALSE);
-
- g_warning ("not implemented yet %s", __FUNCTION__);
- return TRUE;
-}
-
-void
-modest_msg_edit_window_set_file_format (ModestMsgEditWindow *window,
- gint file_format)
-{
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
-
- g_warning ("not implemented yet %s", __FUNCTION__);
-}
-
-gboolean
-modest_msg_edit_window_get_sent (ModestMsgEditWindow *window)
-{
- ModestMsgEditWindowPrivate *priv;
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(window);
- return priv->sent;
-}
-
-void
-modest_msg_edit_window_set_sent (ModestMsgEditWindow *window,
- gboolean sent)
-{
- ModestMsgEditWindowPrivate *priv;
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(window);
- priv->sent = sent;
-}
-
-GtkWidget *
-modest_msg_edit_window_get_child_widget (ModestMsgEditWindow *win,
- ModestMsgEditWindowWidgetType widget_type)
-{
- ModestMsgEditWindowPrivate *priv;
-
- g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (win), NULL);
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (win);
-
- switch (widget_type) {
- case MODEST_MSG_EDIT_WINDOW_WIDGET_TYPE_BODY:
- return priv->msg_body;
- break;
- case MODEST_MSG_EDIT_WINDOW_WIDGET_TYPE_TO:
- return priv->to_field;
- break;
- case MODEST_MSG_EDIT_WINDOW_WIDGET_TYPE_CC:
- return priv->cc_field;
- break;
- case MODEST_MSG_EDIT_WINDOW_WIDGET_TYPE_BCC:
- return priv->bcc_field;
- break;
- case MODEST_MSG_EDIT_WINDOW_WIDGET_TYPE_SUBJECT:
- return priv->subject_field;
- break;
- case MODEST_MSG_EDIT_WINDOW_WIDGET_TYPE_ATTACHMENTS:
- return priv->attachments_view;
- break;
- default:
- return NULL;
- }
- return NULL;
-}
-
-/* FUNCTIONS NOT IMPLEMENTED YET */
-
-void
-modest_msg_edit_window_set_modified (ModestMsgEditWindow *window,
- gboolean modified)
-{
- ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
- GtkTextBuffer *buffer;
-
- buffer = modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR(priv->to_field));
- gtk_text_buffer_set_modified (buffer, modified);
- buffer = modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR(priv->cc_field));
- gtk_text_buffer_set_modified (buffer, modified);
- buffer = modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR(priv->bcc_field));
- gtk_text_buffer_set_modified (buffer, modified);
- gtk_text_buffer_set_modified (priv->text_buffer, modified);
-}
-
-void
-modest_msg_edit_window_toggle_find_toolbar (ModestMsgEditWindow *window,
- gboolean show)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
-}
-
-void
-modest_msg_edit_window_add_part (ModestMsgEditWindow *window,
- TnyMimePart *part)
-{
- ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- g_return_if_fail (TNY_IS_MIME_PART (part));
- tny_list_prepend (priv->attachments, (GObject *) part);
- modest_attachments_view_add_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), part, TRUE, 0);
-}
-
-void
-modest_msg_edit_window_redo (ModestMsgEditWindow *window)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
-}
-
-void
-modest_msg_edit_window_offer_attach_file (ModestMsgEditWindow *window)
-{
- GtkWidget *dialog = NULL;
- gint response = 0;
- GSList *uris = NULL;
- GSList *uri_node;
-
- dialog = gtk_file_chooser_dialog_new (_("mcen_ti_select_attachment_title"),
- GTK_WINDOW (window),
- GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_OPEN,
- GTK_RESPONSE_OK,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- NULL);
-
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- switch (response) {
- case GTK_RESPONSE_OK:
- uris = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (dialog));
- break;
- default:
- break;
- }
- gtk_widget_destroy (dialog);
-
- for (uri_node = uris; uri_node != NULL; uri_node = g_slist_next (uri_node)) {
- const gchar *uri = (const gchar *) uri_node->data;
- modest_msg_edit_window_attach_file_one (window, uri, MODEST_MAX_ATTACHMENT_SIZE);
- }
- g_slist_foreach (uris, (GFunc) g_free, NULL);
- g_slist_free (uris);
-}
-
-GnomeVFSFileSize
-modest_msg_edit_window_attach_file_one (ModestMsgEditWindow *window,
- const gchar *uri,
- GnomeVFSFileSize allowed_size)
-{
- GnomeVFSHandle *handle = NULL;
- ModestMsgEditWindowPrivate *priv;
- GnomeVFSResult result;
-
- g_return_val_if_fail (window, 0);
- g_return_val_if_fail (uri, 0);
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- result = gnome_vfs_open (&handle, uri, GNOME_VFS_OPEN_READ);
- if (result == GNOME_VFS_OK) {
- TnyMimePart *mime_part;
- TnyStream *stream;
- const gchar *mime_type = NULL;
- gchar *basename;
- gchar *escaped_filename;
- gchar *filename;
- gchar *content_id;
- GnomeVFSFileInfo *info;
- GnomeVFSURI *vfs_uri;
-
- vfs_uri = gnome_vfs_uri_new (uri);
-
- escaped_filename = g_path_get_basename (gnome_vfs_uri_get_path (vfs_uri));
- filename = gnome_vfs_unescape_string_for_display (escaped_filename);
- g_free (escaped_filename);
- gnome_vfs_uri_unref (vfs_uri);
-
- info = gnome_vfs_file_info_new ();
-
- if (gnome_vfs_get_file_info (uri,
- info,
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE)
- == GNOME_VFS_OK)
- mime_type = gnome_vfs_file_info_get_mime_type (info);
- mime_part = tny_platform_factory_new_mime_part
- (modest_runtime_get_platform_factory ());
- stream = TNY_STREAM (tny_vfs_stream_new (handle));
-
- tny_mime_part_construct (mime_part, stream, mime_type, "base64");
-
- g_object_unref (stream);
-
- content_id = g_strdup_printf ("%d", priv->next_cid);
- tny_mime_part_set_content_id (mime_part, content_id);
- g_free (content_id);
- priv->next_cid++;
-
- basename = g_path_get_basename (filename);
- tny_mime_part_set_filename (mime_part, basename);
- g_free (basename);
-
- tny_list_prepend (priv->attachments, (GObject *) mime_part);
- modest_attachments_view_add_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view),
- mime_part,
- info->size == 0, info->size);
- gtk_text_buffer_set_modified (priv->text_buffer, TRUE);
- g_free (filename);
- g_object_unref (mime_part);
- gnome_vfs_file_info_unref (info);
- }
- /* TODO: return proper file size */
- return 0;
-}
-
-void
-modest_msg_edit_window_set_draft (ModestMsgEditWindow *window,
- TnyMsg *draft)
-{
- ModestMsgEditWindowPrivate *priv;
- TnyHeader *header = NULL;
-
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
- g_return_if_fail ((draft == NULL)||(TNY_IS_MSG (draft)));
-
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
- ModestWindowMgr *mgr = modest_runtime_get_window_mgr ();
-
- if (priv->draft_msg != NULL) {
- g_object_unref (priv->draft_msg);
- }
-
- if (draft != NULL) {
- g_object_ref (draft);
- header = tny_msg_get_header (draft);
- if (priv->msg_uid) {
- g_free (priv->msg_uid);
- priv->msg_uid = NULL;
- }
- priv->msg_uid = modest_tny_folder_get_header_unique_id (header);
- if (GTK_WIDGET_REALIZED (window))
- modest_window_mgr_register_window (mgr, MODEST_WINDOW (window), NULL);
- }
-
- priv->draft_msg = draft;
-}
-
-gboolean
-modest_msg_edit_window_is_modified (ModestMsgEditWindow *window)
-{
- ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
- const char *account_name;
- GtkTextBuffer *buffer;
-
- buffer = modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR(priv->to_field));
- if (gtk_text_buffer_get_modified (buffer))
- return TRUE;
- buffer = modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR(priv->cc_field));
- if (gtk_text_buffer_get_modified (buffer))
- return TRUE;
- buffer = modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR(priv->bcc_field));
- if (gtk_text_buffer_get_modified (buffer))
- return TRUE;
- if (gtk_text_buffer_get_modified (priv->text_buffer))
- return TRUE;
- account_name = modest_combo_box_get_active_id (MODEST_COMBO_BOX (priv->from_field));
- if (!priv->original_account_name || strcmp(account_name, priv->original_account_name)) {
- return TRUE;
- }
-
- return FALSE;
-}
-
-const gchar *
-modest_msg_edit_window_get_clipboard_text (ModestMsgEditWindow *win)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return NULL;
-}
-
-const gchar*
-modest_msg_edit_window_get_message_uid (ModestMsgEditWindow *window)
-{
- ModestMsgEditWindowPrivate *priv;
-
- g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), NULL);
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- return priv->msg_uid;
-}
+++ /dev/null
-#ifndef __MODEST_MSG_VIEW_WINDOW_UI_DIMMING_PRIV_H__
-#define __MODEST_MSG_VIEW_WINDOW_UI_DIMMING_PRIV_H__
-
-#include "modest-dimming-rules-group.h"
-#include "modest-ui-dimming-rules.h"
-
-G_BEGIN_DECLS
-
-
-/* Menu Dimming rules entries */
-static const ModestDimmingEntry modest_msg_view_menu_dimming_entries [] = {
-
- /* Message Menu */
- { "/MenuBar/MessageMenu/MessageNewMenu", G_CALLBACK(modest_ui_dimming_rules_on_new_msg) },
- { "/MenuBar/MessageMenu/MessageReplyMenu", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) },
- { "/MenuBar/MessageMenu/MessageReplyAllMenu", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) },
- { "/MenuBar/MessageMenu/MessageForwardMenu", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) },
- { "/MenuBar/MessageMenu/MessageDeleteMenu", G_CALLBACK(modest_ui_dimming_rules_on_delete_msg) },
- { "/MenuBar/MessageMenu/MessageDetailsMenu", G_CALLBACK(modest_ui_dimming_rules_on_details) },
-
- /* Edit Menu */
- { "/MenuBar/EditMenu", NULL },
- { "/MenuBar/EditMenu/EditPasteMenu", G_CALLBACK(modest_ui_dimming_rules_always_dimmed) },
- { "/MenuBar/EditMenu/EditSelectAllMenu", NULL },
- { "/MenuBar/EditMenu/EditMoveToMenu", G_CALLBACK(modest_ui_dimming_rules_on_move_to) },
-
- /* View Menu */
- { "/MenuBar/ViewMenu", NULL },
- { "/MenuBar/ViewMenu/ZoomMenu", NULL },
- { "/MenuBar/ViewMenu/ViewToggleFullscreenMenu", NULL },
- { "/MenuBar/ViewMenu/ViewPreviousMessageMenu", G_CALLBACK(modest_ui_dimming_rules_on_view_previous) },
- { "/MenuBar/ViewMenu/ViewNextMessageMenu", G_CALLBACK(modest_ui_dimming_rules_on_view_next)},
-
- /* Attachments Menu */
- { "/MenuBar/AttachmentsMenu", NULL },
- { "/MenuBar/AttachmentsMenu/ViewAttachmentMenu", G_CALLBACK(modest_ui_dimming_rules_on_view_attachments) },
- { "/MenuBar/AttachmentsMenu/SaveAttachmentMenu", G_CALLBACK(modest_ui_dimming_rules_on_save_attachments) },
- { "/MenuBar/AttachmentsMenu/RemoveAttachmentMenu", G_CALLBACK(modest_ui_dimming_rules_on_remove_attachments) },
-
- /* Tools Menu */
- { "/MenuBar/ToolsMenu", NULL },
-
- /* Close Menu */
- { "/MenuBar/CloseMenu", NULL },
- { "/MenuBar/ToolsMenu/CloseWindowMenu", NULL },
- { "/MenuBar/ToolsMenu/CloseAllWindowsMenu", NULL },
-
- /* Contextual Menus (Toolbar) */
- { "/ToolbarReplyCSM/MessageForwardMenu", NULL },
- { "/ToolbarReplyCSM/MessageReplyAllMenu", NULL },
- { "/ToolbarReplyCSM/MessageReplyMenu", NULL },
-
-};
-
-/* Clipboard status dimming rule entries */
-static const ModestDimmingEntry modest_msg_view_clipboard_dimming_entries [] = {
- { "/MenuBar/EditMenu/EditCutMenu", G_CALLBACK(modest_ui_dimming_rules_always_dimmed) },
- { "/MenuBar/EditMenu/EditCopyMenu", G_CALLBACK(modest_ui_dimming_rules_on_copy) },
- { "/MenuBar/ToolsMenu/ToolsAddToContactsMenu", G_CALLBACK (modest_ui_dimming_rules_on_add_to_contacts) },
-};
-
-/* Menu Dimming rules entries */
-static const ModestDimmingEntry modest_msg_view_toolbar_dimming_entries [] = {
-
- /* Toolbar */
- { "/ToolBar/ToolbarMessageReply", G_CALLBACK(modest_ui_dimming_rules_on_reply_msg) },
- { "/ToolBar/ToolbarMessageMoveTo", G_CALLBACK(modest_ui_dimming_rules_on_move_to) },
- { "/ToolBar/ToolbarDeleteMessage", G_CALLBACK(modest_ui_dimming_rules_on_delete_msg) },
- { "/ToolBar/FindInMessage", G_CALLBACK(modest_ui_dimming_rules_on_find_in_msg) },
- { "/ToolBar/ToolbarMessageBack", G_CALLBACK(modest_ui_dimming_rules_on_view_previous) },
- { "/ToolBar/ToolbarMessageNext", G_CALLBACK(modest_ui_dimming_rules_on_view_next) },
- { "/ToolBar/ToolbarCancel", NULL },
-};
-
-G_END_DECLS
-#endif /* __MODEST_MSG_VIEW_WINDOW_UI_PRIV_H__ */
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <glib/gi18n.h>
-#include <string.h>
-#include <tny-account-store.h>
-#include <tny-simple-list.h>
-#include <modest-tny-msg.h>
-#include "modest-icon-names.h"
-#include "modest-ui-actions.h"
-#include <modest-widget-memory.h>
-#include <modest-runtime.h>
-#include <modest-main-window-ui.h>
-#include "modest-msg-view-window-ui-dimming.h"
-#include "modest-defs.h"
-#include <widgets/modest-msg-view-window.h>
-#include <widgets/modest-window-priv.h>
-#include "widgets/modest-msg-view.h"
-#include "modest-ui-dimming-manager.h"
-
-
-static void modest_msg_view_window_class_init (ModestMsgViewWindowClass *klass);
-static void modest_msg_view_window_init (ModestMsgViewWindow *obj);
-static void modest_msg_view_window_finalize (GObject *obj);
-
-static void modest_msg_view_window_toggle_find_toolbar (GtkToggleAction *toggle,
- gpointer data);
-
-/* list my signals */
-enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
- LAST_SIGNAL
-};
-
-typedef struct _ModestMsgViewWindowPrivate ModestMsgViewWindowPrivate;
-struct _ModestMsgViewWindowPrivate {
- GtkWidget *toolbar;
- GtkWidget *menubar;
- GtkWidget *msg_view;
-
- gchar *msg_uid;
- TnyMimePart *other_body;
-};
-
-#define MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_MSG_VIEW_WINDOW, \
- ModestMsgViewWindowPrivate))
-/* globals */
-static GtkWindowClass *parent_class = NULL;
-
-static const GtkToggleActionEntry msg_view_toggle_action_entries [] = {
- { "FindInMessage", GTK_STOCK_FIND, N_("mcen_me_viewer_find"), NULL, NULL, G_CALLBACK (modest_msg_view_window_toggle_find_toolbar), FALSE },
- { "ToolsFindInMessage", NULL, N_("mcen_me_viewer_find"), "<CTRL>F", NULL, G_CALLBACK (modest_msg_view_window_toggle_find_toolbar), FALSE },
-};
-
-static const GtkRadioActionEntry msg_view_zoom_action_entries [] = {
- { "Zoom50", NULL, N_("mcen_me_viewer_50"), NULL, NULL, 50 },
- { "Zoom80", NULL, N_("mcen_me_viewer_80"), NULL, NULL, 80 },
- { "Zoom100", NULL, N_("mcen_me_viewer_100"), NULL, NULL, 100 },
- { "Zoom120", NULL, N_("mcen_me_viewer_120"), NULL, NULL, 120 },
- { "Zoom150", NULL, N_("mcen_me_viewer_150"), NULL, NULL, 150 },
- { "Zoom200", NULL, N_("mcen_me_viewer_200"), NULL, NULL, 200 }
-};
-
-GType
-modest_msg_view_window_get_type (void)
-{
- static GType my_type = 0;
- if (!my_type) {
- static const GTypeInfo my_info = {
- sizeof(ModestMsgViewWindowClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc) modest_msg_view_window_class_init,
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof(ModestMsgViewWindow),
- 1, /* n_preallocs */
- (GInstanceInitFunc) modest_msg_view_window_init,
- NULL
- };
- my_type = g_type_register_static (MODEST_TYPE_WINDOW,
- "ModestMsgViewWindow",
- &my_info, 0);
- }
- return my_type;
-}
-
-static void
-save_state (ModestWindow *self)
-{
- modest_widget_memory_save (modest_runtime_get_conf (),
- G_OBJECT(self),
- MODEST_CONF_MSG_VIEW_WINDOW_KEY);
-}
-
-
-static void
-restore_settings (ModestWindow *self)
-{
- modest_widget_memory_restore (modest_runtime_get_conf (),
- G_OBJECT(self),
- MODEST_CONF_MSG_VIEW_WINDOW_KEY);
-}
-
-static void
-modest_msg_view_window_class_init (ModestMsgViewWindowClass *klass)
-{
- GObjectClass *gobject_class;
- gobject_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_peek_parent (klass);
- gobject_class->finalize = modest_msg_view_window_finalize;
-
- g_type_class_add_private (gobject_class, sizeof(ModestMsgViewWindowPrivate));
-
- ModestWindowClass *modest_window_class = (ModestWindowClass *) klass;
- modest_window_class->save_state_func = save_state;
-}
-
-static void
-modest_msg_view_window_init (ModestMsgViewWindow *obj)
-{
- ModestMsgViewWindowPrivate *priv;
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
-
- priv->toolbar = NULL;
- priv->menubar = NULL;
- priv->msg_view = NULL;
- priv->msg_uid = NULL;
- priv->other_body = NULL;
-}
-
-
-static void
-init_window (ModestMsgViewWindow *obj, TnyMsg *msg, TnyMimePart *other_body)
-{
- GtkWidget *main_vbox, *scrolled_window;
- ModestMsgViewWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
-
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
-
- priv->msg_view = GTK_WIDGET (tny_platform_factory_new_msg_view (modest_tny_platform_factory_get_instance ()));
- if (other_body) {
- priv->other_body = g_object_ref (other_body);
- modest_msg_view_set_msg_with_other_body (MODEST_MSG_VIEW (priv->msg_view), msg, other_body);
- } else {
- tny_msg_view_set_msg (TNY_MSG_VIEW (priv->msg_view), msg);
- }
- main_vbox = gtk_vbox_new (FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX(main_vbox), priv->menubar, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(main_vbox), priv->toolbar, FALSE, FALSE, 0);
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (scrolled_window),
- priv->msg_view);
- gtk_box_pack_start (GTK_BOX(main_vbox), scrolled_window, TRUE, TRUE, 0);
-
- gtk_widget_show_all (GTK_WIDGET(main_vbox));
- gtk_container_add (GTK_CONTAINER(obj), main_vbox);
-}
-
-
-static void
-modest_msg_view_window_finalize (GObject *obj)
-{
- ModestMsgViewWindowPrivate *priv;
-
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
-
- if (priv->other_body != NULL) {
- g_object_unref (priv->other_body);
- priv->other_body = NULL;
- }
-
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-
-
-static gboolean
-on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgViewWindow *self)
-{
- modest_window_save_state (MODEST_WINDOW(self));
- return FALSE;
-}
-
-
-gboolean
-modest_msg_view_window_is_other_body (ModestMsgViewWindow *self)
-{
- ModestMsgViewWindowPrivate *priv = NULL;
-
- g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self), FALSE);
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
-
- return (priv->other_body != NULL);
-}
-
-ModestWindow *
-modest_msg_view_window_new_with_other_body (TnyMsg *msg,
- TnyMimePart *other_body,
- const gchar *modest_account_name,
- const gchar *mailbox, /* ignored */
- const gchar *msg_uid)
-{
- GObject *obj;
- ModestMsgViewWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- GtkActionGroup *action_group;
- GError *error = NULL;
- TnyHeader *header = NULL;
- gchar *subject = NULL;
- ModestDimmingRulesGroup *menu_rules_group = NULL;
- ModestDimmingRulesGroup *toolbar_rules_group = NULL;
- ModestDimmingRulesGroup *clipboard_rules_group = NULL;
-
- g_return_val_if_fail (msg, NULL);
-
- obj = g_object_new(MODEST_TYPE_MSG_VIEW_WINDOW, NULL);
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
-
- priv->msg_uid = g_strdup (msg_uid);
-
- modest_window_set_active_account (MODEST_WINDOW(obj), modest_account_name);
-
- parent_priv->ui_manager = gtk_ui_manager_new();
- action_group = gtk_action_group_new ("ModestMsgViewWindowActions");
- gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
-
- /* Add common actions */
- gtk_action_group_add_actions (action_group,
- modest_action_entries,
- G_N_ELEMENTS (modest_action_entries),
- obj);
- gtk_action_group_add_toggle_actions (action_group,
- modest_toggle_action_entries,
- G_N_ELEMENTS (modest_toggle_action_entries),
- obj);
- gtk_action_group_add_toggle_actions (action_group,
- msg_view_toggle_action_entries,
- G_N_ELEMENTS (msg_view_toggle_action_entries),
- obj);
- gtk_action_group_add_radio_actions (action_group,
- msg_view_zoom_action_entries,
- G_N_ELEMENTS (msg_view_zoom_action_entries),
- 100,
- G_CALLBACK (modest_ui_actions_on_change_zoom),
- obj);
- gtk_ui_manager_insert_action_group (parent_priv->ui_manager, action_group, 0);
- g_object_unref (action_group);
-
-
- /* Load the UI definition */
- gtk_ui_manager_add_ui_from_file (parent_priv->ui_manager,
- MODEST_UIDIR "modest-msg-view-window-ui.xml",
- &error);
- if (error) {
- g_printerr ("modest: could not merge modest-msg-view-window-ui.xml: %s\n", error->message);
- g_error_free (error);
- error = NULL;
- }
- /* ****** */
-
- /* Add accelerators */
- gtk_window_add_accel_group (GTK_WINDOW (obj),
- gtk_ui_manager_get_accel_group (parent_priv->ui_manager));
-
- /* Toolbar / Menubar */
- priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar");
- priv->menubar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/MenuBar");
-
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (priv->toolbar), TRUE);
-
- /* Init window */
- init_window (MODEST_MSG_VIEW_WINDOW(obj), msg, other_body);
- restore_settings (MODEST_WINDOW(obj));
-
- header = tny_msg_get_header (msg);
- if (other_body) {
- gchar *description;
-
- description = modest_tny_mime_part_get_header_value (other_body, "Content-Description");
- if (description) {
- g_strstrip (description);
- subject = description;
- }
- } else {
- if (header)
- subject = tny_header_dup_subject (header);
- }
-
-
- if (subject != NULL)
- gtk_window_set_title (GTK_WINDOW (obj), subject);
- else
- gtk_window_set_title (GTK_WINDOW(obj), "Modest");
- g_free (subject);
-
- if (header)
- g_object_unref (header);
-
- gtk_window_set_icon_from_file (GTK_WINDOW(obj), MODEST_APP_ICON, NULL);
-
- parent_priv->ui_dimming_manager = modest_ui_dimming_manager_new();
-
- menu_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_MENU, FALSE);
- toolbar_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_TOOLBAR, TRUE);
- clipboard_rules_group = modest_dimming_rules_group_new (MODEST_DIMMING_RULES_CLIPBOARD, FALSE);
-
- /* Add common dimming rules */
- modest_dimming_rules_group_add_rules (menu_rules_group,
- modest_msg_view_menu_dimming_entries,
- G_N_ELEMENTS (modest_msg_view_menu_dimming_entries),
- MODEST_WINDOW (obj));
- modest_dimming_rules_group_add_rules (toolbar_rules_group,
- modest_msg_view_toolbar_dimming_entries,
- G_N_ELEMENTS (modest_msg_view_toolbar_dimming_entries),
- MODEST_WINDOW (obj));
- modest_dimming_rules_group_add_rules (clipboard_rules_group,
- modest_msg_view_clipboard_dimming_entries,
- G_N_ELEMENTS (modest_msg_view_clipboard_dimming_entries),
- MODEST_WINDOW (obj));
-
- /* Insert dimming rules group for this window */
- modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, menu_rules_group);
- modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, toolbar_rules_group);
- modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, clipboard_rules_group);
- g_object_unref (menu_rules_group);
- g_object_unref (toolbar_rules_group);
- g_object_unref (clipboard_rules_group);
-
- g_signal_connect (G_OBJECT(obj), "delete-event", G_CALLBACK(on_delete_event), obj);
-
- return MODEST_WINDOW(obj);
-}
-
-ModestWindow *
-modest_msg_view_window_new_for_attachment (TnyMsg *msg,
- const gchar *modest_account_name,
- const gchar *mailbox, /* ignored */
- const gchar *msg_uid)
-{
-
- return modest_msg_view_window_new_with_other_body (msg, NULL, modest_account_name, mailbox, msg_uid);
-
-}
-
-
-TnyMsg*
-modest_msg_view_window_get_message (ModestMsgViewWindow *self)
-{
- GtkWidget *msg_view;
- g_return_val_if_fail (self, NULL);
-
- msg_view = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(self)->msg_view;
-
- return tny_msg_view_get_msg (TNY_MSG_VIEW(msg_view));
-}
-
-const gchar*
-modest_msg_view_window_get_message_uid (ModestMsgViewWindow *self)
-{
- ModestMsgViewWindowPrivate *priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
- TnyMsg *msg;
- TnyHeader *header;
- const gchar *retval = NULL;
-
- msg = tny_msg_view_get_msg (TNY_MSG_VIEW (priv->msg_view));
- msg = modest_msg_view_window_get_message (self);
-
- if (!msg)
- return NULL;
-
- header = tny_msg_get_header (msg);
- g_free (priv->msg_uid);
- if (header) {
- priv->msg_uid = tny_header_dup_uid (header);
- g_object_unref (header);
- }
- g_object_unref (msg);
-
- return priv->msg_uid;
-}
-
-ModestWindow *
-modest_msg_view_window_new_from_uid (const gchar *modest_account_name,
- const gchar *mailbox,
- const gchar *msg_uid)
-{
- /* NOT IMPLEMENTED */
- return NULL;
-}
-
-ModestWindow*
-modest_msg_view_window_new_with_header_model (TnyMsg *msg,
- const gchar *modest_account_name,
- const gchar *mailbox, /*ignored*/
- const gchar *msg_uid,
- GtkTreeModel *model,
- GtkTreeRowReference *row_reference)
-{
- /* Currently we simply redirect to new constructor. It should store a
- reference to the header list model, to enable next/prev message
- actions */
- g_debug ("partially implemented %s", __FUNCTION__);
-
- return modest_msg_view_window_new_for_attachment (msg, modest_account_name, NULL, msg_uid);
-}
-
-
-gboolean
-modest_msg_view_window_select_next_message (ModestMsgViewWindow *window)
-{
- g_warning ("not implemented %s", __FUNCTION__);
- return FALSE;
-}
-
-gboolean
-modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window)
-{
- g_warning ("not implemented %s", __FUNCTION__);
- return FALSE;
-}
-
-void
-modest_msg_view_window_view_attachment (ModestMsgViewWindow *window, TnyMimePart *mime_part)
-{
- g_warning ("not implemented %s", __FUNCTION__);
-}
-
-void
-modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *mime_parts)
-{
- g_warning ("not implemented %s", __FUNCTION__);
-}
-void
-modest_msg_view_window_remove_attachments (ModestMsgViewWindow *window, gboolean get_all)
-{
- g_warning ("not implemented %s", __FUNCTION__);
-}
-
-TnyHeader *
-modest_msg_view_window_get_header (ModestMsgViewWindow *self)
-{
- TnyMsg *msg;
- TnyHeader *header = NULL;
-
- msg = modest_msg_view_window_get_message (self);
- if (msg) {
- header = tny_msg_get_header (msg);
- g_object_unref (msg);
- }
- return header;
-}
-
-TnyFolderType
-modest_msg_view_window_get_folder_type (ModestMsgViewWindow *window)
-{
- ModestMsgViewWindowPrivate *priv;
- TnyMsg *msg;
- TnyFolderType folder_type;
-
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
-
- folder_type = TNY_FOLDER_TYPE_UNKNOWN;
-
- msg = tny_msg_view_get_msg (TNY_MSG_VIEW (priv->msg_view));
- if (msg) {
- TnyFolder *folder;
-
- folder = tny_msg_get_folder (msg);
- if (folder) {
- folder_type = tny_folder_get_folder_type (folder);
- g_object_unref (folder);
- }
- g_object_unref (msg);
- }
-
- return folder_type;
-}
-
-/* NOT IMPLEMENTED METHODS */
-
-gboolean
-modest_msg_view_window_last_message_selected (ModestMsgViewWindow *window)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return TRUE;
-}
-
-gboolean
-modest_msg_view_window_first_message_selected (ModestMsgViewWindow *window)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return TRUE;
-}
-
-gboolean
-modest_msg_view_window_transfer_mode_enabled (ModestMsgViewWindow *self)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return FALSE;
-}
-
-gboolean
-modest_msg_view_window_toolbar_on_transfer_mode (ModestMsgViewWindow *self)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return FALSE;
-}
-
-
-TnyList *
-modest_msg_view_window_get_attachments (ModestMsgViewWindow *win)
-{
- TnyList *result;
-
- result = tny_simple_list_new ();
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return result;
-}
-
-gboolean
-modest_msg_view_window_is_search_result (ModestMsgViewWindow *window)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return FALSE;
-}
-
-gboolean
-modest_msg_view_window_has_headers_model (ModestMsgViewWindow *window)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return FALSE;
-}
-
-static void
-modest_msg_view_window_toggle_find_toolbar (GtkToggleAction *toggle,
- gpointer data)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return FALSE;
-}
-
-void
-modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self)
-{
- modest_ui_actions_on_add_to_contacts (NULL, MODEST_WINDOW (self));
-}
-
-void
-modest_msg_view_window_fetch_images (ModestMsgViewWindow *self)
-{
- ModestMsgViewWindowPrivate *priv;
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
-
- modest_msg_view_request_fetch_images (MODEST_MSG_VIEW (priv->msg_view));
-}
-
-gboolean
-modest_msg_view_window_has_blocked_external_images (ModestMsgViewWindow *self)
-{
- ModestMsgViewWindowPrivate *priv;
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
-
- g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (self), FALSE);
-
- return modest_msg_view_has_blocked_external_images (MODEST_MSG_VIEW (priv->msg_view));
-}
-
-void
-modest_msg_view_window_reload (ModestMsgViewWindow *self)
-{
- /* Not implemented */
- return;
-}
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <libgnomevfs/gnome-vfs-mime.h>
-#include <libgnomeui/gnome-icon-lookup.h>
-#include <tny-gnome-device.h>
-#include <tny-camel-imap-store-account.h>
-#include <tny-camel-pop-store-account.h>
-#include <tny-simple-list.h>
-#include <tny-error.h>
-#include <tny-merge-folder.h>
-#include "modest-platform.h"
-#include "modest-mail-operation-queue.h"
-#include "modest-runtime.h"
-#include "gnome/modest-gnome-global-settings-dialog.h"
-#include "widgets/modest-default-account-settings-dialog.h"
-#include "gnome/modest-account-assistant.h"
-#include "gnome/modest-gnome-sort-dialog.h"
-#include "widgets/modest-details-dialog.h"
-#include "widgets/modest-main-window.h"
-
-gboolean
-modest_platform_init (int argc, char *argv[])
-{
- return TRUE; /* nothing to do */
-}
-
-
-gboolean modest_platform_uninit (void)
-{
- return TRUE; /*nothing to do */
-}
-
-
-TnyDevice*
-modest_platform_get_new_device (void)
-{
- return TNY_DEVICE (tny_gnome_device_new ());
-}
-
-
-gchar*
-modest_platform_get_file_icon_name (const gchar* name, const gchar* mime_type,
- gchar **effective_mime_type)
-{
- GString *mime_str = NULL;
- gchar *icon_name = NULL;
- gchar *uri;
- const static gchar* octet_stream = "application/octet-stream";
-
- g_return_val_if_fail (name || mime_type, NULL);
-
- if (!mime_type || g_ascii_strcasecmp (mime_type, octet_stream))
- mime_str = g_string_new(gnome_vfs_mime_type_from_name_or_default
- (name, "application/octet-stream"));
- else {
- mime_str = g_string_new (mime_type);
- g_string_ascii_down (mime_str);
- }
-
- uri = g_strconcat ("file:///", name ? name : "dummy", NULL);
- icon_name = gnome_icon_lookup (gtk_icon_theme_get_default(), NULL,
- uri, NULL, NULL, mime_str->str, 0, 0);
- g_free (uri);
-
- if (effective_mime_type)
- *effective_mime_type = g_string_free (mime_str, FALSE);
- else
- g_string_free (mime_str, TRUE);
-
- return icon_name;
-}
-
-gboolean
-modest_platform_activate_uri (const gchar *uri)
-{
- g_warning ("NOT IMPLEMENTED");;
- return FALSE;
-}
-
-gboolean
-modest_platform_activate_file (const gchar *path, const gchar *mime_type)
-{
- g_warning ("NOT IMPLEMENTED");;
- return FALSE;
-}
-
-gboolean
-modest_platform_show_uri_popup (const gchar *uri)
-{
- g_warning ("NOT IMPLEMENTED");;
- return FALSE;
-}
-
-GdkPixbuf*
-modest_platform_get_icon (const gchar *name, guint icon_size)
-{
- GError *err = NULL;
- GdkPixbuf* pixbuf;
-
- g_return_val_if_fail (name, NULL);
-
- pixbuf = gdk_pixbuf_new_from_file (name, &err);
-
- if (!pixbuf) {
-/* g_printerr ("modest: error while loading icon '%s': %s\n", */
-/* name, err->message); */
- g_error_free (err);
- err = NULL;
-
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), name, icon_size, 0, &err);
- if (!pixbuf) {
- g_error_free (err);
- }
- }
-
- return pixbuf;
-}
-
-
-const gchar*
-modest_platform_get_app_name (void)
-{
- return ("Modest");
-}
-
-gint
-modest_platform_run_new_folder_dialog (GtkWindow *parent_window,
- TnyFolderStore *suggested_parent,
- gchar *suggested_name,
- gchar **folder_name,
- TnyFolderStore **parent_folder)
-{
- GtkWidget *dialog, *entry;
- gint result;
-
- /* Ask the user for the folder name */
- dialog = gtk_dialog_new_with_buttons (_("New Folder Name"),
- parent_window,
- GTK_DIALOG_MODAL,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_REJECT,
- GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT,
- NULL);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox),
- gtk_label_new (_("Please enter a name for the new folder")),
- FALSE, FALSE, 0);
-
- entry = gtk_entry_new_with_max_length (40);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox),
- entry,
- TRUE, FALSE, 0);
-
- gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
-
- result = gtk_dialog_run (GTK_DIALOG(dialog));
- if (result == GTK_RESPONSE_ACCEPT)
- *folder_name = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
-
- gtk_widget_destroy (dialog);
-
- if (parent_folder != NULL) {
- parent_folder = suggested_parent?g_object_ref (suggested_parent): NULL;
- }
-
- return result;
-}
-
-
-gint
-modest_platform_run_confirmation_dialog (GtkWindow *parent_window,
- const gchar *msg)
-{
- gint response;
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (parent_window,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_OK_CANCEL,
- msg);
-
- response = gtk_dialog_run (GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
-
- return response;
-}
-
-gint
-modest_platform_run_confirmation_dialog_with_buttons (GtkWindow *parent_window,
- const gchar *message,
- const gchar *button_accept,
- const gchar *button_cancel)
-{
- gint response;
- GtkWidget *dialog;
-
- dialog = gtk_dialog_new_with_buttons (message,
- parent_window,
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- button_accept,
- GTK_RESPONSE_ACCEPT,
- button_cancel,
- GTK_RESPONSE_CANCEL,
- NULL);
-
- response = gtk_dialog_run (GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
-
- return response;
-}
-
-void
-modest_platform_run_information_dialog (GtkWindow *parent_window,
- const gchar *message,
- gboolean block)
-{
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (parent_window,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- message);
-
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
-}
-
-gboolean modest_platform_connect_and_wait (GtkWindow *parent_window, TnyAccount *account)
-{
- /* TODO: Do something with network-manager?
- Otherwise, maybe it is safe to assume that we would already be online if we could be. */
- return TRUE;
-}
-
-gboolean modest_platform_connect_and_wait_if_network_account (GtkWindow *parent_window, TnyAccount *account)
-{
- /* TODO: Do something with network-manager?
- Otherwise, maybe it is safe to assume that we would already be online if we could be. */
- return TRUE;
-}
-
-
-void
-modest_platform_connect_if_remote_and_perform (GtkWindow *parent_window,
- gboolean force,
- TnyFolderStore *folder_store,
- ModestConnectedPerformer callback,
- gpointer user_data)
-{
- TnyAccount *account = NULL;
-
- if (!folder_store ||
- (TNY_IS_MERGE_FOLDER (folder_store) &&
- (tny_folder_get_folder_type (TNY_FOLDER(folder_store)) == TNY_FOLDER_TYPE_OUTBOX))) {
-
- /* We promise to instantly perform the callback, so ... */
- if (callback) {
- GError *error = NULL;
- g_set_error (&error, TNY_ERROR_DOMAIN, TNY_SERVICE_ERROR_UNKNOWN,
- "Unable to move or not found folder");
- callback (FALSE, error, parent_window, NULL, user_data);
- g_error_free (error);
- }
- return;
-
- } else if (TNY_IS_FOLDER (folder_store)) {
- /* Get the folder's parent account: */
- account = tny_folder_get_account(TNY_FOLDER (folder_store));
- } else if (TNY_IS_ACCOUNT (folder_store)) {
- /* Use the folder store as an account: */
- account = TNY_ACCOUNT (folder_store);
- }
-
- if (tny_account_get_account_type (account) == TNY_ACCOUNT_TYPE_STORE) {
- if (!TNY_IS_CAMEL_POP_STORE_ACCOUNT (account) &&
- !TNY_IS_CAMEL_IMAP_STORE_ACCOUNT (account)) {
-
- /* This IS a local account like a maildir account, which does not require
- * a connection. (original comment had a vague assumption in its language
- * usage. There's no assuming needed, this IS what it IS: a local account), */
-
- /* We promise to instantly perform the callback, so ... */
- if (callback) {
- callback (FALSE, NULL, parent_window, account, user_data);
- }
-
- return;
- }
- }
-
- modest_platform_connect_and_perform (parent_window, force, account, callback, user_data);
-
- return;
-}
-
-
-gboolean modest_platform_set_update_interval (guint minutes)
-{
- /* TODO. */
- return FALSE;
-}
-
-GtkWidget *
-modest_platform_create_sort_dialog (GtkWindow *parent_window)
-{
- return modest_gnome_sort_dialog_new (parent_window);
-}
-
-GtkWidget *
-modest_platform_get_global_settings_dialog ()
-{
- return modest_gnome_global_settings_dialog_new ();
-}
-
-void
-modest_platform_push_email_notification(void)
-{
- /* TODO: implement this */
- g_print ("--------------- NEW MESSAGE ARRIVED ---------------\n");
-}
-
-void
-modest_platform_on_new_headers_received (GList *URI_list,
- gboolean show_visual)
-{
- /* TODO: implement this */
- g_print ("--------------- NEW MESSAGE ARRIVED ---------------\n");
-}
-
-
-
-void
-modest_platform_show_help (GtkWindow *parent_window, const gchar *help_id)
-{
- return; /* TODO */
-}
-
-void
-modest_platform_information_banner (GtkWidget *widget,
- const gchar *icon_name,
- const gchar *text)
-{
- g_warning ("NOT IMPLEMENTED");;
-}
-
-void
-modest_platform_system_banner (GtkWidget *widget,
- const gchar *icon_name,
- const gchar *text)
-{
- g_warning ("NOT IMPLEMENTED");;
-}
-
-void
-modest_platform_information_banner_with_timeout (GtkWidget *widget,
- const gchar *icon_name,
- const gchar *text,
- gint timeout)
-{
- g_warning ("NOT IMPLEMENTED");;
-}
-
-GtkWidget *
-modest_platform_animation_banner (GtkWidget *widget,
- const gchar *icon_name,
- const gchar *text)
-{
- g_warning ("NOT IMPLEMENTED");
- return NULL;
-}
-
-
-void
-modest_platform_show_search_messages (GtkWindow *parent_window)
-{
- g_warning ("NOT IMPLEMENTED");;
-}
-
-GtkWidget *
-modest_platform_create_folder_view (TnyFolderStoreQuery *query)
-{
- GtkWidget *widget = modest_folder_view_new (query);
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget), FALSE);
- /* Show all accounts by default */
- modest_folder_view_set_style (MODEST_FOLDER_VIEW (widget),
- MODEST_FOLDER_VIEW_STYLE_SHOW_ALL);
-
- return widget;
-}
-
-gboolean
-modest_platform_run_alert_dialog (const gchar* prompt,
- gboolean is_question)
-{
- /* TODO */
- return TRUE;
-}
-
-void
-modest_platform_connect_and_perform (GtkWindow *parent_window,
- gboolean force,
- TnyAccount *account,
- ModestConnectedPerformer callback,
- gpointer user_data)
-{
- if (callback)
- callback (FALSE, NULL, parent_window, account, user_data);
-}
-
-void
-modest_platform_double_connect_and_perform (GtkWindow *parent_window,
- gboolean force,
- TnyFolderStore *folder_store,
- DoubleConnectionInfo *connect_info)
-{
- if (connect_info->callback)
- connect_info->callback (FALSE, NULL, parent_window, TNY_ACCOUNT (folder_store), connect_info->data);
-}
-
-void
-modest_platform_connect_and_perform_if_network_account (GtkWindow *parent_window,
- gboolean force,
- TnyAccount *account,
- ModestConnectedPerformer callback,
- gpointer user_data)
-{
- if (callback)
- callback (FALSE, NULL, parent_window, account, user_data);
-}
-
-void
-modest_platform_connect_and_perform_if_network_folderstore (GtkWindow *parent_window,
- TnyFolderStore *folder_store,
- ModestConnectedPerformer callback,
- gpointer user_data)
-{
- if (callback)
- callback (FALSE, NULL, parent_window, NULL, user_data);
-}
-
-
-void
-modest_platform_remove_new_mail_notifications (gboolean only_visuals)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
-}
-
-gboolean
-modest_platform_check_and_wait_for_account_is_online(TnyAccount *account)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return TRUE;
-}
-
-gboolean
-modest_platform_run_certificate_confirmation_dialog (const gchar* server_name,
- const gchar *certificate)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return TRUE;
-}
-
-gint
-modest_platform_run_rename_folder_dialog (GtkWindow *parent_window,
- TnyFolderStore *parent_folder,
- const gchar *suggested_name,
- gchar **folder_name)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
- return GTK_RESPONSE_CANCEL;
-}
-
-void
-modest_platform_show_addressbook (GtkWindow *parent_window)
-{
- g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
-}
-
-GtkWidget *
-modest_platform_get_account_settings_dialog (ModestAccountSettings *settings)
-{
- ModestAccountSettingsDialog *dialog = modest_default_account_settings_dialog_new ();
-
- modest_account_settings_dialog_load_settings (dialog, settings);
- return GTK_WIDGET (dialog);
-}
-
-GtkWidget *
-modest_platform_get_account_settings_wizard (void)
-{
- GtkWidget *widget = modest_account_assistant_new (modest_runtime_get_account_mgr ());
- return widget;
-}
-
-
-
-gboolean modest_platform_check_memory_low (ModestWindow *win,
- gboolean visuals)
-{
- g_debug ("%s not implemented", __FUNCTION__);
- return FALSE;
-}
-
-void
-modest_platform_run_folder_details_dialog (GtkWindow *parent_window,
- TnyFolder *folder)
-{
- GtkWidget *dialog;
-
- /* Create dialog */
- dialog = modest_details_dialog_new_with_folder (parent_window, folder);
-
- /* Run dialog */
- modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (dialog),
- parent_window);
- gtk_widget_show_all (dialog);
-
- g_signal_connect_swapped (dialog, "response",
- G_CALLBACK (gtk_widget_destroy),
- dialog);
-}
-
-void
-modest_platform_run_header_details_dialog (GtkWindow *parent_window,
- TnyHeader *header,
- gboolean async_get_size,
- TnyMsg *msg)
-{
- GtkWidget *dialog;
-
- /* Create dialog */
- dialog = modest_details_dialog_new_with_header (parent_window, header, TRUE);
-
- /* Run dialog */
- modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (dialog),
- parent_window);
- gtk_widget_show_all (dialog);
-
- g_signal_connect_swapped (dialog, "response",
- G_CALLBACK (gtk_widget_destroy),
- dialog);
-}
-
-GtkWidget*
-modest_platform_create_move_to_dialog (GtkWindow *parent_window,
- GtkWidget **folder_view)
-{
- GtkWidget *dialog, *folder_view_container;
-
- dialog = gtk_dialog_new_with_buttons (_("mcen_ti_moveto_folders_title"),
- GTK_WINDOW (parent_window),
- GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR |
- GTK_DIALOG_DESTROY_WITH_PARENT,
- _("mcen_bd_dialog_ok"), GTK_RESPONSE_OK,
- _("mcen_bd_new"), MODEST_GTK_RESPONSE_NEW_FOLDER,
- _("mcen_bd_dialog_cancel"), GTK_RESPONSE_CANCEL,
- NULL);
-
- /* Create folder view */
- *folder_view = modest_platform_create_folder_view (NULL);
-
- /* Create pannable and add it to the dialog */
- folder_view_container = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (folder_view_container),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), folder_view_container);
- gtk_container_add (GTK_CONTAINER (folder_view_container), *folder_view);
-
- gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 300);
-
- return dialog;
-}
-
-TnyList *
-modest_platform_get_list_to_move (ModestWindow *window)
-{
- TnyList *list = NULL;
-
- /* If it's a main window then it could be that we're moving a
- folder or a set of messages */
- if (MODEST_IS_MAIN_WINDOW (window)) {
- ModestHeaderView *header_view = NULL;
- ModestFolderView *folder_view = NULL;
-
- folder_view = (ModestFolderView *)
- modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
- header_view = (ModestHeaderView *)
- modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
-
- /* Get folder or messages to transfer */
- if (gtk_widget_is_focus (GTK_WIDGET (folder_view))) {
- TnyFolderStore *src_folder;
-
- src_folder = modest_folder_view_get_selected (folder_view);
- if (src_folder) {
- list = tny_simple_list_new ();
- tny_list_prepend (list, G_OBJECT (src_folder));
- g_object_unref (src_folder);
- }
- } else if (gtk_widget_is_focus (GTK_WIDGET(header_view))) {
- list = modest_header_view_get_selected_headers(header_view);
- }
- } else if (MODEST_IS_MSG_VIEW_WINDOW (window)) {
- TnyHeader *header = NULL;
-
- /* We simply return the currently viewed message */
- header = modest_msg_view_window_get_header (MODEST_MSG_VIEW_WINDOW (window));
- if (header) {
- list = tny_simple_list_new ();
- tny_list_prepend (list, G_OBJECT (header));
- g_object_unref (header);
- }
- } else {
- g_return_val_if_reached (NULL);
- }
-
- return list;
-}
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <widgets/modest-combo-box.h>
-#include "modest-store-widget.h"
-#include "modest-runtime.h"
-#include <string.h>
-
-/* 'private'/'protected' functions */
-static void modest_store_widget_class_init (ModestStoreWidgetClass *klass);
-static void modest_store_widget_init (ModestStoreWidget *obj);
-static void modest_store_widget_finalize (GObject *obj);
-/* list my signals */
-enum {
- DATA_CHANGED_SIGNAL,
- LAST_SIGNAL
-};
-
-typedef struct _ModestStoreWidgetPrivate ModestStoreWidgetPrivate;
-struct _ModestStoreWidgetPrivate {
-
- GtkWidget *servername;
- GtkWidget *username;
-
- ModestPairList *security_protos;
- GtkWidget *security;
-
- ModestPairList *auth_protos;
- GtkWidget *auth;
-
- GtkWidget *chooser;
-
- ModestProtocolType proto;
-};
-#define MODEST_STORE_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_STORE_WIDGET, \
- ModestStoreWidgetPrivate))
-/* globals */
-static GtkContainerClass *parent_class = NULL;
-
-/* uncomment the following if you have defined any signals */
-static guint signals[LAST_SIGNAL] = {0};
-
-GType
-modest_store_widget_get_type (void)
-{
- static GType my_type = 0;
- if (!my_type) {
- static const GTypeInfo my_info = {
- sizeof(ModestStoreWidgetClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc) modest_store_widget_class_init,
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof(ModestStoreWidget),
- 1, /* n_preallocs */
- (GInstanceInitFunc) modest_store_widget_init,
- NULL
- };
- my_type = g_type_register_static (GTK_TYPE_VBOX,
- "ModestStoreWidget",
- &my_info, 0);
- }
- return my_type;
-}
-
-static void
-modest_store_widget_class_init (ModestStoreWidgetClass *klass)
-{
- GObjectClass *gobject_class;
- gobject_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_peek_parent (klass);
- gobject_class->finalize = modest_store_widget_finalize;
-
- g_type_class_add_private (gobject_class, sizeof(ModestStoreWidgetPrivate));
-
- /* signal definitions go here, e.g.: */
- signals[DATA_CHANGED_SIGNAL] =
- g_signal_new ("data_changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET(ModestStoreWidgetClass, data_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-modest_store_widget_init (ModestStoreWidget *obj)
-{
- ModestStoreWidgetPrivate *priv;
-
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(obj);
- priv->proto = MODEST_PROTOCOL_REGISTRY_TYPE_INVALID;
-}
-
-
-
-static GtkWidget *
-maildir_configuration (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
- GtkWidget *label, *box, *hbox;
-
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
- box = gtk_vbox_new (FALSE, 6);
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL(label),
- _("<b>Maildir configuration</b>"));
- gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 6);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL(label),
- _("Please select the path to your Maildir below"));
- gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 6);
-
- label = gtk_label_new (_("Path:"));
-
- priv->chooser =
- gtk_file_chooser_button_new (_("(none)"),
- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
-
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX(hbox), priv->chooser, FALSE, FALSE, 6);
-
- gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 6);
-
- return box;
-}
-
-
-static GtkWidget*
-mbox_configuration (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
- GtkWidget *label, *box, *hbox;
-
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
- box = gtk_vbox_new (FALSE, 6);
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL(label),
- _("<b>Mbox configuration</b>"));
- gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 6);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL(label),
- _("Please select your mbox file below"));
- gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 6);
-
- label = gtk_label_new (_("mbox:"));
-
- priv->chooser =
- gtk_file_chooser_button_new (_("(none)"),
- GTK_FILE_CHOOSER_ACTION_OPEN);
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX(hbox), priv->chooser, FALSE, FALSE, 6);
-
- gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 6);
-
- return box;
-}
-
-static void
-on_entry_changed (GtkEntry *entry, gpointer user_data)
-{
- g_signal_emit (MODEST_STORE_WIDGET (user_data), signals[DATA_CHANGED_SIGNAL], 0);
-}
-
-static GtkWidget*
-imap_pop_configuration (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
- GtkWidget *label, *box, *hbox;
-
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
- box = gtk_vbox_new (FALSE, 6);
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL(label),_("<b>Server configuration</b>"));
- gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 6);
-
- hbox = gtk_hbox_new (FALSE, 6);
- label = gtk_label_new (_("Username:"));
- if (!priv->username)
- priv->username = gtk_entry_new_with_max_length (40);
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(hbox), priv->username,FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 0);
-
- hbox = gtk_hbox_new (FALSE, 6);
- label = gtk_label_new (_("Server:"));
- if (!priv->servername)
- priv->servername = gtk_entry_new_with_max_length (40);
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(hbox), priv->servername,FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 0);
-
- label = gtk_label_new(NULL);
- gtk_label_set_markup (GTK_LABEL(label),_("<b>Security</b>"));
- gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 0);
-
- /* Note: This ModestPairList* must exist for as long as the combo
- * that uses it, because the ModestComboBox uses the ID opaquely,
- * so it can't know how to manage its memory. */
- priv->security_protos = modest_protocol_info_get_connection_protocol_pair_list ();
-
- priv->security = modest_combo_box_new (priv->security_protos, g_str_equal);
-
- hbox = gtk_hbox_new (FALSE, 6);
- label = gtk_label_new(NULL);
- gtk_label_set_text (GTK_LABEL(label),_("Connection type:"));
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(hbox), priv->security, FALSE, FALSE,0);
- gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 0);
-
- hbox = gtk_hbox_new (FALSE, 6);
- label = gtk_label_new(NULL);
-
- gtk_label_set_text (GTK_LABEL(label),_("Authentication:"));
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 6);
-
- /* Note: This ModestPairList* must exist for as long as the combo
- * that uses it, because the ModestComboBox uses the ID opaquely,
- * so it can't know how to manage its memory. */
- priv->auth_protos = modest_protocol_info_get_auth_protocol_pair_list ();
- priv->auth = modest_combo_box_new (priv->auth_protos, g_str_equal);
-
- gtk_box_pack_start (GTK_BOX(hbox), priv->auth, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 0);
-
- /* Handle entry modifications */
- g_signal_connect (priv->username, "changed", G_CALLBACK (on_entry_changed), self);
- g_signal_connect (priv->servername, "changed", G_CALLBACK (on_entry_changed), self);
-
- return box;
-}
-
-
-static void
-modest_store_widget_finalize (GObject *obj)
-{
- ModestStoreWidgetPrivate *priv = MODEST_STORE_WIDGET_GET_PRIVATE(obj);
-
- /* These had to stay alive for as long as the comboboxes that used them: */
- modest_pair_list_free (priv->security_protos);
- modest_pair_list_free (priv->auth_protos);
-
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-
-
-GtkWidget*
-modest_store_widget_new (ModestProtocolType proto)
-{
- GObject *obj;
- GtkWidget *w;
- ModestStoreWidget *self;
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (proto, NULL);
-
- obj = g_object_new(MODEST_TYPE_STORE_WIDGET, NULL);
- self = MODEST_STORE_WIDGET(obj);
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
-
- priv->proto = proto;
-
- if (proto == MODEST_PROTOCOLS_STORE_POP || proto == MODEST_PROTOCOLS_STORE_IMAP)
- w = imap_pop_configuration (self);
- else if (proto == MODEST_PROTOCOLS_STORE_MAILDIR)
- w = maildir_configuration (self);
- else if (proto == MODEST_PROTOCOLS_STORE_MBOX)
- w = mbox_configuration (self);
- else
- w = gtk_label_new ("");
-
- gtk_widget_show_all (w);
- gtk_box_pack_start (GTK_BOX(self), w, FALSE, FALSE, 2);
-
- return GTK_WIDGET(self);
-}
-
-const gchar*
-modest_store_widget_get_username (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (self, NULL);
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
-
- if (GTK_IS_ENTRY(priv->username))
- return gtk_entry_get_text (GTK_ENTRY(priv->username));
- else
- return NULL;
-}
-
-const gchar*
-modest_store_widget_get_servername (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (self, NULL);
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
-
- if (GTK_IS_ENTRY(priv->servername))
- return gtk_entry_get_text (GTK_ENTRY(priv->servername));
- else
- return NULL;
-}
-
-
-ModestProtocolType
-modest_store_widget_get_proto (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (self, MODEST_PROTOCOL_REGISTRY_TYPE_INVALID);
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
-
- return priv->proto;
-}
-
-
-gchar *
-modest_store_widget_get_path (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (self, NULL);
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
-
- if (GTK_IS_FILE_CHOOSER(priv->chooser))
- return gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(priv->chooser));
- else
- return NULL;
-}
-
-static ModestProtocolType
-get_value_from_combo (GtkWidget *combo)
-{
- gchar *chosen;
- ModestProtocol *proto;
- const gchar *tag;
-
- g_return_val_if_fail (combo, MODEST_PROTOCOL_REGISTRY_TYPE_INVALID);
-
- chosen = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
- tag = MODEST_PROTOCOL_REGISTRY_TRANSPORT_STORE_PROTOCOLS;
- proto = modest_protocol_registry_get_protocol_by_name (modest_runtime_get_protocol_registry (),
- tag,
- chosen);
-
- return modest_protocol_get_type_id (proto);
-
-}
-
-ModestProtocolType
-modest_store_widget_get_auth (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (self, MODEST_PROTOCOLS_AUTH_NONE);
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
-
- return get_value_from_combo (priv->auth);
-}
-
-ModestProtocolType
-modest_store_widget_get_security (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (self, MODEST_PROTOCOLS_CONNECTION_NONE);
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
-
- return get_value_from_combo (priv->security);
-}
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MODEST_STORE_WIDGET_H__
-#define __MODEST_STORE_WIDGET_H__
-
-#include <gtk/gtk.h>
-#include "modest-protocol.h"
-
-G_BEGIN_DECLS
-
-/* convenience macros */
-#define MODEST_TYPE_STORE_WIDGET (modest_store_widget_get_type())
-#define MODEST_STORE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_STORE_WIDGET,ModestStoreWidget))
-#define MODEST_STORE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_STORE_WIDGET,GtkContainer))
-#define MODEST_IS_STORE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_STORE_WIDGET))
-#define MODEST_IS_STORE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_STORE_WIDGET))
-#define MODEST_STORE_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_STORE_WIDGET,ModestStoreWidgetClass))
-
-typedef struct _ModestStoreWidget ModestStoreWidget;
-typedef struct _ModestStoreWidgetClass ModestStoreWidgetClass;
-
-struct _ModestStoreWidget {
- GtkVBox parent;
- /* insert public members, if any */
-};
-
-struct _ModestStoreWidgetClass {
- GtkVBoxClass parent_class;
-
- void (* data_changed) (ModestStoreWidget* obj);
-};
-
-/* member functions */
-GType modest_store_widget_get_type (void) G_GNUC_CONST;
-
-GtkWidget* modest_store_widget_new (ModestProtocolType proto);
-
-const gchar* modest_store_widget_get_username (ModestStoreWidget *self);
-const gchar* modest_store_widget_get_servername (ModestStoreWidget *self);
-gchar * modest_store_widget_get_path (ModestStoreWidget *self);
-ModestProtocolType modest_store_widget_get_proto (ModestStoreWidget *self);
-ModestProtocolType modest_store_widget_get_auth (ModestStoreWidget *self);
-ModestProtocolType modest_store_widget_get_security (ModestStoreWidget *self);
-
-G_END_DECLS
-
-#endif /* __MODEST_STORE_WIDGET_H__ */
-
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <widgets/modest-combo-box.h>
-#include "modest-transport-widget.h"
-#include <string.h>
-
-
-
-/* 'private'/'protected' functions */
-static void modest_transport_widget_class_init (ModestTransportWidgetClass *klass);
-static void modest_transport_widget_init (ModestTransportWidget *obj);
-static void modest_transport_widget_finalize (GObject *obj);
-/* list my signals */
-enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
- LAST_SIGNAL
-};
-
-typedef struct _ModestTransportWidgetPrivate ModestTransportWidgetPrivate;
-struct _ModestTransportWidgetPrivate {
- ModestProtocolType proto;
- GtkWidget *servername;
- GtkWidget *username;
- GtkWidget *auth;
- GtkWidget *remember_pwd;
-
- ModestPairList *transport_store_protos;
- ModestPairList *auth_protos;
-};
-#define MODEST_TRANSPORT_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_TRANSPORT_WIDGET, \
- ModestTransportWidgetPrivate))
-/* globals */
-static GtkContainerClass *parent_class = NULL;
-
-/* uncomment the following if you have defined any signals */
-/* static guint signals[LAST_SIGNAL] = {0}; */
-
-GType
-modest_transport_widget_get_type (void)
-{
- static GType my_type = 0;
- if (!my_type) {
- static const GTypeInfo my_info = {
- sizeof(ModestTransportWidgetClass),
- NULL, /* base init */
- NULL, /* base finalize */
- (GClassInitFunc) modest_transport_widget_class_init,
- NULL, /* class finalize */
- NULL, /* class data */
- sizeof(ModestTransportWidget),
- 1, /* n_preallocs */
- (GInstanceInitFunc) modest_transport_widget_init,
- NULL
- };
- my_type = g_type_register_static (GTK_TYPE_VBOX,
- "ModestTransportWidget",
- &my_info, 0);
- }
- return my_type;
-}
-
-static void
-modest_transport_widget_class_init (ModestTransportWidgetClass *klass)
-{
- GObjectClass *gobject_class;
- gobject_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_peek_parent (klass);
- gobject_class->finalize = modest_transport_widget_finalize;
-
- g_type_class_add_private (gobject_class, sizeof(ModestTransportWidgetPrivate));
-
- /* signal definitions go here, e.g.: */
-/* signals[MY_SIGNAL_1] = */
-/* g_signal_new ("my_signal_1",....); */
-/* signals[MY_SIGNAL_2] = */
-/* g_signal_new ("my_signal_2",....); */
-/* etc. */
-}
-
-static void
-modest_transport_widget_init (ModestTransportWidget *obj)
-{
- ModestTransportWidgetPrivate *priv;
- priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(obj);
-
- priv->proto = MODEST_PROTOCOL_REGISTRY_TYPE_INVALID;
-}
-
-static void
-modest_transport_widget_finalize (GObject *obj)
-{
- ModestTransportWidgetPrivate *priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(obj);
-
- /* These had to stay alive for as long as the comboboxes that used them: */
- modest_pair_list_free (priv->transport_store_protos);
-
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-static void
-on_button_toggled (GtkToggleButton *button, gpointer user_data)
-{
- ModestTransportWidgetPrivate *priv;
-
- priv = (ModestTransportWidgetPrivate *) user_data;
-
- if (gtk_toggle_button_get_active (button))
- gtk_widget_set_sensitive (gtk_widget_get_parent (priv->username), TRUE);
- else
- gtk_widget_set_sensitive (gtk_widget_get_parent (priv->username), FALSE);
-}
-
-
-static GtkWidget*
-smtp_configuration (ModestTransportWidget *self)
-{
- ModestTransportWidgetPrivate *priv;
- GtkWidget *label, *box, *hbox, *combo;
- const gchar *tag = MODEST_PROTOCOL_REGISTRY_TRANSPORT_PROTOCOLS;
-
- priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
- box = gtk_vbox_new (FALSE, 6);
-
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL(label),
- _("<b>SMTP configuration</b>"));
- gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 6);
-
- priv->servername = gtk_entry_new_with_max_length (40);
- priv->username = gtk_entry_new_with_max_length (40);
-
- /* Servername */
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX(hbox), gtk_label_new (_("Servername: ")),
- FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX(hbox), priv->servername, TRUE, TRUE, 6);
- gtk_box_pack_start (GTK_BOX(box), hbox, TRUE, TRUE, 6);
-
- /* Auth */
- priv->auth = gtk_check_button_new_with_label (_("Requires authentication"));
- gtk_box_pack_start (GTK_BOX(box), priv->auth, TRUE, FALSE, 6);
-
- g_signal_connect (priv->auth, "toggled", G_CALLBACK (on_button_toggled), priv);
-
- /* Username */
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX(hbox), gtk_label_new (_("Username: ")),
- FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX(hbox), priv->username, TRUE, TRUE, 6);
- gtk_widget_set_sensitive (hbox, FALSE);
- gtk_box_pack_start (GTK_BOX(box), hbox, TRUE, TRUE, 6);
-
- /* Security */
- label = gtk_label_new(NULL);
- gtk_label_set_markup (GTK_LABEL(label),_("<b>Security</b>"));
- gtk_box_pack_start (GTK_BOX(box), label, FALSE, FALSE, 0);
-
- hbox = gtk_hbox_new (FALSE, 6);
- label = gtk_label_new(NULL);
- gtk_label_set_text (GTK_LABEL(label),_("Connection type:"));
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
-
- /* Note: This ModestPairList* must exist for as long as the combo
- * that uses it, because the ModestComboBox uses the ID opaquely,
- * so it can't know how to manage its memory. */
- priv->transport_store_protos = modest_gnome_utils_get_protocols_pair_list (tag);
- combo = modest_combo_box_new (priv->transport_store_protos, g_str_equal);
-
- gtk_box_pack_start (GTK_BOX(hbox), combo, FALSE, FALSE,0);
- gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 0);
-
- hbox = gtk_hbox_new (FALSE, 6);
- label = gtk_label_new(NULL);
-
- gtk_label_set_text (GTK_LABEL(label),_("Authentication:"));
- gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 6);
-
- /* Note: This ModestPairList* must exist for as long as the combo
- * that uses it, because the ModestComboBox uses the ID opaquely,
- * so it can't know how to manage its memory. */
- tag = MODEST_PROTOCOL_REGISTRY_AUTH_PROTOCOLS;
- priv->auth_protos = modest_gnome_utils_get_protocols_pair_list (tag);
- combo = modest_combo_box_new (priv->auth_protos, g_str_equal);
-
- gtk_box_pack_start (GTK_BOX(hbox), combo, FALSE, FALSE, 0);
- priv->remember_pwd =
- gtk_check_button_new_with_label (_("Remember password"));
- gtk_box_pack_start (GTK_BOX(hbox),priv->remember_pwd,
- FALSE, FALSE, 0);
- return box;
-}
-
-
-GtkWidget*
-modest_transport_widget_new (ModestProtocolType proto)
-{
- GObject *obj;
- GtkWidget *w;
- ModestTransportWidget *self;
- ModestTransportWidgetPrivate *priv;
-
- g_return_val_if_fail (proto, NULL);
-
- obj = g_object_new(MODEST_TYPE_TRANSPORT_WIDGET, NULL);
- self = MODEST_TRANSPORT_WIDGET(obj);
- priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
-
- priv->proto = proto;
-
- if (proto == MODEST_PROTOCOLS_TRANSPORT_SMTP)
- w = smtp_configuration (self);
- else
- w = gtk_label_new ("");
-
- gtk_widget_show_all (w);
- gtk_box_pack_start (GTK_BOX(self), w, FALSE, FALSE, 2);
-
- return GTK_WIDGET(self);
-}
-
-
-gboolean
-modest_transport_widget_get_remember_password (ModestTransportWidget *self)
-{
- ModestTransportWidgetPrivate *priv;
-
- g_return_val_if_fail (self, FALSE);
- priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
-
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(priv->remember_pwd));
-}
-
-gboolean
-modest_transport_widget_get_requires_auth (ModestTransportWidget *self)
-{
- ModestTransportWidgetPrivate *priv;
-
- g_return_val_if_fail (self, FALSE);
- priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
-
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(priv->auth));
-}
-
-const gchar*
-modest_transport_widget_get_username (ModestTransportWidget *self)
-{
- ModestTransportWidgetPrivate *priv;
-
- g_return_val_if_fail (self, NULL);
- priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
-
- return gtk_entry_get_text (GTK_ENTRY(priv->username));
-}
-
-const gchar*
-modest_transport_widget_get_servername (ModestTransportWidget *self)
-{
- ModestTransportWidgetPrivate *priv;
-
- g_return_val_if_fail (self, NULL);
- priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
-
- return gtk_entry_get_text (GTK_ENTRY(priv->servername));
-}
-
-
-ModestProtocolType
-modest_transport_widget_get_proto (ModestTransportWidget *self)
-{
- ModestTransportWidgetPrivate *priv;
-
- g_return_val_if_fail (self, MODEST_PROTOCOL_REGISTRY_TYPE_INVALID);
- priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
-
- return priv->proto;
-}
-
+++ /dev/null
-/* Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MODEST_TRANSPORT_WIDGET_H__
-#define __MODEST_TRANSPORT_WIDGET_H__
-
-G_BEGIN_DECLS
-
-#include <gtk/gtk.h>
-#include "modest-protocol-registry.h"
-
-/* convenience macros */
-#define MODEST_TYPE_TRANSPORT_WIDGET (modest_transport_widget_get_type())
-#define MODEST_TRANSPORT_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_TRANSPORT_WIDGET,ModestTransportWidget))
-#define MODEST_TRANSPORT_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_TRANSPORT_WIDGET,GtkContainer))
-#define MODEST_IS_TRANSPORT_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_TRANSPORT_WIDGET))
-#define MODEST_IS_TRANSPORT_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_TRANSPORT_WIDGET))
-#define MODEST_TRANSPORT_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_TRANSPORT_WIDGET,ModestTransportWidgetClass))
-
-typedef struct _ModestTransportWidget ModestTransportWidget;
-typedef struct _ModestTransportWidgetClass ModestTransportWidgetClass;
-
-struct _ModestTransportWidget {
- GtkVBox parent;
- /* insert public members, if any */
-};
-
-struct _ModestTransportWidgetClass {
- GtkVBoxClass parent_class;
- /* insert signal callback declarations, eg. */
- /* void (* my_event) (ModestTransportWidget* obj); */
-};
-
-/* member functions */
-GType modest_transport_widget_get_type (void) G_GNUC_CONST;
-
-GtkWidget* modest_transport_widget_new (ModestProtocolType proto);
-
-gboolean modest_transport_widget_get_remember_password (ModestTransportWidget *self);
-gboolean modest_transport_widget_get_requires_auth (ModestTransportWidget *self);
-const gchar* modest_transport_widget_get_username (ModestTransportWidget *self);
-const gchar* modest_transport_widget_get_servername (ModestTransportWidget *self);
-ModestProtocolType modest_transport_widget_get_proto (ModestTransportWidget *self);
-
-G_END_DECLS
-
-#endif /* __MODEST_TRANSPORT_WIDGET_H__ */
-
+++ /dev/null
-<!--
- * Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<ui>
-
- <menubar name="MenuBar">
- <menu name="EmailMenu" action="Email">
- <menu name="EmailNewMainMenu" action="EmailNew">
- <menuitem name="EmailNewMessageMenu" action="EmailNewMessage"/>
- <menuitem name="EmailNewFolderMenu" action="EmailNewFolder"/>
- </menu>
- <menuitem name="EmailOpenMenu" action="EmailOpen"/>
- <separator/>
- <menuitem name="EmailReplyMenu" action="EmailReply"/>
- <menuitem name="EmailReplyAllMenu" action="EmailReplyAll"/>
- <menuitem name="EmailForwardMenu" action="EmailForward"/>
- <separator/>
- <menuitem name="EmailContentsMenu" action="EmailContents"/>
- <menuitem name="EmailPurgeAttachmentsMenu" action="EmailPurgeAttachments"/>
- <separator/>
- <menuitem name="EmailRenameMenu" action="EmailRenameFolder"/>
- <menuitem name="EmailDeleteMenu" action="EmailDelete"/>
- <separator/>
- <menuitem name="EmailDetailsMenu" action="EmailDetails"/>
- <separator/>
- <menuitem name="CloseWindowMenu" action="CloseWindow"/>
- <menuitem name="CloseAllWindowsMenu" action="CloseAllWindows"/>
- </menu>
-
- <menu name="EditMenu" action="Edit">
- <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
- <menuitem name="EditMarkAsReadMenu" action="EditMarkAsRead"/>
- <menuitem name="EditMarkAsUnreadMenu" action="EditMarkAsUnread"/>
- <separator/>
- <menuitem name="EditMoveToMenu" action="EditMoveTo"/>
- </menu>
-
- <menu name="ViewMenu" action="View">
- <menuitem name="ViewSortMenu" action="ViewSort"/>
- <separator/>
-<!-- <menuitem name="ViewToggleFoldersMenu" action="ToggleFolders"/> -->
- <menuitem name="ViewToggleFullscreenMenu" action="ViewToggleFullscreen"/>
- <separator/>
- <placeholder name="ViewMenuAdditions" />
- </menu>
-
- <menu name="ToolsMenu" action="Tools">
- <menuitem name="ToolsSettingsMenu" action="ToolsSettings"/>
- <menuitem name="ToolsAccountsMenu" action="ToolsAccounts"/>
- <menuitem name="ToolsSMTPServersMenu" action="ToolsSMTPServers"/>
- <separator/>
- <menu name="ToolsSendReceiveMainMenu" action="ToolsSendReceive">
- <menuitem name="ToolsSendReceiveAllMenu" action="ToolsSendReceiveAll"/>
- <menuitem name="ToolsSendReceiveCancelSendingMenu" action="ToolsSendReceiveCancelSending"/>
- <separator/>
- <placeholder name="ToolsMenuAdditions" />
- </menu>
- <separator/>
- <menuitem name="ToolsContactsMenu" action="ToolsContacts"/>
- <menuitem name="ToolsSearchMessagesMenu" action="ToolsSearchMessages"/>
- <separator/>
- <menuitem name="ToolsHelpMenu" action="ToolsHelp"/>
- </menu>
-
-
- <menu name="HelpMenu" action="Help">
- <menuitem name="HelpAboutMenu" action="HelpAbout"/>
- </menu>
- </menubar>
-
- <toolbar name="ToolBar">
- <toolitem action="ToolbarMessageNew"/>
- <separator/>
- <toolitem action="ToolbarMessageReply"/>
- <toolitem action="ToolbarMessageReplyAll"/>
- <toolitem action="ToolbarMessageForward"/>
- <separator/>
- <toolitem action="ToolbarSendReceive"/>
- <separator/>
- <toolitem action="GotoPrevious"/>
- <toolitem action="GotoNext"/>
- <separator/>
- <toolitem action="ToolbarDeleteMessage"/>
-<!-- <separator/> -->
-<!-- <toolitem name="ToggleView" action="ToggleView"/> -->
- </toolbar>
-
- <popup name="HeaderViewCSM">
- <menuitem action="HeaderViewCSMReply"/>
- <menuitem action="HeaderViewCSMReplyAll"/>
- <menuitem action="HeaderViewCSMForward"/>
- <menuitem action="HeaderViewCSMCancelSending"/>
- <separator/>
- <menuitem action="HeaderViewCSMDelete"/>
- <menuitem action="HeaderViewCSMHelp"/>
- </popup>
-
- <popup name="FolderViewCSM">
- <menuitem action="FolderViewCSMNewFolder"/>
- <menuitem action="FolderViewCSMRenameFolder"/>
- <menuitem action="FolderViewCSMDeleteFolder"/>
- <separator/>
- <separator/>
- <separator/>
- <menuitem action="FolderViewCSMSearchMessages"/>
- <menuitem action="FolderViewCSMHelp"/>
- </popup>
-
-</ui>
+++ /dev/null
-<!--
- * Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<ui>
-
- <menubar name="MenuBar">
-
- <menu name="EmailMenu" action="Email">
- <menuitem name="SendMenu" action="ActionsSend"/>
- <menuitem name="SaveToDraftsMenu" action="ActionsSaveToDrafts"/>
- <separator/>
- <menuitem name="SelectContactsMenu" action="SelectContacts"/>
- <menuitem name="CheckNamesMenu" action="CheckNames"/>
- <separator/>
- <menuitem name="NewMessageMenu" action="ActionsNewMessage"/>
- <separator/>
- <menuitem name="CloseWindowMenu" action="CloseWindow"/>
- <menuitem name="CloseAllWindowsMenu" action="CloseAllWindows"/>
- </menu>
-
- <menu name="EditMenu" action="Edit">
- <menuitem name="UndoMenu" action="Undo"/>
- <menuitem name="RedoMenu" action="Redo"/>
- <separator/>
- <menuitem name="CutMenu" action="Cut"/>
- <menuitem name="CopyMenu" action="Copy"/>
- <menuitem name="PasteMenu" action="Paste"/>
- <separator/>
- <menuitem name="SelectAllMenu" action="SelectAll"/>
- </menu>
-
- <menu name="AttachmentsMenu" action="Attachments">
- <menuitem name="AttachFileMenu" action="AttachFile"/>
- <separator/>
- <menuitem name="RemoveAttachmentsMenu" action="RemoveAttachments"/>
- </menu>
-
- <menu name="ToolsMenu" action="Tools">
- <menu name="MessagePriorityMenu" action="MessagePriority">
- <menuitem name="MessagePriorityHighMenu" action="MessagePriorityHigh"/>
- <menuitem name="MessagePriorityNormalMenu" action="MessagePriorityNormal"/>
- <menuitem name="MessagePriorityLowMenu" action="MessagePriorityLow"/>
- </menu>
- <separator/>
- <menuitem name="FindInMessageMenu" action="FindInMessage"/>
- <menuitem name="ToolSearchMessagesMenu" action="SearchMessages"/>
- <separator/>
- <menuitem name="ToolsHelpMenu" action="Help"/>
- </menu>
-
- </menubar>
-
- <toolbar name="ToolBar">
- <toolitem action="ToolbarSend"/>
- <toolitem action="ToolbarAttach"/>
- </toolbar>
-
- <accelerator name="AccelZoomMinus" action="ZoomMinus"/>
- <accelerator name="AccelZoomPlus" action="ZoomPlus"/>
- <accelerator name="AccelToggleFullscreen" action="ToggleFullscreen"/>
- <accelerator name="AccelCloseWindow" action="CloseWindowShortcut"/>
-
-</ui>
+++ /dev/null
-<!--
- * Copyright (c) 2006, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<ui>
- <menubar name="MenuBar">
- <menu name="MessageMenu" action="Email">
- <menuitem name="MessageReplyMenu" action="EmailReply"/>
- <menuitem name="MessageReplyAllMenu" action="EmailReplyAll"/>
- <menuitem name="MessageForwardMenu" action="EmailForward"/>
- <separator/>
- <menuitem name="MessageNewMenu" action="EmailNewDefault"/>
- <separator/>
- <menuitem name="MessageDeleteMenu" action="EmailDelete"/>
- <separator/>
- <menuitem name="MessageDetailsMenu" action="EmailDetails"/>
- <separator/>
- <menuitem name="CloseWindowMenu" action="CloseWindow"/>
- <menuitem name="CloseAllWindowsMenu" action="CloseAllWindows"/>
- </menu>
-
- <menu name="EditMenu" action="Edit">
- <menuitem name="EditCutMenu" action="EditCut"/>
- <menuitem name="EditCopyMenu" action="EditCopy"/>
- <menuitem name="EditPasteMenu" action="EditPaste"/>
- <separator/>
- <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
- <separator/>
- <menuitem name="EditMoveToMenu" action="EditMoveTo"/>
- </menu>
-
- <menu name="ViewMenu" action="View">
- <menu name="ZoomMenu" action="Zoom">
- <menuitem name="Zoom50Menu" action="Zoom50"/>
- <menuitem name="Zoom80Menu" action="Zoom80"/>
- <menuitem name="Zoom100Menu" action="Zoom100"/>
- <menuitem name="Zoom120Menu" action="Zoom120"/>
- <menuitem name="Zoom150Menu" action="Zoom150"/>
- <menuitem name="Zoom200Menu" action="Zoom200"/>
- </menu>
- <separator/>
- <menuitem name="ViewToggleFullscreenMenu" action="ViewToggleFullscreen"/>
- <separator/>
-<!-- <menu name="ViewShowToolbarMenu" action="ViewShowToolbar"> -->
-<!-- <menuitem name="ViewShowToolbarNormalScreenMenu" action="ViewShowToolbarNormalScreen"/> -->
-<!-- <menuitem name="ViewShowToolbarFullScreenMenu" action="ViewShowToolbarFullScreen"/> -->
-<!-- </menu> -->
- <separator/>
- <menuitem name="ViewPreviousMessageMenu" action="ViewPreviousMessage"/>
- <menuitem name="ViewNextMessageMenu" action="ViewNextMessage"/>
- </menu>
-
- <menu name="AttachmentsMenu" action="Attachments">
- <menuitem name="ViewAttachmentMenu" action="ViewAttachment"/>
- <menuitem name="SaveAttachmentMenu" action="SaveAttachment"/>
- <menuitem name="RemoveAttachmentMenu" action="RemoveAttachment"/>
- </menu>
-
- <menu name="ToolsMenu" action="Tools">
- <menuitem name="ToolsAddToContactsMenu" action="ToolsAddToContacts"/>
- <separator/>
- <menuitem name="ToolsFindInMessageMenu" action="ToolsFindInMessage"/>
- <menuitem name="ToolsSearchMessagesMenu" action="ToolsSearchMessages"/>
- <separator/>
- <menuitem name="ToolsHelpMenu" action="ToolsHelp"/>
- </menu>
-
-<!-- <menu name="ActionsMenu" action="Actions">
- <menuitem name="ActionsReplyMenu" action="ActionsReply"/>
- <menuitem name="ActionsReplyAllMenu" action="ActionsReplyAll"/>
- <menuitem name="ActionsForwardMenu" action="ActionsForward"/>
- </menu>-->
- </menubar>
-
- <toolbar name="ToolBar">
- <toolitem action="ToolbarMessageReply"/>
- <toolitem action="ToolbarDeleteMessage"/>
- <separator/>
- <toolitem action="ToolbarMessageBack" position="bot"/>
- <toolitem action="ToolbarMessageNext" position="bot"/>
- </toolbar>
-</ui>
--- /dev/null
+# Copyright (c) 2009 Nokia Corporation
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# * Neither the name of the Nokia Corporation nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+INCLUDES=\
+ $(MODEST_GSTUFF_CFLAGS) \
+ $(MODEST_PLATFORM_CFLAGS) \
+ $(MODEST_TOOLKIT_CFLAGS) \
+ $(MODEST_PLUGIN_DEFINES) \
+ -I ${top_srcdir}/src \
+ -DPREFIX=\"@prefix@\" \
+ -Wall
+
+libmodest_ui_la_SOURCES=
+
+LDADD = \
+ $(MODEST_GSTUFF_LIBS) \
+ $(MODEST_PLATFORM_LIBS) \
+ $(MODEST_TOOKIT_LIBS)
\ No newline at end of file
/* Test 2b */
gchar *account_name_from_recipient;
- account_name_from_recipient = modest_utils_get_account_name_from_recipient ("user@email.com");
+ account_name_from_recipient = modest_utils_get_account_name_from_recipient ("user@email.com", NULL);
fail_unless (account_name_from_recipient != NULL,
"modest_utils_get_account_name_from_recipient failed: "\
"From user@email.com should match account");
/* Test 2c */
- account_name_from_recipient = modest_utils_get_account_name_from_recipient ("egg@egg.com");
+ account_name_from_recipient = modest_utils_get_account_name_from_recipient ("egg@egg.com", NULL);
fail_unless (account_name_from_recipient == NULL,
"modest_utils_get_account_name_from_recipient failed: "\
"From egg@egg.com shouldn't match account");
G_CALLBACK (on_progress_changed), queue);
modest_mail_operation_update_account (mail_op, modest_account_mgr_get_default_account (acc_mgr),
- TRUE, FALSE, NULL, update_account_cb, queue);
+ TRUE, FALSE, update_account_cb, queue);
modest_mail_operation_queue_add (queue, mail_op);
g_object_unref (G_OBJECT (mail_op));