[gnome-maps] ShareDialog: Use name from desktop file
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] ShareDialog: Use name from desktop file
- Date: Mon, 24 Nov 2014 07:24:41 +0000 (UTC)
commit f2d65eb6d1c96cd878112fdacf71e4d41398f7fe
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Mon Nov 24 02:09:17 2014 -0500
ShareDialog: Use name from desktop file
src/share-dialog.ui | 6 ++----
src/shareDialog.js | 25 ++++++++++++++-----------
2 files changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/src/share-dialog.ui b/src/share-dialog.ui
index f3d8976..98f84bb 100644
--- a/src/share-dialog.ui
+++ b/src/share-dialog.ui
@@ -88,9 +88,8 @@
</object>
</child>
<child>
- <object class="GtkLabel">
+ <object class="GtkLabel" id='weatherLabel'>
<property name="visible">True</property>
- <property name="label" translatable="yes">Weather</property>
<property name="margin-end">10</property>
</object>
</child>
@@ -117,9 +116,8 @@
</object>
</child>
<child>
- <object class="GtkLabel">
+ <object class="GtkLabel" id="clocksLabel">
<property name="visible">True</property>
- <property name="label" translatable="yes">Clocks</property>
<property name="margin-end">10</property>
</object>
</child>
diff --git a/src/shareDialog.js b/src/shareDialog.js
index 8c3ce88..c1421a9 100644
--- a/src/shareDialog.js
+++ b/src/shareDialog.js
@@ -43,7 +43,9 @@ const ShareDialog = new Lang.Class({
Template: 'resource:///org/gnome/maps/share-dialog.ui',
InternalChildren: [ 'list',
'weatherRow',
+ 'weatherLabel',
'clocksRow',
+ 'clocksLabel',
'headerBar',
'cancelButton',
'chooseButton',
@@ -76,14 +78,20 @@ const ShareDialog = new Lang.Class({
},
ensureShares: function() {
- let shareWeather = this._checkWeather();
- let shareClocks = this._checkClocks();
+ let weatherInfo = Gio.DesktopAppInfo.new(_WEATHER_APPID + '.desktop');
+ let clocksInfo = Gio.DesktopAppInfo.new(_CLOCKS_APPID + '.desktop');
+ let shareWeather = this._checkWeather(weatherInfo);
+ let shareClocks = this._checkClocks(clocksInfo);
if (!shareWeather)
this._weatherRow.hide();
+ else
+ this._weatherLabel.label = weatherInfo.get_name();
if (!shareClocks)
this._clocksRow.hide();
+ else
+ this._clocksLabel.label = clocksInfo.get_name();
return shareWeather || shareClocks;
},
@@ -116,16 +124,11 @@ const ShareDialog = new Lang.Class({
}
},
- _checkApp: function(appId) {
- let info = Gio.DesktopAppInfo.new(appId + '.desktop');
- return info !== null;
+ _checkWeather: function(appInfo) {
+ return (GWeather !== null && appInfo !== null);
},
- _checkWeather: function() {
- return (GWeather !== null && this._checkApp(_WEATHER_APPID));
- },
-
- _checkClocks: function() {
- return (GWeather !== null && this._checkApp(_CLOCKS_APPID));
+ _checkClocks: function(appInfo) {
+ return (GWeather !== null && appInfo !== null);
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]