Changeset 2956

Show
Ignore:
Timestamp:
11/15/07 16:29:37
Author:
svillar
Message:
  • Added support to specify if the connection request comes from an user
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r2954 r2956  
     12007-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 
    1102007-11-15  Philip Van Hoof  <pvanhoof@gnome.org> 
    211 
  • trunk/libtinymail-maemo/tny-maemo-conic-device.c

    r2933 r2956  
    307307 * @self: a #TnyDevice object 
    308308 * @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 
    309310 * @callback: a #TnyMaemoConicDeviceConnectCallback 
    310311 * @user_data: user data for @callback 
     
    318319tny_maemo_conic_device_connect_async (TnyMaemoConicDevice *self,  
    319320                                      const gchar* iap_id,  
     321                                      gboolean user_requested, 
    320322                                      TnyMaemoConicDeviceConnectCallback callback,  
    321323                                      gpointer user_data) 
     
    325327        ConnectInfo *info; 
    326328        GError *err = NULL; 
     329        ConIcConnectFlags flags; 
    327330 
    328331        priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self); 
     
    336339        priv->connect_slot = info; 
    337340 
     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 
    338347        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)) { 
    340349                        g_set_error (&err, TNY_ACCOUNT_ERROR, TNY_ERROR_UNSPEC, 
    341350                                "Could not send connect_by_id dbus message"); 
     
    343352                } 
    344353        } else { 
    345                 if (!con_ic_connection_connect (priv->cnx, CON_IC_CONNECT_FLAG_NONE)) { 
     354                if (!con_ic_connection_connect (priv->cnx, flags)) { 
    346355                        g_set_error (&err, TNY_ACCOUNT_ERROR, TNY_ERROR_UNSPEC, 
    347356                                "Could not send connect dbus message"); 
     
    702711 **/ 
    703712gboolean 
    704 tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, const gchar* iap_id) 
     713tny_maemo_conic_device_connect (TnyMaemoConicDevice *self,  
     714                                const gchar* iap_id, 
     715                                gboolean user_requested) 
    705716{ 
    706717        TnyMaemoConicDevicePriv *priv = NULL; 
    707718        gboolean request_failed = FALSE; 
     719        ConIcConnectFlags flags; 
    708720 
    709721        g_return_val_if_fail (TNY_IS_DEVICE(self), FALSE); 
     
    713725        priv->loop = g_main_loop_new(NULL, FALSE /* not running immediately. */); 
    714726 
     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 
    715733        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)) { 
    717735                        g_warning ("could not send connect_by_id dbus message"); 
    718736                        request_failed = TRUE; 
    719737                } 
    720738        } else { 
    721                 if (!con_ic_connection_connect (priv->cnx, CON_IC_CONNECT_FLAG_NONE)) { 
     739                if (!con_ic_connection_connect (priv->cnx, flags)) { 
    722740                        g_warning ("could not send connect dbus message"); 
    723741                        request_failed = TRUE; 
  • trunk/libtinymail-maemo/tny-maemo-conic-device.h

    r2933 r2956  
    5151}; 
    5252 
     53typedef void (*TnyMaemoConicDeviceConnectCallback) (TnyMaemoConicDevice *self, const gchar* iap_id, gboolean canceled, GError *err, gpointer user_data); 
     54 
     55 
    5356GType tny_maemo_conic_device_get_type (void); 
    5457 
    5558TnyDevice* tny_maemo_conic_device_new (void); 
    5659 
    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); 
     60gboolean tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, const gchar* iap_id, gboolean user_requested); 
     61void tny_maemo_conic_device_connect_async (TnyMaemoConicDevice *self, const gchar* iap_id, gboolean user_requested, TnyMaemoConicDeviceConnectCallback callback, gpointer user_data); 
    6362gboolean tny_maemo_conic_device_disconnect (TnyMaemoConicDevice *self, const gchar* iap_id); 
    6463const gchar* tny_maemo_conic_device_get_current_iap_id (TnyMaemoConicDevice *self); 
     
    7069 
    7170#endif 
    72  
  • trunk/libtinymail-maemo/tny-maemo-conic-dummy-device.c

    r2933 r2956  
    169169 
    170170static void  
    171 dummy_con_ic_connection_connect_by_id_async_cb (GtkWidget *dialog,  gint response, gpointer user_data) 
     171dummy_con_ic_connection_connect_by_id_async_cb (GtkWidget *dialog,   
     172                                                gint response,  
     173                                                gpointer user_data) 
    172174{ 
    173175        ConnectInfo *info = (ConnectInfo *) user_data; 
     
    210212 
    211213static void  
    212 dummy_con_ic_connection_connect_by_id_async (TnyMaemoConicDevice *self, const gchar* iap_id, TnyMaemoConicDeviceConnectCallback callback, gpointer user_data) 
     214dummy_con_ic_connection_connect_by_id_async (TnyMaemoConicDevice *self,  
     215                                             const gchar* iap_id,  
     216                                             TnyMaemoConicDeviceConnectCallback callback,  
     217                                             gpointer user_data) 
    213218{ 
    214219        ConnectInfo *info = g_slice_new0 (ConnectInfo); 
     
    241246 * @self: a #TnyDevice object 
    242247 * @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 
    243249 * @callback: a #TnyMaemoConicDeviceConnectCallback 
    244250 * @user_data: user data for @callback 
     
    250256 **/ 
    251257void   
    252 tny_maemo_conic_device_connect_async (TnyMaemoConicDevice *self, const gchar* iap_id, TnyMaemoConicDeviceConnectCallback callback, gpointer user_data) 
     258tny_maemo_conic_device_connect_async (TnyMaemoConicDevice *self,  
     259                                      const gchar* iap_id,  
     260                                      gboolean user_requested, 
     261                                      TnyMaemoConicDeviceConnectCallback callback,  
     262                                      gpointer user_data) 
    253263{ 
    254264        dummy_con_ic_connection_connect_by_id_async (self, iap_id, callback, user_data); 
     
    674684 
    675685gboolean 
    676 tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, const gchar* iap_id
     686tny_maemo_conic_device_connect (TnyMaemoConicDevice *self, const gchar* iap_id, gboolean user_requested
    677687{ 
    678688        return dummy_con_ic_connection_connect_by_id (self, iap_id);