[evince] Set a style class on the view so it can be more easily styled
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] Set a style class on the view so it can be more easily styled
- Date: Sun, 23 Dec 2012 12:24:38 +0000 (UTC)
commit a56186e42b1eb0c78435f1c82b66666e8932cc39
Author: William Jon McCann <jmccann redhat com>
Date: Tue Dec 4 16:26:54 2012 -0500
Set a style class on the view so it can be more easily styled
And share the style we use for other content views.
https://bugzilla.gnome.org/show_bug.cgi?id=653294
libview/ev-view.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/libview/ev-view.c b/libview/ev-view.c
index df11e5d..7da6323 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -3403,9 +3403,6 @@ ev_view_realize (GtkWidget *widget)
&attributes, attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
-
- gtk_style_context_set_background (gtk_widget_get_style_context (widget),
- window);
}
static gboolean
@@ -3416,6 +3413,12 @@ ev_view_draw (GtkWidget *widget,
gint i;
GdkRectangle clip_rect;
+ gtk_render_background (gtk_widget_get_style_context (widget),
+ cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
+
if (view->document == NULL)
return FALSE;
@@ -4922,11 +4925,17 @@ ev_view_class_init (EvViewClass *class)
static void
ev_view_init (EvView *view)
{
+ GtkStyleContext *context;
+
gtk_widget_set_has_window (GTK_WIDGET (view), TRUE);
gtk_widget_set_can_focus (GTK_WIDGET (view), TRUE);
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (view), FALSE);
gtk_container_set_resize_mode (GTK_CONTAINER (view), GTK_RESIZE_QUEUE);
+ context = gtk_widget_get_style_context (GTK_WIDGET (view));
+ gtk_style_context_add_class (context, "content-view");
+ gtk_style_context_add_class (context, "view");
+
gtk_widget_set_events (GTK_WIDGET (view),
GDK_EXPOSURE_MASK |
GDK_BUTTON_PRESS_MASK |
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]