Re: worst dialog ever



Am Dienstag, den 26.07.2005, 15:44 -0400 schrieb Luis Villa:
> On 7/26/05, Luis Villa <luis villa gmail com> wrote:
> > On 7/26/05, Luis Villa <luis villa gmail com> wrote:
> > > Grr. I've hated the 'these file types are mismatched' 'security'dialog
> > > for a long time, because it is totally uninformative, gives a lot of
> > > false positives, and makes it totally unclear how one is supposed to
> > > recover from the error. I've finally found a case where it actually
> > > *forces* me to use the terminal, though, which makes me hate it even
> > > more.
> > >
> > > Situation:
> > > * docbook extension is .xml
> > > * install attached 'docbook.xml' in /usr/share/mime/packages/, run
> > > 'update-mime-database /usr/share/mime/', kill gnome-vfs-daemon, and
> > > restart nautilus.
> > > * drop test.xml into, say, ~/Desktop/
> > > * right click on properties of test.xml, note that (pleasurably) your
> > > file is shown to be docbook, though you likely don't have any
> > > docbook-specific handlers.
> > > * double-click on the file.
> > > * get the error message from hell, even though the file (1) has the
> > > correct extension and (2) is properly sniffed by the properties
> > > dialog.
> > >
> > > So... can we please finally kill this dialog? :) At the very least, it
> > > has to be fixed to be able to accept that some extensions can be
> > > multiple types of file.
> > >
> > > Luis (and yes, I'll add these details to the bug, but it has been
> > > getting ignored a long time.)
> > 
> > http://bugzilla.gnome.org/show_bug.cgi?id=310082
> 
> Bah. http://bugzilla.gnome.org/show_bug.cgi?id=309862

Turns out that the way we determined whether this dialog should be shown
was really scary. The attached patch handles all cases where the sniffed
MIME type is either equal to the guessed one or inherits from it. Looks
like when we introduced the dialog GnomeVFS was simply not powerful
enough API-wise, but these times are gone - kudos to the brave VFS
hackers :).

-- 
Christian Neumair <chris gnome-de org>
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.702
diff -u -p -r1.702 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	23 Jul 2005 17:47:14 -0000	1.702
+++ src/file-manager/fm-directory-view.c	26 Jul 2005 20:17:12 -0000
@@ -4462,8 +4462,6 @@ activate_check_mime_types (FMDirectoryVi
 	char *guessed_mime_type;
 	char *mime_type;
 	gboolean ret;
-	GnomeVFSMimeApplication *default_app;
-	GnomeVFSMimeApplication *guessed_default_app;
 
 	if (!nautilus_file_check_if_ready (file, NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE)) {
 		return FALSE;
@@ -4474,18 +4472,9 @@ activate_check_mime_types (FMDirectoryVi
 	guessed_mime_type = nautilus_file_get_guessed_mime_type (file);
 	mime_type = nautilus_file_get_mime_type (file);
 
-	if (strcmp (guessed_mime_type, mime_type) != 0) {
-		default_app = gnome_vfs_mime_get_default_application
-			(mime_type);
-		guessed_default_app = gnome_vfs_mime_get_default_application
-			(guessed_mime_type);
-		if (default_app == NULL || guessed_default_app == NULL ||
-		    !gnome_vfs_mime_application_equal (default_app, guessed_default_app)) {
-			if (warn_on_mismatch) {
-				warn_mismatched_mime_types (view, file);
-			}
-			ret = FALSE;
-		}
+	if (gnome_vfs_mime_type_get_equivalence (mime_type, guessed_mime_type) == GNOME_VFS_MIME_UNRELATED) {
+		warn_mismatched_mime_types (view, file);
+		ret = FALSE;
 	}
 
 	g_free (guessed_mime_type);

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]