[gnome-maps] placeBar: Add PlaceButtons
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] placeBar: Add PlaceButtons
- Date: Tue, 9 Feb 2021 20:56:56 +0000 (UTC)
commit ec3a9e785e37bd0a1a2a556c4e124fbd4c937fed
Author: James Westman <james flyingpimonster net>
Date: Mon Dec 28 15:06:45 2020 -0600
placeBar: Add PlaceButtons
data/ui/main-window.ui | 2 +-
data/ui/place-bar.ui | 35 +++++++++++++++++++++++++++++------
src/mainWindow.js | 6 +++++-
src/placeBar.js | 13 +++++++++++++
src/placeButtons.js | 4 +++-
5 files changed, 51 insertions(+), 9 deletions(-)
---
diff --git a/data/ui/main-window.ui b/data/ui/main-window.ui
index bc6d26c2..a21db6aa 100644
--- a/data/ui/main-window.ui
+++ b/data/ui/main-window.ui
@@ -137,7 +137,7 @@
</object>
</child>
<child>
- <object class="Gjs_PlaceBar" id="placeBar">
+ <object class="GtkBox" id="placeBarContainer">
<property name="visible">True</property>
</object>
<packing>
diff --git a/data/ui/place-bar.ui b/data/ui/place-bar.ui
index a9c9d546..47ad3a0b 100644
--- a/data/ui/place-bar.ui
+++ b/data/ui/place-bar.ui
@@ -8,16 +8,39 @@
<object class="GtkActionBar" id="actionbar">
<property name="visible">True</property>
<child>
- <object class="GtkBox">
+ <object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="title">
- <style>
- <class name="title-2"/>
- </style>
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="label"></property>
+ <property name="orientation">horizontal</property>
+ <property name="hexpand">True</property>
+ <child>
+ <object class="GtkLabel" id="title">
+ <style>
+ <class name="title-2"/>
+ </style>
+ <property name="visible">True</property>
+ <property name="label"></property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="altSendToButton">
+ <property name="visible">False</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon_name">send-to-symbolic</property>
+ <property name="tooltip_text" translatable="yes" comments="Translators: This is a
tooltip">Share location</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/src/mainWindow.js b/src/mainWindow.js
index f00d2967..853a4386 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -86,7 +86,7 @@ var MainWindow = GObject.registerClass({
'noNetworkView',
'actionBar',
'actionBarRevealer',
- 'placeBar' ]
+ 'placeBarContainer' ]
}, class MainWindow extends Gtk.ApplicationWindow {
get mapView() {
@@ -164,6 +164,10 @@ var MainWindow = GObject.registerClass({
}
_initPlaceBar() {
+ this._placeBar = new PlaceBar.PlaceBar({ mapView: this._mapView,
+ visible: true });
+ this._placeBarContainer.add(this._placeBar);
+
this.application.bind_property('selected-place',
this._placeBar, 'place',
GObject.BindingFlags.DEFAULT);
diff --git a/src/placeBar.js b/src/placeBar.js
index 7bc5677f..2ddc12d5 100644
--- a/src/placeBar.js
+++ b/src/placeBar.js
@@ -31,6 +31,8 @@ const PlaceFormatter = imports.placeFormatter;
var PlaceBar = GObject.registerClass({
Template: 'resource:///org/gnome/Maps/ui/place-bar.ui',
InternalChildren: [ 'actionbar',
+ 'altSendToButton',
+ 'box',
'title' ],
Properties: {
'place': GObject.ParamSpec.object('place',
@@ -42,8 +44,15 @@ var PlaceBar = GObject.registerClass({
},
}, class PlaceBar extends Gtk.Revealer {
_init(params) {
+ let mapView = params.mapView;
+ delete params.mapView;
+
super._init(params);
+ this._buttons = new PlaceButtons.PlaceButtons({ mapView });
+ this._buttons.initSendToButton(this._altSendToButton);
+ this._box.add(this._buttons);
+
Application.application.connect('notify::adaptive-mode', this._updateVisibility.bind(this));
this.connect('notify::place', this._updatePlace.bind(this));
}
@@ -58,6 +67,10 @@ var PlaceBar = GObject.registerClass({
let formatter = new PlaceFormatter.PlaceFormatter(this.place);
this._title.label = formatter.title;
+ this._buttons.place = this.place;
+
+ this._altSendToButton.visible = this.place.isCurrentLocation;
+ this._buttons.visible = !this.place.isCurrentLocation;
}
_updateVisibility() {
diff --git a/src/placeButtons.js b/src/placeButtons.js
index cee2aa64..5a5f694a 100644
--- a/src/placeButtons.js
+++ b/src/placeButtons.js
@@ -50,7 +50,9 @@ var PlaceButtons = GObject.registerClass({
this._initSignals();
- this.place = place;
+ if (place) {
+ this.place = place;
+ }
}
get place() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]