${top_builddir}/src/modest-account-mgr.o \
${top_builddir}/src/modest-tny-platform-factory.o \
${top_builddir}/src/modest-protocol-mgr.o \
+ ${top_builddir}/src/modest-proto.o \
${top_builddir}/src/modest-pair.o \
${top_builddir}/src/modest-marshal.o \
${top_builddir}/src/modest-tny-account-store.o \
modest-account-keys
<!-- ##### SECTION Short_Description ##### -->
-Some configuration keys related to account management
+
<!-- ##### SECTION Long_Description ##### -->
<para>
ModestAccountMgr
<!-- ##### SECTION Short_Description ##### -->
-Manages email accounts
+
<!-- ##### SECTION Long_Description ##### -->
<para>
@:
@:
+<!-- ##### SIGNAL ModestAccountMgr::account-changed ##### -->
+<para>
+
+</para>
+
+@:
+@:
+@:
+@:
+
+<!-- ##### SIGNAL ModestAccountMgr::account-removed ##### -->
+<para>
+
+</para>
+
+@:
+@:
+@:
+
<!-- ##### STRUCT ModestServerAccountData ##### -->
<para>
modest-conf-keys
<!-- ##### SECTION Short_Description ##### -->
-Some Modest configuration keys
+
<!-- ##### SECTION Long_Description ##### -->
<para>
ModestConf
<!-- ##### SECTION Short_Description ##### -->
-A wrapper to the underlying configuration system (currently GConf)
+
<!-- ##### SECTION Long_Description ##### -->
<para>
@:
@:
+<!-- ##### SIGNAL ModestConf::key-changed ##### -->
+<para>
+
+</para>
+
+@:
+@:
+@:
+
<!-- ##### FUNCTION modest_conf_new ##### -->
<para>
ModestMainWindow
<!-- ##### SECTION Short_Description ##### -->
-A widget that shows the Modest main window
+
<!-- ##### SECTION Long_Description ##### -->
<para>
modest-proto
<!-- ##### SECTION Short_Description ##### -->
-An object that provides lists with the supported email protocols
+
<!-- ##### SECTION Long_Description ##### -->
<para>
ModestTnyAccountStore
<!-- ##### SECTION Short_Description ##### -->
-An implementation of #TnyAccountStore
+
<!-- ##### SECTION Long_Description ##### -->
<para>
@:
@Param5:
+<!-- ##### SIGNAL ModestTnyAccountStore::account-update ##### -->
+<para>
+
+</para>
+
+@:
+@:
+
+<!-- ##### SIGNAL ModestTnyAccountStore::password-requested ##### -->
+<para>
+
+</para>
+
+@:
+@:
+@:
+@:
+@Param5:
+
<!-- ##### FUNCTION modest_tny_account_store_new ##### -->
<para>
ModestUI
<!-- ##### SECTION Short_Description ##### -->
-An object that creates the main window
+
<!-- ##### SECTION Long_Description ##### -->
<para>
<!-- ##### SECTION ./tmpl/modest-tny-msg-view.sgml:Short_Description ##### -->
-
+A widget that displays the body of a message
<!-- ##### SECTION ./tmpl/modest-tny-msg-view.sgml:Stability_Level ##### -->
modest-presets.h\
modest-protocol-mgr.h\
modest-protocol-mgr.c\
+ modest-proto.h\
+ modest-proto.c\
modest-ui.h\
modest-text-utils.h\
modest-text-utils.c\
#include "modest-account-assistant.h"
#include "modest-store-widget.h"
#include "modest-transport-widget.h"
+#include "modest-proto.h"
#include <string.h>
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 (priv->store_widget);
+ if (!txt || strlen(txt) == 0) {
+ set_current_page_complete (self, FALSE);
+ return;
+ }
+
+ txt = modest_store_widget_get_servername (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;
gtk_container_remove (GTK_CONTAINER(priv->store_holder),
priv->store_widget);
+ /* FIXME: we could have these widgets cached instead of
+ creating them every time */
priv->store_widget = modest_store_widget_new (priv->factory, chosen);
+ if (!strcmp (chosen, MODEST_PROTO_POP) || !strcmp (chosen, MODEST_PROTO_IMAP)) {
+ g_signal_connect (priv->store_widget,
+ "data_changed",
+ 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_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 (combo, self);
gtk_assistant_append_page (GTK_ASSISTANT(self), page);
gtk_assistant_set_page_type (GTK_ASSISTANT(self), page,
GTK_ASSISTANT_PAGE_INTRO);
gtk_assistant_set_page_complete (GTK_ASSISTANT(self),
- page, TRUE);
+ page, FALSE);
gtk_widget_show_all (page);
}
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 (combo, self);
+
gtk_assistant_append_page (GTK_ASSISTANT(self), page);
gtk_assistant_set_page_title (GTK_ASSISTANT(self), page,
on_apply (ModestAccountAssistant *self, gpointer user_data)
{
ModestAccountAssistantPrivate *priv;
- gchar *store_name;
- const gchar *account_name;
+ gchar *store_name, *transport_name;
+ const gchar *account_name, *username, *servername, *proto;
ModestStoreWidget *store;
+ ModestTransportWidget *transport;
priv = MODEST_ACCOUNT_ASSISTANT_GET_PRIVATE(self);
- /* create account */
-
/* create server account -> store */
store = MODEST_STORE_WIDGET(priv->store_widget);
- store_name = g_strdup_printf ("%s:%s@%s",
- modest_store_widget_get_proto (store),
- modest_store_widget_get_username (store),
- modest_store_widget_get_servername (store));
+ proto = modest_store_widget_get_proto (store);
+ username = modest_store_widget_get_username (store);
+ servername = modest_store_widget_get_servername (store);
+ store_name = g_strdup_printf ("%s:%s@%s", proto, username, servername);
+
+ modest_account_mgr_add_server_account (priv->account_mgr, store_name, servername,
+ username, NULL, proto);
+
+ /* create server account -> transport */
+ transport = MODEST_TRANSPORT_WIDGET(priv->transport_widget);
+ proto = modest_transport_widget_get_proto (transport);
+
+ if (!strcmp (proto, MODEST_PROTO_SMTP)) {
+ servername = modest_transport_widget_get_servername (transport);
+ if (modest_transport_widget_get_requires_auth (transport))
+ username = modest_transport_widget_get_username (transport);
+ else
+ username = g_get_user_name ();
+ } else {
+ username = g_get_user_name ();
+ servername = "localhost";
+
+ }
+ transport_name = g_strdup_printf ("%s:%s@%s", proto, username, servername);
modest_account_mgr_add_server_account (priv->account_mgr,
- store_name,
- modest_store_widget_get_servername (store),
- modest_store_widget_get_username (store),
+ transport_name,
+ servername,
+ username,
NULL,
- modest_store_widget_get_proto (store));
+ proto);
- /* create server account -> transport */
+ /* create account */
account_name = get_account_name (self);
modest_account_mgr_add_account (priv->account_mgr,
account_name,
account_name,
MODEST_ACCOUNT_EMAIL,
get_email(self), FALSE, NULL);
-
+
+ /* Frees */
g_free (store_name);
+ g_free (transport_name);
}
static void modest_store_widget_finalize (GObject *obj);
/* list my signals */
enum {
- /* MY_SIGNAL_1, */
- /* MY_SIGNAL_2, */
+ DATA_CHANGED_SIGNAL,
LAST_SIGNAL
};
static GtkContainerClass *parent_class = NULL;
/* uncomment the following if you have defined any signals */
-/* static guint signals[LAST_SIGNAL] = {0}; */
+static guint signals[LAST_SIGNAL] = {0};
GType
modest_store_widget_get_type (void)
g_type_class_add_private (gobject_class, sizeof(ModestStoreWidgetPrivate));
/* 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. */
+ 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
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)
gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 0);
+ /* Handle entry modifications */
+ g_signal_connect (priv->username, "changed", on_entry_changed, self);
+ g_signal_connect (priv->servername, "changed", on_entry_changed, self);
+
return box;
}
return GTK_WIDGET(self);
}
-
gboolean
modest_store_widget_get_remember_password (ModestStoreWidget *self)
{
struct _ModestStoreWidgetClass {
GtkVBoxClass parent_class;
- /* insert signal callback declarations, eg. */
- /* void (* my_event) (ModestStoreWidget* obj); */
+
+ void (* data_changed) (ModestStoreWidget* obj);
};
/* member functions */
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)
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(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);
(priv->factory, MODEST_COMBO_BOX_TYPE_SECURITY_PROTOS),
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);
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)
GtkWidget* modest_transport_widget_new (ModestWidgetFactory *factory, const gchar *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);
const gchar* modest_transport_widget_get_proto (ModestTransportWidget *self);
#define MODEST_ACCOUNT_USERNAME "username" /* string */
#define MODEST_ACCOUNT_PROTO "proto" /* string */
#define MODEST_ACCOUNT_ENABLED "enabled" /* boolean */
+#define MODEST_ACCOUNT_TYPE "type" /* string */
#define MODEST_ACCOUNT_LEAVE_ON_SERVER "leave_on_server" /* boolean */
#define MODEST_ACCOUNT_PREFERRED_CNX "preferred_cnx" /* string */
*/
#include <string.h>
-#include <modest-marshal.h>
-#include <modest-account-keys.h>
-#include <modest-account-mgr.h>
+#include "modest-proto.h"
+#include "modest-marshal.h"
+#include "modest-account-keys.h"
+#include "modest-account-mgr.h"
/* 'private'/'protected' functions */
static void modest_account_mgr_class_init (ModestAccountMgrClass * klass);
{
ModestAccountMgrPrivate *priv;
gchar *key;
+ ModestProtoType proto_type = MODEST_PROTO_TYPE_ANY;
g_return_val_if_fail (self, FALSE);
g_return_val_if_fail (name, FALSE);
modest_conf_set_string (priv->modest_conf, key, null_means_empty (proto), NULL);
g_free (key);
+ /* type */
+ key = get_account_keyname (name, MODEST_ACCOUNT_TYPE, TRUE);
+ proto_type = modest_proto_type (proto);
+ modest_conf_set_string (priv->modest_conf, key,
+ (proto_type == MODEST_PROTO_TYPE_TRANSPORT) ? "transport" : "store",
+ NULL);
+ g_free (key);
+
return TRUE;
}
#include <tny-header.h>
#include <tny-gtk-text-buffer-stream.h>
#include <tny-camel-stream.h>
-#include <tny-camel-msg.h>
#include <camel/camel-stream-mem.h>
#include "modest-formatter.h"
#include "modest-text-utils.h"
+#include "modest-tny-platform-factory.h"
typedef struct _ModestFormatterPrivate ModestFormatterPrivate;
struct _ModestFormatterPrivate {
TnyMsg *new_msg;
gchar *body_text = NULL, *txt = NULL;
ModestFormatterPrivate *priv;
+ TnyPlatformFactory *fact;
g_return_val_if_fail (self, NULL);
g_return_val_if_fail (body, NULL);
g_return_val_if_fail (func, NULL);
/* Build new part */
- new_msg = TNY_MSG (tny_camel_msg_new ());
+ fact = modest_tny_platform_factory_get_instance ();
+ new_msg = tny_platform_factory_new_msg (fact);
body_text = extract_text (self, body);
txt = (gchar *) func (self, (const gchar*) body_text, header);
priv = MODEST_FORMATTER_GET_PRIVATE (self);
gchar *attach_text = NULL;
TnyMimePart *body_part = NULL, *attach_part = NULL;
ModestFormatterPrivate *priv;
+ TnyPlatformFactory *fact;
+ fact = modest_tny_platform_factory_get_instance ();
/* Build new part */
- new_msg = TNY_MSG (tny_camel_msg_new ());
- body_part = TNY_MIME_PART (tny_camel_mime_part_new (camel_mime_part_new()));
- attach_part = TNY_MIME_PART (tny_camel_mime_part_new (camel_mime_part_new()));
+ new_msg = tny_platform_factory_new_msg (fact);
+ body_part = tny_platform_factory_new_mime_part (fact);
+ attach_part = tny_platform_factory_new_mime_part (fact);
/* Create the two parts */
priv = MODEST_FORMATTER_GET_PRIVATE (self);
#include <tny-store-account.h>
#include <tny-folder-store.h>
#include <tny-folder-store-query.h>
-#include <tny-camel-msg.h>
-#include <tny-camel-header.h>
#include <tny-camel-stream.h>
-#include <tny-camel-mime-part.h>
#include <tny-simple-list.h>
#include <camel/camel-stream-mem.h>
#include <glib/gi18n.h>
const gchar *body,
const GList *attachments_list)
{
+ TnyPlatformFactory *fact;
TnyMsg *new_msg;
TnyHeader *header;
gchar *content_type;
}
/* Create new msg */
- new_msg = TNY_MSG (tny_camel_msg_new ());
- header = TNY_HEADER (tny_camel_header_new ());
+ fact = modest_tny_platform_factory_get_instance ();
+ new_msg = tny_platform_factory_new_msg (fact);
+ header = tny_platform_factory_new_header (fact);
/* WARNING: set the header before assign values to it */
tny_msg_set_header (new_msg, header);
static TnyMsg *
create_reply_forward_mail (TnyMsg *msg, const gchar *from, gboolean is_reply, guint type)
{
+ TnyPlatformFactory *fact;
TnyMsg *new_msg;
TnyHeader *new_header, *header;
gchar *new_subject;
g_object_unref (G_OBJECT (formatter));
/* Fill the header */
- new_header = TNY_HEADER (tny_camel_header_new ());
- tny_msg_set_header (new_msg, new_header);
+ fact = modest_tny_platform_factory_get_instance ();
+ new_header = TNY_HEADER (tny_platform_factory_new_header (fact));
+ tny_msg_set_header (new_msg, new_header);
tny_header_set_from (new_header, from);
tny_header_set_replyto (new_header, from);
/* Change the subject */
- new_subject = (gchar *) modest_text_utils_derived_subject (tny_header_get_subject(header),
- (is_reply) ? _("Re:") : _("Fwd:"));
+ new_subject =
+ (gchar *) modest_text_utils_derived_subject (tny_header_get_subject(header),
+ (is_reply) ? _("Re:") : _("Fwd:"));
tny_header_set_subject (new_header, (const gchar *) new_subject);
g_free (new_subject);
const gchar *attachment_content_type;
const gchar *attachment_filename;
TnyStream *attachment_stream;
+ TnyPlatformFactory *fact;
+ fact = modest_tny_platform_factory_get_instance ();
for (pos = (GList *)attachments_list; pos; pos = pos->next) {
old_attachment = pos->data;
attachment_filename = tny_mime_part_get_filename (old_attachment);
attachment_stream = tny_mime_part_get_stream (old_attachment);
- attachment_part = TNY_MIME_PART (tny_camel_mime_part_new (camel_mime_part_new()));
+ attachment_part = tny_platform_factory_new_mime_part (fact);
attachment_content_type = tny_mime_part_get_content_type (old_attachment);
{
TnyMimePart *text_body_part = NULL;
TnyStream *text_body_stream;
+ TnyPlatformFactory *fact;
+
+ fact = modest_tny_platform_factory_get_instance ();
/* Create the stream */
text_body_stream = TNY_STREAM (tny_camel_stream_new
/* Create body part if needed */
if (has_attachments)
- text_body_part =
- TNY_MIME_PART (tny_camel_mime_part_new (camel_mime_part_new()));
+ text_body_part = tny_platform_factory_new_mime_part (fact);
else
text_body_part = TNY_MIME_PART(msg);
*/
const gchar** modest_proto_auth_protos (void);
-
-
-
#endif /*__MODEST_SERVER_PROTO_H__*/
static GObject *modest_tny_platform_factory_constructor (GType type, guint n_construct_params,
GObjectConstructParam *construct_params);
static void tny_platform_factory_init (gpointer g, gpointer iface_data);
-static TnyAccountStore *modest_tny_platform_factory_new_account_store (TnyPlatformFactory *self);
-static TnyDevice *modest_tny_platform_factory_new_device (TnyPlatformFactory *self);
-static TnyMsgView *modest_tny_platform_factory_new_msg_view (TnyPlatformFactory *self);
+
+static TnyAccountStore* modest_tny_platform_factory_new_account_store (TnyPlatformFactory *self);
+static TnyDevice* modest_tny_platform_factory_new_device (TnyPlatformFactory *self);
+static TnyMsgView* modest_tny_platform_factory_new_msg_view (TnyPlatformFactory *self);
+static TnyMsg* modest_tny_platform_factory_new_msg (TnyPlatformFactory *self);
+static TnyMimePart* modest_tny_platform_factory_new_mime_part (TnyPlatformFactory *self);
+static TnyHeader* modest_tny_platform_factory_new_header (TnyPlatformFactory *self);
+
/* list my signals */
enum {
klass->new_account_store_func = modest_tny_platform_factory_new_account_store;
klass->new_device_func = modest_tny_platform_factory_new_device;
klass->new_msg_view_func = modest_tny_platform_factory_new_msg_view;
+ klass->new_msg_func = modest_tny_platform_factory_new_msg;
+ klass->new_mime_part_func = modest_tny_platform_factory_new_mime_part;
+ klass->new_header_func = modest_tny_platform_factory_new_header;
return;
}
return NULL;
}
+static TnyMsg*
+modest_tny_platform_factory_new_msg (TnyPlatformFactory *self)
+{
+ return tny_camel_msg_new ();
+}
+
+
+static TnyMimePart*
+modest_tny_platform_factory_new_mime_part (TnyPlatformFactory *self)
+{
+ return tny_camel_mime_part_new ();
+}
+
+
+static TnyHeader*
+modest_tny_platform_factory_new_header (TnyPlatformFactory *self)
+{
+ return tny_camel_header_new ();
+}
+
+
ModestAccountMgr *
modest_tny_platform_factory_get_modest_account_mgr_instance (TnyPlatformFactory *fact)
{
${top_srcdir}/src/modest-tny-platform-factory.o \
${top_srcdir}/src/modest-conf.o \
${top_srcdir}/src/modest-protocol-mgr.o \
+ ${top_srcdir}/src/modest-proto.o \
${top_srcdir}/src/modest-formatter.o \
${top_srcdir}/src/modest-presets.o \
${top_srcdir}/src/modest-pair.o \