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 747983 - Start-up AppChooser dailog improvements
Start-up AppChooser dailog improvements
Status: RESOLVED FIXED
Product: gnome-tweak-tool
Classification: Applications
Component: general
3.16.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Tweak Tool maintainer(s)
GNOME Tweak Tool maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-04-16 11:10 UTC by Phillip Wood
Modified: 2015-04-29 18:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
StartUpTweak: Use g_application_mark_busy() (1.30 KB, patch)
2015-04-16 11:20 UTC, Phillip Wood
committed Details | Review
AppChooser: Include matching running apps when filtering (1.01 KB, patch)
2015-04-16 11:20 UTC, Phillip Wood
committed Details | Review
AppChooser: Don't show existing start-up apps (2.92 KB, patch)
2015-04-16 11:20 UTC, Phillip Wood
none Details | Review
AppChooser: Desensitize ‘Add’ button when no app is selected (3.46 KB, patch)
2015-04-16 11:20 UTC, Phillip Wood
none Details | Review
AppChooser: Add a default response (1.50 KB, patch)
2015-04-16 11:20 UTC, Phillip Wood
committed Details | Review
AppChooser: Select app when row is activated (1.88 KB, patch)
2015-04-16 11:21 UTC, Phillip Wood
none Details | Review
AppChooser: Rationalize ‘Escape’ handling (1.56 KB, patch)
2015-04-16 11:21 UTC, Phillip Wood
committed Details | Review
AppChooser: Respect setting of gtk-dialogs-use-header (1.91 KB, patch)
2015-04-16 11:21 UTC, Phillip Wood
committed Details | Review
AppChooser: Don't show existing start-up apps (2.83 KB, patch)
2015-04-27 10:15 UTC, Phillip Wood
committed Details | Review
AppChooser: Desensitize ‘Add’ button when no app is selected (4.26 KB, patch)
2015-04-27 10:25 UTC, Phillip Wood
none Details | Review
AppChooser: Desensitize ‘Add’ button when no app is selected (2.79 KB, patch)
2015-04-28 12:57 UTC, Phillip Wood
committed Details | Review
AppChooser: Select app when row is activated (1.53 KB, patch)
2015-04-28 12:58 UTC, Phillip Wood
committed Details | Review
AppChooser: Add a search button to header-bar (1.86 KB, patch)
2015-04-28 12:59 UTC, Phillip Wood
committed Details | Review
AppChooser: Add an accelerator to toggle searching (1.54 KB, patch)
2015-04-28 13:27 UTC, Phillip Wood
committed Details | Review
Revert increase in required Gtk version (979 bytes, patch)
2015-04-29 18:03 UTC, Phillip Wood
committed Details | Review

Description Phillip Wood 2015-04-16 11:10:50 UTC
The AppChooser dialog has a number of rough edges:
 - It allows you to add the same application more than once
 - When filtering the list running applications are always hidden
 - The ‘Add Application’ button is active when there's no app selected
 - There's no mnemonic for ‘Add Application’
 - There's no default response set
 - Pressing ‘Escape’ re-focuses the search-bar rather than closing it
 - It ignores ‘gtk-dialogs-use-header’ setting
Comment 1 Phillip Wood 2015-04-16 11:20:36 UTC
Created attachment 301710 [details] [review]
StartUpTweak: Use g_application_mark_busy()

It can take a few seconds to create the AppChooser dialog so mark the
application as busy to provide some visual feedback when the ‘+’ button
is clicked.
Comment 2 Phillip Wood 2015-04-16 11:20:41 UTC
Created attachment 301711 [details] [review]
AppChooser: Include matching running apps when filtering

Running apps have two labels so match against both of them rather than
failing if the first doesn't match. This ensures that any apps that
match and are running get included in the filtered list.
Comment 3 Phillip Wood 2015-04-16 11:20:47 UTC
Created attachment 301712 [details] [review]
AppChooser: Don't show existing start-up apps

Pass a list of existing start-up applications to the AppChooser dialog so
it can avoid showing them.
Comment 4 Phillip Wood 2015-04-16 11:20:53 UTC
Created attachment 301713 [details] [review]
AppChooser: Desensitize ‘Add’ button when no app is selected

The ‘Add Application’ button shouldn't be sensitive if there is no
application currently selected. This is complicated be the fact that
when Gtk.Listbox filters the list it does not clear the selection if the
selected row is filtered out so we need to watch for the selected row
being umapped.
Comment 5 Phillip Wood 2015-04-16 11:20:58 UTC
Created attachment 301714 [details] [review]
AppChooser: Add a default response

Adding a default response improves the keyboard navigation as the user
can select an application by pressing ‘Enter’. It also changes the style
of the ‘Add Application’ button.
Comment 6 Phillip Wood 2015-04-16 11:21:03 UTC
Created attachment 301715 [details] [review]
AppChooser: Select app when row is activated

This allows the user to select a startup application by double clicking
on it rather than having to select it and then click on the ‘Add
Application’ button.
Comment 7 Phillip Wood 2015-04-16 11:21:09 UTC
Created attachment 301716 [details] [review]
AppChooser: Rationalize ‘Escape’ handling

Pressing ‘Escape’ when the search-bar is visible should close it, if the
search-bar is not visible it should close the dialog.
Comment 8 Phillip Wood 2015-04-16 11:21:14 UTC
Created attachment 301717 [details] [review]
AppChooser: Respect setting of gtk-dialogs-use-header

Use a header-bar for the start-up application chooser dialog if
‘gtk-dialogs-use-header’ is True. Rename the ‘Add Application’ button to
‘Add’ and add a mnemonic for it as well as changing the response of the
‘Close’ button so that it is placed on the opposite side of the
header-bar to the ‘Add’ button.
Comment 9 Rui Matos 2015-04-17 13:26:28 UTC
Review of attachment 301710 [details] [review]:

ok
Comment 10 Rui Matos 2015-04-17 13:29:21 UTC
Review of attachment 301711 [details] [review]:

fine
Comment 11 Rui Matos 2015-04-17 13:40:14 UTC
Review of attachment 301712 [details] [review]:

::: gtweak/tweaks/tweak_group_startup.py
@@ +55,3 @@
         apps = Gio.app_info_get_all()
         for a in apps:
+            for b in startup_apps:

ugh, if we have a large number of apps here this might take a while

@@ +252,3 @@
     def _on_add_clicked(self, btn):
         Gio.Application.get_default().mark_busy()
+        startup_apps = []

can we make this a set instead? would avoid the issue above
Comment 12 Rui Matos 2015-04-17 13:51:33 UTC
Review of attachment 301715 [details] [review]:

++
Comment 13 Rui Matos 2015-04-17 13:53:57 UTC
Review of attachment 301713 [details] [review]:

Don't like the complexity here. Isn't it enough to set the ListBox selection mode to GTK_SELECTION_BROWSE ?

::: gtweak/tweaks/tweak_group_startup.py
@@ +56,3 @@
         self.entry.connect("search-changed", lambda e: lb.invalidate_filter())
 
+        lb.connect("row-activated", lambda b, r: self.response(Gtk.ResponseType.OK))

this is duplicated on a patch further ahead, should be removed here
Comment 14 Rui Matos 2015-04-17 13:54:45 UTC
Review of attachment 301714 [details] [review]:

++
Comment 15 Rui Matos 2015-04-17 13:59:41 UTC
Review of attachment 301716 [details] [review]:

I agree that this feels better
Comment 16 Rui Matos 2015-04-17 14:01:32 UTC
Review of attachment 301717 [details] [review]:

anyway, fine

::: gtweak/tweaks/tweak_group_startup.py
@@ +34,3 @@
     def __init__(self, main_window, running_exes, startup_apps):
+        uhb = Gtk.Settings.get_default().props.gtk_dialogs_use_header
+        Gtk.Dialog.__init__(self, title=_("Applications"), use_header_bar=uhb)

GtkDialog doesn't do this by itself?
Comment 17 Phillip Wood 2015-04-27 10:11:17 UTC
(In reply to Rui Matos from comment #16)
> Review of attachment 301717 [details] [review] [review]:
> 
> anyway, fine
> 
> ::: gtweak/tweaks/tweak_group_startup.py
> @@ +34,3 @@
>      def __init__(self, main_window, running_exes, startup_apps):
> +        uhb = Gtk.Settings.get_default().props.gtk_dialogs_use_header
> +        Gtk.Dialog.__init__(self, title=_("Applications"),
> use_header_bar=uhb)
> 
> GtkDialog doesn't do this by itself?

Unfortunately it doesn't. Internally it uses gtk_dialog_set_use_header_bar_from_setting() for the derived dialogs (colorchooser etc) provided by Gtk but it does not export it.
Comment 18 Phillip Wood 2015-04-27 10:15:30 UTC
Created attachment 302431 [details] [review]
AppChooser: Don't show existing start-up apps

I've updated this to use a set as you suggested. This probably causes
conflicts with some later patches so I'll push a branch
wip/pwood/app-chooser with the current versions rather than obsoleting
the patches you've already approved.

Pass a set containing the existing start-up applications to the
AppChooser dialog so it can avoid showing them.
Comment 19 Phillip Wood 2015-04-27 10:25:53 UTC
Created attachment 302433 [details] [review]
AppChooser: Desensitize ‘Add’ button when no app is selected

In reply to comment 13
> Review of attachment 301713 [details] [review] [review]:
>
> Don't like the complexity here. Isn't it enough to set the ListBox
> selection mode to GTK_SELECTION_BROWSE ?

No, for some reason Gtk refuses to deselect a row when it's hidden by
the filter even though it looks to the user like there are no rows
selected (I wondered if it was due to the semantics of
GTK_SELECTION_BROWSE preventing the selection from being cleared, but
it is the same with GTK_SELECTION_SINGLE). I don't like it (I thought
this would be a quick change but it took quite a while to work out
what was going on) but this seems to be the only way to get it to
work. I've added a couple of comments to the code about this. This
patch now increases the required Gtk version as it needs 3.14 for
GtkListBox::row-selected.

>::: gtweak/tweaks/tweak_group_startup.py
>@@ +56,3 @@
>         self.entry.connect("search-changed", lambda e: lb.invalidate_filter())
>
>+        lb.connect("row-activated", lambda b, r: self.response(Gtk.ResponseType.OK))
>
>this is duplicated on a patch further ahead, should be removed here

Well spotted, it was from a bad rebase, I've fixed it.


The ‘Add Application’ button shouldn't be sensitive if there is no
application currently selected. This is complicated be the fact that
when Gtk.Listbox filters the list it does not clear the selection if the
selected row is filtered out so we need to watch for the selected row
being umapped.
Comment 20 Rui Matos 2015-04-27 14:16:10 UTC
Review of attachment 302431 [details] [review]:

fine
Comment 21 Rui Matos 2015-04-27 14:19:03 UTC
Review of attachment 302433 [details] [review]:

I'm pretty sure we can achieve the same result without all the signal juggling by

1) changing the search-changed handler to set_response_sensitive() if we have a selected row and it's mapped

2) set_response_sensitive() on the row-selected handler
Comment 22 Phillip Wood 2015-04-28 12:57:02 UTC
Created attachment 302509 [details] [review]
AppChooser: Desensitize ‘Add’ button when no app is selected

I've updated and simplified this as you suggested.

The ‘Add Application’ button shouldn't be sensitive if there is no
application currently selected. This is complicated be the fact that
when Gtk.Listbox filters the list it does not clear the selection so if
there is a selected row we need to check if it is mapped before changing
the state of the ‘Add Application’ button.
Comment 23 Phillip Wood 2015-04-28 12:58:13 UTC
Created attachment 302510 [details] [review]
AppChooser: Select app when row is activated

I've updated this to make sure it doesn't add an application when all
the applications are hidden by the filter.

This allows the user to select a startup application by double clicking
on it rather than having to select it and then click on the ‘Add
Application’ button. If there are now rows visible then GtkListBox will
activate the (hidden) selected row so we need to check that the
activated row is mapped.
Comment 24 Phillip Wood 2015-04-28 12:59:36 UTC
Created attachment 302511 [details] [review]
AppChooser: Add a search button to header-bar

This gives a visual prompt that it's possible to search the list of
applications.
Comment 25 Phillip Wood 2015-04-28 13:27:55 UTC
Created attachment 302513 [details] [review]
AppChooser: Add an accelerator to toggle searching

Use Control-f to toggle the state of the search-bar
Comment 26 Rui Matos 2015-04-28 16:49:47 UTC
Review of attachment 302511 [details] [review]:

looks good

::: gtweak/tweaks/tweak_group_startup.py
@@ +21,3 @@
 import logging
 
+from gi.repository import Gtk, Gdk, GLib, Gio, GObject

The aditional import shouldn't be needed
Comment 27 Rui Matos 2015-04-28 16:49:54 UTC
Review of attachment 302513 [details] [review]:

++
Comment 28 Rui Matos 2015-04-28 16:50:36 UTC
Review of attachment 302510 [details] [review]:

++
Comment 29 Rui Matos 2015-04-28 16:51:10 UTC
Review of attachment 302509 [details] [review]:

nice
Comment 30 Phillip Wood 2015-04-29 09:51:01 UTC
(In reply to Rui Matos from comment #26)
> Review of attachment 302511 [details] [review] [review]:
> 
> looks good
> 
> ::: gtweak/tweaks/tweak_group_startup.py
> @@ +21,3 @@
>  import logging
>  
> +from gi.repository import Gtk, Gdk, GLib, Gio, GObject
> 
> The aditional import shouldn't be needed

I get this error if I take it out
    self._binding = searchbtn.bind_property("active", self.searchbar, "search-mode-enabled", GObject.BindingFlags.BIDIRECTIONAL)
NameError: global name 'GObject' is not defined
Comment 31 Phillip Wood 2015-04-29 09:57:27 UTC
Attachment 301710 [details] pushed as f78155a - StartUpTweak: Use g_application_mark_busy()
Attachment 301711 [details] pushed as 7664aba - AppChooser: Include matching running apps when filtering
Attachment 301714 [details] pushed as 82924af - AppChooser: Add a default response
Attachment 301716 [details] pushed as 019eda9 - AppChooser: Rationalize ‘Escape’ handling
Attachment 301717 [details] pushed as 96014af - AppChooser: Respect setting of gtk-dialogs-use-header
Attachment 302431 [details] pushed as a4f5db2 - AppChooser: Don't show existing start-up apps
Attachment 302509 [details] pushed as 6874ba8 - AppChooser: Desensitize ‘Add’ button when no app is selected
Attachment 302510 [details] pushed as 1372b5f - AppChooser: Select app when row is activated
Attachment 302511 [details] pushed as ebc6b70 - AppChooser: Add a search button to header-bar
Attachment 302513 [details] pushed as c60d424 - AppChooser: Add an accelerator to toggle searching

Are you happy for me to backport the following patches to the 3.16
branch? It would be nice to have the fixes that don't require a Gtk
version bump or string changes in the stable branch. I can just
cherry-pick and push or open a new bug if you want to check them first.

f78155a StartUpTweak: Use g_application_mark_busy()
7664aba AppChooser: Include matching running apps when filtering
a4f5db2 AppChooser: Don't show existing start-up apps
82924af AppChooser: Add a default response
019eda9 AppChooser: Rationalize ‘Escape’ handling
Comment 32 Rui Matos 2015-04-29 11:08:58 UTC
(In reply to Phillip Wood from comment #30)
> I get this error if I take it out
>     self._binding = searchbtn.bind_property("active", self.searchbar,
> "search-mode-enabled", GObject.BindingFlags.BIDIRECTIONAL)
> NameError: global name 'GObject' is not defined

Ah, nevermind, I totally overlooked that last argument.

(In reply to Phillip Wood from comment #31)
> Are you happy for me to backport the following patches to the 3.16
> branch? It would be nice to have the fixes that don't require a Gtk
> version bump or string changes in the stable branch. I can just
> cherry-pick and push or open a new bug if you want to check them first.
> 
> f78155a StartUpTweak: Use g_application_mark_busy()
> 7664aba AppChooser: Include matching running apps when filtering
> a4f5db2 AppChooser: Don't show existing start-up apps
> 82924af AppChooser: Add a default response
> 019eda9 AppChooser: Rationalize ‘Escape’ handling

Yes please, just push them, thanks
Comment 33 Rui Matos 2015-04-29 11:17:11 UTC
Review of attachment 302509 [details] [review]:

::: configure.ac
@@ +10,2 @@
 DESKTOP_SCHEMAS_REQUIRED_VERSION=3.4.0
+GTK_REQUIRED_VERSION=3.14.0

Wait, why are we bumping this? Looks like all the API used here exists in 3.12
Comment 34 Rui Matos 2015-04-29 11:18:24 UTC
(In reply to Phillip Wood from comment #31)
> 6874ba8 - AppChooser: Desensitize ‘Add’ button when no app is selected
> 1372b5f - AppChooser: Select app when row is activated

I think these are ok for 3.16 too
Comment 35 Phillip Wood 2015-04-29 18:03:19 UTC
Created attachment 302598 [details] [review]
Revert increase in required Gtk version

In reply to comment 33
> Review of attachment 302509 [details] [review] [review]:
>
> ::: configure.ac
> @@ +10,2 @@
>  DESKTOP_SCHEMAS_REQUIRED_VERSION=3.4.0
> +GTK_REQUIRED_VERSION=3.14.0
>
> Wait, why are we bumping this? Looks like all the API used here
> exists in 3.12

Sorry, I'd somehow got it into my head that we needed 3.14 for the
‘row-activated’ and ‘row-selected’ signals.


6874ba8 AppChooser: Desensitize ‘Add’ button when no app is selected
erroneously increased the required Gtk version number.
Comment 36 Rui Matos 2015-04-29 18:08:47 UTC
Review of attachment 302598 [details] [review]:

push it
Comment 37 Phillip Wood 2015-04-29 18:10:57 UTC
Comment on attachment 302598 [details] [review]
Revert increase in required Gtk version

Attachment 302598 [details] pushed as 7e75c2a - Revert increase in required Gtk version
Comment 38 Phillip Wood 2015-04-29 18:11:28 UTC
(In reply to Rui Matos from comment #32)
> (In reply to Phillip Wood from comment #31)
> > Are you happy for me to backport the following patches to the 3.16
> > branch? It would be nice to have the fixes that don't require a Gtk
> > version bump or string changes in the stable branch. I can just
> > cherry-pick and push or open a new bug if you want to check them first.
> > 
> > f78155a StartUpTweak: Use g_application_mark_busy()
> > 7664aba AppChooser: Include matching running apps when filtering
> > a4f5db2 AppChooser: Don't show existing start-up apps
> > 82924af AppChooser: Add a default response
> > 019eda9 AppChooser: Rationalize ‘Escape’ handling
> 
> Yes please, just push them, thanks

> (In reply to Phillip Wood from comment #31)
> > 6874ba8 - AppChooser: Desensitize ‘Add’ button when no app is selected
> > 1372b5f - AppChooser: Select app when row is activated
>
> I think these are ok for 3.16 too

I've removed the version bump and pushed them