30
30
from dialog import error_dialog, info_dialog, question_dialog
32
from olive import delimiter
32
from history import UrlHistory
34
34
class PushDialog(gtk.Dialog):
35
35
""" New implementation of the Push dialog. """
88
88
self.vbox.show_all()
90
90
# Build location history
91
self._history = UrlHistory(self.branch.get_config(), 'push_history')
91
92
self._build_history()
93
94
def _build_history(self):
94
95
""" Build up the location history. """
95
config = LocationConfig(self.branch.base)
96
history = config.get_user_option('gpush_history')
97
if history is not None:
98
self._combo_model = gtk.ListStore(str)
99
for item in history.split(delimiter):
100
self._combo_model.append([ item ])
101
self._combo.set_model(self._combo_model)
102
self._combo.set_text_column(0)
96
self._combo_model = gtk.ListStore(str)
97
for item in self._history.get_entries():
98
self._combo_model.append([ item ])
99
self._combo.set_model(self._combo_model)
100
self._combo.set_text_column(0)
104
102
location = self.branch.get_push_location()
106
104
self._combo.get_child().set_text(location)
108
def _add_to_history(self, location):
109
""" Add specified location to the history (if not yet added). """
110
config = LocationConfig(self.branch.base)
111
history = config.get_user_option('gpush_history')
113
config.set_user_option('gpush_history', location)
115
h = history.split(delimiter)
116
if location not in h:
118
config.set_user_option('gpush_history', delimiter.join(h))
120
106
def _on_test_clicked(self, widget):
121
107
""" Test button clicked handler. """
158
144
revs = do_push(self.branch, overwrite=True)
161
self._add_to_history(location)
147
self._history.add_entry(location)
162
148
info_dialog(_('Push successful'),
163
149
_("%d revision(s) pushed.") % revs)