25
from olive import Preferences
26
from bzrlib.plugins.gtk import _i18n
27
from bzrlib.plugins.gtk.dialog import error_dialog
30
class BookmarkDialog(gtk.Dialog):
26
from olive import OlivePreferences
27
from dialog import error_dialog
28
from guifiles import GLADEFILENAME
32
""" Display the Edit bookmark dialog and perform the needed actions. """
33
def __init__(self, selected):
34
""" Initialize the Edit bookmark dialog. """
35
self.glade = gtk.glade.XML(GLADEFILENAME, 'window_bookmark', 'olive-gtk')
37
self.window = self.glade.get_widget('window_bookmark')
39
self.pref = OlivePreferences()
41
# Dictionary for signal_autoconnect
42
dic = { "on_button_bookmark_save_clicked": self.bookmark,
43
"on_button_bookmark_cancel_clicked": self.close }
45
# Connect the signals to the handlers
46
self.glade.signal_autoconnect(dic)
48
# Get some important widgets
49
self.entry_location = self.glade.get_widget('entry_bookmark_location')
50
self.entry_title = self.glade.get_widget('entry_bookmark_title')
52
self.selected = selected
55
""" Display the Edit bookmark dialog. """
57
self.entry_location.set_text(path)
58
self.entry_title.set_text(self.pref.get_bookmark_title(path))
59
self.window.show_all()
61
def bookmark(self, widget):
62
if self.entry_title.get_text() == '':
63
error_dialog(_('No title given'),
64
_('Please specify a title to continue.'))
67
self.pref.set_bookmark_title(self.entry_location.get_text(),
68
self.entry_title.get_text())
73
def close(self, widget=None):
76
class OliveBookmarkDialog(gtk.Dialog):
31
77
""" This class wraps the old Bookmark window into a gtk.Dialog. """
33
79
def __init__(self, selected, parent=None):
38
84
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
40
self.pref = Preferences()
86
self.pref = OlivePreferences()
43
89
self.selected = selected
46
self._label_location = gtk.Label(_i18n("Location:"))
47
self._label_title = gtk.Label(_i18n("Title:"))
92
self._label_location = gtk.Label(_("Location:"))
93
self._label_title = gtk.Label(_("Title:"))
48
94
self._entry_location = gtk.Entry()
49
95
self._entry_title = gtk.Entry()
50
96
self._button_save = gtk.Button(stock=gtk.STOCK_SAVE)
79
125
def _on_save_clicked(self, button):
80
126
""" Save button clicked handler. """
81
127
if self._entry_title.get_text() == '':
82
error_dialog(_i18n('No title given'),
83
_i18n('Please specify a title to continue.'))
128
error_dialog(_('No title given'),
129
_('Please specify a title to continue.'))
86
132
self.pref.set_bookmark_title(self._entry_location.get_text(),