/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-03-14 20:12:19 UTC
  • Revision ID: jelmer@samba.org-20110314201219-wo692nzwywu6mevh
Fix formatting, imports.

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
 
import gobject
 
28
 
 
29
from bzrlib.plugins.gtk.history import UrlHistory
28
30
 
29
31
class BranchSelectionBox(gtk.HBox):
 
32
 
30
33
    def __init__(self, path=None):
31
34
        gobject.GObject.__init__(self)
32
35
        self._combo = gtk.ComboBoxEntry()
33
36
        self._combo.child.connect('focus-out-event', self._on_combo_changed)
34
 
        
 
37
 
35
38
        # Build branch history
36
39
        self._history = UrlHistory(GlobalConfig(), 'branch_history')
37
40
        self._build_history()
53
56
    def _build_history(self):
54
57
        """ Build up the branch history. """
55
58
        self._combo_model = gtk.ListStore(str)
56
 
        
 
59
 
57
60
        for item in self._history.get_entries():
58
61
            self._combo_model.append([ item ])
59
 
        
 
62
 
60
63
        self._combo.set_model(self._combo_model)
61
64
        self._combo.set_text_column(0)
62
65
 
63
66
    def _on_combo_changed(self, widget, event):
64
67
        self.emit('branch-changed', widget)
65
68
 
66
 
gobject.signal_new('branch-changed', BranchSelectionBox, 
 
69
gobject.signal_new('branch-changed', BranchSelectionBox,
67
70
                   gobject.SIGNAL_RUN_LAST,
68
71
                   gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))
69
72
gobject.type_register(BranchSelectionBox)