/* return FALSE; */
/* } */
-static void
-on_sendqueue_error_happened (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, GError *err, ModestMainWindow *user_data)
-{
- if (err) {
- printf ("DEBUG: %s: err->code=%d, err->message=%s\n", __FUNCTION__, err->code, err->message);
+/* static void */
+/* on_sendqueue_error_happened (TnySendQueue *self, TnyHeader *header, TnyMsg *msg, GError *err, ModestMainWindow *user_data) */
+/* { */
+/* if (err) { */
+/* printf ("DEBUG: %s: err->code=%d, err->message=%s\n", __FUNCTION__, err->code, err->message); */
- if (err->code == TNY_ACCOUNT_ERROR_TRY_CONNECT_USER_CANCEL)
- /* Don't show waste the user's time by showing him a dialog telling him
- * that he has just cancelled something: */
- return;
- }
+/* if (err->code == TNY_ACCOUNT_ERROR_TRY_CONNECT_USER_CANCEL) */
+/* /\* Don't show waste the user's time by showing him a dialog telling him */
+/* * that he has just cancelled something: *\/ */
+/* return; */
+/* } */
- /* Get the server name: */
- const gchar* server_name = NULL;
+/* /\* Get the server name: *\/ */
+/* const gchar* server_name = NULL; */
- TnyCamelTransportAccount* server_account = tny_camel_send_queue_get_transport_account (
- TNY_CAMEL_SEND_QUEUE (self));
- if (server_account) {
- server_name = tny_account_get_hostname (TNY_ACCOUNT (server_account));
+/* TnyCamelTransportAccount* server_account = tny_camel_send_queue_get_transport_account ( */
+/* TNY_CAMEL_SEND_QUEUE (self)); */
+/* if (server_account) { */
+/* server_name = tny_account_get_hostname (TNY_ACCOUNT (server_account)); */
- g_object_unref (server_account);
- server_account = NULL;
- }
+/* g_object_unref (server_account); */
+/* server_account = NULL; */
+/* } */
- if (!server_name)
- server_name = _("Unknown Server");
-
- /* Show the appropriate message text for the GError: */
- gchar *message = NULL;
- if (err) {
- switch (err->code) {
- case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_HOST_LOOKUP_FAILED:
- message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
- break;
- case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_SERVICE_UNAVAILABLE:
- message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name);
- break;
- case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_AUTHENTICATION_NOT_SUPPORTED:
- /* TODO: This logical ID seems more suitable for a wrong username or password than for a
- * wrong authentication method. The user is unlikely to guess at the real cause.
- */
- message = g_strdup_printf (_("eemev_ni_ui_smtp_authentication_fail_error"), server_name);
- break;
- case TNY_TRANSPORT_ACCOUNT_ERROR_SEND:
- /* TODO: Tinymail is still sending this sometimes when it should
- * send TNY_ACCOUNT_ERROR_TRY_CONNECT_USER_CANCEL. */
- default:
- message = g_strdup (_("emev_ib_ui_smtp_send_error"));
- break;
- }
- } else {
- message = g_strdup (_("emev_ib_ui_smtp_send_error"));
- }
+/* if (!server_name) */
+/* server_name = _("Unknown Server"); */
+
+/* /\* Show the appropriate message text for the GError: *\/ */
+/* gchar *message = NULL; */
+/* if (err) { */
+/* switch (err->code) { */
+/* case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_HOST_LOOKUP_FAILED: */
+/* message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name); */
+/* break; */
+/* case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_SERVICE_UNAVAILABLE: */
+/* message = g_strdup_printf (_("emev_ib_ui_smtp_server_invalid"), server_name); */
+/* break; */
+/* case TNY_TRANSPORT_ACCOUNT_ERROR_SEND_AUTHENTICATION_NOT_SUPPORTED: */
+/* /\* TODO: This logical ID seems more suitable for a wrong username or password than for a */
+/* * wrong authentication method. The user is unlikely to guess at the real cause. */
+/* *\/ */
+/* message = g_strdup_printf (_("eemev_ni_ui_smtp_authentication_fail_error"), server_name); */
+/* break; */
+/* case TNY_TRANSPORT_ACCOUNT_ERROR_SEND: */
+/* /\* TODO: Tinymail is still sending this sometimes when it should */
+/* * send TNY_ACCOUNT_ERROR_TRY_CONNECT_USER_CANCEL. *\/ */
+/* default: */
+/* message = g_strdup (_("emev_ib_ui_smtp_send_error")); */
+/* break; */
+/* } */
+/* } else { */
+/* message = g_strdup (_("emev_ib_ui_smtp_send_error")); */
+/* } */
- modest_maemo_show_information_note_and_forget (GTK_WINDOW (user_data), message);
- g_free (message);
+/* modest_maemo_show_information_note_and_forget (GTK_WINDOW (user_data), message); */
+/* g_free (message); */
- /* TODO: Offer to remove the message, to avoid messages in future? */
- /*
- TnyFolder *outbox = tny_send_queue_get_outbox (queue);
- tny_folder_remove_msg (outbox, header, NULL);
- tny_folder_sync (outbox, TRUE, NULL);
- g_object_unref (outbox);
- */
-}
+/* /\* TODO: Offer to remove the message, to avoid messages in future? *\/ */
+/* /\* */
+/* TnyFolder *outbox = tny_send_queue_get_outbox (queue); */
+/* tny_folder_remove_msg (outbox, header, NULL); */
+/* tny_folder_sync (outbox, TRUE, NULL); */
+/* g_object_unref (outbox); */
+/* *\/ */
+/* } */
typedef struct {
TnySendQueue *queue;
priv->queue_err_signals = NULL;
}
-static void
-on_account_store_connecting_finished (TnyAccountStore *store, ModestMainWindow *self)
-{
- ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self);
+/* static void */
+/* on_account_store_connecting_finished (TnyAccountStore *store, ModestMainWindow *self) */
+/* { */
+/* ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self); */
- /* When going online, do the equivalent of pressing the send/receive button,
- * as per the specification:
- * (without the check for >0 accounts, though that is not specified): */
+/* /\* When going online, do the equivalent of pressing the send/receive button, */
+/* * as per the specification: */
+/* * (without the check for >0 accounts, though that is not specified): *\/ */
- TnyDevice *device = tny_account_store_get_device (store);
+/* TnyDevice *device = tny_account_store_get_device (store); */
- /* modest_folder_view_update_model (MODEST_FOLDER_VIEW (priv->folder_view), store); */
+/* /\* modest_folder_view_update_model (MODEST_FOLDER_VIEW (priv->folder_view), store); *\/ */
- /* Check that we are really online.
- * This signal should not be emitted when we are not connected,
- * but it seems to happen sometimes: */
- if (!tny_device_is_online (device))
- return;
+/* /\* Check that we are really online. */
+/* * This signal should not be emitted when we are not connected, */
+/* * but it seems to happen sometimes: *\/ */
+/* if (!tny_device_is_online (device)) */
+/* return; */
- const gchar *iap_id = tny_maemo_conic_device_get_current_iap_id (TNY_MAEMO_CONIC_DEVICE (device));
- printf ("DEBUG: %s: connection id=%s\n", __FUNCTION__, iap_id);
+/* const gchar *iap_id = tny_maemo_conic_device_get_current_iap_id (TNY_MAEMO_CONIC_DEVICE (device)); */
+/* printf ("DEBUG: %s: connection id=%s\n", __FUNCTION__, iap_id); */
- /* Stop the existing send queues: */
- modest_runtime_remove_all_send_queues ();
+/* /\* Stop the existing send queues: *\/ */
+/* modest_runtime_remove_all_send_queues (); */
- /* Create the send queues again, using the appropriate transport accounts
- * for this new connection.
- * This could be the first time that they are created if this is the first
- * connection. */
- /* TODO: Does this really destroy the TnySendQueues and their threads
- * We do not want 2 TnySendQueues to exist with the same underlying
- * outbox directory. */
-
- modest_main_window_cleanup_queue_error_signals (self);
-
- GSList *account_names = modest_account_mgr_account_names (
- modest_runtime_get_account_mgr(),
- TRUE /* enabled accounts only */);
- GSList *iter = account_names;
- while (iter) {
- const gchar *account_name = (const gchar*)(iter->data);
- if (account_name) {
- TnyTransportAccount *account = TNY_TRANSPORT_ACCOUNT (
- modest_tny_account_store_get_transport_account_for_open_connection
- (modest_runtime_get_account_store(), account_name));
- if (account) {
- /* Q: Is this the first location where the send-queues are requested? */
- QueueErrorSignal *esignal = g_slice_new (QueueErrorSignal);
- printf ("debug: %s:\n Transport account for %s: %s\n", __FUNCTION__, account_name,
- tny_account_get_id(TNY_ACCOUNT(account)));
- esignal->queue = TNY_SEND_QUEUE (modest_runtime_get_send_queue (account));
- esignal->signal = g_signal_connect (G_OBJECT (esignal->queue), "error-happened",
- G_CALLBACK (on_sendqueue_error_happened), self);
- priv->queue_err_signals = g_list_prepend (priv->queue_err_signals, esignal);
- }
- }
+/* /\* Create the send queues again, using the appropriate transport accounts */
+/* * for this new connection. */
+/* * This could be the first time that they are created if this is the first */
+/* * connection. *\/ */
+/* /\* TODO: Does this really destroy the TnySendQueues and their threads */
+/* * We do not want 2 TnySendQueues to exist with the same underlying */
+/* * outbox directory. *\/ */
+
+/* modest_main_window_cleanup_queue_error_signals (self); */
+
+/* GSList *account_names = modest_account_mgr_account_names ( */
+/* modest_runtime_get_account_mgr(), */
+/* TRUE /\* enabled accounts only *\/); */
+/* GSList *iter = account_names; */
+/* while (iter) { */
+/* const gchar *account_name = (const gchar*)(iter->data); */
+/* if (account_name) { */
+/* TnyTransportAccount *account = TNY_TRANSPORT_ACCOUNT ( */
+/* modest_tny_account_store_get_transport_account_for_open_connection */
+/* (modest_runtime_get_account_store(), account_name)); */
+/* if (account) { */
+/* /\* Q: Is this the first location where the send-queues are requested? *\/ */
+/* QueueErrorSignal *esignal = g_slice_new (QueueErrorSignal); */
+/* printf ("debug: %s:\n Transport account for %s: %s\n", __FUNCTION__, account_name, */
+/* tny_account_get_id(TNY_ACCOUNT(account))); */
+/* esignal->queue = TNY_SEND_QUEUE (modest_runtime_get_send_queue (account)); */
+/* esignal->signal = g_signal_connect (G_OBJECT (esignal->queue), "error-happened", */
+/* G_CALLBACK (on_sendqueue_error_happened), self); */
+/* priv->queue_err_signals = g_list_prepend (priv->queue_err_signals, esignal); */
+/* } */
+/* } */
- iter = g_slist_next (iter);
- }
+/* iter = g_slist_next (iter); */
+/* } */
- modest_account_mgr_free_account_names (account_names);
- account_names = NULL;
+/* modest_account_mgr_free_account_names (account_names); */
+/* account_names = NULL; */
- modest_ui_actions_do_send_receive (NULL, MODEST_WINDOW (self));
-}
+/* modest_ui_actions_do_send_receive (NULL, MODEST_WINDOW (self)); */
+/* } */
static void
_folder_view_csm_menu_activated (GtkWidget *widget, gpointer user_data)
"password_requested",
G_CALLBACK (modest_ui_actions_on_password_requested), self);
- /* Device */
- g_signal_connect (G_OBJECT(modest_runtime_get_account_store()),
- "connecting-finished",
- G_CALLBACK(on_account_store_connecting_finished), self);
+/* /\* Device *\/ */
+/* g_signal_connect (G_OBJECT(modest_runtime_get_account_store()), */
+/* "connecting-finished", */
+/* G_CALLBACK(on_account_store_connecting_finished), self); */
}
#if 0
#include <libgnomevfs/gnome-vfs-volume-monitor.h>
/* 'private'/'protected' functions */
-static void modest_tny_account_store_class_init (ModestTnyAccountStoreClass *klass);
-//static void modest_tny_account_store_init (ModestTnyAccountStore *obj);
-static void modest_tny_account_store_finalize (GObject *obj);
+static void modest_tny_account_store_class_init (ModestTnyAccountStoreClass *klass);
+
+static void modest_tny_account_store_finalize (GObject *obj);
-/* implementations for tny-account-store-iface */
static void modest_tny_account_store_instance_init (ModestTnyAccountStore *obj);
+
static void modest_tny_account_store_init (gpointer g, gpointer iface_data);
+static void modest_tny_account_store_base_init (gpointer g_class);
static void get_server_accounts (TnyAccountStore *self,
TnyList *list,
/* list my signals */
enum {
+ ACCOUNT_CHANGED_SIGNAL,
+ ACCOUNT_INSERTED_SIGNAL,
+ ACCOUNT_REMOVED_SIGNAL,
ACCOUNT_UPDATE_SIGNAL,
PASSWORD_REQUESTED_SIGNAL,
LAST_SIGNAL
if (!my_type) {
static const GTypeInfo my_info = {
sizeof(ModestTnyAccountStoreClass),
- NULL, /* base init */
+ modest_tny_account_store_base_init, /* base init */
NULL, /* base finalize */
(GClassInitFunc) modest_tny_account_store_class_init,
NULL, /* class finalize */
return my_type;
}
+
+static void
+modest_tny_account_store_base_init (gpointer g_class)
+{
+ static gboolean tny_account_store_initialized = FALSE;
+
+ if (!tny_account_store_initialized) {
+
+ signals[ACCOUNT_CHANGED_SIGNAL] =
+ g_signal_new ("account_changed",
+ MODEST_TYPE_TNY_ACCOUNT_STORE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ModestTnyAccountStoreClass, account_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, TNY_TYPE_ACCOUNT);
+
+ signals[ACCOUNT_INSERTED_SIGNAL] =
+ g_signal_new ("account_inserted",
+ MODEST_TYPE_TNY_ACCOUNT_STORE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ModestTnyAccountStoreClass, account_inserted),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, TNY_TYPE_ACCOUNT);
+
+ signals[ACCOUNT_REMOVED_SIGNAL] =
+ g_signal_new ("account_removed",
+ MODEST_TYPE_TNY_ACCOUNT_STORE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (ModestTnyAccountStoreClass, account_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, TNY_TYPE_ACCOUNT);
+
+/* signals[TNY_ACCOUNT_STORE_CONNECTING_FINISHED] = */
+/* g_signal_new ("connecting_finished", */
+/* TNY_TYPE_ACCOUNT_STORE, */
+/* G_SIGNAL_RUN_FIRST, */
+/* G_STRUCT_OFFSET (TnyAccountStoreIface, connecting_finished), */
+/* NULL, NULL, */
+/* g_cclosure_marshal_VOID__VOID, */
+/* G_TYPE_NONE, 0); */
+
+ signals[ACCOUNT_UPDATE_SIGNAL] =
+ g_signal_new ("account_update",
+ MODEST_TYPE_TNY_ACCOUNT_STORE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(ModestTnyAccountStoreClass, account_update),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
+
+ signals[PASSWORD_REQUESTED_SIGNAL] =
+ g_signal_new ("password_requested",
+ MODEST_TYPE_TNY_ACCOUNT_STORE,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(ModestTnyAccountStoreClass, password_requested),
+ NULL, NULL,
+ modest_marshal_VOID__STRING_POINTER_POINTER_POINTER_POINTER,
+ G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER,
+ G_TYPE_POINTER);
+
+ tny_account_store_initialized = TRUE;
+ }
+}
+
+
static void
modest_tny_account_store_class_init (ModestTnyAccountStoreClass *klass)
{
g_type_class_add_private (gobject_class,
sizeof(ModestTnyAccountStorePrivate));
-
- signals[ACCOUNT_UPDATE_SIGNAL] =
- g_signal_new ("account_update",
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET(ModestTnyAccountStoreClass, account_update),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- signals[PASSWORD_REQUESTED_SIGNAL] =
- g_signal_new ("password_requested",
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET(ModestTnyAccountStoreClass, password_requested),
- NULL, NULL,
- modest_marshal_VOID__STRING_POINTER_POINTER_POINTER_POINTER,
- G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER,
- G_TYPE_POINTER);
}
/* Notify the observers */
g_signal_emit (G_OBJECT (self),
- tny_account_store_signals [TNY_ACCOUNT_STORE_ACCOUNT_REMOVED],
+ signals [ACCOUNT_REMOVED_SIGNAL],
0, store_account);
g_signal_emit (G_OBJECT (self),
- tny_account_store_signals [TNY_ACCOUNT_STORE_ACCOUNT_REMOVED],
+ signals [ACCOUNT_REMOVED_SIGNAL],
0, transport_account);
/* Frees */
}
tny_session_camel_set_ui_locker (priv->session, tny_gtk_lockable_new ());
- tny_session_camel_set_async_connecting (priv->session, TRUE);
+/* tny_session_camel_set_async_connecting (priv->session, TRUE); */
/* Connect signals */
g_signal_connect (G_OBJECT(account_mgr), "account_changed",
gboolean *remember,
gboolean *cancel,
gpointer user_data);
+
+ /* Signals */
+ void (*account_changed) (TnyAccountStore *self, TnyAccount *account);
+ void (*account_inserted) (TnyAccountStore *self, TnyAccount *account);
+ void (*account_removed) (TnyAccountStore *self, TnyAccount *account);
};
typedef enum {
TnyAccount *account,
gpointer user_data);
-static void on_accounts_reloaded (TnyAccountStore *store,
- gpointer user_data);
+/* static void on_accounts_reloaded (TnyAccountStore *store, */
+/* gpointer user_data); */
static gint cmp_rows (GtkTreeModel *tree_model,
GtkTreeIter *iter1,
gulong account_update_signal;
gulong changed_signal;
- gulong accounts_reloaded_signal;
+/* gulong accounts_reloaded_signal; */
gulong account_removed_signal;
gulong conf_key_signal;
if (priv->account_store) {
g_signal_handler_disconnect (G_OBJECT(priv->account_store),
priv->account_update_signal);
- g_signal_handler_disconnect (G_OBJECT(priv->account_store),
- priv->accounts_reloaded_signal);
+/* g_signal_handler_disconnect (G_OBJECT(priv->account_store), */
+/* priv->accounts_reloaded_signal); */
g_signal_handler_disconnect (G_OBJECT(priv->account_store),
priv->account_removed_signal);
g_object_unref (G_OBJECT(priv->account_store));
priv->account_update_signal))
g_signal_handler_disconnect (G_OBJECT (priv->account_store),
priv->account_update_signal);
- if (g_signal_handler_is_connected (G_OBJECT (priv->account_store),
- priv->accounts_reloaded_signal))
- g_signal_handler_disconnect (G_OBJECT (priv->account_store),
- priv->accounts_reloaded_signal);
+/* if (g_signal_handler_is_connected (G_OBJECT (priv->account_store), */
+/* priv->accounts_reloaded_signal)) */
+/* g_signal_handler_disconnect (G_OBJECT (priv->account_store), */
+/* priv->accounts_reloaded_signal); */
if (g_signal_handler_is_connected (G_OBJECT (priv->account_store),
priv->account_removed_signal))
g_signal_handler_disconnect (G_OBJECT (priv->account_store),
g_signal_connect (G_OBJECT(account_store), "account_removed",
G_CALLBACK (on_account_removed), self);
- priv->accounts_reloaded_signal =
- g_signal_connect (G_OBJECT(account_store), "accounts_reloaded",
- G_CALLBACK (on_accounts_reloaded), self);
+/* priv->accounts_reloaded_signal = */
+/* g_signal_connect (G_OBJECT(account_store), "accounts_reloaded", */
+/* G_CALLBACK (on_accounts_reloaded), self); */
- g_signal_connect (G_OBJECT(account_store), "connecting_finished",
- G_CALLBACK (on_accounts_reloaded), self);
+/* g_signal_connect (G_OBJECT(account_store), "connecting_finished", */
+/* G_CALLBACK (on_accounts_reloaded), self); */
- on_accounts_reloaded (account_store, (gpointer ) self);
+/* on_accounts_reloaded (account_store, (gpointer ) self); */
g_object_unref (G_OBJECT (device));
}
account);
}
-static void
-on_accounts_reloaded (TnyAccountStore *account_store,
- gpointer user_data)
-{
- g_return_if_fail (MODEST_IS_FOLDER_VIEW (user_data));
- modest_folder_view_update_model (MODEST_FOLDER_VIEW (user_data), account_store);
-}
+/* static void */
+/* on_accounts_reloaded (TnyAccountStore *account_store, */
+/* gpointer user_data) */
+/* { */
+/* g_return_if_fail (MODEST_IS_FOLDER_VIEW (user_data)); */
+/* modest_folder_view_update_model (MODEST_FOLDER_VIEW (user_data), account_store); */
+/* } */
void
modest_folder_view_set_title (ModestFolderView *self, const gchar *title)
/* FIXME: the local accounts are not shown when the query
selects only the subscribed folders. */
/* model = tny_gtk_folder_store_tree_model_new (TRUE, priv->query); */
- model = tny_gtk_folder_store_tree_model_new (TRUE, NULL);
+ model = tny_gtk_folder_store_tree_model_new (NULL);
/* Deal with the model via its TnyList Interface,
* filling the TnyList via a get_accounts() call: */