/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 branch.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
33
32
 
34
33
from dialog import error_dialog, info_dialog
35
34
 
 
35
from history import UrlHistory
36
36
 
37
37
class BranchDialog(gtk.Dialog):
38
38
    """ New implementation of the Branch dialog. """
101
101
        self.vbox.show_all()
102
102
        
103
103
        # Build branch history
 
104
        self._history = UrlHistory(GlobalConfig(), 'branch_history')
104
105
        self._build_history()
105
106
    
106
107
    def _build_history(self):
107
108
        """ Build up the branch history. """
108
 
        config = GlobalConfig()
109
 
        history = config.get_user_option('gbranch_history')
110
 
        if history is not None:
111
 
            self._combo_model = gtk.ListStore(str)
112
 
            for item in history.split(delimiter):
113
 
                self._combo_model.append([ item ])
114
 
            self._combo.set_model(self._combo_model)
115
 
            self._combo.set_text_column(0)
116
 
    
117
 
    def _add_to_history(self, location):
118
 
        """ Add specified location to the history (if not yet added). """
119
 
        config = GlobalConfig()
120
 
        history = config.get_user_option('gbranch_history')
121
 
        if history is None:
122
 
            config.set_user_option('gbranch_history', location)
123
 
        else:
124
 
            h = history.split(delimiter)
125
 
            if location not in h:
126
 
                h.append(location)
127
 
            config.set_user_option('gbranch_history', delimiter.join(h))                
 
109
        self._combo_model = gtk.ListStore(str)
 
110
        for item in self._history.get_entries():
 
111
            self._combo_model.append([ item ])
 
112
        self._combo.set_model(self._combo_model)
 
113
        self._combo.set_text_column(0)
128
114
    
129
115
    def _get_last_revno(self):
130
116
        """ Get the revno of the last revision (if any). """
205
191
        finally:
206
192
            br_from.unlock()
207
193
                
208
 
        self._add_to_history(location)
 
194
        self._history.add_entry(location)
209
195
        info_dialog(_('Branching successful'),
210
196
                    _('%d revision(s) branched.') % revs)
211
197