ó
Ì’ÏOc           @   s…   d  d l  Z  d  d l m Z m Z m Z m Z e e  j j e  j j	 e
 ƒ d ƒ ƒ j ƒ  d d  !Z d e j e j f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   Gtkt	   GdkPixbuft   Nautilust   GObjectt   VERSIONi    t   Emblemsc           B   sV   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e d „  ƒ Z	 d „  Z
 RS(   c         C   s   d  S(   N(    (   t   self(    (    s
   emblems.pyt   __init__	   s    c         C   s?   | |  _  |  j | ƒ } |  j ƒ  } |  j | ƒ |  j ƒ  | S(   N(   t   filest   get_actual_emblemst   create_property_paget   fill_emblemst   connect_signals(   R   R   t   actual_emblemst   property_page(    (    s
   emblems.pyt   get_property_pages   s    	
c         C   sÈ   t  j d ƒ } | j ƒ  t  j t j t t ƒ |  _ t  j ƒ  |  _	 |  j	 j
 |  j ƒ |  j	 j d ƒ |  j	 j d ƒ |  j	 j ƒ  t  j ƒ  } | j |  j	 ƒ | j ƒ  t j d d d | d | ƒ f S(   NR   i    i   t   names   NautilusPython::emblemst   labelt   page(   R    t   Labelt   showt	   ListStoreR   t   Pixbuft   strt
   list_storet   IconViewt	   icon_viewt	   set_modelt   set_pixbuf_columnt   set_text_columnt   ScrolledWindowt   addR   t   PropertyPage(   R   t   property_labelt   scroll(    (    s
   emblems.pyR
      s    

c         C   s   |  j  j d |  j ƒ d  S(   Ns   selection-changed(   R   t   connectt   on_selection_changed(   R   (    (    s
   emblems.pyR   *   s    c         C   s“   xŒ |  j  D] } d | j ƒ  } t j d | ƒ d j g  | j ƒ  D] } | j ƒ  | d ^ qD ƒ } t j d | | f ƒ | j | ƒ q
 Wd  S(   Ns   gvfs-set-attribute "%s" -ts   %s unset metadata::emblemst    i   s   %s stringv metadata::emblems %s(   R   t   get_urit   ost   systemt   joint   get_selected_itemst	   get_modelt
   add_emblem(   R   t   widgett   filet   partial_cmdt   itemt   emblem(    (    s
   emblems.pyR$   -   s    	-c         C   s   g  S(   N(    (   R   R   (    (    s
   emblems.pyR	   :   s    c         C   sL   |  j  d d ƒ }  |  j  d d ƒ }  |  j  d d ƒ }  |  d j ƒ  |  d S(   sy   Returns the name human readable.

        >>> Emblems.get_icon_name('emblem-test-name-emblem')
        Test name
        s   -emblemR%   s   emblem-t   -t    i    i   (   t   replacet   upper(   R   (    (    s
   emblems.pyt   get_icon_name=   s    c         C   sy   t  j j ƒ  } | j d ƒ } xT | D]L } d | k r% | j | d d ƒ } |  j j | |  j | ƒ | g ƒ q% q% Wd S(   s0   Fill the listore with the proper icons.
        R1   i0   i    N(	   R    t	   IconThemet   get_defaultt
   list_iconst   Nonet	   load_iconR   t   appendR6   (   R   R   t   themet   iconst   icont   pixbuf(    (    s
   emblems.pyR   I   s    (   t   __name__t
   __module__R   R   R
   R   R$   R	   t   staticmethodR6   R   (    (    (    s
   emblems.pyR      s   						(   R'   t   gi.repositoryR    R   R   R   t   opent   pathR)   t   dirnamet   __file__t   readt   __version__t   PropertyPageProviderR   (    (    (    s
   emblems.pyt   <module>   s   "1