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 630171 - [PATCH] desktop environment specific defaults.list
[PATCH] desktop environment specific defaults.list
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gio
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on: 596192
Blocks:
 
 
Reported: 2010-09-20 15:05 UTC by Stanislav Brabec
Modified: 2018-05-24 12:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
glib-mime-env-specific-defaults.patch (4.96 KB, patch)
2010-09-20 15:05 UTC, Stanislav Brabec
none Details | Review
glib-mime-env-specific-defaults.patch (4.51 KB, patch)
2010-09-20 16:45 UTC, Stanislav Brabec
none Details | Review
glib-desktop-specific-defaults2.patch (4.52 KB, patch)
2011-01-28 14:10 UTC, Stanislav Brabec
none Details | Review
glib-desktop-specific-defaults3.patch (5.17 KB, patch)
2011-10-12 17:09 UTC, Stanislav Brabec
none Details | Review

Description Stanislav Brabec 2010-09-20 15:05:15 UTC
Created attachment 170669 [details] [review]
glib-mime-env-specific-defaults.patch

In the current GIO implementation, only one defaults.list can be used.

It makes impossible to have different defaults for GIO-based applications in KDE and GNOME.

Attached patch makes possible to use desktop environment specific defaults.list files.


Dependencies:
GIO: gdesktopappinfo.c: improvement of MIME caching code must be applied before this patch
bug 596192

desktop-file-utils: smart defaults per MIME heuristic
https://bugs.freedesktop.org/show_bug.cgi?id=30214

How to test:
1. Install upper mentioned patches together with this one.
2. update-desktop-database --defaults-list
3.
ssh -X localhost
3.1
DESKTOP_SESSION=kde nautilus --no-desktop
nautilus will prefer KDE applications.
3.2
DESKTOP_SESSION=gnome nautilus --no-desktop
nautilus will prefer GNOME applications.

Discussion:

Patch now uses $XDG_DESKTOP_PREFIX (in form "foo-" with trailing hyphen), if it is not set, then $DESKTOP_SESSION (in form "desktop" without trailing hyphen)

Other possibilities to switch betweens desktops:
Implement something like g_desktop_app_info_set_env() or use g_desktop_app_info_set_desktop_env()  (It has now a bit different meaning.)

Note that it seems that nautilus have a custom way to select defaults as well.

See also discussion in https://bugs.freedesktop.org/show_bug.cgi?id=30214
Comment 1 Stanislav Brabec 2010-09-20 15:32:03 UTC
Feature announced in the XDG list: http://lists.freedesktop.org/archives/xdg/2010-September/011625.html
Comment 2 Stanislav Brabec 2010-09-20 16:45:40 UTC
Created attachment 170681 [details] [review]
glib-mime-env-specific-defaults.patch

Removing gfile.c chunk that was added by mistake.
Comment 3 Stanislav Brabec 2011-01-28 14:10:47 UTC
Created attachment 179518 [details] [review]
glib-desktop-specific-defaults2.patch

Patch ported to the latest glib.

Topics that are still opened:

1. Patch now uses $XDG_DESKTOP_PREFIX (in form "foo-" with trailing hyphen), if it
is not set, then $DESKTOP_SESSION (in form "desktop" without trailing hyphen)

The single variable discrimination of desktop environment was refused in past. So the topic either has to be raised again, or the patch should contain heuristic to detect GNOME, KDE, XFCE, LXDE, GPE separately.

2. It is not clean what should happen with mimeapps.list. Should it be desktop-environment specific? Should be there functions to manipulate all-desktop-environments defaults and this-desktop-environment defaults? Example: Should Nautilus set defaults for XFCE file browser as well? Should they be completely separated? Should there be functions to allow settings Open by default in GNOME and Open by default in all environments?

3. Should we implement something like g_desktop_app_info_set_env() or use
g_desktop_app_info_set_desktop_env() (which has now a bit different meaning) to switch behavior on fly?

4. What name should be used for desktop specific mimeinfo.cache? Now it uses gnome-mimeinfo.cache, kde-mimeinfo.cache etc.
Comment 4 Stanislav Brabec 2011-10-12 17:09:59 UTC
Created attachment 198868 [details] [review]
glib-desktop-specific-defaults3.patch

Rebased version of the patch that applies to the current git snapshot.

It also fixes memory corruption in mime_info_cache_init_desktop_defaults() (insufficient allocation for modified copy of mime_info_cache_dir_item_spec_defaults_list).
Comment 5 David Faure 2012-05-22 15:57:23 UTC
I can't comment on the implementation, but I'm OK with the general idea.
Comment 6 Stanislav Brabec 2015-04-02 14:08:14 UTC
It seems that glib got a different implementation:

glib/gio/gdesktopappinfo.c: desktop_file_dir_unindexed_read_mimeapps_lists() now looks for %s-mimeapps.list, as specified in the latest "Association between MIME types and applications" specification:
http://standards.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html
Comment 7 GNOME Infrastructure Team 2018-05-24 12:46:08 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/347.