Replace some deprecated style calls in the composer with CSS rules.

This commit is contained in:
Michael James Gratton 2018-04-15 22:03:35 +10:00
parent 33150b22c6
commit 07b4a7842f
3 changed files with 17 additions and 26 deletions

View file

@ -1846,34 +1846,10 @@ public class ComposerWidget : Gtk.EventBox {
bool copy_link_enabled = hit_test.context_is_link();
this.pointer_url = copy_link_enabled ? hit_test.get_link_uri() : null;
this.message_overlay_label.label = this.pointer_url ?? "";
this.message_overlay_label.set_visible(copy_link_enabled);
get_action(ACTION_COPY_LINK).set_enabled(copy_link_enabled);
}
private void update_message_overlay_label_style() {
Gdk.RGBA window_background = container.top_window.get_style_context()
.get_background_color(Gtk.StateFlags.NORMAL);
Gdk.RGBA label_background = message_overlay_label.get_style_context()
.get_background_color(Gtk.StateFlags.NORMAL);
if (label_background == window_background)
return;
message_overlay_label.get_style_context().changed.disconnect(
on_message_overlay_label_style_changed);
message_overlay_label.override_background_color(Gtk.StateFlags.NORMAL, window_background);
message_overlay_label.get_style_context().changed.connect(
on_message_overlay_label_style_changed);
}
[GtkCallback]
private void on_message_overlay_label_realize() {
update_message_overlay_label_style();
}
private void on_message_overlay_label_style_changed() {
update_message_overlay_label_style();
}
private bool on_context_menu(WebKit.WebView view,
WebKit.ContextMenu context_menu,
Gdk.Event event,

View file

@ -816,7 +816,9 @@
<property name="halign">start</property>
<property name="valign">end</property>
<property name="ellipsize">middle</property>
<signal name="realize" handler="on_message_overlay_label_realize" swapped="no"/>
<style>
<class name="geary-overlay"/>
</style>
</object>
</child>
</object>

View file

@ -32,6 +32,19 @@
border-bottom-width: 0;
}
.geary-overlay {
background-color: @theme_base_color;
padding: 2px 6px;
border: 1px solid @borders;
border-bottom: 0;
}
.geary-overlay:dir(ltr) {
border-left: 0;
}
.geary-overlay:dir(rtl) {
border-right: 0;
}
.geary-titlebar-left:dir(ltr),
.geary-titlebar-right:dir(rtl) {
border-top-right-radius: 0px;