Indication of WONTSEND via CSS (@error_color on message status)
This commit is contained in:
parent
4faee9f08d
commit
7ab4752b24
|
@ -71,7 +71,9 @@ public class MergedMessageItem : Grid {
|
||||||
message_text_view.buffer.insert(ref end, message.body, -1);
|
message_text_view.buffer.insert(ref end, message.body, -1);
|
||||||
format_suffix_urls(message.body);
|
format_suffix_urls(message.body);
|
||||||
messages.add(message);
|
messages.add(message);
|
||||||
message.notify["marked"].connect_after(update_received); // TODO other thread? not main? css error? gtk main?
|
message.notify["marked"].connect_after(() => {
|
||||||
|
Idle.add(() => { update_received(); return false; });
|
||||||
|
});
|
||||||
update_received();
|
update_received();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,9 +83,10 @@ public class MergedMessageItem : Grid {
|
||||||
foreach (Message message in messages) {
|
foreach (Message message in messages) {
|
||||||
if (message.marked == Message.Marked.WONTSEND) {
|
if (message.marked == Message.Marked.WONTSEND) {
|
||||||
received_image.visible = true;
|
received_image.visible = true;
|
||||||
Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default();
|
received_image.set_from_icon_name("dialog-warning-symbolic", IconSize.SMALL_TOOLBAR);
|
||||||
Gtk.IconInfo? icon_info = icon_theme.lookup_icon("dialog-warning-symbolic", IconSize.SMALL_TOOLBAR, 0);
|
Util.force_error_color(received_image);
|
||||||
received_image.set_from_pixbuf(icon_info.load_symbolic({1,0,0,1}));
|
Util.force_error_color(encryption_image);
|
||||||
|
Util.force_error_color(time_label);
|
||||||
return;
|
return;
|
||||||
} else if (message.marked != Message.Marked.READ) {
|
} else if (message.marked != Message.Marked.READ) {
|
||||||
all_read = false;
|
all_read = false;
|
||||||
|
|
|
@ -77,20 +77,34 @@ public class Util : Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string force_background_css = "%s { background-color: %s; }";
|
private const string force_background_css = "%s { background-color: %s; }";
|
||||||
|
private const string force_color_css = "%s { color: %s; }";
|
||||||
|
|
||||||
public static void force_background(Gtk.Widget widget, string color, string selector = "*") {
|
|
||||||
|
private static void force_css(Gtk.Widget widget, string css) {
|
||||||
var p = new Gtk.CssProvider();
|
var p = new Gtk.CssProvider();
|
||||||
try {
|
try {
|
||||||
p.load_from_data(force_background_css.printf(selector, color));
|
p.load_from_data(css);
|
||||||
widget.get_style_context().add_provider(p, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
widget.get_style_context().add_provider(p, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
} catch (GLib.Error err) {
|
} catch (GLib.Error err) {
|
||||||
// handle err
|
// handle err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void force_background(Gtk.Widget widget, string color, string selector = "*") {
|
||||||
|
force_css(widget, force_background_css.printf(selector, color));
|
||||||
|
}
|
||||||
|
|
||||||
public static void force_base_background(Gtk.Widget widget, string selector = "*") {
|
public static void force_base_background(Gtk.Widget widget, string selector = "*") {
|
||||||
force_background(widget, "@theme_base_color", selector);
|
force_background(widget, "@theme_base_color", selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void force_color(Gtk.Widget widget, string color, string selector = "*") {
|
||||||
|
force_css(widget, force_color_css.printf(selector, color));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void force_error_color(Gtk.Widget widget, string selector = "*") {
|
||||||
|
force_color(widget, "@error_color", selector);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue