28
28
import bzrlib.errors as errors
29
from bzrlib import osutils
30
31
from dialog import error_dialog
31
from gladefile import GLADEFILENAME
32
from guifiles import GLADEFILENAME
34
35
class CommitDialog:
35
36
""" Display Commit dialog and perform the needed actions. """
36
37
def __init__(self, wt, wtpath, standalone=False):
37
38
""" Initialize the Commit dialog.
38
@param wt: bzr working tree object
39
@param wtpath: path to working tree root
40
@param standalone: when used in gcommit command as standalone window
39
:param wt: bzr working tree object
40
:param wtpath: path to working tree root
41
:param standalone: when used in gcommit command as standalone window
41
42
this argument should be True
43
44
self.glade = gtk.glade.XML(GLADEFILENAME, 'window_commit', 'olive-gtk')
76
77
if self.standalone:
77
78
dic["on_button_commit_cancel_clicked"] = self.quit
79
self.window.connect("delete_event", gtk.main_quit)
79
81
# Connect the signals to the handlers
80
82
self.glade.signal_autoconnect(dic)
109
111
def _create_file_view(self):
110
self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,
112
self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN, # [0] checkbox
113
gobject.TYPE_STRING, # [1] path to display
114
gobject.TYPE_STRING, # [2] changes type
115
gobject.TYPE_STRING) # [3] real path
113
116
self.file_view.set_model(self.file_store)
114
117
crt = gtk.CellRendererToggle()
115
118
crt.set_property("activatable", True)
122
125
gtk.CellRendererText(), text=2))
124
127
for path, id, kind in self.delta.added:
125
self.file_store.append([ True, path, _('added') ])
128
marker = osutils.kind_marker(kind)
129
self.file_store.append([ True, path+marker, _('added'), path ])
127
131
for path, id, kind in self.delta.removed:
128
self.file_store.append([ True, path, _('removed') ])
132
marker = osutils.kind_marker(kind)
133
self.file_store.append([ True, path+marker, _('removed'), path ])
130
135
for oldpath, newpath, id, kind, text_modified, meta_modified in self.delta.renamed:
131
self.file_store.append([ True, oldpath, _('renamed') ])
136
marker = osutils.kind_marker(kind)
137
if text_modified or meta_modified:
138
changes = _('renamed and modified')
140
changes = _('renamed')
141
self.file_store.append([ True,
142
oldpath+marker + ' => ' + newpath+marker,
133
147
for path, id, kind, text_modified, meta_modified in self.delta.modified:
134
self.file_store.append([ True, path, _('modified') ])
148
marker = osutils.kind_marker(kind)
149
self.file_store.append([ True, path+marker, _('modified'), path ])
136
151
def _create_pending_merges(self):
137
152
liststore = gtk.ListStore(gobject.TYPE_STRING,
159
174
it = self.file_store.get_iter_first()
161
176
if self.file_store.get_value(it, 0):
162
ret.append(self.file_store.get_value(it, 1))
177
# get real path from hidden column 3
178
ret.append(self.file_store.get_value(it, 3))
163
179
it = self.file_store.iter_next(it)