From 51601d42cc6e6969c13634d5215dc937a555b920 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Mon, 14 Nov 2005 15:54:13 +0000 Subject: [PATCH] mime_type is better than glob syntax for filefilter; also fix logic --- src/config.py | 7 ++----- src/vcard.py | 19 ++++++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/config.py b/src/config.py index aa025f9d0..47cb19c75 100644 --- a/src/config.py +++ b/src/config.py @@ -2057,11 +2057,8 @@ class ManageEmoticonsWindow: filter.add_mime_type('image/png') filter.add_mime_type('image/jpeg') filter.add_mime_type('image/gif') - filter.add_pattern('*.png') - filter.add_pattern('*.jpg') - filter.add_pattern('*.gif') - filter.add_pattern('*.tif') - filter.add_pattern('*.xpm') + filter.add_mime_type('image/tiff') + filter.add_mime_type('image/x-xpixmap') # xpm dialog.add_filter(filter) dialog.set_filter(filter) dialog.set_use_preview_label(False) diff --git a/src/vcard.py b/src/vcard.py index c00e8fcb2..041e4d3ce 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -175,19 +175,16 @@ class VcardWindow: filtr.add_mime_type('image/png') filtr.add_mime_type('image/jpeg') filtr.add_mime_type('image/gif') - filtr.add_pattern('*.png') - filtr.add_pattern('*.jpg') - filtr.add_pattern('*.gif') - filtr.add_pattern('*.tif') - filtr.add_pattern('*.xpm') + filtr.add_mime_type('image/tiff') + filtr.add_mime_type('image/x-xpixmap') # xpm dialog.add_filter(filtr) dialog.set_filter(filtr) dialog.set_use_preview_label(False) dialog.set_preview_widget(gtk.Image()) dialog.connect('selection-changed', self.update_preview) - ok = False - while not ok: + done = False + while not done: response = dialog.run() if response == gtk.RESPONSE_OK: f = dialog.get_filename() @@ -203,12 +200,12 @@ class VcardWindow: _('The file must not be more than 8 kilobytes.')).get_response() continue if self.image_is_ok(f): - ok = True - else: - ok = True + done = True + else: # Cancel or WM X button + done = True dialog.destroy() - if f: + if response == gtk.RESPONSE_OK: fd = open(f, 'rb') data = fd.read() pixbuf = gtkgui_helpers.get_pixbuf_from_data(data)