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 740647 - Use Gtk+'s Composite Widget Templates feature
Use Gtk+'s Composite Widget Templates feature
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on:
Blocks:
 
 
Reported: 2014-11-24 17:46 UTC by Damián Nohales
Modified: 2015-08-23 17:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
LayersPopover: Use templates (6.59 KB, patch)
2015-03-24 03:34 UTC, Mattias Bengtsson
reviewed Details | Review
ZoomControl: Use Templates (5.98 KB, patch)
2015-03-24 03:34 UTC, Mattias Bengtsson
committed Details | Review
InstructionRow: Use Templates (8.66 KB, patch)
2015-03-24 03:34 UTC, Mattias Bengtsson
committed Details | Review
Sidebar: Use Templates (18.83 KB, patch)
2015-03-24 03:35 UTC, Mattias Bengtsson
committed Details | Review
MainWindow: Use Templates (13.35 KB, patch)
2015-03-24 03:35 UTC, Mattias Bengtsson
committed Details | Review
MainWindow: Use params pattern for _init (1.96 KB, patch)
2015-03-24 03:35 UTC, Mattias Bengtsson
committed Details | Review
MainWindow: Use getter for mapView (6.43 KB, patch)
2015-03-24 03:35 UTC, Mattias Bengtsson
committed Details | Review
ContextMenu: Use Templates (2.88 KB, patch)
2015-03-24 03:35 UTC, Mattias Bengtsson
committed Details | Review
ContextMenu: Use params pattern (1.66 KB, patch)
2015-03-24 03:35 UTC, Mattias Bengtsson
committed Details | Review

Description Damián Nohales 2014-11-24 17:46:35 UTC
Now that Gtk+'s Composite Widget Templates feature is with us for a while and that Gjs implemented a good integration of it, it'd be nice to use this feature in Maps, so we can make the code to look even nicer and move a lot of JS code to GtkBuilder files.

Actually, this ticket is intended to formalize the development of the branch wip/templates and to add new work to it, so we can review it and integrate the code to master from BZ.

I'll try to submit in the following days a patch-set with the current wip/template work (rebased and with the fixups squashed, of course) and more work necessary to complete this refactorization.
Comment 1 Mattias Bengtsson 2015-03-24 03:34:46 UTC
Created attachment 300169 [details] [review]
LayersPopover: Use templates
Comment 2 Mattias Bengtsson 2015-03-24 03:34:52 UTC
Created attachment 300170 [details] [review]
ZoomControl: Use Templates
Comment 3 Mattias Bengtsson 2015-03-24 03:34:57 UTC
Created attachment 300171 [details] [review]
InstructionRow: Use Templates
Comment 4 Mattias Bengtsson 2015-03-24 03:35:04 UTC
Created attachment 300172 [details] [review]
Sidebar: Use Templates
Comment 5 Mattias Bengtsson 2015-03-24 03:35:10 UTC
Created attachment 300173 [details] [review]
MainWindow: Use Templates

Since we need to inherit from a GObject to be templated this patch also
makes MainWindow extend Gtk.ApplicationWindow.
Comment 6 Mattias Bengtsson 2015-03-24 03:35:16 UTC
Created attachment 300174 [details] [review]
MainWindow: Use params pattern for _init

This makes MainWindow consistent with most other classes in Maps.
Comment 7 Mattias Bengtsson 2015-03-24 03:35:22 UTC
Created attachment 300175 [details] [review]
MainWindow: Use getter for mapView

This adds consistency to our coding style.
Comment 8 Mattias Bengtsson 2015-03-24 03:35:28 UTC
Created attachment 300176 [details] [review]
ContextMenu: Use Templates
Comment 9 Mattias Bengtsson 2015-03-24 03:35:34 UTC
Created attachment 300177 [details] [review]
ContextMenu: Use params pattern

This makes ContextMenu consistent with most other classes in Maps.
Comment 10 Mattias Bengtsson 2015-03-24 03:37:32 UTC
The patches above moves Maps to use templates for all cases that I'm sure it works.
Still not sure about how to use templates when inheriting from another template class, but let's take that on later.

There's also some small cleanup patches sprinkled in.
Comment 11 Jonas Danielsson 2015-03-24 06:03:01 UTC
(In reply to Mattias Bengtsson from comment #10)
> The patches above moves Maps to use templates for all cases that I'm sure it
> works.
> Still not sure about how to use templates when inheriting from another
> template class, but let's take that on later.
> 
> There's also some small cleanup patches sprinkled in.

Thanks for doing this!
Comment 12 Jonas Danielsson 2015-03-24 06:05:15 UTC
Review of attachment 300169 [details] [review]:

Thanks!

::: data/ui/layers-popover.ui
@@ +63,3 @@
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>

Nit: Are these packing attributes (and the one above), needed? Would the result not be the same with them gone?

::: src/layersPopover.js
@@ +37,1 @@
+        this._aerialLayerButton.join_group(this._streetLayerButton);

And this is still needed? : (
Comment 13 Jonas Danielsson 2015-03-24 06:06:26 UTC
Review of attachment 300170 [details] [review]:

Nice!
Comment 14 Jonas Danielsson 2015-03-24 06:07:47 UTC
Review of attachment 300171 [details] [review]:

(o/

::: data/ui/sidebar.ui
@@ -246,3 @@
-      </packing>
-    </child>
-        <property name="xalign">0</property>

Sweet!
Comment 15 Jonas Danielsson 2015-03-24 06:08:46 UTC
Review of attachment 300172 [details] [review]:

\o/
Comment 16 Jonas Danielsson 2015-03-24 06:10:35 UTC
Review of attachment 300173 [details] [review]:

Åsm!

::: src/application.js
@@ +233,2 @@
     },
 

Looks much better!

::: src/mainWindow.js
@@ +92,3 @@
         this._busySignalId = 0;
 
+        this._grid.attach(this._sidebar, 1, 0, 1, 1);

Still not possible to do this in ui file I guess?
Comment 17 Jonas Danielsson 2015-03-24 06:11:45 UTC
Review of attachment 300174 [details] [review]:

Ack!
Comment 18 Jonas Danielsson 2015-03-24 06:12:57 UTC
Review of attachment 300175 [details] [review]:

Ok!
Comment 19 Jonas Danielsson 2015-03-24 06:14:31 UTC
Review of attachment 300176 [details] [review]:

Yes!
Comment 20 Jonas Danielsson 2015-03-24 06:14:53 UTC
Review of attachment 300177 [details] [review]:

(o/
Comment 21 Jonas Danielsson 2015-03-24 06:15:38 UTC
I say "commit-now" but we should wait until we branch off gnome-3-16.
Comment 22 Mattias Bengtsson 2015-03-24 19:54:47 UTC
Review of attachment 300169 [details] [review]:

::: data/ui/layers-popover.ui
@@ +63,3 @@
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>

I have no idea. I think Glade likes to insert them and that's why they're there. I'm not even sure what it does. 
I could really see a general cleanup patch of our ui files removing stuff like this, but that's for a later patch series.

::: src/layersPopover.js
@@ +37,1 @@
+        this._aerialLayerButton.join_group(this._streetLayerButton);

Yeah I got rid of it in a separate patch that I'll attach soon.
Comment 23 Jonas Danielsson 2015-04-13 19:36:02 UTC
Attachment 300170 [details] pushed as 74d3a12 - ZoomControl: Use Templates
Attachment 300171 [details] pushed as fe270c5 - InstructionRow: Use Templates
Attachment 300172 [details] pushed as 16da0c7 - Sidebar: Use Templates
Attachment 300173 [details] pushed as 6650c30 - MainWindow: Use Templates
Attachment 300174 [details] pushed as c7e6f39 - MainWindow: Use params pattern for _init
Attachment 300175 [details] pushed as a09e957 - MainWindow: Use getter for mapView
Attachment 300176 [details] pushed as 8ca738f - ContextMenu: Use Templates
Attachment 300177 [details] pushed as 0ab663b - ContextMenu: Use params pattern