[gnome-maps] mapbubble: Use GtkButton for favorite button



commit 009a7866468d79172e95e3e03198e4e70b2686af
Author: Prashant Tyagi <prashanttyagi221295 gmail com>
Date:   Thu Jan 7 01:46:22 2016 +0530

    mapbubble: Use GtkButton for favorite button
    
    This is to keep consistency with gnome-photos favorite button.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757554

 data/ui/map-bubble.ui |    2 +-
 src/mapBubble.js      |   22 +++++++++++-----------
 2 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/data/ui/map-bubble.ui b/data/ui/map-bubble.ui
index 18a0c66..3f7d961 100644
--- a/data/ui/map-bubble.ui
+++ b/data/ui/map-bubble.ui
@@ -81,7 +81,7 @@
               </object>
             </child>
             <child>
-              <object class="GtkToggleButton" id="bubble-favorite-button">
+              <object class="GtkButton" id="bubble-favorite-button">
                 <property name="name">bubble-favorite-button</property>
                 <property name="visible">False</property>
                 <property name="can_focus">True</property>
diff --git a/src/mapBubble.js b/src/mapBubble.js
index 3a8ebb7..5d44215 100644
--- a/src/mapBubble.js
+++ b/src/mapBubble.js
@@ -110,25 +110,25 @@ const MapBubble = new Lang.Class({
 
     _initFavoriteButton: function(button, image) {
         let placeStore = Application.placeStore;
-        let isFavorite = placeStore.exists(this._place,
-                                           PlaceStore.PlaceType.FAVORITE);
         button.visible = true;
-        button.active = isFavorite;
 
-        if (button.active)
+        if (placeStore.exists(this._place,
+                              PlaceStore.PlaceType.FAVORITE)) {
             image.icon_name = 'starred-symbolic';
-        else
+        } else {
             image.icon_name = 'non-starred-symbolic';
+        }
 
-        button.connect('toggled', (function() {
-            if (button.active) {
-                image.icon_name = 'starred-symbolic';
-                placeStore.addPlace(this._place,
-                                    PlaceStore.PlaceType.FAVORITE);
-            } else {
+        button.connect('clicked', (function() {
+            if (placeStore.exists(this._place,
+                                  PlaceStore.PlaceType.FAVORITE)) {
                 image.icon_name = 'non-starred-symbolic';
                 placeStore.removePlace(this._place,
                                        PlaceStore.PlaceType.FAVORITE);
+            } else {
+                image.icon_name = 'starred-symbolic';
+                placeStore.addPlace(this._place,
+                                    PlaceStore.PlaceType.FAVORITE);
             }
         }).bind(this));
     },


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