GNOME Bugzilla – Bug 149385
MIME types patch for gedit
Last modified: 2004-12-22 21:47:04 UTC
Currently, the MimeTypes section of the gedit.desktop.in file only contains contains text/plain. This patch I've attached includes support for many more MIME Types, hopefully making gedit more convenient for browsing and editing other types of files.
Created attachment 30235 [details] [review] Patch for more mime types
the patch should not be needed: specifying text/plain should be enough to include all the types that inherit from it. I'm closing this as NOTABUG. Did you see any problems in practice with file association of those MIME types or did you do the patch just because you thought it was right in theory? If you saw real problems feel free to reopen.
I think that in theory, gedit should be able to deal with files that have the MIME types mentioned in that patch. That isn't why I submitted the patch however. On my system, files that have the mime type text/plain would open as expected in gedit. Other files that could be interpereted as plain text (e.g. C source files, Python or PHP scripts) did not. Instead, a dialog box would appear in Nautilus, containing the text along the lines of 'Couldn't display "/home/darren/source-file.c"'. I would then have to right-click on the file and set it up so that gedit would open it in future. If you say that it should work then I suppose the problem is with my system, and I will leave this bug closed.
Sorry if I cannot be 100% helpful, but I haven't a system setup with the new mime stuff yet. The way it *should* work is that by registering with text/plain gedit should be associated with all text files. C, Python etc included. If that's not the case, it may be a bug in the new mime stuff and maybe Ray (cc'ed) would like to know more details about it.
I was thinking that the problem may be in the mime system rather than in any specific application. Should a file a bug against Nautilus?
Ah so, actually what I think's going on is that php, perl, and python don't have text media types so they don't get picked up automatically. Also, another case that gedit special cases for its file selector are desktop files. So, I think that application/x-desktop, application/x-python, application/x-perl, and application/x-php should probably be added to the MimeType line. Darren, are you sure C source files aren't working for you by default? I ask this because C source files do have a text media type.
Ray, at the moment "conventional" (i.e. text/*) source files aren't working for me by default. To get the 'desired' effect, I have to modify the MimeType line in the .desktop file as it's shown in the patch then run 'update-desktop-database'. I have looked at the MIME proposal at http://freedesktop.org/pipermail/xdg/2004-July/004140.html (what I'm assuming the new mime system is based on in GNOME 2.7.x) and everthing seems to be right, but I just can't seem to get it to work.
I'm reopening this... can you guys update this with more details once you find out? As I said at the moment I don't have a full jhbuilded gnome HEAD...
I'm running the BMG ebuilds and I see this too. text/plain works but it's not listed for text/x-csrc.
application/x-desktop etc should not be added to the mimetype line, instead application/x-desktop should inherit from text/plain, and then everything should work automatically. Its possible that we have bugs in the handling of inheritance though.
I fixed this. You need latest gnome-vfs, eel and shared-mime-info and it should work.