gnome-mime.c patch
- From: Chris Rogers <gandalf pobox com>
- To: gnome-list gnome org
- Subject: gnome-mime.c patch
- Date: Fri, 1 Jan 1999 19:11:42 -0500 (EST)
I happen to be working on something that uses mimetypes, and noticed a
FIXME in gnome-mime.c The gnome_mime_type_or_default_of_file was supposed
to be checking with gnome-magic but was not, I made it so that it did.
Anyways, here is (hopefully) a patch. I tested it, and
gnome_mime_type_or_default_of_file will give you the correct type even if
the extension is wrong, or if the file is empty. I am kinda new to all of
this, do with it as you please.
-chris
--- gnome-mime.c.old Fri Jan 1 18:36:27 1999
+++ gnome-mime.c Fri Jan 1 18:50:20 1999
@@ -272,7 +272,13 @@
gchar *
gnome_mime_type_or_default_of_file (char *existing_filename, gchar *defaultv)
{
- /* FIXME: Hook gnome-magic here */
+ gchar *tmpmime = NULL;
+
+ /*Try magic first*/
+ tmpmime = gnome_mime_type_from_magic(existing_filename);
+ if (tmpmime != NULL) return tmpmime;
+
+ /*otherwise use file extensions*/
return gnome_mime_type_or_default (existing_filename, defaultv);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]