[rhythmbox/gobject-introspection: 36/41] port widgets etc. to GtkStyleContext mostly, disable visualizer plugin



commit 4cca69df8fd3aa5926d121fa3e8afefd4fe41dc4
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sun Dec 12 14:51:06 2010 +1000

    port widgets etc. to GtkStyleContext mostly, disable visualizer plugin

 lib/rb-util.c                           |    2 +-
 plugins/Makefile.am                     |    5 +-
 plugins/daap/rb-dacp-pairing-page.c     |    2 +-
 sources/rb-display-page-tree.c          |   35 +++---
 widgets/gossip-cell-renderer-expander.c |  200 ++++---------------------------
 widgets/gossip-cell-renderer-expander.h |    5 -
 widgets/rb-rating-helper.c              |   10 +-
 widgets/rb-rating.c                     |   24 ++--
 widgets/rb-search-entry.c               |   16 ++--
 widgets/rb-segmented-bar.c              |   14 +-
 10 files changed, 80 insertions(+), 233 deletions(-)
---
diff --git a/lib/rb-util.c b/lib/rb-util.c
index ffcd47e..fc170df 100644
--- a/lib/rb-util.c
+++ b/lib/rb-util.c
@@ -356,7 +356,7 @@ rb_image_new_from_stock (const gchar *stock_id, GtkIconSize size)
 			return NULL;
 		}
 		
-		pixbuf = gtk_widget_render_icon (image, stock_id, size, NULL);
+		pixbuf = gtk_widget_render_icon_pixbuf (image, stock_id, size);
 		g_assert (pixbuf != NULL);
 		
 		
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 75552da..9d76271 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -5,8 +5,9 @@ SUBDIRS = 						\
 	mmkeys						\
 	power-manager					\
 	sample						\
-	status-icon					\
-	visualizer
+	status-icon
+
+# visualizer
 
 if WITH_LIRC
 SUBDIRS += lirc
diff --git a/plugins/daap/rb-dacp-pairing-page.c b/plugins/daap/rb-dacp-pairing-page.c
index ad1b0b0..91b5f20 100644
--- a/plugins/daap/rb-dacp-pairing-page.c
+++ b/plugins/daap/rb-dacp-pairing-page.c
@@ -272,7 +272,7 @@ impl_constructed (GObject *object)
 
 		entry_name = g_strdup_printf ("passcode_entry%d", i + 1);
 		page->priv->entries[i] = GTK_WIDGET (gtk_builder_get_object (page->priv->builder, entry_name));
-		gtk_widget_modify_font (page->priv->entries[i], font);
+		gtk_widget_override_font (page->priv->entries[i], font);
 		g_signal_connect_object (page->priv->entries[i],
 		                         "insert-text",
 		                         G_CALLBACK (entry_insert_text_cb),
diff --git a/sources/rb-display-page-tree.c b/sources/rb-display-page-tree.c
index 3fe6808..a083540 100644
--- a/sources/rb-display-page-tree.c
+++ b/sources/rb-display-page-tree.c
@@ -147,33 +147,32 @@ set_cell_background (RBDisplayPageTree  *display_page_tree,
 		     gboolean            is_group,
 		     gboolean            is_active)
 {
-	GdkColor  color;
-	GtkStyle *style;
+	GdkRGBA color;
 
 	g_return_if_fail (display_page_tree != NULL);
 	g_return_if_fail (cell != NULL);
 
-	style = gtk_widget_get_style (GTK_WIDGET (display_page_tree));
+	gtk_style_context_get_color (gtk_widget_get_style_context (GTK_WIDGET (display_page_tree)),
+				     GTK_STATE_SELECTED,
+				     &color);
 
 	if (!is_group) {
 		if (is_active) {
-			color = style->bg[GTK_STATE_SELECTED];
-
 			/* Here we take the current theme colour and add it to
 			 * the colour for white and average the two. This
 			 * gives a colour which is inline with the theme but
 			 * slightly whiter.
 			 */
-			color.red = (color.red + (style->white).red) / 2;
-			color.green = (color.green + (style->white).green) / 2;
-			color.blue = (color.blue + (style->white).blue) / 2;
+			color.red = (color.red + 1.0) / 2;
+			color.green = (color.green + 1.0) / 2;
+			color.blue = (color.blue + 1.0) / 2;
 
 			g_object_set (cell,
-				      "cell-background-gdk", &color,
+				      "cell-background-rgba", &color,
 				      NULL);
 		} else {
 			g_object_set (cell,
-				      "cell-background-gdk", NULL,
+				      "cell-background-rgba", NULL,
 				      NULL);
 		}
 	} else {
@@ -652,7 +651,6 @@ rb_display_page_tree_toggle_expanded (RBDisplayPageTree *display_page_tree,
 {
 	GtkTreeIter iter;
 	GtkTreePath *path;
-	gboolean expanding;
 
 	g_assert (rb_display_page_model_find_page (display_page_tree->priv->page_model,
 						   page,
@@ -662,16 +660,19 @@ rb_display_page_tree_toggle_expanded (RBDisplayPageTree *display_page_tree,
 	if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (display_page_tree->priv->treeview), path)) {
 		rb_debug ("collapsing page %p", page);
 		gtk_tree_view_collapse_row (GTK_TREE_VIEW (display_page_tree->priv->treeview), path);
-		expanding = FALSE;
+		g_object_set (display_page_tree->priv->expander_renderer,
+			      "expander-style",
+			      GTK_EXPANDER_COLLAPSED,
+			      NULL);
 	} else {
 		rb_debug ("expanding page %p", page);
 		gtk_tree_view_expand_row (GTK_TREE_VIEW (display_page_tree->priv->treeview), path, FALSE);
-		expanding = TRUE;
+		g_object_set (display_page_tree->priv->expander_renderer,
+			      "expander-style",
+			      GTK_EXPANDER_EXPANDED,
+			      NULL);
 	}
-	gossip_cell_renderer_expander_start_animation (GOSSIP_CELL_RENDERER_EXPANDER (display_page_tree->priv->expander_renderer),
-						       GTK_TREE_VIEW (display_page_tree->priv->treeview),
-						       path,
-						       expanding);
+
 	gtk_tree_path_free (path);
 }
 
diff --git a/widgets/gossip-cell-renderer-expander.c b/widgets/gossip-cell-renderer-expander.c
index b309478..dfd6b0a 100644
--- a/widgets/gossip-cell-renderer-expander.c
+++ b/widgets/gossip-cell-renderer-expander.c
@@ -27,14 +27,17 @@
  *     start the new one).
  */
 
+/*
+ * XXX none of the above applies any more since animation is (I guess)
+ * the style's responsibility now.  maybe rewrite this for license purity?
+ */
+
 #include "config.h"
 
 #include <gtk/gtk.h>
 
 #include "gossip-cell-renderer-expander.h"
 
-#include "gseal-gtk-compat.h"
-
 #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOSSIP_TYPE_CELL_RENDERER_EXPANDER, GossipCellRendererExpanderPriv))
 
 static void     gossip_cell_renderer_expander_init         (GossipCellRendererExpander      *expander);
@@ -80,17 +83,10 @@ enum {
 typedef struct _GossipCellRendererExpanderPriv GossipCellRendererExpanderPriv;
 
 struct _GossipCellRendererExpanderPriv {
-	GtkExpanderStyle     expander_style;
+	GtkStateFlags        style_flags;
 	gint                 expander_size;
 
-	GtkTreeView         *animation_view;
-	GtkTreeRowReference *animation_node;
-	GtkExpanderStyle     animation_style;
-	guint                animation_timeout;
-	GdkRectangle         animation_area;
-
 	guint                activatable : 1;
-	guint                animation_expanding : 1;
 };
 
 G_DEFINE_TYPE (GossipCellRendererExpander, gossip_cell_renderer_expander, GTK_TYPE_CELL_RENDERER)
@@ -102,10 +98,9 @@ gossip_cell_renderer_expander_init (GossipCellRendererExpander *expander)
 
 	priv = GET_PRIV (expander);
 
-	priv->expander_style = GTK_EXPANDER_COLLAPSED;
+	priv->style_flags = 0;
 	priv->expander_size = 12;
 	priv->activatable = TRUE;
-	priv->animation_node = NULL;
 
 	gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (expander), 2, 2);
 	g_object_set (expander,
@@ -175,7 +170,7 @@ gossip_cell_renderer_expander_get_property (GObject    *object,
 
 	switch (param_id) {
 	case PROP_EXPANDER_STYLE:
-		g_value_set_enum (value, priv->expander_style);
+		g_value_set_enum (value, priv->style_flags & GTK_STATE_FLAG_ACTIVE ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED);
 		break;
 
 	case PROP_EXPANDER_SIZE:
@@ -206,7 +201,11 @@ gossip_cell_renderer_expander_set_property (GObject      *object,
 
 	switch (param_id) {
 	case PROP_EXPANDER_STYLE:
-		priv->expander_style = g_value_get_enum (value);
+		if (g_value_get_enum (value) == GTK_EXPANDER_EXPANDED) {
+			priv->style_flags |= GTK_STATE_FLAG_ACTIVE;
+		} else {
+			priv->style_flags &= ~(GTK_STATE_FLAG_ACTIVE);
+		}
 		break;
 
 	case PROP_EXPANDER_SIZE:
@@ -230,15 +229,6 @@ gossip_cell_renderer_expander_finalize (GObject *object)
 
 	priv = GET_PRIV (object);
 
-	if (priv->animation_timeout) {
-		g_source_remove (priv->animation_timeout);
-		priv->animation_timeout = 0;
-	}
-
-	if (priv->animation_node) {
-		gtk_tree_row_reference_free (priv->animation_node);
-	}
-
 	(* G_OBJECT_CLASS (gossip_cell_renderer_expander_parent_class)->finalize) (object);
 }
 
@@ -305,157 +295,27 @@ gossip_cell_renderer_expander_render (GtkCellRenderer      *cell,
 {
 	GossipCellRendererExpander     *expander;
 	GossipCellRendererExpanderPriv *priv;
-	GtkExpanderStyle                expander_style;
+	GtkStyleContext                *style_context;
 	gint                            x_offset, y_offset;
 	gint                            xpad, ypad;
 
 	expander = (GossipCellRendererExpander*) cell;
 	priv = GET_PRIV (expander);
 
-	if (priv->animation_node) {
-		GtkTreePath *path;
-		GdkRectangle rect;
-
-		/* Not sure if I like this ... */
-		path = gtk_tree_row_reference_get_path (priv->animation_node);
-		gtk_tree_view_get_background_area (priv->animation_view, path,
-						   NULL, &rect);
-		gtk_tree_path_free (path);
-
-		if (background_area->y == rect.y)
-			expander_style = priv->animation_style;
-		else
-			expander_style = priv->expander_style;
-	} else
-		expander_style = priv->expander_style;
-
 	gossip_cell_renderer_expander_get_size (cell, widget, cell_area,
 						&x_offset, &y_offset,
 						NULL, NULL);
 	gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
 
-	gtk_paint_expander (gtk_widget_get_style (widget),
-			    cr,
-			    GTK_STATE_NORMAL,
-			    widget,
-			    "treeview",
-			    cell_area->x + x_offset + xpad + priv->expander_size / 2,
-			    cell_area->y + y_offset + ypad + priv->expander_size / 2,
-			    expander_style);
-}
-
-static void
-invalidate_node (GtkTreeView *tree_view,
-		 GtkTreePath *path)
-{
-       GtkAllocation  allocation;
-       GdkWindow     *bin_window;
-       GdkRectangle   rect;
-
-       bin_window = gtk_tree_view_get_bin_window (tree_view);
-
-       gtk_tree_view_get_background_area (tree_view, path, NULL, &rect);
-       gtk_widget_get_allocation (GTK_WIDGET (tree_view), &allocation);
-
-       rect.x = 0;
-       rect.width = allocation.width;
-
-       gdk_window_invalidate_rect (bin_window, &rect, TRUE);
-}
-
-static gboolean
-do_animation (GossipCellRendererExpander *expander)
-{
-	GossipCellRendererExpanderPriv *priv;
-	GtkTreePath                    *path;
-	gboolean                        done = FALSE;
-
-	priv = GET_PRIV (expander);
-
-	if (priv->animation_expanding) {
-		if (priv->animation_style == GTK_EXPANDER_SEMI_COLLAPSED)
-			priv->animation_style = GTK_EXPANDER_SEMI_EXPANDED;
-		else if (priv->animation_style == GTK_EXPANDER_SEMI_EXPANDED) {
-			priv->animation_style = GTK_EXPANDER_EXPANDED;
-			done = TRUE;
-		}
-	} else {
-		if (priv->animation_style == GTK_EXPANDER_SEMI_EXPANDED)
-			priv->animation_style = GTK_EXPANDER_SEMI_COLLAPSED;
-		else if (priv->animation_style == GTK_EXPANDER_SEMI_COLLAPSED) {
-			priv->animation_style = GTK_EXPANDER_COLLAPSED;
-			done = TRUE;
-		}
-	}
-
-	path = gtk_tree_row_reference_get_path (priv->animation_node);
-	invalidate_node (priv->animation_view, path);
-	gtk_tree_path_free (path);
+	style_context = gtk_widget_get_style_context (widget);
+	gtk_style_context_set_state (style_context, priv->style_flags);
 
-	if (done) {
-		gtk_tree_row_reference_free (priv->animation_node);
-		priv->animation_node = NULL;
-		priv->animation_timeout = 0;
-	}
-
-	return !done;
-}
-
-static gboolean
-animation_timeout (gpointer data)
-{
-	gboolean retval;
-
-	GDK_THREADS_ENTER ();
-
-	retval = do_animation (data);
-
-	GDK_THREADS_LEAVE ();
-
-	return retval;
-}
-
-void
-gossip_cell_renderer_expander_start_animation (GossipCellRendererExpander *expander,
-					       GtkTreeView                *tree_view,
-					       GtkTreePath                *path,
-					       gboolean                    expanding)
-{
-	GossipCellRendererExpanderPriv *priv;
-	GtkSettings                    *settings;
-	gboolean                        animate;
-
-	settings = gtk_widget_get_settings (GTK_WIDGET (tree_view));
-	if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings), "gtk-enable-animations")) {
-		g_object_get (settings,
-			      "gtk-enable-animations", &animate,
-			      NULL);
-	} else {
-		animate = FALSE;
-	}
-
-	if (animate == FALSE) {
-		return;
-	}
-
-	priv = GET_PRIV (expander);
-	if (expanding) {
-		priv->animation_style = GTK_EXPANDER_SEMI_COLLAPSED;
-	} else {
-		priv->animation_style = GTK_EXPANDER_SEMI_EXPANDED;
-	}
-
-	invalidate_node (tree_view, path);
-
-	if (priv->animation_timeout != 0) {
-		g_source_remove (priv->animation_timeout);
-		gtk_tree_row_reference_free (priv->animation_node);
-	}
-
-	priv->animation_expanding = expanding;
-	priv->animation_view = tree_view;
-	priv->animation_node = gtk_tree_row_reference_new (gtk_tree_view_get_model (tree_view), path);
-	priv->animation_timeout = g_timeout_add (50, animation_timeout, expander);
+	gtk_render_expander (gtk_widget_get_style_context (widget),
+			     cr,
+			     cell_area->x + x_offset + xpad,
+			     cell_area->y + y_offset + ypad,
+			     priv->expander_size,
+			     priv->expander_size);
 }
 
 static gboolean
@@ -470,7 +330,6 @@ gossip_cell_renderer_expander_activate (GtkCellRenderer      *cell,
 	GossipCellRendererExpander     *expander;
 	GossipCellRendererExpanderPriv *priv;
 	GtkTreePath                    *path;
-	gboolean                        expanding;
 	gboolean                        in_cell;
 	int                             mouse_x;
 	int                             mouse_y;
@@ -501,25 +360,14 @@ gossip_cell_renderer_expander_activate (GtkCellRenderer      *cell,
 		return FALSE;
 	}
 
-#if 0
-	if (gtk_tree_path_get_depth (path) > 1) {
-		gtk_tree_path_free (path);
-		return TRUE;
-	}
-#endif
-
 	if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (widget), path)) {
 		gtk_tree_view_collapse_row (GTK_TREE_VIEW (widget), path);
-		expanding = FALSE;
+		priv->style_flags &= ~(GTK_STATE_FLAG_ACTIVE);
 	} else {
 		gtk_tree_view_expand_row (GTK_TREE_VIEW (widget), path, FALSE);
-		expanding = TRUE;
+		priv->style_flags |= ~(GTK_STATE_FLAG_ACTIVE);
 	}
 
-	gossip_cell_renderer_expander_start_animation (expander,
-						       GTK_TREE_VIEW (widget),
-						       path,
-						       expanding);
 	gtk_tree_path_free (path);
 
 	return TRUE;
diff --git a/widgets/gossip-cell-renderer-expander.h b/widgets/gossip-cell-renderer-expander.h
index 692bffb..b512205 100644
--- a/widgets/gossip-cell-renderer-expander.h
+++ b/widgets/gossip-cell-renderer-expander.h
@@ -52,11 +52,6 @@ struct _GossipCellRendererExpanderClass {
 GType            gossip_cell_renderer_expander_get_type 	(void) G_GNUC_CONST;
 GtkCellRenderer *gossip_cell_renderer_expander_new      	(void);
 
-void		 gossip_cell_renderer_expander_start_animation  (GossipCellRendererExpander *expander,
-								 GtkTreeView *widget,
-								 GtkTreePath *path,
-								 gboolean expanding);
-
 G_END_DECLS
 
 #endif /* __GOSSIP_CELL_RENDERER_EXPANDER_H__ */
diff --git a/widgets/rb-rating-helper.c b/widgets/rb-rating-helper.c
index 3e67aa8..3aeaf9b 100644
--- a/widgets/rb-rating-helper.c
+++ b/widgets/rb-rating-helper.c
@@ -180,9 +180,9 @@ rb_rating_render_stars (GtkWidget *widget,
 	for (i = 0; i < RB_RATING_MAX_SCORE; i++) {
 		GdkPixbuf *buf;
 		GtkStateType state;
-		GtkStyle *style;
 		gint star_offset;
 		int offset;
+		GdkRGBA color;
 
 		if (selected == TRUE) {
 			offset = 0;
@@ -209,11 +209,11 @@ rb_rating_render_stars (GtkWidget *widget,
 			return FALSE;
 		}
 
-		style = gtk_widget_get_style (widget);
+		gtk_style_context_get_color (gtk_widget_get_style_context (widget), state, &color);
 		buf = eel_create_colorized_pixbuf (buf,
-						   (style->text[state].red + offset) >> 8,
-						   (style->text[state].green + offset) >> 8,
-						   (style->text[state].blue + offset) >> 8);
+						   ((guint16)(color.red * G_MAXUINT16) + offset) >> 8,
+						   ((guint16)(color.green * G_MAXUINT16) + offset) >> 8,
+						   ((guint16)(color.blue * G_MAXUINT16) + offset) >> 8);
 		if (buf == NULL) {
 			return FALSE;
 		}
diff --git a/widgets/rb-rating.c b/widgets/rb-rating.c
index 6752715..bf253f0 100644
--- a/widgets/rb-rating.c
+++ b/widgets/rb-rating.c
@@ -210,6 +210,9 @@ rb_rating_init (RBRating *rating)
 	rating->priv->pixbufs = rb_rating_pixbufs_new ();
 	
 	rb_rating_set_accessible_name (GTK_WIDGET (rating), 0.0);
+
+	gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (rating)),
+				     GTK_STYLE_CLASS_ENTRY);
 }
 
 static void
@@ -304,7 +307,6 @@ static void
 rb_rating_realize (GtkWidget *widget)
 {
 	GtkAllocation allocation;
-	GtkStyle *style;
 	GdkWindowAttr attributes;
 	GdkWindow *window;
 	int attributes_mask;
@@ -321,19 +323,14 @@ rb_rating_realize (GtkWidget *widget)
 	attributes.window_type = GDK_WINDOW_CHILD;
 	attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK;
 	attributes.visual = gtk_widget_get_visual (widget);
-	/*attributes.colormap = gtk_widget_get_colormap (widget);*/
 
-	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL /*| GDK_WA_COLORMAP*/;
+	attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
 
 	window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
 	gtk_widget_set_window (widget, window);
 	gdk_window_set_user_data (window, widget);
 
 	gtk_widget_set_can_focus (widget, TRUE);
-
-	style = gtk_style_attach (gtk_widget_get_style (widget), window);
-	gtk_widget_set_style (widget, style);
-	gtk_style_set_background (style, window, GTK_STATE_ACTIVE);
 }
 
 static void
@@ -394,10 +391,15 @@ rb_rating_draw (GtkWidget *widget, cairo_t *cr)
 		height -= 2 * focus_width;
 	}
 
-	gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
-			    GTK_STATE_NORMAL, GTK_SHADOW_IN,
-			    widget, "entry_bg", x, y,
-			    width, height);
+	/* need to set state?  shadow type?  */
+	gtk_render_background (gtk_widget_get_style_context (widget),
+			       cr,
+			       x, y,
+			       width, height);
+	gtk_render_frame (gtk_widget_get_style_context (widget),
+			  cr,
+			  x, y,
+			  width, height);
 
 	/* draw the stars */
 	if (rating->priv->pixbufs != NULL) {
diff --git a/widgets/rb-search-entry.c b/widgets/rb-search-entry.c
index 71b1200..a56150a 100644
--- a/widgets/rb-search-entry.c
+++ b/widgets/rb-search-entry.c
@@ -265,8 +265,8 @@ rb_search_entry_set_text (RBSearchEntry *entry, const char *text)
 static void
 rb_search_entry_check_style (RBSearchEntry *entry)
 {
-	static const GdkColor bg_colour = { 0, 0xf7f7, 0xf7f7, 0xbebe }; /* yellow-ish */
-	static const GdkColor fg_colour = { 0, 0, 0, 0 }; /* black. */
+	static const GdkRGBA bg_colour = { 0.9686, 0.9686, 0.7451, 1.0}; /* yellow-ish */
+	static const GdkRGBA fg_colour = { 0, 0, 0, 1.0 }; /* black. */
 	const gchar* text;
 
 	if (entry->priv->is_a11y_theme)
@@ -274,13 +274,13 @@ rb_search_entry_check_style (RBSearchEntry *entry)
 
 	text = gtk_entry_get_text (GTK_ENTRY (entry->priv->entry));
 	if (text && *text) {
-		gtk_widget_modify_text (entry->priv->entry, GTK_STATE_NORMAL, &fg_colour);
-		gtk_widget_modify_base (entry->priv->entry, GTK_STATE_NORMAL, &bg_colour);
-		gtk_widget_modify_cursor (entry->priv->entry, &fg_colour, &fg_colour);
+		gtk_widget_override_color (entry->priv->entry, GTK_STATE_NORMAL, &fg_colour);
+		gtk_widget_override_background_color (entry->priv->entry, GTK_STATE_NORMAL, &bg_colour);
+		gtk_widget_override_cursor (entry->priv->entry, &fg_colour, &fg_colour);
 	} else {
-		gtk_widget_modify_text (entry->priv->entry, GTK_STATE_NORMAL, NULL);
-		gtk_widget_modify_base (entry->priv->entry, GTK_STATE_NORMAL, NULL);
-		gtk_widget_modify_cursor (entry->priv->entry, NULL, NULL);
+		gtk_widget_override_color (entry->priv->entry, GTK_STATE_NORMAL, NULL);
+		gtk_widget_override_background_color (entry->priv->entry, GTK_STATE_NORMAL, NULL);
+		gtk_widget_override_cursor (entry->priv->entry, NULL, NULL);
 	}
 
 	gtk_widget_queue_draw (GTK_WIDGET (entry));
diff --git a/widgets/rb-segmented-bar.c b/widgets/rb-segmented-bar.c
index 3baf8ca..f41c1aa 100644
--- a/widgets/rb-segmented-bar.c
+++ b/widgets/rb-segmented-bar.c
@@ -680,10 +680,9 @@ static void rb_segmented_bar_render_labels (RBSegmentedBar *bar,
 					    cairo_t *context)
 {
 	RBSegmentedBarPrivate *priv;
-	GtkStyle *style;
 	PangoLayout *layout;
 	Color text_color;
-	GdkColor *gdk_color;
+	GdkRGBA gdk_color;
 	gboolean ltr = TRUE;
 	int x = 0;
 	GList *it;
@@ -693,17 +692,18 @@ static void rb_segmented_bar_render_labels (RBSegmentedBar *bar,
 	if (priv->segments == NULL) {
 		return;
 	}
-	style = gtk_widget_get_style (GTK_WIDGET (bar));
-	gdk_color = &style->fg[gtk_widget_get_state (GTK_WIDGET (bar))];
+	gtk_style_context_get_color (gtk_widget_get_style_context (GTK_WIDGET (bar)),
+				     gtk_widget_get_state (GTK_WIDGET (bar)),
+				     &gdk_color);
 
 	if (gtk_widget_get_direction (GTK_WIDGET (bar)) == GTK_TEXT_DIR_RTL) {
 		ltr = FALSE;
 		x = priv->layout_width;
 	}
 
-	text_color.red = gdk_color->red / 65535.0;
-	text_color.green = gdk_color->green / 65535.0;
-	text_color.blue = gdk_color->blue / 65535.0;
+	text_color.red = gdk_color.red;
+	text_color.green = gdk_color.green;
+	text_color.blue = gdk_color.blue;
 	text_color.alpha = 1.0;
 	layout = NULL;
 	for (it = priv->segments; it != NULL; it = it->next) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]