2007-08-28 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Tue, 28 Aug 2007 09:42:00 +0000 (09:42 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Tue, 28 Aug 2007 09:42:00 +0000 (09:42 +0000)
* src/modest-search.c: (on_timeout_check_account_is_online):
Added some debug output to help me debug a problem on the N800.
(check_and_wait_for_account_is_online): Fail immediately if the
device is offline.
modest_search_all_accounts(): Try the search even if the account does
not seem to be online, because this can work sometimes, and should work
with the cache if there is no active libconic connection.

pmo-trunk-r3103

ChangeLog2
src/modest-search.c

index 33f40c4..23ce3a0 100644 (file)
@@ -1,3 +1,13 @@
+2007-08-28  Murray Cumming  <murrayc@murrayc.com>
+
+       * src/modest-search.c: (on_timeout_check_account_is_online):
+       Added some debug output to help me debug a problem on the N800.
+       (check_and_wait_for_account_is_online): Fail immediately if the 
+       device is offline.
+       modest_search_all_accounts(): Try the search even if the account does 
+       not seem to be online, because this can work sometimes, and should work 
+       with the cache if there is no active libconic connection.
+
 2007-08-27  Armin Burgmeier  <armin@openismus.com>
 
        * src/modest-tny-send-queue.c: Implement TnyFolderObserver and
index 572989b..0b2db46 100644 (file)
@@ -81,6 +81,18 @@ on_timeout_check_account_is_online(gpointer user_data)
        printf ("DEBUG: %s:\n", __FUNCTION__);
        UtilIdleData *data = (UtilIdleData*)user_data;
        
+       if (!data) {
+               g_warning ("%s: data is NULL.\n", __FUNCTION__);
+       }
+       
+       if (!(data->account)) {
+               g_warning ("%s: data->account is NULL.\n", __FUNCTION__);
+       }
+       
+       if (data && data->account) {
+               printf ("%s: tny_account_get_connection_status()==%d\n", __FUNCTION__, tny_account_get_connection_status (data->account));      
+       }
+       
        gboolean stop_trying = FALSE;
        if (data && data->account && 
                (tny_account_get_connection_status (data->account) == TNY_CONNECTION_STATUS_CONNECTED) )
@@ -119,10 +131,18 @@ on_timeout_check_account_is_online(gpointer user_data)
  * This is useful when the D-Bus method was run immediately after 
  * the application was started (when using D-Bus activation), 
  * because the account usually takes a short time to go online.
+ * The return value is maybe not very useful.
  */
 static gboolean
 check_and_wait_for_account_is_online(TnyAccount *account)
 {
+       if (!tny_device_is_online (modest_runtime_get_device())) {
+               printf ("%s: device is offline.\n", __FUNCTION__);
+               return FALSE;
+       }
+               
+       printf ("%s: tny_account_get_connection_status()==%d\n", __FUNCTION__, tny_account_get_connection_status (account));
+       
        if (tny_account_get_connection_status (account) == TNY_CONNECTION_STATUS_CONNECTED)
                return TRUE;
                
@@ -672,16 +692,16 @@ modest_search_all_accounts (ModestSearch *search)
                        /* Give the account time to go online if necessary, 
                         * for instance if this is immediately after startup,
                         * after D-Bus activation: */
-                       if (check_and_wait_for_account_is_online (account)) {
-                               /* Search: */
-                               res = modest_search_account (account, search);
-                               
-                               if (res != NULL) {      
-                                       if (hits == NULL) {
-                                               hits = res;
-                                       } else {
-                                               hits = g_list_concat (hits, res);
-                                       }
+                       check_and_wait_for_account_is_online (account);
+                       
+                       /* Search: */
+                       res = modest_search_account (account, search);
+                       
+                       if (res != NULL) {      
+                               if (hits == NULL) {
+                                       hits = res;
+                               } else {
+                                       hits = g_list_concat (hits, res);
                                }
                        }