summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk/gtkappchooserbutton.c28
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);
+ }
}
}