* Fixes NB#67061, do not ask the user to download the msg if we're online
authorSergio Villar Senin <svillar@igalia.com>
Wed, 29 Aug 2007 09:59:55 +0000 (09:59 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Wed, 29 Aug 2007 09:59:55 +0000 (09:59 +0000)
pmo-trunk-r3121

src/maemo/modest-msg-view-window.c
src/modest-ui-actions.c

index 188479b..5676299 100644 (file)
@@ -1524,28 +1524,29 @@ message_reader (ModestMsgViewWindow *window,
        if (tny_header_get_flags (header) & TNY_HEADER_FLAG_CACHED) {
                op_type = MODEST_MAIL_OPERATION_TYPE_OPEN;
        } else {
-               TnyFolder *folder;
-               GtkResponseType response;
-
                op_type = MODEST_MAIL_OPERATION_TYPE_RECEIVE;
 
-               /* Ask the user if he wants to download the message */
-               response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
-                                                                   _("mcen_nc_get_msg"));
-               if (response == GTK_RESPONSE_CANCEL)
-                       return FALSE;
+               /* Ask the user if he wants to download the message if
+                  we're not online */
+               if (!tny_device_is_online (modest_runtime_get_device())) {
+                       TnyFolder *folder = NULL;
+                       GtkResponseType response;
+
+                       response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
+                                                                           _("mcen_nc_get_msg"));
+                       if (response == GTK_RESPONSE_CANCEL)
+                               return FALSE;
                
-               /* Offer the connection dialog if necessary */
-               /* FIXME: should this stuff go directly to the mail
-                  operation instead of spread it all over the
-                  code? */
-               folder = tny_header_get_folder (header);
-               if (folder) {
-                       if (!modest_platform_connect_and_wait_if_network_folderstore (NULL, TNY_FOLDER_STORE (folder))) {
+                       /* Offer the connection dialog if necessary */
+                       folder = tny_header_get_folder (header);
+                       if (folder) {
+                               if (!modest_platform_connect_and_wait_if_network_folderstore (NULL, 
+                                                                                             TNY_FOLDER_STORE (folder))) {
+                                       g_object_unref (folder);
+                                       return FALSE;
+                               }
                                g_object_unref (folder);
-                               return FALSE;
                        }
-                       g_object_unref (folder);
                }
        }
 
index 4666309..b564cf0 100644 (file)
@@ -1235,12 +1235,11 @@ header_list_count_uncached_msgs (
  * messages. Returns TRUE if the user allowed the download.
  */
 static gboolean
-connect_to_get_msg (
-                       GtkWindow *win,
-                       gint num_of_uncached_msgs)
+connect_to_get_msg (GtkWindow *win,
+                   gint num_of_uncached_msgs)
 {
        /* Allways download if we are online. */
-       if (tny_device_is_online (modest_runtime_get_device()))
+       if (tny_device_is_online (modest_runtime_get_device ()))
                return TRUE;
 
        /* If offline, then ask for user permission to download the messages */