Merge branch 'red-border' into 'master'

headerbar: Add ERROR style to Add entry

See merge request World/podcasts!109
This commit is contained in:
Jordan Petridis 2019-06-09 03:12:33 +00:00
commit 2631173a0d

View File

@ -107,10 +107,16 @@ impl AddPopover {
match Url::parse(&url) { match Url::parse(&url) {
Ok(u) => { Ok(u) => {
if !dbqueries::source_exists(u.as_str())? { if !dbqueries::source_exists(u.as_str())? {
self.entry
.get_style_context()
.remove_class(&gtk::STYLE_CLASS_ERROR);
self.entry self.entry
.set_icon_from_icon_name(gtk::EntryIconPosition::Secondary, None); .set_icon_from_icon_name(gtk::EntryIconPosition::Secondary, None);
self.add.set_sensitive(true); self.add.set_sensitive(true);
} else { } else {
self.entry
.get_style_context()
.add_class(&gtk::STYLE_CLASS_ERROR);
self.entry.set_icon_from_icon_name( self.entry.set_icon_from_icon_name(
gtk::EntryIconPosition::Secondary, gtk::EntryIconPosition::Secondary,
"dialog-error-symbolic", "dialog-error-symbolic",
@ -126,6 +132,9 @@ impl AddPopover {
Err(err) => { Err(err) => {
self.add.set_sensitive(false); self.add.set_sensitive(false);
if !url.is_empty() { if !url.is_empty() {
self.entry
.get_style_context()
.add_class(&gtk::STYLE_CLASS_ERROR);
self.entry.set_icon_from_icon_name( self.entry.set_icon_from_icon_name(
gtk::EntryIconPosition::Secondary, gtk::EntryIconPosition::Secondary,
"dialog-error-symbolic", "dialog-error-symbolic",
@ -136,6 +145,9 @@ impl AddPopover {
); );
error!("Error: {}", err); error!("Error: {}", err);
} else { } else {
self.entry
.get_style_context()
.remove_class(&gtk::STYLE_CLASS_ERROR);
self.entry self.entry
.set_icon_from_icon_name(gtk::EntryIconPosition::Secondary, None); .set_icon_from_icon_name(gtk::EntryIconPosition::Secondary, None);
} }