+modest (3.90.4-modest0) karmic; urgency=low
+
+ * Integrated changes in modest 3.90.4 release.
+ * Misc build fixes.
+ * Set active account of folder window before registering, to allow window mgr
+ * to know it on register stage.
+ * Moved Back button to the top right corner.
+ * Removed unused includes.
+ * New mail operation modest_mail_operation_update_folder_counts. This is for
+ * only doing poke_status on all folders.
+ * New DBUS API for update_folder_counts method.
+ * Test app for update_folder_counts method.
+ * Show calendar flag in headers list.
+ * New method to find a calendar part in a message.
+ * Detect calendar status from parts in header view.
+ * On showing a calendar event in view, emit a signal to handle it in upper
+ * layers.
+ * If handle_calendar is not handler, then don't show the calendar containers.
+ * Autoretrieve calendar parts in bodystructure.
+ * Add methods to create a reply to calendar message and open it in editor.
+ * Pass to account protocol request to handle the calendar.
+ * Only set priority if it differs from normal.
+ * Fixes: Several reference leaks in ModestFolderView's filter method.
+ * Fixes: Zoom keys behaviour in Modest.
+ * Fixes: A crash creating new messages.
+ * Fixes: NB#134194 "volume %x" shown when attempt to zoom.
+ * Fixes: NB#140276 Only remove mail notifications for each account, when we
+ * see mails or folders from that account.
+ * Fixes: NB#142363 Use non-localized reply and forward prefixes.
+ * Fixes: NB#144441 "unable to zoom" shown in email inbox while mediaplayer
+ * is active.
+ * Fixes: NB#146213 Show progress information when saving attachments.
+ * Fixes: NB#147995 Show the signature in SecondaryTextColor for HTML emails.
+ * Fixes: NB#150401 Usage of zoom keys should be revised in email.
+ * Fixes: NB#152559 New show toolbar button in editor.
+ * Fixes: NB#153338 Fixed a typo in a logical id.
+ * Fixes: NB#153599 Fixes a crash when saving attachments fails.
+
+ -- Jose Dapena Paz <jdapena@igalia.com> Sun, 24 Jan 2010 12:29:34 +0100
+
modest (3.90.3-modest0) karmic; urgency=low
* Integrated fixes in upstream modest 3.90.3
Section: mail
Priority: optional
Maintainer: Moises Martinez <moises.martinez@nokia.com>
-Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev, gnome-common, gtkhtml3.14-dev, libconic0-dev, libhildon1-dev, libdbus-1-dev,
+Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev (>= 3.2.1), gnome-common, gtkhtml3.14-dev, libconic0-dev, libhildon1-dev, libdbus-1-dev,
libdbus-glib-1-dev, libebook-dev, osso-af-settings, libedataserver-dev, libhildonnotify-dev, libgconf2-dev,
libglib2.0-dev, libosso-abook-dev, libosso-gnomevfs2-dev, libhildonmime-dev, libprofile-dev, libtime-dev, libtinymail-1.0-0-dev, libtinymail-camel-1.0-0-dev,
libtinymail-maemo-1.0-0-dev, libtinymailui-1.0-0-dev, libtinymail-gnomevfs-1.0-0-dev, libtinymailui-gtk-1.0-0-dev, wpeditor0,
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-AC_INIT([libmodestclient],[3.2.0],[http://maemo.org])
+AC_INIT([libmodestclient],[3.2.1],[http://maemo.org])
AC_CONFIG_HEADERS([config.h])
m4_define([modest_api_major_version], [1])
m4_define([modest_api_minor_version], [99])
-m4_define([modest_api_micro_version], [2])
+m4_define([modest_api_micro_version], [3])
m4_define([modest_api_version], [modest_api_major_version.modest_api_minor_version.modest_api_micro_version])
+libmodest-dbus-client (4:3.2.1-0) unstable; urgency=low
+
+ * Add API method UpdateFolderCounts
+
+ -- Moises Martinez <moises.martinez@nokia.com> Mon, 18 Jan 2010 14:00:44 +0100
+
libmodest-dbus-client (4:3.2.0-0) unstable; urgency=low
* Week 43, 2009 - third release
**/
#define MODEST_DBUS_METHOD_TOP_APPLICATION "top_application"
+#define MODEST_DBUS_METHOD_UPDATE_FOLDER_COUNTS "update_folder_counts"
+enum ModestDbusUpdateFolderCountsArguments
+{
+ MODEST_DBUS_UPDATE_FOLDER_COUNTS_ARG_ACCOUNT_ID,
+ MODEST_DBUS_UPDATE_FOLDER_COUNTS_ARGS_COUNT
+};
+
#endif /* __MODEST_DBUS_API__ */
}
gboolean
+libmodest_dbus_client_update_folder_counts (osso_context_t *osso_context,
+ const gchar *account)
+{
+ osso_rpc_t retval = { 0 };
+ const osso_return_t ret = osso_rpc_run_with_defaults(osso_context,
+ MODEST_DBUS_NAME,
+ MODEST_DBUS_METHOD_UPDATE_FOLDER_COUNTS, &retval,
+ DBUS_TYPE_STRING, account,
+ DBUS_TYPE_INVALID);
+
+ if (ret != OSSO_OK) {
+ printf("debug: %s: osso_rpc_run() failed.\n", __FUNCTION__);
+ return FALSE;
+ } else {
+ printf("debug: %s: osso_rpc_run() succeeded.\n", __FUNCTION__);
+ }
+
+ osso_rpc_free_val(&retval);
+
+ return TRUE;
+}
+
+gboolean
libmodest_dbus_client_open_default_inbox (osso_context_t *osso_context)
{
osso_rpc_t retval = { 0 };
const gchar *account,
gboolean manual);
+/**
+ * libmodest_dbus_client_update_folder_counts:
+ * @osso_context: a valid osso_context instance
+ * @account: the account name
+ *
+ * updates folder counts of @account.
+ *
+ * Returns: %TRUE upon success, %FALSE otherwise
+ */
+gboolean libmodest_dbus_client_update_folder_counts (osso_context_t *osso_context,
+ const gchar *account);
+
/**
return FALSE;
}
-
-
static gint
on_dbus_method_dump_send_queues (DBusConnection *con, DBusMessage *message)
{
return OSSO_OK;
}
+static gboolean
+on_idle_update_folder_counts (gpointer userdata)
+{
+ ModestMailOperation *mail_op;
+ gchar *account_id = (gchar *) userdata;
+
+ mail_op = modest_mail_operation_new (NULL);
+ modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
+ mail_op);
+ modest_mail_operation_update_folder_counts (mail_op, account_id);
+ g_object_unref (mail_op);
+ g_free (account_id);
+
+ return FALSE;
+
+}
+
+static gint
+on_update_folder_counts (GArray *arguments, gpointer data, osso_rpc_t * retval)
+{
+ osso_rpc_t val;
+ gchar *account_id;
+
+ val = g_array_index (arguments, osso_rpc_t, MODEST_DBUS_SEND_RECEIVE_FULL_ARG_ACCOUNT_ID);
+ account_id = g_strdup (val.value.s);
+
+ if (account_id != NULL) {
+ g_idle_add (on_idle_update_folder_counts, g_strdup (account_id));
+ }
+
+ g_free (account_id);
+
+ return OSSO_OK;
+}
+
static gint
on_open_default_inbox(GArray * arguments, gpointer data, osso_rpc_t * retval)
{
mgr = modest_runtime_get_window_mgr ();
window = (GtkWidget *) modest_window_mgr_show_initial_window (mgr);
- if (window) {
- modest_platform_remove_new_mail_notifications (FALSE);
- } else {
- g_printerr ("modest: failed to get main window instance\n");
- }
}
gdk_threads_leave (); /* CHECKED */
if (arguments->len != MODEST_DBUS_SEND_RECEIVE_FULL_ARGS_COUNT)
goto param_error;
return on_send_receive_full (arguments, data, retval);
+ } else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_UPDATE_FOLDER_COUNTS) == 0) {
+ if (arguments->len != MODEST_DBUS_UPDATE_FOLDER_COUNTS_ARGS_COUNT)
+ goto param_error;
+ return on_update_folder_counts (arguments, data, retval);
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_COMPOSE_MAIL) == 0) {
if (arguments->len != MODEST_DBUS_COMPOSE_MAIL_ARGS_COUNT)
goto param_error;
#define MODEST_HEADER_ICON_NORM_PRIORITY PIXMAP_PREFIX"modest_normal_no_attachment.png"
#define MODEST_HEADER_ICON_HIGH "stock_mail-priority-high"
#define MODEST_HEADER_ICON_LOW "stock_mail-priority-low"
+#define MODEST_HEADER_ICON_CALENDAR "appointment"
/*
*
*/
}
void
-modest_platform_remove_new_mail_notifications (gboolean only_visuals)
+modest_platform_remove_new_mail_notifications (gboolean only_visuals, const gchar *acc_name)
{
return;
}
gtk_widget_show (GTK_WIDGET (priv->new_message_button));
g_signal_connect (G_OBJECT (priv->new_message_button), "clicked", G_CALLBACK (on_new_msg_button_clicked), obj);
- priv->back_button = gtk_tool_button_new_from_stock (GTK_STOCK_GO_BACK);
- g_object_set (priv->back_button, "is-important", TRUE, NULL);
- gtk_toolbar_insert (GTK_TOOLBAR (priv->top_toolbar), priv->back_button, -1);
- gtk_widget_show (GTK_WIDGET (priv->back_button));
- g_signal_connect (G_OBJECT (priv->back_button), "clicked", G_CALLBACK (on_back_button_clicked), obj);
-
separator_toolitem = gtk_separator_tool_item_new ();
gtk_toolbar_insert (GTK_TOOLBAR (priv->top_toolbar), separator_toolitem, -1);
gtk_widget_show (GTK_WIDGET (separator_toolitem));
g_object_set (priv->title_button, "is-important", TRUE, NULL);
g_signal_connect (G_OBJECT (priv->title_button), "clicked", G_CALLBACK (on_title_button_clicked), obj);
+ priv->back_button = gtk_tool_button_new_from_stock (GTK_STOCK_GO_BACK);
+ g_object_set (priv->back_button, "is-important", TRUE, NULL);
+ gtk_toolbar_insert (GTK_TOOLBAR (priv->top_toolbar), priv->back_button, -1);
+ gtk_widget_show (GTK_WIDGET (priv->back_button));
+ g_signal_connect (G_OBJECT (priv->back_button), "clicked", G_CALLBACK (on_back_button_clicked), obj);
+
priv->notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs ((GtkNotebook *)priv->notebook, FALSE);
gtk_notebook_set_show_border ((GtkNotebook *)priv->notebook, FALSE);
HildonWindowStack *stack;
gboolean nested_msg = FALSE;
ModestWindow *current_top;
+ const gchar *acc_name;
g_return_val_if_fail (MODEST_IS_HILDON2_WINDOW_MGR (self), FALSE);
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
*handler_id = g_signal_connect (window, "delete-event", G_CALLBACK (on_window_destroy), self);
g_hash_table_insert (priv->destroy_handlers, window, handler_id);
+ if (!MODEST_IS_MSG_EDIT_WINDOW (window) &&
+ !MODEST_IS_ACCOUNTS_WINDOW (window)) {
+ acc_name = modest_window_get_active_account (window);
+
+ if (acc_name) {
+ modest_platform_remove_new_mail_notifications (FALSE, acc_name);
+ }
+ }
+
/* Show toolbar always */
- modest_window_show_toolbar (window, TRUE);
+ if (MODEST_MSG_EDIT_WINDOW (window)) {
+ gboolean show_toolbar;
+ show_toolbar = modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR, NULL);
+ modest_window_show_toolbar (window, show_toolbar);
+ } else {
+ modest_window_show_toolbar (window, TRUE);
+ }
return TRUE;
fail:
/* Stop blinking if the screen becomes on */
if (priv->display_state == OSSO_DISPLAY_ON)
- modest_platform_remove_new_mail_notifications (TRUE);
+ modest_platform_remove_new_mail_notifications (TRUE, NULL);
}
static gboolean
#define MODEST_HEADER_ICON_ATTACH "email_attachment"
#define MODEST_HEADER_ICON_HIGH "email_message_high_priority"
#define MODEST_HEADER_ICON_LOW "email_message_low_priority"
+#define MODEST_HEADER_ICON_CALENDAR "email_event_invitation"
/*
* until we have the custom cell renderer, we use the hacked icons below;
gchar *from;
TnyAccountStore *acc_store;
TnyAccount *account;
+ gchar *acc_name;
data = (ModestMsgNotificationData *) URI_list->data;
/* Set the account of the headers */
acc_store = (TnyAccountStore *) modest_runtime_get_account_store ();
account = tny_account_store_find_account (acc_store, data->uri);
+ acc_name = NULL;
if (account) {
- const gchar *acc_name;
- acc_name =
- modest_tny_account_get_parent_modest_account_name_for_server_account (account);
+ acc_name = g_strdup (modest_tny_account_get_parent_modest_account_name_for_server_account (account));
notify_notification_set_hint_string(NOTIFY_NOTIFICATION (notification),
"email-account",
acc_name);
GSList *notifications_list = NULL;
/* Get previous notifications ids */
- notifications_list = modest_conf_get_list (modest_runtime_get_conf (),
- MODEST_CONF_NOTIFICATION_IDS,
- MODEST_CONF_VALUE_INT, NULL);
+ if (acc_name) {
+ notifications_list = modest_account_mgr_get_list (modest_runtime_get_account_mgr (), acc_name,
+ MODEST_ACCOUNT_NOTIFICATION_IDS,
+ MODEST_CONF_VALUE_INT, FALSE);
+ }
/* Save id in the list */
g_object_get(G_OBJECT (notification), "id", ¬if_id, NULL);
not to store the list in gconf */
/* Save the ids */
- modest_conf_set_list (modest_runtime_get_conf (), MODEST_CONF_NOTIFICATION_IDS,
- notifications_list, MODEST_CONF_VALUE_INT, NULL);
-
+ if (acc_name)
+ modest_account_mgr_set_list (modest_runtime_get_account_mgr (), acc_name,
+ MODEST_ACCOUNT_NOTIFICATION_IDS,
+ notifications_list, MODEST_CONF_VALUE_INT, FALSE);
+
g_slist_free (notifications_list);
} else {
g_warning ("Failed to send notification");
}
+ g_free (acc_name);
#endif /*MODEST_HAVE_HILDON_NOTIFY*/
}
void
-modest_platform_remove_new_mail_notifications (gboolean only_visuals)
+modest_platform_remove_new_mail_notifications (gboolean only_visuals, const gchar *acc_name)
{
if (only_visuals) {
#ifdef MODEST_HAVE_MCE
GSList *notif_list = NULL;
/* Get previous notifications ids */
- notif_list = modest_conf_get_list (modest_runtime_get_conf (),
- MODEST_CONF_NOTIFICATION_IDS,
- MODEST_CONF_VALUE_INT, NULL);
+ notif_list = modest_account_mgr_get_list (modest_runtime_get_account_mgr (),
+ acc_name,
+ MODEST_ACCOUNT_NOTIFICATION_IDS,
+ MODEST_CONF_VALUE_INT, FALSE);
while (notif_list) {
gint notif_id;
}
/* Save the ids */
- modest_conf_set_list (modest_runtime_get_conf (), MODEST_CONF_NOTIFICATION_IDS,
- notif_list, MODEST_CONF_VALUE_INT, NULL);
+ modest_account_mgr_set_list (modest_runtime_get_account_mgr (), acc_name,
+ MODEST_ACCOUNT_NOTIFICATION_IDS,
+ notif_list, MODEST_CONF_VALUE_INT, FALSE);
g_slist_free (notif_list);
gchar * modest_account_mgr_get_string (ModestAccountMgr *self, const gchar *name,
const gchar *key, gboolean server_account);
+GSList * modest_account_mgr_get_list (ModestAccountMgr *self, const gchar *name,
+ const gchar *key, ModestConfValueType list_type,
+ gboolean server_account);
+gboolean modest_account_mgr_set_list (ModestAccountMgr *self,
+ const gchar *name,
+ const gchar *key,
+ GSList *val,
+ ModestConfValueType list_type,
+ gboolean server_account);
G_END_DECLS
#endif /* __MODEST_ACCOUNT_MGR_H__ */
TnyMsg *old_msg,
ModestAccountProtocolSaveRemoteDraftCallback callback,
gpointer userdata);
+static gboolean
+modest_account_protocol_handle_calendar_default (ModestAccountProtocol *self,
+ ModestWindow *window,
+ TnyMimePart *calendar_part,
+ GtkContainer *container);
/* globals */
static GObjectClass *parent_class = NULL;
modest_account_protocol_get_service_icon_default;
account_class->save_remote_draft =
modest_account_protocol_save_remote_draft_default;
+ account_class->handle_calendar =
+ modest_account_protocol_handle_calendar_default;
}
}
}
+gboolean
+modest_account_protocol_handle_calendar (ModestAccountProtocol *self,
+ ModestWindow *window,
+ TnyMimePart *calendar_part,
+ GtkContainer *container)
+{
+ return MODEST_ACCOUNT_PROTOCOL_GET_CLASS (self)->handle_calendar (self, window,
+ calendar_part, container);
+}
+
+static gboolean
+modest_account_protocol_handle_calendar_default (ModestAccountProtocol *self,
+ ModestWindow *window,
+ TnyMimePart *calendar_part,
+ GtkContainer *container)
+{
+ return FALSE;
+}
#include "widgets/modest-account-settings-dialog.h"
#include "modest-protocol.h"
+#include "widgets/modest-window.h"
#include "widgets/modest-wizard-dialog.h"
#include "modest-pair.h"
#include <tny-account.h>
TnyStatusCallback status_callback,
gpointer user_data);
+ gboolean (*handle_calendar) (ModestAccountProtocol *protocol,
+ ModestWindow *window,
+ TnyMimePart *calendar_part,
+ GtkContainer *container);
+
/* Padding for future expansions */
- void (*_reserved8) (void);
void (*_reserved9) (void);
void (*_reserved10) (void);
void (*_reserved11) (void);
TnyStatusCallback status_callback,
gpointer user_data);
+/**
+ * modest_account_protocol_handle_calendar:
+ * @self: a #ModestAccountProtocol
+ * @window: the #ModestWindow requesting to handle calendar
+ * @calendar_part: a #TnyMimePart
+ * @container: a #GtkContainer (a #GtkVBox now)
+ *
+ * Instruct the account protocol to handle a calendar mime part. The account protocol
+ * will fill @container with the controls to handle the @calendar invitation.
+ *
+ * Returns: %TRUE if account protocol handles the calendar request, %FALSE otherwise
+ */
+gboolean modest_account_protocol_handle_calendar (ModestAccountProtocol *self,
+ ModestWindow *window,
+ TnyMimePart *calendar_part,
+ GtkContainer *container);
+
G_END_DECLS
/* Notification ids */
#define MODEST_CONF_NOTIFICATION_IDS (modest_defs_namespace ("/notification_ids")) /* list of ints */
+#define MODEST_ACCOUNT_NOTIFICATION_IDS "notification_ids" /* list of ints */
#ifdef MODEST_TOOLKIT_HILDON2
#define MODEST_EXAMPLE_EMAIL_ADDRESS _("mcen_va_example_email_address")
TnyFolderObserver *inbox_observer;
gboolean interactive;
gboolean msg_readed;
+ gboolean update_folder_counts;
} UpdateAccountInfo;
static void destroy_update_account_info (UpdateAccountInfo *info);
}
if (new_msg) {
- TnyHeader *header;
+ TnyHeader *header = tny_msg_get_header (new_msg);
/* Set priority flags in message */
- header = tny_msg_get_header (new_msg);
- tny_header_set_flag (header, info->priority_flags);
+ if (info->priority_flags != TNY_HEADER_FLAG_NORMAL_PRIORITY)
+ tny_header_set_flag (header, info->priority_flags);
/* Set attachment flags in message */
if (info->attachments_list != NULL && attached > 0)
g_list_foreach (info->attachments_list, (GFunc) g_object_ref, NULL);
info->images_list = g_list_copy ((GList *) images_list);
g_list_foreach (info->images_list, (GFunc) g_object_ref, NULL);
- info->priority_flags = priority_flags;
+ info->priority_flags = 0 | priority_flags;
info->callback = callback;
info->userdata = userdata;
TnyTransportAccount *transport_account = NULL;
ModestTnyAccountStore *account_store;
+ if (info->update_folder_counts)
+ return;
+
account_store = modest_runtime_get_account_store ();
/* We don't try to send messages while sending mails is blocked */
ModestMailOperationPrivate *priv;
TnyIterator *new_headers_iter;
GPtrArray *new_headers_array = NULL;
- gint max_size, retrieve_limit, i;
+ gint max_size = G_MAXINT, retrieve_limit, i;
ModestAccountMgr *mgr;
ModestAccountRetrieveType retrieve_type;
TnyList *new_headers = NULL;
goto send_mail;
}
- /* Set the last updated as the current time */
+ if (!info->update_folder_counts) {
+ /* Set the last updated as the current time */
#ifdef MODEST_USE_LIBTIME
- struct tm utc_tm;
- time_get_utc (&utc_tm);
- time_to_store = time_mktime (&utc_tm, "GMT");
+ struct tm utc_tm;
+ time_get_utc (&utc_tm);
+ time_to_store = time_mktime (&utc_tm, "GMT");
#else
- time_to_store = time (NULL);
+ time_to_store = time (NULL);
#endif
- modest_account_mgr_set_last_updated (mgr, tny_account_get_id (priv->account), time_to_store);
+ modest_account_mgr_set_last_updated (mgr, tny_account_get_id (priv->account), time_to_store);
- /* Get the message max size */
- max_size = modest_conf_get_int (modest_runtime_get_conf (),
- MODEST_CONF_MSG_SIZE_LIMIT, NULL);
- if (max_size == 0)
- max_size = G_MAXINT;
- else
- max_size = max_size * KB;
+ /* Get the message max size */
+ max_size = modest_conf_get_int (modest_runtime_get_conf (),
+ MODEST_CONF_MSG_SIZE_LIMIT, NULL);
+ if (max_size == 0)
+ max_size = G_MAXINT;
+ else
+ max_size = max_size * KB;
+ }
/* Create the new headers array. We need it to sort the
new headers by date */
folder = TNY_FOLDER (tny_iterator_get_current (iter_all_folders));
- if (tny_folder_get_folder_type (folder) == TNY_FOLDER_TYPE_INBOX) {
+ if (!info->update_folder_counts && tny_folder_get_folder_type (folder) == TNY_FOLDER_TYPE_INBOX) {
/* Get a reference to the INBOX */
inbox = g_object_ref (folder);
} else {
info->mail_op = g_object_ref (self);
info->poke_all = poke_all;
info->interactive = interactive;
+ info->update_folder_counts = FALSE;
info->account_name = g_strdup (account_name);
info->callback = callback;
info->user_data = user_data;
}
+void
+modest_mail_operation_update_folder_counts (ModestMailOperation *self,
+ const gchar *account_name)
+{
+ UpdateAccountInfo *info = NULL;
+ ModestMailOperationPrivate *priv = NULL;
+ ModestTnyAccountStore *account_store = NULL;
+ TnyList *folders;
+ ModestMailOperationState *state;
+
+ /* Init mail operation */
+ priv = MODEST_MAIL_OPERATION_GET_PRIVATE(self);
+ priv->total = 0;
+ priv->done = 0;
+ priv->status = MODEST_MAIL_OPERATION_STATUS_IN_PROGRESS;
+ priv->op_type = MODEST_MAIL_OPERATION_TYPE_UPDATE_FOLDER_COUNTS;
+
+ /* Get the store account */
+ account_store = modest_runtime_get_account_store ();
+ priv->account =
+ modest_tny_account_store_get_server_account (account_store,
+ account_name,
+ TNY_ACCOUNT_TYPE_STORE);
+
+ /* The above function could return NULL */
+ if (!priv->account) {
+ /* Check if the operation was a success */
+ g_set_error (&(priv->error), MODEST_MAIL_OPERATION_ERROR,
+ MODEST_MAIL_OPERATION_ERROR_ITEM_NOT_FOUND,
+ "no account");
+ priv->status = MODEST_MAIL_OPERATION_STATUS_FAILED;
+
+ /* Notify about operation end */
+ modest_mail_operation_notify_end (self);
+
+ return;
+ }
+
+ /* We have once seen priv->account getting finalized during this code,
+ * therefore adding a reference (bug #82296) */
+
+ g_object_ref (priv->account);
+
+ /* Create the helper object */
+ info = g_slice_new0 (UpdateAccountInfo);
+ info->pending_calls = 1;
+ info->folders = tny_simple_list_new ();
+ info->mail_op = g_object_ref (self);
+ info->poke_all = TRUE;
+ info->interactive = FALSE;
+ info->update_folder_counts = TRUE;
+ info->account_name = g_strdup (account_name);
+ info->callback = NULL;
+ info->user_data = NULL;
+
+ /* Set account busy */
+ modest_account_mgr_set_account_busy (modest_runtime_get_account_mgr (), account_name, TRUE);
+ modest_mail_operation_notify_start (self);
+
+ /* notify about the start of the operation */
+ state = modest_mail_operation_clone_state (self);
+ state->done = 0;
+ state->total = 0;
+
+ /* Start notifying progress */
+ g_signal_emit (G_OBJECT (self), signals[PROGRESS_CHANGED_SIGNAL], 0, state, NULL);
+ g_slice_free (ModestMailOperationState, state);
+
+ /* Get all folders and continue in the callback */
+ folders = tny_simple_list_new ();
+ tny_folder_store_get_folders_async (TNY_FOLDER_STORE (priv->account),
+ folders, NULL, TRUE,
+ recurse_folders_async_cb,
+ NULL, info);
+ g_object_unref (folders);
+
+ g_object_unref (priv->account);
+
+}
+
/*
* Used to notify the queue from the main
* loop. We call it inside an idle call to achieve that
MODEST_MAIL_OPERATION_TYPE_SYNC_FOLDER,
MODEST_MAIL_OPERATION_TYPE_SHUTDOWN,
MODEST_MAIL_OPERATION_TYPE_QUEUE_WAKEUP,
+ MODEST_MAIL_OPERATION_TYPE_UPDATE_FOLDER_COUNTS,
MODEST_MAIL_OPERATION_TYPE_UNKNOWN,
} ModestMailOperationTypeOperation;
UpdateAccountCallback callback,
gpointer user_data);
+/**
+ * modest_mail_operation_update_folder_counts:
+ * @self: a #ModestMailOperation
+ * @account_name: the id of a Modest account
+ *
+ * Asynchronously refreshes the folder counts of the given store
+ * account.
+ */
+void modest_mail_operation_update_folder_counts (ModestMailOperation *self,
+ const gchar *account_name);
+
/* Functions that perform store operations */
/**
retval = 1;
goto cleanup;
}
- /* Remove new mail notifications if exist */
- modest_platform_remove_new_mail_notifications (FALSE);
}
gtk_main ();
BOOL:ENUM,BOOL
BOOL:ENUM
VOID:OBJECT,OBJECT
+BOOL:OBJECT,OBJECT
/**
* modest_platform_remove_new_mail_notifications:
* @only_visuals: remove only the visual notifications (like LEDs)
+ * @acc_name: account to remove notifications
*
* Removes all the active new mail notifications
**/
-void modest_platform_remove_new_mail_notifications (gboolean only_visuals);
+void modest_platform_remove_new_mail_notifications (gboolean only_visuals, const gchar *acc_name);
/* ModestConnectedPerformer:
* @canceled: whether or not the user canceled
#include <regex.h>
#include <modest-tny-platform-factory.h>
#include <modest-text-utils.h>
+#include <modest-account-mgr-helpers.h>
#include <modest-runtime.h>
#include <ctype.h>
const gchar *from,
time_t sent_date)
{
- gchar *retval;
- gchar *tmp_sig;
-
+ gchar *retval, *tmp;
+
g_return_val_if_fail (text, NULL);
g_return_val_if_fail (content_type, NULL);
-
- if (!signature) {
- tmp_sig = g_strdup (text);
- } else {
- tmp_sig = g_strconcat (text, "\n", MODEST_TEXT_UTILS_SIGNATURE_MARKER, "\n", signature, NULL);
- }
if (strcmp (content_type, "text/html") == 0) {
- retval = modest_text_utils_convert_to_html_body (tmp_sig, -1, TRUE);
- g_free (tmp_sig);
+ tmp = modest_text_utils_convert_to_html_body (text, -1, TRUE);
+ if (signature) {
+ gchar *colored_signature = modest_text_utils_create_colored_signature (signature);
+ retval = g_strconcat (tmp, colored_signature, NULL);
+ g_free (colored_signature);
+ g_free (tmp);
+ } else {
+ retval = tmp;
+ }
} else {
- retval = tmp_sig;
+ if (signature)
+ retval = g_strconcat (text, "\n", MODEST_TEXT_UTILS_SIGNATURE_MARKER, "\n", signature, NULL);
+ else
+ retval = g_strdup (text);
}
return retval;
gchar *tmp, *subject_dup, *retval, *prefix;
const gchar *untranslated_prefix;
gint prefix_len, untranslated_prefix_len;
- gboolean translated_found = FALSE;
- gboolean first_time;
+ gboolean found = FALSE;
if (!subject || subject[0] == '\0')
subject = _("mail_va_no_subject");
untranslated_prefix = (is_reply) ? "Re:" : "Fw:";
untranslated_prefix_len = 3;
- /* We do not want things like "Re: Re: Re:" or "Fw: Fw:" so
- delete the previous ones */
- first_time = TRUE;
- do {
- if (g_str_has_prefix (tmp, prefix)) {
- tmp += prefix_len;
- tmp = g_strchug (tmp);
- /* Do not consider translated prefixes in the
- middle of a Re:Re:..Re: like sequence */
- if (G_UNLIKELY (first_time))
- translated_found = TRUE;
- } else if (g_str_has_prefix (tmp, untranslated_prefix)) {
- tmp += untranslated_prefix_len;
- tmp = g_strchug (tmp);
- } else {
- gchar *prefix_down, *tmp_down;
-
- /* We need this to properly check the cases of
- some clients adding FW: instead of Fw: for
- example */
- prefix_down = g_utf8_strdown (prefix, -1);
- tmp_down = g_utf8_strdown (tmp, -1);
- if (g_str_has_prefix (tmp_down, prefix_down)) {
- tmp += prefix_len;
- tmp = g_strchug (tmp);
- g_free (prefix_down);
- g_free (tmp_down);
- } else {
- g_free (prefix_down);
- g_free (tmp_down);
- break;
- }
- }
- first_time = FALSE;
- } while (tmp);
+ if (g_str_has_prefix (tmp, prefix) ||
+ g_str_has_prefix (tmp, untranslated_prefix)) {
+ found = TRUE;
+ } else {
+ gchar *prefix_down, *tmp_down, *untranslated_down;
- if (!g_strcmp0 (subject, tmp)) {
- /* normal case */
- retval = g_strdup_printf ("%s %s", untranslated_prefix, tmp);
+ prefix_down = g_utf8_strdown (prefix, -1);
+ untranslated_down = g_utf8_strdown (untranslated_prefix, -1);
+ tmp_down = g_utf8_strdown (tmp, -1);
+ if (g_str_has_prefix (tmp_down, prefix_down) ||
+ g_str_has_prefix (tmp_down, untranslated_down) ||
+ (!is_reply && g_str_has_prefix (tmp_down, "fwd:")))
+ found = TRUE;
+
+ g_free (prefix_down);
+ g_free (untranslated_down);
+ g_free (tmp_down);
+ }
+
+ if (found) {
+ /* If the prefix is already present do not touch the subject */
+ retval = subject_dup;
} else {
- if (translated_found) {
- /* Found a translated prefix, i.e, "VS:" in Finish */
- retval = g_strdup_printf ("%s %s", prefix, tmp);
- } else {
- retval = g_strdup_printf ("%s %s", untranslated_prefix, tmp);
- }
+ /* Normal case, add the prefix */
+ retval = g_strdup_printf ("%s %s", untranslated_prefix, tmp);
+ g_free (subject_dup);
}
- g_free (subject_dup);
g_free (prefix);
return retval;
{
GString *result_string;
- result_string =
+ result_string =
g_string_new ( \
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" \
"<html>\n" \
- "<body>\n<br/>\n");
+ "<body>\n");
if (text || cite || signature) {
GString *quoted_text;
g_string_append (result_string, "<pre>\n");
if (signature) {
- quote_html_add_to_gstring (result_string, MODEST_TEXT_UTILS_SIGNATURE_MARKER);
- quote_html_add_to_gstring (result_string, signature);
+ gchar *colored_signature = modest_text_utils_create_colored_signature (signature);
+ g_string_append_printf (result_string, "%s<br/>", colored_signature);
+ g_free (colored_signature);
}
quote_html_add_to_gstring (result_string, cite);
quoted_text = g_string_new ("");
return retval;
}
+
+gchar *
+modest_text_utils_create_colored_signature (const gchar *signature)
+{
+ gchar *gray_color_markup = NULL, *retval;
+ GdkColor color;
+ GtkWidget *widget;
+
+ /* Get color from widgets */
+ widget = (GtkWidget *) modest_window_mgr_get_current_top (modest_runtime_get_window_mgr ());
+ if (widget && gtk_style_lookup_color (gtk_widget_get_style (widget), "SecondaryTextColor", &color))
+ gray_color_markup = modest_text_utils_get_color_string (&color);
+
+ retval = g_strdup_printf ("<br/>\n<font color=\"%s\">%s<br/>\n%s<br/>\n</font>",
+ (gray_color_markup) ? gray_color_markup : "#babababababa",
+ MODEST_TEXT_UTILS_SIGNATURE_MARKER,
+ signature);
+
+ if (gray_color_markup)
+ g_free (gray_color_markup);
+
+ return retval;
+}
gboolean modest_text_utils_no_recipient (GtkTextBuffer *buffer);
+gchar * modest_text_utils_create_colored_signature (const gchar *signature);
+
#endif /* __MODEST_TEXT_UTILS_H__ */
static void _bodies_filter (TnyMsg *msg, TnyList *list)
{
- TnyMimePart *html_part, *text_part;
+ TnyMimePart *html_part, *text_part, *calendar_part;
html_part = modest_tny_msg_find_body_part (msg, TRUE);
text_part = modest_tny_msg_find_body_part (msg, FALSE);
+ calendar_part = modest_tny_msg_find_calendar (msg);
if (text_part && TNY_IS_MIME_PART (text_part) && html_part == text_part) {
g_object_unref (text_part);
tny_list_prepend (list, G_OBJECT (text_part));
g_object_unref (text_part);
}
+
+ if (calendar_part && TNY_IS_MIME_PART (calendar_part)) {
+ tny_list_prepend (list, G_OBJECT (calendar_part));
+ g_object_unref (calendar_part);
+ }
}
down_content_type = g_ascii_strdown (content_type, -1);
if ((g_str_has_prefix (down_content_type, "message/rfc822") ||
g_str_has_prefix (down_content_type, "multipart/") ||
- g_str_has_prefix (down_content_type, "text/"))) {
+ g_str_has_prefix (down_content_type, "text/plain") ||
+ g_str_has_prefix (down_content_type, "text/html"))) {
g_free (down_content_type);
return TRUE;
} else {
/* Create the stream */
html_body_stream = TNY_STREAM (tny_camel_mem_stream_new_with_buffer
- (body, strlen(body)));
+ (body, (body) ? strlen(body) : 0));
/* Create body part if needed */
html_body_part = modest_formatter_create_body_part (NULL, msg);
* part */
}
+static TnyMimePart*
+modest_tny_msg_find_calendar_from_mime_part (TnyMimePart *msg)
+{
+ TnyMimePart *part = NULL;
+ TnyList *parts = NULL;
+ TnyIterator *iter = NULL;
+ gchar *header_content_type;
+ gchar *header_content_type_lower = NULL;
+
+ if (!msg)
+ return NULL;
+
+ /* If it's an application multipart, then we don't get into as we don't
+ * support them (for example application/sml or wap messages */
+ header_content_type = modest_tny_mime_part_get_header_value (msg, "Content-Type");
+ if (header_content_type) {
+ header_content_type = g_strstrip (header_content_type);
+ header_content_type_lower = g_ascii_strdown (header_content_type, -1);
+ }
+ if (header_content_type_lower &&
+ g_str_has_prefix (header_content_type_lower, "multipart/") &&
+ !g_str_has_prefix (header_content_type_lower, "multipart/signed") &&
+ strstr (header_content_type_lower, "application/")) {
+ g_free (header_content_type_lower);
+ g_free (header_content_type);
+ return NULL;
+ }
+ g_free (header_content_type_lower);
+ g_free (header_content_type);
+
+ parts = TNY_LIST (tny_simple_list_new());
+ tny_mime_part_get_parts (TNY_MIME_PART (msg), parts);
+
+ iter = tny_list_create_iterator(parts);
+
+ /* no parts? assume it's single-part message */
+ if (tny_iterator_is_done(iter)) {
+ gchar *content_type;
+ gboolean is_calendar_part;
+ g_object_unref (G_OBJECT(iter));
+ content_type = modest_tny_mime_part_get_content_type (msg);
+ if (content_type == NULL)
+ return NULL;
+ is_calendar_part =
+ g_str_has_prefix (content_type, "text/calendar");
+ g_free (content_type);
+ /* if this part cannot be a supported body return NULL */
+ if (!is_calendar_part) {
+ return NULL;
+ } else {
+ return TNY_MIME_PART (g_object_ref(G_OBJECT(msg)));
+ }
+ } else {
+ do {
+ gchar *tmp, *content_type = NULL;
+ gboolean has_content_disp_name = FALSE;
+
+ part = TNY_MIME_PART(tny_iterator_get_current (iter));
+
+ if (!part) {
+ g_warning ("%s: not a valid mime part", __FUNCTION__);
+ tny_iterator_next (iter);
+ continue;
+ }
+
+ /* it's a message --> ignore */
+ if (part && TNY_IS_MSG (part)) {
+ g_object_unref (part);
+ part = NULL;
+ tny_iterator_next (iter);
+ continue;
+ }
+
+ /* we need to strdown the content type, because
+ * tny_mime_part_has_content_type does not do it...
+ */
+ content_type = g_ascii_strdown (tny_mime_part_get_content_type (part), -1);
+
+ /* mime-parts with a content-disposition header (either 'inline' or 'attachment')
+ * and a 'name=' thingy cannot be body parts
+ */
+
+ tmp = modest_tny_mime_part_get_header_value (part, "Content-Disposition");
+ if (tmp) {
+ gchar *content_disp = g_ascii_strdown(tmp, -1);
+ g_free (tmp);
+ has_content_disp_name = g_strstr_len (content_disp, strlen(content_disp), "name=") != NULL;
+ g_free (content_disp);
+ }
+
+ if (g_str_has_prefix (content_type, "text/calendar") &&
+ !has_content_disp_name &&
+ !modest_tny_mime_part_is_attachment_for_modest (part)) {
+ /* we found the body. Doesn't have to be the desired mime part, first
+ text/ part in a mixed is the body */
+ g_free (content_type);
+ break;
+
+ } else if (g_str_has_prefix(content_type, "multipart")) {
+
+ /* multipart? recurse! */
+ g_object_unref (part);
+ g_free (content_type);
+ part = modest_tny_msg_find_calendar_from_mime_part (part);
+ if (part)
+ break;
+ } else
+ g_free (content_type);
+
+ if (part) {
+ g_object_unref (G_OBJECT(part));
+ part = NULL;
+ }
+
+ tny_iterator_next (iter);
+
+ } while (!tny_iterator_is_done(iter));
+ }
+
+ g_object_unref (G_OBJECT(iter));
+ g_object_unref (G_OBJECT(parts));
+
+ return part; /* this maybe NULL, this is not an error; some message just don't have a body
+ * part */
+}
+
TnyMimePart*
modest_tny_msg_find_body_part (TnyMsg *msg, gboolean want_html)
want_html);
}
+TnyMimePart*
+modest_tny_msg_find_calendar (TnyMsg *msg)
+{
+ g_return_val_if_fail (msg && TNY_IS_MSG(msg), NULL);
+
+ return modest_tny_msg_find_calendar_from_mime_part (TNY_MIME_PART(msg));
+}
+
#define MODEST_TNY_MSG_PARENT_UID "parent-uid"
return new_msg;
}
+TnyMsg*
+modest_tny_msg_create_reply_calendar_msg (TnyMsg *msg,
+ TnyHeader *header,
+ const gchar *from,
+ const gchar *signature,
+ TnyList *headers)
+{
+ TnyMsg *new_msg = NULL;
+ TnyIterator *iterator;
+
+ g_return_val_if_fail (msg && TNY_IS_MSG(msg), NULL);
+
+ new_msg = modest_tny_msg_create_reply_msg (msg, header, from, signature,
+ MODEST_TNY_MSG_REPLY_TYPE_QUOTE, MODEST_TNY_MSG_REPLY_MODE_SENDER);
+
+ iterator = tny_list_create_iterator (headers);
+ while (!tny_iterator_is_done (iterator)) {
+ TnyPair *pair = TNY_PAIR (tny_iterator_get_current (iterator));
+
+ tny_mime_part_set_header_pair (TNY_MIME_PART (new_msg),
+ tny_pair_get_name (pair),
+ tny_pair_get_value (pair));
+ g_object_unref (pair);
+ tny_iterator_next (iterator);
+ }
+ g_object_unref (iterator);
+
+ return new_msg;
+}
+
static gboolean
is_ascii(const gchar *s)
*/
TnyMimePart* modest_tny_msg_find_body_part (TnyMsg * self, gboolean want_html);
+/**
+ * modest_tny_msg_find_calendar_part:
+ * @self: a message
+ *
+ * search a message for the calendar part.
+ *
+ * Returns: the TnyMimePart for the found part, or NULL if no matching part is found
+ */
+TnyMimePart* modest_tny_msg_find_calendar (TnyMsg *self);
+
/**
* modest_tny_msg_find_body:
ModestTnyMsgForwardType forward_type);
/**
+ * modest_tny_msg_create_reply_calendar_msg:
+ * @msg: a valid #TnyMsg instance, or %NULL
+ * @header: a valid #TnyHeader instance, or %NULL
+ * @from: the sender of the forwarded mail
+ * @signature: signature to add to the reply message
+ * @headers: #TnyList of #TnyPair with the headers to add
+ *
+ * Creates a new message to reply to a calendar event
+ *
+ * Returns: Returns: a new #TnyMsg, or NULL in case of error
+ **/
+TnyMsg* modest_tny_msg_create_reply_calendar_msg (TnyMsg *msg,
+ TnyHeader *header,
+ const gchar *from,
+ const gchar *signature,
+ TnyList *headers);
+
+/**
* modest_tny_msg_create_reply_msg:
* @msg: a valid #TnyMsg instance, or %NULL
* @header: a valid #TnyHeader instance, or %NULL
TnyMsg *msg = NULL;
TnyAccount *account = NULL;
TnyFolder *folder = NULL;
- gchar *from_str = NULL, *signature = NULL, *body = NULL;
- gchar *recipient = NULL;
+ gchar *from_str = NULL, *signature = NULL, *body = NULL, *recipient = NULL, *tmp = NULL;
gboolean use_signature = FALSE;
ModestWindow *msg_win = NULL;
ModestAccountMgr *mgr = modest_runtime_get_account_mgr();
goto cleanup;
}
+
recipient = modest_text_utils_get_email_address (from_str);
- signature = modest_account_mgr_get_signature_from_recipient (mgr, recipient, &use_signature);
+ tmp = modest_account_mgr_get_signature_from_recipient (modest_runtime_get_account_mgr (),
+ recipient,
+ &use_signature);
+ signature = modest_text_utils_create_colored_signature (tmp);
+ g_free (tmp);
g_free (recipient);
- if (body_str != NULL) {
- body = use_signature ? g_strconcat(body_str, "\n",
- MODEST_TEXT_UTILS_SIGNATURE_MARKER,
- "\n", signature, NULL) : g_strdup(body_str);
- } else {
-
- gchar *gray_color_markup = NULL, *color_begin = NULL, *color_end = NULL;
- GdkColor color;
-
- if (win && gtk_style_lookup_color (gtk_widget_get_style ((GtkWidget *) win),
- "SecondaryTextColor", &color))
- gray_color_markup = modest_text_utils_get_color_string (&color);
- if (!gray_color_markup)
- gray_color_markup = g_strdup ("#babababababa");
- color_begin = g_strdup_printf ("<font color=\"%s\">", gray_color_markup);
- color_end = "</font>";
-
- body = use_signature ? g_strconcat("<br/>\n", color_begin,
- MODEST_TEXT_UTILS_SIGNATURE_MARKER, "<br/>\n",
- signature, color_end, NULL) : g_strdup("");
-
- g_free (gray_color_markup);
- g_free (color_begin);
- }
+ body = use_signature ? g_strconcat ((body_str) ? body_str : "", signature, NULL) :
+ g_strdup(body_str);
msg = modest_tny_msg_new_html_plain (to_str, from_str, cc_str, bcc_str, subject_str,
NULL, NULL, body, NULL, NULL, NULL, NULL, NULL);
gchar *from = NULL;
TnyAccount *account = NULL;
ModestWindowMgr *mgr = NULL;
- gchar *signature = NULL;
+ gchar *signature = NULL, *recipient = NULL;
gboolean use_signature;
- gchar *recipient;
/* If there was any error. The mail operation could be NULL,
this means that we already have the message downloaded and
from = modest_account_mgr_get_from_string (modest_runtime_get_account_mgr(),
rf_helper->account_name, rf_helper->mailbox);
+
recipient = modest_text_utils_get_email_address (from);
- signature = modest_account_mgr_get_signature_from_recipient (modest_runtime_get_account_mgr(),
- recipient,
+ signature = modest_account_mgr_get_signature_from_recipient (modest_runtime_get_account_mgr (),
+ recipient,
&use_signature);
g_free (recipient);
}
void
+modest_ui_actions_reply_calendar (ModestWindow *win, TnyMsg *msg, TnyList *header_pairs)
+{
+ gchar *from;
+ gchar *recipient;
+ gchar *signature;
+ gboolean use_signature;
+ TnyMsg *new_msg;
+ GtkWidget *msg_win;
+ gdouble parent_zoom;
+ const gchar *account_name;
+ const gchar *mailbox;
+ TnyHeader *msg_header;
+ ModestWindowMgr *mgr;
+
+ g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW(win));
+
+ /* we check for low-mem; in that case, show a warning, and don't allow
+ * reply/forward (because it could potentially require a lot of memory */
+ if (modest_platform_check_memory_low (MODEST_WINDOW(win), TRUE))
+ return;
+
+ account_name = modest_window_get_active_account (MODEST_WINDOW (win));
+ mailbox = modest_window_get_active_mailbox (MODEST_WINDOW (win));
+ from = modest_account_mgr_get_from_string (modest_runtime_get_account_mgr(),
+ account_name, mailbox);
+ recipient = modest_text_utils_get_email_address (from);
+ signature = modest_account_mgr_get_signature_from_recipient (modest_runtime_get_account_mgr(),
+ recipient,
+ &use_signature);
+ g_free (recipient);
+
+ msg_header = tny_msg_get_header (msg);
+ new_msg =
+ modest_tny_msg_create_reply_calendar_msg (msg, msg_header, from,
+ (use_signature) ? signature : NULL,
+ header_pairs);
+ g_object_unref (msg_header);
+
+ g_free (from);
+ g_free (signature);
+
+ if (!new_msg) {
+ g_warning ("%s: failed to create message\n", __FUNCTION__);
+ goto cleanup;
+ }
+
+ msg_win = (GtkWidget *) modest_msg_edit_window_new (new_msg, account_name, mailbox, FALSE);
+ mgr = modest_runtime_get_window_mgr ();
+ modest_window_mgr_register_window (mgr, MODEST_WINDOW (msg_win), (ModestWindow *) win);
+
+ parent_zoom = modest_window_get_zoom (MODEST_WINDOW (win));
+ modest_window_set_zoom (MODEST_WINDOW (msg_win), parent_zoom);
+
+ /* Show edit window */
+ gtk_widget_show_all (GTK_WIDGET (msg_win));
+
+cleanup:
+ if (new_msg)
+ g_object_unref (G_OBJECT (new_msg));
+}
+
+void
modest_ui_actions_on_reply (GtkAction *action, ModestWindow *win)
{
g_return_if_fail (MODEST_IS_WINDOW(win));
distinguish if the notification belongs to
this account or not, so for safety reasons
we remove them all */
- modest_platform_remove_new_mail_notifications (FALSE);
+ modest_platform_remove_new_mail_notifications (FALSE, account_name);
} else {
g_warning ("%s: modest_account_mgr_remove_account() failed.\n", __FUNCTION__);
}
void modest_ui_actions_on_reply (GtkAction *action, ModestWindow *win);
+void modest_ui_actions_reply_calendar (ModestWindow *win, TnyMsg *msg, TnyList *header_pairs);
+
void modest_ui_actions_on_forward (GtkAction *action, ModestWindow *win);
void modest_ui_actions_on_sort (GtkAction *action, ModestWindow *window);
}
gboolean
+modest_ui_dimming_rules_on_editor_show_toolbar (ModestWindow *win, gpointer user_data)
+{
+ ModestDimmingRule *rule = NULL;
+ gboolean dimmed = FALSE;
+
+ g_return_val_if_fail (MODEST_IS_DIMMING_RULE (user_data), FALSE);
+ g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (win), TRUE);
+ rule = MODEST_DIMMING_RULE (user_data);
+
+ /* Check common dimming rules */
+ ModestMsgEditFormat format;
+ format = modest_msg_edit_window_get_format (MODEST_MSG_EDIT_WINDOW (win));
+
+ dimmed = (format != MODEST_MSG_EDIT_FORMAT_HTML);
+ if (dimmed)
+ modest_dimming_rule_set_notification (rule, _("mcen_ib_item_unavailable_plaintext"));
+
+ return dimmed;
+}
+
+gboolean
modest_ui_dimming_rules_on_zoom (ModestWindow *win, gpointer user_data)
{
ModestDimmingRule *rule = NULL;
gboolean modest_ui_dimming_rules_on_add_to_contacts (ModestWindow *win, gpointer user_data);
gboolean modest_ui_dimming_rules_on_find_in_msg (ModestWindow *win, gpointer user_data);
gboolean modest_ui_dimming_rules_on_set_style (ModestWindow *win, gpointer user_data);
+gboolean modest_ui_dimming_rules_on_editor_show_toolbar (ModestWindow *win, gpointer user_data);
gboolean modest_ui_dimming_rules_on_zoom (ModestWindow *win, gpointer user_data);
gboolean modest_ui_dimming_rules_on_send (ModestWindow *win, gpointer user_data);
gboolean modest_ui_dimming_rules_on_editor_remove_attachment (ModestWindow *win, gpointer user_data);
#include <tny-camel-account.h>
#include <tny-status.h>
#include <tny-camel-send-queue.h>
-#include <tny-camel-transport-account.h>
-#include <tny-camel-imap-store-account.h>
-#include <tny-camel-pop-store-account.h>
#include <locale.h>
#include <modest-defs.h>
#include "modest-utils.h"
} else {
new_window = GTK_WIDGET (modest_folder_window_new (NULL));
+ modest_window_set_active_account (MODEST_WINDOW (new_window), account_name);
}
registered = modest_window_mgr_register_window (modest_runtime_get_window_mgr (),
direct_attach = (!g_str_has_prefix (msg_content_type, "message/rfc822") &&
!g_str_has_prefix (msg_content_type, "multipart") &&
- !g_str_has_prefix (msg_content_type, "text/"));
+ !g_str_has_prefix (msg_content_type, "text/plain") &&
+ !g_str_has_prefix (msg_content_type, "text/html"));
g_free (msg_content_type);
if (g_str_has_prefix (content_type, "multipart/digest")) {
add_digest_attachments (attachments_view, part);
- } else if (body_found && g_str_has_prefix (content_type, "text/")) {
+ } else if (body_found &&
+ (g_str_has_prefix (content_type, "text/plain") ||
+ g_str_has_prefix (content_type, "text/html"))) {
modest_attachments_view_add_attachment (attachments_view, part, TRUE, 0);
} else if (g_str_has_prefix (content_type, "multipart/") ||
- g_str_has_prefix (content_type, "text/")) {
+ g_str_has_prefix (content_type, "text/plain") ||
+ g_str_has_prefix (content_type, "text/html")) {
body_found = TRUE;
}
}
/* apply special filters */
if (retval && (priv->filter & MODEST_FOLDER_VIEW_FILTER_HIDE_ACCOUNTS)) {
if (TNY_IS_ACCOUNT (instance))
- return FALSE;
+ retval = FALSE;
}
if (retval && (priv->filter & MODEST_FOLDER_VIEW_FILTER_HIDE_FOLDERS)) {
if (TNY_IS_FOLDER (instance))
- return FALSE;
+ retval = FALSE;
}
if (retval && (priv->filter & MODEST_FOLDER_VIEW_FILTER_HIDE_LOCAL_FOLDERS)) {
if (TNY_IS_ACCOUNT (instance)) {
if (modest_tny_account_is_virtual_local_folders (TNY_ACCOUNT (instance)))
- return FALSE;
+ retval = FALSE;
} else if (TNY_IS_FOLDER (instance)) {
if (modest_tny_folder_is_local_folder (TNY_FOLDER (instance)))
- return FALSE;
+ retval = FALSE;
}
}
if (retval && (priv->filter & MODEST_FOLDER_VIEW_FILTER_HIDE_MCC_FOLDERS)) {
if (TNY_IS_ACCOUNT (instance)) {
if (modest_tny_account_is_memory_card_account (TNY_ACCOUNT (instance)))
- return FALSE;
+ retval = FALSE;
} else if (TNY_IS_FOLDER (instance)) {
if (modest_tny_folder_is_memory_card_folder (TNY_FOLDER (instance)))
- return FALSE;
+ retval = FALSE;
}
}
/* A mailbox is a fake folder with an @ in the middle of the name */
if (!TNY_IS_FOLDER (instance) ||
!(tny_folder_get_caps (TNY_FOLDER (instance)) & TNY_FOLDER_CAPS_NOSELECT)) {
- return FALSE;
+ retval = FALSE;
} else {
const gchar *folder_name;
folder_name = tny_folder_get_name (TNY_FOLDER (instance));
if (!folder_name || strchr (folder_name, '@') == NULL)
- return FALSE;
+ retval = FALSE;
}
}
_("mcen_va_options_updateinterval_5min"),
&list);
add_to_modest_pair_list (MODEST_UPDATE_INTERVAL_10_MIN,
- _("mcen_va_options_updateinteval_10min"),
+ _("mcen_va_options_updateinterval_10min"),
&list);
add_to_modest_pair_list (MODEST_UPDATE_INTERVAL_15_MIN,
_("mcen_va_options_updateinterval_15min"),
static void request_fetch_images (ModestGtkhtmlMsgView *view);
static void set_branding (ModestGtkhtmlMsgView *view, const gchar *brand_name, const GdkPixbuf *brand_icon);
static gboolean has_blocked_external_images (ModestGtkhtmlMsgView *view);
+static void set_calendar (ModestGtkhtmlMsgView *self, TnyHeader *header, TnyMsg *msg);
/* list properties */
enum {
GtkWidget *priority_box;
GtkWidget *priority_icon;
#endif
+ GtkWidget *calendar_box;
+ GtkWidget *calendar_icon;
+ GtkWidget *calendar_actions_box;
+ GtkWidget *calendar_actions_container;
/* internal adjustments for set_scroll_adjustments */
GtkAdjustment *hadj;
gtk_widget_hide_all (priv->priority_box);
}
#endif
+ priv->calendar_actions_box = NULL;
+ priv->calendar_icon = gtk_image_new ();
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->calendar_icon), MODEST_HEADER_ICON_CALENDAR, GTK_ICON_SIZE_MENU);
+ gtk_misc_set_alignment (GTK_MISC (priv->calendar_icon), 0.0, 0.5);
+ if (priv->calendar_icon) {
+ priv->calendar_box = (GtkWidget *)
+ modest_mail_header_view_add_custom_header (MODEST_MAIL_HEADER_VIEW (priv->mail_header_view),
+ _("mail_fi_invitation"),
+ priv->calendar_icon,
+ FALSE, FALSE);
+
+ gtk_widget_hide_all (priv->calendar_box);
+ }
+
if (priv->attachments_view) {
#ifndef MODEST_TOOLKIT_HILDON2
gchar *att_label = g_strconcat (_("mcen_me_viewer_attachments"), ":", NULL);
g_free (att_label);
}
+ priv->calendar_actions_container = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->headers_box), priv->calendar_actions_container, FALSE, FALSE, 0);
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
+ gtk_widget_set_no_show_all (priv->calendar_actions_container, TRUE);
+
#ifndef MODEST_TOOLKIT_HILDON2
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX(priv->headers_box), separator, FALSE, FALSE, 0);
#ifdef MODEST_TOOKIT_HILDON2
gtk_widget_hide_all (priv->priority_box);
#endif
+ gtk_widget_hide_all (priv->calendar_box);
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
tny_mime_part_view_clear (TNY_MIME_PART_VIEW (priv->body_view));
/* Refresh priority */
set_priority (self, tny_header_get_flags (header));
+ set_calendar (self, header, msg);
gtk_widget_show (priv->body_view);
#ifdef MODEST_TOOLKIT_HILDON2
gtk_widget_set_no_show_all (priv->priority_box, TRUE);
#endif
+ gtk_widget_set_no_show_all (priv->calendar_box, TRUE);
+ gtk_widget_set_no_show_all (priv->calendar_actions_container, TRUE);
gtk_widget_set_no_show_all (priv->attachments_box, TRUE);
gtk_widget_show_all (priv->mail_header_view);
gtk_widget_set_no_show_all (priv->attachments_box, FALSE);
#ifdef MODEST_TOOLKIT_HILDON2
gtk_widget_set_no_show_all (priv->priority_box, FALSE);
#endif
+ gtk_widget_set_no_show_all (priv->calendar_box, FALSE);
+ gtk_widget_set_no_show_all (priv->calendar_actions_container, FALSE);
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
html_vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->html_scroll));
#ifdef MODEST_TOOLKIT_HILDON2
gtk_widget_hide_all (priv->priority_box);
#endif
+ gtk_widget_hide_all (priv->calendar_box);
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
gtk_widget_set_no_show_all (priv->mail_header_view, TRUE);
tny_mime_part_view_clear (TNY_MIME_PART_VIEW (priv->body_view));
priv->idle_changes_count = 0;
{
return has_blocked_external_images (MODEST_GTKHTML_MSG_VIEW (self));
}
+
+static void
+set_calendar (ModestGtkhtmlMsgView *self, TnyHeader *header, TnyMsg *msg)
+{
+ ModestGtkhtmlMsgViewPrivate *priv;
+ TnyMimePart *calendar_part;
+
+ g_return_if_fail (MODEST_IS_GTKHTML_MSG_VIEW (self));
+ priv = MODEST_GTKHTML_MSG_VIEW_GET_PRIVATE (self);
+
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
+ if (priv->calendar_actions_box) {
+ gtk_widget_destroy (priv->calendar_actions_box);
+ priv->calendar_actions_box = NULL;
+ }
+
+ calendar_part = modest_tny_msg_find_calendar (TNY_MSG (msg));
+
+ if (calendar_part) {
+ gboolean retval = FALSE;
+ priv->calendar_actions_box = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->calendar_actions_container), priv->calendar_actions_box, FALSE, FALSE, 0);
+ g_signal_emit_by_name (G_OBJECT (self), "handle-calendar", calendar_part, priv->calendar_actions_box, &retval);
+ if (retval) {
+ gtk_widget_show (priv->calendar_actions_container);
+ gtk_widget_show_all (priv->calendar_actions_container);
+ gtk_widget_show (priv->calendar_actions_box);
+ gtk_widget_show_all (priv->calendar_actions_box);
+ } else {
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
+ gtk_widget_hide (priv->calendar_actions_box);
+ gtk_widget_hide_all (priv->calendar_actions_box);
+ }
+ gtk_widget_show_all (priv->calendar_box);
+ g_object_unref (calendar_part);
+ } else {
+ gtk_widget_hide_all (priv->calendar_box);
+ gtk_widget_hide (priv->calendar_actions_container);
+ gtk_widget_hide_all (priv->calendar_actions_container);
+ gtk_widget_hide (priv->calendar_actions_box);
+ }
+
+
+}
}
static GdkPixbuf*
-get_pixbuf_for_flag (TnyHeaderFlags flag)
+get_pixbuf_for_flag (TnyHeaderFlags flag, gboolean is_calendar)
{
/* optimization */
static GdkPixbuf *deleted_pixbuf = NULL;
static GdkPixbuf *attachments_pixbuf = NULL;
static GdkPixbuf *high_pixbuf = NULL;
static GdkPixbuf *low_pixbuf = NULL;
+ static GdkPixbuf *calendar_pixbuf = NULL;
+
+ if (is_calendar) {
+ if (G_UNLIKELY(!calendar_pixbuf))
+ calendar_pixbuf = modest_platform_get_icon (MODEST_HEADER_ICON_CALENDAR,
+ SMALL_ICON_SIZE);
+ return calendar_pixbuf;
+ }
switch (flag) {
case TNY_HEADER_FLAG_DELETED:
if (flags & TNY_HEADER_FLAG_ATTACHMENTS)
g_object_set (G_OBJECT (renderer), "pixbuf",
- get_pixbuf_for_flag (TNY_HEADER_FLAG_ATTACHMENTS),
+ get_pixbuf_for_flag (TNY_HEADER_FLAG_ATTACHMENTS, FALSE),
NULL);
}
*recipient_box, *subject_box = NULL;
TnyHeader *msg_header = NULL;
TnyHeaderFlags prio = 0;
+ gboolean is_calendar = FALSE;
#ifdef MAEMO_CHANGES
#ifdef HAVE_GTK_TREE_VIEW_COLUMN_GET_CELL_DATA_HINT
/* FIXME: we might gain something by doing all the g_object_set's at once */
if (flags & TNY_HEADER_FLAG_ATTACHMENTS)
g_object_set (G_OBJECT (attach_cell), "pixbuf",
- get_pixbuf_for_flag (TNY_HEADER_FLAG_ATTACHMENTS),
+ get_pixbuf_for_flag (TNY_HEADER_FLAG_ATTACHMENTS, FALSE),
NULL);
else
g_object_set (G_OBJECT (attach_cell), "pixbuf",
NULL, NULL);
- if (msg_header)
+ is_calendar = tny_header_get_user_flag (msg_header, "calendar");
+ if (msg_header) {
prio = tny_header_get_priority (msg_header);
+ }
+
g_object_set (G_OBJECT (priority_cell), "pixbuf",
- get_pixbuf_for_flag (prio),
+ get_pixbuf_for_flag (prio, is_calendar),
NULL);
set_cell_text (subject_cell, (subject && subject[0] != 0)?subject:_("mail_va_no_subject"),
GtkTextIter *iter,
GtkTextMark *mark,
ModestMsgEditWindow *userdata);
+static void on_show_toolbar_button_toggled (GtkWidget *button,
+ ModestMsgEditWindow *window);
static void on_message_settings (GtkAction *action,
ModestMsgEditWindow *window);
static void setup_menu (ModestMsgEditWindow *self);
GtkWidget *app_menu;
GtkWidget *cc_button;
GtkWidget *bcc_button;
+ GtkWidget *show_toolbar_button;
GtkWidget *max_chars_banner;
case MODEST_MSG_EDIT_FORMAT_HTML:
wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), TRUE);
update_signature (self, priv->last_from_account, priv->last_from_account);
- if (parent_priv->toolbar) gtk_widget_show (parent_priv->toolbar);
+ if (parent_priv->toolbar)
+ on_show_toolbar_button_toggled (priv->show_toolbar_button,
+ MODEST_MSG_EDIT_WINDOW (self));
break;
case MODEST_MSG_EDIT_FORMAT_TEXT:
wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), FALSE);
- if (parent_priv->toolbar) gtk_widget_hide (parent_priv->toolbar);
+ if (parent_priv->toolbar)
+ on_show_toolbar_button_toggled (priv->show_toolbar_button,
+ MODEST_MSG_EDIT_WINDOW (self));
break;
default:
g_return_if_reached ();
} else {
gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
}
+ modest_conf_set_bool(modest_runtime_get_conf(), MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR, show_toolbar, NULL);
+ if (modest_togglable_get_active (priv->show_toolbar_button) != show_toolbar) {
+ modest_togglable_set_active (priv->show_toolbar_button, show_toolbar);
+ }
}
void
remove_tags (WP_TEXT_BUFFER (priv->text_buffer));
update_signature (window, priv->last_from_account, priv->last_from_account);
if (parent_priv->toolbar)
- gtk_widget_show (parent_priv->toolbar);
+ on_show_toolbar_button_toggled (priv->show_toolbar_button,
+ MODEST_MSG_EDIT_WINDOW (window));
break;
case MODEST_FILE_FORMAT_PLAIN_TEXT:
{
if (response == GTK_RESPONSE_OK) {
wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), FALSE);
if (parent_priv->toolbar)
- gtk_widget_hide (parent_priv->toolbar);
+ on_show_toolbar_button_toggled (priv->show_toolbar_button,
+ MODEST_MSG_EDIT_WINDOW (window));
} else {
GtkToggleAction *action = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/FileFormatFormattedTextMenu"));
modest_utils_toggle_action_set_active_block_notify (action, TRUE);
is_rich_text = wp_text_buffer_is_rich_text (WP_TEXT_BUFFER (priv->text_buffer));
if (parent_priv->toolbar && was_rich_text != is_rich_text) {
- if (is_rich_text)
- gtk_widget_show (parent_priv->toolbar);
- else
- gtk_widget_hide (parent_priv->toolbar);
+ on_show_toolbar_button_toggled (priv->show_toolbar_button,
+ MODEST_MSG_EDIT_WINDOW (window));
}
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window));
}
static void
+on_show_toolbar_button_toggled (GtkWidget *button,
+ ModestMsgEditWindow *window)
+{
+ g_return_if_fail (MODEST_MSG_EDIT_WINDOW (window));
+
+ modest_msg_edit_window_show_toolbar (MODEST_WINDOW (window),
+ modest_togglable_get_active (button));
+}
+
+static void
on_cc_button_toggled (GtkWidget *button,
ModestMsgEditWindow *window)
{
modest_window_add_to_menu (MODEST_WINDOW (self), _("mcen_me_viewer_find"), "<Ctrl>f",
MODEST_WINDOW_MENU_CALLBACK (modest_ui_actions_on_toggle_find_in_page),
NULL);
+
+ priv->show_toolbar_button = modest_toolkit_factory_create_check_menu (modest_runtime_get_toolkit_factory (),
+ _("mcen_bd_show_toolbar"));
+ modest_togglable_set_active (priv->show_toolbar_button,
+ FALSE);
+ modest_window_add_item_to_menu (MODEST_WINDOW (self), priv->show_toolbar_button,
+ MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_editor_show_toolbar));
+ gtk_widget_show (priv->show_toolbar_button);
+ g_signal_connect (G_OBJECT (priv->show_toolbar_button), "toggled",
+ G_CALLBACK (on_show_toolbar_button_toggled), (gpointer) self);
+
}
static void
#ifdef MODEST_TOOLKIT_HILDON2
#include <hildon/hildon.h>
+#include <gdk/gdkx.h>
+#include <X11/Xatom.h>
+#include <X11/XKBlib.h>
+#include <X11/Xdmcp.h>
#endif
+
#include <tny-camel-bs-mime-part.h>
#include <tny-camel-bs-msg.h>
gpointer userdata);
static void update_branding (ModestMsgViewWindow *self);
static void sync_flags (ModestMsgViewWindow *self);
+static gboolean on_handle_calendar (ModestMsgView *msgview, TnyMimePart *calendar_part,
+ GtkContainer *container, ModestMsgViewWindow *self);
+
+static gboolean on_realize (GtkWidget *widget,
+ gpointer userdata);
/* list my signals */
enum {
priv->remove_attachment_banner = NULL;
priv->msg_uid = NULL;
priv->other_body = NULL;
-
+
priv->sighandlers = NULL;
-
+
/* Init window */
init_window (MODEST_MSG_VIEW_WINDOW(obj));
+#ifdef MODEST_TOOLKIT_HILDON2
+ /* Grab the zoom keys, it will be used for Zoom and not for
+ changing volume */
+ g_signal_connect (G_OBJECT (obj), "realize",
+ G_CALLBACK (on_realize),
+ NULL);
+#endif
}
static void
G_CALLBACK (modest_ui_actions_on_msg_link_contextual), obj);
g_signal_connect (G_OBJECT(priv->msg_view), "limit_error",
G_CALLBACK (modest_ui_actions_on_limit_error), obj);
+ g_signal_connect (G_OBJECT(priv->msg_view), "handle_calendar",
+ G_CALLBACK (on_handle_calendar), obj);
g_signal_connect (G_OBJECT (priv->msg_view), "fetch_image",
G_CALLBACK (on_fetch_image), obj);
} else {
modest_platform_system_banner (NULL, NULL, _("mail_ib_file_operation_failed"));
}
+ set_progress_hint (info->window, FALSE);
save_mime_part_info_free (info, FALSE);
gdk_threads_leave (); /* CHECKED */
if (written < 0) {
g_warning ("modest: could not save attachment %s: %d (%s)\n", pair->filename, error?error->code:-1, error?error->message:"Unknown error");
- if ((error->domain == TNY_ERROR_DOMAIN) &&
+ if (error && (error->domain == TNY_ERROR_DOMAIN) &&
(error->code == TNY_IO_ERROR_WRITE) &&
(errno == ENOSPC)) {
info->result = GNOME_VFS_ERROR_NO_SPACE;
if (!is_ok) {
save_mime_part_info_free (info, TRUE);
} else {
+ /* Start progress and launch thread */
+ set_progress_hint (info->window, TRUE);
g_thread_create ((GThreadFunc)save_mime_part_to_file, info, FALSE, NULL);
}
g_object_unref (header);
}
}
+
+#ifdef MODEST_TOOLKIT_HILDON2
+static gboolean
+on_realize (GtkWidget *widget,
+ gpointer userdata)
+{
+ GdkDisplay *display;
+ Atom atom;
+ unsigned long val = 1;
+
+ display = gdk_drawable_get_display (widget->window);
+ atom = gdk_x11_get_xatom_by_name_for_display (display, "_HILDON_ZOOM_KEY_ATOM");
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (widget->window), atom,
+ XA_INTEGER, 32, PropModeReplace,
+ (unsigned char *) &val, 1);
+
+ return FALSE;
+}
+#endif
+
+static gboolean
+on_handle_calendar (ModestMsgView *msgview, TnyMimePart *calendar_part, GtkContainer *container, ModestMsgViewWindow *self)
+{
+ const gchar *account_name;
+ ModestProtocolType proto_type;
+ ModestProtocol *protocol;
+ gboolean retval = FALSE;
+
+ account_name = modest_window_get_active_account (MODEST_WINDOW (self));
+
+ /* Get proto */
+ proto_type = modest_account_mgr_get_store_protocol (modest_runtime_get_account_mgr (),
+ account_name);
+ protocol =
+ modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (),
+ proto_type);
+
+ if (MODEST_IS_ACCOUNT_PROTOCOL (protocol)) {
+ retval = modest_account_protocol_handle_calendar (MODEST_ACCOUNT_PROTOCOL (protocol), MODEST_WINDOW (self),
+ calendar_part, container);
+ }
+ return retval;
+}
FETCH_IMAGE_SIGNAL,
SHOW_DETAILS_SIGNAL,
LIMIT_ERROR_SIGNAL,
+ HANDLE_CALENDAR_SIGNAL,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = {0};
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ signals[HANDLE_CALENDAR_SIGNAL] =
+ g_signal_new ("handle_calendar",
+ MODEST_TYPE_MSG_VIEW,
+ G_SIGNAL_ACTION | G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(ModestMsgViewIface, handle_calendar),
+ NULL, NULL,
+ modest_marshal_BOOLEAN__OBJECT_OBJECT,
+ G_TYPE_BOOLEAN, 2, G_TYPE_OBJECT, G_TYPE_OBJECT);
initialized = TRUE;
}
}
void (*request_fetch_images_func) (ModestMsgView *msgview);
gboolean (*has_blocked_external_images_func) (ModestMsgView *msgview);
void (*limit_error) (ModestMsgView *msgview);
+ gboolean (*handle_calendar) (ModestMsgView *msgview, TnyMimePart *calendar_part, GtkContainer *container);
};
continue;
do {
- const gchar *id;
+ gchar *id = NULL;
gtk_tree_model_get (priv->model, &iter,
- MODEL_COL_ID, id,
+ MODEL_COL_ID, &id,
-1);
if (g_strcmp0 (id, modest_protocol_get_name (proto)) == 0) {
gdouble zoom);
static gboolean on_key_pressed (GtkWidget *self, GdkEventKey *event, gpointer user_data);
-static void _make_zoom_buttons_grabeable (GtkWidget* widget);
-static gboolean _modest_window_map_event (GtkWidget *widget,
- GdkEvent *event,
- gpointer userdata);
+
static void modest_window_pack_toolbar_not_implemented (ModestWindow *self,
GtkPackType pack_type,
GtkWidget *toolbar);
-
-
/* list my signals */
enum {
LAST_SIGNAL
g_signal_connect (G_OBJECT (obj),
"key-press-event",
G_CALLBACK (on_key_pressed), NULL);
- g_signal_connect (G_OBJECT (obj), "map-event",
- G_CALLBACK (_modest_window_map_event),
- G_OBJECT (obj));
}
static void
}
break;
}
-
- return FALSE;
-}
-static gboolean
-_modest_window_map_event (GtkWidget *widget,
- GdkEvent *event,
- gpointer userdata)
-{
- _make_zoom_buttons_grabeable (GTK_WIDGET (widget));
return FALSE;
}
static void
-_make_zoom_buttons_grabeable (GtkWidget* widget)
-{
- GdkDisplay *display;
- Atom atom;
- unsigned long val = 1;
-
- display = gdk_drawable_get_display (widget->window);
- atom = gdk_x11_get_xatom_by_name_for_display (display, "_HILDON_ZOOM_KEY_ATOM");
- XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
- GDK_WINDOW_XID (widget->window), atom,
- XA_INTEGER, 32, PropModeReplace,
- (unsigned char *) &val, 1);
-}
-
-static void
modest_window_pack_toolbar_not_implemented (ModestWindow *self,
GtkPackType pack_type,
GtkWidget *toolbar)
MODEST_WINDOW_GET_CLASS (self)->pack_toolbar_func (self, pack_type, toolbar);
}
-
test_get_folders \
test_top_application \
test_update_account \
+ test_update_folder_counts \
test_open_account \
test_open_edit_accounts_dialog
test_update_account_SOURCES = test_update_account.c
test_update_account_LDADD = $(objects)
+test_update_folder_counts_SOURCES = test_update_folder_counts.c
+test_update_folder_counts_LDADD = $(objects)
+
test_open_account_SOURCES = test_open_account.c
test_open_account_LDADD = $(objects)
--- /dev/null
+#include <libmodest-dbus-client/libmodest-dbus-client.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+
+static gchar *account_id = NULL;
+
+static GOptionEntry option_entries [] =
+{
+ { "account", 'a', 0, G_OPTION_ARG_STRING, &account_id, "Account to perform update folder accounts into", NULL },
+ { NULL }
+};
+
+
+int
+main (int argc, char *argv[])
+{
+ osso_context_t *osso_context;
+ GOptionContext *context;
+ gboolean result;
+ GError *error = NULL;
+
+ context = g_option_context_new ("- Modest email client");
+ g_option_context_add_main_entries (context, option_entries, NULL);
+ if (!g_option_context_parse (context, &argc, &argv, &error)) {
+ g_print ("option parsing failed: %s\n", error->message);
+ g_option_context_free (context);
+ exit (1);
+ }
+ g_option_context_free (context);
+
+ osso_context = osso_initialize ("test_update_account",
+ "0.0.1",
+ TRUE,
+ NULL);
+
+ if (osso_context == NULL) {
+ g_printerr ("osso_initialize() failed.\n");
+ return -1;
+ }
+
+ if (account_id == NULL) {
+ g_printerr ("Provide an account id\n");
+ return -1;
+ }
+
+ result = libmodest_dbus_client_update_folder_counts (osso_context, account_id);
+ g_free (account_id);
+
+ return result;
+
+}