From 0ff0828b0dfa9c70597382421f1ca3a3dd5ff260 Mon Sep 17 00:00:00 2001 From: Giselle Machado Date: Fri, 20 Jun 2014 15:15:00 +0200 Subject: Change the opacity of the annotation window Implements the functions needed to change the opacity of the annotation windows. https://bugzilla.gnome.org/show_bug.cgi?id=725571 origin commit: https://git.gnome.org/browse/evince/commit/?id=b968cfb --- libview/ev-annotation-window.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'libview') diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c index eadb6d65..e3c3783a 100644 --- a/libview/ev-annotation-window.c +++ b/libview/ev-annotation-window.c @@ -153,6 +153,14 @@ ev_annotation_window_set_color (EvAnnotationWindow *window, g_object_unref (properties); } +static void +ev_annotation_window_set_opacity (EvAnnotationWindow *window, + gdouble opacity) +{ + gtk_widget_set_opacity (GTK_WIDGET (window), opacity); + gtk_widget_set_opacity (GTK_WIDGET (window->text_view), opacity); +} + static void ev_annotation_window_label_changed (EvAnnotationMarkup *annot, GParamSpec *pspec, @@ -175,6 +183,17 @@ ev_annotation_window_color_changed (EvAnnotation *annot, ev_annotation_window_set_color (window, &rgba); } +static void +ev_annotation_window_opacity_changed (EvAnnotation *annot, + GParamSpec *pspec, + EvAnnotationWindow *window) +{ + gdouble opacity; + + opacity = ev_annotation_markup_get_opacity (EV_ANNOTATION_MARKUP (annot)); + ev_annotation_window_set_opacity (window, opacity); +} + static void ev_annotation_window_dispose (GObject *object) { @@ -397,6 +416,7 @@ ev_annotation_window_constructor (GType type, GdkRGBA color; EvRectangle *rect; gdouble scale; + gdouble opacity; object = G_OBJECT_CLASS (ev_annotation_window_parent_class)->constructor (type, n_construct_properties, @@ -422,6 +442,10 @@ ev_annotation_window_constructor (GType type, ev_annotation_get_rgba (annot, &color); ev_annotation_window_set_color (window, &color); + + opacity = ev_annotation_markup_get_opacity (markup); + ev_annotation_window_set_opacity (window, opacity); + gtk_widget_set_name (GTK_WIDGET (window), ev_annotation_get_name (annot)); gtk_window_set_title (GTK_WINDOW (window), label); gtk_label_set_text (GTK_LABEL (window->title), label); @@ -440,6 +464,9 @@ ev_annotation_window_constructor (GType type, g_signal_connect (annot, "notify::rgba", G_CALLBACK (ev_annotation_window_color_changed), window); + g_signal_connect (annot, "notify::opacity", + G_CALLBACK (ev_annotation_window_opacity_changed), + window); return object; } -- cgit v1.2.1