³ò
Pt¡Ic           @   se   d  Z  d d k Z d d k Z d d k Z d d k Z d e i f d „  ƒ  YZ d „  Z d „  Z d S(   s0   deprecated.py - Clean up deprecated Comix files.iÿÿÿÿNt   _CleanerDialogc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s^   t  i i |  | d t  i t  i t d ƒ ƒ | |  _ |  i d |  i ƒ |  i	 t d ƒ ƒ d  S(   Ni    s1   There are deprecated files left on your computer.t   responses?  Some old files (that were used for storing preferences, the library, bookmarks etc. for older versions of Comix) were found on your computer. If you do not plan on using the older versions of Comix again, you should remove these files in order to save some disk space. Do you want these files to be removed for you now?(
   t   gtkt   MessageDialogt   __init__t   MESSAGE_QUESTIONt   BUTTONS_YES_NOt   _t   _pathst   connectt	   _responset   format_secondary_text(   t   selft   windowt   paths(    (    sJ   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/deprecated.pyR      s    	c         C   sŠ   | t  i j ol xi |  i D]Z } y5 t i i | ƒ o t i | ƒ n t i | ƒ Wq t	 j
 o d G| GHq Xq Wn |  i
 ƒ  d  S(   Ns   ! Could not remove(   R   t   RESPONSE_YESR   t   ost   patht   isdirt   shutilt   rmtreet   removet	   Exceptiont   destroy(   R   t   dialogR   R   (    (    sJ   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/deprecated.pyR
      s    
 (   t   __name__t
   __module__R   R
   (    (    (    sJ   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/deprecated.pyR       s   	c       	   C   sú   t  i i t i d ƒ }  d t i f d t i f d t i f d t i f f } x¥ | D] \ } } t  i i t  i i |  | ƒ ƒ oo t  i i t  i i | | ƒ ƒ oL y2 t  i t  i i |  | ƒ t  i i | | ƒ ƒ Wqò t	 j
 o qò XqU qU Wd S(   st   Move config and data files from the old Comix directory (~/.comix/)
    to the XDG config and data directories.
    s   .comixs   preferences.pickles   bookmarks.pickles
   library.dbt   library_coversN(
   R   R   t   joint	   constantst   HOME_DIRt
   CONFIG_DIRt   DATA_DIRt   existst   renameR   (   t   old_dirt   to_be_movedt   namet   new_dir(    (    sJ   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/deprecated.pyt   move_files_to_xdg_dirs%   s     +c         C   s“   t  i i t i d ƒ t  i i t i d ƒ f } g  } x2 | D]* } t  i i | ƒ o | i | ƒ q= q= W| o t |  | ƒ } | i ƒ  n d S(   s¥   Check for a number of deprecated files created by older versions of
    Comix. If any are found, we ask the user through a dilaog if they
    should be removed.
    s   .comixrcs   .comixN(	   R   R   R   R   R   R!   t   appendR    t   show_all(   R   t
   deprecatedt   foundR   R   (    (    sJ   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/deprecated.pyt   check_for_deprecated_files9   s     (	   t   __doc__R   R   R   R   R   R    R'   R,   (    (    (    sJ   /home/sork/Pontus/Programmering/Python/Comix/comix-4.0.4/src/deprecated.pys   <module>   s   	