Changeset 1998
- Timestamp:
- 05/17/07 14:47:26
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-maemo/tny-maemo-conic-device.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r1984 r1998 1 2007-05-17 Murray Cumming <murrayc@murrayc.com> 2 3 * libtinymail-maemo/tny-maemo-conic-device.c: 4 (tny_maemo_conic_device_get_iap_list): When MAEMO_CONIC_DUMMY 5 hack together a list of fake debug* connection IDs as the result, 6 so we can simulate libconic in scratchbox. 7 8 (tny_maemo_conic_device_get_current_iap_id): When MAEMO_CONIC_DUMMY, 9 return a fake debug* connection ID based on the value of a 10 MAEMO_CONIC_DUMMY_IAP_ID environment variable, so we can fake a 11 connection change (though the signal will not be emitted when the 12 environment variable changes.) 13 1 14 2007-05-16 Philip Van Hoof <pvanhoof@gnome.org> 2 15 trunk/libtinymail-maemo/tny-maemo-conic-device.c
r1912 r1998 23 23 #include <tny-maemo-conic-device.h> 24 24 25 #ifdef MAEMO_CONIC_DUMMY 26 /* #include "coniciap-private.h" 27 * This is not installed, so we predeclare 28 * the struct instead. 29 * Of course, this is a hack and could break if the private API 30 * changes. 31 * It would be better for libconic to support scratchbox. 32 */ 33 struct _ConIcIap 34 { 35 GObject parent_instance; 36 gboolean dispose_has_run; 37 gchar *id; 38 gchar *name; 39 gchar *bearer; 40 }; 41 #endif /* MAEMO_CONIC_DUMMY */ 42 25 43 static gboolean tny_maemo_conic_device_is_online (TnyDevice *self); 26 44 … … 207 225 tny_maemo_conic_device_get_current_iap_id (TnyMaemoConicDevice *self) 208 226 { 209 TnyMaemoConicDevicePriv *priv;227 210 228 211 229 g_return_val_if_fail (TNY_IS_MAEMO_CONIC_DEVICE(self), NULL); 212 230 g_return_val_if_fail (tny_maemo_conic_device_is_online(TNY_DEVICE(self)), NULL); 213 231 214 priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self); 215 232 233 #ifdef MAEMO_CONIC_DUMMY 234 /* Allow debuggers to fake a connection change by setting an environment 235 * variable. This should match one of the fake iap IDs that we 236 * created in tny_maemo_conic_device_get_iap_list(). 237 */ 238 const gchar *env = g_getenv ("MAEMO_CONIC_DUMMY_IAP_ID"); 239 return env; 240 #else 241 TnyMaemoConicDevicePriv *priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self); 216 242 return priv->iap; 243 #endif 217 244 } 218 245 … … 267 294 g_return_val_if_fail (TNY_IS_MAEMO_CONIC_DEVICE(self), NULL); 268 295 296 #ifdef MAEMO_CONIC_DUMMY 297 /* libconic does not return a list of connections when running 298 * in scratchbox, though it might do this in future when 299 * "ethernet support" is implemented. 300 * So we return a fake list so we can exercise funcationality 301 * that uses connections: */ 302 GSList* result = NULL; 303 304 int i = 0; 305 for (i = 0; i < 10; ++i) { 306 /* con_ic_iap_new (id) would checkc for a gconf dir and 307 * fails, though _new() functions should just call g_object_new(). 308 * 309 gchar *id = g_strdup_printf("debug id%d", i); 310 ConIcIap *iap = con_ic_iap_new (id); 311 g_free (id); 312 */ 313 314 /* Note that we have re-declared the private struct so that we 315 * can do this, which is very bad and fragile: */ 316 ConIcIap *iap = g_object_new (CON_IC_TYPE_IAP, NULL); 317 iap->id = g_strdup_printf("debug id%d", i); 318 iap->name = g_strdup_printf("debug name%d", i); 319 320 result = g_slist_append (result, iap); 321 } 322 323 return result; 324 #else 269 325 priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self); 270 326 g_return_val_if_fail (priv->cnx, NULL); 271 327 272 328 return con_ic_connection_get_all_iaps (priv->cnx); 329 #endif 273 330 } 274 331
