/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/bookmark.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-30 10:21:43 UTC
  • Revision ID: jelmer@samba.org-20060930102143-c0ef64d6ca860c21
Merge some files from Olive and bzr-gtk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import sys
18
 
 
19
17
try:
20
18
    import pygtk
21
19
    pygtk.require("2.0")
22
20
except:
23
21
    pass
24
 
try:
25
 
    import gtk
26
 
    import gtk.glade
27
 
except:
28
 
    sys.exit(1)
 
22
 
 
23
import gtk
 
24
import gtk.glade
 
25
 
 
26
from olive import gladefile, OlivePreferences
 
27
from dialog import error_dialog
29
28
 
30
29
class OliveBookmark:
31
30
    """ Display the Edit bookmark dialog and perform the needed actions. """
32
 
    def __init__(self, gladefile, comm, dialog):
 
31
    def __init__(self, selected):
33
32
        """ Initialize the Edit bookmark dialog. """
34
 
        self.gladefile = gladefile
35
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_bookmark', 'olive-gtk')
36
 
        
37
 
        # Communication object
38
 
        self.comm = comm
39
 
        # Dialog object
40
 
        self.dialog = dialog
 
33
        self.glade = gtk.glade.XML(gladefile, 'window_bookmark', 'olive-gtk')
41
34
        
42
35
        self.window = self.glade.get_widget('window_bookmark')
43
36
        
 
37
        self.pref = self.pref = OlivePreferences()
 
38
        
44
39
        # Dictionary for signal_autoconnect
45
40
        dic = { "on_button_bookmark_save_clicked": self.bookmark,
46
41
                "on_button_bookmark_cancel_clicked": self.close }
51
46
        # Get some important widgets
52
47
        self.entry_location = self.glade.get_widget('entry_bookmark_location')
53
48
        self.entry_title = self.glade.get_widget('entry_bookmark_title')
 
49
        
 
50
        self.selected = selected
54
51
 
55
52
    def display(self):
56
53
        """ Display the Edit bookmark dialog. """
57
 
        path = self.comm.get_selected_left()
 
54
        path = self.selected
58
55
        self.entry_location.set_text(path)
59
 
        self.entry_title.set_text(self.comm.pref.get_bookmark_title(path))
 
56
        self.entry_title.set_text(self.pref.get_bookmark_title(path))
60
57
        self.window.show_all()
61
58
        
62
59
    def bookmark(self, widget):
63
60
        if self.entry_title.get_text() == '':
64
 
            self.dialog.error_dialog(_('No title given'),
65
 
                                     _('Please specify a title to continue.'))
 
61
            error_dialog(_('No title given'),
 
62
                         _('Please specify a title to continue.'))
66
63
            return
67
64
        
68
 
        self.comm.pref.set_bookmark_title(self.entry_location.get_text(),
69
 
                                          self.entry_title.get_text())
 
65
        self.pref.set_bookmark_title(self.entry_location.get_text(),
 
66
                                     self.entry_title.get_text())
 
67
        self.pref.write()
70
68
        
71
69
        self.close()
72
 
        self.comm.refresh_left()
73
70
    
74
71
    def close(self, widget=None):
75
72
        self.window.destroy()