1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
from olive import gladefile, OlivePreferences
27
from dialog import error_dialog
30
""" Display the Edit bookmark dialog and perform the needed actions. """
31
def __init__(self, selected):
32
""" Initialize the Edit bookmark dialog. """
33
self.glade = gtk.glade.XML(gladefile, 'window_bookmark', 'olive-gtk')
35
self.window = self.glade.get_widget('window_bookmark')
37
self.pref = self.pref = OlivePreferences()
39
# Dictionary for signal_autoconnect
40
dic = { "on_button_bookmark_save_clicked": self.bookmark,
41
"on_button_bookmark_cancel_clicked": self.close }
43
# Connect the signals to the handlers
44
self.glade.signal_autoconnect(dic)
46
# Get some important widgets
47
self.entry_location = self.glade.get_widget('entry_bookmark_location')
48
self.entry_title = self.glade.get_widget('entry_bookmark_title')
50
self.selected = selected
53
""" Display the Edit bookmark dialog. """
55
self.entry_location.set_text(path)
56
self.entry_title.set_text(self.pref.get_bookmark_title(path))
57
self.window.show_all()
59
def bookmark(self, widget):
60
if self.entry_title.get_text() == '':
61
error_dialog(_('No title given'),
62
_('Please specify a title to continue.'))
65
self.pref.set_bookmark_title(self.entry_location.get_text(),
66
self.entry_title.get_text())
71
def close(self, widget=None):