if (TNY_IS_ACCOUNT(acc)) {
gchar *tmp, *url = tny_account_get_url_string (acc);
ModestTnySendQueue *sendqueue =
- modest_runtime_get_send_queue (TNY_TRANSPORT_ACCOUNT(acc));
+ modest_runtime_get_send_queue (TNY_TRANSPORT_ACCOUNT(acc), TRUE);
gchar *queue_str = modest_tny_send_queue_to_string (sendqueue);
tmp = g_strdup_printf ("%s[%s]: '%s': %s\n%s",
if (TNY_IS_ACCOUNT(acc)) {
gchar *tmp, *url = tny_account_get_url_string (acc);
tmp = g_strdup_printf ("%sstore : '%s': %s (refs: %d)\n",
- str, tny_account_get_id (acc), url, ((GObject*)acc)->ref_count);
+ str, tny_account_get_id (acc), url,
+ ((GObject*)acc)->ref_count-1);
g_free (str);
str = tmp;
g_free (url);
TNY_ACCOUNT_TYPE_TRANSPORT);
if (TNY_IS_ACCOUNT(acc)) {
gchar *tmp, *url = tny_account_get_url_string (acc);
- tmp = g_strdup_printf ("%stransport: '%s': %s\n",
- str, tny_account_get_id (acc), url);
+ tmp = g_strdup_printf ("%stransport: '%s': %s (refs: %d)\n",
+ str, tny_account_get_id (acc), url,
+ ((GObject*)acc)->ref_count-1);
g_free (str);
str = tmp;
g_free (url);
}
+static void
+reply_empty_results (DBusConnection *con, DBusMessage *msg)
+{
+ DBusMessage *reply = dbus_message_new_method_return (msg);
+ if (reply) {
+ dbus_uint32_t serial = 0;
+ /* we simply return an empty list, otherwise
+ global-search gets confused */
+ search_result_to_message (reply, NULL);
+
+ dbus_connection_send (con, reply, &serial);
+ dbus_connection_flush (con);
+ dbus_message_unref (reply);
+ } else
+ g_warning ("%s: failed to send reply",
+ __FUNCTION__);
+}
+
+
/** This D-Bus handler is used when the main osso-rpc
* D-Bus handler has not handled something.
* We use this for D-Bus methods that need to use more complex types
if (dbus_message_is_method_call (message,
MODEST_DBUS_IFACE,
MODEST_DBUS_METHOD_SEARCH)) {
- on_dbus_method_search (con, message);
- handled = TRUE;
+
+ /* don't try to search when there not enough mem */
+ if (modest_platform_check_memory_low (NULL)) {
+ g_warning ("%s: not enough memory for searching",
+ __FUNCTION__);
+ reply_empty_results (con, message);
+ handled = TRUE;
+
+ } else {
+ on_dbus_method_search (con, message);
+ handled = TRUE;
+ }
+
} else if (dbus_message_is_method_call (message,
MODEST_DBUS_IFACE,
MODEST_DBUS_METHOD_GET_FOLDERS)) {