/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 checkout.py

  • Committer: Jelmer Vernooij
  • Date: 2007-02-03 15:04:56 UTC
  • Revision ID: jelmer@samba.org-20070203150456-t3ednkxql05rzg0m
Add trivial generic class for storing URL history.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
import gtk
26
26
 
27
 
from olive import delimiter
28
27
from errors import show_bzr_error
29
28
 
30
29
from bzrlib.branch import Branch
31
30
from bzrlib.config import GlobalConfig
32
31
 
33
 
from olive.dialog import error_dialog
 
32
from dialog import error_dialog
34
33
 
 
34
from history import UrlHistory
35
35
 
36
36
class CheckoutDialog(gtk.Dialog):
37
37
    """ New implementation of the Checkout dialog. """
103
103
        self.vbox.show_all()
104
104
        
105
105
        # Build checkout history
 
106
        self._history = UrlHistory(GlobalConfig(), 'branch_history')
106
107
        self._build_history()
107
108
    
108
109
    def _build_history(self):
109
110
        """ Build up the checkout history. """
110
 
        config = GlobalConfig()
111
 
        history = config.get_user_option('gcheckout_history')
112
 
        if history is not None:
113
 
            self._combo_model = gtk.ListStore(str)
114
 
            for item in history.split(delimiter):
115
 
                self._combo_model.append([ item ])
116
 
            self._combo.set_model(self._combo_model)
117
 
            self._combo.set_text_column(0)
118
 
    
119
 
    def _add_to_history(self, location):
120
 
        """ Add specified location to the history (if not yet added). """
121
 
        config = GlobalConfig()
122
 
        history = config.get_user_option('gcheckout_history')
123
 
        if history is None:
124
 
            config.set_user_option('gcheckout_history', location)
125
 
        else:
126
 
            h = history.split(delimiter)
127
 
            if location not in h:
128
 
                h.append(location)
129
 
            config.set_user_option('gcheckout_history', delimiter.join(h))                
 
111
        self._combo_model = gtk.ListStore(str)
 
112
        for item in self._history.get_entries():
 
113
            self._combo_model.append([ item ])
 
114
        self._combo.set_model(self._combo_model)
 
115
        self._combo.set_text_column(0)
130
116
    
131
117
    def _get_last_revno(self):
132
118
        """ Get the revno of the last revision (if any). """
189
175
        
190
176
        br_from.create_checkout(to_location, revision_id, lightweight)
191
177
        
192
 
        self._add_to_history(location)
 
178
        self._history.add_entry(location)
193
179
        
194
180
        self.response(gtk.RESPONSE_OK)
195
181