[gnome-maps] placeBar: Show current location details inline



commit 7efd020875461ed5939216c850f6c3b8d27aefa1
Author: James Westman <james flyingpimonster net>
Date:   Thu Jan 14 14:31:10 2021 -0600

    placeBar: Show current location details inline
    
    The place dialog for Current Location didn't look very good--it was mostly
    empty, and the Share button looked like it belonged in the headerbar. Fixed
    by showing those details in the place bar itself, under the title row.

 src/placeBar.js  | 26 ++++++++++++++++++++------
 src/placeView.js | 13 +++++++++++++
 2 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/src/placeBar.js b/src/placeBar.js
index e3ee3529..323c3ace 100644
--- a/src/placeBar.js
+++ b/src/placeBar.js
@@ -30,6 +30,7 @@ const ContactPlace = imports.contactPlace;
 const PlaceButtons = imports.placeButtons;
 const PlaceDialog = imports.placeDialog;
 const PlaceFormatter = imports.placeFormatter;
+const PlaceView = imports.placeView;
 const Utils = imports.utils;
 
 var PlaceBar = GObject.registerClass({
@@ -106,12 +107,25 @@ var PlaceBar = GObject.registerClass({
     }
 
     _onEventBoxClicked() {
-        let dialog = new PlaceDialog.PlaceDialog ({ transient_for: this.get_toplevel(),
-                                                    modal: true,
-                                                    mapView: this._mapView,
-                                                    place: this.place });
-        dialog.connect('response', () => dialog.destroy());
-        dialog.show();
+        if (this.place.isCurrentLocation) {
+            if (this._currentLocationView) {
+                this._box.remove(this._currentLocationView);
+                delete this._currentLocationView;
+            } else {
+                this._currentLocationView = new PlaceView.PlaceView({ place: this.place,
+                                                                      mapView: this._mapView,
+                                                                      inlineMode: true,
+                                                                      visible: true });
+                this._box.add(this._currentLocationView);
+            }
+        } else {
+            let dialog = new PlaceDialog.PlaceDialog ({ transient_for: this.get_toplevel(),
+                                                        modal: true,
+                                                        mapView: this._mapView,
+                                                        place: this.place });
+            dialog.connect('response', () => dialog.destroy());
+            dialog.show();
+        }
     }
 
     _onPlaceEdited() {
diff --git a/src/placeView.js b/src/placeView.js
index e5808fc3..f3287d5a 100644
--- a/src/placeView.js
+++ b/src/placeView.js
@@ -60,6 +60,11 @@ var PlaceView = GObject.registerClass({
         let mapView = params.mapView;
         delete params.mapView;
 
+        /* This mode is used in PlaceBar for inline current location details.
+           It hides the title box and decreases the start margin on the rows. */
+        this._inlineMode = !!params.inlineMode;
+        delete params.inlineMode;
+
         super._init(params);
 
         let ui = Utils.getUIObject('place-view', [ 'bubble-main-box',
@@ -150,6 +155,10 @@ var PlaceView = GObject.registerClass({
             }
         }
 
+        if (this._inlineMode) {
+            ui.titleBox.hide();
+        }
+
         this.updatePlaceDetails();
 
         this._place.connect('notify::location', () => this._updateLocation());
@@ -412,6 +421,10 @@ var PlaceView = GObject.registerClass({
                                     marginBottom: 6,
                                     spacing: 12 });
 
+            if (this._inlineMode) {
+                box.marginStart = 6;
+            }
+
             if (icon) {
                 let widget = new Gtk.Image({ icon_name: icon,
                                              visible: true,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]