[gnome-documents] embed: only show the System Settings label when no GOA accounts
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] embed: only show the System Settings label when no GOA accounts
- Date: Tue, 4 Sep 2012 16:49:11 +0000 (UTC)
commit af6747ea763384fafb5d668a50b4a0a84ad0bbe5
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Sep 4 12:44:02 2012 -0400
embed: only show the System Settings label when no GOA accounts
Doesn't make sense to show it when we already have accounts configured.
src/embed.js | 31 ++++++++++++++++++++-----------
src/sources.js | 11 +++++++++++
2 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index d8f3ca8..be12127 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -212,17 +212,31 @@ const EmptyResultsBox = new Lang.Class({
icon_name: 'emblem-documents-symbolic' });
this.widget.add(this._image);
- let labelsGrid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
- row_spacing: 12 });
- this.widget.add(labelsGrid);
+ this._labelsGrid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
+ row_spacing: 12 });
+ this.widget.add(this._labelsGrid);
let titleLabel = new Gtk.Label({ label: '<b><span size="large">' +
_("No Documents Found") +
'</span></b>',
use_markup: true,
- halign: Gtk.Align.START });
- labelsGrid.add(titleLabel);
+ halign: Gtk.Align.START,
+ vexpand: true });
+ this._labelsGrid.add(titleLabel);
+ if (Global.sourceManager.hasOnlineSources()) {
+ titleLabel.valign = Gtk.Align.CENTER;
+ } else {
+ titleLabel.valign = Gtk.Align.START;
+ this._addSystemSettingsLabel();
+ }
+
+ this.actor = new GtkClutter.Actor({ contents: this.widget,
+ opacity: 255 });
+ this.widget.show_all();
+ },
+
+ _addSystemSettingsLabel: function() {
let details = new Gtk.Label({ label: _("You can add your online accounts in") +
" <a href=\"system-settings\">" + _("System Settings") + "</a>",
use_markup: true,
@@ -230,7 +244,7 @@ const EmptyResultsBox = new Lang.Class({
xalign: 0,
max_width_chars: 24,
wrap: true });
- labelsGrid.add(details);
+ this._labelsGrid.add(details);
details.connect('activate-link', Lang.bind(this,
function(label, uri) {
@@ -255,11 +269,6 @@ const EmptyResultsBox = new Lang.Class({
return true;
}));
-
- this.actor = new GtkClutter.Actor({ contents: this.widget,
- opacity: 255 });
-
- this.widget.show_all();
}
});
diff --git a/src/sources.js b/src/sources.js
index e7ae399..e3fe16f 100644
--- a/src/sources.js
+++ b/src/sources.js
@@ -121,5 +121,16 @@ const SourceManager = new Lang.Class({
}));
this.processNewItems(newItems);
+ },
+
+ hasOnlineSources: function() {
+ let hasOnline = false;
+ this.forEachItem(
+ function(source) {
+ if (source.object)
+ hasOnline = true;
+ });
+
+ return hasOnline;
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]