[gthumb] removed the use of GtkStyle and other deprecated functions



commit 99c10fbb08f22a54e1f947384f723471b1507868
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Oct 16 16:45:06 2011 +0200

    removed the use of GtkStyle and other deprecated functions

 extensions/file_manager/callbacks.c                |    3 +-
 extensions/gstreamer_tools/gth-media-viewer-page.c |   21 ++-
 extensions/slideshow/gth-slideshow.c               |   17 +-
 gthumb/gth-cell-renderer-thumbnail.c               |   46 +++--
 gthumb/gth-empty-list.c                            |   52 +++---
 gthumb/gth-folder-tree.c                           |   20 +--
 gthumb/gth-histogram-view.c                        |   57 +++---
 gthumb/gth-image-dragger.c                         |   25 ++--
 gthumb/gth-image-navigator.c                       |   36 ++--
 gthumb/gth-image-selector.c                        |   23 ++-
 gthumb/gth-image-viewer.c                          |  107 +++++------
 gthumb/gth-menu-button.c                           |    2 +-
 gthumb/gth-time-selector.c                         |   30 ++--
 gthumb/gth-toggle-menu-tool-button.c               |    4 +-
 gthumb/gth-window.c                                |   11 +
 gthumb/gtk-utils.c                                 |   41 ++++-
 gthumb/gtk-utils.h                                 |  209 ++++++++++----------
 17 files changed, 382 insertions(+), 322 deletions(-)
---
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 3ed5212..cff6008 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -1000,8 +1000,7 @@ activate_open_with_application_item (GtkMenuItem *menuitem,
 	appinfo = g_object_get_data (G_OBJECT (menuitem), "appinfo");
 	g_return_if_fail (G_IS_APP_INFO (appinfo));
 
-	context = gdk_app_launch_context_new ();
-	gdk_app_launch_context_set_screen (context, gtk_widget_get_screen (GTK_WIDGET (browser)));
+	context = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (browser)));
 	gdk_app_launch_context_set_timestamp (context, 0);
 	gdk_app_launch_context_set_icon (context, g_app_info_get_icon (appinfo));
 	if (! g_app_info_launch_uris (appinfo, uris, G_APP_LAUNCH_CONTEXT (context), &error)) {
diff --git a/extensions/gstreamer_tools/gth-media-viewer-page.c b/extensions/gstreamer_tools/gth-media-viewer-page.c
index e6c72cd..ace1e7d 100644
--- a/extensions/gstreamer_tools/gth-media-viewer-page.c
+++ b/extensions/gstreamer_tools/gth-media-viewer-page.c
@@ -177,7 +177,7 @@ video_area_draw_cb (GtkWidget *widget,
 {
 	GthMediaViewerPage *self = user_data;
 	GtkAllocation       allocation;
-	GtkStyle           *style;
+	GtkStyleContext    *style_context;
 
 	if (event->count > 0)
 		return FALSE;
@@ -186,7 +186,7 @@ video_area_draw_cb (GtkWidget *widget,
 		return FALSE;
 
 	gtk_widget_get_allocation (widget, &allocation);
-	style = gtk_widget_get_style (widget);
+	style_context = gtk_widget_get_style_context (widget);
 
 	if (self->priv->icon == NULL) {
 		char  *type;
@@ -209,10 +209,16 @@ video_area_draw_cb (GtkWidget *widget,
 		g_free (type);
 	}
 
-	if (self->priv->has_video)
-		cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+	if (! self->priv->has_video) {
+		GdkRGBA color;
+
+		gtk_style_context_get_background_color (style_context,
+							gtk_widget_get_state (widget),
+							&color);
+		gdk_cairo_set_source_rgba (cr, &color);
+	}
 	else
-		gdk_cairo_set_source_color (cr, &style->text[gtk_widget_get_state (widget)]);
+		cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
 	gdk_cairo_region (cr, event->region);
 	cairo_fill (cr);
 
@@ -222,6 +228,7 @@ video_area_draw_cb (GtkWidget *widget,
 		int            icon_x, icon_y;
 		PangoRectangle logical_rect;
 		int            x, y;
+		GdkRGBA        color;
 
 		icon_w = gdk_pixbuf_get_width (self->priv->icon);
 		icon_h = gdk_pixbuf_get_height (self->priv->icon);
@@ -241,8 +248,10 @@ video_area_draw_cb (GtkWidget *widget,
 		cairo_fill (cr);
 
 		cairo_move_to (cr, x, y);
+		pango_layout_set_font_description (self->priv->caption_layout, gtk_style_context_get_font (style_context, gtk_widget_get_state (widget)));
 		pango_cairo_layout_path (cr, self->priv->caption_layout);
-		gdk_cairo_set_source_color (cr, &style->base[gtk_widget_get_state (widget)]);
+		gtk_style_context_get_color (style_context, gtk_widget_get_state (widget), &color);
+		gdk_cairo_set_source_rgba (cr, &color);
 		cairo_fill (cr);
 	}
 
diff --git a/extensions/slideshow/gth-slideshow.c b/extensions/slideshow/gth-slideshow.c
index 002cf8d..f84e77d 100644
--- a/extensions/slideshow/gth-slideshow.c
+++ b/extensions/slideshow/gth-slideshow.c
@@ -964,7 +964,7 @@ clutter_projector_image_ready (GthSlideshow *self,
 		texture = self->priv->image1;
 	else
 		texture = self->priv->image2;
-	gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (texture), image, NULL);
+	gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE (texture), image, NULL);
 
 	self->next_geometry.x = 0;
 	self->next_geometry.y = 0;
@@ -1147,7 +1147,7 @@ adapt_image_size_to_stage_size (GthSlideshow *self)
 		texture = self->priv->image1;
 	else
 		texture = self->priv->image2;
-	gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (texture), image, NULL);
+	gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE (texture), image, NULL);
 
 	self->current_geometry.x = 0;
 	self->current_geometry.y = 0;
@@ -1203,12 +1203,17 @@ clutter_projector_construct (GthSlideshow *self)
 
 	self->priv->alpha = clutter_alpha_new_full (self->priv->timeline, CLUTTER_EASE_IN_OUT_SINE);
 
+	self->priv->paused_actor = gtk_clutter_texture_new ();
 	if (self->priv->pause_pixbuf != NULL)
-		self->priv->paused_actor = gtk_clutter_texture_new_from_pixbuf (self->priv->pause_pixbuf);
+		gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE (self->priv->paused_actor),
+				 	 	     self->priv->pause_pixbuf,
+				 	 	     NULL);
 	else
-		self->priv->paused_actor = gtk_clutter_texture_new_from_stock (GTK_WIDGET (self),
-									       GTK_STOCK_MEDIA_PAUSE,
-									       GTK_ICON_SIZE_DIALOG);
+		gtk_clutter_texture_set_from_stock (GTK_CLUTTER_TEXTURE (self->priv->paused_actor),
+						    GTK_WIDGET (self),
+						    GTK_STOCK_MEDIA_PAUSE,
+						    GTK_ICON_SIZE_DIALOG,
+						    NULL);
 	clutter_actor_hide (self->priv->paused_actor);
 	clutter_container_add_actor (CLUTTER_CONTAINER (self->stage), self->priv->paused_actor);
 
diff --git a/gthumb/gth-cell-renderer-thumbnail.c b/gthumb/gth-cell-renderer-thumbnail.c
index 222dc2c..3076e77 100644
--- a/gthumb/gth-cell-renderer-thumbnail.c
+++ b/gthumb/gth-cell-renderer-thumbnail.c
@@ -22,6 +22,7 @@
 #include <config.h>
 #include "cairo-utils.h"
 #include "gth-file-data.h"
+#include "gtk-utils.h"
 #include "glib-utils.h"
 #include "gth-cell-renderer-thumbnail.h"
 #include "pixbuf-utils.h"
@@ -234,7 +235,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 				    GtkCellRendererState   flags)
 {
 	GthCellRendererThumbnail *self;
-	GtkStyle                 *style;
+	GtkStyleContext          *style_context;
 	GtkStateType              state;
 	cairo_rectangle_int_t     thumb_rect;
 	cairo_rectangle_int_t     draw_rect;
@@ -272,7 +273,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 	image_rect.x = thumb_rect.x + (thumb_rect.width - image_rect.width) * .5;
 	image_rect.y = thumb_rect.y + (thumb_rect.height - image_rect.height) * .5;
 
-	style = gtk_widget_get_style (widget);
+	style_context = gtk_widget_get_style_context (widget);
 
 	if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
 		state = gtk_widget_has_focus (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
@@ -280,16 +281,14 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 		state = ((flags & GTK_CELL_RENDERER_FOCUSED) == GTK_CELL_RENDERER_FOCUSED) ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL;
 
 	if (self->priv->is_icon || ((image_rect.width < self->priv->size) && (image_rect.height < self->priv->size))) {
-		GtkStyle *style;
+		GdkRGBA color;
 
 		/* use a gray rounded box for icons or when the original size
 		 * is smaller than the thumbnail size... */
 
-		style = gtk_widget_get_style (widget);
-		if (state == GTK_STATE_NORMAL)
-			gdk_cairo_set_source_color (cr, &style->bg[state]);
-		else
-			gdk_cairo_set_source_color (cr, &style->base[state]);
+		gtk_style_context_get_background_color (style_context, state, &color);
+		_gdk_rgba_lighter (&color, &color);
+		gdk_cairo_set_source_rgba (cr, &color);
 
 		_cairo_draw_rounded_box (cr,
 					 thumb_rect.x,
@@ -304,10 +303,19 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 		/* ...else draw a frame with a drop-shadow effect */
 
 		cairo_rectangle_int_t frame_rect;
+		GdkRGBA               background_color;
+		GdkRGBA               color;
+		GdkRGBA               lighter_color;
+		GdkRGBA               darker_color;
 
 		if (state == GTK_STATE_ACTIVE)
 			state = GTK_STATE_SELECTED;
 
+		gtk_style_context_get_background_color (style_context, state, &background_color);
+		gtk_style_context_get_color (style_context, state, &color);
+		_gdk_rgba_lighter (&color, &lighter_color);
+		_gdk_rgba_darker (&color, &darker_color);
+
 		if (self->priv->fixed_size && _g_mime_type_is_image (gth_file_data_get_mime_type (self->priv->file))) {
 			frame_rect.width = self->priv->size; /*image_rect.width*/
 			frame_rect.height = self->priv->size; /*image_rect.height*/
@@ -330,7 +338,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 		if (border > 1) {
 			/* the drop shadow */
 
-			gdk_cairo_set_source_color (cr, &style->dark[state]);
+			gdk_cairo_set_source_rgba (cr, &darker_color);
 			_cairo_draw_rounded_box (cr,
 						 frame_rect.x - border + 2,
 						 frame_rect.y - border + 2,
@@ -341,7 +349,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 
 			/* the outer frame */
 
-			gdk_cairo_set_source_color (cr, &style->bg[state]);
+			gdk_cairo_set_source_rgba (cr, &background_color);
 			_cairo_draw_rounded_box (cr,
 						 frame_rect.x - border,
 						 frame_rect.y - border,
@@ -351,9 +359,9 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 			cairo_fill_preserve (cr);
 
 			if (state == GTK_STATE_SELECTED)
-				gdk_cairo_set_source_color (cr, &style->dark[state]);
+				gdk_cairo_set_source_rgba (cr, &darker_color);
 			else
-				gdk_cairo_set_source_color (cr, &style->mid[state]);
+				gdk_cairo_set_source_rgba (cr, &lighter_color);
 
 			cairo_stroke (cr);
 
@@ -369,7 +377,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 		else {
 			/* the drop shadow */
 
-			gdk_cairo_set_source_color (cr, &style->dark[state]);
+			gdk_cairo_set_source_rgba (cr, &darker_color);
 			cairo_rectangle (cr,
 					 frame_rect.x - border + 2,
 					 frame_rect.y - border + 2,
@@ -377,7 +385,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 					 frame_rect.height + (border * 2));
 			cairo_fill (cr);
 
-			gdk_cairo_set_source_color (cr, &style->dark[state]);
+			gdk_cairo_set_source_rgba (cr, &darker_color);
 			cairo_rectangle (cr,
 					 frame_rect.x - border,
 					 frame_rect.y - border,
@@ -390,7 +398,15 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer       *cell,
 	}
 
 	if (! self->priv->checked || ((flags & (GTK_CELL_RENDERER_SELECTED | GTK_CELL_RENDERER_PRELIT)) != 0)) {
-		colorized = _gdk_pixbuf_colorize (pixbuf, &style->base[state], self->priv->checked ? 1.0 : 0.33);
+		GdkRGBA  rgba_color;
+		GdkColor color;
+
+		gtk_style_context_get_background_color (style_context, state, &rgba_color);
+		color.pixel = 0;
+		color.red = rgba_color.red;
+		color.green = rgba_color.green;
+		color.blue = rgba_color.blue;
+		colorized = _gdk_pixbuf_colorize (pixbuf, &color, self->priv->checked ? 1.0 : 0.33);
 		pixbuf = colorized;
 	}
 
diff --git a/gthumb/gth-empty-list.c b/gthumb/gth-empty-list.c
index 963e88d..37a365c 100644
--- a/gthumb/gth-empty-list.c
+++ b/gthumb/gth-empty-list.c
@@ -98,12 +98,12 @@ gth_empty_list_get_property (GObject    *object,
 static void
 gth_empty_list_realize (GtkWidget *widget)
 {
-	GthEmptyList  *self;
-	GtkAllocation  allocation;
-	GdkWindowAttr  attributes;
-	int            attributes_mask;
-	GdkWindow     *window;
-	GtkStyle      *style;
+	GthEmptyList    *self;
+	GtkAllocation    allocation;
+	GdkWindowAttr    attributes;
+	int              attributes_mask;
+	GdkWindow       *window;
+	GtkStyleContext *style_context;
 
 	g_return_if_fail (GTH_IS_EMPTY_LIST (widget));
 	self = (GthEmptyList*) widget;
@@ -153,11 +153,9 @@ gth_empty_list_realize (GtkWidget *widget)
 
 	/* Style */
 
-	style = gtk_widget_get_style (widget);
-	style = gtk_style_attach (style, window);
-	gtk_widget_set_style (widget, style);
-	gdk_window_set_background (window, &style->base[gtk_widget_get_state (widget)]);
-	gdk_window_set_background (self->priv->bin_window, &style->base[gtk_widget_get_state (widget)]);
+	style_context = gtk_widget_get_style_context (widget);
+	gtk_style_context_set_background (style_context, window);
+	gtk_style_context_set_background (style_context, self->priv->bin_window);
 	
 	/* 'No Image' message Layout */
 
@@ -166,7 +164,6 @@ gth_empty_list_realize (GtkWidget *widget)
 
 	self->priv->layout = gtk_widget_create_pango_layout (widget, NULL);
 	pango_layout_set_wrap (self->priv->layout, PANGO_WRAP_WORD_CHAR);
-	pango_layout_set_font_description (self->priv->layout, style->font_desc);
 	pango_layout_set_alignment (self->priv->layout, PANGO_ALIGN_CENTER);
 }
 
@@ -234,11 +231,11 @@ static gboolean
 gth_empty_list_draw (GtkWidget *widget,
 		     cairo_t   *cr)
 {
-	GthEmptyList   *self = (GthEmptyList*) widget;
-	GtkAllocation   allocation;
-	PangoRectangle  bounds;
-	GtkStyle       *style;
-	cairo_t        *cr;
+	GthEmptyList    *self = (GthEmptyList*) widget;
+	GtkAllocation    allocation;
+	PangoRectangle   bounds;
+	GtkStyleContext *style_context;
+	GdkRGBA          color;
 	
 	if (event->window != self->priv->bin_window)
 		return FALSE;
@@ -251,22 +248,21 @@ gth_empty_list_draw (GtkWidget *widget,
 	pango_layout_set_text (self->priv->layout, self->priv->text, strlen (self->priv->text));
 	pango_layout_get_pixel_extents (self->priv->layout, NULL, &bounds);
 
+	style_context = gtk_widget_get_style_context (widget);
+	pango_layout_set_font_description (self->priv->layout, gtk_style_context_get_font (style_context, gtk_widget_get_state (widget)));
+	gtk_style_context_get_color (style_context, gtk_widget_get_state (widget), &color);
+	gdk_cairo_set_source_rgba (cr, &color);
 	cairo_move_to (cr, 0, (allocation.height - bounds.height) / 2);
 	pango_cairo_layout_path (cr, self->priv->layout);
-	style = gtk_widget_get_style (widget);
-	gdk_cairo_set_source_color (cr, &style->text[gtk_widget_get_state (widget)]);
+
 	cairo_fill (cr);
 
 	if (gtk_widget_has_focus (widget)) {
-		gtk_paint_focus (style,
-				 self->priv->bin_window,
-				 gtk_widget_get_state (widget),
-				 &event->area,
-				 widget,
-				 NULL,
-				 1, 1,
-				 allocation.width - 2,
-				 allocation.height - 2);
+		gtk_render_focus (style_context,
+				  cr,
+				  1, 1,
+				  allocation.width - 2,
+				  allocation.height - 2);
 	}
 
 	return TRUE;
diff --git a/gthumb/gth-folder-tree.c b/gthumb/gth-folder-tree.c
index f41cb15..167dc28 100644
--- a/gthumb/gth-folder-tree.c
+++ b/gthumb/gth-folder-tree.c
@@ -455,7 +455,6 @@ button_press_cb (GtkWidget      *widget,
 		GtkTreeSelection *selection;
 		int               start_pos;
 		int               width;
-		GValue            value = { 0, };
 		int               expander_size;
 		int               horizontal_separator;
 
@@ -481,19 +480,10 @@ button_press_cb (GtkWidget      *widget,
 			width = 0;
 		}
 
-		g_value_init (&value, G_TYPE_INT);
-		gtk_style_get_style_property (gtk_widget_get_style (GTK_WIDGET (folder_tree)),
-					      GTK_TYPE_TREE_VIEW,
-					      "expander-size",
-					      &value);
-		expander_size = g_value_get_int (&value);
-
-		gtk_style_get_style_property (gtk_widget_get_style (GTK_WIDGET (folder_tree)),
-					      GTK_TYPE_TREE_VIEW,
-					      "horizontal-separator",
-					      &value);
-		horizontal_separator = g_value_get_int (&value);
-
+		gtk_style_context_get_style (gtk_widget_get_style_context (GTK_WIDGET (folder_tree)),
+					     "expander-size", &expander_size,
+					     "horizontal-separator", &horizontal_separator,
+					     NULL);
 		start_pos += (gtk_tree_path_get_depth (path) - 1) * (expander_size + (horizontal_separator * 2));
 
 		selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
@@ -1104,7 +1094,7 @@ gth_folder_tree_set_list (GthFolderTree *folder_tree,
 		GtkTreeIter  iter;
 
 		sort_key = g_utf8_collate_key_for_filename (PARENT_URI, -1);
-		pixbuf = gtk_widget_render_icon (GTK_WIDGET (folder_tree), GTK_STOCK_GO_UP, GTK_ICON_SIZE_MENU, "folder-list");
+		pixbuf = gtk_widget_render_icon_pixbuf (GTK_WIDGET (folder_tree), GTK_STOCK_GO_UP, GTK_ICON_SIZE_MENU);
 
 		gtk_tree_store_append (folder_tree->priv->tree_store, &iter, NULL);
 		gtk_tree_store_set (folder_tree->priv->tree_store, &iter,
diff --git a/gthumb/gth-histogram-view.c b/gthumb/gth-histogram-view.c
index ba46e73..c235242 100644
--- a/gthumb/gth-histogram-view.c
+++ b/gthumb/gth-histogram-view.c
@@ -386,12 +386,10 @@ gth_histogram_paint_rgb (GthHistogramView *self,
 			 cairo_t          *cr,
 			 GtkAllocation    *allocation)
 {
-	GtkStyle *style;
-	double    max;
-	double    step;
-	int       i;
+	double max;
+	double step;
+	int    i;
 
-	style = gtk_widget_get_style (GTK_WIDGET (self));
 	max = MAX (gth_histogram_get_channel_max (self->priv->histogram, 1), gth_histogram_get_channel_max (self->priv->histogram, 2));
 	max = MAX (max, gth_histogram_get_channel_max (self->priv->histogram, 3));
 	if (max > 0.0)
@@ -402,14 +400,15 @@ gth_histogram_paint_rgb (GthHistogramView *self,
 	step = (double) (allocation->width - 1) / 256.0;
 	cairo_set_line_width (cr, 0.5);
 	for (i = 0; i <= 255; i++) {
-		double value_r;
-		double value_g;
-		double value_b;
-		int    min_c;
-		int    mid_c;
-		int    max_c;
-		int    y;
-		double value;
+		double   value_r;
+		double   value_g;
+		double   value_b;
+		int      min_c;
+		int      mid_c;
+		int      max_c;
+		int      y;
+		double   value;
+		GdkRGBA  color;
 
 		value_r = gth_histogram_get_value (self->priv->histogram, 1, i);
 		value_g = gth_histogram_get_value (self->priv->histogram, 2, i);
@@ -480,14 +479,17 @@ gth_histogram_paint_grid (GthHistogramView *self,
 			  cairo_t          *cr,
 			  GtkAllocation    *allocation)
 {
-	GtkStyle *style;
-	double    grid_step;
-	int       i;
+	GdkRGBA color;
+	double  grid_step;
+	int     i;
 
 	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 
-	style = gtk_widget_get_style (GTK_WIDGET (self));
-	gdk_cairo_set_source_color (cr, &style->dark[gtk_widget_get_state (GTK_WIDGET (self))]);
+	gtk_style_context_get_color (gtk_widget_get_style_context (GTK_WIDGET (self)),
+				     gtk_widget_get_state (GTK_WIDGET (self)),
+				     &color);
+	_gdk_rgba_darker (&color, &color);
+	gdk_cairo_set_source_rgba (cr, &color);
 
 	cairo_set_line_width (cr, 0.5);
 	cairo_rectangle (cr, 0.5, 0.5, allocation->width, allocation->height);
@@ -511,14 +513,16 @@ gth_histogram_paint_selection (GthHistogramView *self,
 			       cairo_t          *cr,
 			       GtkAllocation    *allocation)
 {
-	GtkStyle *style;
-	double    step;
+	GdkRGBA color;
+	double  step;
 
 	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
 	cairo_set_line_width (cr, 0.5);
 
-	style = gtk_widget_get_style (GTK_WIDGET (self));
-	gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_SELECTED]);
+	gtk_style_context_get_background_color (gtk_widget_get_style_context (GTK_WIDGET (self)),
+						GTK_STATE_SELECTED,
+						&color);
+	gdk_cairo_set_source_rgba (cr, &color);
 
 	step = (double) allocation->width / 256.0;
 	cairo_rectangle (cr,
@@ -537,7 +541,7 @@ histogram_view_draw_cb (GtkWidget *widget,
 {
 	GthHistogramView *self = user_data;
 	GtkAllocation     allocation;
-	GtkStyle         *style;
+	GdkRGBA           color;
 
 	if (GTK_WIDGET_CLASS (gth_histogram_view_parent_class)->draw != NULL)
 		GTK_WIDGET_CLASS (gth_histogram_view_parent_class)->draw (widget, cr);
@@ -546,9 +550,10 @@ histogram_view_draw_cb (GtkWidget *widget,
 	allocation.width--;
 	allocation.height--;
 
-	style = gtk_widget_get_style (widget);
-
-	gdk_cairo_set_source_color (cr, &style->base[gtk_widget_get_state (widget)]);
+	gtk_style_context_get_background_color (gtk_widget_get_style_context (widget),
+						gtk_widget_get_state (widget),
+						&color);
+	gdk_cairo_set_source_rgba (cr, &color);
 	cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
 	cairo_fill (cr);
 
diff --git a/gthumb/gth-image-dragger.c b/gthumb/gth-image-dragger.c
index f164db8..f281884 100644
--- a/gthumb/gth-image-dragger.c
+++ b/gthumb/gth-image-dragger.c
@@ -192,23 +192,24 @@ gth_image_dragger_button_press (GthImageViewerTool *self,
 		return FALSE;
 
 	if ((event->button == 1) && ! viewer->dragging) {
-		GdkCursor *cursor;
-		int        retval;
+		GdkCursor     *cursor;
+		GdkGrabStatus  retval;
 
 		cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget), "grabbing");
-		retval = gdk_pointer_grab (gtk_widget_get_window (widget),
-					   FALSE,
-					   (GDK_POINTER_MOTION_MASK
-					    | GDK_POINTER_MOTION_HINT_MASK
-					    | GDK_BUTTON_RELEASE_MASK),
-					   NULL,
-					   cursor,
-					   event->time);
+		retval = gdk_device_grab (event->device,
+					  gtk_widget_get_window (widget),
+					  GDK_OWNERSHIP_WINDOW,
+					  FALSE,
+					  (GDK_POINTER_MOTION_MASK
+					   | GDK_POINTER_MOTION_HINT_MASK
+					   | GDK_BUTTON_RELEASE_MASK),
+					  cursor,
+					  event->time);
 
 		if (cursor != NULL)
 			g_object_unref (cursor);
 
-		if (retval != 0)
+		if (retval != GDK_GRAB_SUCCESS)
 			return FALSE;
 
 		viewer->pressed = TRUE;
@@ -235,7 +236,7 @@ gth_image_dragger_button_release (GthImageViewerTool *self,
 	viewer = dragger->priv->viewer;
 
 	if (viewer->dragging)
-		gdk_pointer_ungrab (event->time);
+		gdk_device_ungrab (event->device, event->time);
 
 	return TRUE;
 }
diff --git a/gthumb/gth-image-navigator.c b/gthumb/gth-image-navigator.c
index ea52175..635a81a 100644
--- a/gthumb/gth-image-navigator.c
+++ b/gthumb/gth-image-navigator.c
@@ -205,8 +205,9 @@ popup_window_event_cb (GtkWidget *widget,
 	switch (event->type) {
 	case GDK_BUTTON_RELEASE:
 		/* Release keyboard focus. */
-		gdk_keyboard_ungrab (GDK_CURRENT_TIME);
-		gtk_grab_remove (nav_popup->popup_win);
+		/*gdk_keyboard_ungrab (GDK_CURRENT_TIME);*/
+		/*gtk_grab_remove (nav_popup->popup_win);*/
+		gdk_device_ungrab (gdk_event_get_device (event), ((GdkEventButton *)event)->time);
 
 		gtk_widget_destroy (nav_popup->popup_win);
 		cairo_surface_destroy (nav_popup->image);
@@ -269,27 +270,29 @@ popup_window_event_cb (GtkWidget *widget,
 
 
 static void
-nav_window_grab_pointer (NavigatorPopup *nav_popup)
+nav_window_grab_pointer (NavigatorPopup *nav_popup,
+			 GdkDevice      *device)
 {
 	GdkCursor *cursor;
 
 	gtk_grab_add (nav_popup->popup_win);
 
-	cursor = gdk_cursor_new (GDK_FLEUR);
-	gdk_pointer_grab (gtk_widget_get_window (nav_popup->popup_win),
-			  TRUE,
-			  (GDK_BUTTON_RELEASE_MASK
-			   | GDK_POINTER_MOTION_HINT_MASK
-			   | GDK_BUTTON_MOTION_MASK
-			   | GDK_EXTENSION_EVENTS_ALL),
-			   gtk_widget_get_window (nav_popup->preview),
-			  cursor,
-			  0);
+	cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (nav_popup->viewer)), GDK_FLEUR);
+	gdk_device_grab (device,
+			 gtk_widget_get_window (nav_popup->popup_win),
+			 GDK_OWNERSHIP_WINDOW,
+			 TRUE,
+			 (GDK_BUTTON_RELEASE_MASK
+			  | GDK_POINTER_MOTION_HINT_MASK
+			  | GDK_BUTTON_MOTION_MASK
+			  | GDK_EXTENSION_EVENTS_ALL),
+			 cursor,
+			 0);
 	g_object_unref (cursor);
 
 	/* Capture keyboard events. */
 
-	gdk_keyboard_grab (gtk_widget_get_window (nav_popup->popup_win), TRUE, GDK_CURRENT_TIME);
+	/*gdk_keyboard_grab (gtk_widget_get_window (nav_popup->popup_win), TRUE, GDK_CURRENT_TIME);*/
         gtk_widget_grab_focus (nav_popup->popup_win);
 }
 
@@ -400,7 +403,7 @@ navigator_event_area_button_press_event_cb (GtkWidget      *widget,
 
 	gtk_widget_show_all (nav_popup->popup_win);
 
-	nav_window_grab_pointer (nav_popup);
+	nav_window_grab_pointer (nav_popup, gdk_event_get_device ((GdkEvent *) event));
 }
 
 
@@ -464,7 +467,8 @@ gth_image_navigator_construct (GthImageNavigator *self,
 	self->priv->viewer_vscr = gtk_vscrollbar_new (vadj);
 
 	self->priv->navigator_event_area = gtk_event_box_new ();
-	gtk_container_add (GTK_CONTAINER (self->priv->navigator_event_area), gtk_image_new_from_icon_name ("image-navigator", GTK_ICON_SIZE_MENU));
+	gtk_container_add (GTK_CONTAINER (self->priv->navigator_event_area),
+			   gtk_image_new_from_icon_name ("image-navigator", GTK_ICON_SIZE_MENU));
 
 	g_signal_connect (G_OBJECT (self->priv->navigator_event_area),
 			  "button_press_event",
diff --git a/gthumb/gth-image-selector.c b/gthumb/gth-image-selector.c
index daa1429..1c9234b 100644
--- a/gthumb/gth-image-selector.c
+++ b/gthumb/gth-image-selector.c
@@ -1379,17 +1379,18 @@ gth_image_selector_motion_notify (GthImageViewerTool *base,
 		|| (abs (self->priv->viewer->drag_y - self->priv->viewer->drag_y_prev) > DRAG_THRESHOLD))
 	    && (self->priv->current_area != NULL))
 	{
-		int retval;
-
-		retval = gdk_pointer_grab (gtk_widget_get_window (widget),
-					   FALSE,
-					   (GDK_POINTER_MOTION_MASK
-					    | GDK_POINTER_MOTION_HINT_MASK
-					    | GDK_BUTTON_RELEASE_MASK),
-					   NULL,
-					   self->priv->current_area->cursor,
-					   event->time);
-		if (retval == 0)
+		GdkGrabStatus retval;
+
+		retval = gdk_device_grab (event->device,
+					  gtk_widget_get_window (widget),
+					  GDK_OWNERSHIP_WINDOW,
+					  FALSE,
+					  (GDK_POINTER_MOTION_MASK
+					   | GDK_POINTER_MOTION_HINT_MASK
+					   | GDK_BUTTON_RELEASE_MASK),
+					  self->priv->current_area->cursor,
+					  event->time);
+		if (retval == GDK_GRAB_SUCCESS)
 			self->priv->viewer->dragging = TRUE;
 
 		return FALSE;
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index 9e14e4c..7e4d628 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -30,6 +30,7 @@
 #include "gth-image-dragger.h"
 #include "gth-image-viewer.h"
 #include "gth-marshal.h"
+#include "gtk-utils.h"
 #include "glib-utils.h"
 #include "pixbuf-utils.h"
 
@@ -326,7 +327,6 @@ gth_image_viewer_realize (GtkWidget *widget)
 	GdkWindowAttr   attributes;
 	int             attributes_mask;
 	GdkWindow      *window;
-	GtkStyle       *style;
 
 	g_return_if_fail (GTH_IS_IMAGE_VIEWER (widget));
 
@@ -360,10 +360,7 @@ gth_image_viewer_realize (GtkWidget *widget)
 	gtk_widget_set_window (widget, window);
 	gdk_window_set_user_data (window, self);
 
-	style = gtk_widget_get_style (widget);
-	style = gtk_style_attach (style, window);
-	gtk_style_set_background (style, window, GTK_STATE_NORMAL);
-	gtk_widget_set_style (widget, style);
+	gtk_style_context_set_background (gtk_widget_get_style_context (widget), window);
 
 	self->priv->cursor = gdk_cursor_new (GDK_LEFT_PTR);
 	self->priv->cursor_void = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_BLANK_CURSOR);
@@ -373,15 +370,16 @@ gth_image_viewer_realize (GtkWidget *widget)
 		gdk_window_set_cursor (window, self->priv->cursor_void);
 
 	if (self->priv->transp_type == GTH_TRANSP_TYPE_NONE) {
-		GdkColor color;
-		guint    base_color;
+		GdkRGBA color;
+		guint   base_color;
 
-		color = style->bg[GTK_STATE_NORMAL];
+		gtk_style_context_get_background_color (gtk_widget_get_style_context (widget),
+							GTK_STATE_NORMAL,
+							&color);
 		base_color = (0xFF000000
 			      | (to_255 (color.red) << 16)
 			      | (to_255 (color.green) << 8)
 			      | (to_255 (color.blue) << 0));
-
 		self->priv->check_color1 = base_color;
 		self->priv->check_color2 = base_color;
 	}
@@ -999,12 +997,12 @@ gth_image_viewer_style_set (GtkWidget *widget,
 	GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
 
 	if (self->priv->transp_type == GTH_TRANSP_TYPE_NONE) {
-		GtkStyle *style;
-		GdkColor  color;
-		guint     base_color;
+		GdkRGBA color;
+		guint   base_color;
 
-		style = gtk_widget_get_style (GTK_WIDGET (self));
-		color = style->bg[GTK_STATE_NORMAL];
+		gtk_style_context_get_background_color (gtk_widget_get_style_context (widget),
+							GTK_STATE_NORMAL,
+							&color);
 		base_color = (0xFF000000
 			      | (to_255 (color.red) << 16)
 			      | (to_255 (color.green) << 8)
@@ -1493,7 +1491,7 @@ halt_animation (GthImageViewer *self)
 
 
 static void
-gth_image_viewer_instance_init (GthImageViewer *self)
+gth_image_viewer_init (GthImageViewer *self)
 {
 	gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
 	gtk_widget_set_double_buffered (GTK_WIDGET (self), TRUE);
@@ -1568,32 +1566,10 @@ gth_image_viewer_instance_init (GthImageViewer *self)
 }
 
 
-GType
-gth_image_viewer_get_type (void)
-{
-	static GType type = 0;
-
-	if (! type) {
-		GTypeInfo type_info = {
-			sizeof (GthImageViewerClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) gth_image_viewer_class_init,
-			NULL,
-			NULL,
-			sizeof (GthImageViewer),
-			0,
-			(GInstanceInitFunc) gth_image_viewer_instance_init
-		};
-
-		type = g_type_register_static (GTK_TYPE_WIDGET,
-					       "GthImageViewer",
-					       &type_info,
-					       0);
-	}
-
-	return type;
-}
+G_DEFINE_TYPE_WITH_CODE (GthImageViewer,
+			 gth_image_viewer,
+			 GTK_TYPE_WIDGET,
+                         G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
 
 
 GtkWidget*
@@ -2180,16 +2156,16 @@ void
 gth_image_viewer_set_transp_type (GthImageViewer *self,
 				  GthTranspType   transp_type)
 {
-	GtkStyle *style;
-	GdkColor  color;
-	guint     base_color;
+	GdkRGBA color;
+	guint   base_color;
 
 	g_return_if_fail (self != NULL);
 
 	self->priv->transp_type = transp_type;
 
-	style = gtk_widget_get_style (GTK_WIDGET (self));
-	color = style->bg[GTK_STATE_NORMAL];
+	gtk_style_context_get_background_color (gtk_widget_get_style_context (GTK_WIDGET (self)),
+						GTK_STATE_NORMAL,
+						&color);
 	base_color = (0xFF000000
 		      | (to_255 (color.red) << 16)
 		      | (to_255 (color.green) << 8)
@@ -2286,7 +2262,7 @@ gth_image_viewer_set_size_request (GthImageViewer *self,
 
 	requisition.width = width;
 	requisition.height = height;
-	gtk_widget_size_request (GTK_WIDGET (self), &requisition);
+	gtk_widget_get_preferred_size (GTK_WIDGET (self), &requisition, NULL);
 
 	gtk_widget_queue_resize (GTK_WIDGET (self));
 }
@@ -2621,16 +2597,15 @@ void
 gth_image_viewer_paint_background (GthImageViewer *self,
 				   cairo_t        *cr)
 {
-	GtkAllocation   allocation;
-	int             gdk_width;
-	int             gdk_height;
-	GtkStyle       *style;
+	GtkAllocation    allocation;
+	int              gdk_width;
+	int              gdk_height;
+	GtkStyleContext *style_context;
 
 	gtk_widget_get_allocation (GTK_WIDGET (self), &allocation);
 	gdk_width = allocation.width - self->priv->frame_border2;
 	gdk_height = allocation.height - self->priv->frame_border2;
-
-	style = gtk_widget_get_style (GTK_WIDGET (self));
+	style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
 
 	if ((self->image_area.x > self->priv->frame_border)
 	    || (self->image_area.y > self->priv->frame_border)
@@ -2639,10 +2614,15 @@ gth_image_viewer_paint_background (GthImageViewer *self,
 	{
 		int rx, ry, rw, rh;
 
-		if (self->priv->black_bg)
+		if (self->priv->black_bg) {
 			cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
-		else
-			gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
+		}
+		else {
+			GdkRGBA color;
+
+			gtk_style_context_get_background_color (style_context, GTK_STATE_NORMAL, &color);
+			gdk_cairo_set_source_rgba (cr, &color);
+		}
 
 		if (gth_image_viewer_get_current_image (self) == NULL) {
 			cairo_rectangle (cr,
@@ -2700,13 +2680,24 @@ gth_image_viewer_paint_background (GthImageViewer *self,
 	if ((self->priv->frame_border > 0)
 	    && (gth_image_viewer_get_current_image (self) != NULL))
 	{
+		GdkRGBA darker_color;
+		GdkRGBA lighter_color;
+
+		gtk_style_context_get_color (style_context,
+					     gtk_widget_get_state (GTK_WIDGET (self)),
+					     &darker_color);
+		_gdk_rgba_darker (&darker_color, &darker_color);
+		gtk_style_context_get_color (style_context,
+					     gtk_widget_get_state (GTK_WIDGET (self)),
+					     &lighter_color);
+		_gdk_rgba_lighter (&lighter_color, &lighter_color);
 
 		/* bottom and right side */
 
 		if (self->priv->black_bg)
 			cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
 		else
-			gdk_cairo_set_source_color (cr, &style->light[GTK_STATE_NORMAL]);
+			gdk_cairo_set_source_rgba (cr, &lighter_color);
 
 		cairo_move_to (cr,
 			       self->image_area.x + self->image_area.width + 0.5,
@@ -2722,7 +2713,7 @@ gth_image_viewer_paint_background (GthImageViewer *self,
 		/* top and left side */
 
 		if (! self->priv->black_bg)
-			gdk_cairo_set_source_color (cr, &style->dark[GTK_STATE_NORMAL]);
+			gdk_cairo_set_source_rgba (cr, &darker_color);
 
 		cairo_move_to (cr,
 			       self->image_area.x - 1 + 0.5,
diff --git a/gthumb/gth-menu-button.c b/gthumb/gth-menu-button.c
index 08d5d56..0e2f774 100644
--- a/gthumb/gth-menu-button.c
+++ b/gthumb/gth-menu-button.c
@@ -151,7 +151,7 @@ menu_position_func (GtkMenu       *menu,
 	GdkScreen             *screen;
 	GtkAllocation          allocation;
 
-	gtk_widget_size_request (GTK_WIDGET (self->priv->menu), &menu_req);
+	gtk_widget_get_preferred_size (GTK_WIDGET (self->priv->menu), &menu_req, NULL);
 
 	direction = gtk_widget_get_direction (widget);
 
diff --git a/gthumb/gth-time-selector.c b/gthumb/gth-time-selector.c
index 7f8c0c8..474aceb 100644
--- a/gthumb/gth-time-selector.c
+++ b/gthumb/gth-time-selector.c
@@ -106,8 +106,9 @@ static void
 hide_calendar_popup (GthTimeSelector *self)
 {
 	gtk_grab_remove (self->priv->calendar_popup);
-	gdk_keyboard_ungrab (GDK_CURRENT_TIME);
-	gdk_pointer_ungrab (GDK_CURRENT_TIME);
+	/*gdk_keyboard_ungrab (GDK_CURRENT_TIME);*/
+	gdk_device_ungrab (gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_window_get_display (gtk_widget_get_window (self->priv->calendar_popup)))),
+			   GDK_CURRENT_TIME);
 	gtk_widget_hide (self->priv->calendar_popup);
 
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->calendar_button), FALSE);
@@ -126,7 +127,7 @@ show_calendar_popup (GthTimeSelector *self)
 	gint                   monitor_num;
 	cairo_rectangle_int_t  monitor;
 
-	gtk_widget_size_request (self->priv->popup_box, &popup_req);
+	gtk_widget_get_preferred_size (self->priv->popup_box, &popup_req, NULL);
 
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->calendar_button), TRUE);
 
@@ -152,18 +153,19 @@ show_calendar_popup (GthTimeSelector *self)
 	gtk_window_move (GTK_WINDOW (self->priv->calendar_popup), x, y);
 	gtk_widget_show (self->priv->calendar_popup);
 
-	gdk_keyboard_grab (gtk_widget_get_window (self->priv->calendar_popup), TRUE, GDK_CURRENT_TIME);
+	/*gdk_keyboard_grab (gtk_widget_get_window (self->priv->calendar_popup), TRUE, GDK_CURRENT_TIME);*/
 	gtk_grab_add (self->priv->calendar_popup);
-	gdk_pointer_grab (gtk_widget_get_window (self->priv->calendar_popup),
-			  TRUE,
-			  (GDK_BUTTON_PRESS_MASK
-			   | GDK_BUTTON_RELEASE_MASK
-			   | GDK_POINTER_MOTION_HINT_MASK
-			   | GDK_BUTTON_MOTION_MASK
-			   | GDK_EXTENSION_EVENTS_ALL),
-			  NULL,
-			  NULL,
-			  GDK_CURRENT_TIME);
+	gdk_device_grab (gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_window_get_display (gtk_widget_get_window (self->priv->calendar_popup)))),
+			 gtk_widget_get_window (self->priv->calendar_popup),
+			 GDK_OWNERSHIP_WINDOW,
+			 TRUE,
+			 (GDK_BUTTON_PRESS_MASK
+			  | GDK_BUTTON_RELEASE_MASK
+			  | GDK_POINTER_MOTION_HINT_MASK
+			  | GDK_BUTTON_MOTION_MASK
+			  | GDK_EXTENSION_EVENTS_ALL),
+			 NULL,
+			 GDK_CURRENT_TIME);
 	gtk_widget_grab_focus (self->priv->calendar);
 }
 
diff --git a/gthumb/gth-toggle-menu-tool-button.c b/gthumb/gth-toggle-menu-tool-button.c
index 22fcf9f..846c04c 100644
--- a/gthumb/gth-toggle-menu-tool-button.c
+++ b/gthumb/gth-toggle-menu-tool-button.c
@@ -465,7 +465,7 @@ menu_position_func (GtkMenu                 *menu,
 	GdkScreen             *screen;
 	GtkAllocation          allocation;
 
-	gtk_widget_size_request (GTK_WIDGET (button->priv->menu), &menu_req);
+	gtk_widget_get_preferred_size (GTK_WIDGET (button->priv->menu), &menu_req, NULL);
 
 	orientation = gtk_tool_item_get_orientation (GTK_TOOL_ITEM (button));
 	direction = gtk_widget_get_direction (widget);
@@ -498,7 +498,7 @@ menu_position_func (GtkMenu                 *menu,
 	}
 	else {
 		gdk_window_get_origin (gtk_button_get_event_window (GTK_BUTTON (widget)), x, y);
-		gtk_widget_size_request (widget, &req);
+		gtk_widget_get_preferred_size (widget, &req, NULL);
 
 		if (direction == GTK_TEXT_DIR_LTR)
 			*x += allocation.width;
diff --git a/gthumb/gth-window.c b/gthumb/gth-window.c
index ae87564..4f8f6a1 100644
--- a/gthumb/gth-window.c
+++ b/gthumb/gth-window.c
@@ -182,6 +182,16 @@ gth_window_real_set_current_page (GthWindow *window,
 
 
 static void
+gth_window_realize (GtkWidget *widget)
+{
+	GTK_WIDGET_CLASS (parent_class)->realize (widget);
+
+	gtk_icon_theme_append_search_path (gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget)),
+					   GTHUMB_ICON_DIR);
+}
+
+
+static void
 gth_window_class_init (GthWindowClass *klass)
 {
 	GObjectClass   *gobject_class;
@@ -196,6 +206,7 @@ gth_window_class_init (GthWindowClass *klass)
 
 	widget_class = (GtkWidgetClass*) klass;
 	widget_class->delete_event = gth_window_delete_event;
+	widget_class->realize = gth_window_realize;
 
 	klass->close = gth_window_real_close;
 	klass->set_current_page = gth_window_real_set_current_page;
diff --git a/gthumb/gtk-utils.c b/gthumb/gtk-utils.c
index 69f319a..adda022 100644
--- a/gthumb/gtk-utils.c
+++ b/gthumb/gtk-utils.c
@@ -993,9 +993,7 @@ _g_launch_command (GtkWidget  *parent,
 		return;
 	}
 
-	launch_context = gdk_app_launch_context_new ();
-	gdk_app_launch_context_set_screen (launch_context, gtk_widget_get_screen (parent));
-
+	launch_context = gdk_display_get_app_launch_context (gtk_widget_get_display (parent));
 	if (! g_app_info_launch (app_info, files, G_APP_LAUNCH_CONTEXT (launch_context), &error)) {
 		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (parent), _("Could not launch the application"), error);
 		g_clear_error (&error);
@@ -1185,3 +1183,40 @@ gimp_scale_entry_new (GtkWidget *parent_box,
 
 	return (GtkAdjustment *) adj;
 }
+
+
+static gboolean
+_gdk_rgba_shade (GdkRGBA *color,
+		 GdkRGBA *result,
+		 gdouble  factor)
+{
+	GtkSymbolicColor *sym_color;
+	GtkSymbolicColor *sym_result;
+	gboolean          retval;
+
+	sym_color = gtk_symbolic_color_new_literal (color);
+	sym_result = gtk_symbolic_color_new_shade (sym_color, factor);
+
+	retval = gtk_symbolic_color_resolve (sym_result, NULL, result);
+
+	gtk_symbolic_color_unref (sym_result);
+	gtk_symbolic_color_unref (sym_color);
+
+	return retval;
+}
+
+
+gboolean
+_gdk_rgba_darker (GdkRGBA *color,
+		  GdkRGBA *result)
+{
+	return _gdk_rgba_shade (color, result, 1.2);
+}
+
+
+gboolean
+_gdk_rgba_lighter (GdkRGBA *color,
+		   GdkRGBA *result)
+{
+	return _gdk_rgba_shade (color, result, 0.8);
+}
diff --git a/gthumb/gtk-utils.h b/gthumb/gtk-utils.h
index 97624a4..dc85bce 100644
--- a/gthumb/gtk-utils.h
+++ b/gthumb/gtk-utils.h
@@ -28,113 +28,108 @@
 
 G_BEGIN_DECLS
 
-GtkWidget * _gtk_button_new_from_stock_with_text (const char *stock_id,
-				      	      	  const char *text);
-GtkWidget*  _gtk_message_dialog_new        (GtkWindow        *parent,
-					    GtkDialogFlags    flags,
-					    const char       *stock_id,
-					    const char       *message,
-					    const char       *secondary_message,
-					    const char       *first_button_text,
-					    ...);
-GtkWidget*
-_gtk_message_dialog_with_checkbutton_new   (GtkWindow        *parent,
-			 		    GtkDialogFlags    flags,
-			 		    const char       *stock_id,
-			 		    const char       *message,
-			 		    const char       *secondary_message,
-			 		    const char       *gconf_key,
-			 		    const char       *check_button_label,
-			 		    const char       *first_button_text,
-			 		    ...);
-GtkWidget*  _gtk_yesno_dialog_new          (GtkWindow        *parent,
-					    GtkDialogFlags    flags,
-					    const char       *message,
-					    const char       *no_button_text,
-					    const char       *yes_button_text);
-GtkWidget*
-_gtk_yesno_dialog_with_checkbutton_new     (GtkWindow        *parent,
-					    GtkDialogFlags    flags,
-					    const char       *message,
-					    const char       *no_button_text,
-					    const char       *yes_button_text,
-					    const char       *check_button_label,
-					    const char       *gconf_key);
-void
-_gtk_error_dialog_from_gerror_run          (GtkWindow        *parent,
-					    const char       *title,
-					    GError           *gerror);
-void
-_gtk_error_dialog_from_gerror_show         (GtkWindow        *parent,
-					    const char       *title,
-					    GError           *gerror);
-void        _gtk_error_dialog_run          (GtkWindow        *parent,
-					    const gchar      *format,
-					    ...) G_GNUC_PRINTF (2, 3);
-void        _gtk_error_dialog_show         (GtkWindow        *parent,
-					    const char       *title,
-					    const char       *format,
-					    ...) G_GNUC_PRINTF (3, 4);
-void        _gtk_info_dialog_run           (GtkWindow        *parent,
-					    const gchar      *format,
-					    ...) G_GNUC_PRINTF (2, 3);
-GdkPixbuf * _g_icon_get_pixbuf             (GIcon            *icon,
-		 			    int               size,
-		 			    GtkIconTheme     *icon_theme);
-GdkPixbuf * get_mime_type_pixbuf           (const char       *mime_type,
-					    int               icon_size,
-					    GtkIconTheme     *icon_theme);
-int         _gtk_icon_get_pixel_size       (GtkWidget        *widget,
-					    GtkIconSize       size);
-void        show_help_dialog               (GtkWindow        *parent,
-					    const char       *section);
-void        _gtk_container_remove_children
-					   (GtkContainer     *container,
-					    gpointer          start_after_this,
-			   		    gpointer          stop_before_this);
-int         _gtk_container_get_pos         (GtkContainer     *container,
-					    GtkWidget        *child);
-guint       _gtk_container_get_n_children  (GtkContainer     *container);
-GtkBuilder *
-	    _gtk_builder_new_from_file     (const char       *filename,
-					    const char       *extension);
-GtkWidget *
-	    _gtk_builder_get_widget        (GtkBuilder       *builder,
-			 		    const char       *name);
-GtkWidget * _gtk_combo_box_new_with_texts  (const char       *first_text,
-					    ...);
-void        _gtk_combo_box_append_texts    (GtkComboBoxText  *combo_box,
-					    const char       *first_text,
-					    ...);
-GtkWidget * _gtk_image_new_from_xpm_data   (char             *xpm_data[]);
-GtkWidget * _gtk_image_new_from_inline     (const guint8     *data);
-void        _gtk_widget_get_screen_size    (GtkWidget        *widget,
-					    int              *width,
-					    int              *height);
-void        _gtk_tree_path_list_free       (GList            *list);
-int         _gtk_paned_get_position2       (GtkPaned         *paned);
-void        _gtk_paned_set_position2       (GtkPaned         *paned,
-					    int               pos);
-void        _g_launch_command              (GtkWidget        *parent,
-					    const char       *command,
-					    const char       *name,
-					    GList            *files);
-void        _gtk_window_resize_to_fit_screen_height
-					   (GtkWidget        *window,
-					    int               default_width);
-void        _gtk_info_bar_clear_action_area (GtkInfoBar      *info_bar);
-
-GdkDragAction _gtk_menu_ask_drag_drop_action (GtkWidget     *widget,
-					      GdkDragAction  actions,
-					      guint32        activate_time);
-GtkAdjustment * gimp_scale_entry_new         (GtkWidget *parent_box,
-		      	      	      	      GtkLabel  *label,
-		      	      	      	      float      value,
-		      	      	      	      float      lower,
-		      	      	      	      float      upper,
-		      	      	      	      float      step_increment,
-		      	      	      	      float      page_increment,
-		      	      	      	      int        digits);
+GtkWidget *     _gtk_button_new_from_stock_with_text       (const char       *stock_id,
+							    const char       *text);
+GtkWidget *     _gtk_message_dialog_new                    (GtkWindow        *parent,
+					    	    	    GtkDialogFlags    flags,
+					    	    	    const char       *stock_id,
+					    	    	    const char       *message,
+					    	    	    const char       *secondary_message,
+					    	    	    const char       *first_button_text,
+					    	    	    ...);
+GtkWidget *     _gtk_message_dialog_with_checkbutton_new   (GtkWindow        *parent,
+			 				    GtkDialogFlags    flags,
+			 				    const char       *stock_id,
+			 				    const char       *message,
+			 				    const char       *secondary_message,
+			 				    const char       *gconf_key,
+			 				    const char       *check_button_label,
+			 				    const char       *first_button_text,
+			 				    ...);
+GtkWidget *     _gtk_yesno_dialog_new                      (GtkWindow        *parent,
+							    GtkDialogFlags    flags,
+							    const char       *message,
+							    const char       *no_button_text,
+							    const char       *yes_button_text);
+GtkWidget *     _gtk_yesno_dialog_with_checkbutton_new     (GtkWindow        *parent,
+							    GtkDialogFlags    flags,
+							    const char       *message,
+							    const char       *no_button_text,
+							    const char       *yes_button_text,
+							    const char       *check_button_label,
+							    const char       *gconf_key);
+void            _gtk_error_dialog_from_gerror_run          (GtkWindow        *parent,
+					    	    	    const char       *title,
+					    	    	    GError           *gerror);
+void            _gtk_error_dialog_from_gerror_show         (GtkWindow        *parent,
+					    	    	    const char       *title,
+					    	    	    GError           *gerror);
+void            _gtk_error_dialog_run                      (GtkWindow        *parent,
+					    	    	    const gchar      *format,
+					    	    	    ...) G_GNUC_PRINTF (2, 3);
+void            _gtk_error_dialog_show                     (GtkWindow        *parent,
+					    	    	    const char       *title,
+					    	    	    const char       *format,
+					    	    	    ...) G_GNUC_PRINTF (3, 4);
+void            _gtk_info_dialog_run                       (GtkWindow        *parent,
+					    	    	    const gchar      *format,
+					    	    	    ...) G_GNUC_PRINTF (2, 3);
+GdkPixbuf *     _g_icon_get_pixbuf                         (GIcon            *icon,
+		 			    	    	    int               size,
+		 			    	    	    GtkIconTheme     *icon_theme);
+GdkPixbuf *     get_mime_type_pixbuf                       (const char       *mime_type,
+					    	    	    int               icon_size,
+					    	    	    GtkIconTheme     *icon_theme);
+int             _gtk_icon_get_pixel_size                   (GtkWidget        *widget,
+					    	    	    GtkIconSize       size);
+void            show_help_dialog                           (GtkWindow        *parent,
+					    	    	    const char       *section);
+void            _gtk_container_remove_children             (GtkContainer     *container,
+					    	    	    gpointer          start_after_this,
+					    	    	    gpointer          stop_before_this);
+int             _gtk_container_get_pos                     (GtkContainer     *container,
+					    	    	    GtkWidget        *child);
+guint           _gtk_container_get_n_children              (GtkContainer     *container);
+GtkBuilder *    _gtk_builder_new_from_file                 (const char       *filename,
+					    	    	    const char       *extension);
+GtkWidget *     _gtk_builder_get_widget                    (GtkBuilder       *builder,
+	 		 		    	    	    const char       *name);
+GtkWidget *     _gtk_combo_box_new_with_texts              (const char       *first_text,
+					    	    	    ...);
+void            _gtk_combo_box_append_texts                (GtkComboBoxText  *combo_box,
+					    	    	    const char       *first_text,
+					    	    	    ...);
+GtkWidget *     _gtk_image_new_from_xpm_data               (char             *xpm_data[]);
+GtkWidget *     _gtk_image_new_from_inline                 (const guint8     *data);
+void            _gtk_widget_get_screen_size                (GtkWidget        *widget,
+					    	    	    int              *width,
+					    	    	    int              *height);
+void            _gtk_tree_path_list_free                   (GList            *list);
+int             _gtk_paned_get_position2                   (GtkPaned         *paned);
+void            _gtk_paned_set_position2                   (GtkPaned         *paned,
+					    	    	    int               pos);
+void            _g_launch_command                          (GtkWidget        *parent,
+					    	    	    const char       *command,
+					    	    	    const char       *name,
+					    	    	    GList            *files);
+void            _gtk_window_resize_to_fit_screen_height    (GtkWidget        *window,
+					    	    	    int               default_width);
+void            _gtk_info_bar_clear_action_area            (GtkInfoBar       *info_bar);
+GdkDragAction   _gtk_menu_ask_drag_drop_action             (GtkWidget        *widget,
+					      	      	    GdkDragAction     actions,
+					      	      	    guint32           activate_time);
+GtkAdjustment * gimp_scale_entry_new        		   (GtkWidget        *parent_box,
+		      	      	      	      	      	    GtkLabel         *label,
+		      	      	      	      	      	    float             value,
+		      	      	      	      	      	    float             lower,
+		      	      	      	      	      	    float             upper,
+		      	      	      	      	      	    float             step_increment,
+		      	      	      	      	      	    float             page_increment,
+		      	      	      	      	      	    int               digits);
+gboolean        _gdk_rgba_darker                           (GdkRGBA          *color,
+		 					    GdkRGBA          *result);
+gboolean        _gdk_rgba_lighter                          (GdkRGBA          *color,
+							    GdkRGBA          *result);
 
 G_END_DECLS
 



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