GNOME Bugzilla – Bug 309664
Some file types impossible to open in Anjuta
Last modified: 2008-12-19 20:35:34 UTC
Please describe the problem: Trying to open .php files for instance starts screem. Opening .rb(ruby) scripts starts AbiWord. I find no way to open a .php or .rb file in Anjuta for editing. Steps to reproduce: 1. File -> Open 2. Choose a .php file Actual results: The .php file is opened in Screem Expected results: The .php file is opened in Anjuta Does this happen every time? Yes. Other information: I'm running debian testing.
Your desktop have those applications configured to open those files. Anjuta failed to recognize the mime types and simply forwarded the files to those apps. I have added application/x-php and application/x-ruby as supported mime types in anjuta editor. However, this looks like a complex problem because we will have to keep on adding new mime types. All these files are also of text/source, but their specific mime type handler overrides it. Is there a way to get all know mime types for a particular file (rather then just one). That way if we find text/* in one of them, Anjuta editor can accept the file. See also https://listman.redhat.com/archives/xdg-list/2003-July/msg00004.html for a similar discussion to be able to determine generic mime type of an unknown/alien mime types.
*** Bug 312562 has been marked as a duplicate of this bug. ***
*** Bug 514695 has been marked as a duplicate of this bug. ***
It's possible to fix this using the function g_content_type_is_a of GIO. It checks the supertype as defined in the mime database. Here most script language type are defined as a subclass of text/plain. So we just need to define that the document manager support text/plain. There is a still a drawback. ruby type by example is a sub type of text/plain and application/x-executable. And there are several plugins be able to load a application/x-executable at least auto tools build plugin and the profiler here. I think it's not obvious for an user to select between the document manager, the profile or the build tools when loading a ruby file. 1. Do you think that we can keep it like this ? 2. Perhaps we can just remove the file loader supported mime type from the profiler and auto tool build plugin. 3. Do you see another solution ? By the way, I think it would be easier if Anjuta propose to load an editor instead of the document manager plugin. Is it possible to implement the IAnjutaFileLoader interface in the editor plugins ?
I don't think it is useful to open binary files at all because in 99% the user will not want to open that file and in the other cases he will most likely use the appropriate plugin directly. About the editor thing - well, I think it's a minor issue but you can change it if you want.
I have fixed this bug. Using g_content_type_is_a from GIO, it is possible to check if a mime type is not a sub type of a more basic one. Typically all script language types have text/plain as one ancestor, if Anjuta handles text/plain, it can open them. There is two points not completely solved though. 1. Some languages have application/x-executable as ancestor too, which means that the profiler plugin or the build tools plugin can try to open them too. 2. It does not work on Windows, where content type, handled by g_content_type_is_a, are not equal to mime_type, used by Anjuta. There is a functions g_content_type_from_mime_type which could be used to make the conversion. But it is not guarantee that it always works. Moreover it has appeared in gio 2.18, so I have not used it yet.