diff options
author | Alex Anthony <alex.anthony28991@gmail.com> | 2016-01-10 17:14:51 +0000 |
---|---|---|
committer | Jonas Danielsson <jonas@threetimestwo.org> | 2016-01-18 18:33:02 +0100 |
commit | 64828459ee69a75087e70867f03d08582592cb64 (patch) | |
tree | f77e60ef618f9cf50816693000cc0ebea49af177 | |
parent | 0a8dceb53a81af82efa8ae2181282434e4061eab (diff) | |
download | gnome-maps-64828459ee69a75087e70867f03d08582592cb64.tar.gz |
exportViewDialog: Add option to include/exclude layers
Add a checkbox in the export view dialog to allow the user to decide
whether or not to include layers in the export.
https://bugzilla.gnome.org/show_bug.cgi?id=760353
-rw-r--r-- | data/ui/export-view-dialog.ui | 19 | ||||
-rw-r--r-- | src/exportViewDialog.js | 15 |
2 files changed, 31 insertions, 3 deletions
diff --git a/data/ui/export-view-dialog.ui b/data/ui/export-view-dialog.ui index 81bb2f69..993a5339 100644 --- a/data/ui/export-view-dialog.ui +++ b/data/ui/export-view-dialog.ui @@ -87,7 +87,7 @@ <property name="left_attach">0</property> <property name="top_attach">0</property> <property name="width">1</property> - <property name="height">2</property> + <property name="height">3</property> </packing> </child> <child> @@ -121,6 +121,23 @@ <property name="height">1</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="layersCheckButton"> + <property name="label" translatable="yes">Include route and markers</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <property name="active">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> </object> </child> </object> diff --git a/src/exportViewDialog.js b/src/exportViewDialog.js index 2894ac9d..15e1e543 100644 --- a/src/exportViewDialog.js +++ b/src/exportViewDialog.js @@ -41,7 +41,8 @@ const ExportViewDialog = new Lang.Class({ 'cancelButton', 'filenameEntry', 'fileChooserButton', - 'previewArea' ], + 'previewArea', + 'layersCheckButton' ], _init: function(params) { this._surface = params.surface; @@ -67,6 +68,9 @@ const ExportViewDialog = new Lang.Class({ this._fileChooserButton.connect('file-set', this._onFolderChanged.bind(this)); + this._layersCheckButton.connect('toggled', + this._includeLayersChanged.bind(this)); + this._folder = GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES); if (!this._folder) @@ -98,7 +102,7 @@ const ExportViewDialog = new Lang.Class({ cr.paint(); cr.setOperator(Cairo.Operator.OVER); - cr.scale(this._scaleFactor, this._scaleFactor) + cr.scale(this._scaleFactor, this._scaleFactor); cr.setSourceSurface(this._surface, 0, 0); cr.paint(); }, @@ -170,5 +174,12 @@ const ExportViewDialog = new Lang.Class({ dialog.run(); dialog.destroy(); } + }, + + _includeLayersChanged: function() { + let includeLayers = this._layersCheckButton.get_active(); + + this._surface = this._mapView.view.to_surface(includeLayers); + this._previewArea.queue_draw(); } }); |