Changeset 2372

Show
Ignore:
Timestamp:
07/04/07 11:26:55
Author:
murrayc
Message:

2007-07-04 Murray Cumming <murrayc@murrayc.com>

        • libtinymail-maemo/tny-maemo-conic-device.c:

(on_dummy_connection_check): Set is_online here instead of waiting for it to be
set in the signal, becacuse this is used to do a quick check without waiting for the timout
to check the file.
(tny_maemo_conic_device_is_online): In the dummy scratchbox implementation, call
on_dummy_connection_check() before returning is_online, so that it is accurate.

(tny_maemo_conic_device_instance_init),
(tny_maemo_conic_device_finalize): Don't use libconic at all if we are in scratchbox,
because it signals that there is no connection, which confuses our dummy implementation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r2370 r2372  
     12007-07-04  Murray Cumming  <murrayc@murrayc.com> 
     2 
     3        * libtinymail-maemo/tny-maemo-conic-device.c: 
     4        (on_dummy_connection_check): Set is_online here instead of waiting for it to be  
     5        set in the signal, becacuse this is used to do a quick check without waiting for the timout  
     6        to check the file. 
     7        (tny_maemo_conic_device_is_online): In the dummy scratchbox implementation, call  
     8        on_dummy_connection_check() before returning is_online, so that it is accurate. 
     9 
     10        (tny_maemo_conic_device_instance_init), 
     11        (tny_maemo_conic_device_finalize): Don't use libconic at all if we are in scratchbox,  
     12        because it signals that there is no connection, which confuses our dummy implementation. 
     13 
    1142007-07-04  Philip Van Hoof  <pvanhoof@gnome.org> 
    215 
  • trunk/libtinymail-maemo/tny-maemo-conic-device.c

    r2339 r2372  
    195195                        GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL,  
    196196                        "TnyMaemoConicDevice fake scratchbox implementation:\nThe application requested a connection. Make a fake connection?")); 
     197        printf ("DEBUG: %s before gtk_dialog_run()\n", __FUNCTION__); 
    197198        const int response = gtk_dialog_run (dialog); 
     199        printf ("DEBUG: %s after gtk_dialog_run()\n", __FUNCTION__); 
    198200        gtk_widget_hide (GTK_WIDGET (dialog)); 
    199201        gtk_widget_destroy (GTK_WIDGET (dialog)); 
     
    353355         
    354356        #ifdef MAEMO_CONIC_DUMMY 
    355         if (!(priv->iap)) { 
    356                 on_dummy_connection_check (self); 
    357         } 
     357        on_dummy_connection_check (self); 
    358358         
    359359        /* Handle the special "none" text: */ 
     
    531531 
    532532 
    533 static gboolean 
    534 tny_maemo_conic_device_is_online (TnyDevice *self) 
    535 { 
    536 #ifdef MAEMO_CONIC_DUMMY 
    537         return TRUE; 
    538 #endif /*MAEMO_CONIC_DUMMY*/ 
    539          
    540         g_return_val_if_fail (TNY_IS_DEVICE(self), FALSE);       
    541  
    542         return TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self)->is_online; 
    543 } 
    544  
    545533#ifdef MAEMO_CONIC_DUMMY 
    546534 
     
    580568                priv->iap = g_strdup (contents); 
    581569                 
    582                 if (strcmp (priv->iap, MAEMO_CONIC_DUMMY_IAP_ID_NONE) == 0) {            
    583                         printf ("DEBUG: TnyMaemoConicDevice: %s:\n  Dummy connection changing to no connection.\n", __FUNCTION__); 
    584                         g_signal_emit (self, tny_device_signals [TNY_DEVICE_CONNECTION_CHANGED], 
    585                                0, FALSE); 
     570                if (strcmp (priv->iap, MAEMO_CONIC_DUMMY_IAP_ID_NONE) == 0) { 
     571                        priv->is_online = FALSE; 
     572                        printf ("DEBUG: TnyMaemoConicDevice: %s:\n  Dummy connection changed to no connection.\n", __FUNCTION__); 
    586573                } else { 
    587                         printf ("DEBUG: TnyMaemoConicDevice: %s:\n  Dummy connection changing to '%s\n", __FUNCTION__, priv->iap); 
    588                         g_signal_emit (self, tny_device_signals [TNY_DEVICE_CONNECTION_CHANGED], 
    589                        0, TRUE); 
     574                        priv->is_online = TRUE; 
     575                        printf ("DEBUG: TnyMaemoConicDevice: %s:\n  Dummy connection changed to '%s\n", __FUNCTION__, priv->iap); 
    590576                } 
     577                 
     578                g_signal_emit (self, tny_device_signals [TNY_DEVICE_CONNECTION_CHANGED], 
     579                       0, priv->is_online); 
    591580        } 
    592581         
     
    598587#endif /* MAEMO_CONIC_DUMMY */ 
    599588 
     589static gboolean 
     590tny_maemo_conic_device_is_online (TnyDevice *self) 
     591{ 
     592        g_return_val_if_fail (TNY_IS_DEVICE(self), FALSE);       
     593 
     594        on_dummy_connection_check(self); 
     595         
     596        return TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self)->is_online; 
     597} 
    600598 
    601599 
     
    607605        TnyMaemoConicDevicePriv *priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (self); 
    608606        priv->iap = NULL; 
     607         
     608        #ifndef MAEMO_CONIC_DUMMY 
    609609        priv->cnx = con_ic_connection_new (); 
    610610        if (!priv->cnx) { 
     
    629629        if (!con_ic_connection_connect (priv->cnx, CON_IC_CONNECT_FLAG_AUTOMATICALLY_TRIGGERED)) 
    630630                g_warning ("could not send connect dbus message"); 
    631          
     631                 
     632        #endif /* MAEMO_CONIC_DUMMY */ 
    632633         
    633634        priv->is_online     = FALSE;  
     
    665666        TnyMaemoConicDevicePriv *priv; 
    666667        priv   = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (obj); 
     668         
     669        #ifndef MAEMO_CONIC_DUMMY 
    667670        if (priv->cnx && CON_IC_IS_CONNECTION(priv->cnx)) { 
    668671                if (!tny_maemo_conic_device_disconnect (TNY_MAEMO_CONIC_DEVICE(obj),priv->iap)) 
     
    671674                priv->cnx = NULL; 
    672675        } 
     676        #endif /* MAEMO_CONIC_DUMMY */ 
    673677 
    674678        #ifdef MAEMO_CONIC_DUMMY