[gnome-maps] mapBubble: Add Check-in button



commit 0c94a082e9bae798a3dc92bcd388c98f2c7e784f
Author: Damián Nohales <damiannohales gmail com>
Date:   Fri Aug 22 17:04:47 2014 -0300

    mapBubble: Add Check-in button
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731113

 po/POTFILES.in    |    1 +
 src/map-bubble.ui |    9 +++++++++
 src/mapBubble.js  |   27 +++++++++++++++++++++++++--
 3 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 44a76de..d67144b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -13,6 +13,7 @@ src/mainWindow.js
 [type: gettext/glade]src/main-window.ui
 src/mapView.js
 src/place.js
+[type: gettext/glade]src/map-bubble.ui
 src/routeService.js
 src/searchResultBubble.js
 [type: gettext/glade]src/share-dialog.ui
diff --git a/src/map-bubble.ui b/src/map-bubble.ui
index dd6a12f..a6a7051 100644
--- a/src/map-bubble.ui
+++ b/src/map-bubble.ui
@@ -95,6 +95,15 @@
                 </child>
               </object>
             </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>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="left_attach">0</property>
diff --git a/src/mapBubble.js b/src/mapBubble.js
index 7c7f80c..7d6696a 100644
--- a/src/mapBubble.js
+++ b/src/mapBubble.js
@@ -22,6 +22,7 @@
 
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const GObject = imports.gi.GObject;
 const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
@@ -36,7 +37,8 @@ const Button = {
     NONE: 0,
     ROUTE: 2,
     SHARE: 4,
-    FAVORITE: 8
+    FAVORITE: 8,
+    CHECK_IN: 16
 };
 
 const MapBubble = new Lang.Class({
@@ -58,6 +60,11 @@ const MapBubble = new Lang.Class({
         let routeFrom = params.routeFrom;
         delete params.routeFrom;
 
+        let checkInMatchPlace = params.checkInMatchPlace;
+        if (checkInMatchPlace !== false)
+            checkInMatchPlace = true;
+        delete params.checkInMatchPlace;
+
         params.modal = false;
 
         this.parent(params);
@@ -67,7 +74,8 @@ const MapBubble = new Lang.Class({
                                                    'bubble-button-area',
                                                    'bubble-route-button',
                                                    'bubble-share-button',
-                                                   'bubble-favorite-button']);
+                                                   'bubble-favorite-button',
+                                                   'bubble-check-in-button']);
         this._image = ui.bubbleImage;
         this._content = ui.bubbleContentArea;
 
@@ -80,6 +88,8 @@ const MapBubble = new Lang.Class({
                 this._initShareButton(ui.bubbleShareButton);
             if (buttonFlags & Button.FAVORITE)
                 this._initFavoriteButton(ui.bubbleFavoriteButton);
+            if (buttonFlags & Button.CHECK_IN)
+                this._initCheckInButton(ui.bubbleCheckInButton, checkInMatchPlace);
         }
 
         this.add(ui.bubbleMainGrid);
@@ -148,5 +158,18 @@ const MapBubble = new Lang.Class({
             this.destroy();
             query.thaw_notify();
         }).bind(this));
+    },
+
+    _initCheckInButton: function(button, matchPlace) {
+        Application.checkInManager.bind_property('hasCheckIn',
+                                                 button, 'visible',
+                                                 GObject.BindingFlags.DEFAULT |
+                                                 GObject.BindingFlags.SYNC_CREATE);
+
+        button.connect('clicked', (function() {
+            Application.checkInManager.showCheckInDialog(this.get_toplevel(),
+                                                         this.place,
+                                                         matchPlace);
+        }).bind(this));
     }
 });


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