jdapena-ppa release 3.90.4modest0 using modest master release 3.90.5 jdapena-ppa-3.90.4-modest0
authorJosé Dapena Paz <jdapena@igalia.com>
Sun, 24 Jan 2010 11:30:35 +0000 (12:30 +0100)
committerJosé Dapena Paz <jdapena@igalia.com>
Sun, 24 Jan 2010 11:30:35 +0000 (12:30 +0100)
48 files changed:
debian/changelog
debian/control.maemo-fremantle
libmodest-dbus-client/configure.ac
libmodest-dbus-client/debian/changelog
libmodest-dbus-client/src/libmodest-dbus-api.h
libmodest-dbus-client/src/libmodest-dbus-client.c
libmodest-dbus-client/src/libmodest-dbus-client.h
src/dbus_api/modest-dbus-callbacks.c
src/gtk/modest-icon-names.h
src/gtk/modest-platform.c
src/gtk/modest-shell.c
src/hildon2/modest-hildon2-window-mgr.c
src/hildon2/modest-icon-names.h
src/hildon2/modest-platform.c
src/modest-account-mgr.h
src/modest-account-protocol.c
src/modest-account-protocol.h
src/modest-defs.h
src/modest-mail-operation.c
src/modest-mail-operation.h
src/modest-main.c
src/modest-marshal.list
src/modest-platform.h
src/modest-text-utils.c
src/modest-text-utils.h
src/modest-tny-account-store.c
src/modest-tny-mime-part.c
src/modest-tny-msg.c
src/modest-tny-msg.h
src/modest-ui-actions.c
src/modest-ui-actions.h
src/modest-ui-dimming-rules.c
src/modest-ui-dimming-rules.h
src/modest-utils.c
src/widgets/modest-accounts-window.c
src/widgets/modest-attachments-view.c
src/widgets/modest-folder-view.c
src/widgets/modest-global-settings-dialog.c
src/widgets/modest-gtkhtml-msg-view.c
src/widgets/modest-header-view-render.c
src/widgets/modest-msg-edit-window.c
src/widgets/modest-msg-view-window.c
src/widgets/modest-msg-view.c
src/widgets/modest-msg-view.h
src/widgets/modest-provider-combo-box.c
src/widgets/modest-window.c
tests/dbus_api/Makefile.am
tests/dbus_api/test_update_folder_counts.c [new file with mode: 0644]

index 228b56e..128c425 100644 (file)
@@ -1,3 +1,43 @@
+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
index 836f8a4..5eba975 100644 (file)
@@ -2,7 +2,7 @@ Source: modest
 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,
index e820261..a088195 100644 (file)
 # 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])
 
 
index a876179..57a18b6 100644 (file)
@@ -1,3 +1,9 @@
+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
index b06ac27..d4bda8c 100644 (file)
@@ -117,4 +117,11 @@ enum ModestDbusDeleteMessageArguments
  **/
 #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__ */
index 8b5f330..7775f56 100644 (file)
@@ -230,6 +230,29 @@ libmodest_dbus_client_send_and_receive_full (osso_context_t *osso_context,
 }
 
 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 };
index d196b17..33c7c56 100644 (file)
@@ -119,6 +119,18 @@ gboolean libmodest_dbus_client_send_and_receive_full (osso_context_t *osso_conte
                                                      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);
+
 
 
 /**
index 1f07719..8bff930 100644 (file)
@@ -983,8 +983,6 @@ on_idle_send_receive(gpointer user_data)
        return FALSE;
 }
 
-
-
 static gint 
 on_dbus_method_dump_send_queues (DBusConnection *con, DBusMessage *message)
 {
@@ -1255,6 +1253,41 @@ on_send_receive_full (GArray *arguments, gpointer data, osso_rpc_t * retval)
        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)
 {
@@ -1365,11 +1398,6 @@ on_idle_top_application (gpointer user_data)
 
                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 */
@@ -1549,6 +1577,10 @@ modest_dbus_req_handler(const gchar * interface, const gchar * method,
                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;
index 5864172..1851b38 100644 (file)
@@ -62,6 +62,7 @@
 #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"
 /*
  *
  */
index d950cb1..7af2d23 100644 (file)
@@ -1239,7 +1239,7 @@ modest_platform_on_new_headers_received (GList *URI_list,
 }
 
 void
-modest_platform_remove_new_mail_notifications (gboolean only_visuals) 
+modest_platform_remove_new_mail_notifications (gboolean only_visuals, const gchar *acc_name) 
 {
        return;
 }
index 77aa9a2..c506ec6 100644 (file)
@@ -169,12 +169,6 @@ modest_shell_instance_init (ModestShell *obj)
        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));
@@ -203,6 +197,12 @@ modest_shell_instance_init (ModestShell *obj)
        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);
index 66a6906..d6ef4f5 100644 (file)
@@ -432,6 +432,7 @@ modest_hildon2_window_mgr_register_window (ModestWindowMgr *self,
        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);
@@ -577,8 +578,23 @@ modest_hildon2_window_mgr_register_window (ModestWindowMgr *self,
        *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:
@@ -1017,7 +1033,7 @@ osso_display_event_cb (osso_display_state_t state,
 
        /* 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
index edc83d4..c9b7bd6 100644 (file)
@@ -46,6 +46,7 @@
 #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;
index 6b57a1d..c71c1d5 100644 (file)
@@ -1610,6 +1610,7 @@ modest_platform_on_new_headers_received (GList *URI_list,
        gchar *from;
        TnyAccountStore *acc_store;
        TnyAccount *account;
+       gchar *acc_name;
 
        data = (ModestMsgNotificationData *) URI_list->data;
 
@@ -1659,10 +1660,9 @@ modest_platform_on_new_headers_received (GList *URI_list,
        /* 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);
@@ -1673,9 +1673,11 @@ modest_platform_on_new_headers_received (GList *URI_list,
                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", &notif_id, NULL);
@@ -1686,19 +1688,22 @@ modest_platform_on_new_headers_received (GList *URI_list,
                   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
@@ -1718,9 +1723,10 @@ modest_platform_remove_new_mail_notifications (gboolean only_visuals)
        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;
@@ -1743,8 +1749,9 @@ modest_platform_remove_new_mail_notifications (gboolean only_visuals)
         }
 
        /* 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);
 
index 679c97d..859e390 100644 (file)
@@ -375,6 +375,15 @@ gboolean modest_account_mgr_singleton_protocol_exists (ModestAccountMgr *mgr,
 
 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__ */
index a995db2..850be4e 100644 (file)
@@ -133,6 +133,11 @@ static void modest_account_protocol_save_remote_draft_default (ModestAccountProt
                                                               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;
@@ -242,6 +247,8 @@ modest_account_protocol_class_init (ModestAccountProtocolClass *klass)
                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;
 
 }
 
@@ -903,3 +910,21 @@ modest_account_protocol_save_remote_draft_default (ModestAccountProtocol *self,
        }
 }
 
+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;
+}
index f773f61..16e8e44 100644 (file)
@@ -35,6 +35,7 @@
 
 #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>
@@ -114,8 +115,12 @@ struct _ModestAccountProtocolClass {
                                                 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);
@@ -545,6 +550,23 @@ gboolean modest_account_protocol_decode_part_to_stream_async (ModestAccountProto
                                                              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
 
index 4198225..988ba1a 100644 (file)
@@ -248,6 +248,7 @@ const gchar *modest_defs_namespace (const gchar *string);
 
 /* 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")
index 5f852e7..39b57af 100644 (file)
@@ -140,6 +140,7 @@ typedef struct
        TnyFolderObserver *inbox_observer;
        gboolean interactive;
        gboolean msg_readed;
+       gboolean update_folder_counts;
 } UpdateAccountInfo;
 
 static void destroy_update_account_info         (UpdateAccountInfo *info);
@@ -864,11 +865,11 @@ create_msg_thread (gpointer thread_data)
        }
 
        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)
@@ -949,7 +950,7 @@ modest_mail_operation_create_msg (ModestMailOperation *self,
        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;
@@ -1509,6 +1510,9 @@ update_account_send_mail (UpdateAccountInfo *info)
        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 */
@@ -1646,7 +1650,7 @@ inbox_refreshed_cb (TnyFolder *inbox,
        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;
@@ -1681,23 +1685,25 @@ inbox_refreshed_cb (TnyFolder *inbox,
                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 */
@@ -1912,7 +1918,7 @@ recurse_folders_async_cb (TnyFolderStore *folder_store,
 
                        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 {
@@ -2005,6 +2011,7 @@ modest_mail_operation_update_account (ModestMailOperation *self,
        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;
@@ -2034,6 +2041,86 @@ modest_mail_operation_update_account (ModestMailOperation *self,
        
 }
 
+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
index 407a914..2388479 100644 (file)
@@ -78,6 +78,7 @@ typedef enum {
        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;
 
@@ -473,6 +474,17 @@ void          modest_mail_operation_update_account (ModestMailOperation *self,
                                                    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 */
 
 /**
index ed753dd..19ceda6 100644 (file)
@@ -220,8 +220,6 @@ main (int argc, char *argv[])
                        retval = 1;
                        goto cleanup;
                }
-               /* Remove new mail notifications if exist */
-               modest_platform_remove_new_mail_notifications (FALSE);
        }
 
        gtk_main ();
index 94d596a..6c4d092 100644 (file)
@@ -14,3 +14,4 @@ BOOL:STRING,OBJECT
 BOOL:ENUM,BOOL
 BOOL:ENUM
 VOID:OBJECT,OBJECT
+BOOL:OBJECT,OBJECT
index 3489a0e..5ade99b 100644 (file)
@@ -404,10 +404,11 @@ gboolean modest_platform_run_alert_dialog (const gchar* prompt, gboolean is_ques
 /**
  * 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
index c37beeb..8306c60 100644 (file)
@@ -41,6 +41,7 @@
 #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>
 
@@ -207,23 +208,26 @@ modest_text_utils_cite (const gchar *text,
                        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;
@@ -302,8 +306,7 @@ modest_text_utils_derived_subject (const gchar *subject, gboolean is_reply)
        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");
@@ -318,54 +321,33 @@ modest_text_utils_derived_subject (const gchar *subject, gboolean is_reply)
        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;
@@ -1162,18 +1144,19 @@ modest_text_utils_quote_html (const gchar *text,
 {
        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 ("");
@@ -2323,3 +2306,26 @@ modest_text_utils_no_recipient (GtkTextBuffer *buffer)
 
        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;
+}
index 845f302..b35e6b6 100644 (file)
@@ -695,4 +695,6 @@ gchar * modest_text_utils_quote_names (const gchar *recipients);
 
 gboolean modest_text_utils_no_recipient (GtkTextBuffer *buffer);
 
+gchar * modest_text_utils_create_colored_signature (const gchar *signature);
+
 #endif /* __MODEST_TEXT_UTILS_H__ */
index 1499a75..b560a8e 100644 (file)
@@ -883,10 +883,11 @@ volume_path_is_mounted (const gchar* path)
 
 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);
@@ -902,6 +903,11 @@ static void _bodies_filter (TnyMsg *msg, TnyList *list)
                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);
+       }
 }
 
 
index 8f04082..3e9a473 100644 (file)
@@ -171,7 +171,8 @@ modest_tny_mime_part_is_msg (TnyMimePart *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 {
index 46ff6b7..e237efb 100644 (file)
@@ -224,7 +224,7 @@ add_html_body_part (TnyMsg *msg,
 
        /* 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);
@@ -639,6 +639,132 @@ modest_tny_msg_find_body_part_from_mime_part (TnyMimePart *msg, gboolean want_ht
                      * 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)
@@ -649,6 +775,14 @@ 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"
 
@@ -1271,6 +1405,36 @@ modest_tny_msg_create_reply_msg (TnyMsg *msg,
        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)
index 0c0126a..bc9d81c 100644 (file)
@@ -119,6 +119,16 @@ TnyMsg* modest_tny_msg_new_html_plain (const gchar* mailto, const gchar* mailfro
  */     
 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:
@@ -154,6 +164,24 @@ TnyMsg*       modest_tny_msg_create_forward_msg   (TnyMsg *msg,
                                                   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
index 97bb9c8..84cae1b 100644 (file)
@@ -665,8 +665,7 @@ modest_ui_actions_compose_msg(ModestWindow *win,
        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();
@@ -733,34 +732,17 @@ modest_ui_actions_compose_msg(ModestWindow *win,
                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);
@@ -1595,9 +1577,8 @@ reply_forward_cb (ModestMailOperation *mail_op,
        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
@@ -1608,9 +1589,10 @@ reply_forward_cb (ModestMailOperation *mail_op,
 
        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);
 
@@ -2041,6 +2023,68 @@ reply_forward (ReplyForwardAction action, ModestWindow *win)
 }
 
 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));
@@ -5836,7 +5880,7 @@ modest_ui_actions_on_delete_account (GtkWindow *parent_window,
                           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__);
                }
index 8284cff..9d6435c 100644 (file)
@@ -82,6 +82,8 @@ void     modest_ui_actions_on_open           (GtkAction *action, ModestWindow *w
 
 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);
index 6812635..8a84e85 100644 (file)
@@ -983,6 +983,27 @@ 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)
+{
+       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;
index bcdd043..3988550 100644 (file)
@@ -71,6 +71,7 @@ gboolean modest_ui_dimming_rules_on_send_receive_all (ModestWindow *win, gpointe
 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);
index f3820f0..9eda9e9 100644 (file)
@@ -37,9 +37,6 @@
 #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"
index 51aafc0..2a46f28 100644 (file)
@@ -489,6 +489,7 @@ on_account_activated (GtkTreeView *account_view,
        } 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 (), 
index 2b28cfe..a83f7d8 100644 (file)
@@ -187,7 +187,8 @@ modest_attachments_view_set_message (ModestAttachmentsView *attachments_view, Tn
 
                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);
 
@@ -219,10 +220,13 @@ modest_attachments_view_set_message (ModestAttachmentsView *attachments_view, Tn
 
                        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;
                        }
                }
index 14b5250..75866d2 100644 (file)
@@ -2110,31 +2110,31 @@ filter_row (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
        /* 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;
                }
        }
 
@@ -2142,12 +2142,12 @@ filter_row (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
                /* 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;
                }
                
        }
index 6f1db31..59cd35c 100644 (file)
@@ -202,7 +202,7 @@ _modest_global_settings_dialog_get_update_interval (void)
                                 _("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"),
index 667281f..a86d062 100644 (file)
@@ -224,6 +224,7 @@ static void remove_attachment (ModestGtkhtmlMsgView *view, TnyMimePart *attachme
 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 {
@@ -250,6 +251,10 @@ struct _ModestGtkhtmlMsgViewPrivate {
        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;
@@ -1239,6 +1244,20 @@ modest_gtkhtml_msg_view_init (ModestGtkhtmlMsgView *obj)
                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);
@@ -1255,6 +1274,12 @@ modest_gtkhtml_msg_view_init (ModestGtkhtmlMsgView *obj)
                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);
@@ -1824,6 +1849,9 @@ set_message (ModestGtkhtmlMsgView *self, TnyMsg *msg, TnyMimePart *other_body)
 #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));
 
@@ -1898,17 +1926,22 @@ set_message (ModestGtkhtmlMsgView *self, TnyMsg *msg, TnyMimePart *other_body)
 
        /* 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));
@@ -1992,6 +2025,9 @@ set_header (ModestGtkhtmlMsgView *self, TnyHeader *header)
 #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;
@@ -2752,3 +2788,49 @@ modest_gtkhtml_msg_view_has_blocked_external_images_default (ModestMsgView *self
 {
        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);
+       }
+       
+
+}
index d2a6c96..455c94e 100644 (file)
@@ -73,7 +73,7 @@ get_status_string (ModestTnySendQueueStatus status)
 }
 
 static GdkPixbuf*
-get_pixbuf_for_flag (TnyHeaderFlags flag)
+get_pixbuf_for_flag (TnyHeaderFlags flag, gboolean is_calendar)
 {
        /* optimization */
        static GdkPixbuf *deleted_pixbuf          = NULL;
@@ -82,6 +82,14 @@ get_pixbuf_for_flag (TnyHeaderFlags flag)
        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:
@@ -204,7 +212,7 @@ _modest_header_view_attach_cell_data (GtkTreeViewColumn *column, GtkCellRenderer
 
        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);
 }
 
@@ -296,6 +304,7 @@ _modest_header_view_compact_header_cell_data  (GtkTreeViewColumn *column,  GtkCe
                *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
@@ -346,16 +355,19 @@ _modest_header_view_compact_header_cell_data  (GtkTreeViewColumn *column,  GtkCe
        /* 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"), 
index 290f62e..910379e 100644 (file)
@@ -188,6 +188,8 @@ static void text_buffer_mark_set (GtkTextBuffer *buffer,
                                  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);
@@ -337,6 +339,7 @@ struct _ModestMsgEditWindowPrivate {
        GtkWidget   *app_menu;
        GtkWidget   *cc_button;
        GtkWidget   *bcc_button;
+       GtkWidget   *show_toolbar_button;
 
        GtkWidget   *max_chars_banner;
 
@@ -2118,11 +2121,15 @@ modest_msg_edit_window_set_format (ModestMsgEditWindow *self,
        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 ();
@@ -3166,6 +3173,10 @@ modest_msg_edit_window_show_toolbar (ModestWindow *self,
        } 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
@@ -3249,7 +3260,8 @@ modest_msg_edit_window_set_file_format (ModestMsgEditWindow *window,
                        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:
                {
@@ -3258,7 +3270,8 @@ modest_msg_edit_window_set_file_format (ModestMsgEditWindow *window,
                        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);
@@ -3430,10 +3443,8 @@ modest_msg_edit_window_undo (ModestMsgEditWindow *window)
        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));
@@ -4616,6 +4627,16 @@ on_message_settings (GtkAction *action,
 }
 
 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)
 {
@@ -4689,6 +4710,17 @@ setup_menu (ModestMsgEditWindow *self)
        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
index a3fddba..d3ebe31 100644 (file)
 
 #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>
 
@@ -245,6 +250,11 @@ static gboolean _modest_msg_view_window_map_event (GtkWidget *widget,
                                                   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 {
@@ -503,12 +513,19 @@ modest_msg_view_window_init (ModestMsgViewWindow *obj)
        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
@@ -826,6 +843,8 @@ modest_msg_view_window_construct (ModestMsgViewWindow *self,
                          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);
 
@@ -3101,6 +3120,7 @@ idle_save_mime_part_show_result (SaveMimePartInfo *info)
        } 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 */
 
@@ -3224,7 +3244,7 @@ save_mime_part_to_file (SaveMimePartInfo *info)
                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;
@@ -3295,6 +3315,8 @@ save_mime_parts_to_file_with_checks (GtkWindow *parent,
        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);
        }
 
@@ -4138,3 +4160,47 @@ sync_flags (ModestMsgViewWindow *self)
                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;
+}
index ebbbfd0..ff74123 100644 (file)
@@ -40,6 +40,7 @@ enum {
        FETCH_IMAGE_SIGNAL,
        SHOW_DETAILS_SIGNAL,
        LIMIT_ERROR_SIGNAL,
+       HANDLE_CALENDAR_SIGNAL,
        LAST_SIGNAL
 };
 static guint signals[LAST_SIGNAL] = {0};
@@ -207,6 +208,14 @@ modest_msg_view_base_init (gpointer g_class)
                                      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;
        }
 }
index 0ee8b1c..f7c4fcb 100644 (file)
@@ -88,6 +88,7 @@ struct _ModestMsgViewIface {
        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);
 };
 
 
index 9273229..60f02c8 100644 (file)
@@ -347,9 +347,9 @@ modest_provider_combo_box_refresh (ModestProviderComboBox *self)
                                        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) {
index 1fdb139..1f60734 100644 (file)
@@ -85,15 +85,10 @@ static void     modest_window_set_zoom_default           (ModestWindow *window,
                                                          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
@@ -187,9 +182,6 @@ modest_window_init (ModestWindow *obj)
        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
@@ -632,35 +624,11 @@ on_key_pressed (GtkWidget *self,
                }
                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)
@@ -679,4 +647,3 @@ modest_window_pack_toolbar (ModestWindow *self,
 
        MODEST_WINDOW_GET_CLASS (self)->pack_toolbar_func (self, pack_type, toolbar);
 }
-
index 0a73dbc..28c8a0e 100644 (file)
@@ -30,6 +30,7 @@ noinst_PROGRAMS = \
        test_get_folders \
        test_top_application \
        test_update_account \
+       test_update_folder_counts \
        test_open_account \
        test_open_edit_accounts_dialog
 
@@ -60,6 +61,9 @@ test_top_application_LDADD = $(objects)
 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)
 
diff --git a/tests/dbus_api/test_update_folder_counts.c b/tests/dbus_api/test_update_folder_counts.c
new file mode 100644 (file)
index 0000000..42d068d
--- /dev/null
@@ -0,0 +1,52 @@
+#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;
+
+}