[gnome-weather/wip/new-ui] fixup! fix accessing the label from the grid after redoing the grid layout
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather/wip/new-ui] fixup! fix accessing the label from the grid after redoing the grid layout
- Date: Wed, 30 Jul 2014 16:30:07 +0000 (UTC)
commit 476671549554c935bc27bb77e813898fd510602a
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Wed Jul 30 18:29:20 2014 +0200
fixup! fix accessing the label from the grid after redoing the grid layout
Indexing a map with a user visible string retrieved from a GtkLabel
is like BAD CODE capitalized and highlighted several times, but
I'm way too tired to rewrite this properly today.
src/misc/util.js | 7 -------
src/shared/world.js | 11 +++++++++--
2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/misc/util.js b/src/misc/util.js
index 80250dd..73b37d2 100644
--- a/src/misc/util.js
+++ b/src/misc/util.js
@@ -170,10 +170,3 @@ function getEnabledProviders() {
return (GWeather.Provider.METAR | GWeather.Provider.YR_NO | GWeather.Provider.OWM);
}
}
-
-function getLabelFromRow(row) {
- let children = row.get_children();
- let grid = children[0];
- let gridChildren = children[0].get_children();
- return gridChildren[1].get_label();
-}
\ No newline at end of file
diff --git a/src/shared/world.js b/src/shared/world.js
index ea6653e..27e49b5 100644
--- a/src/shared/world.js
+++ b/src/shared/world.js
@@ -25,6 +25,13 @@ const Lang = imports.lang;
const Params = imports.misc.params;
const Util = imports.misc.util;
+function getLabelFromRow(row) {
+ let grid = row.get_child();
+ let cityGrid = grid.get_child_at(0, 0);
+ let label = cityGrid.get_child_at(0, 0);
+ return label.get_text();
+}
+
const WorldModel = new Lang.Class({
Name: 'WorldModel',
Extends: GObject.Object,
@@ -88,7 +95,7 @@ const WorldModel = new Lang.Class({
},
rowActivated: function(listbox, row) {
- let cityName = Util.getLabelFromRow(row);
+ let cityName = getLabelFromRow(row);
this.emit('show-info', this._infoList[cityName]);
this.currentlyLoadedInfo = this._infoList[cityName];
this.emit('validate-listbox', this.currentlyLoadedInfo.location);
@@ -382,7 +389,7 @@ const WorldContentView = new Lang.Class({
_filterListbox: function(row, model) {
if(model.currentlyLoadedInfo) {
- let cityName = Util.getLabelFromRow(row);
+ let cityName = getLabelFromRow(row);
let loadedCity = model.currentlyLoadedInfo.location.get_city_name();
return (cityName != loadedCity);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]