static gboolean
on_idle_present_modal (gpointer user_data)
{
+ GtkWindow *current, *transient;
gdk_threads_enter ();
- gtk_window_present (user_data);
+ current = (GtkWindow *) user_data;
+ while (GTK_IS_DIALOG (current)) {
+ transient = gtk_window_get_transient_for (GTK_WINDOW (current));
+ if (transient == NULL)
+ break;
+ else
+ current = transient;
+ }
+ gtk_window_present (current);
gdk_threads_leave ();
return FALSE;
DBUS_STRUCT_BEGIN_CHAR_AS_STRING \
DBUS_TYPE_STRING_AS_STRING \
DBUS_TYPE_STRING_AS_STRING \
+ DBUS_TYPE_STRING_AS_STRING \
+ DBUS_TYPE_INT64_AS_STRING \
DBUS_TYPE_ARRAY_AS_STRING \
ACCOUNT_HIT_DBUS_TYPE \
DBUS_STRUCT_END_CHAR_AS_STRING
typedef struct {
gchar *account_id;
gchar *account_name;
+ gchar *store_protocol;
gchar *mailbox_id;
+ gint unread_count;
GList *header_list;
} AccountHits;
AccountHits *ah = (AccountHits *) node->data;
const char *account_id;
const char *account_name;
+ const char *store_protocol;
+ gint64 unread_count;
DBusMessageIter ah_struct_iter;
DBusMessageIter sh_array_iter;
GList *result_node;
&ah_struct_iter);
account_id = ah->account_id;
account_name = ah->account_name;
+ store_protocol = ah->store_protocol;
+ unread_count = ah->unread_count;
dbus_message_iter_append_basic (&ah_struct_iter,
DBUS_TYPE_STRING,
&account_id);
dbus_message_iter_append_basic (&ah_struct_iter,
DBUS_TYPE_STRING,
&account_name);
+ dbus_message_iter_append_basic (&ah_struct_iter,
+ DBUS_TYPE_STRING,
+ &store_protocol);
+ dbus_message_iter_append_basic (&ah_struct_iter,
+ DBUS_TYPE_INT64,
+ &unread_count);
dbus_message_iter_open_container (&ah_struct_iter,
DBUS_TYPE_ARRAY,
&ah_struct_iter);
g_free (ah->account_id);
g_free (ah->account_name);
+ g_free (ah->store_protocol);
g_list_free (ah->header_list);
}
AccountHits *account_hits;
const gchar *folder_id;
const gchar *bar;
+ ModestProtocolType store_protocol_type;
+ ModestProtocol *store_protocol;
+ gint unread_count;
+ ModestProtocolRegistry *registry;
acc_iterator = tny_list_create_iterator (helper->accounts_list);
account = TNY_ACCOUNT (tny_iterator_get_current (acc_iterator));
headers_iterator = tny_list_create_iterator (headers);
+ unread_count = 0;
while (!tny_iterator_is_done (headers_iterator)) {
TnyHeader *header;
TnyHeaderFlags flags;
header = TNY_HEADER (tny_iterator_get_current (headers_iterator));
flags = tny_header_get_flags (header);
if (!(flags & TNY_HEADER_FLAG_SEEN)) {
- result_list = g_list_insert_sorted (result_list, g_object_ref (header), (GCompareFunc) headers_cmp);
+ unread_count++;
+ result_list = g_list_insert_sorted (result_list, g_object_ref (header), (GCompareFunc) headers_cmp);
if (members_count == helper->unread_msgs_count) {
g_object_unref (result_list->data);
result_list = g_list_delete_link (result_list, result_list);
}
g_object_unref (headers_iterator);
+ registry = modest_runtime_get_protocol_registry ();
+ store_protocol_type = modest_tny_account_get_protocol_type (account);
+
+ /* Get the number of unread messages for plug-in based accounts */
+ if (modest_protocol_registry_protocol_type_is_provider (registry, store_protocol_type)) {
+ unread_count = tny_folder_get_unread_count (self);
+ }
+
account_hits = g_slice_new (AccountHits);
account_hits->account_id = g_strdup (modest_tny_account_get_parent_modest_account_name_for_server_account (account));
account_hits->account_name = g_strdup (tny_account_get_name (account));
+ store_protocol = modest_protocol_registry_get_protocol_by_type (registry, store_protocol_type);
+ account_hits->store_protocol = g_strdup (modest_protocol_get_name (store_protocol));
account_hits->header_list = result_list;
account_hits->mailbox_id = NULL;
+ account_hits->unread_count = unread_count;
folder_id = tny_folder_get_id (self);
bar = g_strstr_len (folder_id, -1, "/");