SUBDIRS += docs
endif
-
-
EXTRA_DIST= \
mkinstalldirs \
autogen.sh \
dnl # GLib/Gobject/Gtk/Gconf => mandatory
-PKG_CHECK_MODULES(MODEST_GSTUFF,glib-2.0 >= 2.6 gobject-2.0 gtk+-2.0 >= 2.6 gconf-2.0 libgtkhtml-3.8 libtinymail-1.0 libtinymail-camel-1.0 libtinymailui-1.0 libtinymailui-gtk-1.0)
+PKG_CHECK_MODULES(MODEST_GSTUFF,glib-2.0 >= 2.6 gobject-2.0 gtk+-2.0 >= 2.6 gconf-2.0 gnome-vfs-2.0 libgtkhtml-3.8 libtinymail-1.0 libtinymail-camel-1.0 libtinymailui-1.0 libtinymailui-gtk-1.0)
AC_SUBST(MODEST_GSTUFF_CFLAGS)
AC_SUBST(MODEST_GSTUFF_LIBS)
-
dnl dnl now, determine what to build
AC_MSG_NOTICE([Determining what platform to build])
PKG_CHECK_MODULES(LIBOSSO,libosso,[with_platform=maemo],true)
AC_ARG_WITH(platform,
-[--with-platform=gtk platform to build for [gtk]],
+[--with-platform=gnome platform to build for [gnome]],
[case "${with_platform}" in
- gtk) MODEST_PLATFORM=gtk;;
+ gnome) MODEST_PLATFORM=gnome;;
maemo) MODEST_PLATFORM=maemo;;
*) MODEST_PLATFORM=${with_platform}
-esac], [MODEST_PLATFORM=gtk
- with_platform=gtk])
+esac], [MODEST_PLATFORM=gnome
+ with_platform=gnome])
AC_SUBST(MODEST_PLATFORM)
-
if test "x$with_platform" = "xmaemo"; then
- PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_MAEMO,libtinymail-maemo-1.0 hildon-libs libosso)
+ PKG_CHECK_MODULES(MODEST_LIBTINYMAIL_MAEMO,libtinymail-maemo-1.0 hildon-libs libosso libossomime)
AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_CFLAGS)
AC_SUBST(MODEST_LIBTINYMAIL_MAEMO_LIBS)
MODEST_PLATFORM_ID=1
fi
-dnl 1==>gtk, 2==>maemo
+dnl 1==>gnome, 2==>maemo
AC_SUBST(MODEST_PLATFORM_ID)
Makefile
man/Makefile
src/Makefile
-src/gtk/Makefile
+src/gnome/Makefile
src/maemo/Makefile
src/widgets/Makefile
docs/Makefile
-modest (0.0.1) UNRELEASED; urgency=low
+modest (0.0.1-svn-870) unstable; urgency=low
- * Initial release.
+ * Package subversion revision 870
+
+ -- Dirk-Jan Binnema <djcb@djcbsoftware.nl> Thu, 01 Mar 2007 20:06:15 +0000
- -- Dirk-Jan Binnema <dirk-jan.binnema@nokia.com> Sat, 11 Nov 2006 15:21:06 +0100
-modest_0.0.1_armel.deb user/unknown optional
+modest_0.0.1-svn-870_armel.deb user/unknown optional
-shlibs:Depends=gtkhtml0, hildon-libs0 (>= 0.14.11-1), libart-2.0-2 (>= 2.3.16), libatk1.0-0 (>= 1.9.0), libc6 (>= 2.3.5-1), libdbus-1-2 (>= 0.61), libdbus-glib-1-2 (>= 0.61), libgconf2-6 (>= 2.6.4.15), libglib2.0-0 (>= 2.8.6-1osso1), libgtk2.0-0 (>= 2:2.6.10-1.osso8), libosso1 (>= 1.20-1), libpango1.0-0 (>= 1.8.1), libtinymail-1.0-0
+shlibs:Depends=gtkhtml0, hildon-libs0 (>= 0.14.11-1), libart-2.0-2 (>= 2.3.16), libatk1.0-0 (>= 1.9.0), libc6 (>= 2.3.5-1), libdbus-1-2 (>= 0.61), libdbus-glib-1-2 (>= 0.61), libgconf2-6 (>= 2.6.4.15), libglib2.0-0 (>= 2.8.6-1osso1), libgtk2.0-0 (>= 2:2.6.10-1.osso8), libosso1 (>= 1.20-1), libpango1.0-0 (>= 1.8.1), libtinymail-1.0-0, libtinymail-camel-1.0-0, libtinymail-maemo-1.0-0, libtinymailui-1.0-0, libtinymailui-gtk-1.0-0
#
# Makefile.am
-# Time-stamp: <2007-02-07 23:11:40 (djcb)>
+# Time-stamp: <2007-03-03 17:20:20 (djcb)>
SUBDIRS=$(MODEST_PLATFORM) widgets
DIST_SUBDIRS = widgets gtk maemo
modest-marshal.h \
modest-pair.c\
modest-pair.h\
+ modest-platform.h\
modest-protocol-info.c\
modest-protocol-info.h\
modest-runtime.c\
modest-tny-folder.h \
modest-tny-msg.c\
modest-tny-msg.h\
+ modest-platform.h\
modest-tny-platform-factory.c \
modest-tny-platform-factory.h \
modest-tny-send-queue.c\
--- /dev/null
+#
+# Makefile.am
+# Time-stamp: <2007-02-10 14:47:15 (djcb)>
+#
+#
+# use Automake 'trick' ==> convenience static libraries, which
+# won't be installed, just for linking
+#
+INCLUDES=\
+ $(MODEST_GSTUFF_CFLAGS) \
+ $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS) \
+ -DMODEST_PLATFORM_ID=$(MODEST_PLATFORM_ID) \
+ -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 \
+ pixmaps/*.svg
+
+libmodest_ui_la_SOURCES= \
+ modest-account-assistant.c \
+ modest-account-assistant.h \
+ modest-account-view-window.c \
+ modest-msg-edit-window.c \
+ modest-icon-names.h \
+ modest-main-window.c \
+ modest-main-window-ui.h \
+ modest-msg-view-window.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_LIBTINYMAIL_GNOME_DESKTOP_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-protocol-info.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);
+
+/* list my signals */
+enum {
+ /* MY_SIGNAL_1, */
+ /* MY_SIGNAL_2, */
+ LAST_SIGNAL
+};
+
+typedef struct _ModestAccountAssistantPrivate ModestAccountAssistantPrivate;
+struct _ModestAccountAssistantPrivate {
+
+ ModestAccountMgr *account_mgr;
+
+ GtkWidget *account_name;
+ GtkWidget *fullname;
+ GtkWidget *email;
+
+ GtkWidget *store_widget;
+ GtkWidget *transport_widget;
+
+ GtkWidget *transport_holder;
+ GtkWidget *store_holder;
+};
+
+#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}; */
+
+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 (GTK_TYPE_ASSISTANT,
+ "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));
+
+ /* 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
+add_intro_page (ModestAccountAssistant *assistant)
+{
+ GtkWidget *page, *label;
+
+ page = gtk_vbox_new (FALSE, 6);
+
+ label = gtk_label_new (
+ _("Welcome to the account assistant\n\n"
+ "It will help to set up a new e-mail account\n"));
+ gtk_box_pack_start (GTK_BOX(page), label, FALSE, FALSE, 6);
+ gtk_widget_show_all (page);
+
+ gtk_assistant_append_page (GTK_ASSISTANT(assistant), page);
+
+ gtk_assistant_set_page_title (GTK_ASSISTANT(assistant), page,
+ _("Modest Account Assistant"));
+ gtk_assistant_set_page_type (GTK_ASSISTANT(assistant), page,
+ GTK_ASSISTANT_PAGE_INTRO);
+ gtk_assistant_set_page_complete (GTK_ASSISTANT(assistant),
+ page, TRUE);
+}
+
+
+static void
+set_current_page_complete (ModestAccountAssistant *self, gboolean complete)
+{
+ GtkWidget *page;
+ gint pageno;
+
+ pageno = gtk_assistant_get_current_page (GTK_ASSISTANT(self));
+
+ if (pageno != -1) {
+ page = gtk_assistant_get_nth_page (GTK_ASSISTANT(self), pageno);
+ gtk_assistant_set_page_complete (GTK_ASSISTANT(self), page, complete);
+ }
+}
+
+
+static void
+identity_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->fullname));
+ if (!txt || strlen(txt) == 0) {
+ set_current_page_complete (self, FALSE);
+ return;
+ }
+
+ /* FIXME: regexp check for email address */
+ txt = gtk_entry_get_text (GTK_ENTRY(priv->email));
+ if (!modest_text_utils_validate_email_address (txt))
+ set_current_page_complete (self, FALSE);
+ else
+ set_current_page_complete (self, TRUE);
+}
+
+
+static void
+add_identity_page (ModestAccountAssistant *self)
+{
+ GtkWidget *page, *label, *table;
+ ModestAccountAssistantPrivate *priv;
+
+ priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
+
+ priv->fullname = gtk_entry_new_with_max_length (40);
+ priv->email = gtk_entry_new_with_max_length (40);
+
+ page = gtk_vbox_new (FALSE, 6);
+
+ label = gtk_label_new (
+ _("Please enter your name and your e-mail address below.\n\n"));
+ gtk_box_pack_start (GTK_BOX(page), label, FALSE, FALSE, 6);
+
+ table = gtk_table_new (2,2, FALSE);
+ gtk_table_attach_defaults (GTK_TABLE(table),gtk_label_new (_("Full name")),
+ 0,1,0,1);
+ gtk_table_attach_defaults (GTK_TABLE(table),gtk_label_new (_("E-mail 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);
+
+ g_signal_connect (G_OBJECT(priv->fullname), "changed",
+ G_CALLBACK(identity_page_update_completeness),
+ self);
+ g_signal_connect (G_OBJECT(priv->email), "changed",
+ G_CALLBACK(identity_page_update_completeness),
+ self);
+
+ gtk_box_pack_start (GTK_BOX(page), table, FALSE, FALSE, 6);
+ gtk_widget_show_all (page);
+
+ gtk_assistant_append_page (GTK_ASSISTANT(self), page);
+
+ gtk_assistant_set_page_title (GTK_ASSISTANT(self), page,
+ _("Identity"));
+ gtk_assistant_set_page_type (GTK_ASSISTANT(self), page,
+ GTK_ASSISTANT_PAGE_INTRO);
+ gtk_assistant_set_page_complete (GTK_ASSISTANT(self),
+ page, FALSE);
+}
+
+
+static void
+receiving_page_update_completeness (GtkEditable *editable,
+ ModestAccountAssistant *self)
+{
+ ModestAccountAssistantPrivate *priv;
+ const gchar *txt;
+
+ priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
+
+ txt = modest_store_widget_get_username (MODEST_STORE_WIDGET (priv->store_widget));
+ if (!txt || strlen(txt) == 0) {
+ set_current_page_complete (self, FALSE);
+ return;
+ }
+
+ txt = modest_store_widget_get_servername (MODEST_STORE_WIDGET (priv->store_widget));
+ if (!txt || strlen(txt) == 0) {
+ set_current_page_complete (self, FALSE);
+ return;
+ }
+ set_current_page_complete (self, TRUE);
+}
+
+static void
+on_receiving_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->store_widget)
+ gtk_container_remove (GTK_CONTAINER(priv->store_holder),
+ priv->store_widget);
+
+ proto = modest_protocol_info_get_protocol (chosen);
+
+ /* FIXME: we could have these widgets cached instead of
+ creating them every time */
+ priv->store_widget = modest_store_widget_new (proto);
+ if (proto == MODEST_PROTOCOL_STORE_POP || proto == MODEST_PROTOCOL_STORE_IMAP) {
+ g_signal_connect (priv->store_widget,
+ "data_changed",
+ G_CALLBACK (receiving_page_update_completeness),
+ self);
+ set_current_page_complete (self, FALSE);
+ } else
+ set_current_page_complete (self, TRUE);
+
+ gtk_container_add (GTK_CONTAINER(priv->store_holder),
+ priv->store_widget);
+
+ gtk_widget_show_all (priv->store_holder);
+
+}
+
+static void
+add_receiving_page (ModestAccountAssistant *self)
+{
+ GtkWidget *page, *box, *combo;
+ ModestPairList *protos;
+ ModestAccountAssistantPrivate *priv;
+
+ priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
+ page = gtk_vbox_new (FALSE, 6);
+
+ gtk_box_pack_start (GTK_BOX(page),
+ gtk_label_new (
+ _("Please select among the following options")),
+ FALSE, FALSE, 6);
+ box = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX(box),
+ gtk_label_new(_("Server type")),
+ FALSE,FALSE,6);
+
+ protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_STORE);
+ combo = modest_combo_box_new (protos, g_str_equal);
+ modest_pair_list_free (protos);
+
+ g_signal_connect (G_OBJECT(combo), "changed",
+ G_CALLBACK(on_receiving_combo_box_changed), self);
+
+ gtk_box_pack_start (GTK_BOX(box), combo, FALSE,FALSE,6);
+ gtk_box_pack_start (GTK_BOX(page), box, FALSE,FALSE, 6);
+
+ gtk_box_pack_start (GTK_BOX(page), gtk_hseparator_new(), FALSE, FALSE, 0);
+
+ priv->store_holder = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(page), priv->store_holder,
+ TRUE, TRUE, 0);
+
+ /* Force the selection */
+ on_receiving_combo_box_changed (GTK_COMBO_BOX (combo), self);
+
+ gtk_assistant_append_page (GTK_ASSISTANT(self), page);
+
+ gtk_assistant_set_page_title (GTK_ASSISTANT(self), page,
+ _("Receiving mail"));
+ gtk_assistant_set_page_type (GTK_ASSISTANT(self), page,
+ GTK_ASSISTANT_PAGE_INTRO);
+ gtk_assistant_set_page_complete (GTK_ASSISTANT(self),
+ page, FALSE);
+ gtk_widget_show_all (page);
+}
+
+
+
+
+static void
+on_sending_combo_box_changed (GtkComboBox *combo, ModestAccountAssistant *self)
+{
+ ModestAccountAssistantPrivate *priv;
+ gchar *chosen;
+
+ 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);
+ priv->transport_widget =
+ modest_transport_widget_new (modest_protocol_info_get_protocol(chosen));
+
+ gtk_container_add (GTK_CONTAINER(priv->transport_holder),
+ priv->transport_widget);
+
+ gtk_widget_show_all (priv->transport_holder);
+}
+
+
+
+static void
+add_sending_page (ModestAccountAssistant *self)
+{
+ GtkWidget *page, *box, *combo;
+ ModestPairList *protos;
+ ModestAccountAssistantPrivate *priv;
+
+ priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
+ page = gtk_vbox_new (FALSE, 6);
+
+ gtk_box_pack_start (GTK_BOX(page),
+ gtk_label_new (
+ _("Please select among the following options")),
+ FALSE, FALSE, 0);
+ box = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(box),
+ gtk_label_new(_("Server type")),
+ FALSE,FALSE,0);
+
+ protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_TRANSPORT);
+ combo = modest_combo_box_new (protos, g_str_equal);
+ modest_pair_list_free (protos);
+
+ g_signal_connect (G_OBJECT(combo), "changed",
+ G_CALLBACK(on_sending_combo_box_changed), self);
+
+ gtk_box_pack_start (GTK_BOX(box), combo, FALSE,FALSE,0);
+ gtk_box_pack_start (GTK_BOX(page), box, FALSE,FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX(page), gtk_hseparator_new(), FALSE, FALSE, 0);
+
+ priv->transport_holder = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(page), priv->transport_holder,
+ FALSE, FALSE, 0);
+
+ /* Force the selection */
+ on_sending_combo_box_changed (GTK_COMBO_BOX (combo), self);
+
+ gtk_assistant_append_page (GTK_ASSISTANT(self), page);
+
+ gtk_assistant_set_page_title (GTK_ASSISTANT(self), page,
+ _("Sending mail"));
+ gtk_assistant_set_page_type (GTK_ASSISTANT(self), page,
+ GTK_ASSISTANT_PAGE_INTRO);
+ gtk_assistant_set_page_complete (GTK_ASSISTANT(self),
+ page, TRUE);
+ gtk_widget_show_all (page);
+}
+
+
+
+static void
+add_final_page (ModestAccountAssistant *self)
+{
+ GtkWidget *page, *box;
+ ModestAccountAssistantPrivate *priv;
+
+ priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
+ page = gtk_vbox_new (FALSE, 6);
+
+ gtk_box_pack_start (GTK_BOX(page),
+ gtk_label_new (
+ _("We're almost done. Press 'Apply' to store this new account")),
+ FALSE, FALSE, 6);
+ box = gtk_hbox_new (FALSE, 6);
+ priv->account_name =
+ gtk_entry_new_with_max_length (40);
+ gtk_entry_set_text (GTK_ENTRY(priv->account_name),
+ gtk_entry_get_text(GTK_ENTRY(priv->email)));
+ gtk_box_pack_start (GTK_BOX(box),gtk_label_new(_("Account name:")),
+ FALSE,FALSE,6);
+ gtk_box_pack_start (GTK_BOX(box),priv->account_name , FALSE,FALSE,6);
+
+ gtk_box_pack_start (GTK_BOX(page), box, FALSE, FALSE, 6);
+
+ gtk_assistant_append_page (GTK_ASSISTANT(self), page);
+
+ gtk_assistant_set_page_title (GTK_ASSISTANT(self), page,
+ _("Account Management"));
+ gtk_assistant_set_page_type (GTK_ASSISTANT(self), page,
+ GTK_ASSISTANT_PAGE_CONFIRM);
+
+ gtk_assistant_set_page_complete (GTK_ASSISTANT(self),
+ page, TRUE);
+ 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_widget = NULL;
+ priv->transport_widget = NULL;
+}
+
+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;
+ }
+
+ G_OBJECT_CLASS(parent_class)->finalize (obj);
+}
+
+static void
+on_cancel (ModestAccountAssistant *self, gpointer user_data)
+{
+ GtkWidget *label;
+ GtkWidget *dialog;
+ int response;
+
+ label = gtk_label_new (_("Are you sure you want to cancel\n"
+ "setting up a new account?"));
+
+ dialog = gtk_dialog_new_with_buttons (_("Cancel"),
+ GTK_WINDOW(self),
+ GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_YES, GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_NO, GTK_RESPONSE_CANCEL,
+ NULL);
+
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox),
+ label, FALSE, FALSE, 6);
+
+ gtk_widget_show_all ((GTK_DIALOG(dialog)->vbox));
+
+ gtk_window_set_resizable (GTK_WINDOW(dialog), FALSE);
+
+ response = gtk_dialog_run (GTK_DIALOG(dialog));
+ gtk_widget_destroy (dialog);
+
+ switch (response) {
+ case GTK_RESPONSE_ACCEPT:
+ /* close the assistant */
+ gtk_widget_hide (GTK_WIDGET(self));
+ break;
+ case GTK_RESPONSE_CANCEL:
+ /* don't do anything */
+ break;
+ default: g_assert_not_reached ();
+
+ };
+}
+
+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));
+}
+
+
+static void
+on_close (ModestAccountAssistant *self, gpointer user_data)
+{
+ gtk_widget_hide (GTK_WIDGET (self));
+}
+
+
+/*
+ * FIXME: hmmmm this a Camel internal thing, should move this
+ * somewhere else
+ */
+static gchar*
+get_account_uri (ModestProtocol proto, const gchar* path)
+{
+ CamelURL *url;
+ gchar *uri;
+
+ switch (proto) {
+ case MODEST_PROTOCOL_STORE_MBOX:
+ url = camel_url_new ("mbox:", NULL); break;
+ case MODEST_PROTOCOL_STORE_MAILDIR:
+ url = camel_url_new ("maildir:", NULL); break;
+ default:
+ 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, ModestProtocol proto,
+ const gchar* username, const gchar *servername)
+{
+ gchar *name;
+ gint i = 0;
+
+ while (TRUE) {
+ name = g_strdup_printf ("%s:%d",
+ modest_protocol_info_get_protocol_name(proto), i++);
+ if (modest_account_mgr_account_exists (acc_mgr, name, TRUE))
+ g_free (name);
+ else
+ break;
+ }
+ return name;
+}
+
+
+static void
+on_apply (ModestAccountAssistant *self, gpointer user_data)
+{
+ ModestAccountAssistantPrivate *priv;
+ ModestProtocol proto, security, auth;
+ gchar *store_name, *transport_name;
+ const gchar *account_name, *username, *servername, *path;
+ ModestStoreWidget *store;
+ ModestTransportWidget *transport;
+
+ priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
+
+ /* create server account -> store */
+ store = MODEST_STORE_WIDGET(priv->store_widget);
+ proto = modest_store_widget_get_proto (store);
+ username = modest_store_widget_get_username (store);
+ servername = modest_store_widget_get_servername (store);
+ path = modest_store_widget_get_path (store);
+ security = modest_store_widget_get_security (store);
+ auth = modest_store_widget_get_auth (store);
+ store_name = get_new_server_account_name (priv->account_mgr, proto,username, servername);
+
+ if (proto == MODEST_PROTOCOL_STORE_MAILDIR ||
+ proto == MODEST_PROTOCOL_STORE_MBOX) {
+ gchar *uri = get_account_uri (proto, path);
+ modest_account_mgr_add_server_account_uri (priv->account_mgr, store_name, proto, uri);
+ g_free (uri);
+ } else
+ modest_account_mgr_add_server_account (priv->account_mgr, store_name, servername,
+ username, NULL, proto, security, auth);
+
+ /* create server account -> transport */
+ transport = MODEST_TRANSPORT_WIDGET(priv->transport_widget);
+ proto = modest_transport_widget_get_proto (transport);
+ username = NULL;
+ servername = NULL;
+ if (proto == MODEST_PROTOCOL_TRANSPORT_SMTP) {
+ servername = modest_transport_widget_get_servername (transport);
+ if (modest_transport_widget_get_requires_auth (transport))
+ username = modest_transport_widget_get_username (transport);
+ }
+
+ transport_name = get_new_server_account_name (priv->account_mgr, proto,username, servername);
+ modest_account_mgr_add_server_account (priv->account_mgr,
+ transport_name, servername,
+ username, NULL,
+ proto, security, auth);
+
+ /* create account */
+ account_name = get_account_name (self);
+ modest_account_mgr_add_account (priv->account_mgr,
+ account_name,
+ store_name,
+ transport_name);
+ modest_account_mgr_set_string (priv->account_mgr,
+ account_name,
+ MODEST_ACCOUNT_FULLNAME,
+ get_fullname(self), FALSE);
+ modest_account_mgr_set_string (priv->account_mgr,
+ account_name,
+ MODEST_ACCOUNT_EMAIL,
+ get_email(self), FALSE);
+
+ /* Frees */
+ g_free (store_name);
+ g_free (transport_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;
+
+ add_intro_page (self);
+ add_identity_page (self);
+ add_receiving_page (self);
+ add_sending_page (self);
+ add_final_page (self);
+
+ gtk_assistant_set_current_page (GTK_ASSISTANT(self), 0);
+ gtk_window_set_title (GTK_WINDOW(self),
+ _("Modest Account Wizard"));
+ gtk_window_set_resizable (GTK_WINDOW(self), TRUE);
+ gtk_window_set_default_size (GTK_WINDOW(self), 400, 400);
+
+ gtk_window_set_modal (GTK_WINDOW(self), TRUE);
+
+ g_signal_connect (G_OBJECT(self), "apply",
+ G_CALLBACK(on_apply), NULL);
+ g_signal_connect (G_OBJECT(self), "cancel",
+ G_CALLBACK(on_cancel), NULL);
+ g_signal_connect (G_OBJECT(self), "close",
+ G_CALLBACK(on_close), NULL);
+
+ return GTK_WIDGET(self);
+}
--- /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 <gtk/gtkassistant.h>
+#include <modest-account-mgr.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 {
+ GtkAssistant parent;
+ /* insert public members, if any */
+};
+
+struct _ModestAccountAssistantClass {
+ GtkAssistantClass 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-runtime.h>
+#include <modest-account-mgr-helpers.h>
+#include <string.h>
+#include "modest-account-assistant.h"
+#include "modest-tny-platform-factory.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 GtkWindowClass *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_WINDOW,
+ "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;
+
+ 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) {
+ gboolean removed;
+ GtkWidget *dialog;
+ gchar *txt;
+
+ dialog = gtk_dialog_new_with_buttons (_("Confirmation dialog"),
+ GTK_WINDOW (self),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+ txt = g_strdup_printf (_("Do you really want to delete the account %s?"), account_name);
+ gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox),
+ gtk_label_new (txt), FALSE, FALSE, 0);
+/* gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox)); */
+ g_free (txt);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
+ /* Remove account. If succeeded it removes also
+ the account from the ModestAccountView */
+ removed = modest_account_mgr_remove_account (account_mgr,
+ account_name,
+ FALSE);
+ if (removed) {
+ /* Show confirmation dialog ??? */
+ } else {
+ /* Show error dialog ??? */
+ g_warning ("Error removing account %s", account_name);
+ }
+ }
+ gtk_widget_destroy (dialog);
+ g_free (account_name);
+ }
+}
+
+static void
+on_edit_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
+{
+ g_message (__FUNCTION__);
+}
+
+static void
+on_add_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
+{
+ GtkWidget *assistant;
+ ModestAccountViewWindowPrivate *priv;
+
+ priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
+ assistant = modest_account_assistant_new (modest_runtime_get_account_mgr());
+ gtk_window_set_transient_for (GTK_WINDOW(assistant),
+ GTK_WINDOW(self));
+
+ gtk_widget_show (GTK_WIDGET(assistant));
+}
+
+
+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 void
+on_close_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
+{
+ gtk_widget_destroy (GTK_WIDGET(self));
+}
+
+
+
+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 *close_button;
+ GtkWidget *close_hbox;
+
+ priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
+
+ main_vbox = gtk_vbox_new (FALSE, 6);
+ main_hbox = gtk_hbox_new (FALSE, 6);
+
+ 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));
+ g_signal_connect (G_OBJECT(sel), "changed", G_CALLBACK(on_selection_changed),
+ self);
+
+ button_box = button_box_new (self);
+
+ gtk_box_pack_start (GTK_BOX(main_hbox), GTK_WIDGET(priv->account_view), TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX(main_hbox), button_box, FALSE, FALSE,2);
+
+ gtk_box_pack_start (GTK_BOX(main_vbox), main_hbox, TRUE, TRUE, 2);
+
+ close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+ g_signal_connect (G_OBJECT(close_button), "clicked",
+ G_CALLBACK(on_close_button_clicked),
+ self);
+
+ close_hbox = gtk_hbox_new (FALSE, 2);
+ gtk_box_pack_end (GTK_BOX(close_hbox),
+ close_button, FALSE, FALSE,2);
+ gtk_box_pack_end (GTK_BOX(main_vbox), close_hbox, FALSE, FALSE,2);
+
+ 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), FALSE);
+ gtk_window_set_title (GTK_WINDOW(obj), _("Accounts"));
+ gtk_window_set_type_hint (GTK_WINDOW(obj), GDK_WINDOW_TYPE_HINT_DIALOG);
+
+ gtk_window_set_modal (GTK_WINDOW(obj), TRUE);
+
+ gtk_container_add (GTK_CONTAINER(obj),
+ window_vbox_new (MODEST_ACCOUNT_VIEW_WINDOW(obj)));
+
+ 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.
+ */
+
+
+/* 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_FOLDER_ICON_OPEN PIXMAP_PREFIX "qgn_list_gene_fldr_opn.png"
+#define MODEST_FOLDER_ICON_CLOSED PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png"
+
+#define MODEST_FOLDER_ICON_ACCOUNT PIXMAP_PREFIX "qgn_addr_icon_user_group.png"
+#define MODEST_FOLDER_ICON_INBOX PIXMAP_PREFIX "qgn_list_messagin_inbox.png"
+#define MODEST_FOLDER_ICON_OUTBOX PIXMAP_PREFIX "qgn_list_messagin_outbox.png"
+#define MODEST_FOLDER_ICON_SENT PIXMAP_PREFIX "qgn_list_messagin_sent.png"
+#define MODEST_FOLDER_ICON_TRASH PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png"
+#define MODEST_FOLDER_ICON_JUNK PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png"
+#define MODEST_FOLDER_ICON_DRAFTS PIXMAP_PREFIX "qgn_list_messagin_drafts.png"
+#define MODEST_FOLDER_ICON_NORMAL PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png"
+
+#define MODEST_FOLDER_ICON_CONTACTS PIXMAP_PREFIX "qgn_addr_icon_user_group.png"
+#define MODEST_FOLDER_ICON_NOTES PIXMAP_PREFIX "qgn_list_messagin_viewer.png"
+#define MODEST_FOLDER_ICON_CALENDAR PIXMAP_PREFIX "qgn_widg_datedit.png"
+
+/* toolbar */
+#define MODEST_TOOLBAR_ICON_MAIL_SEND PIXMAP_PREFIX "qgn_list_messagin_sent.png"
+#define MODEST_TOOLBAR_ICON_NEW_MAIL PIXMAP_PREFIX "mail-message-new.png"
+/* #define MODEST_TOOLBAR_ICON_SEND_RECEIVE PIXMAP_PREFIX "gtk-refresh.png" */
+#define MODEST_TOOLBAR_ICON_REPLY PIXMAP_PREFIX "mail-reply-sender.png"
+#define MODEST_TOOLBAR_ICON_REPLY_ALL PIXMAP_PREFIX "mail-reply-all.png"
+#define MODEST_TOOLBAR_ICON_FORWARD PIXMAP_PREFIX "mail-forward.png"
+#define MODEST_TOOLBAR_ICON_DELETE PIXMAP_PREFIX "mail-mark-junk.png"
+/* #define MODEST_TOOLBAR_ICON_NEXT PIXMAP_PREFIX "forward.png" */
+/* #define MODEST_TOOLBAR_ICON_PREV PIXMAP_PREFIX "back.png" */
+#define MODEST_TOOLBAR_ICON_STOP PIXMAP_PREFIX "stock-stop.png"
+
+/* 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"
+
+#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_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 */
+ { "File", NULL, N_("_File") },
+ { "Edit", NULL, N_("_Edit") },
+ { "Actions", NULL, N_("_Actions") },
+ { "Options", NULL, N_("_Options") },
+ { "Help", NULL, N_("_Help") },
+
+ /* FILE */
+ { "FileNew", MODEST_STOCK_NEW_MAIL, N_("_New"), "<CTRL>N", N_("Compose new message"), G_CALLBACK (modest_ui_actions_on_new_msg) },
+ { "FileOpen", GTK_STOCK_OPEN, N_("_Open"), "<CTRL>O", N_("Open a message"), NULL },
+ { "FileSave", GTK_STOCK_SAVE, N_("_Save"), "<CTRL>S", N_("Save a message"), NULL },
+ { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("Save _As"), NULL, N_("Save a message as"), NULL },
+ { "FileQuit", GTK_STOCK_QUIT, N_("_Quit"), "<CTRL>Q", N_("Exit the application"), G_CALLBACK (modest_ui_actions_on_quit) },
+
+ /* EDIT */
+ { "EditUndo", GTK_STOCK_UNDO, N_("_Undo"), "<CTRL>Z", N_("Undo last action"), NULL },
+ { "EditRedo", GTK_STOCK_REDO, N_("_Redo"), "<shift><CTRL>Z", N_("Redo previous action"), NULL },
+ { "EditCut", GTK_STOCK_CUT, N_("Cut"), "<CTRL>X", N_("_Cut"), NULL },
+ { "EditCopy", GTK_STOCK_COPY, N_("Copy"), "<CTRL>C", N_("Copy"), NULL },
+ { "EditPaste", GTK_STOCK_PASTE, N_("Paste"), "<CTRL>V", N_("Paste"), NULL },
+ { "EditDelete", GTK_STOCK_DELETE, N_("_Delete"), "<CTRL>Q", N_("Delete"), NULL },
+ { "EditSelectAll", NULL, N_("Select all"), "<CTRL>A", N_("Select all"), NULL },
+ { "EditDeselectAll", NULL, N_("Deselect all"), "<Shift><CTRL>A", N_("Deselect all"), NULL },
+
+ /* VIEW */
+ { "ToggleView", GTK_STOCK_CDROM, N_("_Toggle view"), NULL, N_("Toggle the list view"), G_CALLBACK(modest_ui_actions_toggle_view) },
+ /* ACTIONS */
+ { "ActionsNew", MODEST_STOCK_NEW_MAIL, N_("_New Message"), NULL, N_("Compose a new message"), G_CALLBACK (modest_ui_actions_on_new_msg) },
+ { "ActionsReply", MODEST_STOCK_REPLY, N_("_Reply"), NULL, N_("Reply to a message"), G_CALLBACK (modest_ui_actions_on_reply) },
+ { "ActionsReplyAll", MODEST_STOCK_REPLY_ALL, N_("Reply to all"), NULL, N_("Reply to all"), G_CALLBACK (modest_ui_actions_on_reply_all) },
+ { "ActionsForward", MODEST_STOCK_FORWARD, N_("_Forward"), NULL, N_("Forward a message"), G_CALLBACK (modest_ui_actions_on_forward) },
+ { "ActionsBounce", NULL, N_("_Bounce"), NULL, N_("Bounce a message"), NULL },
+ { "ActionsSendReceive", GTK_STOCK_REFRESH, N_("Send/Receive"), NULL, N_("Send and receive messages"), NULL },
+ { "ActionsDelete", GTK_STOCK_DELETE, N_("Delete message"), NULL, N_("Delete messages"), G_CALLBACK (modest_ui_actions_on_delete) },
+ { "ActionsFolderNew", NULL, N_("New Folder"), NULL, N_("Create a new folder"), G_CALLBACK (modest_ui_actions_on_new_folder) },
+ { "ActionsFolderDelete", NULL, N_("Delete Folder"), NULL, N_("Delete the folder"), G_CALLBACK (modest_ui_actions_on_delete_folder) },
+ { "ActionsFolderRename", NULL, N_("Rename Folder"), NULL, N_("Rename the folder"), G_CALLBACK (modest_ui_actions_on_rename_folder) },
+ { "ActionsFolderMoveToTrash", NULL, N_("Move Folder to Trash"), NULL, N_("Move folder to Trash"), G_CALLBACK (modest_ui_actions_on_move_folder_to_trash_folder) },
+
+
+ /* 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) },
+
+ /* OPTIONS */
+ { "OptionsAccounts", NULL, N_("_Accounts"), NULL, N_("Manage accounts"), G_CALLBACK (modest_ui_actions_on_accounts) },
+ { "OptionsContacts", NULL, N_("_Contacts"), NULL, N_("Manage contacts"), NULL },
+
+ /* HELP */
+ { "HelpAbout", GTK_STOCK_ABOUT, N_("About"), NULL, N_("About Modest"), G_CALLBACK (modest_ui_actions_on_about) },
+};
+
+
+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/gtktreeviewcolumn.h>
+#include <tny-account-store-view.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 <modest-runtime.h>
+#include "modest-widget-memory.h"
+#include "modest-ui-actions.h"
+#include "modest-main-window-ui.h"
+#include "modest-account-mgr.h"
+#include "modest-conf.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_sizes (ModestMainWindow *self);
+static void save_sizes (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);
+
+
+/* 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 *online_toggle;
+ GtkWidget *folder_info_label;
+
+ ModestHeaderView *header_view;
+ ModestFolderView *folder_view;
+ ModestMsgView *msg_preview;
+
+ GtkWidget *status_bar;
+ GtkWidget *progress_bar;
+
+};
+
+
+#define MODEST_MAIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
+ MODEST_TYPE_MAIN_WINDOW, \
+ ModestMainWindowPrivate))
+
+typedef struct _GetMsgAsyncHelper {
+ ModestMainWindowPrivate *main_window_private;
+ guint action;
+ ModestMailOperationReplyType reply_type;
+ ModestMailOperationForwardType forward_type;
+ gchar *from;
+ TnyIterator *iter;
+} GetMsgAsyncHelper;
+
+/* globals */
+static GtkWindowClass *parent_class = NULL;
+
+/* 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;
+
+ g_type_class_add_private (gobject_class, sizeof(ModestMainWindowPrivate));
+}
+
+static void
+modest_main_window_init (ModestMainWindow *obj)
+{
+ TnyAccountStore *account_store;
+ ModestMainWindowPrivate *priv;
+ TnyFolderStoreQuery *query;
+ GtkWidget *icon;
+ gboolean online;
+
+ priv = MODEST_MAIN_WINDOW_GET_PRIVATE(obj);
+
+ priv->folder_paned = NULL;
+ priv->msg_paned = NULL;
+ priv->main_paned = NULL;
+
+ account_store = TNY_ACCOUNT_STORE (modest_runtime_get_account_store ());
+
+ /* online/offline combo */
+ 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);
+
+ /* label with number of items, unread items for
+ the current folder */
+ priv->folder_info_label = gtk_label_new (NULL);
+
+ /* status bar */
+ priv->status_bar = gtk_statusbar_new ();
+ gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR(priv->status_bar),
+ FALSE);
+
+ /* progress bar */
+ priv->progress_bar = gtk_progress_bar_new ();
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(priv->progress_bar), 1.0);
+ gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR(priv->progress_bar),
+ PANGO_ELLIPSIZE_END);
+
+ /* msg preview */
+ priv->msg_preview = MODEST_MSG_VIEW(modest_msg_view_new (NULL));
+ 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_DETAILS));
+ 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));
+ 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,
+ ModestWidgetType widget_type)
+{
+ ModestMainWindowPrivate *priv;
+ GtkWidget *widget;
+
+ g_return_val_if_fail (self, NULL);
+ g_return_val_if_fail (widget_type >= 0 && widget_type < MODEST_WIDGET_TYPE_NUM,
+ NULL);
+
+ priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
+
+ switch (widget_type) {
+ case MODEST_WIDGET_TYPE_HEADER_VIEW:
+ widget = (GtkWidget*)priv->header_view; break;
+ case MODEST_WIDGET_TYPE_FOLDER_VIEW:
+ widget = (GtkWidget*)priv->folder_view; break;
+ case MODEST_WIDGET_TYPE_MSG_PREVIEW:
+ widget = (GtkWidget*)priv->msg_preview; break;
+ case MODEST_WIDGET_TYPE_STATUS_BAR:
+ widget = (GtkWidget*)priv->status_bar; break;
+ case MODEST_WIDGET_TYPE_PROGRESS_BAR:
+ widget = (GtkWidget*)priv->progress_bar; break;
+ default:
+ g_return_val_if_reached (NULL);
+ return NULL;
+ }
+
+ return widget ? GTK_WIDGET(widget) : NULL;
+}
+
+
+static void
+restore_sizes (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-folder-paned");
+ modest_widget_memory_restore (conf, G_OBJECT(priv->msg_paned),
+ "modest-msg-paned");
+ modest_widget_memory_restore (conf, G_OBJECT(priv->main_paned),
+ "modest-main-paned");
+ modest_widget_memory_restore (conf, G_OBJECT(priv->header_view),"header-view");
+ modest_widget_memory_restore (conf,G_OBJECT(self), "modest-main-window");
+}
+
+
+static void
+save_sizes (ModestMainWindow *self)
+{
+ ModestWindowPrivate *parent_priv;
+ ModestMainWindowPrivate *priv;
+ ModestConf *conf;
+
+ priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
+ parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
+
+ conf = modest_runtime_get_conf ();
+
+ modest_widget_memory_save (conf,G_OBJECT(self), "modest-main-window");
+ modest_widget_memory_save (conf, G_OBJECT(priv->folder_paned),
+ "modest-folder-paned");
+ modest_widget_memory_save (conf, G_OBJECT(priv->msg_paned),
+ "modest-msg-paned");
+ modest_widget_memory_save (conf, G_OBJECT(priv->main_paned),
+ "modest-main-paned");
+ modest_widget_memory_save (conf, G_OBJECT(priv->header_view), "header-view");
+}
+
+
+static void
+on_connection_changed (TnyDevice *device, gboolean online, ModestMainWindow *self)
+{
+ GtkWidget *icon;
+ const gchar *icon_name;
+ ModestMainWindowPrivate *priv;
+
+ g_return_if_fail (device);
+ g_return_if_fail (self);
+
+ priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
+
+ icon_name = online ? GTK_STOCK_CONNECT : GTK_STOCK_DISCONNECT;
+ icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
+
+ /* Block handlers in order to avoid unnecessary calls */
+ //g_signal_handler_block (G_OBJECT (priv->online_toggle), priv->toggle_button_signal);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->online_toggle), online);
+ //g_signal_handler_unblock (G_OBJECT (online_toggle), priv->toggle_button_signal);
+
+ gtk_button_set_image (GTK_BUTTON(priv->online_toggle), icon);
+ //statusbar_push (widget_factory, 0, online ? _("Modest went online") : _("Modest went offline"));
+
+ /* If Modest has became online and the header view has a
+ header selected then show it */
+ /* FIXME: there is a race condition if some account needs to
+ ask the user for a password */
+
+/* if (online) { */
+/* GtkTreeSelection *selected; */
+
+/* selected = gtk_tree_view_get_selection (GTK_TREE_VIEW (header_view)); */
+/* _modest_header_view_change_selection (selected, header_view); */
+/* } */
+}
+
+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)
+ tny_device_force_online (device);
+ else
+ tny_device_force_offline (device);
+}
+
+static gboolean
+on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMainWindow *self)
+{
+ save_sizes (self);
+ return FALSE;
+}
+
+static void
+on_destroy (GtkWidget *widget, GdkEvent *event, ModestMainWindow *self)
+{
+ gtk_main_quit();
+}
+
+
+
+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), "folder_selection_changed",
+ G_CALLBACK(modest_ui_actions_on_folder_selection_changed), self);
+ g_signal_connect (G_OBJECT(priv->folder_view), "button-press-event",
+ G_CALLBACK (on_folder_view_button_press_event),self);
+/* g_signal_connect (priv->folder_view, "popup-menu", */
+/* G_CALLBACK (on_folder_view_button_press_event),self); */
+
+ /* header view */
+ g_signal_connect (G_OBJECT(priv->header_view), "status_update",
+ G_CALLBACK(modest_ui_actions_on_header_status_update), self);
+ 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_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);
+
+ /* Account store */
+ g_signal_connect (G_OBJECT (modest_runtime_get_account_store()), "password_requested",
+ G_CALLBACK (modest_ui_actions_on_password_requested), self);
+
+ /* Device */
+ g_signal_connect (G_OBJECT(modest_runtime_get_device()), "connection_changed",
+ G_CALLBACK(on_connection_changed), self);
+ g_signal_connect (G_OBJECT(priv->online_toggle), "toggled",
+ G_CALLBACK(on_online_toggle_toggled), self);
+
+ /* window */
+ g_signal_connect (G_OBJECT(self), "destroy", G_CALLBACK(on_destroy), NULL);
+ g_signal_connect (G_OBJECT(self), "delete-event", G_CALLBACK(on_delete_event), 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;
+}
+
+
+
+
+ModestWindow *
+modest_main_window_new (void)
+{
+ GObject *obj;
+ ModestMainWindow *self;
+ ModestMainWindowPrivate *priv;
+ ModestWindowPrivate *parent_priv;
+ GtkWidget *main_vbox;
+ GtkWidget *status_hbox;
+ GtkWidget *header_win, *folder_win;
+ GtkActionGroup *action_group;
+ GError *error = 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();
+ action_group = gtk_action_group_new ("ModestMainWindowActions");
+
+ /* Add common actions */
+ gtk_action_group_add_actions (action_group,
+ modest_action_entries,
+ G_N_ELEMENTS (modest_action_entries),
+ 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-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 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");
+
+ gtk_toolbar_set_tooltips (GTK_TOOLBAR (parent_priv->toolbar), TRUE);
+ folder_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->folder_view), FALSE);
+ header_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->header_view), FALSE);
+
+ /* paned */
+ priv->folder_paned = gtk_vpaned_new ();
+ priv->msg_paned = gtk_vpaned_new ();
+ priv->main_paned = gtk_hpaned_new ();
+ 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), header_win);
+ gtk_paned_add2 (GTK_PANED(priv->msg_paned), GTK_WIDGET(priv->msg_preview));
+
+ /* status bar / progress */
+ 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->status_bar, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX(status_hbox), priv->progress_bar,FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(status_hbox), priv->online_toggle,FALSE, FALSE, 0);
+
+ /* putting it all together... */
+ main_vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(main_vbox), parent_priv->menubar, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(main_vbox), parent_priv->toolbar, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(main_vbox), priv->main_paned, TRUE, TRUE,0);
+ gtk_box_pack_start (GTK_BOX(main_vbox), status_hbox, FALSE, FALSE, 0);
+
+ gtk_container_add (GTK_CONTAINER(obj), main_vbox);
+ restore_sizes (MODEST_MAIN_WINDOW(obj));
+
+ 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 (main_vbox);
+
+ /* Connect signals */
+ connect_signals (MODEST_MAIN_WINDOW(obj));
+
+ /* 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 ()));
+
+ 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, "/HeaderViewContextMenu");
+
+ 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, "/FolderViewContextMenu");
+
+ 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;
+}
--- /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 <modest-widget-memory.h>
+#include <modest-account-mgr-helpers.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);
+
+/* list my signals */
+enum {
+ /* MY_SIGNAL_1, */
+ /* MY_SIGNAL_2, */
+ LAST_SIGNAL
+};
+
+typedef struct _ModestMsgEditWindowPrivate ModestMsgEditWindowPrivate;
+struct _ModestMsgEditWindowPrivate {
+
+ GtkWidget *toolbar;
+ GtkWidget *menubar;
+
+ GtkWidget *msg_body;
+ GtkWidget *from_field;
+ GtkWidget *to_field;
+ GtkWidget *cc_field;
+ GtkWidget *bcc_field;
+ GtkWidget *subject_field;
+};
+
+#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
+modest_msg_edit_window_class_init (ModestMsgEditWindowClass *klass)
+{
+ GObjectClass *gobject_class;
+ gobject_class = (GObjectClass*) 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));
+}
+
+static void
+modest_msg_edit_window_init (ModestMsgEditWindow *obj)
+{
+ ModestMsgEditWindowPrivate *priv;
+ priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj);
+
+ priv->toolbar = NULL;
+ 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;
+}
+
+static void
+save_settings (ModestMsgEditWindow *self)
+{
+ modest_widget_memory_save (modest_runtime_get_conf (),
+ G_OBJECT(self), "modest-edit-msg-window");
+}
+
+
+static void
+restore_settings (ModestMsgEditWindow *self)
+{
+ modest_widget_memory_restore (modest_runtime_get_conf (),
+ G_OBJECT(self), "modest-edit-msg-window");
+}
+
+
+
+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);
+ while (cursor) {
+ gchar *account_name = (gchar*)cursor->data;
+ gchar *from_string = modest_account_mgr_get_from_string (account_mgr,
+ account_name);
+ 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
+init_window (ModestMsgEditWindow *obj, const gchar* account)
+{
+ GtkWidget *to_button, *cc_button, *bcc_button;
+ GtkWidget *header_table;
+ GtkWidget *main_vbox;
+ ModestMsgEditWindowPrivate *priv;
+ ModestWindowPrivate *parent_priv;
+ ModestPairList *protos;
+
+ 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..."));
+
+ protos = get_transports ();
+ priv->from_field = modest_combo_box_new (protos, g_str_equal);
+ modest_pair_list_free (protos);
+ 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 = gtk_entry_new_with_max_length (80);
+ priv->cc_field = gtk_entry_new_with_max_length (80);
+ priv->bcc_field = gtk_entry_new_with_max_length (80);
+ priv->subject_field = gtk_entry_new_with_max_length (80);
+
+ header_table = gtk_table_new (5,2, FALSE);
+
+ gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("From:")),
+ 0,1,0,1, GTK_SHRINK, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE(header_table), to_button, 0,1,1,2, GTK_SHRINK, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE(header_table), cc_button, 0,1,2,3, GTK_SHRINK, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE(header_table), bcc_button, 0,1,3,4, GTK_SHRINK, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("Subject:")),
+ 0,1,4,5, GTK_SHRINK, 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), priv->subject_field,1,2,4,5);
+
+ priv->msg_body = gtk_text_view_new ();
+
+ main_vbox = gtk_vbox_new (FALSE, 6);
+
+ 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);
+ gtk_box_pack_start (GTK_BOX(main_vbox), header_table, FALSE, FALSE, 6);
+ gtk_box_pack_start (GTK_BOX(main_vbox), priv->msg_body, TRUE, TRUE, 6);
+
+ gtk_widget_show_all (GTK_WIDGET(main_vbox));
+ gtk_container_add (GTK_CONTAINER(obj), main_vbox);
+}
+
+
+static void
+modest_msg_edit_window_finalize (GObject *obj)
+{
+ G_OBJECT_CLASS(parent_class)->finalize (obj);
+}
+
+
+
+static gboolean
+on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgEditWindow *self)
+{
+ save_settings (self);
+ return FALSE;
+}
+
+
+static void
+set_msg (ModestMsgEditWindow *self, TnyMsg *msg)
+{
+ TnyHeader *header;
+ GtkTextBuffer *buf;
+ const gchar *to, *cc, *bcc, *subject;
+ ModestMsgEditWindowPrivate *priv;
+ gchar *body;
+
+ 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_get_to (header);
+ cc = tny_header_get_cc (header);
+ bcc = tny_header_get_bcc (header);
+ subject = tny_header_get_subject (header);
+
+ if (to)
+ gtk_entry_set_text (GTK_ENTRY(priv->to_field), to);
+ if (cc)
+ gtk_entry_set_text (GTK_ENTRY(priv->cc_field), cc);
+ if (bcc)
+ gtk_entry_set_text (GTK_ENTRY(priv->bcc_field), bcc);
+ if (subject)
+ gtk_entry_set_text (GTK_ENTRY(priv->subject_field), subject);
+
+
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW(priv->msg_body));
+ body = modest_tny_msg_get_body (msg, FALSE);
+ if (body)
+ gtk_text_buffer_set_text (buf, body, -1);
+ g_free (body);
+}
+
+
+ModestWindow *
+modest_msg_edit_window_new (TnyMsg *msg, const gchar *account)
+{
+ ModestMsgEditWindow *self;
+ ModestMsgEditWindowPrivate *priv;
+ ModestWindowPrivate *parent_priv;
+ GtkActionGroup *action_group;
+ GError *error = NULL;
+
+ g_return_val_if_fail (msg, 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");
+
+ /* 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_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 */
+ 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_EDIT_WINDOW(self), account);
+
+ 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);
+
+ set_msg (self, msg);
+
+ return MODEST_WINDOW(self);
+}
+
+
+MsgData *
+modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window)
+{
+ MsgData *data;
+ GtkTextBuffer *buf;
+ GtkTextIter b, e;
+ const gchar *account_name;
+ gchar *from_string = NULL;
+ ModestMsgEditWindowPrivate *priv;
+
+ 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);
+ if (!from_string) {
+ g_printerr ("modest: cannot get from string\n");
+ return NULL;
+ }
+
+ buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
+ gtk_text_buffer_get_bounds (buf, &b, &e);
+
+ /* don't free these (except from) */
+ data = g_slice_new0 (MsgData);
+ data->from = from_string, /* will be freed when data is freed */
+ data->to = (gchar*) gtk_entry_get_text (GTK_ENTRY(priv->to_field));
+ data->cc = (gchar*) gtk_entry_get_text (GTK_ENTRY(priv->cc_field));
+ data->bcc = (gchar*) gtk_entry_get_text (GTK_ENTRY(priv->bcc_field));
+ data->subject = (gchar*) gtk_entry_get_text (GTK_ENTRY(priv->subject_field));
+ data->body = gtk_text_buffer_get_text (buf, &b, &e, FALSE);
+
+ return data;
+}
+
+void
+modest_msg_edit_window_free_msg_data (ModestMsgEditWindow *edit_window,
+ MsgData *data)
+{
+ g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (edit_window));
+
+ g_free (data->from);
+ g_free (data->body);
+ g_slice_free (MsgData, data);
+}
--- /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 <widgets/modest-msg-view-window.h>
+#include <widgets/modest-window-priv.h>
+#include "widgets/modest-msg-view.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);
+
+/* 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;
+};
+
+#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;
+
+/* Action entries */
+static const GtkActionEntry modest_action_entries [] = {
+
+ /* Toplevel menus */
+ { "Edit", NULL, N_("_Edit") },
+ { "Actions", NULL, N_("_Actions") },
+ { "Help", NULL, N_("_Help") },
+
+ /* EDIT */
+ { "EditUndo", GTK_STOCK_UNDO, N_("_Undo"), "<CTRL>Z", N_("Undo last action"), NULL },
+ { "EditRedo", GTK_STOCK_REDO, N_("_Redo"), "<shift><CTRL>Z", N_("Redo previous action"), NULL },
+ { "EditCut", GTK_STOCK_CUT, N_("Cut"), "<CTRL>X", N_("_Cut"), NULL },
+ { "EditCopy", GTK_STOCK_COPY, N_("Copy"), "<CTRL>C", N_("Copy"), NULL },
+ { "EditPaste", GTK_STOCK_PASTE, N_("Paste"), "<CTRL>V", N_("Paste"), NULL },
+ { "EditDelete", GTK_STOCK_DELETE, N_("_Delete"), "<CTRL>Q", N_("Delete"), NULL },
+ { "EditSelectAll", NULL, N_("Select all"), "<CTRL>A", N_("Select all"), NULL },
+ { "EditDeselectAll", NULL, N_("Deselect all"), "<Shift><CTRL>A", N_("Deselect all"), NULL },
+
+ /* ACTIONS */
+ { "ActionsReply", MODEST_STOCK_REPLY, N_("_Reply"), NULL, N_("Reply to a message"), G_CALLBACK (modest_ui_actions_on_reply) },
+ { "ActionsReplyAll", MODEST_STOCK_REPLY_ALL, N_("Reply to all"), NULL, N_("Reply to all"), G_CALLBACK (modest_ui_actions_on_reply_all) },
+ { "ActionsForward", MODEST_STOCK_FORWARD, N_("_Forward"), NULL, N_("Forward a message"), G_CALLBACK (modest_ui_actions_on_forward) },
+ { "ActionsBounce", NULL, N_("_Bounce"), NULL, N_("Bounce a message"), NULL },
+ { "ActionsSendReceive", GTK_STOCK_REFRESH, N_("Send/Receive"), NULL, N_("Send and receive messages"), NULL },
+ { "ActionsDelete", MODEST_STOCK_DELETE, N_("Delete message"), NULL, N_("Delete messages"), G_CALLBACK (modest_ui_actions_on_delete) },
+
+ /* HELP */
+ { "HelpAbout", GTK_STOCK_ABOUT, N_("About"), NULL, N_("About Modest"), G_CALLBACK (modest_ui_actions_on_about) },
+};
+
+
+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
+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));
+}
+
+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;
+}
+
+static void
+save_settings (ModestMsgViewWindow *self)
+{
+ modest_widget_memory_save (modest_runtime_get_conf (),
+ G_OBJECT(self), "modest-msg-view-window");
+}
+
+
+static void
+restore_settings (ModestMsgViewWindow *self)
+{
+ modest_widget_memory_restore (modest_runtime_get_conf (),
+ G_OBJECT(self), "modest-msg-view-window");
+}
+
+
+static void
+init_window (ModestMsgViewWindow *obj, TnyMsg *msg)
+{
+ GtkWidget *main_vbox;
+ ModestMsgViewWindowPrivate *priv;
+ ModestWindowPrivate *parent_priv;
+
+ priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
+ parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
+
+ priv->msg_view = modest_msg_view_new (msg);
+ main_vbox = gtk_vbox_new (FALSE, 6);
+
+ 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);
+ gtk_box_pack_start (GTK_BOX(main_vbox), priv->msg_view, TRUE, TRUE, 6);
+
+ 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)
+{
+ G_OBJECT_CLASS(parent_class)->finalize (obj);
+}
+
+
+
+static gboolean
+on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgViewWindow *self)
+{
+ save_settings (self);
+ return FALSE;
+}
+
+
+ModestWindow *
+modest_msg_view_window_new (TnyMsg *msg, const gchar *account)
+{
+ GObject *obj;
+ ModestMsgViewWindowPrivate *priv;
+ ModestWindowPrivate *parent_priv;
+ GtkActionGroup *action_group;
+ GError *error = 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);
+
+ modest_window_set_active_account (MODEST_WINDOW(obj), account);
+
+ parent_priv->ui_manager = gtk_ui_manager_new();
+ action_group = gtk_action_group_new ("ModestMsgViewWindowActions");
+
+ /* Add common actions */
+ gtk_action_group_add_actions (action_group,
+ modest_action_entries,
+ G_N_ELEMENTS (modest_action_entries),
+ 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);
+ restore_settings (MODEST_MSG_VIEW_WINDOW(obj));
+
+ gtk_window_set_title (GTK_WINDOW(obj), "Modest");
+ gtk_window_set_icon_from_file (GTK_WINDOW(obj), MODEST_APP_ICON, NULL);
+
+ g_signal_connect (G_OBJECT(obj), "delete-event", G_CALLBACK(on_delete_event), obj);
+
+ return MODEST_WINDOW(obj);
+}
+
+
+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 modest_msg_view_get_message (MODEST_MSG_VIEW(msg_view));
+}
--- /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-platform.h>
+#include <libgnomevfs/gnome-vfs-mime.h>
+#include <libgnomeui/gnome-icon-lookup.h>
+#include <tny-gnome-device.h>
+
+gboolean
+modest_platform_init (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;
+}
--- /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 <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;
+ GtkWidget *security;
+ GtkWidget *auth;
+ GtkWidget *chooser;
+
+ ModestProtocol 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_UNKNOWN;
+}
+
+
+
+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)
+{
+ ModestPairList *protos;
+ 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);
+
+ protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_SECURITY);
+ priv->security = modest_combo_box_new (protos, g_str_equal);
+ modest_pair_list_free (protos);
+
+ 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);
+
+ protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_AUTH);
+ priv->auth = modest_combo_box_new (protos, g_str_equal);
+ modest_pair_list_free (protos);
+
+ 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)
+{
+ G_OBJECT_CLASS(parent_class)->finalize (obj);
+}
+
+
+
+GtkWidget*
+modest_store_widget_new (ModestProtocol 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_PROTOCOL_STORE_POP || proto == MODEST_PROTOCOL_STORE_IMAP)
+ w = imap_pop_configuration (self);
+ else if (proto == MODEST_PROTOCOL_STORE_MAILDIR)
+ w = maildir_configuration (self);
+ else if (proto == MODEST_PROTOCOL_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;
+}
+
+
+ModestProtocol
+modest_store_widget_get_proto (ModestStoreWidget *self)
+{
+ ModestStoreWidgetPrivate *priv;
+
+ g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+ 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, MODEST_PROTOCOL_UNKNOWN);
+ 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 ModestProtocol
+get_protocol_from_combo (GtkWidget *combo)
+{
+ gchar *chosen;
+
+ if (!combo)
+ return MODEST_PROTOCOL_UNKNOWN;
+
+ chosen = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
+
+ return modest_protocol_info_get_protocol (chosen);
+
+}
+
+ModestProtocol
+modest_store_widget_get_auth (ModestStoreWidget *self)
+{
+ ModestStoreWidgetPrivate *priv;
+
+ g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+ priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
+
+ return get_protocol_from_combo (priv->auth);
+}
+
+ModestProtocol
+modest_store_widget_get_security (ModestStoreWidget *self)
+{
+ ModestStoreWidgetPrivate *priv;
+
+ g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+ priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
+
+ return get_protocol_from_combo (priv->security);
+}
--- /dev/null
+/* modest-store-widget.h */
+/* insert (c)/licensing information) */
+
+#ifndef __MODEST_STORE_WIDGET_H__
+#define __MODEST_STORE_WIDGET_H__
+
+#include <gtk/gtkvbox.h>
+#include <modest-protocol-info.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 (ModestProtocol proto);
+
+const gchar* modest_store_widget_get_username (ModestStoreWidget *self);
+const gchar* modest_store_widget_get_servername (ModestStoreWidget *self);
+ModestProtocol modest_store_widget_get_proto (ModestStoreWidget *self);
+gchar * modest_store_widget_get_path (ModestStoreWidget *self);
+ModestProtocol modest_store_widget_get_auth (ModestStoreWidget *self);
+ModestProtocol modest_store_widget_get_security (ModestStoreWidget *self);
+
+G_END_DECLS
+
+#endif /* __MODEST_STORE_WIDGET_H__ */
+
--- /dev/null
+/* modest-transport-widget.c */
+
+/* insert (c)/licensing information) */
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <widgets/modest-combo-box.h>
+#include <modest-protocol-info.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 {
+ ModestProtocol proto;
+ GtkWidget *servername;
+ GtkWidget *username;
+ GtkWidget *auth;
+ GtkWidget *remember_pwd;
+};
+#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_UNKNOWN;
+}
+
+static void
+modest_transport_widget_finalize (GObject *obj)
+{
+ 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;
+ ModestPairList *protos;
+
+ 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);
+
+ protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_AUTH);
+ combo = modest_combo_box_new (protos, g_str_equal);
+ modest_pair_list_free (protos);
+
+ 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);
+
+ protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_AUTH);
+ combo = modest_combo_box_new (protos, g_str_equal);
+ modest_pair_list_free (protos);
+
+ 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 (ModestProtocol 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_PROTOCOL_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));
+}
+
+
+ModestProtocol
+modest_transport_widget_get_proto (ModestTransportWidget *self)
+{
+ ModestTransportWidgetPrivate *priv;
+
+ g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
+ priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
+
+ return priv->proto;
+}
+
--- /dev/null
+/* modest-transport-widget.h */
+/* insert (c)/licensing information) */
+
+#ifndef __MODEST_TRANSPORT_WIDGET_H__
+#define __MODEST_TRANSPORT_WIDGET_H__
+
+G_BEGIN_DECLS
+
+#include <gtk/gtkvbox.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 (ModestProtocol 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);
+ModestProtocol modest_transport_widget_get_proto (ModestTransportWidget *self);
+
+G_END_DECLS
+
+#endif /* __MODEST_TRANSPORT_WIDGET_H__ */
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ sodipodi:docname="modest-email.svg"
+ sodipodi:docbase="/home/djcb/Desktop"
+ inkscape:version="0.44"
+ sodipodi:version="0.32"
+ id="svg5816"
+ height="48px"
+ width="48px">
+ <defs
+ id="defs3">
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6719"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060">
+ <stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient6717"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" />
+ <linearGradient
+ id="linearGradient5048">
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" />
+ <stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient6715"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" />
+ <linearGradient
+ id="linearGradient28260">
+ <stop
+ style="stop-color:#9aa29a;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop28262" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop28264" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient28254">
+ <stop
+ id="stop28256"
+ offset="0.0000000"
+ style="stop-color:#9aa29a;stop-opacity:1.0000000;" />
+ <stop
+ id="stop28258"
+ offset="1.0000000"
+ style="stop-color:none" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2274">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.12871288;"
+ offset="0.0000000"
+ id="stop2276" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0.0000000;"
+ offset="1.0000000"
+ id="stop2278" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient9749">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop9751" />
+ <stop
+ style="stop-color:#ededed;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop9753" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2152">
+ <stop
+ style="stop-color:#9aa29a;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop2154" />
+ <stop
+ style="stop-color:#b5beb5;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2156" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2166">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2168" />
+ <stop
+ style="stop-color:#dcdcdc;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2170" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient18913">
+ <stop
+ style="stop-color:#ededed;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop18915" />
+ <stop
+ style="stop-color:#c8c8c8;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop18917" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient2136">
+ <stop
+ style="stop-color:#989690;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop2138" />
+ <stop
+ style="stop-color:#656460;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop2140" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient15107">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop15109" />
+ <stop
+ style="stop-color:#e2e2e2;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop15111" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient10691"
+ inkscape:collect="always">
+ <stop
+ id="stop10693"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop10695"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <radialGradient
+ r="7.2284161"
+ fy="73.615714"
+ fx="6.7027131"
+ cy="73.615714"
+ cx="6.7027131"
+ gradientTransform="scale(1.902215,0.525703)"
+ gradientUnits="userSpaceOnUse"
+ id="radialGradient11382"
+ xlink:href="#linearGradient10691"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="32.203162"
+ x2="9.7619219"
+ y1="37.784682"
+ x1="8.7803760"
+ gradientTransform="matrix(2.394900,0.000000,0.000000,0.781058,2.879512,0.343005)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient27463"
+ xlink:href="#linearGradient2274"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="24.132717"
+ x2="21.111549"
+ y1="13.686079"
+ x1="11.233107"
+ gradientTransform="matrix(1.370928,0.000000,0.000000,1.443758,2.431133,-0.140786)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient27468"
+ xlink:href="#linearGradient9749"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="52.090678"
+ x2="9.8855033"
+ y1="37.197018"
+ x1="8.9156475"
+ gradientTransform="matrix(2.454781,0.000000,0.000000,0.762004,2.879512,0.343005)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient27471"
+ xlink:href="#linearGradient2152"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="52.090678"
+ x2="9.8855033"
+ y1="37.197018"
+ x1="8.9156475"
+ gradientTransform="matrix(2.454781,0.000000,0.000000,0.762004,2.879512,0.343005)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient27474"
+ xlink:href="#linearGradient2152"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="29.568739"
+ x2="15.310744"
+ y1="15.148383"
+ x1="10.184240"
+ gradientTransform="matrix(1.819266,0.000000,0.000000,1.028193,2.879512,0.343005)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient27477"
+ xlink:href="#linearGradient2166"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="17.876846"
+ x2="13.467486"
+ y1="7.2310905"
+ x1="5.8266134"
+ gradientTransform="matrix(1.570607,0.000000,0.000000,1.190976,2.879512,0.343005)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient27483"
+ xlink:href="#linearGradient18913"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="26.022910"
+ x2="18.475286"
+ y1="4.7461626"
+ x1="11.572842"
+ gradientTransform="matrix(1.343475,0.000000,0.000000,1.417854,2.879511,0.314599)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient27486"
+ xlink:href="#linearGradient15107"
+ inkscape:collect="always" />
+ <linearGradient
+ y2="15.257116"
+ x2="30.599684"
+ y1="15.257116"
+ x1="2.0618774"
+ gradientTransform="matrix(1.343475,0.000000,0.000000,1.417854,2.879511,0.314599)"
+ gradientUnits="userSpaceOnUse"
+ id="linearGradient27488"
+ xlink:href="#linearGradient2136"
+ inkscape:collect="always" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-y="81"
+ inkscape:window-x="518"
+ inkscape:window-height="743"
+ inkscape:window-width="874"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showgrid="false"
+ inkscape:current-layer="layer2"
+ inkscape:cy="18.316166"
+ inkscape:cx="28.384904"
+ inkscape:zoom="8"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Mail</dc:title>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Andreas Nilsson</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>mail</rdf:li>
+ <rdf:li>e-mail</rdf:li>
+ <rdf:li>MUA</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Attribution" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ inkscape:label="Layer 1"
+ id="layer1">
+ <g
+ transform="matrix(2.269972e-2,0,0,2.297929e-2,44.98918,37.78447)"
+ id="g6707">
+ <rect
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient6715);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect6709"
+ width="1339.6335"
+ height="478.35718"
+ x="-1559.2523"
+ y="-150.69685" />
+ <path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6717);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ id="path6711"
+ sodipodi:nodetypes="cccc" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path6713"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient6719);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <path
+ style="fill:url(#linearGradient27486);fill-opacity:1.0000000;fill-rule:evenodd;stroke:url(#linearGradient27488);stroke-width:0.85660440;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+ d="M 6.3334395,16.972251 L 6.3334395,41.481799 L 43.305555,41.481799 L 43.244499,17.089859 C 43.241050,15.712272 31.395999,2.4121110 29.210877,2.4121110 L 20.659391,2.4121110 C 18.362072,2.4121110 6.3334395,15.673953 6.3334395,16.972251 z "
+ id="path12723"
+ sodipodi:nodetypes="ccczzzz" />
+ <path
+ style="fill:url(#linearGradient27483);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:0.25000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+ d="M 6.9230610,16.787103 C 6.5250222,16.356975 18.809966,3.0935378 20.667210,3.0935378 L 29.042965,3.0935378 C 30.790449,3.0935378 43.079567,16.221603 42.470079,16.978956 L 31.608858,30.475150 L 19.295373,30.156846 L 6.9230610,16.787103 z "
+ id="path18153"
+ sodipodi:nodetypes="czzzccz" />
+ <path
+ style="fill:#000000;fill-opacity:0.14619882;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+ d="M 19.077530,30.017590 L 11.744526,21.271586 L 36.562951,14.335513 L 39.592221,20.551966 L 32.175956,29.992298"
+ id="path2164"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:#000000;fill-opacity:0.14619882;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+ d="M 18.291767,29.836259 L 10.809167,21.026146 L 35.456637,14.132812 L 38.630714,20.403811 L 31.390193,29.810968"
+ id="path2162"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:#000000;fill-opacity:0.14619882;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+ d="M 18.775313,29.957146 L 11.100386,21.296624 L 36.068405,14.232329 L 39.354114,20.824726 L 31.873739,29.931855"
+ id="path2160"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:url(#linearGradient27477);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+ d="M 18.593984,30.440693 L 11.260975,21.694689 L 35.972554,14.801355 L 39.083369,21.188770 L 31.963198,30.174701"
+ id="path15105"
+ sodipodi:nodetypes="ccccc" />
+ <path
+ style="fill:url(#linearGradient27474);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+ d="M 20.488434,29.064331 L 7.0924698,40.036319 L 21.001312,30.432013 L 30.019470,30.432013 L 42.438517,39.914206 L 30.575092,29.064331 L 20.488434,29.064331 z "
+ id="path14245"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ style="color:#000000;fill:url(#linearGradient27471);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
+ d="M 6.9634751,16.885144 L 18.479648,31.201334 L 19.548151,30.346532 L 6.9634751,16.885144 z "
+ id="path14339"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:url(#linearGradient27468);stroke-width:0.85660428;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+ d="M 7.3077115,17.131415 L 7.3388644,40.342421 L 42.283659,40.342421 L 42.221353,17.257512 C 42.219329,16.508413 31.005032,3.4591863 28.837233,3.4591863 L 20.941579,3.4591863 C 18.689313,3.4591863 7.3066655,16.351067 7.3077115,17.131415 z "
+ id="path15103"
+ sodipodi:nodetypes="ccczzzz" />
+ <path
+ style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+ d="M 20.957271,30.452732 L 9.0157722,38.723588 L 11.235205,38.729695 L 21.233330,31.860755 L 30.055238,30.437917 L 20.957271,30.452732 z "
+ id="path17393"
+ sodipodi:nodetypes="cccccc" />
+ <path
+ style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+ d="M 11.427536,21.670296 L 12.752479,23.080719 L 35.543311,16.196529 L 38.458445,21.878896 L 39.072496,21.166981 L 36.003081,14.789145 L 11.427536,21.670296 z "
+ id="path2174"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ style="fill:url(#linearGradient27463);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+ d="M 13.308098,23.636340 L 19.334450,30.090093 L 20.531174,29.064331 L 30.617831,29.107071 L 31.429893,29.833651 L 35.404721,25.089502 C 34.250740,23.679081 13.308098,23.636340 13.308098,23.636340 z "
+ id="path2272"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path27492"
+ d="M 41.812936,17.847945 L 31.861315,30.479232 L 30.792812,29.624431 L 41.812936,17.847945 z "
+ style="color:#000000;fill:#b1b1b1;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="M">
+ <text
+ xml:space="preserve"
+ style="font-size:32px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:80.00000119%;writing-mode:lr-tb;text-anchor:start;fill:#f57900;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Century Schoolbook L"
+ x="12"
+ y="36.125"
+ id="text1968"
+ sodipodi:linespacing="80.000001%"><tspan
+ sodipodi:role="line"
+ id="tspan1970"
+ x="12"
+ y="36.125">m</tspan></text>
+ </g>
+</svg>
--- /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="FileMenu" action="File">
+ <menuitem name="FileNewMenu" action="FileNew"/>
+ <menuitem name="FileOpenMenu" action="FileOpen"/>
+ <separator/>
+ <menuitem name="FileSaveMenu" action="FileSave"/>
+ <menuitem name="FileSaveAsMenu" action="FileSaveAs"/>
+ <separator/>
+ <menuitem name="FileQuitMenu" action="FileQuit"/>
+ </menu>
+
+ <menu name="EditMenu" action="Edit">
+ <menuitem name="EditUndoMenu" action="EditUndo"/>
+ <menuitem name="EditRedoMenu" action="EditRedo"/>
+ <separator/>
+ <menuitem name="EditCutMenu" action="EditCut"/>
+ <menuitem name="EditCopyMenu" action="EditCopy"/>
+ <menuitem name="EditPasteMenu" action="EditPaste"/>
+ <menuitem name="EditDeleteMenu" action="EditDelete"/>
+ <separator/>
+ <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
+ <menuitem name="EditDeselectAllMenu" action="EditDeselectAll"/>
+ </menu>
+
+ <menu name="ActionsMenu" action="Actions">
+ <menuitem name="ActionsNewMenu" action="ActionsNew"/>
+ <menuitem name="ActionsReplyMenu" action="ActionsReply"/>
+ <menuitem name="ActionsForwardMenu" action="ActionsForward"/>
+ <menuitem name="ActionsBounceMenu" action="ActionsBounce"/>
+ <separator/>
+ <menuitem name="ActionsFolderNewMenu" action="ActionsFolderNew"/>
+ <menuitem name="ActionsFolderDeleteMenu" action="ActionsFolderDelete"/>
+ <menuitem name="ActionsFolderRenameMenu" action="ActionsFolderRename"/>
+ <menuitem name="ActionsFolderMoveToTrashMenu" action="ActionsFolderMoveToTrash"/>
+ </menu>
+
+ <menu name="OptionsMenu" action="Options">
+ <menuitem name="OptionsAccountsMenu" action="OptionsAccounts"/>
+ <menuitem name="OptionsContactsMenu" action="OptionsContacts"/>
+ </menu>
+
+ <menu name="HelpMenu" action="Help">
+ <menuitem name="HelpAboutMenu" action="HelpAbout"/>
+ </menu>
+ </menubar>
+
+ <toolbar name="ToolBar">
+ <toolitem action="ActionsNew"/>
+ <separator/>
+ <toolitem action="ActionsReply"/>
+ <toolitem action="ActionsReplyAll"/>
+ <toolitem action="ActionsForward"/>
+ <separator/>
+ <toolitem action="ActionsSendReceive"/>
+ <separator/>
+ <toolitem action="GotoPrevious"/>
+ <toolitem action="GotoNext"/>
+ <separator/>
+ <toolitem action="ActionsDelete"/>
+ <separator/>
+ <toolitem name="ToggleView" action="ToggleView"/>
+ </toolbar>
+
+ <popup name="HeaderViewContextMenu">
+ <menuitem action="ActionsReply"/>
+ <menuitem action="ActionsForward"/>
+ </popup>
+
+ <popup name="FolderViewContextMenu">
+ <menuitem action="ActionsFolderNew"/>
+ <menuitem action="ActionsFolderDelete"/>
+ <menuitem action="ActionsFolderRename"/>
+ <menuitem action="ActionsFolderMoveToTrash"/>
+ </popup>
+
+</ui>
\ No newline at end of file
--- /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="ViewMenu" action="View">
+ <menuitem name="ViewToFieldMenu" action="ViewToField"/>
+ <menuitem name="ViewCcFieldMenu" action="ViewCcField"/>
+ <menuitem name="ViewBccFieldMenu" action="ViewBccField"/>
+ </menu>
+
+ </menubar>
+
+ <toolbar name="ToolBar">
+ <toolitem action="ActionsSend"/>
+ </toolbar>
+
+</ui>
\ No newline at end of file
--- /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="EditMenu" action="Edit">
+ <menuitem name="EditUndoMenu" action="EditUndo"/>
+ <menuitem name="EditRedoMenu" action="EditRedo"/>
+ <separator/>
+ <menuitem name="EditCutMenu" action="EditCut"/>
+ <menuitem name="EditCopyMenu" action="EditCopy"/>
+ <menuitem name="EditPasteMenu" action="EditPaste"/>
+ <menuitem name="EditDeleteMenu" action="EditDelete"/>
+ <separator/>
+ <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
+ <menuitem name="EditDeselectAllMenu" action="EditDeselectAll"/>
+ </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="ActionsReply"/>
+ <toolitem action="ActionsReplyAll"/>
+ <toolitem action="ActionsForward"/>
+ </toolbar>
+</ui>
+++ /dev/null
-#
-# Makefile.am
-# Time-stamp: <2007-02-10 14:47:15 (djcb)>
-#
-#
-# use Automake 'trick' ==> convenience static libraries, which
-# won't be installed, just for linking
-#
-INCLUDES=\
- $(MODEST_GSTUFF_CFLAGS) \
- $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS) \
- -DMODEST_PLATFORM_ID=$(MODEST_PLATFORM_ID) \
- -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 \
- pixmaps/*.svg
-
-libmodest_ui_la_SOURCES= \
- modest-account-assistant.c \
- modest-account-assistant.h \
- modest-account-view-window.c \
- modest-msg-edit-window.c \
- modest-icon-names.h \
- modest-main-window.c \
- modest-main-window-ui.h \
- modest-msg-view-window.c \
- modest-store-widget.c \
- modest-store-widget.h \
- modest-transport-widget.c \
- modest-transport-widget.h
-
-LDADD = \
- $(MODEST_GSTUFF_LIBS) \
- $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_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-protocol-info.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);
-
-/* list my signals */
-enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
- LAST_SIGNAL
-};
-
-typedef struct _ModestAccountAssistantPrivate ModestAccountAssistantPrivate;
-struct _ModestAccountAssistantPrivate {
-
- ModestAccountMgr *account_mgr;
-
- GtkWidget *account_name;
- GtkWidget *fullname;
- GtkWidget *email;
-
- GtkWidget *store_widget;
- GtkWidget *transport_widget;
-
- GtkWidget *transport_holder;
- GtkWidget *store_holder;
-};
-
-#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}; */
-
-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 (GTK_TYPE_ASSISTANT,
- "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));
-
- /* 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
-add_intro_page (ModestAccountAssistant *assistant)
-{
- GtkWidget *page, *label;
-
- page = gtk_vbox_new (FALSE, 6);
-
- label = gtk_label_new (
- _("Welcome to the account assistant\n\n"
- "It will help to set up a new e-mail account\n"));
- gtk_box_pack_start (GTK_BOX(page), label, FALSE, FALSE, 6);
- gtk_widget_show_all (page);
-
- gtk_assistant_append_page (GTK_ASSISTANT(assistant), page);
-
- gtk_assistant_set_page_title (GTK_ASSISTANT(assistant), page,
- _("Modest Account Assistant"));
- gtk_assistant_set_page_type (GTK_ASSISTANT(assistant), page,
- GTK_ASSISTANT_PAGE_INTRO);
- gtk_assistant_set_page_complete (GTK_ASSISTANT(assistant),
- page, TRUE);
-}
-
-
-static void
-set_current_page_complete (ModestAccountAssistant *self, gboolean complete)
-{
- GtkWidget *page;
- gint pageno;
-
- pageno = gtk_assistant_get_current_page (GTK_ASSISTANT(self));
-
- if (pageno != -1) {
- page = gtk_assistant_get_nth_page (GTK_ASSISTANT(self), pageno);
- gtk_assistant_set_page_complete (GTK_ASSISTANT(self), page, complete);
- }
-}
-
-
-static void
-identity_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->fullname));
- if (!txt || strlen(txt) == 0) {
- set_current_page_complete (self, FALSE);
- return;
- }
-
- /* FIXME: regexp check for email address */
- txt = gtk_entry_get_text (GTK_ENTRY(priv->email));
- if (!modest_text_utils_validate_email_address (txt))
- set_current_page_complete (self, FALSE);
- else
- set_current_page_complete (self, TRUE);
-}
-
-
-static void
-add_identity_page (ModestAccountAssistant *self)
-{
- GtkWidget *page, *label, *table;
- ModestAccountAssistantPrivate *priv;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- priv->fullname = gtk_entry_new_with_max_length (40);
- priv->email = gtk_entry_new_with_max_length (40);
-
- page = gtk_vbox_new (FALSE, 6);
-
- label = gtk_label_new (
- _("Please enter your name and your e-mail address below.\n\n"));
- gtk_box_pack_start (GTK_BOX(page), label, FALSE, FALSE, 6);
-
- table = gtk_table_new (2,2, FALSE);
- gtk_table_attach_defaults (GTK_TABLE(table),gtk_label_new (_("Full name")),
- 0,1,0,1);
- gtk_table_attach_defaults (GTK_TABLE(table),gtk_label_new (_("E-mail 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);
-
- g_signal_connect (G_OBJECT(priv->fullname), "changed",
- G_CALLBACK(identity_page_update_completeness),
- self);
- g_signal_connect (G_OBJECT(priv->email), "changed",
- G_CALLBACK(identity_page_update_completeness),
- self);
-
- gtk_box_pack_start (GTK_BOX(page), table, FALSE, FALSE, 6);
- gtk_widget_show_all (page);
-
- gtk_assistant_append_page (GTK_ASSISTANT(self), page);
-
- gtk_assistant_set_page_title (GTK_ASSISTANT(self), page,
- _("Identity"));
- gtk_assistant_set_page_type (GTK_ASSISTANT(self), page,
- GTK_ASSISTANT_PAGE_INTRO);
- gtk_assistant_set_page_complete (GTK_ASSISTANT(self),
- page, FALSE);
-}
-
-
-static void
-receiving_page_update_completeness (GtkEditable *editable,
- ModestAccountAssistant *self)
-{
- ModestAccountAssistantPrivate *priv;
- const gchar *txt;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- txt = modest_store_widget_get_username (MODEST_STORE_WIDGET (priv->store_widget));
- if (!txt || strlen(txt) == 0) {
- set_current_page_complete (self, FALSE);
- return;
- }
-
- txt = modest_store_widget_get_servername (MODEST_STORE_WIDGET (priv->store_widget));
- if (!txt || strlen(txt) == 0) {
- set_current_page_complete (self, FALSE);
- return;
- }
- set_current_page_complete (self, TRUE);
-}
-
-static void
-on_receiving_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->store_widget)
- gtk_container_remove (GTK_CONTAINER(priv->store_holder),
- priv->store_widget);
-
- proto = modest_protocol_info_get_protocol (chosen);
-
- /* FIXME: we could have these widgets cached instead of
- creating them every time */
- priv->store_widget = modest_store_widget_new (proto);
- if (proto == MODEST_PROTOCOL_STORE_POP || proto == MODEST_PROTOCOL_STORE_IMAP) {
- g_signal_connect (priv->store_widget,
- "data_changed",
- G_CALLBACK (receiving_page_update_completeness),
- self);
- set_current_page_complete (self, FALSE);
- } else
- set_current_page_complete (self, TRUE);
-
- gtk_container_add (GTK_CONTAINER(priv->store_holder),
- priv->store_widget);
-
- gtk_widget_show_all (priv->store_holder);
-
-}
-
-static void
-add_receiving_page (ModestAccountAssistant *self)
-{
- GtkWidget *page, *box, *combo;
- ModestPairList *protos;
- ModestAccountAssistantPrivate *priv;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
- page = gtk_vbox_new (FALSE, 6);
-
- gtk_box_pack_start (GTK_BOX(page),
- gtk_label_new (
- _("Please select among the following options")),
- FALSE, FALSE, 6);
- box = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX(box),
- gtk_label_new(_("Server type")),
- FALSE,FALSE,6);
-
- protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_STORE);
- combo = modest_combo_box_new (protos, g_str_equal);
- modest_pair_list_free (protos);
-
- g_signal_connect (G_OBJECT(combo), "changed",
- G_CALLBACK(on_receiving_combo_box_changed), self);
-
- gtk_box_pack_start (GTK_BOX(box), combo, FALSE,FALSE,6);
- gtk_box_pack_start (GTK_BOX(page), box, FALSE,FALSE, 6);
-
- gtk_box_pack_start (GTK_BOX(page), gtk_hseparator_new(), FALSE, FALSE, 0);
-
- priv->store_holder = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX(page), priv->store_holder,
- TRUE, TRUE, 0);
-
- /* Force the selection */
- on_receiving_combo_box_changed (GTK_COMBO_BOX (combo), self);
-
- gtk_assistant_append_page (GTK_ASSISTANT(self), page);
-
- gtk_assistant_set_page_title (GTK_ASSISTANT(self), page,
- _("Receiving mail"));
- gtk_assistant_set_page_type (GTK_ASSISTANT(self), page,
- GTK_ASSISTANT_PAGE_INTRO);
- gtk_assistant_set_page_complete (GTK_ASSISTANT(self),
- page, FALSE);
- gtk_widget_show_all (page);
-}
-
-
-
-
-static void
-on_sending_combo_box_changed (GtkComboBox *combo, ModestAccountAssistant *self)
-{
- ModestAccountAssistantPrivate *priv;
- gchar *chosen;
-
- 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);
- priv->transport_widget =
- modest_transport_widget_new (modest_protocol_info_get_protocol(chosen));
-
- gtk_container_add (GTK_CONTAINER(priv->transport_holder),
- priv->transport_widget);
-
- gtk_widget_show_all (priv->transport_holder);
-}
-
-
-
-static void
-add_sending_page (ModestAccountAssistant *self)
-{
- GtkWidget *page, *box, *combo;
- ModestPairList *protos;
- ModestAccountAssistantPrivate *priv;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
- page = gtk_vbox_new (FALSE, 6);
-
- gtk_box_pack_start (GTK_BOX(page),
- gtk_label_new (
- _("Please select among the following options")),
- FALSE, FALSE, 0);
- box = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX(box),
- gtk_label_new(_("Server type")),
- FALSE,FALSE,0);
-
- protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_TRANSPORT);
- combo = modest_combo_box_new (protos, g_str_equal);
- modest_pair_list_free (protos);
-
- g_signal_connect (G_OBJECT(combo), "changed",
- G_CALLBACK(on_sending_combo_box_changed), self);
-
- gtk_box_pack_start (GTK_BOX(box), combo, FALSE,FALSE,0);
- gtk_box_pack_start (GTK_BOX(page), box, FALSE,FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX(page), gtk_hseparator_new(), FALSE, FALSE, 0);
-
- priv->transport_holder = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX(page), priv->transport_holder,
- FALSE, FALSE, 0);
-
- /* Force the selection */
- on_sending_combo_box_changed (GTK_COMBO_BOX (combo), self);
-
- gtk_assistant_append_page (GTK_ASSISTANT(self), page);
-
- gtk_assistant_set_page_title (GTK_ASSISTANT(self), page,
- _("Sending mail"));
- gtk_assistant_set_page_type (GTK_ASSISTANT(self), page,
- GTK_ASSISTANT_PAGE_INTRO);
- gtk_assistant_set_page_complete (GTK_ASSISTANT(self),
- page, TRUE);
- gtk_widget_show_all (page);
-}
-
-
-
-static void
-add_final_page (ModestAccountAssistant *self)
-{
- GtkWidget *page, *box;
- ModestAccountAssistantPrivate *priv;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
- page = gtk_vbox_new (FALSE, 6);
-
- gtk_box_pack_start (GTK_BOX(page),
- gtk_label_new (
- _("We're almost done. Press 'Apply' to store this new account")),
- FALSE, FALSE, 6);
- box = gtk_hbox_new (FALSE, 6);
- priv->account_name =
- gtk_entry_new_with_max_length (40);
- gtk_entry_set_text (GTK_ENTRY(priv->account_name),
- gtk_entry_get_text(GTK_ENTRY(priv->email)));
- gtk_box_pack_start (GTK_BOX(box),gtk_label_new(_("Account name:")),
- FALSE,FALSE,6);
- gtk_box_pack_start (GTK_BOX(box),priv->account_name , FALSE,FALSE,6);
-
- gtk_box_pack_start (GTK_BOX(page), box, FALSE, FALSE, 6);
-
- gtk_assistant_append_page (GTK_ASSISTANT(self), page);
-
- gtk_assistant_set_page_title (GTK_ASSISTANT(self), page,
- _("Account Management"));
- gtk_assistant_set_page_type (GTK_ASSISTANT(self), page,
- GTK_ASSISTANT_PAGE_CONFIRM);
-
- gtk_assistant_set_page_complete (GTK_ASSISTANT(self),
- page, TRUE);
- 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_widget = NULL;
- priv->transport_widget = NULL;
-}
-
-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;
- }
-
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-static void
-on_cancel (ModestAccountAssistant *self, gpointer user_data)
-{
- GtkWidget *label;
- GtkWidget *dialog;
- int response;
-
- label = gtk_label_new (_("Are you sure you want to cancel\n"
- "setting up a new account?"));
-
- dialog = gtk_dialog_new_with_buttons (_("Cancel"),
- GTK_WINDOW(self),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_YES, GTK_RESPONSE_ACCEPT,
- GTK_STOCK_NO, GTK_RESPONSE_CANCEL,
- NULL);
-
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox),
- label, FALSE, FALSE, 6);
-
- gtk_widget_show_all ((GTK_DIALOG(dialog)->vbox));
-
- gtk_window_set_resizable (GTK_WINDOW(dialog), FALSE);
-
- response = gtk_dialog_run (GTK_DIALOG(dialog));
- gtk_widget_destroy (dialog);
-
- switch (response) {
- case GTK_RESPONSE_ACCEPT:
- /* close the assistant */
- gtk_widget_hide (GTK_WIDGET(self));
- break;
- case GTK_RESPONSE_CANCEL:
- /* don't do anything */
- break;
- default: g_assert_not_reached ();
-
- };
-}
-
-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));
-}
-
-
-static void
-on_close (ModestAccountAssistant *self, gpointer user_data)
-{
- gtk_widget_hide (GTK_WIDGET (self));
-}
-
-
-/*
- * FIXME: hmmmm this a Camel internal thing, should move this
- * somewhere else
- */
-static gchar*
-get_account_uri (ModestProtocol proto, const gchar* path)
-{
- CamelURL *url;
- gchar *uri;
-
- switch (proto) {
- case MODEST_PROTOCOL_STORE_MBOX:
- url = camel_url_new ("mbox:", NULL); break;
- case MODEST_PROTOCOL_STORE_MAILDIR:
- url = camel_url_new ("maildir:", NULL); break;
- default:
- 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, ModestProtocol proto,
- const gchar* username, const gchar *servername)
-{
- gchar *name;
- gint i = 0;
-
- while (TRUE) {
- name = g_strdup_printf ("%s:%d",
- modest_protocol_info_get_protocol_name(proto), i++);
- if (modest_account_mgr_account_exists (acc_mgr, name, TRUE))
- g_free (name);
- else
- break;
- }
- return name;
-}
-
-
-static void
-on_apply (ModestAccountAssistant *self, gpointer user_data)
-{
- ModestAccountAssistantPrivate *priv;
- ModestProtocol proto, security, auth;
- gchar *store_name, *transport_name;
- const gchar *account_name, *username, *servername, *path;
- ModestStoreWidget *store;
- ModestTransportWidget *transport;
-
- priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
-
- /* create server account -> store */
- store = MODEST_STORE_WIDGET(priv->store_widget);
- proto = modest_store_widget_get_proto (store);
- username = modest_store_widget_get_username (store);
- servername = modest_store_widget_get_servername (store);
- path = modest_store_widget_get_path (store);
- security = modest_store_widget_get_security (store);
- auth = modest_store_widget_get_auth (store);
- store_name = get_new_server_account_name (priv->account_mgr, proto,username, servername);
-
- if (proto == MODEST_PROTOCOL_STORE_MAILDIR ||
- proto == MODEST_PROTOCOL_STORE_MBOX) {
- gchar *uri = get_account_uri (proto, path);
- modest_account_mgr_add_server_account_uri (priv->account_mgr, store_name, proto, uri);
- g_free (uri);
- } else
- modest_account_mgr_add_server_account (priv->account_mgr, store_name, servername,
- username, NULL, proto, security, auth);
-
- /* create server account -> transport */
- transport = MODEST_TRANSPORT_WIDGET(priv->transport_widget);
- proto = modest_transport_widget_get_proto (transport);
- username = NULL;
- servername = NULL;
- if (proto == MODEST_PROTOCOL_TRANSPORT_SMTP) {
- servername = modest_transport_widget_get_servername (transport);
- if (modest_transport_widget_get_requires_auth (transport))
- username = modest_transport_widget_get_username (transport);
- }
-
- transport_name = get_new_server_account_name (priv->account_mgr, proto,username, servername);
- modest_account_mgr_add_server_account (priv->account_mgr,
- transport_name, servername,
- username, NULL,
- proto, security, auth);
-
- /* create account */
- account_name = get_account_name (self);
- modest_account_mgr_add_account (priv->account_mgr,
- account_name,
- store_name,
- transport_name);
- modest_account_mgr_set_string (priv->account_mgr,
- account_name,
- MODEST_ACCOUNT_FULLNAME,
- get_fullname(self), FALSE);
- modest_account_mgr_set_string (priv->account_mgr,
- account_name,
- MODEST_ACCOUNT_EMAIL,
- get_email(self), FALSE);
-
- /* Frees */
- g_free (store_name);
- g_free (transport_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;
-
- add_intro_page (self);
- add_identity_page (self);
- add_receiving_page (self);
- add_sending_page (self);
- add_final_page (self);
-
- gtk_assistant_set_current_page (GTK_ASSISTANT(self), 0);
- gtk_window_set_title (GTK_WINDOW(self),
- _("Modest Account Wizard"));
- gtk_window_set_resizable (GTK_WINDOW(self), TRUE);
- gtk_window_set_default_size (GTK_WINDOW(self), 400, 400);
-
- gtk_window_set_modal (GTK_WINDOW(self), TRUE);
-
- g_signal_connect (G_OBJECT(self), "apply",
- G_CALLBACK(on_apply), NULL);
- g_signal_connect (G_OBJECT(self), "cancel",
- G_CALLBACK(on_cancel), NULL);
- g_signal_connect (G_OBJECT(self), "close",
- G_CALLBACK(on_close), NULL);
-
- return GTK_WIDGET(self);
-}
+++ /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 <gtk/gtkassistant.h>
-#include <modest-account-mgr.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 {
- GtkAssistant parent;
- /* insert public members, if any */
-};
-
-struct _ModestAccountAssistantClass {
- GtkAssistantClass 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-runtime.h>
-#include <modest-account-mgr-helpers.h>
-#include <string.h>
-#include "modest-account-assistant.h"
-#include "modest-tny-platform-factory.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 GtkWindowClass *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_WINDOW,
- "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;
-
- 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) {
- gboolean removed;
- GtkWidget *dialog;
- gchar *txt;
-
- dialog = gtk_dialog_new_with_buttons (_("Confirmation dialog"),
- GTK_WINDOW (self),
- GTK_DIALOG_MODAL,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_REJECT,
- GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT,
- NULL);
- txt = g_strdup_printf (_("Do you really want to delete the account %s?"), account_name);
- gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox),
- gtk_label_new (txt), FALSE, FALSE, 0);
-/* gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox)); */
- g_free (txt);
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
- /* Remove account. If succeeded it removes also
- the account from the ModestAccountView */
- removed = modest_account_mgr_remove_account (account_mgr,
- account_name,
- FALSE);
- if (removed) {
- /* Show confirmation dialog ??? */
- } else {
- /* Show error dialog ??? */
- g_warning ("Error removing account %s", account_name);
- }
- }
- gtk_widget_destroy (dialog);
- g_free (account_name);
- }
-}
-
-static void
-on_edit_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
-{
- g_message (__FUNCTION__);
-}
-
-static void
-on_add_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
-{
- GtkWidget *assistant;
- ModestAccountViewWindowPrivate *priv;
-
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
- assistant = modest_account_assistant_new (modest_runtime_get_account_mgr());
- gtk_window_set_transient_for (GTK_WINDOW(assistant),
- GTK_WINDOW(self));
-
- gtk_widget_show (GTK_WIDGET(assistant));
-}
-
-
-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 void
-on_close_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
-{
- gtk_widget_destroy (GTK_WIDGET(self));
-}
-
-
-
-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 *close_button;
- GtkWidget *close_hbox;
-
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
-
- main_vbox = gtk_vbox_new (FALSE, 6);
- main_hbox = gtk_hbox_new (FALSE, 6);
-
- 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));
- g_signal_connect (G_OBJECT(sel), "changed", G_CALLBACK(on_selection_changed),
- self);
-
- button_box = button_box_new (self);
-
- gtk_box_pack_start (GTK_BOX(main_hbox), GTK_WIDGET(priv->account_view), TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX(main_hbox), button_box, FALSE, FALSE,2);
-
- gtk_box_pack_start (GTK_BOX(main_vbox), main_hbox, TRUE, TRUE, 2);
-
- close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- g_signal_connect (G_OBJECT(close_button), "clicked",
- G_CALLBACK(on_close_button_clicked),
- self);
-
- close_hbox = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_end (GTK_BOX(close_hbox),
- close_button, FALSE, FALSE,2);
- gtk_box_pack_end (GTK_BOX(main_vbox), close_hbox, FALSE, FALSE,2);
-
- 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), FALSE);
- gtk_window_set_title (GTK_WINDOW(obj), _("Accounts"));
- gtk_window_set_type_hint (GTK_WINDOW(obj), GDK_WINDOW_TYPE_HINT_DIALOG);
-
- gtk_window_set_modal (GTK_WINDOW(obj), TRUE);
-
- gtk_container_add (GTK_CONTAINER(obj),
- window_vbox_new (MODEST_ACCOUNT_VIEW_WINDOW(obj)));
-
- 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.
- */
-
-
-/* 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_FOLDER_ICON_OPEN PIXMAP_PREFIX "qgn_list_gene_fldr_opn.png"
-#define MODEST_FOLDER_ICON_CLOSED PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png"
-
-#define MODEST_FOLDER_ICON_ACCOUNT PIXMAP_PREFIX "qgn_addr_icon_user_group.png"
-#define MODEST_FOLDER_ICON_INBOX PIXMAP_PREFIX "qgn_list_messagin_inbox.png"
-#define MODEST_FOLDER_ICON_OUTBOX PIXMAP_PREFIX "qgn_list_messagin_outbox.png"
-#define MODEST_FOLDER_ICON_SENT PIXMAP_PREFIX "qgn_list_messagin_sent.png"
-#define MODEST_FOLDER_ICON_TRASH PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png"
-#define MODEST_FOLDER_ICON_JUNK PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png"
-#define MODEST_FOLDER_ICON_DRAFTS PIXMAP_PREFIX "qgn_list_messagin_drafts.png"
-#define MODEST_FOLDER_ICON_NORMAL PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png"
-
-#define MODEST_FOLDER_ICON_CONTACTS PIXMAP_PREFIX "qgn_addr_icon_user_group.png"
-#define MODEST_FOLDER_ICON_NOTES PIXMAP_PREFIX "qgn_list_messagin_viewer.png"
-#define MODEST_FOLDER_ICON_CALENDAR PIXMAP_PREFIX "qgn_widg_datedit.png"
-
-/* toolbar */
-#define MODEST_TOOLBAR_ICON_MAIL_SEND PIXMAP_PREFIX "qgn_list_messagin_sent.png"
-#define MODEST_TOOLBAR_ICON_NEW_MAIL PIXMAP_PREFIX "mail-message-new.png"
-/* #define MODEST_TOOLBAR_ICON_SEND_RECEIVE PIXMAP_PREFIX "gtk-refresh.png" */
-#define MODEST_TOOLBAR_ICON_REPLY PIXMAP_PREFIX "mail-reply-sender.png"
-#define MODEST_TOOLBAR_ICON_REPLY_ALL PIXMAP_PREFIX "mail-reply-all.png"
-#define MODEST_TOOLBAR_ICON_FORWARD PIXMAP_PREFIX "mail-forward.png"
-#define MODEST_TOOLBAR_ICON_DELETE PIXMAP_PREFIX "mail-mark-junk.png"
-/* #define MODEST_TOOLBAR_ICON_NEXT PIXMAP_PREFIX "forward.png" */
-/* #define MODEST_TOOLBAR_ICON_PREV PIXMAP_PREFIX "back.png" */
-#define MODEST_TOOLBAR_ICON_STOP PIXMAP_PREFIX "stock-stop.png"
-
-/* 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"
-
-#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_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 */
- { "File", NULL, N_("_File") },
- { "Edit", NULL, N_("_Edit") },
- { "Actions", NULL, N_("_Actions") },
- { "Options", NULL, N_("_Options") },
- { "Help", NULL, N_("_Help") },
-
- /* FILE */
- { "FileNew", MODEST_STOCK_NEW_MAIL, N_("_New"), "<CTRL>N", N_("Compose new message"), G_CALLBACK (modest_ui_actions_on_new_msg) },
- { "FileOpen", GTK_STOCK_OPEN, N_("_Open"), "<CTRL>O", N_("Open a message"), NULL },
- { "FileSave", GTK_STOCK_SAVE, N_("_Save"), "<CTRL>S", N_("Save a message"), NULL },
- { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("Save _As"), NULL, N_("Save a message as"), NULL },
- { "FileQuit", GTK_STOCK_QUIT, N_("_Quit"), "<CTRL>Q", N_("Exit the application"), G_CALLBACK (modest_ui_actions_on_quit) },
-
- /* EDIT */
- { "EditUndo", GTK_STOCK_UNDO, N_("_Undo"), "<CTRL>Z", N_("Undo last action"), NULL },
- { "EditRedo", GTK_STOCK_REDO, N_("_Redo"), "<shift><CTRL>Z", N_("Redo previous action"), NULL },
- { "EditCut", GTK_STOCK_CUT, N_("Cut"), "<CTRL>X", N_("_Cut"), NULL },
- { "EditCopy", GTK_STOCK_COPY, N_("Copy"), "<CTRL>C", N_("Copy"), NULL },
- { "EditPaste", GTK_STOCK_PASTE, N_("Paste"), "<CTRL>V", N_("Paste"), NULL },
- { "EditDelete", GTK_STOCK_DELETE, N_("_Delete"), "<CTRL>Q", N_("Delete"), NULL },
- { "EditSelectAll", NULL, N_("Select all"), "<CTRL>A", N_("Select all"), NULL },
- { "EditDeselectAll", NULL, N_("Deselect all"), "<Shift><CTRL>A", N_("Deselect all"), NULL },
-
- /* VIEW */
- { "ToggleView", GTK_STOCK_CDROM, N_("_Toggle view"), NULL, N_("Toggle the list view"), G_CALLBACK(modest_ui_actions_toggle_view) },
- /* ACTIONS */
- { "ActionsNew", MODEST_STOCK_NEW_MAIL, N_("_New Message"), NULL, N_("Compose a new message"), G_CALLBACK (modest_ui_actions_on_new_msg) },
- { "ActionsReply", MODEST_STOCK_REPLY, N_("_Reply"), NULL, N_("Reply to a message"), G_CALLBACK (modest_ui_actions_on_reply) },
- { "ActionsReplyAll", MODEST_STOCK_REPLY_ALL, N_("Reply to all"), NULL, N_("Reply to all"), G_CALLBACK (modest_ui_actions_on_reply_all) },
- { "ActionsForward", MODEST_STOCK_FORWARD, N_("_Forward"), NULL, N_("Forward a message"), G_CALLBACK (modest_ui_actions_on_forward) },
- { "ActionsBounce", NULL, N_("_Bounce"), NULL, N_("Bounce a message"), NULL },
- { "ActionsSendReceive", GTK_STOCK_REFRESH, N_("Send/Receive"), NULL, N_("Send and receive messages"), NULL },
- { "ActionsDelete", GTK_STOCK_DELETE, N_("Delete message"), NULL, N_("Delete messages"), G_CALLBACK (modest_ui_actions_on_delete) },
- { "ActionsFolderNew", NULL, N_("New Folder"), NULL, N_("Create a new folder"), G_CALLBACK (modest_ui_actions_on_new_folder) },
- { "ActionsFolderDelete", NULL, N_("Delete Folder"), NULL, N_("Delete the folder"), G_CALLBACK (modest_ui_actions_on_delete_folder) },
- { "ActionsFolderRename", NULL, N_("Rename Folder"), NULL, N_("Rename the folder"), G_CALLBACK (modest_ui_actions_on_rename_folder) },
- { "ActionsFolderMoveToTrash", NULL, N_("Move Folder to Trash"), NULL, N_("Move folder to Trash"), G_CALLBACK (modest_ui_actions_on_move_folder_to_trash_folder) },
-
-
- /* 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) },
-
- /* OPTIONS */
- { "OptionsAccounts", NULL, N_("_Accounts"), NULL, N_("Manage accounts"), G_CALLBACK (modest_ui_actions_on_accounts) },
- { "OptionsContacts", NULL, N_("_Contacts"), NULL, N_("Manage contacts"), NULL },
-
- /* HELP */
- { "HelpAbout", GTK_STOCK_ABOUT, N_("About"), NULL, N_("About Modest"), G_CALLBACK (modest_ui_actions_on_about) },
-};
-
-
-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/gtktreeviewcolumn.h>
-#include <tny-account-store-view.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 <modest-runtime.h>
-#include "modest-widget-memory.h"
-#include "modest-ui-actions.h"
-#include "modest-main-window-ui.h"
-#include "modest-account-mgr.h"
-#include "modest-conf.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_sizes (ModestMainWindow *self);
-static void save_sizes (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);
-
-
-/* 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 *online_toggle;
- GtkWidget *folder_info_label;
-
- ModestHeaderView *header_view;
- ModestFolderView *folder_view;
- ModestMsgView *msg_preview;
-
- GtkWidget *status_bar;
- GtkWidget *progress_bar;
-
-};
-
-
-#define MODEST_MAIN_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
- MODEST_TYPE_MAIN_WINDOW, \
- ModestMainWindowPrivate))
-
-typedef struct _GetMsgAsyncHelper {
- ModestMainWindowPrivate *main_window_private;
- guint action;
- ModestMailOperationReplyType reply_type;
- ModestMailOperationForwardType forward_type;
- gchar *from;
- TnyIterator *iter;
-} GetMsgAsyncHelper;
-
-/* globals */
-static GtkWindowClass *parent_class = NULL;
-
-/* 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;
-
- g_type_class_add_private (gobject_class, sizeof(ModestMainWindowPrivate));
-}
-
-static void
-modest_main_window_init (ModestMainWindow *obj)
-{
- TnyAccountStore *account_store;
- ModestMainWindowPrivate *priv;
- TnyFolderStoreQuery *query;
- GtkWidget *icon;
- gboolean online;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(obj);
-
- priv->folder_paned = NULL;
- priv->msg_paned = NULL;
- priv->main_paned = NULL;
-
- account_store = TNY_ACCOUNT_STORE (modest_runtime_get_account_store ());
-
- /* online/offline combo */
- 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);
-
- /* label with number of items, unread items for
- the current folder */
- priv->folder_info_label = gtk_label_new (NULL);
-
- /* status bar */
- priv->status_bar = gtk_statusbar_new ();
- gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR(priv->status_bar),
- FALSE);
-
- /* progress bar */
- priv->progress_bar = gtk_progress_bar_new ();
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(priv->progress_bar), 1.0);
- gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR(priv->progress_bar),
- PANGO_ELLIPSIZE_END);
-
- /* msg preview */
- priv->msg_preview = MODEST_MSG_VIEW(modest_msg_view_new (NULL));
- 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_DETAILS));
- 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));
- 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,
- ModestWidgetType widget_type)
-{
- ModestMainWindowPrivate *priv;
- GtkWidget *widget;
-
- g_return_val_if_fail (self, NULL);
- g_return_val_if_fail (widget_type >= 0 && widget_type < MODEST_WIDGET_TYPE_NUM,
- NULL);
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-
- switch (widget_type) {
- case MODEST_WIDGET_TYPE_HEADER_VIEW:
- widget = (GtkWidget*)priv->header_view; break;
- case MODEST_WIDGET_TYPE_FOLDER_VIEW:
- widget = (GtkWidget*)priv->folder_view; break;
- case MODEST_WIDGET_TYPE_MSG_PREVIEW:
- widget = (GtkWidget*)priv->msg_preview; break;
- case MODEST_WIDGET_TYPE_STATUS_BAR:
- widget = (GtkWidget*)priv->status_bar; break;
- case MODEST_WIDGET_TYPE_PROGRESS_BAR:
- widget = (GtkWidget*)priv->progress_bar; break;
- default:
- g_return_val_if_reached (NULL);
- return NULL;
- }
-
- return widget ? GTK_WIDGET(widget) : NULL;
-}
-
-
-static void
-restore_sizes (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-folder-paned");
- modest_widget_memory_restore (conf, G_OBJECT(priv->msg_paned),
- "modest-msg-paned");
- modest_widget_memory_restore (conf, G_OBJECT(priv->main_paned),
- "modest-main-paned");
- modest_widget_memory_restore (conf, G_OBJECT(priv->header_view),"header-view");
- modest_widget_memory_restore (conf,G_OBJECT(self), "modest-main-window");
-}
-
-
-static void
-save_sizes (ModestMainWindow *self)
-{
- ModestWindowPrivate *parent_priv;
- ModestMainWindowPrivate *priv;
- ModestConf *conf;
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
-
- conf = modest_runtime_get_conf ();
-
- modest_widget_memory_save (conf,G_OBJECT(self), "modest-main-window");
- modest_widget_memory_save (conf, G_OBJECT(priv->folder_paned),
- "modest-folder-paned");
- modest_widget_memory_save (conf, G_OBJECT(priv->msg_paned),
- "modest-msg-paned");
- modest_widget_memory_save (conf, G_OBJECT(priv->main_paned),
- "modest-main-paned");
- modest_widget_memory_save (conf, G_OBJECT(priv->header_view), "header-view");
-}
-
-
-static void
-on_connection_changed (TnyDevice *device, gboolean online, ModestMainWindow *self)
-{
- GtkWidget *icon;
- const gchar *icon_name;
- ModestMainWindowPrivate *priv;
-
- g_return_if_fail (device);
- g_return_if_fail (self);
-
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-
- icon_name = online ? GTK_STOCK_CONNECT : GTK_STOCK_DISCONNECT;
- icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
-
- /* Block handlers in order to avoid unnecessary calls */
- //g_signal_handler_block (G_OBJECT (priv->online_toggle), priv->toggle_button_signal);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->online_toggle), online);
- //g_signal_handler_unblock (G_OBJECT (online_toggle), priv->toggle_button_signal);
-
- gtk_button_set_image (GTK_BUTTON(priv->online_toggle), icon);
- //statusbar_push (widget_factory, 0, online ? _("Modest went online") : _("Modest went offline"));
-
- /* If Modest has became online and the header view has a
- header selected then show it */
- /* FIXME: there is a race condition if some account needs to
- ask the user for a password */
-
-/* if (online) { */
-/* GtkTreeSelection *selected; */
-
-/* selected = gtk_tree_view_get_selection (GTK_TREE_VIEW (header_view)); */
-/* _modest_header_view_change_selection (selected, header_view); */
-/* } */
-}
-
-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)
- tny_device_force_online (device);
- else
- tny_device_force_offline (device);
-}
-
-static gboolean
-on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMainWindow *self)
-{
- save_sizes (self);
- return FALSE;
-}
-
-static void
-on_destroy (GtkWidget *widget, GdkEvent *event, ModestMainWindow *self)
-{
- gtk_main_quit();
-}
-
-
-
-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), "folder_selection_changed",
- G_CALLBACK(modest_ui_actions_on_folder_selection_changed), self);
- g_signal_connect (G_OBJECT(priv->folder_view), "button-press-event",
- G_CALLBACK (on_folder_view_button_press_event),self);
-/* g_signal_connect (priv->folder_view, "popup-menu", */
-/* G_CALLBACK (on_folder_view_button_press_event),self); */
-
- /* header view */
- g_signal_connect (G_OBJECT(priv->header_view), "status_update",
- G_CALLBACK(modest_ui_actions_on_header_status_update), self);
- 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_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);
-
- /* Account store */
- g_signal_connect (G_OBJECT (modest_runtime_get_account_store()), "password_requested",
- G_CALLBACK (modest_ui_actions_on_password_requested), self);
-
- /* Device */
- g_signal_connect (G_OBJECT(modest_runtime_get_device()), "connection_changed",
- G_CALLBACK(on_connection_changed), self);
- g_signal_connect (G_OBJECT(priv->online_toggle), "toggled",
- G_CALLBACK(on_online_toggle_toggled), self);
-
- /* window */
- g_signal_connect (G_OBJECT(self), "destroy", G_CALLBACK(on_destroy), NULL);
- g_signal_connect (G_OBJECT(self), "delete-event", G_CALLBACK(on_delete_event), 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;
-}
-
-
-
-
-ModestWindow *
-modest_main_window_new (void)
-{
- GObject *obj;
- ModestMainWindow *self;
- ModestMainWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- GtkWidget *main_vbox;
- GtkWidget *status_hbox;
- GtkWidget *header_win, *folder_win;
- GtkActionGroup *action_group;
- GError *error = 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();
- action_group = gtk_action_group_new ("ModestMainWindowActions");
-
- /* Add common actions */
- gtk_action_group_add_actions (action_group,
- modest_action_entries,
- G_N_ELEMENTS (modest_action_entries),
- 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-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 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");
-
- gtk_toolbar_set_tooltips (GTK_TOOLBAR (parent_priv->toolbar), TRUE);
- folder_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->folder_view), FALSE);
- header_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->header_view), FALSE);
-
- /* paned */
- priv->folder_paned = gtk_vpaned_new ();
- priv->msg_paned = gtk_vpaned_new ();
- priv->main_paned = gtk_hpaned_new ();
- 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), header_win);
- gtk_paned_add2 (GTK_PANED(priv->msg_paned), GTK_WIDGET(priv->msg_preview));
-
- /* status bar / progress */
- 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->status_bar, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX(status_hbox), priv->progress_bar,FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(status_hbox), priv->online_toggle,FALSE, FALSE, 0);
-
- /* putting it all together... */
- main_vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX(main_vbox), parent_priv->menubar, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(main_vbox), parent_priv->toolbar, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX(main_vbox), priv->main_paned, TRUE, TRUE,0);
- gtk_box_pack_start (GTK_BOX(main_vbox), status_hbox, FALSE, FALSE, 0);
-
- gtk_container_add (GTK_CONTAINER(obj), main_vbox);
- restore_sizes (MODEST_MAIN_WINDOW(obj));
-
- 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 (main_vbox);
-
- /* Connect signals */
- connect_signals (MODEST_MAIN_WINDOW(obj));
-
- /* 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 ()));
-
- 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, "/HeaderViewContextMenu");
-
- 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, "/FolderViewContextMenu");
-
- 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;
-}
+++ /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 <modest-widget-memory.h>
-#include <modest-account-mgr-helpers.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);
-
-/* list my signals */
-enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
- LAST_SIGNAL
-};
-
-typedef struct _ModestMsgEditWindowPrivate ModestMsgEditWindowPrivate;
-struct _ModestMsgEditWindowPrivate {
-
- GtkWidget *toolbar;
- GtkWidget *menubar;
-
- GtkWidget *msg_body;
- GtkWidget *from_field;
- GtkWidget *to_field;
- GtkWidget *cc_field;
- GtkWidget *bcc_field;
- GtkWidget *subject_field;
-};
-
-#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
-modest_msg_edit_window_class_init (ModestMsgEditWindowClass *klass)
-{
- GObjectClass *gobject_class;
- gobject_class = (GObjectClass*) 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));
-}
-
-static void
-modest_msg_edit_window_init (ModestMsgEditWindow *obj)
-{
- ModestMsgEditWindowPrivate *priv;
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj);
-
- priv->toolbar = NULL;
- 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;
-}
-
-static void
-save_settings (ModestMsgEditWindow *self)
-{
- modest_widget_memory_save (modest_runtime_get_conf (),
- G_OBJECT(self), "modest-edit-msg-window");
-}
-
-
-static void
-restore_settings (ModestMsgEditWindow *self)
-{
- modest_widget_memory_restore (modest_runtime_get_conf (),
- G_OBJECT(self), "modest-edit-msg-window");
-}
-
-
-
-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);
- while (cursor) {
- gchar *account_name = (gchar*)cursor->data;
- gchar *from_string = modest_account_mgr_get_from_string (account_mgr,
- account_name);
- 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
-init_window (ModestMsgEditWindow *obj, const gchar* account)
-{
- GtkWidget *to_button, *cc_button, *bcc_button;
- GtkWidget *header_table;
- GtkWidget *main_vbox;
- ModestMsgEditWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- ModestPairList *protos;
-
- 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..."));
-
- protos = get_transports ();
- priv->from_field = modest_combo_box_new (protos, g_str_equal);
- modest_pair_list_free (protos);
- 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 = gtk_entry_new_with_max_length (80);
- priv->cc_field = gtk_entry_new_with_max_length (80);
- priv->bcc_field = gtk_entry_new_with_max_length (80);
- priv->subject_field = gtk_entry_new_with_max_length (80);
-
- header_table = gtk_table_new (5,2, FALSE);
-
- gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("From:")),
- 0,1,0,1, GTK_SHRINK, 0, 0, 0);
- gtk_table_attach (GTK_TABLE(header_table), to_button, 0,1,1,2, GTK_SHRINK, 0, 0, 0);
- gtk_table_attach (GTK_TABLE(header_table), cc_button, 0,1,2,3, GTK_SHRINK, 0, 0, 0);
- gtk_table_attach (GTK_TABLE(header_table), bcc_button, 0,1,3,4, GTK_SHRINK, 0, 0, 0);
- gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("Subject:")),
- 0,1,4,5, GTK_SHRINK, 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), priv->subject_field,1,2,4,5);
-
- priv->msg_body = gtk_text_view_new ();
-
- main_vbox = gtk_vbox_new (FALSE, 6);
-
- 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);
- gtk_box_pack_start (GTK_BOX(main_vbox), header_table, FALSE, FALSE, 6);
- gtk_box_pack_start (GTK_BOX(main_vbox), priv->msg_body, TRUE, TRUE, 6);
-
- gtk_widget_show_all (GTK_WIDGET(main_vbox));
- gtk_container_add (GTK_CONTAINER(obj), main_vbox);
-}
-
-
-static void
-modest_msg_edit_window_finalize (GObject *obj)
-{
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-
-
-static gboolean
-on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgEditWindow *self)
-{
- save_settings (self);
- return FALSE;
-}
-
-
-static void
-set_msg (ModestMsgEditWindow *self, TnyMsg *msg)
-{
- TnyHeader *header;
- GtkTextBuffer *buf;
- const gchar *to, *cc, *bcc, *subject;
- ModestMsgEditWindowPrivate *priv;
- gchar *body;
-
- 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_get_to (header);
- cc = tny_header_get_cc (header);
- bcc = tny_header_get_bcc (header);
- subject = tny_header_get_subject (header);
-
- if (to)
- gtk_entry_set_text (GTK_ENTRY(priv->to_field), to);
- if (cc)
- gtk_entry_set_text (GTK_ENTRY(priv->cc_field), cc);
- if (bcc)
- gtk_entry_set_text (GTK_ENTRY(priv->bcc_field), bcc);
- if (subject)
- gtk_entry_set_text (GTK_ENTRY(priv->subject_field), subject);
-
-
- buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW(priv->msg_body));
- body = modest_tny_msg_get_body (msg, FALSE);
- if (body)
- gtk_text_buffer_set_text (buf, body, -1);
- g_free (body);
-}
-
-
-ModestWindow *
-modest_msg_edit_window_new (TnyMsg *msg, const gchar *account)
-{
- ModestMsgEditWindow *self;
- ModestMsgEditWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- GtkActionGroup *action_group;
- GError *error = NULL;
-
- g_return_val_if_fail (msg, 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");
-
- /* 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_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 */
- 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_EDIT_WINDOW(self), account);
-
- 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);
-
- set_msg (self, msg);
-
- return MODEST_WINDOW(self);
-}
-
-
-MsgData *
-modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window)
-{
- MsgData *data;
- GtkTextBuffer *buf;
- GtkTextIter b, e;
- const gchar *account_name;
- gchar *from_string = NULL;
- ModestMsgEditWindowPrivate *priv;
-
- 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);
- if (!from_string) {
- g_printerr ("modest: cannot get from string\n");
- return NULL;
- }
-
- buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
- gtk_text_buffer_get_bounds (buf, &b, &e);
-
- /* don't free these (except from) */
- data = g_slice_new0 (MsgData);
- data->from = from_string, /* will be freed when data is freed */
- data->to = (gchar*) gtk_entry_get_text (GTK_ENTRY(priv->to_field));
- data->cc = (gchar*) gtk_entry_get_text (GTK_ENTRY(priv->cc_field));
- data->bcc = (gchar*) gtk_entry_get_text (GTK_ENTRY(priv->bcc_field));
- data->subject = (gchar*) gtk_entry_get_text (GTK_ENTRY(priv->subject_field));
- data->body = gtk_text_buffer_get_text (buf, &b, &e, FALSE);
-
- return data;
-}
-
-void
-modest_msg_edit_window_free_msg_data (ModestMsgEditWindow *edit_window,
- MsgData *data)
-{
- g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (edit_window));
-
- g_free (data->from);
- g_free (data->body);
- g_slice_free (MsgData, data);
-}
+++ /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 <widgets/modest-msg-view-window.h>
-#include <widgets/modest-window-priv.h>
-#include "widgets/modest-msg-view.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);
-
-/* 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;
-};
-
-#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;
-
-/* Action entries */
-static const GtkActionEntry modest_action_entries [] = {
-
- /* Toplevel menus */
- { "Edit", NULL, N_("_Edit") },
- { "Actions", NULL, N_("_Actions") },
- { "Help", NULL, N_("_Help") },
-
- /* EDIT */
- { "EditUndo", GTK_STOCK_UNDO, N_("_Undo"), "<CTRL>Z", N_("Undo last action"), NULL },
- { "EditRedo", GTK_STOCK_REDO, N_("_Redo"), "<shift><CTRL>Z", N_("Redo previous action"), NULL },
- { "EditCut", GTK_STOCK_CUT, N_("Cut"), "<CTRL>X", N_("_Cut"), NULL },
- { "EditCopy", GTK_STOCK_COPY, N_("Copy"), "<CTRL>C", N_("Copy"), NULL },
- { "EditPaste", GTK_STOCK_PASTE, N_("Paste"), "<CTRL>V", N_("Paste"), NULL },
- { "EditDelete", GTK_STOCK_DELETE, N_("_Delete"), "<CTRL>Q", N_("Delete"), NULL },
- { "EditSelectAll", NULL, N_("Select all"), "<CTRL>A", N_("Select all"), NULL },
- { "EditDeselectAll", NULL, N_("Deselect all"), "<Shift><CTRL>A", N_("Deselect all"), NULL },
-
- /* ACTIONS */
- { "ActionsReply", MODEST_STOCK_REPLY, N_("_Reply"), NULL, N_("Reply to a message"), G_CALLBACK (modest_ui_actions_on_reply) },
- { "ActionsReplyAll", MODEST_STOCK_REPLY_ALL, N_("Reply to all"), NULL, N_("Reply to all"), G_CALLBACK (modest_ui_actions_on_reply_all) },
- { "ActionsForward", MODEST_STOCK_FORWARD, N_("_Forward"), NULL, N_("Forward a message"), G_CALLBACK (modest_ui_actions_on_forward) },
- { "ActionsBounce", NULL, N_("_Bounce"), NULL, N_("Bounce a message"), NULL },
- { "ActionsSendReceive", GTK_STOCK_REFRESH, N_("Send/Receive"), NULL, N_("Send and receive messages"), NULL },
- { "ActionsDelete", MODEST_STOCK_DELETE, N_("Delete message"), NULL, N_("Delete messages"), G_CALLBACK (modest_ui_actions_on_delete) },
-
- /* HELP */
- { "HelpAbout", GTK_STOCK_ABOUT, N_("About"), NULL, N_("About Modest"), G_CALLBACK (modest_ui_actions_on_about) },
-};
-
-
-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
-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));
-}
-
-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;
-}
-
-static void
-save_settings (ModestMsgViewWindow *self)
-{
- modest_widget_memory_save (modest_runtime_get_conf (),
- G_OBJECT(self), "modest-msg-view-window");
-}
-
-
-static void
-restore_settings (ModestMsgViewWindow *self)
-{
- modest_widget_memory_restore (modest_runtime_get_conf (),
- G_OBJECT(self), "modest-msg-view-window");
-}
-
-
-static void
-init_window (ModestMsgViewWindow *obj, TnyMsg *msg)
-{
- GtkWidget *main_vbox;
- ModestMsgViewWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
-
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
- parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
-
- priv->msg_view = modest_msg_view_new (msg);
- main_vbox = gtk_vbox_new (FALSE, 6);
-
- 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);
- gtk_box_pack_start (GTK_BOX(main_vbox), priv->msg_view, TRUE, TRUE, 6);
-
- 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)
-{
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-
-
-static gboolean
-on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgViewWindow *self)
-{
- save_settings (self);
- return FALSE;
-}
-
-
-ModestWindow *
-modest_msg_view_window_new (TnyMsg *msg, const gchar *account)
-{
- GObject *obj;
- ModestMsgViewWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- GtkActionGroup *action_group;
- GError *error = 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);
-
- modest_window_set_active_account (MODEST_WINDOW(obj), account);
-
- parent_priv->ui_manager = gtk_ui_manager_new();
- action_group = gtk_action_group_new ("ModestMsgViewWindowActions");
-
- /* Add common actions */
- gtk_action_group_add_actions (action_group,
- modest_action_entries,
- G_N_ELEMENTS (modest_action_entries),
- 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);
- restore_settings (MODEST_MSG_VIEW_WINDOW(obj));
-
- gtk_window_set_title (GTK_WINDOW(obj), "Modest");
- gtk_window_set_icon_from_file (GTK_WINDOW(obj), MODEST_APP_ICON, NULL);
-
- g_signal_connect (G_OBJECT(obj), "delete-event", G_CALLBACK(on_delete_event), obj);
-
- return MODEST_WINDOW(obj);
-}
-
-
-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 modest_msg_view_get_message (MODEST_MSG_VIEW(msg_view));
-}
+++ /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 <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;
- GtkWidget *security;
- GtkWidget *auth;
- GtkWidget *chooser;
-
- ModestProtocol 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_UNKNOWN;
-}
-
-
-
-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)
-{
- ModestPairList *protos;
- 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);
-
- protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_SECURITY);
- priv->security = modest_combo_box_new (protos, g_str_equal);
- modest_pair_list_free (protos);
-
- 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);
-
- protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_AUTH);
- priv->auth = modest_combo_box_new (protos, g_str_equal);
- modest_pair_list_free (protos);
-
- 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)
-{
- G_OBJECT_CLASS(parent_class)->finalize (obj);
-}
-
-
-
-GtkWidget*
-modest_store_widget_new (ModestProtocol 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_PROTOCOL_STORE_POP || proto == MODEST_PROTOCOL_STORE_IMAP)
- w = imap_pop_configuration (self);
- else if (proto == MODEST_PROTOCOL_STORE_MAILDIR)
- w = maildir_configuration (self);
- else if (proto == MODEST_PROTOCOL_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;
-}
-
-
-ModestProtocol
-modest_store_widget_get_proto (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
- 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, MODEST_PROTOCOL_UNKNOWN);
- 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 ModestProtocol
-get_protocol_from_combo (GtkWidget *combo)
-{
- gchar *chosen;
-
- if (!combo)
- return MODEST_PROTOCOL_UNKNOWN;
-
- chosen = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
-
- return modest_protocol_info_get_protocol (chosen);
-
-}
-
-ModestProtocol
-modest_store_widget_get_auth (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
-
- return get_protocol_from_combo (priv->auth);
-}
-
-ModestProtocol
-modest_store_widget_get_security (ModestStoreWidget *self)
-{
- ModestStoreWidgetPrivate *priv;
-
- g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
- priv = MODEST_STORE_WIDGET_GET_PRIVATE(self);
-
- return get_protocol_from_combo (priv->security);
-}
+++ /dev/null
-/* modest-store-widget.h */
-/* insert (c)/licensing information) */
-
-#ifndef __MODEST_STORE_WIDGET_H__
-#define __MODEST_STORE_WIDGET_H__
-
-#include <gtk/gtkvbox.h>
-#include <modest-protocol-info.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 (ModestProtocol proto);
-
-const gchar* modest_store_widget_get_username (ModestStoreWidget *self);
-const gchar* modest_store_widget_get_servername (ModestStoreWidget *self);
-ModestProtocol modest_store_widget_get_proto (ModestStoreWidget *self);
-gchar * modest_store_widget_get_path (ModestStoreWidget *self);
-ModestProtocol modest_store_widget_get_auth (ModestStoreWidget *self);
-ModestProtocol modest_store_widget_get_security (ModestStoreWidget *self);
-
-G_END_DECLS
-
-#endif /* __MODEST_STORE_WIDGET_H__ */
-
+++ /dev/null
-/* modest-transport-widget.c */
-
-/* insert (c)/licensing information) */
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <widgets/modest-combo-box.h>
-#include <modest-protocol-info.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 {
- ModestProtocol proto;
- GtkWidget *servername;
- GtkWidget *username;
- GtkWidget *auth;
- GtkWidget *remember_pwd;
-};
-#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_UNKNOWN;
-}
-
-static void
-modest_transport_widget_finalize (GObject *obj)
-{
- 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;
- ModestPairList *protos;
-
- 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);
-
- protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_AUTH);
- combo = modest_combo_box_new (protos, g_str_equal);
- modest_pair_list_free (protos);
-
- 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);
-
- protos = modest_protocol_info_get_protocol_pair_list (MODEST_PROTOCOL_TYPE_AUTH);
- combo = modest_combo_box_new (protos, g_str_equal);
- modest_pair_list_free (protos);
-
- 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 (ModestProtocol 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_PROTOCOL_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));
-}
-
-
-ModestProtocol
-modest_transport_widget_get_proto (ModestTransportWidget *self)
-{
- ModestTransportWidgetPrivate *priv;
-
- g_return_val_if_fail (self, MODEST_PROTOCOL_UNKNOWN);
- priv = MODEST_TRANSPORT_WIDGET_GET_PRIVATE(self);
-
- return priv->proto;
-}
-
+++ /dev/null
-/* modest-transport-widget.h */
-/* insert (c)/licensing information) */
-
-#ifndef __MODEST_TRANSPORT_WIDGET_H__
-#define __MODEST_TRANSPORT_WIDGET_H__
-
-G_BEGIN_DECLS
-
-#include <gtk/gtkvbox.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 (ModestProtocol 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);
-ModestProtocol modest_transport_widget_get_proto (ModestTransportWidget *self);
-
-G_END_DECLS
-
-#endif /* __MODEST_TRANSPORT_WIDGET_H__ */
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://web.resource.org/cc/"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- sodipodi:docname="modest-email.svg"
- sodipodi:docbase="/home/djcb/Desktop"
- inkscape:version="0.44"
- sodipodi:version="0.32"
- id="svg5816"
- height="48px"
- width="48px">
- <defs
- id="defs3">
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient5060"
- id="radialGradient6719"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
- cx="605.71429"
- cy="486.64789"
- fx="605.71429"
- fy="486.64789"
- r="117.14286" />
- <linearGradient
- inkscape:collect="always"
- id="linearGradient5060">
- <stop
- style="stop-color:black;stop-opacity:1;"
- offset="0"
- id="stop5062" />
- <stop
- style="stop-color:black;stop-opacity:0;"
- offset="1"
- id="stop5064" />
- </linearGradient>
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient5060"
- id="radialGradient6717"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
- cx="605.71429"
- cy="486.64789"
- fx="605.71429"
- fy="486.64789"
- r="117.14286" />
- <linearGradient
- id="linearGradient5048">
- <stop
- style="stop-color:black;stop-opacity:0;"
- offset="0"
- id="stop5050" />
- <stop
- id="stop5056"
- offset="0.5"
- style="stop-color:black;stop-opacity:1;" />
- <stop
- style="stop-color:black;stop-opacity:0;"
- offset="1"
- id="stop5052" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient5048"
- id="linearGradient6715"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
- x1="302.85715"
- y1="366.64789"
- x2="302.85715"
- y2="609.50507" />
- <linearGradient
- id="linearGradient28260">
- <stop
- style="stop-color:#9aa29a;stop-opacity:1.0000000;"
- offset="0.0000000"
- id="stop28262" />
- <stop
- style="stop-color:#ffffff;stop-opacity:1.0000000;"
- offset="1.0000000"
- id="stop28264" />
- </linearGradient>
- <linearGradient
- id="linearGradient28254">
- <stop
- id="stop28256"
- offset="0.0000000"
- style="stop-color:#9aa29a;stop-opacity:1.0000000;" />
- <stop
- id="stop28258"
- offset="1.0000000"
- style="stop-color:none" />
- </linearGradient>
- <linearGradient
- id="linearGradient2274">
- <stop
- style="stop-color:#000000;stop-opacity:0.12871288;"
- offset="0.0000000"
- id="stop2276" />
- <stop
- style="stop-color:#000000;stop-opacity:0.0000000;"
- offset="1.0000000"
- id="stop2278" />
- </linearGradient>
- <linearGradient
- id="linearGradient9749">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop9751" />
- <stop
- style="stop-color:#ededed;stop-opacity:1.0000000;"
- offset="1.0000000"
- id="stop9753" />
- </linearGradient>
- <linearGradient
- id="linearGradient2152">
- <stop
- style="stop-color:#9aa29a;stop-opacity:1.0000000;"
- offset="0.0000000"
- id="stop2154" />
- <stop
- style="stop-color:#b5beb5;stop-opacity:1.0000000;"
- offset="1.0000000"
- id="stop2156" />
- </linearGradient>
- <linearGradient
- id="linearGradient2166">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop2168" />
- <stop
- style="stop-color:#dcdcdc;stop-opacity:1.0000000;"
- offset="1.0000000"
- id="stop2170" />
- </linearGradient>
- <linearGradient
- id="linearGradient18913">
- <stop
- style="stop-color:#ededed;stop-opacity:1.0000000;"
- offset="0.0000000"
- id="stop18915" />
- <stop
- style="stop-color:#c8c8c8;stop-opacity:1.0000000;"
- offset="1.0000000"
- id="stop18917" />
- </linearGradient>
- <linearGradient
- id="linearGradient2136">
- <stop
- style="stop-color:#989690;stop-opacity:1.0000000;"
- offset="0.0000000"
- id="stop2138" />
- <stop
- style="stop-color:#656460;stop-opacity:1.0000000;"
- offset="1.0000000"
- id="stop2140" />
- </linearGradient>
- <linearGradient
- id="linearGradient15107">
- <stop
- style="stop-color:#ffffff;stop-opacity:1.0000000;"
- offset="0.0000000"
- id="stop15109" />
- <stop
- style="stop-color:#e2e2e2;stop-opacity:1.0000000;"
- offset="1.0000000"
- id="stop15111" />
- </linearGradient>
- <linearGradient
- id="linearGradient10691"
- inkscape:collect="always">
- <stop
- id="stop10693"
- offset="0"
- style="stop-color:#000000;stop-opacity:1;" />
- <stop
- id="stop10695"
- offset="1"
- style="stop-color:#000000;stop-opacity:0;" />
- </linearGradient>
- <radialGradient
- r="7.2284161"
- fy="73.615714"
- fx="6.7027131"
- cy="73.615714"
- cx="6.7027131"
- gradientTransform="scale(1.902215,0.525703)"
- gradientUnits="userSpaceOnUse"
- id="radialGradient11382"
- xlink:href="#linearGradient10691"
- inkscape:collect="always" />
- <linearGradient
- y2="32.203162"
- x2="9.7619219"
- y1="37.784682"
- x1="8.7803760"
- gradientTransform="matrix(2.394900,0.000000,0.000000,0.781058,2.879512,0.343005)"
- gradientUnits="userSpaceOnUse"
- id="linearGradient27463"
- xlink:href="#linearGradient2274"
- inkscape:collect="always" />
- <linearGradient
- y2="24.132717"
- x2="21.111549"
- y1="13.686079"
- x1="11.233107"
- gradientTransform="matrix(1.370928,0.000000,0.000000,1.443758,2.431133,-0.140786)"
- gradientUnits="userSpaceOnUse"
- id="linearGradient27468"
- xlink:href="#linearGradient9749"
- inkscape:collect="always" />
- <linearGradient
- y2="52.090678"
- x2="9.8855033"
- y1="37.197018"
- x1="8.9156475"
- gradientTransform="matrix(2.454781,0.000000,0.000000,0.762004,2.879512,0.343005)"
- gradientUnits="userSpaceOnUse"
- id="linearGradient27471"
- xlink:href="#linearGradient2152"
- inkscape:collect="always" />
- <linearGradient
- y2="52.090678"
- x2="9.8855033"
- y1="37.197018"
- x1="8.9156475"
- gradientTransform="matrix(2.454781,0.000000,0.000000,0.762004,2.879512,0.343005)"
- gradientUnits="userSpaceOnUse"
- id="linearGradient27474"
- xlink:href="#linearGradient2152"
- inkscape:collect="always" />
- <linearGradient
- y2="29.568739"
- x2="15.310744"
- y1="15.148383"
- x1="10.184240"
- gradientTransform="matrix(1.819266,0.000000,0.000000,1.028193,2.879512,0.343005)"
- gradientUnits="userSpaceOnUse"
- id="linearGradient27477"
- xlink:href="#linearGradient2166"
- inkscape:collect="always" />
- <linearGradient
- y2="17.876846"
- x2="13.467486"
- y1="7.2310905"
- x1="5.8266134"
- gradientTransform="matrix(1.570607,0.000000,0.000000,1.190976,2.879512,0.343005)"
- gradientUnits="userSpaceOnUse"
- id="linearGradient27483"
- xlink:href="#linearGradient18913"
- inkscape:collect="always" />
- <linearGradient
- y2="26.022910"
- x2="18.475286"
- y1="4.7461626"
- x1="11.572842"
- gradientTransform="matrix(1.343475,0.000000,0.000000,1.417854,2.879511,0.314599)"
- gradientUnits="userSpaceOnUse"
- id="linearGradient27486"
- xlink:href="#linearGradient15107"
- inkscape:collect="always" />
- <linearGradient
- y2="15.257116"
- x2="30.599684"
- y1="15.257116"
- x1="2.0618774"
- gradientTransform="matrix(1.343475,0.000000,0.000000,1.417854,2.879511,0.314599)"
- gradientUnits="userSpaceOnUse"
- id="linearGradient27488"
- xlink:href="#linearGradient2136"
- inkscape:collect="always" />
- </defs>
- <sodipodi:namedview
- inkscape:window-y="81"
- inkscape:window-x="518"
- inkscape:window-height="743"
- inkscape:window-width="874"
- inkscape:document-units="px"
- inkscape:grid-bbox="true"
- showgrid="false"
- inkscape:current-layer="layer2"
- inkscape:cy="18.316166"
- inkscape:cx="28.384904"
- inkscape:zoom="8"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- borderopacity="1.0"
- bordercolor="#666666"
- pagecolor="#ffffff"
- id="base" />
- <metadata
- id="metadata4">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title>Mail</dc:title>
- <dc:creator>
- <cc:Agent>
- <dc:title>Jakub Steiner</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:contributor>
- <cc:Agent>
- <dc:title>Andreas Nilsson</dc:title>
- </cc:Agent>
- </dc:contributor>
- <cc:license
- rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
- <dc:subject>
- <rdf:Bag>
- <rdf:li>mail</rdf:li>
- <rdf:li>e-mail</rdf:li>
- <rdf:li>MUA</rdf:li>
- </rdf:Bag>
- </dc:subject>
- </cc:Work>
- <cc:License
- rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
- <cc:permits
- rdf:resource="http://web.resource.org/cc/Reproduction" />
- <cc:permits
- rdf:resource="http://web.resource.org/cc/Distribution" />
- <cc:requires
- rdf:resource="http://web.resource.org/cc/Notice" />
- <cc:requires
- rdf:resource="http://web.resource.org/cc/Attribution" />
- <cc:permits
- rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
- <cc:requires
- rdf:resource="http://web.resource.org/cc/ShareAlike" />
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:groupmode="layer"
- inkscape:label="Layer 1"
- id="layer1">
- <g
- transform="matrix(2.269972e-2,0,0,2.297929e-2,44.98918,37.78447)"
- id="g6707">
- <rect
- style="opacity:0.40206185;color:black;fill:url(#linearGradient6715);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="rect6709"
- width="1339.6335"
- height="478.35718"
- x="-1559.2523"
- y="-150.69685" />
- <path
- style="opacity:0.40206185;color:black;fill:url(#radialGradient6717);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
- id="path6711"
- sodipodi:nodetypes="cccc" />
- <path
- sodipodi:nodetypes="cccc"
- id="path6713"
- d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
- style="opacity:0.40206185;color:black;fill:url(#radialGradient6719);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
- </g>
- <path
- style="fill:url(#linearGradient27486);fill-opacity:1.0000000;fill-rule:evenodd;stroke:url(#linearGradient27488);stroke-width:0.85660440;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
- d="M 6.3334395,16.972251 L 6.3334395,41.481799 L 43.305555,41.481799 L 43.244499,17.089859 C 43.241050,15.712272 31.395999,2.4121110 29.210877,2.4121110 L 20.659391,2.4121110 C 18.362072,2.4121110 6.3334395,15.673953 6.3334395,16.972251 z "
- id="path12723"
- sodipodi:nodetypes="ccczzzz" />
- <path
- style="fill:url(#linearGradient27483);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:0.25000000pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
- d="M 6.9230610,16.787103 C 6.5250222,16.356975 18.809966,3.0935378 20.667210,3.0935378 L 29.042965,3.0935378 C 30.790449,3.0935378 43.079567,16.221603 42.470079,16.978956 L 31.608858,30.475150 L 19.295373,30.156846 L 6.9230610,16.787103 z "
- id="path18153"
- sodipodi:nodetypes="czzzccz" />
- <path
- style="fill:#000000;fill-opacity:0.14619882;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
- d="M 19.077530,30.017590 L 11.744526,21.271586 L 36.562951,14.335513 L 39.592221,20.551966 L 32.175956,29.992298"
- id="path2164"
- sodipodi:nodetypes="ccccc" />
- <path
- style="fill:#000000;fill-opacity:0.14619882;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
- d="M 18.291767,29.836259 L 10.809167,21.026146 L 35.456637,14.132812 L 38.630714,20.403811 L 31.390193,29.810968"
- id="path2162"
- sodipodi:nodetypes="ccccc" />
- <path
- style="fill:#000000;fill-opacity:0.14619882;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
- d="M 18.775313,29.957146 L 11.100386,21.296624 L 36.068405,14.232329 L 39.354114,20.824726 L 31.873739,29.931855"
- id="path2160"
- sodipodi:nodetypes="ccccc" />
- <path
- style="fill:url(#linearGradient27477);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
- d="M 18.593984,30.440693 L 11.260975,21.694689 L 35.972554,14.801355 L 39.083369,21.188770 L 31.963198,30.174701"
- id="path15105"
- sodipodi:nodetypes="ccccc" />
- <path
- style="fill:url(#linearGradient27474);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
- d="M 20.488434,29.064331 L 7.0924698,40.036319 L 21.001312,30.432013 L 30.019470,30.432013 L 42.438517,39.914206 L 30.575092,29.064331 L 20.488434,29.064331 z "
- id="path14245"
- sodipodi:nodetypes="ccccccc" />
- <path
- style="color:#000000;fill:url(#linearGradient27471);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible"
- d="M 6.9634751,16.885144 L 18.479648,31.201334 L 19.548151,30.346532 L 6.9634751,16.885144 z "
- id="path14339"
- sodipodi:nodetypes="cccc" />
- <path
- style="fill:none;fill-opacity:0.75000000;fill-rule:evenodd;stroke:url(#linearGradient27468);stroke-width:0.85660428;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
- d="M 7.3077115,17.131415 L 7.3388644,40.342421 L 42.283659,40.342421 L 42.221353,17.257512 C 42.219329,16.508413 31.005032,3.4591863 28.837233,3.4591863 L 20.941579,3.4591863 C 18.689313,3.4591863 7.3066655,16.351067 7.3077115,17.131415 z "
- id="path15103"
- sodipodi:nodetypes="ccczzzz" />
- <path
- style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
- d="M 20.957271,30.452732 L 9.0157722,38.723588 L 11.235205,38.729695 L 21.233330,31.860755 L 30.055238,30.437917 L 20.957271,30.452732 z "
- id="path17393"
- sodipodi:nodetypes="cccccc" />
- <path
- style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
- d="M 11.427536,21.670296 L 12.752479,23.080719 L 35.543311,16.196529 L 38.458445,21.878896 L 39.072496,21.166981 L 36.003081,14.789145 L 11.427536,21.670296 z "
- id="path2174"
- sodipodi:nodetypes="ccccccc" />
- <path
- style="fill:url(#linearGradient27463);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
- d="M 13.308098,23.636340 L 19.334450,30.090093 L 20.531174,29.064331 L 30.617831,29.107071 L 31.429893,29.833651 L 35.404721,25.089502 C 34.250740,23.679081 13.308098,23.636340 13.308098,23.636340 z "
- id="path2272"
- sodipodi:nodetypes="ccccccc" />
- <path
- sodipodi:nodetypes="cccc"
- id="path27492"
- d="M 41.812936,17.847945 L 31.861315,30.479232 L 30.792812,29.624431 L 41.812936,17.847945 z "
- style="color:#000000;fill:#b1b1b1;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;visibility:visible;display:inline;overflow:visible" />
- </g>
- <g
- inkscape:groupmode="layer"
- id="layer2"
- inkscape:label="M">
- <text
- xml:space="preserve"
- style="font-size:32px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:80.00000119%;writing-mode:lr-tb;text-anchor:start;fill:#f57900;fill-opacity:1;stroke:none;stroke-width:1pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Century Schoolbook L"
- x="12"
- y="36.125"
- id="text1968"
- sodipodi:linespacing="80.000001%"><tspan
- sodipodi:role="line"
- id="tspan1970"
- x="12"
- y="36.125">m</tspan></text>
- </g>
-</svg>
+++ /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="FileMenu" action="File">
- <menuitem name="FileNewMenu" action="FileNew"/>
- <menuitem name="FileOpenMenu" action="FileOpen"/>
- <separator/>
- <menuitem name="FileSaveMenu" action="FileSave"/>
- <menuitem name="FileSaveAsMenu" action="FileSaveAs"/>
- <separator/>
- <menuitem name="FileQuitMenu" action="FileQuit"/>
- </menu>
-
- <menu name="EditMenu" action="Edit">
- <menuitem name="EditUndoMenu" action="EditUndo"/>
- <menuitem name="EditRedoMenu" action="EditRedo"/>
- <separator/>
- <menuitem name="EditCutMenu" action="EditCut"/>
- <menuitem name="EditCopyMenu" action="EditCopy"/>
- <menuitem name="EditPasteMenu" action="EditPaste"/>
- <menuitem name="EditDeleteMenu" action="EditDelete"/>
- <separator/>
- <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
- <menuitem name="EditDeselectAllMenu" action="EditDeselectAll"/>
- </menu>
-
- <menu name="ActionsMenu" action="Actions">
- <menuitem name="ActionsNewMenu" action="ActionsNew"/>
- <menuitem name="ActionsReplyMenu" action="ActionsReply"/>
- <menuitem name="ActionsForwardMenu" action="ActionsForward"/>
- <menuitem name="ActionsBounceMenu" action="ActionsBounce"/>
- <separator/>
- <menuitem name="ActionsFolderNewMenu" action="ActionsFolderNew"/>
- <menuitem name="ActionsFolderDeleteMenu" action="ActionsFolderDelete"/>
- <menuitem name="ActionsFolderRenameMenu" action="ActionsFolderRename"/>
- <menuitem name="ActionsFolderMoveToTrashMenu" action="ActionsFolderMoveToTrash"/>
- </menu>
-
- <menu name="OptionsMenu" action="Options">
- <menuitem name="OptionsAccountsMenu" action="OptionsAccounts"/>
- <menuitem name="OptionsContactsMenu" action="OptionsContacts"/>
- </menu>
-
- <menu name="HelpMenu" action="Help">
- <menuitem name="HelpAboutMenu" action="HelpAbout"/>
- </menu>
- </menubar>
-
- <toolbar name="ToolBar">
- <toolitem action="ActionsNew"/>
- <separator/>
- <toolitem action="ActionsReply"/>
- <toolitem action="ActionsReplyAll"/>
- <toolitem action="ActionsForward"/>
- <separator/>
- <toolitem action="ActionsSendReceive"/>
- <separator/>
- <toolitem action="GotoPrevious"/>
- <toolitem action="GotoNext"/>
- <separator/>
- <toolitem action="ActionsDelete"/>
- <separator/>
- <toolitem name="ToggleView" action="ToggleView"/>
- </toolbar>
-
- <popup name="HeaderViewContextMenu">
- <menuitem action="ActionsReply"/>
- <menuitem action="ActionsForward"/>
- </popup>
-
- <popup name="FolderViewContextMenu">
- <menuitem action="ActionsFolderNew"/>
- <menuitem action="ActionsFolderDelete"/>
- <menuitem action="ActionsFolderRename"/>
- <menuitem action="ActionsFolderMoveToTrash"/>
- </popup>
-
-</ui>
\ No newline at end of file
+++ /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="ViewMenu" action="View">
- <menuitem name="ViewToFieldMenu" action="ViewToField"/>
- <menuitem name="ViewCcFieldMenu" action="ViewCcField"/>
- <menuitem name="ViewBccFieldMenu" action="ViewBccField"/>
- </menu>
-
- </menubar>
-
- <toolbar name="ToolBar">
- <toolitem action="ActionsSend"/>
- </toolbar>
-
-</ui>
\ No newline at end of file
+++ /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="EditMenu" action="Edit">
- <menuitem name="EditUndoMenu" action="EditUndo"/>
- <menuitem name="EditRedoMenu" action="EditRedo"/>
- <separator/>
- <menuitem name="EditCutMenu" action="EditCut"/>
- <menuitem name="EditCopyMenu" action="EditCopy"/>
- <menuitem name="EditPasteMenu" action="EditPaste"/>
- <menuitem name="EditDeleteMenu" action="EditDelete"/>
- <separator/>
- <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
- <menuitem name="EditDeselectAllMenu" action="EditDeselectAll"/>
- </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="ActionsReply"/>
- <toolitem action="ActionsReplyAll"/>
- <toolitem action="ActionsForward"/>
- </toolbar>
-</ui>
INCLUDES=\
$(MODEST_GSTUFF_CFLAGS) \
- $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS) \
+ $(MODEST_LIBTINYMAIL_MAEMO_CFLAGS) \
-DMODEST_PLATFORM_ID=$(MODEST_PLATFORM_ID) \
-I ${top_srcdir}/src/widgets \
-I ${top_srcdir}/src \
modest-icon-names.h \
modest-main-window.c \
modest-main-window-ui.h \
+ modest-platform.c \
modest-store-widget.c \
modest-store-widget.h \
modest-transport-widget.c \
LDADD = \
$(MODEST_GSTUFF_LIBS) \
- $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_LIBS)
+ $(MODEST_LIBTINYMAIL_MAEMO_LIBS)
PIXMAP_FILES=\
pixmaps/*.png
"',member='" BTNAME_SIG_CHANGED "'"
+GtkWidget*
+modest_maemo_utils_menubar_to_menu (GtkUIManager *ui_manager)
+{
+ GtkWidget *main_menu;
+ GtkWidget *menubar;
+ GList *iter;
+
+ g_return_val_if_fail (ui_manager, NULL);
+
+ /* Create new main menu */
+ main_menu = gtk_menu_new();
+
+ /* Get the menubar from the UI manager */
+ menubar = gtk_ui_manager_get_widget (ui_manager, "/MenuBar");
+
+ iter = gtk_container_get_children (GTK_CONTAINER (menubar));
+ while (iter) {
+ GtkWidget *menu;
+
+ menu = GTK_WIDGET (iter->data);
+ gtk_widget_reparent(menu, main_menu);
+
+ iter = g_list_next (iter);
+ }
+ return main_menu;
+}
+
+
+
+
+
+
static void
update_device_name_from_msg (DBusMessage *message)
{
#ifndef __MODEST_MAEMO_UTILS_H__
#define __MODEST_MAEMO_UTILS_H__
+#include <gtk/gtk.h>
+
+/**
+ * modest_maemo_utils_menubar_to_menu:
+ * @ui_manager: a ui manager, with the menubar at "/MenuBar"
+ *
+ * convert a menubar description (in a GtkUIManager) in to a menu
+ *
+ * Returns: a new menu, or NULL in case of error
+ */
+GtkWidget* modest_maemo_utils_menubar_to_menu (GtkUIManager *ui_manager);
+
+
/**
* modest_maemo_utils_get_device_name
*
#include <widgets/modest-msg-edit-window.h>
#include <widgets/modest-account-view-window.h>
+
#include "modest-widget-memory.h"
#include "modest-window-priv.h"
#include "modest-main-window-ui.h"
#include "modest-account-mgr.h"
#include "modest-conf.h"
-
-#include "modest-maemo-utils.h"
+#include <modest-maemo-utils.h>
#include "modest-tny-platform-factory.h"
#include "modest-tny-msg.h"
#include "modest-mail-operation.h"
return FALSE;
}
-static GtkWidget *
-menubar_to_menu (GtkUIManager *ui_manager)
-{
- GtkWidget *main_menu;
- GtkWidget *menubar;
- GList *iter;
-
- /* Create new main menu */
- main_menu = gtk_menu_new();
-
- /* Get the menubar from the UI manager */
- menubar = gtk_ui_manager_get_widget (ui_manager, "/MenuBar");
-
- iter = gtk_container_get_children (GTK_CONTAINER (menubar));
- while (iter) {
- GtkWidget *menu;
-
- menu = GTK_WIDGET (iter->data);
- gtk_widget_reparent(menu, main_menu);
-
- iter = g_list_next (iter);
- }
- return main_menu;
-}
static GtkWidget*
get_toolbar (ModestMainWindow *self)
hildon_window_add_toolbar (HILDON_WINDOW (self), GTK_TOOLBAR (parent_priv->toolbar));
/* Menubar */
- parent_priv->menubar = menubar_to_menu (parent_priv->ui_manager);
+ parent_priv->menubar = modest_maemo_utils_menubar_to_menu (parent_priv->ui_manager);
hildon_window_set_menu (HILDON_WINDOW (self), GTK_MENU (parent_priv->menubar));
/* folder view */
--- /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 <config.h>
+#include <modest-platform.h>
+#include <libosso.h>
+#include <osso-mime.h>
+#include <tny-maemo-device.h>
+#include <gtk/gtkicontheme.h>
+
+gboolean
+modest_platform_init (void)
+{
+ osso_context_t *osso_context =
+ osso_initialize(PACKAGE, PACKAGE_VERSION,
+ TRUE, NULL);
+ if (!osso_context) {
+ g_printerr ("modest: failed to acquire osso context\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+TnyDevice*
+modest_platform_get_new_device (void)
+{
+ return TNY_DEVICE (tny_maemo_device_new ());
+}
+
+
+const gchar*
+guess_mime_type_from_name (const gchar* name)
+{
+ int i;
+ const gchar* ext;
+ const static gchar* octet_stream= "application/octet-stream";
+ const static gchar* mime_map[][2] = {
+ { "pdf", "application/pdf"},
+ { "doc", "application/msword"},
+ { "xls", "application/excel"},
+ { "png", "image/png" },
+ { "gif", "image/gif" },
+ { "jpg", "image/jpeg"},
+ { "jpeg", "image/jpeg"},
+ { "mp3", "audio/mp3" }
+ };
+
+ if (!name)
+ return octet_stream;
+
+ ext = g_strrstr (name, ".");
+ if (!ext)
+ return octet_stream;
+
+ for (i = 0; i != G_N_ELEMENTS(mime_map); ++i) {
+ if (g_ascii_strcasecmp (mime_map[i][0], ext + 1)) /* +1: ignore '.'*/
+ return mime_map[i][1];
+ }
+ return octet_stream;
+}
+
+
+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 **icons, **cursor;
+
+
+ g_return_val_if_fail (name || mime_type, NULL);
+
+ if (!mime_type || g_ascii_strcasecmp (mime_type, "application/octet-stream"))
+ mime_str = g_string_new (guess_mime_type_from_name(name));
+ else {
+ mime_str = g_string_new (mime_type);
+ g_string_ascii_down (mime_str);
+ }
+
+ icons = osso_mime_get_icon_names (mime_str->str, NULL);
+ for (cursor = icons; cursor; ++cursor) {
+ if (gtk_icon_theme_has_icon (gtk_icon_theme_get_default(), *cursor)) {
+ icon_name = g_strdup (*cursor);
+ break;
+ }
+ }
+ g_strfreev (icons);
+
+ if (effective_mime_type)
+ *effective_mime_type = g_string_free (mime_str, FALSE);
+ else
+ g_string_free (mime_str, TRUE);
+
+ return icon_name;
+}
/* hostname */
key = _modest_account_mgr_get_account_keyname (name, MODEST_ACCOUNT_HOSTNAME, TRUE);
if (modest_conf_key_exists (priv->modest_conf, key, &err)) {
- g_printerr ("modest: server account '%s' already exists", name);
+ g_printerr ("modest: server account '%s' already exists\n", name);
g_free (key);
ok = FALSE;
}
--- /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_PLATFORM_H__
+#define __MODEST_PLATFORM_H__
+
+#include <glib.h>
+#include <tny-device.h>
+
+/**
+ * modest_platform_platform_init:
+ *
+ * platform specific initialization function
+ *
+ * Returns: TRUE if succeeded, FALSE otherwise
+ */
+gboolean modest_platform_init (void);
+
+
+/**
+ * modest_platform_get_new_device:
+ *
+ * platform specific initialization function
+ *
+ * Returns: TRUE if succeeded, FALSE otherwise
+ */
+TnyDevice* modest_platform_get_new_device (void);
+
+
+/**
+ * modest_platform_get_file_icon:
+ * @name: the name of the file, or NULL
+ * @mime_type: the mime-type, or NULL
+ * @effective_mime_type: out-param which receives the 'effective mime-type', ie., the mime type
+ * that will be used. May be NULL if you're not interested in this. Note: the returned string
+ * is newly allocated, and should be g_free'd when done with it.
+ *
+ * this function gets the icon for the file, based on the file name and/or the mime type,
+ * using the following strategy:
+ * (1) if mime_type != NULL and mime_type != application/octet-stream, find the
+ * the icon name for this mime type
+ * (2) otherwise, guess the icon type from the file name, and then goto (1)
+ *
+ * Returns: the icon name
+ */
+const gchar* modest_platform_get_file_icon (const gchar* name, const gchar* mime_type,
+ gchar **effective_mime_type);
+
+#endif /* __MODEST_PLATFORM_UTILS_H__ */
#include <widgets/modest-header-view.h>
#include <widgets/modest-folder-view.h>
#include <modest-tny-platform-factory.h>
+#include <modest-platform.h>
#include <modest-widget-memory.h>
#include <modest-widget-memory-priv.h>
#include <modest-local-folder-info.h>
#include <modest-account-mgr-helpers.h>
#include <modest-icon-names.h>
-#if MODEST_PLATFORM_ID==2 /* maemo/hildon */
-#include <libosso.h>
-static gboolean init_hildon (void);
-#endif /* MODEST_PLATFORM_ID==2 */
-
static gboolean init_header_columns (ModestConf *conf, gboolean overwrite);
static gboolean init_local_folders (void);
static gboolean init_default_account_maybe (ModestAccountMgr *acc_mgr);
g_printerr ("modest: failed to initialize singletons\n");
return FALSE;
}
-
-#if MODEST_PLATFORM_ID==2
- if (!init_hildon ()) {
+
+ if (!modest_platform_init()) {
modest_runtime_uninit ();
- g_printerr ("modest: failed to initialize hildon\n");
+ g_printerr ("modest: failed to run platform-specific initialization\n");
return FALSE;
}
-#endif /* MODEST_PLATFORM_ID==2 */
/* based on the debug settings, we decide whether to overwrite old settings */
reset = modest_runtime_get_debug_flags () & MODEST_RUNTIME_DEBUG_FACTORY_SETTINGS;
}
-#if MODEST_PLATFORM_ID==2
-static gboolean
-init_hildon (void)
-{
- osso_context_t *osso_context =
- osso_initialize(PACKAGE, PACKAGE_VERSION,
- TRUE, NULL);
- if (!osso_context) {
- g_printerr ("modest: failed to acquire osso context\n");
- return FALSE;
- }
-}
-#endif /* MODEST_PLATFORM_ID==2 */
-
-
/*
* This function registers our custom toolbar icons, so they can be
* themed. The idea of this function was taken from the gtk-demo
{
static GDate date;
-#if MODEST_PLATFORM_ID==1 /* gtk */
- g_date_set_time_t (&date, timet);
-#elif MODEST_PLATFORM_ID==2 /* hildon (maemo) */
+ /* does not work on old maemo glib:
+ * g_date_set_time_t (&date, timet);
+ */
g_date_set_time (&date, (GTime) timet);
-#endif
+
return g_date_strftime (s, max, fmt, (const GDate*) &date);
}
#include <tny-camel-mime-part.h>
#include <tny-camel-msg.h>
-/* MODES_PLATFORM_ID: 1 ==> gtk, 2==> maemo */
-#if MODEST_PLATFORM_ID==1
-#include <tny-gnome-device.h>
-#elif MODEST_PLATFORM_ID==2
-#include <tny-maemo-device.h>
-#endif
-
#include "modest-tny-platform-factory.h"
#include "modest-tny-account-store.h"
static TnyDevice *
modest_tny_platform_factory_new_device (TnyPlatformFactory *self)
{
-/* MODES_PLATFORM_ID: 1 ==> gtk, 2==> maemo */
-#if MODEST_PLATFORM_ID==1
- return TNY_DEVICE (tny_gnome_device_new ());
-#elif MODEST_PLATFORM_ID==2
- return TNY_DEVICE (tny_maemo_device_new ());
-#else
- g_return_val_if_reached (NULL);
-#endif /* MODEST_PLATFORM */
+ return modest_platform_get_new_device ();
}
static TnyMsgView*