[geary/wip/conversation-polish: 26/26] Tidy up placeholder style when it has no text
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/conversation-polish: 26/26] Tidy up placeholder style when it has no text
- Date: Sat, 2 Feb 2019 02:12:10 +0000 (UTC)
commit 8d1735474061e794bb0331a9dca275b09da2f764
Author: Michael Gratton <mike vee net>
Date: Sat Feb 2 13:03:45 2019 +1100
Tidy up placeholder style when it has no text
.../components/components-placeholder-pane.vala | 27 ++++++++++++++++++++--
ui/geary.css | 2 +-
2 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/src/client/components/components-placeholder-pane.vala
b/src/client/components/components-placeholder-pane.vala
index ec8926f9..1851356b 100644
--- a/src/client/components/components-placeholder-pane.vala
+++ b/src/client/components/components-placeholder-pane.vala
@@ -11,6 +11,10 @@
[GtkTemplate (ui = "/org/gnome/Geary/components-placeholder-pane.ui")]
public class Components.PlaceholderPane : Gtk.Grid {
+
+ public const string CLASS_HAS_TEXT = "geary-has-text";
+
+
/** The icon name of the pane's image. */
public string icon_name {
owned get { return this.placeholder_image.icon_name; }
@@ -20,13 +24,19 @@ public class Components.PlaceholderPane : Gtk.Grid {
/** The text of the pane's title label. */
public string title {
get { return this.title_label.get_text(); }
- set { this.title_label.set_text(value); }
+ set {
+ this.title_label.set_text(value);
+ update();
+ }
}
/** The text of the pane's sub-title label. */
public string subtitle {
get { return this.subtitle_label.get_text(); }
- set { this.subtitle_label.set_text(value); }
+ set {
+ this.subtitle_label.set_text(value);
+ update();
+ }
}
[GtkChild]
@@ -38,4 +48,17 @@ public class Components.PlaceholderPane : Gtk.Grid {
[GtkChild]
private Gtk.Label subtitle_label;
+
+ private void update() {
+ if (Geary.String.is_empty_or_whitespace(this.title_label.get_text())) {
+ this.title_label.hide();
+ }
+ if (Geary.String.is_empty_or_whitespace(this.subtitle_label.get_text())) {
+ this.subtitle_label.hide();
+ }
+ if (this.title_label.visible || this.subtitle_label.visible) {
+ get_style_context().add_class(CLASS_HAS_TEXT);
+ }
+ }
+
}
diff --git a/ui/geary.css b/ui/geary.css
index e18e8ceb..a11f940f 100644
--- a/ui/geary.css
+++ b/ui/geary.css
@@ -184,7 +184,7 @@ grid.geary-message-summary {
/* PlaceholderPane */
-.geary-placeholder-pane > image {
+.geary-placeholder-pane.geary-has-text > image {
margin-bottom: 12px;
}
.geary-placeholder-pane > .title {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]