GNOME Bugzilla – Bug 762410
GtkAppChooserWidget does not show all applications
Last modified: 2016-02-22 16:10:52 UTC
When show-all is set through gtk_app_chooser_widget_set_show_all (), the widget only displays applications that has a uri or file type asociated with it. The cause of this is in gtk/gtkappchooserwidget.c: 558 if (!g_app_info_supports_uris (app) && 559 !g_app_info_supports_files (app)) 560 continue; This change was included as part of d0c35d63, which reverted b4322420 for unclear reasons.
Created attachment 321792 [details] [review] Proposed fix
::show-all is not a promise to show 'all applications' (whatever that means). As the docs say: * If the #GtkAppChooserWidget:show-all property is %TRUE, the app * chooser presents all applications in a single list, without * subsections for default, recommended or related applications.
Can you clarify the purpose of the widget? Even reading that documentation, it seems to me that show-all=TRUE implies I will get a widget populated with a list of .desktop entries where Type=Application. For example, gnome-terminal doesn't appear in the list no matter which flags are set.
The docs say: * #GtkAppChooser is an interface that can be implemented by widgets which * allow the user to choose an application (typically for the purpose of * opening a file). The constructors for GtkAppChooserDialog reinforce that: GDK_AVAILABLE_IN_ALL GtkWidget * gtk_app_chooser_dialog_new (GtkWindow *parent, GtkDialogFlags flags, GFile *file); GDK_AVAILABLE_IN_ALL GtkWidget * gtk_app_chooser_dialog_new_for_content_type (GtkWindow *parent, GtkDialogFlags flags, const gchar *content_type);
(In reply to Craig Cabrey from comment #3) > For example, gnome-terminal doesn't appear in the list no matter which flags > are set. Because GNOME Terminal cannot open files or URIs. If an application cannot open a file, using the application chooser dialog is a bit pointless; what could the user possibly do with the selected application? If you want to list the installed applications you can simply load all GAppInfo using the GIO API, and then construct a GtkListBox with the results.
I originally tracked down this problem from the GNOME Shell extension Auto Move Windows[0]. In that extension, the author is using the GtkAppChooserWidget to display a list of apps for which users could create a rule, but it seems he is using it incorrectly. Perhaps a documentation update/clarification is in order? It would help to make it clear that the widget is intended to be used as a way to select an application associated with a filetype or uri handler. Thoughts? [0]: https://extensions.gnome.org/extension/16/auto-move-windows/