Closes #7365 Draft saving notifications are now less distracting

This commit is contained in:
Eric Gregory 2013-09-27 17:05:28 -07:00
parent 1b1ddc8735
commit 302ffc4fdc
4 changed files with 22 additions and 9 deletions

View file

@ -83,6 +83,11 @@ public class ComposerWindow : Gtk.Window {
</style>
</head><body id="message-body"></body></html>""";
private const string draft_save_label_style = """
.draft-save-label {
color: shade (@bg_color, 0.6);
}""";
private const int DRAFT_TIMEOUT_MSEC = 2000; // 2 seconds
public const string ATTACHMENT_KEYWORDS_GENERIC = ".doc|.pdf|.xls|.ppt|.rtf|.pps";
@ -235,6 +240,7 @@ public class ComposerWindow : Gtk.Window {
subject_entry = builder.get_object("subject") as Gtk.Entry;
Gtk.Alignment message_area = builder.get_object("message area") as Gtk.Alignment;
draft_save_label = (Gtk.Label) builder.get_object("draft_save_label");
GtkUtil.apply_style(draft_save_label, draft_save_label_style);
actions = builder.get_object("compose actions") as Gtk.ActionGroup;
// Can only happen after actions exits
compose_as_html = GearyApplication.instance.config.compose_as_html;

View file

@ -108,4 +108,16 @@ void set_source_color_from_string(Cairo.Context ctx, string spec) {
ctx.set_source_rgb(rgba.red, rgba.green, rgba.blue);
}
void apply_style(Gtk.Widget widget, string style) {
try {
Gtk.CssProvider style_provider = new Gtk.CssProvider();
style_provider.load_from_data(style, -1);
Gtk.StyleContext style_context = widget.get_style_context();
style_context.add_provider(style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
} catch (Error e) {
warning("Could not load style: %s", e.message);
}
}
}

View file

@ -49,15 +49,7 @@ public class ConversationFindBar : Gtk.Layout {
entry.buffer.deleted_text.connect(on_entry_buffer_deleted_text);
entry.activate.connect(on_entry_activate);
try {
Gtk.CssProvider style_provider = new Gtk.CssProvider();
style_provider.load_from_data(entry_not_found_style, -1);
Gtk.StyleContext style_context = entry.get_style_context();
style_context.add_provider(style_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
} catch (Error e) {
warning("Could not load built-in style for find bar entry: %s", e.message);
}
GtkUtil.apply_style(entry, entry_not_found_style);
result_label = (Gtk.Label) builder.get_object("label: result");
update_result_label();

View file

@ -559,6 +559,9 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<style>
<class name="draft-save-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>