Changeset 2956
- Timestamp:
- 11/15/07 16:29:37
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/libtinymail-maemo/tny-maemo-conic-device.c (modified) (7 diffs)
- trunk/libtinymail-maemo/tny-maemo-conic-device.h (modified) (2 diffs)
- trunk/libtinymail-maemo/tny-maemo-conic-dummy-device.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r2954 r2956 1 2007-11-15 Sergio Villar Senin <svillar@igalia.com> 2 3 * libtinymail-maemo/tny-maemo-conic-device.c: 4 (tny_maemo_conic_device_connect): 5 (tny_maemo_conic_device_connect_async): added a new parametter called 6 user_requested that specifies whether or not the connection was 7 requested by an user or by an automatic system (like a daemon). This 8 allows the connection not to succed when the device is sleeping. 9 1 10 2007-11-15 Philip Van Hoof <pvanhoof@gnome.org> 2 11 trunk/libtinymail-maemo/tny-maemo-conic-device.c
r2933 r2956 307 307 * @self: a #TnyDevice object 308 308 * @iap_id: the id of the Internet Access Point (IAP), or NULL for 'any; 309 * @user_requested: whether or not the connection was automatically requested or by an user action 309 310 * @callback: a #TnyMaemoConicDeviceConnectCallback 310 311 * @user_data: user data for @callback … … 318 319 tny_maemo_conic_device_connect_async (TnyMaemoConicDevice *self, 319 320 const gchar* iap_id, 321 gboolean user_requested, 320 322 TnyMaemoConicDeviceConnectCallback callback, 321 323 gpointer user_data) … … 325 327 ConnectInfo *info; 326 328 GError *err = NULL; 329 ConIcConnectFlags flags; 327 330 328 331 priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self); … … 336 339 priv->connect_slot = info; 337 340 341 /* Set the flags */ 342 if (user_requested) 343 flags = CON_IC_CONNECT_FLAG_NONE; 344 else 345 flags = CON_IC_CONNECT_FLAG_AUTOMATICALLY_TRIGGERED; 346 338 347 if (iap_id) { 339 if (!con_ic_connection_connect_by_id (priv->cnx, iap_id, CON_IC_CONNECT_FLAG_NONE)) {348 if (!con_ic_connection_connect_by_id (priv->cnx, iap_id, flags)) { 340 349 g_set_error (&err, TNY_ACCOUNT_ERROR, TNY_ERROR_UNSPEC, 341 350 "Could not send connect_by_id dbus message"); … … 343 352 } 344 353 } else { 345 if (!con_ic_connection_connect (priv->cnx, CON_IC_CONNECT_FLAG_NONE)) {354 if (!con_ic_connection_connect (priv->cnx, flags)) { 346 355 g_set_error (&err, TNY_ACCOUNT_ERROR, TNY_ERROR_UNSPEC, 347 356 "Could not send connect dbus message"); … … 702 711 **/ 703 712 gboolean 704 tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, const gchar* iap_id) 713 tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, 714 const gchar* iap_id, 715 gboolean user_requested) 705 716 { 706 717 TnyMaemoConicDevicePriv *priv = NULL; 707 718 gboolean request_failed = FALSE; 719 ConIcConnectFlags flags; 708 720 709 721 g_return_val_if_fail (TNY_IS_DEVICE(self), FALSE); … … 713 725 priv->loop = g_main_loop_new(NULL, FALSE /* not running immediately. */); 714 726 727 /* Set the flags */ 728 if (user_requested) 729 flags = CON_IC_CONNECT_FLAG_NONE; 730 else 731 flags = CON_IC_CONNECT_FLAG_AUTOMATICALLY_TRIGGERED; 732 715 733 if (iap_id) { 716 if (!con_ic_connection_connect_by_id (priv->cnx, iap_id, CON_IC_CONNECT_FLAG_NONE)) {734 if (!con_ic_connection_connect_by_id (priv->cnx, iap_id, flags)) { 717 735 g_warning ("could not send connect_by_id dbus message"); 718 736 request_failed = TRUE; 719 737 } 720 738 } else { 721 if (!con_ic_connection_connect (priv->cnx, CON_IC_CONNECT_FLAG_NONE)) {739 if (!con_ic_connection_connect (priv->cnx, flags)) { 722 740 g_warning ("could not send connect dbus message"); 723 741 request_failed = TRUE; trunk/libtinymail-maemo/tny-maemo-conic-device.h
r2933 r2956 51 51 }; 52 52 53 typedef void (*TnyMaemoConicDeviceConnectCallback) (TnyMaemoConicDevice *self, const gchar* iap_id, gboolean canceled, GError *err, gpointer user_data); 54 55 53 56 GType tny_maemo_conic_device_get_type (void); 54 57 55 58 TnyDevice* tny_maemo_conic_device_new (void); 56 59 57 gboolean tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, const gchar* iap_id); 58 typedef void (*TnyMaemoConicDeviceConnectCallback) (TnyMaemoConicDevice *self, const gchar* iap_id, gboolean canceled, GError *err, gpointer user_data); 59 void tny_maemo_conic_device_connect_async (TnyMaemoConicDevice *self, 60 const gchar* iap_id, 61 TnyMaemoConicDeviceConnectCallback callback, 62 gpointer user_data); 60 gboolean tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, const gchar* iap_id, gboolean user_requested); 61 void tny_maemo_conic_device_connect_async (TnyMaemoConicDevice *self, const gchar* iap_id, gboolean user_requested, TnyMaemoConicDeviceConnectCallback callback, gpointer user_data); 63 62 gboolean tny_maemo_conic_device_disconnect (TnyMaemoConicDevice *self, const gchar* iap_id); 64 63 const gchar* tny_maemo_conic_device_get_current_iap_id (TnyMaemoConicDevice *self); … … 70 69 71 70 #endif 72 trunk/libtinymail-maemo/tny-maemo-conic-dummy-device.c
r2933 r2956 169 169 170 170 static void 171 dummy_con_ic_connection_connect_by_id_async_cb (GtkWidget *dialog, gint response, gpointer user_data) 171 dummy_con_ic_connection_connect_by_id_async_cb (GtkWidget *dialog, 172 gint response, 173 gpointer user_data) 172 174 { 173 175 ConnectInfo *info = (ConnectInfo *) user_data; … … 210 212 211 213 static void 212 dummy_con_ic_connection_connect_by_id_async (TnyMaemoConicDevice *self, const gchar* iap_id, TnyMaemoConicDeviceConnectCallback callback, gpointer user_data) 214 dummy_con_ic_connection_connect_by_id_async (TnyMaemoConicDevice *self, 215 const gchar* iap_id, 216 TnyMaemoConicDeviceConnectCallback callback, 217 gpointer user_data) 213 218 { 214 219 ConnectInfo *info = g_slice_new0 (ConnectInfo); … … 241 246 * @self: a #TnyDevice object 242 247 * @iap_id: the id of the Internet Access Point (IAP), or NULL for 'any; 248 * @user_requested: whether or not the connection was automatically requested or by an user action 243 249 * @callback: a #TnyMaemoConicDeviceConnectCallback 244 250 * @user_data: user data for @callback … … 250 256 **/ 251 257 void 252 tny_maemo_conic_device_connect_async (TnyMaemoConicDevice *self, const gchar* iap_id, TnyMaemoConicDeviceConnectCallback callback, gpointer user_data) 258 tny_maemo_conic_device_connect_async (TnyMaemoConicDevice *self, 259 const gchar* iap_id, 260 gboolean user_requested, 261 TnyMaemoConicDeviceConnectCallback callback, 262 gpointer user_data) 253 263 { 254 264 dummy_con_ic_connection_connect_by_id_async (self, iap_id, callback, user_data); … … 674 684 675 685 gboolean 676 tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, const gchar* iap_id )686 tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, const gchar* iap_id, gboolean user_requested) 677 687 { 678 688 return dummy_con_ic_connection_connect_by_id (self, iap_id);
