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

  • Committer: Jelmer Vernooij
  • Date: 2008-06-29 16:20:15 UTC
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: jelmer@samba.org-20080629162015-amhe7xj4cdmup4id
Rename GtkProgressBarStack to GtkWindowProgressBarStack

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
except:
21
21
    pass
22
22
 
 
23
from bzrlib.branch import Branch
 
24
from bzrlib.config import GlobalConfig
23
25
import gtk
 
26
from history import UrlHistory
 
27
from olive import Preferences
24
28
import gobject
25
29
 
26
 
from bzrlib.branch import Branch
27
 
from bzrlib.config import GlobalConfig
28
 
 
29
 
from bzrlib.plugins.gtk.history import UrlHistory
30
 
 
31
30
class BranchSelectionBox(gtk.HBox):
32
 
 
33
31
    def __init__(self, path=None):
34
 
        gobject.GObject.__init__(self)
 
32
        super(BranchSelectionBox, self).__init__()
35
33
        self._combo = gtk.ComboBoxEntry()
36
34
        self._combo.child.connect('focus-out-event', self._on_combo_changed)
37
 
 
 
35
        
38
36
        # Build branch history
39
37
        self._history = UrlHistory(GlobalConfig(), 'branch_history')
40
38
        self._build_history()
41
39
 
42
40
        self.add(self._combo)
43
41
 
 
42
        gobject.signal_new('branch-changed', BranchSelectionBox, 
 
43
                           gobject.SIGNAL_RUN_LAST,
 
44
                           gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))
 
45
 
44
46
        if path is not None:
45
47
            self.set_url(path)
46
48
 
56
58
    def _build_history(self):
57
59
        """ Build up the branch history. """
58
60
        self._combo_model = gtk.ListStore(str)
59
 
 
 
61
        
60
62
        for item in self._history.get_entries():
61
63
            self._combo_model.append([ item ])
62
 
 
 
64
        
 
65
        pref = Preferences()
 
66
        for item in pref.get_bookmarks():
 
67
            self._combo_model.append([ item ])
 
68
        
63
69
        self._combo.set_model(self._combo_model)
64
70
        self._combo.set_text_column(0)
65
71
 
66
72
    def _on_combo_changed(self, widget, event):
67
73
        self.emit('branch-changed', widget)
68
 
 
69
 
gobject.signal_new('branch-changed', BranchSelectionBox,
70
 
                   gobject.SIGNAL_RUN_LAST,
71
 
                   gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))
72
 
gobject.type_register(BranchSelectionBox)
 
74