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 762410 - GtkAppChooserWidget does not show all applications
GtkAppChooserWidget does not show all applications
Status: RESOLVED NOTABUG
Product: gtk+
Classification: Platform
Component: Widget: GtkAppChooser
3.19.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Cosimo Cecchi
Depends on:
Blocks:
 
 
Reported: 2016-02-21 20:04 UTC by Craig Cabrey
Modified: 2016-02-22 16:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix (1.09 KB, patch)
2016-02-21 20:15 UTC, Craig Cabrey
none Details | Review

Description Craig Cabrey 2016-02-21 20:04: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.
Comment 1 Craig Cabrey 2016-02-21 20:15:31 UTC
Created attachment 321792 [details] [review]
Proposed fix
Comment 2 Matthias Clasen 2016-02-22 00:43:31 UTC
::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.
Comment 3 Craig Cabrey 2016-02-22 00:59:01 UTC
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.
Comment 4 Matthias Clasen 2016-02-22 15:48:44 UTC
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);
Comment 5 Emmanuele Bassi (:ebassi) 2016-02-22 16:04:24 UTC
(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.
Comment 6 Craig Cabrey 2016-02-22 16:10:52 UTC
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/