diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2019-11-15 16:29:13 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2019-11-15 16:32:52 +0000 |
commit | 989553758eedd44e33bbacd2856e7c19741c45ac (patch) | |
tree | 98b5eefff44a5a4a7ad9d6bedf3ac2832848d633 | |
parent | 767df50edadb8dd42d62d22a96ce630cb2bb1410 (diff) | |
download | gtk+-issue-377.tar.gz |
Show the default app for a content type only if recommendedissue-377
The default application for a content type is selected depending on
whether it matches the given content type or any of its sub-classes.
This means that we might end up showing a text editor for the
`text/calendar` MIME type because it matches the `text/*` super-class.
The recommended applications, on the other hand, match the exact content
type.
Fixes: #377
-rw-r--r-- | gtk/gtkappchooserbutton.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/gtk/gtkappchooserbutton.c b/gtk/gtkappchooserbutton.c index 4c8dc45ee4..1dc1e32483 100644 --- a/gtk/gtkappchooserbutton.c +++ b/gtk/gtkappchooserbutton.c @@ -364,12 +364,28 @@ gtk_app_chooser_button_populate (GtkAppChooserButton *self) if (default_app != NULL) { - get_first_iter (priv->store, &iter); - cycled_recommended = TRUE; - - insert_one_application (self, default_app, &iter); - - g_object_unref (default_app); + /* The default app matches all types and sub-types of the + * content type we're looking at, whereas the recomended + * apps match the content type exactly. If the default app + * does not appear in the recommended apps then we might + * end up showing a text editor for calendar-related files, + * which is not helpful. + * + * See: https://gitlab.gnome.org/GNOME/gtk/issues/377 + */ + if (g_list_find (recommended_apps, default_app) != NULL) + { + get_first_iter (priv->store, &iter); + cycled_recommended = TRUE; + + insert_one_application (self, default_app, &iter); + + g_object_unref (default_app); + } + else + { + g_clear_object (&default_app); + } } } |