165
163
store = self._files_store
166
164
self._treeview_files.set_model(None)
168
added = _i18n('added')
169
removed = _i18n('removed')
170
renamed = _i18n('renamed')
171
renamed_and_modified = _i18n('renamed and modified')
172
modified = _i18n('modified')
173
kind_changed = _i18n('kind changed')
167
removed = _('removed')
168
renamed = _('renamed')
169
renamed_and_modified = _('renamed and modified')
170
modified = _('modified')
171
kind_changed = _('kind changed')
175
173
# The store holds:
176
174
# [file_id, real path, checkbox, display path, changes type, message]
177
# iter_changes returns:
175
# _iter_changes returns:
178
176
# (file_id, (path_in_source, path_in_target),
179
177
# changed_content, versioned, parent, name, kind,
182
all_enabled = (self._selected is None)
183
180
# The first entry is always the 'whole tree'
184
all_iter = store.append([None, None, all_enabled, 'All Files', '', ''])
185
initial_cursor = store.get_path(all_iter)
181
store.append([None, None, True, 'All Files', '', ''])
186
182
# should we pass specific_files?
187
183
self._wt.lock_read()
188
184
self._basis_tree.lock_read()
190
from diff import iter_changes_to_status
186
from diff import _iter_changes_to_status
191
187
for (file_id, real_path, change_type, display_path
192
) in iter_changes_to_status(self._basis_tree, self._wt):
193
if self._selected and real_path != self._selected:
197
item_iter = store.append([
199
real_path.encode('UTF-8'),
201
display_path.encode('UTF-8'),
203
'', # Initial comment
205
if self._selected and enabled:
206
initial_cursor = store.get_path(item_iter)
188
) in _iter_changes_to_status(self._basis_tree, self._wt):
189
store.append([file_id, real_path.encode('UTF-8'),
190
True, display_path.encode('UTF-8'),
208
193
self._basis_tree.unlock()
209
194
self._wt.unlock()
213
198
# This sets the cursor, which causes the expander to close, which
214
199
# causes the _file_message_text_view to never get realized. So we have
215
200
# to give it a little kick, or it warns when we try to grab the focus
216
self._treeview_files.set_cursor(initial_cursor)
201
self._treeview_files.set_cursor(0)
218
203
def _realize_file_message_tree_view(*args):
219
204
self._file_message_text_view.realize()
230
215
bus = dbus.SystemBus()
232
proxy_obj = bus.get_object('org.freedesktop.NetworkManager',
233
'/org/freedesktop/NetworkManager')
234
except dbus.DBusException:
235
mutter("networkmanager not available.")
236
self._check_local.show()
216
proxy_obj = bus.get_object('org.freedesktop.NetworkManager',
217
'/org/freedesktop/NetworkManager')
239
218
dbus_iface = dbus.Interface(proxy_obj,
240
219
'org.freedesktop.NetworkManager')
303
281
gtk.gdk.CONTROL_MASK, 0, self._on_accel_next)
304
282
self.add_accel_group(group)
306
# ignore the escape key (avoid closing the window)
307
self.connect_object('close', self.emit_stop_by_name, 'close')
309
284
def _construct_left_pane(self):
310
285
self._left_pane_box = gtk.VBox(homogeneous=False, spacing=5)
311
286
self._construct_file_list()
312
287
self._construct_pending_list()
314
self._check_local = gtk.CheckButton(_i18n("_Only commit locally"),
289
self._check_local = gtk.CheckButton(_("_Only commit locally"),
315
290
use_underline=True)
316
291
self._left_pane_box.pack_end(self._check_local, False, False)
317
292
self._check_local.set_active(False)
338
313
self._hpane.pack2(self._right_pane_table, resize=True, shrink=True)
340
315
def _construct_action_pane(self):
341
self._button_commit = gtk.Button(_i18n("Comm_it"), use_underline=True)
316
self._button_commit = gtk.Button(_("Comm_it"), use_underline=True)
342
317
self._button_commit.connect('clicked', self._on_commit_clicked)
343
318
self._button_commit.set_flags(gtk.CAN_DEFAULT)
344
319
self._button_commit.show()
365
340
def _construct_file_list(self):
366
341
self._files_box = gtk.VBox(homogeneous=False, spacing=0)
367
file_label = gtk.Label(_i18n('Files'))
342
file_label = gtk.Label(_('Files'))
369
344
self._files_box.pack_start(file_label, expand=False)
371
self._commit_all_files_radio = gtk.RadioButton(
372
None, _i18n("Commit all changes"))
373
self._files_box.pack_start(self._commit_all_files_radio, expand=False)
374
self._commit_all_files_radio.show()
375
self._commit_all_files_radio.connect('toggled',
376
self._toggle_commit_selection)
377
self._commit_selected_radio = gtk.RadioButton(
378
self._commit_all_files_radio, _i18n("Only commit selected changes"))
379
self._files_box.pack_start(self._commit_selected_radio, expand=False)
380
self._commit_selected_radio.show()
381
self._commit_selected_radio.connect('toggled',
382
self._toggle_commit_selection)
384
self._commit_all_files_radio.set_label(_i18n('Commit all changes*'))
385
self._commit_all_files_radio.set_sensitive(False)
386
self._commit_selected_radio.set_sensitive(False)
388
346
scroller = gtk.ScrolledWindow()
389
347
scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
390
348
self._treeview_files = gtk.TreeView()
411
369
self._files_store = liststore
412
370
self._treeview_files.set_model(liststore)
413
371
crt = gtk.CellRendererToggle()
414
crt.set_property('activatable', not bool(self._pending))
372
crt.set_active(not bool(self._pending))
415
373
crt.connect("toggled", self._toggle_commit, self._files_store)
416
374
if self._pending:
417
name = _i18n('Commit*')
419
name = _i18n('Commit')
420
commit_col = gtk.TreeViewColumn(name, crt, active=2)
421
commit_col.set_visible(False)
422
self._treeview_files.append_column(commit_col)
423
self._treeview_files.append_column(gtk.TreeViewColumn(_i18n('Path'),
378
self._treeview_files.append_column(gtk.TreeViewColumn(name,
380
self._treeview_files.append_column(gtk.TreeViewColumn(_('Path'),
424
381
gtk.CellRendererText(), text=3))
425
self._treeview_files.append_column(gtk.TreeViewColumn(_i18n('Type'),
382
self._treeview_files.append_column(gtk.TreeViewColumn(_('Type'),
426
383
gtk.CellRendererText(), text=4))
427
384
self._treeview_files.connect('cursor-changed',
428
385
self._on_treeview_files_cursor_changed)
436
393
model[path][2] = not model[path][2]
438
def _toggle_commit_selection(self, button):
439
all_files = self._commit_all_files_radio.get_active()
440
if self._commit_all_changes != all_files:
441
checked_col = self._treeview_files.get_column(0)
442
self._commit_all_changes = all_files
444
checked_col.set_visible(False)
446
checked_col.set_visible(True)
447
renderer = checked_col.get_cell_renderers()[0]
448
renderer.set_property('activatable', not all_files)
450
395
def _construct_pending_list(self):
451
396
# Pending information defaults to hidden, we put it all in 1 box, so
452
397
# that we can show/hide all of them at once
456
401
pending_message = gtk.Label()
457
402
pending_message.set_markup(
458
_i18n('<i>* Cannot select specific files when merging</i>'))
403
_('<i>* Cannot select specific files when merging</i>'))
459
404
self._pending_box.pack_start(pending_message, expand=False, padding=5)
460
405
pending_message.show()
462
pending_label = gtk.Label(_i18n('Pending Revisions'))
407
pending_label = gtk.Label(_('Pending Revisions'))
463
408
self._pending_box.pack_start(pending_label, expand=False, padding=0)
464
409
pending_label.show()
482
427
self._pending_store = liststore
483
428
self._treeview_pending.set_model(liststore)
484
self._treeview_pending.append_column(gtk.TreeViewColumn(_i18n('Date'),
429
self._treeview_pending.append_column(gtk.TreeViewColumn(_('Date'),
485
430
gtk.CellRendererText(), text=1))
486
self._treeview_pending.append_column(gtk.TreeViewColumn(_i18n('Committer'),
431
self._treeview_pending.append_column(gtk.TreeViewColumn(_('Committer'),
487
432
gtk.CellRendererText(), text=2))
488
self._treeview_pending.append_column(gtk.TreeViewColumn(_i18n('Summary'),
433
self._treeview_pending.append_column(gtk.TreeViewColumn(_('Summary'),
489
434
gtk.CellRendererText(), text=3))
491
436
def _construct_diff_view(self):
492
437
from diff import DiffView
494
# TODO: jam 2007-10-30 The diff label is currently disabled. If we
495
# decide that we really don't ever want to display it, we should
496
# actually remove it, and other references to it, along with the
497
# tests that it is set properly.
498
self._diff_label = gtk.Label(_i18n('Diff for whole tree'))
439
self._diff_label = gtk.Label(_('Diff for whole tree'))
499
440
self._diff_label.set_alignment(0, 0)
500
441
self._right_pane_table.set_row_spacing(self._right_pane_table_row, 0)
501
442
self._add_to_right_table(self._diff_label, 1, False)
502
# self._diff_label.show()
443
self._diff_label.show()
504
445
self._diff_view = DiffView()
505
446
self._add_to_right_table(self._diff_view, 4, True)
519
460
self._file_message_text_view.set_accepts_tab(False)
520
461
self._file_message_text_view.show()
522
self._file_message_expander = gtk.Expander(_i18n('File commit message'))
463
self._file_message_expander = gtk.Expander(_('File commit message'))
523
464
self._file_message_expander.set_expanded(True)
524
465
self._file_message_expander.add(scroller)
525
466
self._add_to_right_table(self._file_message_expander, 1, False)
526
467
self._file_message_expander.show()
528
469
def _construct_global_message(self):
529
self._global_message_label = gtk.Label(_i18n('Global Commit Message'))
530
self._global_message_label.set_markup(
531
_i18n('<b>Global Commit Message</b>'))
470
self._global_message_label = gtk.Label(_('Global Commit Message'))
532
471
self._global_message_label.set_alignment(0, 0)
533
472
self._right_pane_table.set_row_spacing(self._right_pane_table_row, 0)
534
473
self._add_to_right_table(self._global_message_label, 1, False)
555
494
if selection is not None:
556
495
path, display_path = model.get(selection, 1, 3)
557
self._diff_label.set_text(_i18n('Diff for ') + display_path)
496
self._diff_label.set_text(_('Diff for ') + display_path)
559
498
self._diff_view.show_diff(None)
601
540
text_buffer = self._file_message_text_view.get_buffer()
602
541
file_id, display_path, message = self._files_store.get(selection, 0, 3, 5)
603
542
if file_id is None: # Whole tree
604
self._file_message_expander.set_label(_i18n('File commit message'))
543
self._file_message_expander.set_label(_('File commit message'))
605
544
self._file_message_expander.set_expanded(False)
606
545
self._file_message_expander.set_sensitive(False)
607
546
text_buffer.set_text('')
608
547
self._last_selected_file = None
610
self._file_message_expander.set_label(_i18n('Commit message for ')
549
self._file_message_expander.set_label(_('Commit message for ')
612
551
self._file_message_expander.set_expanded(True)
613
552
self._file_message_expander.set_sensitive(True)
653
592
if message == '':
654
593
response = self._question_dialog(
655
_i18n('Commit with an empty message?'),
656
_i18n('You can describe your commit intent in the message.'))
594
_('Commit with an empty message?'),
595
_('You can describe your commit intent in the message.'))
657
596
if response == gtk.RESPONSE_NO:
658
597
# Kindly give focus to message area
659
598
self._global_message_text_view.grab_focus()
672
611
# files at this point.
673
612
for path in self._wt.unknowns():
674
613
response = self._question_dialog(
675
_i18n("Commit with unknowns?"),
676
_i18n("Unknown files exist in the working tree. Commit anyway?"))
614
_("Commit with unknowns?"),
615
_("Unknown files exist in the working tree. Commit anyway?"))
677
616
if response == gtk.RESPONSE_NO:
691
630
revprops=revprops)
692
631
except errors.PointlessCommit:
693
632
response = self._question_dialog(
694
_i18n('Commit with no changes?'),
695
_i18n('There are no changes in the working tree.'
696
' Do you want to commit anyway?'))
633
_('Commit with no changes?'),
634
_('There are no changes in the working tree.'
635
' Do you want to commit anyway?'))
697
636
if response == gtk.RESPONSE_YES:
698
637
rev_id = self._wt.commit(message,
699
638
allow_pointless=True,