Le mardi 14 août 2012 à 11:30 +1000, Amy C a écrit : > Hi all, > > I'm trying to bring up a Gtk.AppChooserWidget with a list of all > applications on the computer for the user to select from. > > However, I notice that there are quite a few apps missing from the > list, and duplicates of others. For example, I have 3 'Banshee' > entries and *no* 'Terminal' entries. I definitely need the Terminal to > show up in the list. Even clicking the 'Show other application' > buttons doesn't increase the list. > > The code in prefs.js (I've also attached a standalone version of the > code: do './gjs sample_app-chooser.js' to see. It works in GNOME 3.2, > probably GNOME 3.4 but I can't test at the moment. Modified from from > the ButtonExample on dev.gnome.org in the demos/unstable section. > However, I didn't bother connecting up the dialog buttons to anything > so you'll have to Ctrl+C to quit the program). > > /* bring up a dialogue for them to set windows */ > let dialog = new Gtk.AppChooserDialog(this.get_toplevel(), > Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT), You do not pass the 'file' argument which is required according to the docs. That's why you did not notice that GtkAppChooser is meant to select an application to open a file (or a content type), not to select any application. This means only applications that claim they handle the given MIME type will be shown.
> widget = dialog.get_widget(); > dialog.set_heading(_("Select an app to blacklist/whitelist")); > widget.set_show_all(true); // set the appchooser to show every app > > I was under the impression that the `.set_show_all(true)` would cause > every application to appear on the list - why would some not show? > (such as the Terminal application which is definitely installed!) See http://developer.gnome.org/gtk3/stable/GtkAppChooserWidget.html#GtkAppChooserWidget--show-all 'show-all' means that a flat list is used, instead of sections for every type of applications (default, recommended...). I don't think there's a way of showing all installed apps. What I _suspect_ is happening is that only applications that claim they handle at least one MIME type are listed. The terminal is not registered at all in the MIME database, so it is not listed. (You can check that /usr/share/applications/gnome-terminal.desktop does not contain any information about MIME types.) If you need to manage installed applications, I think you'd better use libgnome-menu just like the Shell and Alacarte do. My two cents _______________________________________________ gnome-shell-list mailing list gnome-shell-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-shell-list