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 731540 - Make it easier to perform new searches without using the mouse
Make it easier to perform new searches without using the mouse
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on:
Blocks:
 
 
Reported: 2014-06-11 22:53 UTC by Mattias Bengtsson
Modified: 2014-10-19 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Added ctrl+f accelerator. (1.31 KB, patch)
2014-10-01 14:10 UTC, Ankita Patil
reviewed Details | Review
Added _initAccelerator() so that we can have the other accelerator in the same method. (3.23 KB, patch)
2014-10-02 10:41 UTC, Ankita Patil
committed Details | Review
Added Ctrl+F accelerator. (1.90 KB, patch)
2014-10-02 10:57 UTC, Ankita Patil
committed Details | Review

Description Mattias Bengtsson 2014-06-11 22:53:32 UTC
It would be nice to not have to use the mouse to perform a new search when you have interacted with the map a bit.

One possibility is to do it like in the content apps and just search on type. 

Another (arguably easier to get working right) is to do like in Web and Firefox and bind Ctrl+L to move to the search field.
Comment 1 Mattias Bengtsson 2014-06-11 22:54:31 UTC
Or instead of Ctrl+L you could do Ctrl+F f or find. Not sure there.
Comment 2 Jonas Danielsson 2014-06-19 07:23:56 UTC
Well the reason we made the map grab focus was because it made it impossible for tablets to dismiss the on-screen-keyboard.

So search on type might be out.

A shortcut might be fine.
Comment 3 Ankita Patil 2014-10-01 14:10:38 UTC
Created attachment 287517 [details] [review]
Added ctrl+f accelerator.
Comment 4 Damián Nohales 2014-10-01 17:19:08 UTC
Review of attachment 287517 [details] [review]:

Thanks for the patch!

I am not a fully experienced Gtk+ developer (I didn't suffered much of the Gtk+ 2 epoch :) ), so maybe I'm wrong.

I think a most modern approach is by creating a new action in the main window that focus on the search entry when it's activated and then bind an accelerator by using gtk_application_add_accelerator.
Comment 5 Jonas Danielsson 2014-10-02 07:53:13 UTC
Review of attachment 287517 [details] [review]:

Hi thanks for patch!

Yes, I agree with Damián. Almost.

This is what the docs say:
"gtk_application_add_accelerator has been deprecated since version 3.14 and should not be used in newly-written code.
Use gtk_application_set_accels_for_action() instead"

So yes, I think we should use gtk_application_set_accels_for_action()
Where the detailed_action_name shoud probably be: 'win.find' and the accels: '<Primary>f' ? Or '<Control>f' ?
You can check the gedit source for reference.

Then you need to add the 'find' action to mainWindow.js with an appropriate signal handler. Check the syntax for the other actions in _initActions.

Jonas
Comment 6 Jonas Danielsson 2014-10-02 07:54:04 UTC
Or maybe it should be called win.search and action name search.
Comment 7 Ankita Patil 2014-10-02 10:41:15 UTC
Created attachment 287573 [details] [review]
Added _initAccelerator() so that we can have the other accelerator in the same method.
Comment 8 Ankita Patil 2014-10-02 10:57:22 UTC
Created attachment 287574 [details] [review]
Added Ctrl+F accelerator.
Comment 9 Jonas Danielsson 2014-10-02 11:39:16 UTC
Review of attachment 287573 [details] [review]:

Thanks this looks great!

One small nit below, but that can be fixed up in merge.

::: src/mainWindow.js
@@ +164,3 @@
+                signalHandlers: {
+                    activate:  this.mapView.view.zoom_out.bind(this.mapView.view)
+                }

There is an extra space between activate: and the callack.
Comment 10 Jonas Danielsson 2014-10-02 11:40:06 UTC
Review of attachment 287574 [details] [review]:

Thanks, looks great!
Comment 11 Jonas Danielsson 2014-10-02 11:40:42 UTC
Will be commited after we branch off gnome-3-14, we are still collecting pure bugfixes for the 3.14.1 release.
Comment 12 Mattias Bengtsson 2014-10-02 21:04:41 UTC
Great work Ankita!

I think it would make sense to move the calls to set_accels_for_action into Utils.initActions though.

That way you would write code like:

{
  properties: { name: 'find' },
  signalHandlers: {
      activate: this._placeEntry.grab_focus.bind(this._placeEntry)
  },
  accels: ['<Primary>F']
}

And have all that code collected in one place.

Jonas what do you think?
Comment 13 Jonas Danielsson 2014-10-03 12:39:31 UTC
(In reply to comment #12)
> Great work Ankita!
> 
> I think it would make sense to move the calls to set_accels_for_action into
> Utils.initActions though.
> 
> That way you would write code like:
> 
> {
>   properties: { name: 'find' },
>   signalHandlers: {
>       activate: this._placeEntry.grab_focus.bind(this._placeEntry)
>   },
>   accels: ['<Primary>F']
> }
> 
> And have all that code collected in one place.
> 
> Jonas what do you think?

Good idea! That works for me!

Ankita, mind doing the change?
Comment 14 Jonas Danielsson 2014-10-19 13:12:21 UTC
I pushed these patches. I noticed that we are already using deprecated methods in our Utils actions code. Let's take a closer look at how we are supposed to do actions later, and maybe we can couple the accelerators better then.