After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 309664 - Some file types impossible to open in Anjuta
Some file types impossible to open in Anjuta
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: file-loader
2.0.x
Other All
: Normal normal
: ---
Assigned To: Anjuta maintainers
Anjuta maintainers
: 312562 514695 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2005-07-07 03:56 UTC by Steve Halasz
Modified: 2008-12-19 20:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Steve Halasz 2005-07-07 03:56:30 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.
Comment 1 Naba Kumar 2005-07-21 19:18:20 UTC
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.
Comment 2 Naba Kumar 2005-08-10 17:25:18 UTC
*** Bug 312562 has been marked as a duplicate of this bug. ***
Comment 3 Johannes Schmid 2008-02-10 19:35:57 UTC
*** Bug 514695 has been marked as a duplicate of this bug. ***
Comment 4 Sébastien Granjoux 2008-12-16 22:01:06 UTC
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 ?
Comment 5 Johannes Schmid 2008-12-17 09:39:29 UTC
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.

Comment 6 Sébastien Granjoux 2008-12-19 20:35:34 UTC
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.