/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/__init__.py

  • Committer: Jasper Groenewegen
  • Date: 2008-08-03 08:32:49 UTC
  • mfrom: (560.11.2 redo-bookmarks)
  • Revision ID: colbrac@xs4al.nl-20080803083249-41tcfqqj17o0w3zj
Merge of Olive bookmarks makeover

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
        # Initialize the statusbar
97
97
        self.context_id = self.window.statusbar.get_context_id('olive')
98
98
        
99
 
                # Get the TreeViews
100
 
        self.treeview_left = self.window.treeview_left
101
 
        
102
99
        # Get the drive selector
103
100
        self.combobox_drive = gtk.combo_box_new_text()
104
101
        self.combobox_drive.connect("changed", self._refresh_drives)
141
138
        # Acceptable errors when loading files/folders in the treeviews
142
139
        self.acceptable_errors = (errno.ENOENT, errno.ELOOP)
143
140
        
144
 
        self._load_left()
 
141
        self.refresh_left()
145
142
 
146
143
        # Apply menu state
147
144
        self.window.mb_view_showhidden.set_active(self.pref.get_preference('dotted_files', 'bool'))
873
870
        
874
871
        self.pref.write()
875
872
        self.window.destroy()
876
 
        
877
 
    def _load_left(self):
878
 
        """ Load data into the left panel. (Bookmarks) """
879
 
        # Create TreeStore
880
 
        treestore = gtk.TreeStore(str, str)
881
 
        
882
 
        # Get bookmarks
883
 
        bookmarks = self.pref.get_bookmarks()
884
 
        
885
 
        # Add them to the TreeStore
886
 
        titer = treestore.append(None, [_i18n('Bookmarks'), None])
887
 
 
888
 
        # Get titles and sort by title
889
 
        bookmarks = [[self.pref.get_bookmark_title(item), item] for item in bookmarks]
890
 
        bookmarks.sort()
891
 
        for title_item in bookmarks:
892
 
            treestore.append(titer, title_item)
893
 
        
894
 
        # Create the column and add it to the TreeView
895
 
        self.treeview_left.set_model(treestore)
896
 
        tvcolumn_bookmark = gtk.TreeViewColumn(_i18n('Bookmark'))
897
 
        self.treeview_left.append_column(tvcolumn_bookmark)
898
 
        
899
 
        # Set up the cells
900
 
        cell = gtk.CellRendererText()
901
 
        tvcolumn_bookmark.pack_start(cell, True)
902
 
        tvcolumn_bookmark.add_attribute(cell, 'text', 0)
903
 
        
904
 
        # Expand the tree
905
 
        self.treeview_left.expand_all()
906
 
       
 
873
    
907
874
    def get_selected_fileid(self):
908
875
        """ Get the file_id of the selected file. """
909
876
        treeselection = self.window.treeview_right.get_selection()
926
893
    
927
894
    def get_selected_left(self):
928
895
        """ Get the selected bookmark. """
929
 
        treeselection = self.treeview_left.get_selection()
 
896
        treeselection = self.window.treeview_left.get_selection()
930
897
        (model, iter) = treeselection.get_selected()
931
898
        
932
899
        if iter is None:
952
919
    def refresh_left(self):
953
920
        """ Refresh the bookmark list. """
954
921
        
955
 
        # Get TreeStore and clear it
956
 
        treestore = self.treeview_left.get_model()
957
 
        treestore.clear()
 
922
        # Get ListStore and clear it
 
923
        liststore = self.window.bookmarklist
 
924
        liststore.clear()
958
925
 
959
926
        # Re-read preferences
960
927
        self.pref.read()
962
929
        # Get bookmarks
963
930
        bookmarks = self.pref.get_bookmarks()
964
931
 
965
 
        # Add them to the TreeStore
966
 
        titer = treestore.append(None, [_i18n('Bookmarks'), None])
967
 
 
968
932
        # Get titles and sort by title
969
 
        bookmarks = [[self.pref.get_bookmark_title(item), item] for item in bookmarks]
 
933
        bookmarks = [[self.pref.get_bookmark_title(item), item, gtk.STOCK_DIRECTORY] for item in bookmarks]
970
934
        bookmarks.sort()
971
935
        for title_item in bookmarks:
972
 
            treestore.append(titer, title_item)
 
936
            liststore.append(title_item)
973
937
        
974
 
        # Add the TreeStore to the TreeView
975
 
        self.treeview_left.set_model(treestore)
976
 
 
977
 
        # Expand the tree
978
 
        self.treeview_left.expand_all()
 
938
        # Add the ListStore to the TreeView
 
939
        self.window.treeview_left.set_model(liststore)
979
940
 
980
941
    def refresh_right(self, path=None):
981
942
        """ Refresh the file list. """
993
954
            # Get ListStore and clear it
994
955
            liststore = self.window.filelist
995
956
            liststore.clear()
996
 
            
997
 
            # Show Status column
998
 
            self.window.col_status.set_visible(True)
999
957
    
1000
958
            dirs = []
1001
959
            files = []
1025
983
            
1026
984
                delta = tree1.changes_from(tree2, want_unchanged=True)
1027
985
                
 
986
                # Show Status column
 
987
                self.window.col_status.set_visible(True)
 
988
            else:
 
989
                # Don't show Status column
 
990
                self.window.col_status.set_visible(False)
 
991
                
1028
992
            # Add'em to the ListStore
1029
993
            for item in dirs:
1030
994
                status = ''