Changeset 3577

Show
Ignore:
Timestamp:
04/14/08 16:28:37
Author:
djcb
Message:

* add some extra debugging information
* really disconnect, also in the iap = NULL case. the note in the code was wrong.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail-maemo/tny-maemo-conic-device.c

    r3545 r3577  
    8686        info  = (EmitStatusInfo *) user_data; 
    8787 
     88        g_debug ("%s: destroying %p (idle)", __FUNCTION__, user_data); 
     89 
    8890        /* We lock the gdk thread because tinymail wants implementations to do 
    8991         * this before emitting signals from within a g_idle_add_full callback. 
    9092         * See http://www.tinymail.org/trac/tinymail/wiki/HowTnyLockable */ 
    91  
    9293        gdk_threads_enter (); 
    9394        g_signal_emit (info->self, tny_device_signals [TNY_DEVICE_CONNECTION_CHANGED], 
     
    9596        gdk_threads_leave (); 
    9697 
     98        g_debug ("%s: emitted tny-device-connection-changed signal", __FUNCTION__); 
     99 
    97100        return FALSE; 
    98101} 
     
    107110        info = (EmitStatusInfo *) user_data; 
    108111         
     112        g_debug ("%s: destroying status info (%p)", __FUNCTION__, user_data); 
     113 
    109114        if (G_IS_OBJECT(info->self)) 
    110115                g_object_unref (info->self); 
    111116         
    112117        g_slice_free (EmitStatusInfo, info); 
     118 
     119        g_debug ("%s: destroyed %p", __FUNCTION__, user_data); 
    113120} 
    114121 
     
    129136        if (!dnsmasq_has_resolv()) 
    130137                time = 5000; 
     138 
     139        g_debug ("%s: emitting status (%s, %s) in %d ms",  
     140                   __FUNCTION__, info, status ? "true" : "false", time); 
    131141 
    132142        g_timeout_add_full (G_PRIORITY_DEFAULT, time, conic_emit_status_idle, 
     
    212222} HandleConnInfo; 
    213223 
    214 static gboolean /* FIXME: this function will always return FALSE, is that correct? */ 
     224static gboolean  
    215225handle_con_idle (gpointer data) 
    216226{ 
     
    418428        if (iap_id) { 
    419429                if (!con_ic_connection_disconnect_by_id (priv->cnx, iap_id)) { 
    420                         g_warning ("Could not send disconnect_by_id dbus message"); 
     430                        g_warning ("%s: disconnect_by_id failed (%s)",  
     431                                   __FUNCTION__, iap_id); 
    421432                        return FALSE; 
    422433                } 
    423         } else { 
    424                 /* don't try to disconnect if iap_id==NULL, or conic will crash... */ 
    425                 g_warning ("Could not send disconnect dbus message"); 
     434        } else  
     435                if (!con_ic_connection_disconnect (priv->cnx)) 
     436                       g_warning ("Could not send disconnect dbus message"); 
    426437                return FALSE; 
    427438        } 
     
    594605        priv->cnx = con_ic_connection_new (); 
    595606 
    596         if (!priv->cnx) 
    597                 g_warning ("con_ic_connection_new failed. The TnyMaemoConicDevice will be useless."); 
     607        if (!priv->cnx) {        
     608                g_warning ("%s: con_ic_connection_new failed.", __FUNCTION__); 
     609                return; 
     610        } 
    598611 
    599612        /* This might be necessary to make the connection object actually emit  
     
    609622         * thus, this will setup our state correctly when we receive the signals. */ 
    610623        if (!con_ic_connection_connect (priv->cnx, CON_IC_CONNECT_FLAG_AUTOMATICALLY_TRIGGERED)) 
    611                 g_warning ("could not send connect dbus message"); 
    612  
    613         return; 
     624                g_warning ("%s: could not send connect dbus message", 
     625                        __FUNCTION__);   
    614626} 
    615627 
     
    632644 
    633645        g_return_if_fail (obj && G_IS_OBJECT(obj)); 
     646 
     647        g_debug ("%s", __FUNCTION__); 
    634648         
    635649        priv = TNY_MAEMO_CONIC_DEVICE_GET_PRIVATE (obj); 
     650 
    636651        if (g_signal_handler_is_connected (priv->cnx, priv->signal1)) 
    637652                g_signal_handler_disconnect (priv->cnx, priv->signal1); 
    638653 
    639654        if (priv->cnx && CON_IC_IS_CONNECTION(priv->cnx)) { 
    640                 tny_maemo_conic_device_disconnect (TNY_MAEMO_CONIC_DEVICE(obj),priv->iap); 
     655                tny_maemo_conic_device_disconnect (TNY_MAEMO_CONIC_DEVICE(obj), 
     656                                                   priv->iap); 
    641657                g_object_unref (priv->cnx); 
    642658                priv->cnx = NULL;