From: José Dapena Paz Date: Sat, 23 Jan 2010 20:07:14 +0000 (+0100) Subject: Emit dbus signal on changing SEEN flag. X-Git-Tag: 3.90.5~37 X-Git-Url: http://vcs.maemo.org/git/?p=modest;a=commitdiff_plain;h=b4322b2797a54b300ea6601e65623d8a03584b23 Emit dbus signal on changing SEEN flag. --- diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index a765be7..1811ab7 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -537,6 +537,7 @@ find_msg_async_cb (TnyFolder *folder, ModestMailOperation *mail_op; tny_header_set_flag (header, TNY_HEADER_FLAG_SEEN); + modest_platform_emit_msg_read_changed_signal (msg_uid, TRUE); /* Sync folder, we need this to save the seen flag */ mail_op = modest_mail_operation_new (NULL); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), diff --git a/src/gtk/modest-platform.c b/src/gtk/modest-platform.c index 9254016..a1a9361 100644 --- a/src/gtk/modest-platform.c +++ b/src/gtk/modest-platform.c @@ -2386,3 +2386,9 @@ modest_platform_emit_account_removed_signal (const gchar *account_id) return; } +void +modest_platform_emit_msg_read_changed_signal (const gchar *msg_uid, + gboolean is_read) +{ + return; +} diff --git a/src/hildon2/modest-platform.c b/src/hildon2/modest-platform.c index d8f9225..14d6f32 100644 --- a/src/hildon2/modest-platform.c +++ b/src/hildon2/modest-platform.c @@ -3211,3 +3211,14 @@ modest_platform_emit_account_removed_signal (const gchar *account_id) modest_dbus_emit_account_removed_signal (con, account_id); } +void +modest_platform_emit_msg_read_changed_signal (const gchar *msg_uid, + gboolean is_read) +{ + DBusConnection *con; + + con = modest_platform_get_dbus_connection (); + if (!con) return; + + modest_dbus_emit_msg_read_changed_signal (con, msg_uid, is_read); +} diff --git a/src/modest-platform.h b/src/modest-platform.h index bc389c5..f92e0cc 100644 --- a/src/modest-platform.h +++ b/src/modest-platform.h @@ -569,6 +569,7 @@ DBusConnection* modest_platform_get_dbus_connection (void); void modest_platform_emit_folder_updated_signal (const gchar *account_id, const gchar *folder_id); void modest_platform_emit_account_created_signal (const gchar *account_id); void modest_platform_emit_account_removed_signal (const gchar *account_id); +void modest_platform_emit_msg_read_changed_signal (const gchar *msg_uid, gboolean is_read); G_END_DECLS diff --git a/src/modest-tny-send-queue.c b/src/modest-tny-send-queue.c index 9e9586b..b3bd3b1 100644 --- a/src/modest-tny-send-queue.c +++ b/src/modest-tny-send-queue.c @@ -679,6 +679,8 @@ _on_msg_has_been_sent (TnySendQueue *self, tny_header_set_flag (header, TNY_HEADER_FLAG_SEEN); + modest_platform_emit_msg_read_changed_signal (msg_id, TRUE); + tny_folder_sync_async (priv->sentbox, FALSE, NULL, NULL, NULL); /* Get status info */ diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 84cae1b..db9be88 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -328,12 +328,16 @@ headers_action_mark_as_read (TnyHeader *header, gpointer user_data) { TnyHeaderFlags flags; + gchar *uid; g_return_if_fail (TNY_IS_HEADER(header)); flags = tny_header_get_flags (header); if (flags & TNY_HEADER_FLAG_SEEN) return; tny_header_set_flag (header, TNY_HEADER_FLAG_SEEN); + uid = modest_tny_folder_get_header_unique_id (header); + modest_platform_emit_msg_read_changed_signal (uid, TRUE); + g_free (uid); } static void @@ -347,7 +351,10 @@ headers_action_mark_as_unread (TnyHeader *header, flags = tny_header_get_flags (header); if (flags & TNY_HEADER_FLAG_SEEN) { + gchar *uid; + uid = modest_tny_folder_get_header_unique_id (header); tny_header_unset_flag (header, TNY_HEADER_FLAG_SEEN); + modest_platform_emit_msg_read_changed_signal (uid, FALSE); } } diff --git a/src/widgets/modest-header-window.c b/src/widgets/modest-header-window.c index 7e40fb6..d163a76 100644 --- a/src/widgets/modest-header-window.c +++ b/src/widgets/modest-header-window.c @@ -562,7 +562,11 @@ on_mark_read_csm_activated (GtkMenuItem *item, priv->x_coord, priv->y_coord); if (header) { + gchar *uid; tny_header_set_flag (header, TNY_HEADER_FLAG_SEEN); + uid = modest_tny_folder_get_header_unique_id (header); + modest_platform_emit_msg_read_changed_signal (uid, TRUE); + g_free (uid); g_object_unref (header); } } @@ -582,7 +586,11 @@ on_mark_unread_csm_activated (GtkMenuItem *item, priv->x_coord, priv->y_coord); if (header) { + gchar *uid; tny_header_unset_flag (header, TNY_HEADER_FLAG_SEEN); + uid = modest_tny_folder_get_header_unique_id (header); + modest_platform_emit_msg_read_changed_signal (uid, FALSE); + g_free (uid); g_object_unref (header); } } diff --git a/src/widgets/modest-msg-view-window.c b/src/widgets/modest-msg-view-window.c index d3ebe31..f68d07a 100644 --- a/src/widgets/modest-msg-view-window.c +++ b/src/widgets/modest-msg-view-window.c @@ -2329,8 +2329,14 @@ view_msg_cb (ModestMailOperation *mail_op, } /* Mark header as read */ - if (!(tny_header_get_flags (header) & TNY_HEADER_FLAG_SEEN)) + if (!(tny_header_get_flags (header) & TNY_HEADER_FLAG_SEEN)) { + gchar *uid; + tny_header_set_flag (header, TNY_HEADER_FLAG_SEEN); + uid = modest_tny_folder_get_header_unique_id (header); + modest_platform_emit_msg_read_changed_signal (uid, TRUE); + g_free (uid); + } /* Set new message */ if (priv->msg_view != NULL && TNY_IS_MSG_VIEW (priv->msg_view)) {