2007-04-27 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Fri, 27 Apr 2007 11:35:53 +0000 (11:35 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Fri, 27 Apr 2007 11:35:53 +0000 (11:35 +0000)
* src/modest-platform.h:
        * src/gnome/modest-platform.c: (modest_platform_connect_and_wait):
        * src/maemo/modest-platform.c: (modest_platform_connect_and_wait):
        * src/modest-main.c: Implement this function so we can avoid using
        maemo-specific API from cross-platform code.
        (main):
        * src/modest-tny-account-store.c:
        (get_smtp_specific_transport_account_for_open_connection):
        * src/modest-ui-actions.c: (check_for_connection),
        (modest_ui_actions_on_item_not_found):
        Use modest_platform_connect_and_wait() and put #idefs around other
        maemo-specific code, because only maemo currently has a way to
        identify connection names.

pmo-trunk-r1692

ChangeLog2
src/gnome/modest-platform.c
src/maemo/modest-platform.c
src/modest-main.c
src/modest-platform.h
src/modest-tny-account-store.c
src/modest-ui-actions.c

index 11c02a0..080b38d 100644 (file)
@@ -1,5 +1,21 @@
 2007-04-27  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/modest-platform.h:
+       * src/gnome/modest-platform.c: (modest_platform_connect_and_wait):
+       * src/maemo/modest-platform.c: (modest_platform_connect_and_wait):
+       * src/modest-main.c: Implement this function so we can avoid using 
+       maemo-specific API from cross-platform code.
+       (main):
+       * src/modest-tny-account-store.c:
+       (get_smtp_specific_transport_account_for_open_connection):
+       * src/modest-ui-actions.c: (check_for_connection),
+       (modest_ui_actions_on_item_not_found):
+       Use modest_platform_connect_and_wait() and put #idefs around other 
+       maemo-specific code, because only maemo currently has a way to 
+       identify connection names.
+
+2007-04-27  Murray Cumming  <murrayc@murrayc.com>
+
        * src/modest-tny-account-store.h:
        * src/modest-tny-account-store.c:
        Added modest_tny_account_store_get_transport_account_for_open_connection(), which respects 
@@ -21,7 +37,7 @@
        
        (modest_ui_actions_on_send_receive): 
        Check that a connection is open before proceeding.
-       Receive and then send, instead of vice-versa, as per the specification
+       Receive and then send, instead of vice-versa, as per the specification.
 
 2007-04-26  Murray Cumming  <murrayc@murrayc.com>
 
index 999e462..3fc46b4 100644 (file)
@@ -189,3 +189,11 @@ modest_platform_run_information_dialog (GtkWindow *parent_window,
 
        /* TODO: implement a information dialog */
 }
+
+gboolean modest_platform_connect_and_wait (GtkWindow *parent_window)
+{
+       /* TODO: Do something with network-manager? 
+          Otherwise, maybe it is safe to assume that we would already be online if we could be. */
+       return TRUE;
+}
+
index 2659506..46505dd 100644 (file)
@@ -30,6 +30,7 @@
 #include <config.h>
 #include <glib/gi18n.h>
 #include <modest-platform.h>
+#include <modest-runtime.h>
 #include <dbus_api/modest-dbus-callbacks.h>
 #include <libosso.h>
 
@@ -507,3 +508,19 @@ modest_platform_run_information_dialog (GtkWindow *parent_window,
 
        gtk_widget_destroy (GTK_WIDGET (dialog));
 }
+
+gboolean modest_platform_connect_and_wait (GtkWindow *parent_window)
+{
+       TnyDevice *device = modest_runtime_get_device();
+       
+       if (tny_device_is_online (device))
+               return TRUE;
+               
+       /* TODO: Block on the result: */
+       gboolean request_sent = tny_maemo_conic_device_connect (TNY_MAEMO_CONIC_DEVICE (device), NULL);
+       if (!request_sent)
+               return FALSE;
+
+       return TRUE;
+}
+
index 9dcc063..324465c 100644 (file)
@@ -38,9 +38,9 @@
 #include <tny-account-store.h>
 #include <tny-list.h>
 #include <tny-simple-list.h>
-#include <tny-maemo-conic-device.h> /* For tny_maemo_conic_device_connect() */
 
 #include <modest-runtime.h>
+#include <modest-platform.h>
 #include <modest-init.h>
 
 #include <modest-defs.h>
@@ -136,7 +136,7 @@ main (int argc, char *argv[])
                } else {
                        if (modest_conf_get_bool (modest_runtime_get_conf(),
                                                  MODEST_CONF_CONNECT_AT_STARTUP, NULL))
-                               tny_maemo_conic_device_connect (TNY_MAEMO_CONIC_DEVICE (modest_runtime_get_device()), NULL);
+                               modest_platform_connect_and_wait(NULL);
                        
                        retval = start_ui (account_or_default,
                                           mailto, cc, bcc, subject, body);
index 492bfa3..84aa8cd 100644 (file)
@@ -163,6 +163,17 @@ gint      modest_platform_run_confirmation_dialog      (GtkWindow *parent_window
  **/
 void      modest_platform_run_information_dialog       (GtkWindow *parent_window,
                                                        ModestInformationDialogType type);
+               
+/*
+ * modest_platform_connect_and_wait:
+ * @parent_window: the parent #GtkWindow for any interactive or progress feedback UI.
+ * @return value: Whether a connection was make.
+ * 
+ * Attempts to make a connection, possibly showing interactive UI to achieve this.
+ * This will return TRUE immediately if a connection is already open.
+ * Otherwise, this function blocks until the connection attempt has either succeded or failed.
+ */            
+gboolean modest_platform_connect_and_wait (GtkWindow *parent_window);
 
 G_END_DECLS
 
index 39f6b78..8eac8c8 100644 (file)
 #include <tny-transport-account.h>
 #include <tny-simple-list.h>
 #include <tny-account-store.h>
-#include <tny-maemo-conic-device.h> /* For ConIcIap */
 #include <tny-camel-transport-account.h>
 #include <tny-camel-imap-store-account.h>
 #include <tny-camel-pop-store-account.h>
+
 #include <modest-runtime.h>
 #include <modest-marshal.h>
 #include <modest-protocol-info.h>
 #include <tny-gtk-lockable.h>
 #include <camel/camel.h>
 
+#ifdef MODEST_PLATFORM_MAEMO
+#include <tny-maemo-conic-device.h>
+#endif
+
 /* 'private'/'protected' functions */
 static void modest_tny_account_store_class_init   (ModestTnyAccountStoreClass *klass);
 //static void modest_tny_account_store_init         (ModestTnyAccountStore *obj);
@@ -780,6 +784,7 @@ static TnyAccount* get_smtp_specific_transport_account_for_open_connection (Mode
        if (!tny_device_is_online (device))
                return NULL;
 
+#ifdef MODEST_PLATFORM_MAEMO
        g_assert (TNY_IS_MAEMO_CONIC_DEVICE (device));
        TnyMaemoConicDevice *maemo_device = TNY_MAEMO_CONIC_DEVICE (device);    
        const gchar* iap_id = tny_maemo_conic_device_get_current_iap_id (maemo_device);
@@ -809,6 +814,9 @@ static TnyAccount* get_smtp_specific_transport_account_for_open_connection (Mode
        g_object_unref (connection);
        
        return account;
+#else
+       return NULL; /* TODO: Implement this for GNOME, instead of just Maemo? */
+#endif /* MODEST_PLATFORM_MAEMO */
 }
 
                                                                 
index b7d12f9..f286737 100644 (file)
@@ -52,7 +52,6 @@
 #include "modest-account-mgr-helpers.h"
 #include "modest-mail-operation.h"
 #include "modest-text-utils.h"
-#include <tny-maemo-conic-device.h> /* For ConIcIap */
 
 #ifdef MODEST_HAVE_EASYSETUP
 #include "easysetup/modest-easysetup-wizard.h"
@@ -677,7 +676,7 @@ gboolean check_for_connection (const gchar *account_name)
        if (tny_device_is_online (device))
                return TRUE;
        else {
-               tny_maemo_conic_device_connect (TNY_MAEMO_CONIC_DEVICE (device), NULL);
+               modest_platform_connect_and_wait (NULL);
                
                /* TODO: Wait until a result. */
                return TRUE;
@@ -1017,7 +1016,7 @@ modest_ui_actions_on_item_not_found (ModestHeaderView *header_view,ModestItemTyp
 
                gtk_window_set_default_size (GTK_WINDOW(dialog), 300, 300);
                if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
-//                     tny_maemo_conic_device_connect (TNY_MAEMO_CONIC_DEVICE (modest_runtime_get_device());
+//                     modest_platform_connect_and_wait ();;
                }
        }
        gtk_widget_destroy (dialog);