Patch for GTK2.4 fileselector
Tom Parker <[email protected]>
| Newsgroups | gmane.comp.gnome.apps.pybliographer |
|---|---|
| Message-ID | <[email protected]> |
(I had previously reported this to the Debian bug system as http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=277065 but this is probably a better place to send this to) Pybliographic (certainly the stable 1.2.4) doesn't use the new GTK 2.4 FileChooserDialog, and instead sticks with the old FileSelection. I've attached to this message a patch against the stable Arch branch (in "diff -ur" format as I can't seem to figure out how to easily do patches with Arch) that uses FileChooserDialog if the user has installed GTK 2.4, and otherwise uses the old dialog. Tom Parker -- [email protected] - http://tevp.net Illegitimus non carborundum
pygtk2.4.patch
(text/x-patch, 3 KB)
diff -ur pybliographer--stable--1.2--patch-161/Pyblio/GnomeUI/Document.py pybliographer--stable--1.2--patch-161-gtk2.4/Pyblio/GnomeUI/Document.py
--- pybliographer--stable--1.2--patch-161/Pyblio/GnomeUI/Document.py 2004-11-01 13:48:11.000000000 +0100
+++ pybliographer--stable--1.2--patch-161-gtk2.4/Pyblio/GnomeUI/Document.py 2004-11-01 13:47:52.000000000 +0100
@@ -446,7 +446,7 @@
def save_document_as (self, * arg):
# get a new file name
(url, how) = FileSelector.URLFileSelection (_("Save As..."),
- url = False, has_auto = False).run ()
+ url = False, has_auto = False, is_save = True).run ()
if url is None: return
diff -ur pybliographer--stable--1.2--patch-161/Pyblio/GnomeUI/FileSelector.py pybliographer--stable--1.2--patch-161-gtk2.4/Pyblio/GnomeUI/FileSelector.py
--- pybliographer--stable--1.2--patch-161/Pyblio/GnomeUI/FileSelector.py 2004-11-01 13:48:11.000000000 +0100
+++ pybliographer--stable--1.2--patch-161-gtk2.4/Pyblio/GnomeUI/FileSelector.py 2004-11-01 13:47:52.000000000 +0100
@@ -33,22 +33,34 @@
from Pyblio.GnomeUI import Utils
+if gtk.__dict__.has_key('FileChooserDialog'):
+ has_file_chooser = True
+ FileSelect = gtk.FileChooserDialog
+else:
+ has_file_chooser = False
+ FileSelect = gtk.FileSelection
-class URLFileSelection (gtk.FileSelection):
+class URLFileSelection (FileSelect):
''' Extended file selection dialog, with an URL field and a type
selector. '''
defaultdir = None
def __init__(self, title = _("File"),
- url = True, modal = True, has_auto = True,
+ url = True, modal = True, has_auto = True,is_save = False,
directory = None):
- gtk.FileSelection.__init__ (self)
+ if has_file_chooser:
+ FileSelect.__init__ (self,buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
+ else:
+ FileSelect.__init__ (self)
+ if has_file_chooser and is_save:
+ self.set_action(gtk.FILE_CHOOSER_ACTION_SAVE)
self.set_title (title)
- self.hide_fileop_buttons ()
+ if not has_file_chooser:
+ self.hide_fileop_buttons ()
if directory:
self.set_filename (directory)
@@ -60,7 +72,10 @@
self.ret = None
self.url = None
- vbox = self.main_vbox
+ if not has_file_chooser:
+ vbox = self.main_vbox
+ else:
+ vbox = self.vbox
# url handler
if url:
@@ -81,7 +96,10 @@
self.menu = gtk.OptionMenu ()
hbox.pack_start (self.menu)
- vbox.pack_start (hbox, expand = False, fill = False)
+ if not has_file_chooser:
+ vbox.pack_start (hbox, expand = False, fill = False)
+ else:
+ self.set_extra_widget(hbox)
# menu content
menu = gtk.Menu ()