/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-05-19 16:56:46 UTC
  • mfrom: (0.1.25 gannotate)
  • Revision ID: jelmer@samba.org-20060519165646-0d867938fdbc9097
Merge in Dan Loda's gannotate plugin and put it in annotate/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
2
 
#
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.
7
 
#
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.
12
 
#
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
16
 
 
17
 
import sys
18
 
 
19
 
try:
20
 
    import pygtk
21
 
    pygtk.require("2.0")
22
 
except:
23
 
    pass
24
 
 
25
 
import gtk
26
 
import gtk.glade
27
 
from olive import gladefile
28
 
 
29
 
class OliveBookmark:
30
 
    """ Display the Edit bookmark dialog and perform the needed actions. """
31
 
    def __init__(self, comm):
32
 
        """ Initialize the Edit bookmark dialog. """
33
 
        self.glade = gtk.glade.XML(gladefile, 'window_bookmark', 'olive-gtk')
34
 
        
35
 
        # Communication object
36
 
        self.comm = comm
37
 
        
38
 
        self.window = self.glade.get_widget('window_bookmark')
39
 
        
40
 
        # Dictionary for signal_autoconnect
41
 
        dic = { "on_button_bookmark_save_clicked": self.bookmark,
42
 
                "on_button_bookmark_cancel_clicked": self.close }
43
 
        
44
 
        # Connect the signals to the handlers
45
 
        self.glade.signal_autoconnect(dic)
46
 
        
47
 
        # Get some important widgets
48
 
        self.entry_location = self.glade.get_widget('entry_bookmark_location')
49
 
        self.entry_title = self.glade.get_widget('entry_bookmark_title')
50
 
 
51
 
    def display(self):
52
 
        """ Display the Edit bookmark dialog. """
53
 
        path = self.comm.get_selected_left()
54
 
        self.entry_location.set_text(path)
55
 
        self.entry_title.set_text(self.comm.pref.get_bookmark_title(path))
56
 
        self.window.show_all()
57
 
        
58
 
    def bookmark(self, widget):
59
 
        if self.entry_title.get_text() == '':
60
 
            error_dialog(_('No title given'),
61
 
                                     _('Please specify a title to continue.'))
62
 
            return
63
 
        
64
 
        self.comm.pref.set_bookmark_title(self.entry_location.get_text(),
65
 
                                          self.entry_title.get_text())
66
 
        
67
 
        self.close()
68
 
        self.comm.refresh_left()
69
 
    
70
 
    def close(self, widget=None):
71
 
        self.window.destroy()