Ticket #139: zhone-registration.patch

File zhone-registration.patch, 2.2 KB (added by hedora, 4 years ago)

Move GSM registration handling from Register() callback to network Status signal handler

  • /usr/bin/

    old new  
    174174                self.main.groups["call"].onCallStatus( None, "outgoing", {"peer": "".join(self.text)} ) 
    175175        self.last = time.time() 
    176176 
     177    def onNetworkStatus( self, status ): 
     178        logger.info( "network status changed: %s" % status ) 
     179        #if(status.has_key("registration") != "busy")  # XXX this might work too.  which is better? 
     180        if(status.has_key('provider')): 
     181           self.main.agents["gsm"].setState("Registered: %s" % status['provider']) 
     182            self.main.groups["main"].targets["phone"] = True 
     183            self.main.groups["main"].update() 
     184            if dbus_object.gsm_sim_iface.GetSimReady(): 
     185                self.main.groups["contacts"].prepare() 
     186                self.main.groups["sms"].prepare() 
     187        else: 
     188           self.main.agents["gsm"].setState("Failed to register to network") 
     189           self.main.groups["main"].targets["phone"] = False 
     190           self.main.groups["main"].update() 
     191 
    177192#----------------------------------------------------------------------------# 
    178193class pyphone_call(edje_group): 
    179194#----------------------------------------------------------------------------# 
     
    17441759        self.cbDBusReady() 
    17451760 
    17461761    def cbRegisterReply( self ): 
    1747         self.setState( "Registered to network" ) 
    1748         self.main.groups["main"].targets["phone"] = True 
    1749         self.main.groups["main"].update() 
    1750         if dbus_object.gsm_sim_iface.GetSimReady(): 
    1751             self.main.groups["contacts"].prepare() 
    1752             self.main.groups["sms"].prepare() 
     1762       0 
    17531763 
    17541764    def cbRegisterError( self, e ): 
    1755         self.setState( "Failed to register to network" ) 
    17561765        logger.exception( e ) 
    17571766 
    17581767#----------------------------------------------------------------------------# 
     
    18191828        dbus_object.onReadyStatus.append( self.groups["sms"].onReadyStatus ) 
    18201829        dbus_object.onIncomingMessage.append( self.groups["sms"].onIncomingMessage ) 
    18211830        dbus_object.onIdleStateChanged.append( self.lock_on_idle ) 
     1831        dbus_object.onNetworkStatus.append( self.groups["phone"].onNetworkStatus ) 
    18221832 
    18231833        logger.debug( "GUI init done" )