/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: 2011-04-06 14:53:44 UTC
  • Revision ID: jelmer@samba.org-20110406145344-m6s0i7q7ssjwhmwq
Support use without gtk.Spinner, which is only available in pygtk >= 2.22.

Show diffs side-by-side

added added

removed removed

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