Changeset 2648

Show
Ignore:
Timestamp:
08/15/07 17:05:43
Author:
pvanhoof
Message:

2007-08-15 Philip Van Hoof <pvanhoof@gnome.org>

        • Reading dnsmasq's resolv.conf files to know whether or not we

are initially online or not in libtinymail-maemo/tny-maemo-conic-device.c

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r2647 r2648  
     12007-08-15  Philip Van Hoof  <pvanhoof@gnome.org> 
     2 
     3        * Reading dnsmasq's resolv.conf files to know whether or not we are 
     4        initially online or not in libtinymail-maemo/tny-maemo-conic-device.c 
     5 
    162007-08-15  Murray Cumming  <murrayc@murrayc.com> 
    27 
  • trunk/libtinymail-maemo/tny-maemo-conic-device.c

    r2647 r2648  
    3535#ifdef MAEMO_CONIC_DUMMY 
    3636 
     37 
     38static gboolean 
     39dnsmasq_has_resolv (void) 
     40{ 
     41        /* This is because silly Conic does not have a blocking API that tells 
     42         * us immediately when the device is online. */ 
     43 
     44        if (!g_file_test ("/var/run/resolv.conf", G_FILE_TEST_EXISTS)) 
     45                if (!g_file_test ("/tmp/resolv.conf.wlan0", G_FILE_TEST_EXISTS)) 
     46                        if (!g_file_test ("/tmp/resolv.conf.ppp0", G_FILE_TEST_EXISTS)) 
     47                                return FALSE; 
     48 
     49        return TRUE; 
     50} 
     51 
    3752/* #include "coniciap-private.h" 
    3853 * This is not installed, so we predeclare the struct instead. Of course, this  
     
    123138                /* Emit it in an idle handler: */ 
    124139                EmitStatusInfo *info = g_slice_new (EmitStatusInfo); 
     140                guint time = 1; 
     141 
    125142                info->self = g_object_ref (self); 
    126143                info->status = status; 
    127                 g_timeout_add_full (G_PRIORITY_DEFAULT, 5000, conic_emit_status_idle, 
     144 
     145                if (!dnsmasq_has_resolv()) 
     146                        time = 5000; 
     147 
     148                g_timeout_add_full (G_PRIORITY_DEFAULT, time, conic_emit_status_idle, 
    128149                        info, conic_emit_status_destroy); 
    129150 
     
    268289{ 
    269290        int response = 0; 
    270          
     291 
    271292        /* Show a dialog, because libconic would show a dialog here, 
    272293         * and give the user a chance to refuse a new connection, because libconic would allow that too. 
     
    703724        priv->forced = FALSE; 
    704725        priv->iap = NULL; 
    705         /* priv->is_online = FALSE; */ 
    706  
    707         /* TODO: This is a hack that fixes a problem: Our signal is not emitted  
    708          * before the gtk mainloop is started, because we use an idle handler  
    709          * for that and we don't know how to detect when the mainloop has not  
    710          * yet started. The downside is that we now don't know that we are really  
    711          * offline, so we can't ask the user to go online. This must be fixed  
    712          * properly. */ 
    713  
    714         priv->is_online = TRUE;  
     726        priv->is_online = dnsmasq_has_resolv (); 
    715727 
    716728