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 725352 - Add a nice layer popover menu
Add a nice layer popover menu
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on:
Blocks:
 
 
Reported: 2014-02-27 22:08 UTC by Mattias Bengtsson
Modified: 2014-03-27 07:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
street maptype image (32.16 KB, image/png)
2014-03-01 23:36 UTC, Andreas Nilsson
  Details
satellite maptype image (29.82 KB, image/png)
2014-03-01 23:37 UTC, Andreas Nilsson
  Details
layers icon (2.93 KB, image/svg+xml)
2014-03-01 23:46 UTC, Andreas Nilsson
  Details
Implemented layers popover menu. (109.11 KB, patch)
2014-03-05 00:19 UTC, Dario Di Nucci
needs-work Details | Review
Fix bug #725352 - add a new layers popover menu. (69.72 KB, patch)
2014-03-05 10:30 UTC, Dario Di Nucci
needs-work Details | Review
Fix bug #725352 - add a new layers popover menu. (108.40 KB, patch)
2014-03-05 10:38 UTC, Dario Di Nucci
needs-work Details | Review
New layers popover menu (108.79 KB, patch)
2014-03-05 13:14 UTC, Dario Di Nucci
needs-work Details | Review
New layers popover menu (94.41 KB, patch)
2014-03-05 16:00 UTC, Dario Di Nucci
needs-work Details | Review
visual mockup (433.34 KB, image/png)
2014-03-06 09:56 UTC, Andreas Nilsson
  Details
New layers popover menu (94.79 KB, patch)
2014-03-10 10:37 UTC, Dario Di Nucci
needs-work Details | Review
New layers popover menu (94.51 KB, patch)
2014-03-10 12:32 UTC, Dario Di Nucci
needs-work Details | Review
New layers popover menu (94.47 KB, patch)
2014-03-10 12:56 UTC, Dario Di Nucci
needs-work Details | Review
New layers popover menu (94.42 KB, patch)
2014-03-10 13:45 UTC, Dario Di Nucci
none Details | Review
New layers popover menu (94.40 KB, patch)
2014-03-10 16:56 UTC, Dario Di Nucci
needs-work Details | Review
New layers popover menu (94.26 KB, patch)
2014-03-15 13:18 UTC, Dario Di Nucci
committed Details | Review

Description Mattias Bengtsson 2014-02-27 22:08:16 UTC
Me and Andreas did some design work in January for the Headerbar (see here: https://raw.github.com/gnome-design-team/gnome-mockups/master/maps/headerbar-and-popup-ideas.png). 

It would be nice to have an implementation for the new layer menu seen in picture two from the top in maps.
Comment 1 Dario Di Nucci 2014-02-27 22:11:14 UTC
Start working on this now. =)
Comment 2 Mattias Bengtsson 2014-02-27 22:32:43 UTC
(In reply to comment #1)
> Start working on this now. =)

Great!
Comment 3 Andreas Nilsson 2014-03-01 23:36:38 UTC
Created attachment 270657 [details]
street maptype image
Comment 4 Andreas Nilsson 2014-03-01 23:37:04 UTC
Created attachment 270658 [details]
satellite maptype image
Comment 5 Andreas Nilsson 2014-03-01 23:46:17 UTC
Created attachment 270660 [details]
layers icon
Comment 6 Dario Di Nucci 2014-03-05 00:19:11 UTC
Created attachment 270957 [details] [review]
Implemented layers popover menu.
Comment 7 Mattias Bengtsson 2014-03-05 01:03:21 UTC
Review of attachment 270957 [details] [review]:

Great work! You'll need to add some info about the patch on the third line. Look in the history if you're unsure as to what we want there.

Don't feel bad about the many comments below btw. Click review to actually check them out and to reply to the comments.

Thanks for doing this!

::: src/gnome-maps.data.gresource.xml
@@ +15,3 @@
+    <file alias="maptype-satellite.png">../data/media/maptype-satellite.png</file>
+    <file alias="maptype-street.png">../data/media/maptype-street.png</file>
+    <file alias="layers.svg">../data/media/layers.svg</file>

Call this layers-button.svg and put it in ../data/icons/ instead.

::: src/layers-popup.ui
@@ +2,3 @@
+<interface>
+  <!-- interface-requires gtk+ 3.10 -->
+  <object class="GtkGrid" id="grid-box">

Just call this grid since there's both GtkGrid and GtkBox. "-box" just adds confusion IMO. Not very important though.

@@ +34,3 @@
+    </child>
+    <child>
+      <object class="GtkRadioButton" id="satellite-layer-button">

Let's call this aerial-layer-button (since the action-target is AERIAL too).

::: src/layersPopup.js
@@ +27,3 @@
+    ICON: 0,
+    TEXT: 1
+};

What are this for? Is it left overs from a copy-n-paste?
If it's not used it should be removed. :)

@@ +33,3 @@
+    Extends: Gtk.Popover,
+
+    _init: function(relativeTo) {

This parameter isn't needed, see below.

@@ +39,3 @@
+                                                    'street-layer-image',
+                                                    'satellite-layer-button',
+                                                    'satellite-layer-image',

These two *-image objects aren't used in the code below, can they be removed?

@@ +44,3 @@
+        this._gridBox = ui.gridBox;
+
+        this.parent({ relative_to: relativeTo,

This shouldn't be needed since you do this in mainwindow:
this._layersButton.popover = this._layersPopover;

When you set that property, the relative_to thing is set automatically.

@@ +47,3 @@
+                      width_request: 200,
+                      no_show_all: true,
+                      visible: true });

If you initialize this to false here the this.hide() below isn't needed.

@@ +51,3 @@
+        this._streetLayerButton = ui.streetLayerButton;
+        this._satelliteLayerButton = ui.satelliteLayerButton;
+        this._satelliteLayerButton.join_group(this._streetLayerButton);

Why did you get these warnings when doing the group joining the UI-file? 
I'd like to have this in the UI-file if possible.

@@ +55,3 @@
+        this.get_style_context().add_class('maps-popover');
+        this.add(this._gridBox);
+        this.hide();

Shouldn't be needed. See above.

::: src/main-window.ui
@@ +72,3 @@
             </style>
             <child>
+              <object class="GtkImage" id="layers-image">

I think layers-button-image is better.

::: src/mainWindow.js
@@ +66,3 @@
+                                                    'search-completion',
+                                                    'layers-button']);
+        this._layersButton = ui.layersButton;

I think you can skip the initLayersWidgets method below and just do this instead:

let layersPopover = new LayersPopup.LayersPopup(ui.layersButton);
ui.layersButton.popover = layersPopover;
Comment 8 Zeeshan Ali 2014-03-05 01:23:37 UTC
(In reply to comment #6)
> Created an attachment (id=270957) [details] [review]
> Implemented layers popover menu.

You want to use 'present rather than past tense': Implemented -> implement. As Mattias pointed out, the commit log needs some love: https://wiki.gnome.org/Git/CommitMessages
Comment 9 Dario Di Nucci 2014-03-05 10:30:23 UTC
Created attachment 270970 [details] [review]
Fix bug #725352 - add a new layers popover menu.

This patch implement the new layers popover menu.
The new module is an extension of Gtk.Popover.
The new menu provides a gtk_radio_button for selecting between the aerial and the street view.

Fixed all the troubles coming from the review, except one.
Setting the radio button properties 'group' in the ui gives a warning.
For this reason the radio button grouping is setup in the js file.
Comment 10 Dario Di Nucci 2014-03-05 10:36:41 UTC
Review of attachment 270970 [details] [review]:

In this patch an icon is missing.
Comment 11 Dario Di Nucci 2014-03-05 10:38:18 UTC
Created attachment 270971 [details] [review]
Fix bug #725352 - add a new layers popover menu.

This patch implement the new layers popover menu.
The new module is an extension of Gtk.Popover.
The new menu provides a gtk_radio_button for selecting between the aerial and
the street view.

Fixed all the troubles coming from the review, except one.
Setting the radio button properties 'group' in the ui gives a warning.
For this reason the radio button grouping is setup in the js file.

-- Added the missing icon.
Comment 12 Zeeshan Ali 2014-03-05 12:08:36 UTC
Review of attachment 270970 [details] [review]:

The commit log doesn't say anything about the change. :( Please follow these guidelines: https://wiki.gnome.org/Git/CommitMessages (there is even a checklist in there now). Oh and for bug referencing, we use the default format of git-bz: Put a link to the bug as the last line with an empty line above it.
Comment 13 Zeeshan Ali 2014-03-05 12:09:45 UTC
Review of attachment 270971 [details] [review]:

I commented on the obsolete patch it seems (please mark them as obsolete btw, `git-bz attach -e` makes that super easy). Anyway, same comment applies here.
Comment 14 Dario Di Nucci 2014-03-05 12:37:18 UTC
Comment on attachment 270971 [details] [review]
Fix bug #725352 - add a new layers popover menu.

This patch implements the new layers popover menu.
The new module is an extension of Gtk.Popover.
The new menu provides a gtk_radio_button for selecting between the aerial and
the street view.
There is just a thing to fix.
Setting the radio button properties 'group' in the ui gives a warning.
For this reason the radio button grouping is setup in the js file.
Comment 15 Jonas Danielsson 2014-03-05 13:13:30 UTC
Review of attachment 270971 [details] [review]:

Hi, thanks for the patch!

The icons included are all routing icons. I do not see the icons actually referenced (maptype-*.png) in the patch included. Something went wrong?

Comments below!

::: src/layersPopup.js
@@ +26,3 @@
+const LayersPopup = new Lang.Class({
+    Name: 'LayersPopup',
+    Extends: Gtk.Popover,

Maybe LayersPopover is a better name for this class?

@@ +44,3 @@
+        this._aerialLayerButton = ui.aerialLayerButton;
+        this._aerialLayerButton.join_group(this._streetLayerButton);
+

Are we sure this is needed? And can't be done in ui file? Have you checked how it is done in the gtk3+ example? It can be found under the gtk+ checkout dir at: demos/widget-factory/widget-factory.ui

::: src/mainWindow.js
@@ +80,3 @@
+        
+        let layersPopover = new LayersPopup.LayersPopup(ui.layersButton);
+        ui.layersButton.popover = layersPopover;

The LayersPopup class does no longer take a button as an argument, right?

@@ +121,2 @@
         this._searchEntry.connect('changed',
                                   this._searchPopup.hide.bind(this._searchPopup));

This line removal should not be included in the patch.
Comment 16 Dario Di Nucci 2014-03-05 13:14:13 UTC
Created attachment 270987 [details] [review]
New layers popover menu

This patch implements the new layers popover menu. The new module is an extension of Gtk.Popover. Inside the menu there is a radio button group that allows the user to select a view (aerial or street).
Note that setting the radio button properties 'group' in the ui file gives a warning and for this reason the radio button grouping is coded in the js file.
Comment 17 Jonas Danielsson 2014-03-05 13:17:39 UTC
Review of attachment 270987 [details] [review]:

Thanks!

My comments from the last patch attachments are still valid on this one!
Comment 18 Dario Di Nucci 2014-03-05 14:11:23 UTC

(In reply to comment #15)
> Review of attachment 270971 [details] [review]:
> 
> Hi, thanks for the patch!
> 
> The icons included are all routing icons. I do not see the icons actually
> referenced (maptype-*.png) in the patch included. Something went wrong?

For now the routing icons are not needed the routing is not complete.
I just used layers-button.svg and the maptypes. If you consider not right to put them in this patch, I could remove them.

 
> Comments below!
> 
> ::: src/layersPopup.js
> @@ +26,3 @@
> +const LayersPopup = new Lang.Class({
> +    Name: 'LayersPopup',
> +    Extends: Gtk.Popover,
> 
> Maybe LayersPopover is a better name for this class?

Fixed in the next patch.
 
> @@ +44,3 @@
> +        this._aerialLayerButton = ui.aerialLayerButton;
> +        this._aerialLayerButton.join_group(this._streetLayerButton);
> +
> 
> Are we sure this is needed? And can't be done in ui file? Have you checked how
> it is done in the gtk3+ example? It can be found under the gtk+ checkout dir
> at: demos/widget-factory/widget-factory.ui

If I don't do in this way the radio button continue to work but I have this warning:

(gnome-maps:5350): Gtk-CRITICAL **: gtk_radio_button_set_group: assertion '!g_slist_find (group, radio_button)' failed


> ::: src/mainWindow.js
> @@ +80,3 @@
> +        
> +        let layersPopover = new LayersPopup.LayersPopup(ui.layersButton);
> +        ui.layersButton.popover = layersPopover;
> 
> The LayersPopup class does no longer take a button as an argument, right?

Fixed in the next patch.

> @@ +121,2 @@
>          this._searchEntry.connect('changed',
>                                   
> this._searchPopup.hide.bind(this._searchPopup));
> 
> This line removal should not be included in the patch.

Sorry :-)
Comment 19 Jonas Danielsson 2014-03-05 15:05:40 UTC
(In reply to comment #18)
> 
> (In reply to comment #15)
> > Review of attachment 270971 [details] [review] [details]:
> > 
> > Hi, thanks for the patch!
> > 
> > The icons included are all routing icons. I do not see the icons actually
> > referenced (maptype-*.png) in the patch included. Something went wrong?
> 
> For now the routing icons are not needed the routing is not complete.
> I just used layers-button.svg and the maptypes. If you consider not right to
> put them in this patch, I could remove them.
> 
> 

Yes please, the routing icons should not be added in this patch. And also make sure that the maptype icons are included they were not included in the last patch.


> > Comments below!
> > 
> > ::: src/layersPopup.js
> > @@ +26,3 @@
> > +const LayersPopup = new Lang.Class({
> > +    Name: 'LayersPopup',
> > +    Extends: Gtk.Popover,
> > 
> > Maybe LayersPopover is a better name for this class?
> 
> Fixed in the next patch.
> 
> > @@ +44,3 @@
> > +        this._aerialLayerButton = ui.aerialLayerButton;
> > +        this._aerialLayerButton.join_group(this._streetLayerButton);
> > +
> > 
> > Are we sure this is needed? And can't be done in ui file? Have you checked how
> > it is done in the gtk3+ example? It can be found under the gtk+ checkout dir
> > at: demos/widget-factory/widget-factory.ui
> 
> If I don't do in this way the radio button continue to work but I have this
> warning:
> 
> (gnome-maps:5350): Gtk-CRITICAL **: gtk_radio_button_set_group: assertion
> '!g_slist_find (group, radio_button)' failed
> 
> 
> > ::: src/mainWindow.js
> > @@ +80,3 @@
> > +        
> > +        let layersPopover = new LayersPopup.LayersPopup(ui.layersButton);
> > +        ui.layersButton.popover = layersPopover;
> > 
> > The LayersPopup class does no longer take a button as an argument, right?
> 
> Fixed in the next patch.
> 
> > @@ +121,2 @@
> >          this._searchEntry.connect('changed',
> >                                   
> > this._searchPopup.hide.bind(this._searchPopup));
> > 
> > This line removal should not be included in the patch.
> 
> Sorry :-)

Also again, make sure that the patch applies cleanly to master and that all files that should be included are included.

Thanks!
Comment 20 Dario Di Nucci 2014-03-05 16:00:41 UTC
Created attachment 271004 [details] [review]
New layers popover menu

This patch implements the new layers popover menu. The new module is an extension of Gtk.Popover. Inside the menu there is a radio button group that allows the user to select a view (aerial or street).
Note that setting the radio button properties 'group' in the ui file gives a warning and for this reason the radio button grouping is coded in the js file.
Comment 21 Jonas Danielsson 2014-03-05 19:17:47 UTC
Review of attachment 271004 [details] [review]:

Thanks!

I can now apply the patch using git bz apply.


I would like some desinger, Andreas maybe?, to look at how this look before we commit this. The arrow pointing thing is not in the center of the box for instance, could that be fixed? Should it be fixed?

Some additional comments below about whitespace damage. It might be wise to see if your editor has some way to show whitespace.

::: src/layersPopover.js
@@ +27,3 @@
+    Name: 'LayersPopover',
+    Extends: Gtk.Popover,
+

Some whitespace damage here.

@@ +34,3 @@
+                                                    'aerial-layer-button',
+                                                    ]);
+        

And here as well.

@@ +40,3 @@
+                      no_show_all: true,
+                      visible: false });
+                      

And whitespace damage here too.

::: src/mainWindow.js
@@ +78,2 @@
         this._contextMenu = new ContextMenu.ContextMenu(this.mapView);
+        

Whitespace damage here.
Comment 22 Andreas Nilsson 2014-03-06 09:56:50 UTC
Created attachment 271078 [details]
visual mockup

> I would like some desinger, Andreas maybe?, to look at how this look before we
> commit this. The arrow pointing thing is not in the center of the box for
> instance, could that be fixed? Should it be fixed?

I think it's a very good start!
Visually, I envisioned something like the attached mockup.
So no button appearance, and just a border and then blue border to indicate the selected map type.
Comment 23 Dario Di Nucci 2014-03-10 10:37:13 UTC
Created attachment 271416 [details] [review]
New layers popover menu

Replace the map-type-menu with a new popover menu for switching between views (aerial and street).
Comment 24 Jonas Danielsson 2014-03-10 11:55:30 UTC
Review of attachment 271416 [details] [review]:

Thanks, looks great.

Is there anyway of making this keyboard accessible? So that one could use the keyboard to choose the layer style.
Hopefully Andreas or Mattias can comment on how this looks ui-wise.

I have some nit comments below.

::: src/layers-popover.ui
@@ +13,3 @@
+        <property name="action-target">"STREET"</property>
+        <property name="draw_indicator">False</property>
+        <property name="receives_default">True</property>

You mix using '-' and '_' to separate the names of the properties, might want to stick to one.

Also: why does it need receives_default?

@@ +39,3 @@
+        <property name="action-target">"AERIAL"</property>
+        <property name="draw_indicator">False</property>
+        <property name="receives_default">True</property>

Same question about default here.

::: src/layersPopover.js
@@ +29,3 @@
+
+    _init: function() {
+

This blank line should be removed.

@@ +39,3 @@
+                      visible: false });
+
+        ui.aerialLayerButton.join_group(ui.streetLayerButton);

This still bugs me :) But I don't know how to fix it. The funny thing is that when you run the gtk3-widget-factory demo, found in the demo directory of gtk+ you don't get this warning. But I can't see what the difference between your ui-file and the gtk one is. Would like to fix it, but can live with having it in js-code as well if a fix is not easily found. Maybe a bug should be placed towards gtk+.

@@ +43,3 @@
+        ui.streetLayerButton.get_style_context().add_class('layer-radio-button');
+        ui.aerialLayerButton.get_style_context().add_class('layer-radio-button');
+

These can be set from the ui-file. <class name="layer-radio-button"/> same way you set the "image-button" class.
Comment 25 Dario Di Nucci 2014-03-10 12:32:39 UTC
Created attachment 271426 [details] [review]
New layers popover menu

Replace the map-type-menu with a new popover menu for switching between views (aerial and street).

The keyboard navigation is still not implemented. Waiting for comments :-)
Comment 26 Jonas Danielsson 2014-03-10 12:51:00 UTC
Review of attachment 271426 [details] [review]:

Thanks!

Some more nits below :)

::: src/layersPopover.js
@@ +32,3 @@
+                                                    'street-layer-button',
+                                                    'aerial-layer-button',
+                                                    ]);

These does not appear to be aligned properly.

::: src/mainWindow.js
@@ +70,3 @@
 
+        let layersPopover = new LayersPopover.LayersPopover();
+        ui.layersButton.popover = layersPopover;

Thinking about it, we don't really need the layersPopover temp variable here, right?
We could go ui.layersButton.popover = new LayersPopover.LayersPopover();
Comment 27 Jonas Danielsson 2014-03-10 12:52:36 UTC
Review of attachment 271426 [details] [review]:

Also, the commit message does not follow guidelines atm, the body has too long line, the limit is 74 iirc.
Comment 28 Dario Di Nucci 2014-03-10 12:56:27 UTC
Created attachment 271427 [details] [review]
New layers popover menu

Replace the map-type-menu with a new popover menu for switching between views (aerial and street).

The keyboard navigation is still not implemented. Waiting for comments :-)
Comment 29 Jonas Danielsson 2014-03-10 13:00:48 UTC
Review of attachment 271427 [details] [review]:

Thank you!

What comments are you waiting for regarding keyboard accessibility?

::: src/layersPopover.js
@@ +31,3 @@
+        let ui = Utils.getUIObject('layers-popover', ['grid',
+                                                     'street-layer-button',
+                                                     'aerial-layer-button',

Still not aligned :)
Comment 30 Dario Di Nucci 2014-03-10 13:40:07 UTC
Review of attachment 271427 [details] [review]:

Waiting for comments by Andreas or Mattias.
Comment 31 Dario Di Nucci 2014-03-10 13:45:58 UTC
Created attachment 271431 [details] [review]
New layers popover menu

Replace the map-type-menu with a new popover menu for switching between
views (aerial and street).
Comment 32 Dario Di Nucci 2014-03-10 16:56:06 UTC
Created attachment 271449 [details] [review]
New layers popover menu

Replace the map-type-menu with a new popover menu for switching between
views (aerial and street).
Comment 33 Dario Di Nucci 2014-03-10 17:02:22 UTC
Jonas the menu now is keyboard accessible. :-)
Comment 34 Jonas Danielsson 2014-03-11 11:06:42 UTC
Review of attachment 271449 [details] [review]:

Great, thanks!

It's a bit hard to see the focus thingie, but it might be ok.

Andreas, Mattias, what do you say is the UI ok to go (including the focus ring while using the kb)?
Comment 35 Andreas Nilsson 2014-03-11 11:28:06 UTC
(In reply to comment #34)
> Review of attachment 271449 [details] [review]:
> Andreas, Mattias, what do you say is the UI ok to go (including the focus ring
> while using the kb)?

I'm all right with the focus look of things as it seems it's the only way to indicate keyboard accessibility.
Comment 36 Mattias Bengtsson 2014-03-11 13:08:22 UTC
I don't have time to test this until tomorrow evening, but I trust Andreas' judgment. :)
Comment 37 Jonas Danielsson 2014-03-14 19:26:49 UTC
Review of attachment 271449 [details] [review]:

I still want Andreas or Mattias to give a final "this UI is good to go". But it's no rush. GNOME is in ui freeze so this will not be commited until after 3.12.
I found some more nits. When they are cleared up and I get an ok for the UI I will mark this as commit_after_freeze and you can reference that in your application.

::: data/gnome-maps.css
@@ +28,3 @@
 }
 
+.layer-radio-button{

Insert a space before the curly bracket.

@@ +39,3 @@
+}
+
+.layer-radio-button:active{

Insert a space before the curly bracket.

@@ +42,3 @@
+    border: 2px solid @suggested_action_button_a;
+}
+

This lands in between different styling for the zoom-control, maybe it could be moved above the zoom related css?

::: src/layersPopover.js
@@ +31,3 @@
+        let ui = Utils.getUIObject('layers-popover', [ 'grid',
+                                                       'street-layer-button',
+                                                       'aerial-layer-button']);

Needs a space before the end bracket.
Comment 38 Dario Di Nucci 2014-03-15 13:09:14 UTC
Review of attachment 271449 [details] [review]:

It's a trade off if the focus is more visible than we have more space between the border and the image.
Comment 39 Dario Di Nucci 2014-03-15 13:10:07 UTC
Review of attachment 271449 [details] [review]:

Going to have these small changes right now and upload soon the new patch.
Comment 40 Dario Di Nucci 2014-03-15 13:18:52 UTC
Created attachment 272001 [details] [review]
New layers popover menu

Replace the map-type-menu with a new popover menu for switching between
views (aerial and street).
Comment 41 Jonas Danielsson 2014-03-16 18:56:08 UTC
Review of attachment 272001 [details] [review]:

Thanks a lot Dario!

I will mark this with commit_after_freeze and it will be committed to master after the 3.12 release is over.
Comment 42 Jonas Danielsson 2014-03-27 07:31:41 UTC
Attachment 272001 [details] pushed as 93710ef - New layers popover menu