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

  • Committer: Daniel Schierbeck
  • Date: 2007-11-03 02:23:43 UTC
  • mto: (330.6.6 trunk)
  • mto: This revision was merged to the branch mainline in revision 342.
  • Revision ID: daniel.schierbeck@gmail.com-20071103022343-2sij2iupdwk8bjqo
Made it work when right-clicking, too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
import bzrlib
25
25
import gtk
26
 
import gobject
27
26
from bzrlib import (errors, ui)
28
 
from bzrlib.revision import NULL_REVISION
29
27
 
30
28
class RevisionPopupMenu(gtk.Menu):
31
 
 
32
 
    __gsignals__ = {
33
 
            'tag-added': (
34
 
                gobject.SIGNAL_RUN_FIRST,
35
 
                gobject.TYPE_NONE,
36
 
                (gobject.TYPE_STRING, gobject.TYPE_STRING)
37
 
            )
38
 
    }
39
 
 
40
29
    def __init__(self, repository, revids, branch=None, wt=None):
41
30
        super(RevisionPopupMenu, self).__init__()
42
31
        self.branch = branch
47
36
 
48
37
    def create_items(self):
49
38
        if len(self.revids) == 1:
50
 
            item = gtk.MenuItem("View _Changes")
 
39
            item = gtk.MenuItem("View _Diff")
51
40
            item.connect('activate', self.show_diff)
52
41
            self.append(item)
53
42
            self.show_all()
84
73
        parentids = self.repository.revision_parents(self.revids[0])
85
74
 
86
75
        if len(parentids) == 0:
87
 
            parentid = NULL_REVISION
 
76
            parentid = None
88
77
        else:
89
78
            parentid = parentids[0]
90
79
 
96
85
    def show_push(self, item):
97
86
        from bzrlib.plugins.gtk.push import PushDialog
98
87
        dialog = PushDialog(self.repository, self.revids[0], self.branch)
99
 
        response = dialog.run()
100
 
 
101
 
        if response != gtk.RESPONSE_NONE:
102
 
            dialog.destroy()
 
88
        dialog.run()
103
89
 
104
90
    def show_tag(self, item):
105
91
        from bzrlib.plugins.gtk.tags import AddTagDialog
106
92
        dialog = AddTagDialog(self.repository, self.revids[0], self.branch)
107
93
        response = dialog.run()
108
 
 
109
94
        if response != gtk.RESPONSE_NONE:
110
95
            dialog.hide()
111
96
        
112
97
            if response == gtk.RESPONSE_OK:
113
 
                self.emit('tag-added', dialog.tagname, dialog._revid)
 
98
                self.branch.lock_write()
 
99
                self.branch.tags.set_tag(dialog.tagname, dialog._revid)
 
100
                self.branch.unlock()
114
101
            
115
102
            dialog.destroy()
116
103