2007-05-15 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Tue, 15 May 2007 14:28:00 +0000 (14:28 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Tue, 15 May 2007 14:28:00 +0000 (14:28 +0000)
* src/maemo/modest-maemo-global-settings-dialog.c:
        (current_connection): Prevent a crash in scratchbox when
        ny_maemo_conic_device_get_current_iap_id() returns NULL.
        * src/maemo/modest-platform.c:
        (on_modest_conf_update_interval_changed), (modest_platform_init):
        Get the update interval from gconf and reset it when the gconf key changes.

pmo-trunk-r1876

ChangeLog2
src/dbus_api/modest-dbus-callbacks.c
src/maemo/modest-maemo-global-settings-dialog.c
src/maemo/modest-platform.c

index f6b93dd..4a0dd05 100644 (file)
@@ -1,5 +1,14 @@
 2007-05-15  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/maemo/modest-maemo-global-settings-dialog.c:
+       (current_connection): Prevent a crash in scratchbox when 
+       ny_maemo_conic_device_get_current_iap_id() returns NULL.
+       * src/maemo/modest-platform.c:
+       (on_modest_conf_update_interval_changed), (modest_platform_init):
+       Get the update interval from gconf and reset it when the gconf key changes.
+
+2007-05-15  Murray Cumming  <murrayc@murrayc.com>
+
        * src/modest-protocol-info.c:
        * src/modest-protocol-info.h: Adde enum-specific get functions, 
        instead of using a ModestProtocolType enum parameter.
index 35940a0..aa3d541 100644 (file)
@@ -474,7 +474,7 @@ on_idle_send_receive(gpointer user_data)
        win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ());
 
        /* Send & receive all if "Update automatically" is set */
-       /* TODO: check the auto-update parametter in the configuration */
+       /* TODO: check the auto-update parameter in the configuration */
        modest_ui_actions_do_send_receive_all (win);
        
        return FALSE; /* Do not call this callback again. */
index 1d3d6c5..e262409 100644 (file)
@@ -375,25 +375,26 @@ current_connection (void)
 {
        TnyAccountStore *account_store;
        TnyDevice *device;
-       gboolean retval;
-       const gchar *bearer_type, *iap_id;
-       ConIcIap *iap;
+       gboolean retval = FALSE;
        
        account_store = TNY_ACCOUNT_STORE (modest_runtime_get_account_store ());
        device = tny_account_store_get_device (account_store);
 
        /* Get iap id */
-       iap_id = tny_maemo_conic_device_get_current_iap_id (TNY_MAEMO_CONIC_DEVICE (device));
-       iap = tny_maemo_conic_device_get_iap (TNY_MAEMO_CONIC_DEVICE (device), iap_id);
-       bearer_type = con_ic_iap_get_bearer_type (iap);
-               
-       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);
+       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 (!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);
+       }
        g_object_unref (device);
 
        return retval;
index c1f43f1..0eed3e9 100644 (file)
 
 static osso_context_t *osso_context = NULL;
        
+static void    
+on_modest_conf_update_interval_changed (ModestConf* self, const gchar *key, 
+       ModestConfEvent event, gpointer user_data)
+{
+       const guint update_interval_minutes = 
+               modest_conf_get_int (self, MODEST_CONF_UPDATE_INTERVAL, NULL);
+       modest_platform_set_update_interval (update_interval_minutes);
+}
+
 gboolean
 modest_platform_init (void)
 {
@@ -95,12 +104,18 @@ modest_platform_init (void)
                g_warning ("osso_application_set_autosave_cb() failed.");       
        }
        
-       
-       /* TODO: Get the actual update interval from gconf, 
-        * when that preferences dialog has been implemented.
-        * And make sure that this is called again whenever that is changed. */
-       const guint update_interval_minutes = 15;
-       modest_platform_set_update_interval (update_interval_minutes);
+
+       /* Make sure that the update interval is changed whenever its gconf key 
+        * is changed: */
+       ModestConf *conf = modest_runtime_get_conf ();
+       g_signal_connect (G_OBJECT(conf),
+                         "key_changed",
+                         G_CALLBACK (on_modest_conf_update_interval_changed), 
+                         NULL);
+                         
+       /* Get the initial update interval from gconf: */
+       on_modest_conf_update_interval_changed(conf, NULL, 
+               MODEST_CONF_EVENT_KEY_CHANGED, NULL);
        
        return TRUE;
 }