* Partially fixes NB#80917, we still need the strings from the translation team
authorSergio Villar Senin <svillar@igalia.com>
Tue, 19 Feb 2008 19:06:55 +0000 (19:06 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 19 Feb 2008 19:06:55 +0000 (19:06 +0000)
pmo-trunk-r4203

src/dbus_api/modest-dbus-callbacks.c
src/maemo/modest-maemo-global-settings-dialog.c
src/maemo/modest-maemo-utils.h
src/maemo/modest-platform.c
src/modest-init.c
src/modest-platform.h
src/widgets/modest-global-settings-dialog.c
src/widgets/modest-global-settings-dialog.h

index d90994a..1275b8e 100644 (file)
@@ -987,8 +987,19 @@ on_dbus_method_dump_accounts (DBusConnection *con, DBusMessage *message)
 static gint 
 on_send_receive(GArray *arguments, gpointer data, osso_rpc_t * retval)
 {      
-       /* Use g_idle to context-switch into the application's thread: */
-       g_idle_add(on_idle_send_receive, NULL);
+       ModestConnectedVia connect_when;
+
+       connect_when = modest_conf_get_int (modest_runtime_get_conf (), 
+                                           MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, NULL);
+       
+       /* Perform a send and receive if the user selected to connect
+          via any mean or if the current connection method is the
+          same as the one specified by the user */
+       if (connect_when == MODEST_CONNECTED_VIA_ANY ||
+           connect_when == modest_platform_get_current_connection ()) {
+               /* Use g_idle to context-switch into the application's thread: */
+               g_idle_add(on_idle_send_receive, NULL);
+       }
        
        return OSSO_OK;
 }
index ad4e4c5..c7f84a7 100644 (file)
@@ -497,40 +497,7 @@ on_size_notify         (HildonNumberEditor *editor,
 static ModestConnectedVia
 current_connection (void)
 {
-       TnyAccountStore *account_store = NULL;
-       TnyDevice *device = NULL;
-       ModestConnectedVia retval = MODEST_CONNECTED_VIA_ANY;
-       
-       account_store = TNY_ACCOUNT_STORE (modest_runtime_get_account_store ());
-       device = tny_account_store_get_device (account_store);
-
-       if (!tny_device_is_online (device))
-               return MODEST_CONNECTED_VIA_ANY;
-
-#ifdef MODEST_HAVE_CONIC
-       /* Get iap id */
-       const gchar *iap_id = tny_maemo_conic_device_get_current_iap_id (TNY_MAEMO_CONIC_DEVICE (device));
-       if (iap_id) {
-               ConIcIap *iap = tny_maemo_conic_device_get_iap (
-                       TNY_MAEMO_CONIC_DEVICE (device), iap_id);
-               const gchar *bearer_type = con_ic_iap_get_bearer_type (iap);
-               if (bearer_type) {
-                       if (!strcmp (bearer_type, CON_IC_BEARER_WLAN_INFRA) ||
-                           !strcmp (bearer_type, CON_IC_BEARER_WLAN_ADHOC))
-                               retval = MODEST_CONNECTED_VIA_WLAN;
-                       else
-                               retval = MODEST_CONNECTED_VIA_ANY;
-               }
-       
-               g_object_unref (iap);
-       }
-#else
-       retval = MODEST_CONNECTED_VIA_WLAN; /* assume WLAN (fast) internet */  
-#endif /* MODEST_HAVE_CONIC */
-       
-       g_object_unref (device);
-
-       return retval;
+       return modest_platform_get_current_connection ();
 }
 
 static gboolean
index d8ce63d..28802a6 100644 (file)
@@ -36,7 +36,7 @@
 #include <modest-protocol-info.h>
 #include <tny-fs-stream.h>
 #include <libosso.h>
-
+#include "widgets/modest-global-settings-dialog.h"
 
 #define MODEST_MAEMO_UTILS_MYDOCS_FOLDER "MyDocs"
 #define MODEST_MAEMO_UTILS_DEFAULT_IMAGE_FOLDER ".images"
index a566b5e..4b86833 100644 (file)
@@ -2208,3 +2208,39 @@ modest_platform_get_account_settings_wizard ()
 
        return GTK_WIDGET (dialog);
 }
+
+ModestConnectedVia
+modest_platform_get_current_connection (void)
+{
+       TnyDevice *device = NULL;
+       ModestConnectedVia retval = MODEST_CONNECTED_VIA_ANY;
+       
+       device = modest_runtime_get_device ();
+
+       if (!tny_device_is_online (device))
+               return MODEST_CONNECTED_VIA_ANY;
+
+#ifdef MODEST_HAVE_CONIC
+       /* Get iap id */
+       const gchar *iap_id = tny_maemo_conic_device_get_current_iap_id (TNY_MAEMO_CONIC_DEVICE (device));
+       if (iap_id) {
+               ConIcIap *iap = tny_maemo_conic_device_get_iap (
+                       TNY_MAEMO_CONIC_DEVICE (device), iap_id);
+               const gchar *bearer_type = con_ic_iap_get_bearer_type (iap);
+               if (bearer_type) {
+                       if (!strcmp (bearer_type, CON_IC_BEARER_WLAN_INFRA) ||
+                           !strcmp (bearer_type, CON_IC_BEARER_WLAN_ADHOC) ||
+                           !strcmp (bearer_type, "WIMAX")) {
+                               retval = MODEST_CONNECTED_VIA_WLAN_OR_WIMAX;
+                       } else {
+                               retval = MODEST_CONNECTED_VIA_ANY;
+                       }
+               }
+       
+               g_object_unref (iap);
+       }
+#else
+       retval = MODEST_CONNECTED_VIA_WLAN_OR_WIMAX; /* assume WLAN (fast) internet */  
+#endif /* MODEST_HAVE_CONIC */
+       return retval;
+}
index ed61d10..0cf8e7e 100644 (file)
@@ -704,7 +704,7 @@ init_default_settings (ModestConf *conf)
                modest_conf_set_bool (conf, MODEST_CONF_AUTO_UPDATE, TRUE, NULL);
 
        if (!modest_conf_key_exists (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, NULL))
-               modest_conf_set_int (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, MODEST_CONNECTED_VIA_WLAN, NULL);
+               modest_conf_set_int (conf, MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, MODEST_CONNECTED_VIA_WLAN_OR_WIMAX, NULL);
 
        if (!modest_conf_key_exists (conf, MODEST_CONF_UPDATE_INTERVAL, NULL))
                modest_conf_set_int (conf, MODEST_CONF_UPDATE_INTERVAL, MODEST_UPDATE_INTERVAL_15_MIN, NULL);
index 27f4872..6af81c4 100644 (file)
@@ -44,6 +44,11 @@ typedef enum _ModestSortDialogType {
        MODEST_SORT_HEADERS,
 } ModestSortDialogType;
 
+typedef enum _ModestConnectedVia {
+       MODEST_CONNECTED_VIA_WLAN_OR_WIMAX = 1,
+       MODEST_CONNECTED_VIA_ANY,
+} ModestConnectedVia;
+
 /**
  * modest_platform_platform_init:
  *
@@ -497,6 +502,8 @@ GtkWidget *modest_platform_get_account_settings_dialog (ModestAccountSettings *s
  */
 GtkWidget *modest_platform_get_account_settings_wizard ();
 
+ModestConnectedVia modest_platform_get_current_connection (void);
+
 G_END_DECLS
 
 #endif /* __MODEST_PLATFORM_UTILS_H__ */
index 778ccbc..2498700 100644 (file)
@@ -173,7 +173,7 @@ _modest_global_settings_dialog_get_connected_via (void)
 {
        GSList *list = NULL;
 
-       add_to_modest_pair_list (MODEST_CONNECTED_VIA_WLAN, 
+       add_to_modest_pair_list (MODEST_CONNECTED_VIA_WLAN_OR_WIMAX, 
                                 _("mcen_va_options_connectiontype_wlan"), 
                                 &list);
        add_to_modest_pair_list (MODEST_CONNECTED_VIA_ANY, 
@@ -258,7 +258,7 @@ _modest_global_settings_dialog_load_conf (ModestGlobalSettingsDialog *self)
        if (error) {
                g_error_free (error);
                error = NULL;
-               combo_id = MODEST_CONNECTED_VIA_WLAN;
+               combo_id = MODEST_CONNECTED_VIA_WLAN_OR_WIMAX;
        }
        modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->connect_via), 
                                        (gpointer) &combo_id);
@@ -405,7 +405,7 @@ _modest_global_settings_dialog_save_conf (ModestGlobalSettingsDialog *self)
                        /* Disable autoupdate in offline mode */
                        modest_platform_set_update_interval (0);
                }
-               g_object_unref (device);                
+               g_object_unref (device);
        }
 
 exit:
index c734faf..9c487e4 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <gtk/gtkdialog.h>
 #include "widgets/modest-global-settings-dialog-priv.h"
+#include "modest-platform.h"
 /* other include files */
 
 G_BEGIN_DECLS
@@ -45,11 +46,6 @@ G_BEGIN_DECLS
 #define MODEST_GLOBAL_SETTINGS_DIALOG_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_GLOBAL_SETTINGS_DIALOG,ModestGlobalSettingsDialogClass))
 
 /* Global settings */
-typedef enum _ModestConnectedVia {
-       MODEST_CONNECTED_VIA_WLAN = 1,
-       MODEST_CONNECTED_VIA_ANY,
-} ModestConnectedVia;
-
 typedef enum _ModestUpdateInterval {
        MODEST_UPDATE_INTERVAL_5_MIN = 5,
        MODEST_UPDATE_INTERVAL_10_MIN = 10,