Tidy up placeholder style when it has no text
This commit is contained in:
parent
c64eb72e69
commit
8d17354740
2 changed files with 26 additions and 3 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue