Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed setting of default app in Properties dialog #555

Merged
merged 1 commit into from
Jul 19, 2020

Conversation

tsujan
Copy link
Member

@tsujan tsujan commented Jul 9, 2020

GLib has a weird problem. On the one hand, g_app_info_set_as_default_for_type() writes to ~/.config/mimeapps.list. On the other hand, the DE-specific list — e.g., ~/.config/lxqt-mimeapps.list in LXQt — has priority over it and GLib respects that. Therefore, if the latter exists and contains some default apps, g_app_info_set_as_default_for_type() could not change them.

This patch solves the problem by adding a utility function that sets the default app directly inside the DE-specific list.

Also, see lxqt/libqtxdg#219.

GLib has a weird problem. On the one hand, `g_app_info_set_as_default_for_type()` writes to `~/.config/mimeapps.list`. On the other hand, the DE-specific list — e.g., `~/.config/lxqt-mimeapps.list` in LXQt — has priority over it and GLib respects that. Therefore, if the latter exists and contains some default apps, `g_app_info_set_as_default_for_type()` could not change them.

This patch solves the problem by adding a utility function that sets the default app directly inside the DE-specific list.

Also, see lxqt/libqtxdg#219.
@tsujan
Copy link
Member Author

tsujan commented Jul 9, 2020

@luis-pereira
This is very similar to lxqt/libqtxdg#219 and is needed alongside it. There's only one difference: here we don't need to add associations first because they either already exist (otherwise they wouldn't show up in Properties dialog) or were added by the code before (see

#if GLIB_CHECK_VERSION(2, 27, 6)

g_app_info_set_as_last_used_for_type() automatically adds the association; PCMan's comment: "add this app to the mime-type").

Since libfm-qt is the place where we use GLib most actively, there isn't a need to an extra dependency on libqtxdg.

@tsujan tsujan merged commit 378612f into master Jul 19, 2020
@tsujan tsujan deleted the fix_default_app_setting branch July 19, 2020 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant