ó
ÍÿŠTc           @   s±   d  d l  Z  d  d l m Z d  d l m Z m Z m Z d  d l m Z d  d l	 m
 Z
 d  d l m Z d  d l m Z d  d l m Z d	 Z d
 Z d e j f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   gettext(   t   Giot   Gtkt   Notify(   t   ConfigurationProxy(   t   ConfigurationModel(   t
   UISettings(   t   ClientSettingsDialog(   t   ConfigControllers*   com.canonical.landscape-client.settings.uis   Landscape management servicet   SettingsApplicationControllerc           B   se   e  Z d  Z g  d „ Z d „  Z d „  Z d „  Z d „  Z d	 d „ Z	 d	 d „ Z
 d	 e d „ Z RS(
   sM   
    Core application controller for the landscape settings application.
    c         C   s9   t  t |  ƒ j d t ƒ | |  _ |  j d |  j ƒ d  S(   Nt   application_idt   activate(   t   superR	   t   __init__t   APPLICATION_IDt   _argst   connectt   setup_ui(   t   selft   args(    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyR      s    	c         C   s   t  ƒ  S(   N(   R   (   R   (    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyt
   get_config   s    c         C   s   t  t j ƒ S(   N(   R   R   t   Settings(   R   (    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyt   get_uisettings    s    c         C   s&   t  j j t | d ƒ } | j ƒ  d  S(   Ns   dialog-information(   R   t   Notificationt   newt	   NOTIFY_IDt   show(   R   t   messaget   notification(    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyt	   on_notify#   s    	c         C   s&   t  j j t | d ƒ } | j ƒ  d  S(   Ns   dialog-information(   R   R   R   R   R   (   R   R   R   (    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyt   on_error(   s    	c         C   sA   | r | } n t  d ƒ } t j j t | d ƒ } | j ƒ  d  S(   Ns   Success.s   dialog-information(   t   _R   R   R   R   R   (   R   t   actionR   R   (    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyt
   on_succeed-   s    		c         C   sA   | r | } n t  d ƒ } t j j t | d ƒ } | j ƒ  d  S(   Ns   Failure.s   dialog-information(   R   R   R   R   R   R   (   R   R    R   R   (    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyt   on_fail6   s    		c         C   sô   t  j t ƒ |  j ƒ  } |  j ƒ  } t d | d |  j d | ƒ } t | ƒ } | j ƒ  rÊ t	 | ƒ |  _
 |  j
 j ƒ  t j j k rª | j |  j |  j |  j |  j ƒ n  | j d | ƒ |  j
 j ƒ  n& |  j d t d ƒ ƒ t j j d ƒ d S(	   s  
        L{setup_ui} wires the model to the L{ConfigurationController} and then
        invokes the view with the controller.  When the dialog exits
        appropriate termination is triggered.

        @param data: the Gtk callback could pass this, but it is always None in
        practice.
        @param asynchronous: a parameter passed through to
        L{ConfigurationController.exit}, it indicates whether the exit method
        should be called asynchronously.  Is makes testing easier to use it
        synchronously.
        t   proxyt   proxy_loadargst
   uisettingst   asynchronousR    s   Authentication faileds   Authentication failed.
N(   R   t   initR   R   R   R   R   R   t   loadR   t   settings_dialogt   runR   t   ResponseTypet   OKt   persistR   R   R!   R"   t   exitt   destroyR   t   syst   stderrt   write(   R   t   dataR&   t   configR%   t   modelt
   controller(    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyR   ?   s    	N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   t   NoneR!   R"   t   TrueR   (    (    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyR	      s   						(   R0   R    R   t   gi.repositoryR   R   R   t&   landscape.ui.model.configuration.proxyR   t&   landscape.ui.model.configuration.stateR   t+   landscape.ui.model.configuration.uisettingsR   t   landscape.ui.view.configurationR   t%   landscape.ui.controller.configurationR   R   R   t   ApplicationR	   (    (    (    s?   /usr/lib/python2.7/dist-packages/landscape/ui/controller/app.pyt   <module>   s   