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 657445 - Setting app as default fails silently
Setting app as default fails silently
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.29.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-08-26 14:12 UTC by Bastien Nocera
Modified: 2011-08-30 15:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test.c (4.50 KB, text/x-csrc)
2011-08-26 14:12 UTC, Bastien Nocera
  Details
gio: Error out when we cannot modify a GAppInfo (1.95 KB, patch)
2011-08-26 15:38 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2011-08-26 14:12:17 UTC
Created attachment 194838 [details]
test.c

Compile with:
gcc -o test test.c `pkg-config --libs --cflags gio-unix-2.0`

$ ./test --query x-scheme-handler/https
Default application for 'x-scheme-handler/https': mozilla-firefox.desktop
Registered applications:
	mozilla-firefox.desktop
	epiphany.desktop
	chromium-browser.desktop

$ ./test --set x-scheme-handler/https epiphany.desktop
** Message: Set (null) as the default for x-scheme-handler/https

$ ./test --query x-scheme-handler/https
Default application for 'x-scheme-handler/https': mozilla-firefox.desktop
Registered applications:
	mozilla-firefox.desktop
	epiphany.desktop
	chromium-browser.desktop

update_mimeapps_list() in gdesktopappinfo.c, called from g_desktop_app_info_set_as_default_for_type() seems to fail to do anything because of how the GAppInfo was constructed.
Comment 1 Bastien Nocera 2011-08-26 14:27:27 UTC
(Note that I worked around the problem in the gvfs-mime program I just added to gvfs).
Comment 2 Bastien Nocera 2011-08-26 15:38:13 UTC
Created attachment 194854 [details] [review]
gio: Error out when we cannot modify a GAppInfo

g_desktop_app_info_set_as_default_for_type() and
g_desktop_app_info_set_as_last_used_for_type () require the
application's ID, but depending on how the GAppInfo was created,
we might not be have one, and would thus silently fail to set
the default application, or last used application.
Comment 3 Matthias Clasen 2011-08-27 04:44:29 UTC
Review of attachment 194854 [details] [review]:

Looks good to me.
Comment 4 Bastien Nocera 2011-08-30 15:10:24 UTC
Pushed after actually testing it :)

Attachment 194854 [details] pushed as 2292341 - gio: Error out when we cannot modify a GAppInfo