[gnome-maps] mapBubble: Move check in button to sendToDialog



commit a45da14780d0d7b0acbaea317326bff68e96c9aa
Author: James Westman <james flyingpimonster net>
Date:   Wed Nov 11 23:12:39 2020 -0600

    mapBubble: Move check in button to sendToDialog
    
    This makes a bit more sense since it's part of sharing a location. Also, it's
    only shown in current location bubbles, and it doesn't really fit anywhere else
    in the redesigned bubble.

 data/ui/map-bubble.ui     | 13 -------------
 data/ui/send-to-dialog.ui |  7 +++++++
 src/mapBubble.js          | 30 +++++-------------------------
 src/sendToDialog.js       | 17 +++++++++++++++++
 src/userLocationBubble.js |  1 -
 5 files changed, 29 insertions(+), 39 deletions(-)
---
diff --git a/data/ui/map-bubble.ui b/data/ui/map-bubble.ui
index 9ccf32a2..3565c2ac 100644
--- a/data/ui/map-bubble.ui
+++ b/data/ui/map-bubble.ui
@@ -168,19 +168,6 @@
                     <property name="pack-type">end</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkButton" id="bubble-check-in-button">
-                    <property name="label" translatable="yes" comments="Translators: Check in is used as a 
verb">C_heck in</property>
-                    <property name="visible">False</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="tooltip-text" translatable="yes" comments="Translators: This is a 
tooltip">Check in here</property>
-                  </object>
-                  <packing>
-                    <property name="pack-type">end</property>
-                  </packing>
-                </child>
                 <child>
                   <object class="GtkButton" id="bubble-edit-button">
                     <property name="visible">False</property>
diff --git a/data/ui/send-to-dialog.ui b/data/ui/send-to-dialog.ui
index c07560ea..072dc3f5 100644
--- a/data/ui/send-to-dialog.ui
+++ b/data/ui/send-to-dialog.ui
@@ -80,6 +80,13 @@
                     <property name="hexpand">True</property>
                   </object>
                 </child>
+                <child>
+                  <object class="GtkButton" id="checkInButton">
+                    <property name="visible">False</property>
+                    <property name="label" translatable="yes">Check In&#8230;</property>
+                    <property name="hexpand">True</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="pack_type">end</property>
diff --git a/src/mapBubble.js b/src/mapBubble.js
index 9383022d..de41238c 100644
--- a/src/mapBubble.js
+++ b/src/mapBubble.js
@@ -61,11 +61,6 @@ class MapBubble extends Gtk.Popover {
         let buttonFlags = params.buttons || Button.NONE;
         delete params.buttons;
 
-        let checkInMatchPlace = params.checkInMatchPlace;
-        if (checkInMatchPlace !== false)
-            checkInMatchPlace = true;
-        delete params.checkInMatchPlace;
-
         params.modal = false;
 
         super._init(params);
@@ -84,7 +79,6 @@ class MapBubble extends Gtk.Popover {
                                                    'bubble-send-to-button-alt',
                                                    'title-box',
                                                    'bubble-favorite-button',
-                                                   'bubble-check-in-button',
                                                    'bubble-edit-button',
                                                    'bubble-favorite-button-image']);
         this._title = ui.labelTitle;
@@ -103,11 +97,9 @@ class MapBubble extends Gtk.Popover {
             if (buttonFlags & Button.ROUTE)
                 this._initRouteButton(ui.bubbleRouteButton);
             if (buttonFlags & Button.SEND_TO)
-                this._initSendToButton(ui.bubbleSendToButton);
+                this._initSendToButton(ui.bubbleSendToButton, buttonFlags & Button.CHECK_IN);
             if (buttonFlags & Button.FAVORITE)
                 this._initFavoriteButton(ui.bubbleFavoriteButton, ui.bubbleFavoriteButtonImage);
-            if (buttonFlags & Button.CHECK_IN)
-                this._initCheckInButton(ui.bubbleCheckInButton, checkInMatchPlace);
             if (buttonFlags & Button.EDIT_ON_OSM)
                 this._initEditButton(ui.bubbleEditButton);
         }
@@ -119,7 +111,7 @@ class MapBubble extends Gtk.Popover {
             /* hide the normal button area */
             ui.bubbleButtonArea.visible = false;
             /* show the top-end-corner share button instead */
-            this._initSendToButton(ui.bubbleSendToButtonAlt);
+            this._initSendToButton(ui.bubbleSendToButtonAlt, buttonFlags & Button.CHECK_IN);
             /* adjust some margins */
             ui.titleBox.margin = 12;
             ui.titleBox.marginStart = 18;
@@ -215,13 +207,14 @@ class MapBubble extends Gtk.Popover {
         });
     }
 
-    _initSendToButton(button) {
+    _initSendToButton(button, showCheckIn) {
         button.visible = true;
         button.connect('clicked', () => {
             let dialog = new SendToDialog.SendToDialog({ transient_for: this.get_toplevel(),
                                                          modal: true,
                                                          mapView: this._mapView,
-                                                         place: this._place });
+                                                         place: this._place,
+                                                         showCheckIn });
             dialog.connect('response', () => dialog.destroy());
             dialog.show();
         });
@@ -248,19 +241,6 @@ class MapBubble extends Gtk.Popover {
         });
     }
 
-    _initCheckInButton(button, matchPlace) {
-        Application.checkInManager.bind_property('hasCheckIn',
-                                                 button, 'visible',
-                                                 GObject.BindingFlags.DEFAULT |
-                                                 GObject.BindingFlags.SYNC_CREATE);
-
-        button.connect('clicked', () => {
-            Application.checkInManager.showCheckInDialog(this.get_toplevel(),
-                                                         this.place,
-                                                         matchPlace);
-        });
-    }
-
     _initEditButton(button) {
         button.visible = true;
         button.connect('clicked', this._onEditClicked.bind(this));
diff --git a/src/sendToDialog.js b/src/sendToDialog.js
index 50198014..d7e278c8 100644
--- a/src/sendToDialog.js
+++ b/src/sendToDialog.js
@@ -54,6 +54,7 @@ var SendToDialog = GObject.registerClass({
                         'summaryUrl',
                         'copyButton',
                         'emailButton',
+                        'checkInButton',
                         'scrolledWindow' ]
 }, class SendToDialog extends Gtk.Dialog {
 
@@ -65,6 +66,9 @@ var SendToDialog = GObject.registerClass({
         this._mapView = params.mapView;
         delete params.mapView;
 
+        let showCheckIn = params.showCheckIn || false;
+        delete params.showCheckIn;
+
         params.use_header_bar = true;
         super._init(params);
 
@@ -85,6 +89,19 @@ var SendToDialog = GObject.registerClass({
                 row.set_header(null);
         });
 
+        if (showCheckIn) {
+            Application.checkInManager.bind_property('hasCheckIn',
+                                                     this._checkInButton, 'visible',
+                                                     GObject.BindingFlags.DEFAULT |
+                                                     GObject.BindingFlags.SYNC_CREATE);
+
+            this._checkInButton.connect('clicked', () => {
+                Application.checkInManager.showCheckInDialog(this.get_toplevel(),
+                                                             this._place,
+                                                             false);
+            });
+        }
+
         this.connect('show', () => {
             this._summaryLabel.label = this._getSummary();
             let osmuri = GLib.markup_escape_text(this._getOSMURI(), -1);
diff --git a/src/userLocationBubble.js b/src/userLocationBubble.js
index fc7a3524..494e2de9 100644
--- a/src/userLocationBubble.js
+++ b/src/userLocationBubble.js
@@ -35,7 +35,6 @@ class UserLocationBubble extends MapBubble.MapBubble {
                                                                'label-coordinates' ]);
         params.buttons = MapBubble.Button.SEND_TO |
                          MapBubble.Button.CHECK_IN;
-        params.checkInMatchPlace = false;
 
         super._init(params);
 


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