Commit 8d173547 authored by Michael Gratton's avatar Michael Gratton 🤞

Tidy up placeholder style when it has no text

parent c64eb72e
Pipeline #55456 failed with stages
in 16 minutes and 26 seconds
......@@ -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);
}
}
}
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment