X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fdbus_api%2Fmodest-dbus-callbacks.c;h=24cd7a86898cdcf439be97603e3c6a20cd5b98e2;hp=525d71918e1d3df2facde7da0b2f0ed4fd098a79;hb=2b6c4fa7f90c2e9e24627eba531e3f03f7a6391f;hpb=e811a41e854da0d930708209e6f7be573c30d7f9 diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index 525d719..24cd7a8 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -846,7 +846,7 @@ on_dbus_method_dump_send_queues (DBusConnection *con, DBusMessage *message) 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", @@ -956,7 +956,8 @@ on_dbus_method_dump_accounts (DBusConnection *con, DBusMessage *message) 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); @@ -970,7 +971,8 @@ on_dbus_method_dump_accounts (DBusConnection *con, DBusMessage *message) if (TNY_IS_ACCOUNT(acc)) { gchar *tmp, *url = tny_account_get_url_string (acc); tmp = g_strdup_printf ("%stransport: '%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); @@ -1719,6 +1721,25 @@ on_dbus_method_get_folders (DBusConnection *con, DBusMessage *message) } +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 @@ -1734,8 +1755,19 @@ modest_dbus_req_filter (DBusConnection *con, 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)) {