
    Eg                     B    d dl mZmZmZ  G d dej                        Zy)    )GioGObjectGLibc                   D     e Zd ZdZ fdZddZddZd Zd Zd Z	 xZ
S )	
BaseClientaT  
    The base constructor for all of our generated GDBusProxies.

    This initializes and sets self.proxy, then fires on_client_setup_complete()
    or on_failure(), which the subclasses implement, depending on the outcome.

    These clients are technically one more level of abstraction than would be
    needed in a perfect world, where all dbus proxies work as they should and
    are supported properly by the actual providers they proxy for, but they
    provide a convenient and relatively clean way of implementing workarounds
    and alternate ways of retrieving or calculating values when the interface
    itself is broken in some way (this is common.)

    They also provide a bit of fault tolerance in cases where one or more of
    these providers do not exist on the bus, and we can provide sane default
    values for our widgets.
    c                     t         t        |           || _        || _        d| _        t        j                  ||t        j                  j                  | j                  | j                        | _        y)z
        Asynchronously initialize the GDBusProxy - we'll call
        on_client_setup_complete() or on_failure() depending on this outcome.
        N)superr   __init__proxy_classpathproxyr   bus_watch_nameBusNameWatcherFlagsNONE_on_appeared
on_failurewatch_name_id)selfbustyper   servicer   	__class__s        7/usr/share/cinnamon-screensaver/dbusdepot/baseClient.pyr
   zBaseClient.__init__   s`    
 	j$(*&	
 //07030G0G0L0L040A0A04	A    c                 <   	 | j                   j                  |t        j                  j                  || j
                  d | j                         t        j                  | j                         y # t        j                  $ r d | _	        | j                          Y Lw xY wN)r   newr   DBusProxyFlagsr   r   _on_proxy_readyr   Errorr   r   bus_unwatch_namer   )r   
connectionname
name_ownerdatas        r   r   zBaseClient._on_appeared)   s~    		  !$!3!3!8!8!%!%!%!%!5!57 	T//0	 zz 	DJOO	s   AA. .*BBc                 d    | j                   j                  |      | _        | j                          y r   )r   
new_finishr   on_client_setup_complete)r   objectresultr$   s       r   r   zBaseClient._on_proxy_ready7   s&    %%008
%%'r   c                 V    | j                   xr | j                   j                         duS )z`
        Use this as a safety check to see if a given proxy is valid
        and owned.
        N)r   get_name_ownerr   s    r   ensure_proxy_alivezBaseClient.ensure_proxy_alive<   s%    
 zzEdjj779EEr   c                 $    t        d       t        )zz
        Subclasses must implement this - to complete setup after self.proxy is
        successfully initialized.
        zNYou need to implement on_client_setup_complete(self) in your real client class)printNotImplementedErrorr,   s    r   r'   z#BaseClient.on_client_setup_completeC   s    
 	^_!!r   c                      y)z
        Can be implemented by subclasses, but not necessary.  Nothing further is done anyhow
        if on_client_setup_complete() is never called.
        N )r   argss     r   r   zBaseClient.on_failureK   s    
 	r   r   )__name__
__module____qualname____doc__r
   r   r   r-   r'   r   __classcell__)r   s   @r   r   r      s(    "A$1(
F"r   r   N)gi.repositoryr   r   r   r   r2   r   r   <module>r:      s    - ,K Kr   