/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: Curtis Hovey
  • Date: 2011-09-04 03:48:04 UTC
  • mfrom: (737.1.3 fix-threads-icons)
  • Revision ID: sinzui.is@verizon.net-20110904034804-u7nod7mzximvqu8l
Fix icon and running thread issues reported by the test suite.

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
 
        super(BranchSelectionBox, self).__init__()
 
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()
39
41
 
40
42
        self.add(self._combo)
41
43
 
42
 
        gobject.signal_new('branch-changed', BranchSelectionBox, 
43
 
                           gobject.SIGNAL_RUN_LAST,
44
 
                           gobject.TYPE_NONE, (gobject.TYPE_OBJECT,))
45
 
 
46
44
        if path is not None:
47
45
            self.set_url(path)
48
46
 
58
56
    def _build_history(self):
59
57
        """ Build up the branch history. """
60
58
        self._combo_model = gtk.ListStore(str)
61
 
        
 
59
 
62
60
        for item in self._history.get_entries():
63
61
            self._combo_model.append([ item ])
64
 
        
65
 
        pref = Preferences()
66
 
        for item in pref.get_bookmarks():
67
 
            self._combo_model.append([ item ])
68
 
        
 
62
 
69
63
        self._combo.set_model(self._combo_model)
70
64
        self._combo.set_text_column(0)
71
65
 
72
66
    def _on_combo_changed(self, widget, event):
73
67
        self.emit('branch-changed', widget)
74
 
    
 
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)