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.
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. */
{
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;
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)
{
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;
}