[gthumb] Fixed errors when the GSEAL macro is enabled



commit df10d218fd483a5b8da8951667afc41f7c9f990e
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Jul 23 18:33:19 2010 +0200

    Fixed errors when the GSEAL macro is enabled

 configure.ac                                       |   14 +-
 extensions/facebook/facebook-authentication.c      |    4 +-
 extensions/file_manager/actions.c                  |   13 +-
 extensions/file_manager/callbacks.c                |   14 +-
 extensions/file_viewer/gth-file-viewer-page.c      |    2 +-
 extensions/flicker/flickr-authentication.c         |    4 +-
 extensions/gstreamer_tools/gth-media-viewer-page.c |   12 +-
 extensions/image_print/gth-image-print-job.c       |    6 +-
 extensions/image_viewer/gth-image-viewer-page.c    |    4 +-
 extensions/oauth/oauth-authentication.c            |    4 +-
 extensions/slideshow/gth-slideshow.c               |    2 +-
 extensions/webalbums/dlg-web-exporter.c            |    2 +-
 gthumb/gth-browser.c                               |   15 +-
 gthumb/gth-cell-renderer-thumbnail.c               |   49 ++--
 gthumb/gth-dumb-notebook.c                         |   36 ++--
 gthumb/gth-embedded-dialog.c                       |    4 +-
 gthumb/gth-empty-list.c                            |   87 +++---
 gthumb/gth-file-tool.c                             |    2 +-
 gthumb/gth-filterbar.c                             |    2 +-
 gthumb/gth-histogram-view.c                        |   76 +++---
 gthumb/gth-image-dragger.c                         |   17 +-
 gthumb/gth-image-navigator.c                       |   20 +-
 gthumb/gth-image-selector.c                        |   35 ++-
 gthumb/gth-image-viewer.c                          |  304 +++++++++++---------
 gthumb/gth-info-bar.c                              |    4 +-
 gthumb/gth-location-chooser.c                      |    2 +-
 gthumb/gth-tags-entry.c                            |    4 +-
 gthumb/gth-test-selector.c                         |    2 +-
 gthumb/gth-time-selector.c                         |    8 +-
 gthumb/gth-toggle-menu-tool-button.c               |   52 ++--
 gthumb/gtk-utils.c                                 |   28 +-
 31 files changed, 464 insertions(+), 364 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5bbea96..58bb3b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ GNOME_CXX_WARNINGS
 GTHUMB_EXTENSION_RULES
 
 GLIB_REQUIRED=2.16.0
-GTK_REQUIRED=2.18.0
+GTK_REQUIRED=2.21.0
 GCONF_REQUIRED=2.6.0
 EXIV2_REQUIRED=0.18
 CLUTTER_REQUIRED=1.0.0
@@ -85,6 +85,18 @@ if test x$ENABLE_DEBUG = xyes; then
 	CFLAGS+=" -g -O0"
 fi
 
+AC_ARG_ENABLE(gseal,
+	      AS_HELP_STRING([--enable-gseal], [check use of direct access to object fields]),
+	      [case "${enableval}" in
+	      yes) ENABLE_GSEAL=yes ;;
+	      no) ENABLE_GSEAL=no ;;
+	      *) AC_MSG_ERROR([bad value ${enableval} for --enable-gseal]) ;;
+	      esac],
+	      [ENABLE_GSEAL=no])
+if test x$ENABLE_GSEAL = xyes; then
+	CFLAGS+=" -DGSEAL_ENABLE"
+fi
+
 AC_ARG_ENABLE(run_in_place,
 	      AS_HELP_STRING([--enable-run-in-place],[load ui data and extensions from the source tree]),
 	      [case "${enableval}" in
diff --git a/extensions/facebook/facebook-authentication.c b/extensions/facebook/facebook-authentication.c
index 6bf77ce..6abf720 100644
--- a/extensions/facebook/facebook-authentication.c
+++ b/extensions/facebook/facebook-authentication.c
@@ -501,7 +501,7 @@ complete_authorization (FacebookAuthentication *self)
 			  G_CALLBACK (complete_authorization_messagedialog_response_cb),
 			  self);
 
-	if (GTK_WIDGET_VISIBLE (self->priv->dialog))
+	if (gtk_widget_get_visible (self->priv->dialog))
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->dialog));
 	else
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
@@ -568,7 +568,7 @@ ask_authorization (FacebookAuthentication *self)
 
 	builder = _gtk_builder_new_from_file ("facebook-ask-authorization.ui", "facebook");
 	dialog = _gtk_builder_get_widget (builder, "ask_authorization_messagedialog");
-	if (GTK_WIDGET_VISIBLE (self->priv->dialog))
+	if (gtk_widget_get_visible (self->priv->dialog))
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->dialog));
 	else
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
diff --git a/extensions/file_manager/actions.c b/extensions/file_manager/actions.c
index 0659edc..ee5a48c 100644
--- a/extensions/file_manager/actions.c
+++ b/extensions/file_manager/actions.c
@@ -143,11 +143,16 @@ clipboard_get_cb (GtkClipboard     *clipboard,
 		  gpointer          user_data_or_owner)
 {
 	ClipboardData *clipboard_data = user_data_or_owner;
+	GdkAtom       *targets;
+	int            n_targets;
 
-	if (gtk_targets_include_uri (&selection_data->target, 1)) {
+	if (! gtk_selection_data_get_targets (selection_data, &targets, &n_targets))
+		return;
+
+	if (gtk_targets_include_uri (targets, n_targets)) {
 		gtk_selection_data_set_uris (selection_data, clipboard_data->uris);
 	}
-	else if (gtk_targets_include_text (&selection_data->target, 1)) {
+	else if (gtk_targets_include_text (targets, n_targets)) {
 		char  *str;
 		gsize  len;
 
@@ -155,7 +160,7 @@ clipboard_get_cb (GtkClipboard     *clipboard,
 		gtk_selection_data_set_text (selection_data, str, len);
 		g_free (str);
 	}
-	else if (selection_data->target == GNOME_COPIED_FILES) {
+	else if (gtk_selection_data_get_target (selection_data) == GNOME_COPIED_FILES) {
 		char  *str;
 		gsize  len;
 
@@ -163,6 +168,8 @@ clipboard_get_cb (GtkClipboard     *clipboard,
 		gtk_selection_data_set (selection_data, GNOME_COPIED_FILES, 8, (guchar *) str, len);
 		g_free (str);
 	}
+
+	g_free (targets);
 }
 
 
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 98e5525..037a240 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -258,8 +258,8 @@ gth_file_list_drag_data_received (GtkWidget        *file_view,
 
 	g_signal_stop_emission_by_name (file_view, "drag-data-received");
 
-	if ((context->suggested_action == GDK_ACTION_COPY)
-	    || (context->suggested_action == GDK_ACTION_MOVE))
+	if ((gdk_drag_context_get_suggested_action (context) == GDK_ACTION_COPY)
+	    || (gdk_drag_context_get_suggested_action (context) == GDK_ACTION_MOVE))
 	{
 		success = TRUE;
 	}
@@ -288,7 +288,7 @@ gth_file_list_drag_data_received (GtkWidget        *file_view,
 			gboolean       move;
 
 			file_source = gth_browser_get_location_source (browser);
-			move = context->suggested_action == GDK_ACTION_MOVE;
+			move = gdk_drag_context_get_suggested_action (context) == GDK_ACTION_MOVE;
 			if (move && ! gth_file_source_can_cut (file_source)) {
 				GtkWidget *dialog;
 				int        response;
@@ -393,13 +393,17 @@ gth_file_list_drag_motion (GtkWidget      *file_view,
 	}
 
 	if ((gtk_drag_get_source_widget (context) == file_view) && gth_file_source_is_reorderable (gth_browser_get_location_source (browser))) {
+		GtkAllocation allocation;
+
 		gdk_drag_status (context, GDK_ACTION_MOVE, time);
 		gth_file_view_set_drag_dest_pos (GTH_FILE_VIEW (file_view), context, x, y, time, &data->drop_pos);
 
+		gtk_widget_get_allocation (file_view, &allocation);
+
 		if (y < 10)
 			data->scroll_diff = - (10 - y);
-		else if (y > file_view->allocation.height - 10)
-			data->scroll_diff = (10 - (file_view->allocation.height - y));
+		else if (y > allocation.height - 10)
+			data->scroll_diff = (10 - (allocation.height - y));
 		else
 			data->scroll_diff = 0;
 
diff --git a/extensions/file_viewer/gth-file-viewer-page.c b/extensions/file_viewer/gth-file-viewer-page.c
index cc7f7ce..b032707 100644
--- a/extensions/file_viewer/gth-file-viewer-page.c
+++ b/extensions/file_viewer/gth-file-viewer-page.c
@@ -240,7 +240,7 @@ gth_file_viewer_page_real_focus (GthViewerPage *base)
 	GtkWidget *widget;
 
 	widget = GTH_FILE_VIEWER_PAGE (base)->priv->label;
-	if (GTK_WIDGET_REALIZED (widget) && GTK_WIDGET_MAPPED (widget))
+	if (gtk_widget_get_realized (widget) && gtk_widget_get_mapped (widget))
 		gtk_widget_grab_focus (widget);
 }
 
diff --git a/extensions/flicker/flickr-authentication.c b/extensions/flicker/flickr-authentication.c
index ec6f78e..c8eed43 100644
--- a/extensions/flicker/flickr-authentication.c
+++ b/extensions/flicker/flickr-authentication.c
@@ -440,7 +440,7 @@ complete_authorization (FlickrAuthentication *self)
 			  G_CALLBACK (complete_authorization_messagedialog_response_cb),
 			  self);
 
-	if (GTK_WIDGET_VISIBLE (self->priv->dialog))
+	if (gtk_widget_get_visible (self->priv->dialog))
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->dialog));
 	else
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
@@ -517,7 +517,7 @@ ask_authorization (FlickrAuthentication *self)
 			  self);
 
 	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-	if (GTK_WIDGET_VISIBLE (self->priv->dialog))
+	if (gtk_widget_get_visible (self->priv->dialog))
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->dialog));
 	else
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
diff --git a/extensions/gstreamer_tools/gth-media-viewer-page.c b/extensions/gstreamer_tools/gth-media-viewer-page.c
index f4139e6..bcf0d7c 100644
--- a/extensions/gstreamer_tools/gth-media-viewer-page.c
+++ b/extensions/gstreamer_tools/gth-media-viewer-page.c
@@ -588,7 +588,7 @@ gth_media_viewer_page_real_activate (GthViewerPage *base,
 						  | GDK_POINTER_MOTION_MASK
 						  | GDK_POINTER_MOTION_HINT_MASK
 						  | GDK_BUTTON_MOTION_MASK));
-	GTK_WIDGET_SET_FLAGS (self->priv->area, GTK_CAN_FOCUS);
+	gtk_widget_set_can_focus (self->priv->area, TRUE);
 	gtk_widget_show (self->priv->area);
 	gtk_box_pack_start (GTK_BOX (self->priv->area_box), self->priv->area, TRUE, TRUE, 0);
 
@@ -991,7 +991,7 @@ gth_media_viewer_page_real_focus (GthViewerPage *base)
 	GtkWidget *widget;
 
 	widget = GTH_MEDIA_VIEWER_PAGE (base)->priv->area;
-	if (GTK_WIDGET_REALIZED (widget) && GTK_WIDGET_MAPPED (widget))
+	if (gtk_widget_get_realized (widget) && gtk_widget_get_mapped (widget))
 		gtk_widget_grab_focus (widget);
 }
 
@@ -1002,6 +1002,7 @@ gth_media_viewer_page_real_fullscreen (GthViewerPage *base,
 {
 	GthMediaViewerPage *self = (GthMediaViewerPage*) base;
 	GdkScreen          *screen;
+	GtkAllocation       allocation;
 
 	if (! active) {
 		g_object_ref (self->priv->mediabar);
@@ -1033,7 +1034,8 @@ gth_media_viewer_page_real_fullscreen (GthViewerPage *base,
 
 	gtk_widget_realize (self->priv->mediabar);
 	gtk_window_set_gravity (GTK_WINDOW (self->priv->fullscreen_toolbar), GDK_GRAVITY_SOUTH_EAST);
-	gtk_window_move (GTK_WINDOW (self->priv->fullscreen_toolbar), 0, gdk_screen_get_height (screen) - self->priv->mediabar->allocation.height);
+	gtk_widget_get_allocation (self->priv->mediabar, &allocation);
+	gtk_window_move (GTK_WINDOW (self->priv->fullscreen_toolbar), 0, gdk_screen_get_height (screen) - allocation.height);
 
 	gth_browser_register_fullscreen_control (self->priv->browser, self->priv->fullscreen_toolbar);
 }
@@ -1046,10 +1048,10 @@ gth_media_viewer_page_real_show_pointer (GthViewerPage *base,
 	GthMediaViewerPage *self = (GthMediaViewerPage*) base;
 
 	if (self->priv->fullscreen_toolbar != NULL) {
-		if (show && ! GTK_WIDGET_VISIBLE (self->priv->fullscreen_toolbar)) {
+		if (show && ! gtk_widget_get_visible (self->priv->fullscreen_toolbar)) {
 			gtk_widget_show (self->priv->fullscreen_toolbar);
 		}
-		else if (! show && GTK_WIDGET_VISIBLE (self->priv->fullscreen_toolbar)) {
+		else if (! show && gtk_widget_get_visible (self->priv->fullscreen_toolbar)) {
 			gtk_widget_hide (self->priv->fullscreen_toolbar);
 		}
 	}
diff --git a/extensions/image_print/gth-image-print-job.c b/extensions/image_print/gth-image-print-job.c
index c724183..a242fcb 100644
--- a/extensions/image_print/gth-image-print-job.c
+++ b/extensions/image_print/gth-image-print-job.c
@@ -853,17 +853,19 @@ preview_expose_event_cb (GtkWidget      *widget,
 {
 	GthImagePrintJob *self = user_data;
 	cairo_t          *cr;
+	GtkAllocation     allocation;
 	PangoLayout      *pango_layout;
 
 	g_return_if_fail (GTH_IS_IMAGE_PRINT_JOB (self));
 	g_return_if_fail ((self->priv->page_setup != NULL) && GTK_IS_PAGE_SETUP (self->priv->page_setup));
 
-	cr = gdk_cairo_create (widget->window);
+	cr = gdk_cairo_create (gtk_widget_get_window (widget));
 
 	/* paint the paper */
 
 	cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
-	cairo_rectangle (cr, 0, 0, widget->allocation.width - 1, widget->allocation.height - 1);
+	gtk_widget_get_allocation (widget, &allocation);
+	cairo_rectangle (cr, 0, 0, allocation.width - 1, allocation.height - 1);
 	cairo_fill_preserve (cr);
 	cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
 	cairo_stroke (cr);
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index f944861..c8757cf 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -640,7 +640,7 @@ gth_image_viewer_page_real_focus (GthViewerPage *base)
 	GtkWidget *widget;
 
 	widget = GTH_IMAGE_VIEWER_PAGE (base)->priv->viewer;
-	if (GTK_WIDGET_REALIZED (widget) && GTK_WIDGET_MAPPED (widget))
+	if (gtk_widget_get_realized (widget) && gtk_widget_get_mapped (widget))
 		gtk_widget_grab_focus (widget);
 }
 
@@ -1118,7 +1118,7 @@ add_non_content_height (GthImageViewerPage *self,
 {
 	int height = 0;
 
-	if ((non_content != NULL) && GTK_WIDGET_VISIBLE (non_content)) {
+	if ((non_content != NULL) && gtk_widget_get_visible (non_content)) {
 		GtkAllocation allocation;
 		gtk_widget_get_allocation (non_content, &allocation);
 		height = allocation.height;
diff --git a/extensions/oauth/oauth-authentication.c b/extensions/oauth/oauth-authentication.c
index 80f8611..0e2498a 100644
--- a/extensions/oauth/oauth-authentication.c
+++ b/extensions/oauth/oauth-authentication.c
@@ -452,7 +452,7 @@ complete_authorization (OAuthAuthentication *self)
 			  G_CALLBACK (complete_authorization_messagedialog_response_cb),
 			  self);
 
-	if (GTK_WIDGET_VISIBLE (self->priv->dialog))
+	if (gtk_widget_get_visible (self->priv->dialog))
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->dialog));
 	else
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
@@ -529,7 +529,7 @@ ask_authorization (OAuthAuthentication *self)
 			  self);
 
 	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-	if (GTK_WIDGET_VISIBLE (self->priv->dialog))
+	if (gtk_widget_get_visible (self->priv->dialog))
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->dialog));
 	else
 		gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser));
diff --git a/extensions/slideshow/gth-slideshow.c b/extensions/slideshow/gth-slideshow.c
index 1087566..0703d43 100644
--- a/extensions/slideshow/gth-slideshow.c
+++ b/extensions/slideshow/gth-slideshow.c
@@ -89,7 +89,7 @@ _gth_slideshow_close (GthSlideshow *self)
 	GthBrowser *browser;
 
 	browser = self->priv->browser;
-	close_browser = ! GTK_WIDGET_VISIBLE (browser);
+	close_browser = ! gtk_widget_get_visible (GTK_WIDGET (browser));
 	gtk_widget_destroy (GTK_WIDGET (self));
 
 	if (close_browser)
diff --git a/extensions/webalbums/dlg-web-exporter.c b/extensions/webalbums/dlg-web-exporter.c
index dac625e..cbb25bf 100644
--- a/extensions/webalbums/dlg-web-exporter.c
+++ b/extensions/webalbums/dlg-web-exporter.c
@@ -252,7 +252,7 @@ footer_entry_icon_press_cb (GtkEntry             *entry,
 	else
 		help_box = GET_WIDGET ("image_footer_help_table");
 
-	if (GTK_WIDGET_VISIBLE (help_box))
+	if (gtk_widget_get_visible (help_box))
 		gtk_widget_hide (help_box);
 	else
 		gtk_widget_show (help_box);
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 916c932..89d8e3e 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -1960,7 +1960,7 @@ _gth_browser_close_final_step (gpointer user_data)
 
 	/* Save visualization options only if the window is not maximized. */
 
-	if (GTK_WIDGET_REALIZED (browser)) {
+	if (gtk_widget_get_realized (GTK_WIDGET (browser))) {
 		GdkWindowState state;
 		gboolean       maximized;
 		GtkAllocation  allocation;
@@ -1992,7 +1992,7 @@ _gth_browser_close_final_step (gpointer user_data)
 
 	gth_hook_invoke ("gth-browser-close", browser);
 
-	if (GTK_WIDGET_REALIZED (browser) && last_window) {
+	if (gtk_widget_get_realized (GTK_WIDGET (browser)) && last_window) {
 		if (eel_gconf_get_boolean (PREF_GO_TO_LAST_LOCATION, TRUE)
 		    && (browser->priv->location != NULL))
 		{
@@ -2397,7 +2397,7 @@ folder_tree_drag_data_received (GtkWidget        *tree_view,
 	char          **uris;
 	GList          *file_list;
 
-	suggested_action = context->suggested_action; /* gdk_drag_context_get_suggested_action (context) */
+	suggested_action = gdk_drag_context_get_suggested_action (context);
 
 	if ((suggested_action == GDK_ACTION_COPY) || (suggested_action == GDK_ACTION_MOVE))
 		success = TRUE;
@@ -5080,13 +5080,16 @@ file_metadata_ready_cb (GList    *files,
 
 	g_file_info_copy_into (file_data->info, browser->priv->current_file->info);
 
-	if (! GTK_WIDGET_VISIBLE (browser->priv->file_properties)) {
-		GtkTreePath *path;
+	if (! gtk_widget_get_visible (browser->priv->file_properties)) {
+		GtkAllocation allocation;
 
-		gtk_paned_set_position (GTK_PANED (browser->priv->browser_sidebar), browser->priv->browser_sidebar->allocation.height / 2);
+		gtk_widget_get_allocation (browser->priv->browser_sidebar, &allocation);
+		gtk_paned_set_position (GTK_PANED (browser->priv->browser_sidebar), allocation.height / 2);
 		gtk_widget_show (browser->priv->file_properties);
 
 		if (browser->priv->location != NULL) {
+			GtkTreePath *path;
+
 			path = gth_folder_tree_get_path (GTH_FOLDER_TREE (browser->priv->folder_tree), browser->priv->location->file);
 			if (path != NULL) {
 				gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (browser->priv->folder_tree), path, NULL, TRUE, .25, .0);
diff --git a/gthumb/gth-cell-renderer-thumbnail.c b/gthumb/gth-cell-renderer-thumbnail.c
index a0b99d6..ba0e66b 100644
--- a/gthumb/gth-cell-renderer-thumbnail.c
+++ b/gthumb/gth-cell-renderer-thumbnail.c
@@ -167,10 +167,12 @@ gth_cell_renderer_thumbnail_get_size (GtkCellRenderer *cell,
 				      int             *height)
 {
 	GthCellRendererThumbnail *self;
-	int image_width;
-	int image_height;
-	int calc_width;
-  	int calc_height;
+	int   image_width;
+	int   image_height;
+	int   calc_width;
+  	int   calc_height;
+  	int   xpad;
+  	int   ypad;
 
   	self = GTH_CELL_RENDERER_THUMBNAIL (cell);
 
@@ -183,13 +185,15 @@ gth_cell_renderer_thumbnail_get_size (GtkCellRenderer *cell,
   		image_height = 0;
   	}
 
+  	gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+
 	if (self->priv->is_icon || self->priv->fixed_size || (self->priv->thumbnail == NULL) || ((image_width < self->priv->size) && (image_height < self->priv->size))) {
-		calc_width  = (int) (cell->xpad * 2) + (THUMBNAIL_X_BORDER * 2) + self->priv->size;
-		calc_height = (int) (cell->ypad * 2) + (THUMBNAIL_Y_BORDER * 2) + self->priv->size;
+		calc_width  = (int) (xpad * 2) + (THUMBNAIL_X_BORDER * 2) + self->priv->size;
+		calc_height = (int) (ypad * 2) + (THUMBNAIL_Y_BORDER * 2) + self->priv->size;
 	}
 	else {
-		calc_width  = (int) (cell->xpad * 2) + (THUMBNAIL_X_BORDER * 2) + image_width;
-		calc_height = (int) (cell->ypad * 2) + (THUMBNAIL_Y_BORDER * 2) + image_height;
+		calc_width  = (int) (xpad * 2) + (THUMBNAIL_X_BORDER * 2) + image_width;
+		calc_height = (int) (ypad * 2) + (THUMBNAIL_Y_BORDER * 2) + image_height;
 	}
 
 	if (width != NULL)
@@ -199,13 +203,18 @@ gth_cell_renderer_thumbnail_get_size (GtkCellRenderer *cell,
 		*height = calc_height;
 
 	if (cell_area != NULL) {
+	  	float xalign;
+	  	float yalign;
+
+		gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
+
 		if (x_offset != NULL) {
-			*x_offset = cell->xalign * (cell_area->width - calc_width);
+			*x_offset = xalign * (cell_area->width - calc_width);
 			*x_offset = MAX (*x_offset, 0);
 		}
 
 		if (y_offset != NULL) {
-      			*y_offset = cell->yalign * (cell_area->height - calc_height);
+      			*y_offset = yalign * (cell_area->height - calc_height);
       			*y_offset = MAX (*y_offset, 0);
     		}
   	}
@@ -306,6 +315,8 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer      *cell,
 	GdkRectangle              image_rect;
 	cairo_t                  *cr;
 	GdkPixbuf                *pixbuf;
+	int                       xpad;
+	int                       ypad;
 	GdkPixbuf                *colorized = NULL;
 	int                       border;
 
@@ -321,10 +332,12 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer      *cell,
 	if (pixbuf == NULL)
 		return;
 
-	thumb_rect.x += cell_area->x + cell->xpad;
-  	thumb_rect.y += cell_area->y + cell->ypad;
-  	thumb_rect.width  -= cell->xpad * 2;
-  	thumb_rect.height -= cell->ypad * 2;
+	gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
+
+	thumb_rect.x += cell_area->x + xpad;
+  	thumb_rect.y += cell_area->y + ypad;
+  	thumb_rect.width  -= xpad * 2;
+  	thumb_rect.height -= ypad * 2;
 
 	if (! gdk_rectangle_intersect (cell_area, &thumb_rect, &draw_rect)
 	    || ! gdk_rectangle_intersect (expose_area, &thumb_rect, &draw_rect))
@@ -342,19 +355,21 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer      *cell,
 	style = gtk_widget_get_style (widget);
 
   	if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
-  		state = GTK_WIDGET_HAS_FOCUS (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
+  		state = gtk_widget_has_focus (widget) ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE;
   	else
   		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;
 
 		/* 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, &widget->style->bg[state]);
+			gdk_cairo_set_source_color (cr, &style->bg[state]);
 		else
-			gdk_cairo_set_source_color (cr, &widget->style->base[state]);
+			gdk_cairo_set_source_color (cr, &style->base[state]);
 
 		_cairo_draw_rounded_box (cr, thumb_rect.x, thumb_rect.y, thumb_rect.width, thumb_rect.height, 7);
 		cairo_close_path (cr);
diff --git a/gthumb/gth-dumb-notebook.c b/gthumb/gth-dumb-notebook.c
index b9d9619..e06a3d1 100644
--- a/gthumb/gth-dumb-notebook.c
+++ b/gthumb/gth-dumb-notebook.c
@@ -57,26 +57,25 @@ gth_dumb_notebook_size_request (GtkWidget      *widget,
 	GthDumbNotebook *dumb_notebook = GTH_DUMB_NOTEBOOK (widget);
 	GList           *scan;
 	GtkRequisition   child_requisition;
+	int              border_width;
 	
-	widget->requisition.width = 0;
-  	widget->requisition.height = 0;
+	requisition->width = 0;
+  	requisition->height = 0;
   
 	for (scan = dumb_notebook->priv->children; scan; scan = scan->next) {
 		GtkWidget *child = scan->data;
 		
-		if (! GTK_WIDGET_VISIBLE (child))
+		if (! gtk_widget_get_visible (child))
                         continue;
                         
 		gtk_widget_size_request (child, &child_requisition);
-          
-		widget->requisition.width = MAX (widget->requisition.width,
-						 child_requisition.width);
-		widget->requisition.height = MAX (widget->requisition.height,
-						  child_requisition.height);
+		requisition->width = MAX (requisition->width, child_requisition.width);
+		requisition->height = MAX (requisition->height, child_requisition.height);
 	}
 	
-	widget->requisition.width += GTK_CONTAINER (widget)->border_width * 2;
-  	widget->requisition.height += GTK_CONTAINER (widget)->border_width * 2;
+	border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+	requisition->width += border_width * 2;
+  	requisition->height += border_width * 2;
 }
 
 
@@ -85,23 +84,24 @@ gth_dumb_notebook_size_allocate (GtkWidget     *widget,
 				 GtkAllocation *allocation)
 {
 	GthDumbNotebook *dumb_notebook = GTH_DUMB_NOTEBOOK (widget);
-	GList           *scan;
-	int              border_width = GTK_CONTAINER (widget)->border_width;
+	int              border_width;
 	GtkAllocation    child_allocation;
+	GList           *scan;
 	
-	widget->allocation = *allocation;
-
-	child_allocation.x = widget->allocation.x + border_width;
-	child_allocation.y = widget->allocation.y + border_width;
+	border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+	child_allocation.x = allocation->x + border_width;
+	child_allocation.y = allocation->y + border_width;
 	child_allocation.width = MAX (1, allocation->width - border_width * 2);
 	child_allocation.height = MAX (1, allocation->height - border_width * 2);
 
 	for (scan = dumb_notebook->priv->children; scan; scan = scan->next) {
 		GtkWidget *child = scan->data;
 		
-		if (GTK_WIDGET_VISIBLE (child))
+		if (gtk_widget_get_visible (child))
 			gtk_widget_size_allocate (child, &child_allocation);
 	}
+
+	gtk_widget_set_allocation (widget, allocation);
 }
 
 
@@ -202,7 +202,7 @@ gth_dumb_notebook_class_init (GthDumbNotebookClass *klass)
 static void
 gth_dumb_notebook_init (GthDumbNotebook *notebook) 
 {
-	GTK_WIDGET_SET_FLAGS (notebook, GTK_NO_WINDOW);
+	gtk_widget_set_has_window (GTK_WIDGET (notebook), FALSE);
 	
 	notebook->priv = g_new0 (GthDumbNotebookPrivate, 1);
 	notebook->priv->n_children = 0;	
diff --git a/gthumb/gth-embedded-dialog.c b/gthumb/gth-embedded-dialog.c
index 184e9bc..b94f9c4 100644
--- a/gthumb/gth-embedded-dialog.c
+++ b/gthumb/gth-embedded-dialog.c
@@ -122,12 +122,12 @@ gth_embedded_dialog_construct (GthEmbeddedDialog *self)
 	gtk_label_set_ellipsize (GTK_LABEL (primary_label), PANGO_ELLIPSIZE_MIDDLE);
 	gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
 	gtk_misc_set_padding (GTK_MISC (primary_label), 0, 6);
-	GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+	gtk_widget_set_can_focus (primary_label, TRUE);
 	gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
 	
 	self->priv->secondary_text_label = secondary_label = gtk_label_new (NULL);
 	gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
-	GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+	gtk_widget_set_can_focus (secondary_label, TRUE);
 	gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
 	gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
 	gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
diff --git a/gthumb/gth-empty-list.c b/gthumb/gth-empty-list.c
index 9686b43..f01e6a3 100644
--- a/gthumb/gth-empty-list.c
+++ b/gthumb/gth-empty-list.c
@@ -100,20 +100,26 @@ static void
 gth_empty_list_realize (GtkWidget *widget)
 {
 	GthEmptyList  *self;
+	GtkAllocation  allocation;
 	GdkWindowAttr  attributes;
 	int            attributes_mask;
+	GdkWindow     *window;
+	GtkStyle      *style;
 
 	g_return_if_fail (GTH_IS_EMPTY_LIST (widget));
+	self = (GthEmptyList*) widget;
 
-	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+	gtk_widget_set_realized (widget, TRUE);
 
 	/**/
 
+	gtk_widget_get_allocation (widget, &allocation);
+
 	attributes.window_type = GDK_WINDOW_CHILD;
-	attributes.x           = widget->allocation.x;
-	attributes.y           = widget->allocation.y;
-	attributes.width       = widget->allocation.width;
-	attributes.height      = widget->allocation.height;
+	attributes.x           = allocation.x;
+	attributes.y           = allocation.y;
+	attributes.width       = allocation.width;
+	attributes.height      = allocation.height;
 	attributes.wclass      = GDK_INPUT_OUTPUT;
 	attributes.visual      = gtk_widget_get_visual (widget);
 	attributes.colormap    = gtk_widget_get_colormap (widget);
@@ -122,19 +128,18 @@ gth_empty_list_realize (GtkWidget *widget)
 				  | GDK_WA_Y
 				  | GDK_WA_VISUAL
 				  | GDK_WA_COLORMAP);
-	widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
-					 &attributes,
-					 attributes_mask);
-	gdk_window_set_user_data (widget->window, widget);
+	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);
 
 	/**/
 
-	self = (GthEmptyList*) widget;
-
 	attributes.x = 0;
 	attributes.y = 0;
-	attributes.width = widget->allocation.width;
-	attributes.height = widget->allocation.height;
+	attributes.width = allocation.width;
+	attributes.height = allocation.height;
 	attributes.event_mask = (GDK_EXPOSURE_MASK
 				 | GDK_SCROLL_MASK
 				 | GDK_POINTER_MOTION_MASK
@@ -144,16 +149,18 @@ gth_empty_list_realize (GtkWidget *widget)
 				 | GDK_BUTTON_RELEASE_MASK
 				 | gtk_widget_get_events (widget));
 
-	self->priv->bin_window = gdk_window_new (widget->window,
+	self->priv->bin_window = gdk_window_new (window,
 						 &attributes,
 						 attributes_mask);
 	gdk_window_set_user_data (self->priv->bin_window, widget);
 
 	/* Style */
 
-	widget->style = gtk_style_attach (widget->style, widget->window);
-	gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
-	gdk_window_set_background (self->priv->bin_window, &widget->style->base[widget->state]);
+	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)]);
 	
 	/* 'No Image' message Layout */
 
@@ -162,7 +169,7 @@ 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, widget->style->font_desc);
+	pango_layout_set_font_description (self->priv->layout, style->font_desc);
 	pango_layout_set_alignment (self->priv->layout, PANGO_ALIGN_CENTER);
 }
 
@@ -192,24 +199,18 @@ gth_empty_list_unrealize (GtkWidget *widget)
 static void
 gth_empty_list_map (GtkWidget *widget)
 {
-	GthEmptyList *self = (GthEmptyList*) widget;
-
-	GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-
-	gdk_window_show (self->priv->bin_window);
-	gdk_window_show (widget->window);
+	gtk_widget_set_mapped (widget, TRUE);
+	gdk_window_show (GTH_EMPTY_LIST (widget)->priv->bin_window);
+	gdk_window_show (gtk_widget_get_window (widget));
 }
 
 
 static void
 gth_empty_list_unmap (GtkWidget *widget)
 {
-	GthEmptyList *self = (GthEmptyList*) widget;
-
-	GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
-	gdk_window_hide (self->priv->bin_window);
-	gdk_window_hide (widget->window);
+	gtk_widget_set_mapped (widget, FALSE);
+	gdk_window_hide (GTH_EMPTY_LIST (widget)->priv->bin_window);
+	gdk_window_hide (gtk_widget_get_window (widget));
 }
 
 
@@ -219,17 +220,15 @@ gth_empty_list_size_allocate (GtkWidget     *widget,
 {
 	GthEmptyList *self = (GthEmptyList*) widget;
 
-	widget->allocation = *allocation;
+	gtk_widget_set_allocation (widget, allocation);
 
-	if (GTK_WIDGET_REALIZED (widget)) {
-		gdk_window_move_resize (widget->window,
+	if (gtk_widget_get_realized (widget)) {
+		gdk_window_move_resize (gtk_widget_get_window (widget),
 					allocation->x,
 					allocation->y,
 					allocation->width,
 					allocation->height);
-		gdk_window_invalidate_rect (self->priv->bin_window,
-					    NULL,
-					    FALSE);
+		gdk_window_invalidate_rect (self->priv->bin_window, NULL, FALSE);
 	}
 }
 
@@ -239,8 +238,8 @@ gth_empty_list_expose_event (GtkWidget      *widget,
 		             GdkEventExpose *event)
 {
 	GthEmptyList   *self = (GthEmptyList*) widget;
-	PangoRectangle  bounds;
 	GtkAllocation   allocation;
+	PangoRectangle  bounds;
 	GtkStyle       *style;
 	cairo_t        *cr;
 	
@@ -250,20 +249,19 @@ gth_empty_list_expose_event (GtkWidget      *widget,
 	if (self->priv->text == NULL)
 		return TRUE;
 
-	pango_layout_set_width (self->priv->layout, widget->allocation.width * PANGO_SCALE);
+	gtk_widget_get_allocation (widget, &allocation);
+	pango_layout_set_width (self->priv->layout, allocation.width * PANGO_SCALE);
 	pango_layout_set_text (self->priv->layout, self->priv->text, strlen (self->priv->text));
 	pango_layout_get_pixel_extents (self->priv->layout, NULL, &bounds);
 
-	gtk_widget_get_allocation (widget, &allocation);
-	style = gtk_widget_get_style (widget);
-
 	cr = gdk_cairo_create (self->priv->bin_window);
 	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)) {
+	if (gtk_widget_has_focus (widget)) {
 		gtk_paint_focus (style,
 				 self->priv->bin_window,
 				 gtk_widget_get_state (widget),
@@ -288,7 +286,7 @@ gth_empty_list_button_press (GtkWidget      *widget,
 	GthEmptyList *self = (GthEmptyList*) widget;
 
 	if (event->window == self->priv->bin_window)
-		if (! GTK_WIDGET_HAS_FOCUS (widget))
+		if (! gtk_widget_has_focus (widget))
 			gtk_widget_grab_focus (widget);
 	
 	return FALSE;
@@ -332,9 +330,8 @@ gth_empty_list_class_init (GthEmptyListClass *klass)
 static void 
 gth_empty_list_instance_init (GthEmptyList *self) 
 {
+	gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
 	self->priv = g_new0 (GthEmptyListPrivate, 1);
-	
-	GTK_WIDGET_SET_FLAGS (self, GTK_CAN_FOCUS);	
 }
 
 
diff --git a/gthumb/gth-file-tool.c b/gthumb/gth-file-tool.c
index d522fcc..4308dfc 100644
--- a/gthumb/gth-file-tool.c
+++ b/gthumb/gth-file-tool.c
@@ -194,7 +194,7 @@ gth_file_tool_get_window (GthFileTool *self)
 {
 	if (self->priv->window == NULL) {
 		self->priv->window = gtk_widget_get_toplevel (GTK_WIDGET (self));
-		if (! GTK_WIDGET_TOPLEVEL (self->priv->window))
+		if (! gtk_widget_is_toplevel (self->priv->window))
 			self->priv->window = NULL;
 	}
 	return self->priv->window;
diff --git a/gthumb/gth-filterbar.c b/gthumb/gth-filterbar.c
index 340ae3f..4fa6017 100644
--- a/gthumb/gth-filterbar.c
+++ b/gthumb/gth-filterbar.c
@@ -341,7 +341,7 @@ gth_filterbar_construct (GthFilterbar *filterbar,
 	GtkWidget       *button;
 	GtkWidget       *image;
 
-	GTK_BOX (filterbar)->spacing = 6;
+	gtk_box_set_spacing (GTK_BOX (filterbar), 6);
 	gtk_container_set_border_width (GTK_CONTAINER (filterbar), 2);
 
 	/* filter combo box */
diff --git a/gthumb/gth-histogram-view.c b/gthumb/gth-histogram-view.c
index 2436069..e4dd968 100644
--- a/gthumb/gth-histogram-view.c
+++ b/gthumb/gth-histogram-view.c
@@ -123,20 +123,18 @@ gth_histogram_paint_channel (GthHistogramView *self,
 			     int               channel,
 			     gboolean          black_mask)
 {
-	GtkWidget *widget = GTK_WIDGET (self);
-	int        w;
-	int        h;
-	double     max;
-	double     step;
-	int        i;
+	GtkWidget     *widget = GTK_WIDGET (self);
+	GtkAllocation  allocation;
+	double         max;
+	double         step;
+	int            i;
 
 	if (channel > 3)
 		return;
 	if ((self->priv->display_mode == GTH_HISTOGRAM_MODE_ALL_CHANNELS) && (channel == 0))
 		return;
 
-	w = widget->allocation.width;
-	h = widget->allocation.height;
+	gtk_widget_get_allocation (widget, &allocation);
 
 	switch (channel) {
 	case 0:
@@ -172,14 +170,14 @@ gth_histogram_paint_channel (GthHistogramView *self,
 	else
 		max = 1.0;
 
-	step = w / 256.0;
+	step = allocation.width / 256.0;
 	cairo_set_line_width (cr, 0.5);
 	for (i = 0; i < 256; i++) {
 		double value;
 		int    y;
 
 		value = gth_histogram_get_value (self->priv->histogram, channel, i);
-		y = (int) (h * convert_to_scale (self->priv->scale_type, value)) / max;
+		y = (int) (allocation.height * convert_to_scale (self->priv->scale_type, value)) / max;
 
 		/*cairo_new_path (cr);
 		cairo_move_to (cr, i * step + (step / 2) + 0.5, h - y);
@@ -187,9 +185,9 @@ gth_histogram_paint_channel (GthHistogramView *self,
 		cairo_close_path (cr);
 		cairo_stroke (cr);*/
 
-		cairo_rectangle (cr, (i * step) + 0.5, h - y, 1 + step, h);
-		cairo_fill (cr);
+		cairo_rectangle (cr, (i * step) + 0.5, allocation.height - y, 1 + step, allocation.height);
 	}
+	cairo_fill (cr);
 }
 
 
@@ -197,32 +195,32 @@ static void
 gth_histogram_paint_grid (GthHistogramView *self,
 			  cairo_t          *cr)
 {
-	GtkWidget *widget = GTK_WIDGET (self);
-	int        w;
-	int        h;
-	int        i;
-
-	w = widget->allocation.width;
-	h = widget->allocation.height;
+	GtkWidget     *widget = GTK_WIDGET (self);
+	GtkAllocation  allocation;
+	GtkStyle      *style;
+	int            i;
 
 	cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
-	gdk_cairo_set_source_color (cr, &widget->style->dark[GTK_WIDGET_STATE (widget)]);
 
-	cairo_rectangle (cr, 0, 0, w, h);
+	style = gtk_widget_get_style (widget);
+	gdk_cairo_set_source_color (cr, &style->dark[gtk_widget_get_state (widget)]);
+
+	gtk_widget_get_allocation (widget, &allocation);
+	cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
 	cairo_stroke (cr);
 
 	cairo_set_line_width (cr, 0.5);
 	for (i = 1; i <= 4; i++) {
 		int x;
 
-		x = (i * 64) * ((float) w / 256);
+		x = (i * 64) * ((float) allocation.width / 256);
 
-		cairo_new_path (cr);
+		/*cairo_new_path (cr);*/
 		cairo_move_to (cr, x + 0.5, 0);
-		cairo_line_to (cr, x + 0.5, h);
-		cairo_close_path (cr);
-		cairo_stroke (cr);
+		cairo_line_to (cr, x + 0.5, allocation.height);
+		/*cairo_close_path (cr);*/
 	}
+	cairo_stroke (cr);
 }
 
 
@@ -231,19 +229,18 @@ gth_histogram_view_expose_event (GtkWidget      *widget,
 				 GdkEventExpose *event)
 {
 	GthHistogramView *self;
-	int               w;
-	int               h;
+	GtkAllocation     allocation;
+	GtkStyle         *style;
 	cairo_t          *cr;
 
 	self = GTH_HISTOGRAM_VIEW (widget);
 
-	w = widget->allocation.width;
-	h = widget->allocation.height;
+	gtk_widget_get_allocation (widget, &allocation);
+	style = gtk_widget_get_style (widget);
 
-	cr = gdk_cairo_create (widget->window);
-
-	gdk_cairo_set_source_color (cr, &widget->style->base[GTK_WIDGET_STATE (widget)]);
-	cairo_rectangle (cr, 0, 0, w, h);
+	cr = gdk_cairo_create (gtk_widget_get_window (widget));
+	gdk_cairo_set_source_color (cr, &style->base[gtk_widget_get_state (widget)]);
+	cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
 	cairo_fill (cr);
 
 	cairo_set_line_width (cr, 2.0);
@@ -254,13 +251,13 @@ gth_histogram_view_expose_event (GtkWidget      *widget,
 		/* draw an x if no histogram is set */
 		cairo_new_path (cr);
 		cairo_move_to (cr, 0, 0);
-		cairo_line_to (cr, w, h);
+		cairo_line_to (cr, allocation.width, allocation.height);
 		cairo_close_path (cr);
 		cairo_stroke (cr);
 
 		cairo_new_path (cr);
-		cairo_move_to (cr, w, 0);
-		cairo_line_to (cr, 0, h);
+		cairo_move_to (cr, allocation.width, 0);
+		cairo_line_to (cr, 0, allocation.height);
 		cairo_close_path (cr);
 		cairo_stroke (cr);
 	}
@@ -293,10 +290,13 @@ gth_histogram_view_expose_event (GtkWidget      *widget,
 static void
 gth_histogram_view_map (GtkWidget *widget)
 {
+	GdkWindow *window;
+
 	if (GTK_WIDGET_CLASS (gth_histogram_view_parent_class)->map != NULL)
 		GTK_WIDGET_CLASS (gth_histogram_view_parent_class)->map (widget);
 
-	gdk_window_set_events (widget->window, GDK_BUTTON_PRESS_MASK | gdk_window_get_events (widget->window));
+	window = gtk_widget_get_window (widget);
+	gdk_window_set_events (window, GDK_BUTTON_PRESS_MASK | gdk_window_get_events (window));
 }
 
 
diff --git a/gthumb/gth-image-dragger.c b/gthumb/gth-image-dragger.c
index 9088917..fa948ef 100644
--- a/gthumb/gth-image-dragger.c
+++ b/gthumb/gth-image-dragger.c
@@ -102,12 +102,21 @@ gth_image_dragger_size_allocate (GthImageViewerTool *base,
 {
 	GthImageDragger *self;
 	GthImageViewer  *viewer;
+	double           h_page_size;
+	double           v_page_size;
+	double           h_upper;
+	double           v_upper;
 
 	self = (GthImageDragger *) base;
 	viewer = (GthImageViewer *) self->priv->viewer;
 
-	self->priv->draggable = (viewer->hadj->page_size > 0) && (viewer->vadj->page_size > 0) && ((viewer->hadj->upper > viewer->hadj->page_size) || (viewer->vadj->upper > viewer->vadj->page_size));
-	if (GTK_WIDGET_REALIZED (viewer))
+	h_page_size = gtk_adjustment_get_page_size (viewer->hadj);
+	v_page_size = gtk_adjustment_get_page_size (viewer->vadj);
+	h_upper = gtk_adjustment_get_upper (viewer->hadj);
+	v_upper = gtk_adjustment_get_upper (viewer->vadj);
+
+	self->priv->draggable = (h_page_size > 0) && (v_page_size > 0) && ((h_upper > h_page_size) || (v_upper > v_page_size));
+	if (gtk_widget_get_realized (GTK_WIDGET (viewer)))
 		_gth_image_dragger_update_cursor (self);
 }
 
@@ -179,8 +188,8 @@ gth_image_dragger_button_press (GthImageViewerTool *self,
 		GdkCursor *cursor;
 		int        retval;
 
-		cursor = gth_cursor_get (widget->window, GTH_CURSOR_HAND_CLOSED);
-		retval = gdk_pointer_grab (widget->window,
+		cursor = gth_cursor_get (gtk_widget_get_window (widget), GTH_CURSOR_HAND_CLOSED);
+		retval = gdk_pointer_grab (gtk_widget_get_window (widget),
 					   FALSE,
 					   (GDK_POINTER_MOTION_MASK
 					    | GDK_POINTER_MOTION_HINT_MASK
diff --git a/gthumb/gth-image-navigator.c b/gthumb/gth-image-navigator.c
index 8005230..35c6dfc 100644
--- a/gthumb/gth-image-navigator.c
+++ b/gthumb/gth-image-navigator.c
@@ -225,7 +225,7 @@ popup_window_event_cb (GtkWidget *widget,
 		return TRUE;
 
 	case GDK_MOTION_NOTIFY:
-		gdk_window_get_pointer (widget->window, &mx, &my, &mask);
+		gdk_window_get_pointer (gtk_widget_get_window (widget), &mx, &my, &mask);
 
 		get_visible_area_origin_as_double (nav_popup, mx, my, &x, &y);
 		nav_popup->visible_area.x = (int) x;
@@ -284,20 +284,20 @@ nav_window_grab_pointer (NavigatorPopup *nav_popup)
 	gtk_grab_add (nav_popup->popup_win);
 
 	cursor = gdk_cursor_new (GDK_FLEUR);
-	gdk_pointer_grab (nav_popup->popup_win->window,
+	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),
-			  nav_popup->preview->window,
+			   gtk_widget_get_window (nav_popup->preview),
 			  cursor,
 			  0);
 	gdk_cursor_unref (cursor);
 
 	/* Capture keyboard events. */
 
-	gdk_keyboard_grab (nav_popup->popup_win->window, 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);
 }
 
@@ -403,6 +403,10 @@ image_viewer_size_changed_cb (GtkWidget         *widget,
 {
 	GtkAdjustment *vadj;
 	GtkAdjustment *hadj;
+	double         h_page_size;
+	double         v_page_size;
+	double         h_upper;
+	double         v_upper;
 	gboolean       hide_vscr;
 	gboolean       hide_hscr;
 
@@ -411,8 +415,12 @@ image_viewer_size_changed_cb (GtkWidget         *widget,
 	g_return_val_if_fail (hadj != NULL, FALSE);
 	g_return_val_if_fail (vadj != NULL, FALSE);
 
-	hide_vscr = (vadj->page_size == 0) || (vadj->upper <= vadj->page_size);
-	hide_hscr = (hadj->page_size == 0) || (hadj->upper <= hadj->page_size);
+	h_page_size = gtk_adjustment_get_page_size (hadj);
+	v_page_size = gtk_adjustment_get_page_size (vadj);
+	h_upper = gtk_adjustment_get_upper (hadj);
+	v_upper = gtk_adjustment_get_upper (vadj);
+	hide_vscr = (v_page_size == 0) || (v_upper <= v_page_size);
+	hide_hscr = (h_page_size == 0) || (h_upper <= h_page_size);
 
 	if (! self->priv->scrollbars_visible || (hide_vscr && hide_hscr)) {
 		gtk_widget_hide (self->priv->viewer_vscr);
diff --git a/gthumb/gth-image-selector.c b/gthumb/gth-image-selector.c
index 91bc706..0ec1174 100644
--- a/gthumb/gth-image-selector.c
+++ b/gthumb/gth-image-selector.c
@@ -349,7 +349,7 @@ update_event_areas (GthImageSelector *self)
 	EventArea *event_area;
 	int        x, y, width, height;
 
-	if (! GTK_WIDGET_REALIZED (self->priv->viewer))
+	if (! gtk_widget_get_realized (GTK_WIDGET (self->priv->viewer)))
 		return;
 
 	x = self->priv->selection_area.x - 1;
@@ -417,7 +417,7 @@ static void
 queue_draw (GthImageSelector *self,
 	    GdkRectangle      area)
 {
-	if (! GTK_WIDGET_REALIZED (self->priv->viewer))
+	if (! gtk_widget_get_realized (GTK_WIDGET (self->priv->viewer)))
 		return;
 
 	gtk_widget_queue_draw_area (GTK_WIDGET (self->priv->viewer),
@@ -1112,20 +1112,24 @@ static gboolean
 autoscroll_cb (gpointer data)
 {
 	GthImageSelector *self = GTH_IMAGE_SELECTOR (data);
-	double            max_value;
 	double            value;
+	double            max_value;
 
 	GDK_THREADS_ENTER ();
 
-	max_value = self->priv->viewer->hadj->upper - self->priv->viewer->hadj->page_size;
-	value = self->priv->viewer->hadj->value + self->priv->x_value_diff;
+	/* drag x */
+
+	value = gtk_adjustment_get_value (self->priv->viewer->hadj) + self->priv->x_value_diff;
+	max_value = gtk_adjustment_get_upper (self->priv->viewer->hadj) - gtk_adjustment_get_page_size (self->priv->viewer->hadj);
 	if (value > max_value)
 		value = max_value;
 	gtk_adjustment_set_value (self->priv->viewer->hadj, value);
 	self->priv->viewer->drag_x = self->priv->viewer->drag_x + self->priv->x_value_diff;
 
-	max_value = self->priv->viewer->vadj->upper - self->priv->viewer->vadj->page_size;
-	value = self->priv->viewer->vadj->value + self->priv->y_value_diff;
+	/* drag y */
+
+	value = gtk_adjustment_get_value (self->priv->viewer->vadj) + self->priv->y_value_diff;
+	max_value = gtk_adjustment_get_upper (self->priv->viewer->vadj) - gtk_adjustment_get_page_size (self->priv->viewer->vadj);
 	if (value > max_value)
 		value = max_value;
 	gtk_adjustment_set_value (self->priv->viewer->vadj, value);
@@ -1147,6 +1151,7 @@ gth_image_selector_motion_notify (GthImageViewerTool *base,
 	GthImageSelector *self = GTH_IMAGE_SELECTOR (base);
 	GtkWidget        *widget;
 	int               x, y;
+	GtkAllocation     allocation;
 	int               absolute_x, absolute_y;
 
 	widget = GTK_WIDGET (self->priv->viewer);
@@ -1171,7 +1176,7 @@ gth_image_selector_motion_notify (GthImageViewerTool *base,
 	{
 		int retval;
 
-		retval = gdk_pointer_grab (widget->window,
+		retval = gdk_pointer_grab (gtk_widget_get_window (widget),
 					   FALSE,
 					   (GDK_POINTER_MOTION_MASK
 					    | GDK_POINTER_MOTION_HINT_MASK
@@ -1197,11 +1202,11 @@ gth_image_selector_motion_notify (GthImageViewerTool *base,
 	/* If we are out of bounds, schedule a timeout that will do
 	 * the scrolling */
 
+	gtk_widget_get_allocation (widget, &allocation);
 	absolute_x = event->x;
 	absolute_y = event->y;
-
-	if ((absolute_y < 0) || (absolute_y > widget->allocation.height)
-	    || (absolute_x < 0) || (absolute_x > widget->allocation.width))
+	if ((absolute_y < 0) || (absolute_y > allocation.height)
+	    || (absolute_x < 0) || (absolute_x > allocation.width))
 	{
 
 		/* Make the steppings be relative to the mouse
@@ -1211,16 +1216,16 @@ gth_image_selector_motion_notify (GthImageViewerTool *base,
 		 */
 		if (absolute_x < 0)
 			self->priv->x_value_diff = absolute_x;
-		else if (absolute_x > widget->allocation.width)
-			self->priv->x_value_diff = absolute_x - widget->allocation.width;
+		else if (absolute_x > allocation.width)
+			self->priv->x_value_diff = absolute_x - allocation.width;
 		else
 			self->priv->x_value_diff = 0.0;
 		self->priv->x_value_diff /= 2;
 
 		if (absolute_y < 0)
 			self->priv->y_value_diff = absolute_y;
-		else if (absolute_y > widget->allocation.height)
-			self->priv->y_value_diff = absolute_y - widget->allocation.height;
+		else if (absolute_y > allocation.height)
+			self->priv->y_value_diff = absolute_y -allocation.height;
 		else
 			self->priv->y_value_diff = 0.0;
 		self->priv->y_value_diff /= 2;
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index f9aa6fe..2566788 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -40,7 +40,6 @@
 #define COLOR_GRAY_CC   0x00cccccc
 #define COLOR_GRAY_FF   0x00ffffff
 
-#define GTH_IMAGE_VIEWER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTH_TYPE_IMAGE_VIEWER, GthImageViewerPrivate))
 
 #define DRAG_THRESHOLD  1     /* When dragging the image ignores movements
 			       * smaller than this value. */
@@ -251,16 +250,18 @@ get_zoomed_size (GthImageViewer *viewer,
 static void
 _gth_image_viewer_update_image_area (GthImageViewer *viewer)
 {
-	GtkWidget *widget;
-	int        pixbuf_width;
-	int        pixbuf_height;
-	int        gdk_width;
-	int        gdk_height;
+	GtkWidget     *widget;
+	int            pixbuf_width;
+	int            pixbuf_height;
+	GtkAllocation  allocation;
+	int            gdk_width;
+	int            gdk_height;
 
 	widget = GTK_WIDGET (viewer);
 	get_zoomed_size (viewer, &pixbuf_width, &pixbuf_height, viewer->priv->zoom_level);
-	gdk_width = widget->allocation.width - viewer->priv->frame_border2;
-	gdk_height = widget->allocation.height - viewer->priv->frame_border2;
+	gtk_widget_get_allocation (widget, &allocation);
+	gdk_width = allocation.width - viewer->priv->frame_border2;
+	gdk_height = allocation.height - viewer->priv->frame_border2;
 
 	viewer->image_area.x = MAX (viewer->priv->frame_border, (gdk_width - pixbuf_width) / 2);
 	viewer->image_area.y = MAX (viewer->priv->frame_border, (gdk_height - pixbuf_height) / 2);
@@ -275,15 +276,17 @@ set_zoom (GthImageViewer *viewer,
 	  int             center_x,
 	  int             center_y)
 {
-	GtkWidget *widget = (GtkWidget*) viewer;
-	gdouble    zoom_ratio;
-	int        gdk_width, gdk_height;
+	GtkWidget     *widget = (GtkWidget*) viewer;
+	GtkAllocation  allocation;
+	gdouble        zoom_ratio;
+	int            gdk_width, gdk_height;
 
 	g_return_if_fail (viewer != NULL);
 	g_return_if_fail (viewer->priv->loader != NULL);
 
-	gdk_width = widget->allocation.width - viewer->priv->frame_border2;
-	gdk_height = widget->allocation.height - viewer->priv->frame_border2;
+	gtk_widget_get_allocation (widget, &allocation);
+	gdk_width = allocation.width - viewer->priv->frame_border2;
+	gdk_height = allocation.height - viewer->priv->frame_border2;
 
 	/* try to keep the center of the view visible. */
 
@@ -326,19 +329,23 @@ static void
 gth_image_viewer_realize (GtkWidget *widget)
 {
 	GthImageViewer *viewer;
+	GtkAllocation   allocation;
 	GdkWindowAttr   attributes;
 	int             attributes_mask;
+	GdkWindow      *window;
+	GtkStyle       *style;
 
 	g_return_if_fail (GTH_IS_IMAGE_VIEWER (widget));
 
 	viewer = GTH_IMAGE_VIEWER (widget);
-	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+	gtk_widget_set_realized (widget, TRUE);
+	gtk_widget_get_allocation (widget, &allocation);
 
 	attributes.window_type = GDK_WINDOW_CHILD;
-	attributes.x           = widget->allocation.x;
-	attributes.y           = widget->allocation.y;
-	attributes.width       = widget->allocation.width;
-	attributes.height      = widget->allocation.height;
+	attributes.x           = allocation.x;
+	attributes.y           = allocation.y;
+	attributes.width       = allocation.width;
+	attributes.height      = allocation.height;
 	attributes.wclass      = GDK_INPUT_OUTPUT;
 	attributes.visual      = gtk_widget_get_visual (widget);
 	attributes.colormap    = gtk_widget_get_colormap (widget);
@@ -355,23 +362,27 @@ gth_image_viewer_realize (GtkWidget *widget)
 				  | GDK_WA_Y
 				  | GDK_WA_VISUAL
 				  | GDK_WA_COLORMAP);
-	widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
-					 &attributes,
-					 attributes_mask);
-	gdk_window_set_user_data (widget->window, viewer);
 
-	widget->style = gtk_style_attach (widget->style, widget->window);
-	gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+	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, viewer);
+
+	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);
 
 	viewer->priv->cursor = gdk_cursor_new (GDK_LEFT_PTR);
-	viewer->priv->cursor_void = gth_cursor_get (widget->window, GTH_CURSOR_VOID);
-	gdk_window_set_cursor (widget->window, viewer->priv->cursor);
+	viewer->priv->cursor_void = gth_cursor_get (window, GTH_CURSOR_VOID);
+	gdk_window_set_cursor (window, viewer->priv->cursor);
 
 	if (viewer->priv->transp_type == GTH_TRANSP_TYPE_NONE) {
 		GdkColor color;
 		guint    base_color;
 
-		color = GTK_WIDGET (viewer)->style->bg[GTK_STATE_NORMAL];
+		color = style->bg[GTK_STATE_NORMAL];
 		base_color = (0xFF000000
 			      | (to_255 (color.red) << 16)
 			      | (to_255 (color.green) << 8)
@@ -440,17 +451,21 @@ gth_image_viewer_unmap (GtkWidget *widget)
 static void
 zoom_to_fit (GthImageViewer *viewer)
 {
-	GdkPixbuf *buf;
-	int        gdk_width, gdk_height;
-	double     x_level, y_level;
-	double     new_zoom_level;
+	GdkPixbuf     *pixbuf;
+	GtkAllocation  allocation;
+	int            gdk_width;
+	int            gdk_height;
+	double         x_level;
+	double         y_level;
+	double         new_zoom_level;
 
-	buf = gth_image_viewer_get_current_pixbuf (viewer);
+	pixbuf = gth_image_viewer_get_current_pixbuf (viewer);
 
-	gdk_width = GTK_WIDGET (viewer)->allocation.width - viewer->priv->frame_border2;
-	gdk_height = GTK_WIDGET (viewer)->allocation.height - viewer->priv->frame_border2;
-	x_level = (double) gdk_width / gdk_pixbuf_get_width (buf);
-	y_level = (double) gdk_height / gdk_pixbuf_get_height (buf);
+	gtk_widget_get_allocation (GTK_WIDGET (viewer), &allocation);
+	gdk_width = allocation.width - viewer->priv->frame_border2;
+	gdk_height = allocation.height - viewer->priv->frame_border2;
+	x_level = (double) gdk_width / gdk_pixbuf_get_width (pixbuf);
+	y_level = (double) gdk_height / gdk_pixbuf_get_height (pixbuf);
 
 	new_zoom_level = (x_level < y_level) ? x_level : y_level;
 	if (new_zoom_level > 0.0) {
@@ -464,14 +479,15 @@ zoom_to_fit (GthImageViewer *viewer)
 static void
 zoom_to_fit_width (GthImageViewer *viewer)
 {
-	GdkPixbuf *buf;
-	double     new_zoom_level;
-	int        gdk_width;
+	GdkPixbuf     *pixbuf;
+	GtkAllocation  allocation;
+	int            gdk_width;
+	double         new_zoom_level;
 
-	buf = gth_image_viewer_get_current_pixbuf (viewer);
-
-	gdk_width = GTK_WIDGET (viewer)->allocation.width - viewer->priv->frame_border2;
-	new_zoom_level = (double) gdk_width / gdk_pixbuf_get_width (buf);
+	pixbuf = gth_image_viewer_get_current_pixbuf (viewer);
+	gtk_widget_get_allocation (GTK_WIDGET (viewer), &allocation);
+	gdk_width = allocation.width - viewer->priv->frame_border2;
+	new_zoom_level = (double) gdk_width / gdk_pixbuf_get_width (pixbuf);
 
 	if (new_zoom_level > 0.0) {
 		viewer->priv->doing_zoom_fit = TRUE;
@@ -491,7 +507,8 @@ gth_image_viewer_size_allocate (GtkWidget       *widget,
 
 	viewer = GTH_IMAGE_VIEWER (widget);
 
-	widget->allocation = *allocation;
+	gtk_widget_set_allocation (widget, allocation);
+
 	gdk_width = allocation->width - viewer->priv->frame_border2;
 	gdk_height = allocation->height - viewer->priv->frame_border2;
 
@@ -507,6 +524,7 @@ gth_image_viewer_size_allocate (GtkWidget       *widget,
 		case GTH_FIT_SIZE:
 			zoom_to_fit (viewer);
 			break;
+
 		case GTH_FIT_SIZE_IF_LARGER:
 			if ((gdk_width < gdk_pixbuf_get_width (current_pixbuf))
 				|| (gdk_height < gdk_pixbuf_get_height (current_pixbuf)))
@@ -519,9 +537,11 @@ gth_image_viewer_size_allocate (GtkWidget       *widget,
 				viewer->priv->doing_zoom_fit = FALSE;
 			}
 			break;
+
 		case GTH_FIT_WIDTH:
 			zoom_to_fit_width (viewer);
 			break;
+
 		case GTH_FIT_WIDTH_IF_LARGER:
 			if (gdk_width < gdk_pixbuf_get_width (current_pixbuf)) {
 				zoom_to_fit_width (viewer);
@@ -532,6 +552,7 @@ gth_image_viewer_size_allocate (GtkWidget       *widget,
 				viewer->priv->doing_zoom_fit = FALSE;
 			}
 			break;
+
 		default:
 			break;
 		}
@@ -540,7 +561,8 @@ gth_image_viewer_size_allocate (GtkWidget       *widget,
 	/* Check whether the offset is still valid. */
 
 	if (current_pixbuf != NULL) {
-		int width, height;
+		int width;
+		int height;
 
 		get_zoomed_size (viewer, &width, &height, viewer->priv->zoom_level);
 
@@ -558,37 +580,37 @@ gth_image_viewer_size_allocate (GtkWidget       *widget,
 		else
 			viewer->y_offset = 0;
 
-		if ((width != viewer->hadj->upper) || (height != viewer->vadj->upper))
+		if ((width != gtk_adjustment_get_upper (viewer->hadj)) || (height != gtk_adjustment_get_upper (viewer->vadj)))
 			g_signal_emit (G_OBJECT (viewer),
 				       gth_image_viewer_signals[SIZE_CHANGED],
 				       0);
 
 		/* Change adjustment values. */
 
-		viewer->hadj->lower          = 0.0;
-		viewer->hadj->upper          = width;
-		viewer->hadj->value          = viewer->x_offset;
-		viewer->hadj->step_increment = STEP_INCREMENT;
-		viewer->hadj->page_increment = gdk_width / 2;
-		viewer->hadj->page_size      = gdk_width;
-
-		viewer->vadj->lower          = 0.0;
-		viewer->vadj->upper          = height;
-		viewer->vadj->value          = viewer->y_offset;
-		viewer->vadj->step_increment = STEP_INCREMENT;
-		viewer->vadj->page_increment = gdk_height / 2;
-		viewer->vadj->page_size      = gdk_height;
+		gtk_adjustment_set_lower (viewer->hadj, 0.0);
+		gtk_adjustment_set_upper (viewer->hadj, width);
+		gtk_adjustment_set_value (viewer->hadj, viewer->x_offset);
+		gtk_adjustment_set_step_increment (viewer->hadj, STEP_INCREMENT);
+		gtk_adjustment_set_page_increment (viewer->hadj, gdk_width / 2);
+		gtk_adjustment_set_page_size (viewer->hadj, gdk_width);
+
+		gtk_adjustment_set_lower (viewer->vadj, 0.0);
+		gtk_adjustment_set_upper (viewer->vadj, height);
+		gtk_adjustment_set_value (viewer->vadj, viewer->y_offset);
+		gtk_adjustment_set_step_increment (viewer->vadj, STEP_INCREMENT);
+		gtk_adjustment_set_page_increment (viewer->vadj, gdk_height / 2);
+		gtk_adjustment_set_page_size (viewer->vadj, gdk_height);
 	}
 	else {
-		viewer->hadj->lower     = 0.0;
-		viewer->hadj->upper     = 1.0;
-		viewer->hadj->value     = 0.0;
-		viewer->hadj->page_size = 1.0;
-
-		viewer->vadj->lower     = 0.0;
-		viewer->vadj->upper     = 1.0;
-		viewer->vadj->value     = 0.0;
-		viewer->vadj->page_size = 1.0;
+		gtk_adjustment_set_lower (viewer->hadj, 0.0);
+		gtk_adjustment_set_upper (viewer->hadj, 1.0);
+		gtk_adjustment_set_value (viewer->hadj, 0.0);
+		gtk_adjustment_set_page_size (viewer->hadj, 1.0);
+
+		gtk_adjustment_set_lower (viewer->vadj, 0.0);
+		gtk_adjustment_set_upper (viewer->vadj, 1.0);
+		gtk_adjustment_set_value (viewer->vadj, 0.0);
+		gtk_adjustment_set_page_size (viewer->vadj, 1.0);
 	}
 
 	_gth_image_viewer_update_image_area (viewer);
@@ -602,8 +624,8 @@ gth_image_viewer_size_allocate (GtkWidget       *widget,
 
 	/**/
 
-	if (GTK_WIDGET_REALIZED (widget))
-		gdk_window_move_resize (widget->window,
+	if (gtk_widget_get_realized (widget))
+		gdk_window_move_resize (gtk_widget_get_window (widget),
 					allocation->x,
 					allocation->y,
 					allocation->width,
@@ -624,9 +646,7 @@ static gboolean
 gth_image_viewer_focus_in (GtkWidget     *widget,
 			   GdkEventFocus *event)
 {
-	GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
 	gtk_widget_queue_draw (widget);
-
 	return TRUE;
 }
 
@@ -635,9 +655,7 @@ static gboolean
 gth_image_viewer_focus_out (GtkWidget     *widget,
 			    GdkEventFocus *event)
 {
-	GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
 	gtk_widget_queue_draw (widget);
-
 	return TRUE;
 }
 
@@ -718,9 +736,10 @@ gth_image_viewer_expose (GtkWidget      *widget,
 {
 	GthImageViewer *viewer;
 	cairo_t        *cr;
-	GtkStyle       *style;
+	GtkAllocation   allocation;
 	int             gdk_width;
 	int             gdk_height;
+	GtkStyle       *style;
 
 	viewer = GTH_IMAGE_VIEWER (widget);
 
@@ -734,9 +753,11 @@ gth_image_viewer_expose (GtkWidget      *widget,
 
 	/* Draw the background. */
 
+	gtk_widget_get_allocation (widget, &allocation);
+	gdk_width = allocation.width - viewer->priv->frame_border2;
+	gdk_height = allocation.height - viewer->priv->frame_border2;
+
 	style = gtk_widget_get_style (widget);
-	gdk_width = widget->allocation.width - viewer->priv->frame_border2;
-	gdk_height = widget->allocation.height - viewer->priv->frame_border2;
 
 	if ((viewer->image_area.x > viewer->priv->frame_border)
 	    || (viewer->image_area.y > viewer->priv->frame_border)
@@ -754,8 +775,8 @@ gth_image_viewer_expose (GtkWidget      *widget,
 			cairo_rectangle (cr,
 					 0 + 0.5,
 					 0 + 0.5,
-					 widget->allocation.width + 0.5,
-					 widget->allocation.height + 0.5);
+					 allocation.width + 0.5,
+					 allocation.height + 0.5);
 		}
 		else {
 			/* If an image is present draw in four phases to avoid
@@ -765,7 +786,7 @@ gth_image_viewer_expose (GtkWidget      *widget,
 
 			rx = 0;
 			ry = 0;
-			rw = widget->allocation.width;
+			rw = allocation.width;
 			rh = viewer->image_area.y;
 			if ((rw > 0) && (rh > 0))
 				cairo_rectangle (cr, rx + 0.5, ry + 0.5, rw + 0.5, rh + 0.5);
@@ -774,8 +795,8 @@ gth_image_viewer_expose (GtkWidget      *widget,
 
 			rx = 0;
 			ry = viewer->image_area.y + viewer->image_area.height;
-			rw = widget->allocation.width;
-			rh = widget->allocation.height - viewer->image_area.y - viewer->image_area.height;
+			rw = allocation.width;
+			rh = allocation.height - viewer->image_area.y - viewer->image_area.height;
 			if ((rw > 0) && (rh > 0))
 				cairo_rectangle (cr, rx + 0.5, ry + 0.5, rw + 0.5, rh + 0.5);
 
@@ -792,7 +813,7 @@ gth_image_viewer_expose (GtkWidget      *widget,
 
 			rx = viewer->image_area.x + viewer->image_area.width;
 			ry = viewer->image_area.y - 1;
-			rw = widget->allocation.width - viewer->image_area.x - viewer->image_area.width;
+			rw = allocation.width - viewer->image_area.x - viewer->image_area.width;
 			rh = viewer->image_area.height + 2;
 			if ((rw > 0) && (rh > 0))
 				cairo_rectangle (cr, rx + 0.5, ry + 0.5, rw + 0.5, rh + 0.5);
@@ -879,7 +900,7 @@ gth_image_viewer_button_press (GtkWidget      *widget,
 	GthImageViewer *viewer = GTH_IMAGE_VIEWER (widget);
 	int             retval;
 
-	if (! GTK_WIDGET_HAS_FOCUS (widget)) {
+	if (! gtk_widget_has_focus (widget)) {
 		gtk_widget_grab_focus (widget);
 		viewer->priv->just_focused = TRUE;
 	}
@@ -964,10 +985,11 @@ scroll_to (GthImageViewer *viewer,
 	   int            *x_offset,
 	   int            *y_offset)
 {
-	GdkDrawable *drawable;
-	int          width, height;
-	int          delta_x, delta_y;
-	int          gdk_width, gdk_height;
+	GdkDrawable   *drawable;
+	GtkAllocation  allocation;
+	int            width, height;
+	int            delta_x, delta_y;
+	int            gdk_width, gdk_height;
 
 	g_return_if_fail (viewer != NULL);
 
@@ -976,9 +998,10 @@ scroll_to (GthImageViewer *viewer,
 
 	get_zoomed_size (viewer, &width, &height, viewer->priv->zoom_level);
 
-	drawable = GTK_WIDGET (viewer)->window;
-	gdk_width = GTK_WIDGET (viewer)->allocation.width - viewer->priv->frame_border2;
-	gdk_height = GTK_WIDGET (viewer)->allocation.height - viewer->priv->frame_border2;
+	drawable = gtk_widget_get_window (GTK_WIDGET (viewer));
+	gtk_widget_get_allocation (GTK_WIDGET (viewer), &allocation);
+	gdk_width = allocation.width - viewer->priv->frame_border2;
+	gdk_height = allocation.height - viewer->priv->frame_border2;
 
 	if (width > gdk_width)
 		*x_offset = CLAMP (*x_offset, 0, width - gdk_width);
@@ -1006,9 +1029,7 @@ scroll_to (GthImageViewer *viewer,
 			       gth_image_viewer_signals[REPAINTED],
 			       0);
 
-		expose_area (viewer, 0, 0,
-			     GTK_WIDGET (viewer)->allocation.width,
-			     GTK_WIDGET (viewer)->allocation.height);
+		expose_area (viewer, 0, 0, allocation.width, allocation.height);
 
 		return;
 	}
@@ -1126,13 +1147,11 @@ gth_image_viewer_scroll_event (GtkWidget      *widget,
 		return FALSE;
 
 	adj = viewer->hadj;
-
 	if (event->direction == GDK_SCROLL_LEFT)
-		new_value = adj->value - adj->page_increment / 2;
+		new_value = gtk_adjustment_get_value (adj) - gtk_adjustment_get_page_increment (adj) / 2;
 	else if (event->direction == GDK_SCROLL_RIGHT)
-		new_value = adj->value + adj->page_increment / 2;
-
-	new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
+		new_value = gtk_adjustment_get_value (adj) + gtk_adjustment_get_page_increment (adj) / 2;
+	new_value = CLAMP (new_value, gtk_adjustment_get_lower (adj), gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
 	gtk_adjustment_set_value (adj, new_value);
 
 	return TRUE;
@@ -1148,10 +1167,12 @@ gth_image_viewer_style_set (GtkWidget *widget,
 	GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
 
 	if (viewer->priv->transp_type == GTH_TRANSP_TYPE_NONE) {
-		GdkColor color;
-		guint    base_color;
+		GtkStyle *style;
+		GdkColor  color;
+		guint     base_color;
 
-		color = GTK_WIDGET (viewer)->style->bg[GTK_STATE_NORMAL];
+		style = gtk_widget_get_style (GTK_WIDGET (viewer));
+		color = style->bg[GTK_STATE_NORMAL];
 		base_color = (0xFF000000
 			      | (to_255 (color.red) << 16)
 			      | (to_255 (color.green) << 8)
@@ -1184,16 +1205,16 @@ scroll_signal (GtkWidget     *widget,
 
 	switch (xscroll_type) {
 	case GTK_SCROLL_STEP_LEFT:
-		xstep = -viewer->hadj->step_increment;
+		xstep = - gtk_adjustment_get_step_increment (viewer->hadj);
 		break;
 	case GTK_SCROLL_STEP_RIGHT:
-		xstep = viewer->hadj->step_increment;
+		xstep = gtk_adjustment_get_step_increment (viewer->hadj);
 		break;
 	case GTK_SCROLL_PAGE_LEFT:
-		xstep = -viewer->hadj->page_increment;
+		xstep = - gtk_adjustment_get_page_increment (viewer->hadj);
 		break;
 	case GTK_SCROLL_PAGE_RIGHT:
-		xstep = viewer->hadj->page_increment;
+		xstep = gtk_adjustment_get_page_increment (viewer->hadj);
 		break;
 	default:
 		xstep = 0;
@@ -1202,16 +1223,16 @@ scroll_signal (GtkWidget     *widget,
 
 	switch (yscroll_type) {
 	case GTK_SCROLL_STEP_UP:
-		ystep = -viewer->vadj->step_increment;
+		ystep = - gtk_adjustment_get_step_increment (viewer->vadj);
 		break;
 	case GTK_SCROLL_STEP_DOWN:
-		ystep = viewer->vadj->step_increment;
+		ystep = gtk_adjustment_get_step_increment (viewer->vadj);
 		break;
 	case GTK_SCROLL_PAGE_UP:
-		ystep = -viewer->vadj->page_increment;
+		ystep = - gtk_adjustment_get_page_increment (viewer->vadj);
 		break;
 	case GTK_SCROLL_PAGE_DOWN:
-		ystep = viewer->vadj->page_increment;
+		ystep = gtk_adjustment_get_page_increment (viewer->vadj);
 		break;
 	default:
 		ystep = 0;
@@ -1223,12 +1244,12 @@ scroll_signal (GtkWidget     *widget,
 
 
 static gboolean
-hadj_value_changed (GtkObject      *adj,
+hadj_value_changed (GtkAdjustment  *adj,
 		    GthImageViewer *viewer)
 {
 	int x_ofs, y_ofs;
 
-	x_ofs = (int) GTK_ADJUSTMENT (adj)->value;
+	x_ofs = (int) gtk_adjustment_get_value (adj);
 	y_ofs = viewer->y_offset;
 	scroll_to (viewer, &x_ofs, &y_ofs);
 
@@ -1237,13 +1258,13 @@ hadj_value_changed (GtkObject      *adj,
 
 
 static gboolean
-vadj_value_changed (GtkObject      *adj,
+vadj_value_changed (GtkAdjustment  *adj,
 		    GthImageViewer *viewer)
 {
 	int x_ofs, y_ofs;
 
 	x_ofs = viewer->x_offset;
-	y_ofs = (int) GTK_ADJUSTMENT (adj)->value;
+	y_ofs = (int) gtk_adjustment_get_value (adj);
 	scroll_to (viewer, &x_ofs, &y_ofs);
 
 	return FALSE;
@@ -1693,13 +1714,13 @@ image_loader_ready_cb (GthImageLoader *il,
 static void
 gth_image_viewer_instance_init (GthImageViewer *viewer)
 {
-	GTK_WIDGET_SET_FLAGS (viewer, GTK_CAN_FOCUS);
-
-	viewer->priv = GTH_IMAGE_VIEWER_GET_PRIVATE (viewer);
+	gtk_widget_set_can_focus (GTK_WIDGET (viewer), TRUE);
 	gtk_widget_set_double_buffered (GTK_WIDGET (viewer), TRUE);
 
 	/* Initialize data. */
 
+	viewer->priv = G_TYPE_INSTANCE_GET_PRIVATE (viewer, GTH_TYPE_IMAGE_VIEWER, GthImageViewerPrivate);
+
 	viewer->priv->check_type = GTH_CHECK_TYPE_MIDTONE;
 	viewer->priv->check_size = GTH_CHECK_SIZE_LARGE;
 	viewer->priv->check_color1 = COLOR_GRAY_66;
@@ -2163,12 +2184,13 @@ void
 gth_image_viewer_set_zoom (GthImageViewer *viewer,
 			   gdouble         zoom_level)
 {
-	GtkWidget *widget = (GtkWidget*) viewer;
+	GtkAllocation allocation;
 
+	gtk_widget_get_allocation (GTK_WIDGET (viewer), &allocation);
 	set_zoom (viewer,
 		  zoom_level,
-		  (widget->allocation.width - viewer->priv->frame_border2) / 2,
-		  (widget->allocation.height - viewer->priv->frame_border2) / 2);
+		  (allocation.width - viewer->priv->frame_border2) / 2,
+		  (allocation.height - viewer->priv->frame_border2) / 2);
 }
 
 
@@ -2249,14 +2271,16 @@ void
 gth_image_viewer_set_transp_type (GthImageViewer *viewer,
 				  GthTranspType   transp_type)
 {
-	GdkColor color;
-	guint    base_color;
+	GtkStyle *style;
+	GdkColor  color;
+	guint     base_color;
 
 	g_return_if_fail (viewer != NULL);
 
 	viewer->priv->transp_type = transp_type;
 
-	color = GTK_WIDGET (viewer)->style->bg[GTK_STATE_NORMAL];
+	style = gtk_widget_get_style (GTK_WIDGET (viewer));
+	color = style->bg[GTK_STATE_NORMAL];
 	base_color = (0xFF000000
 		      | (to_255 (color.red) << 16)
 		      | (to_255 (color.green) << 8)
@@ -2349,8 +2373,12 @@ gth_image_viewer_set_size_request (GthImageViewer *viewer,
 				   int             width,
 				   int             height)
 {
-	GTK_WIDGET (viewer)->requisition.width = width;
-	GTK_WIDGET (viewer)->requisition.height = height;
+	GtkRequisition requisition;
+
+	requisition.width = width;
+	requisition.height = height;
+	gtk_widget_size_request (GTK_WIDGET (viewer), &requisition);
+
 	gtk_widget_queue_resize (GTK_WIDGET (viewer));
 }
 
@@ -2395,7 +2423,7 @@ gth_image_viewer_set_tool (GthImageViewer     *viewer,
 		viewer->priv->tool = gth_image_dragger_new (viewer);
 	else
 		viewer->priv->tool = g_object_ref (tool);
-	if (GTK_WIDGET_REALIZED (viewer))
+	if (gtk_widget_get_realized (GTK_WIDGET (viewer)))
 		gth_image_viewer_tool_realize (viewer->priv->tool);
 	gth_image_viewer_tool_image_changed (viewer->priv->tool);
 	gtk_widget_queue_resize (GTK_WIDGET (viewer));
@@ -2429,7 +2457,7 @@ gth_image_viewer_scroll_step_x (GthImageViewer *viewer,
 				gboolean        increment)
 {
 	scroll_relative (viewer,
-			 (increment ? 1 : -1) * viewer->hadj->step_increment,
+			 (increment ? 1 : -1) * gtk_adjustment_get_step_increment (viewer->hadj),
 			 0);
 }
 
@@ -2440,7 +2468,7 @@ gth_image_viewer_scroll_step_y (GthImageViewer *viewer,
 {
 	scroll_relative (viewer,
 			 0,
-			 (increment ? 1 : -1) * viewer->vadj->step_increment);
+			 (increment ? 1 : -1) * gtk_adjustment_get_step_increment (viewer->vadj));
 }
 
 
@@ -2449,7 +2477,7 @@ gth_image_viewer_scroll_page_x (GthImageViewer *viewer,
 				gboolean        increment)
 {
 	scroll_relative (viewer,
-			 (increment ? 1 : -1) * viewer->hadj->page_increment,
+			 (increment ? 1 : -1) * gtk_adjustment_get_page_increment (viewer->hadj),
 			 0);
 }
 
@@ -2460,7 +2488,7 @@ gth_image_viewer_scroll_page_y (GthImageViewer *viewer,
 {
 	scroll_relative (viewer,
 			 0,
-			 (increment ? 1 : -1) * viewer->vadj->page_increment);
+			 (increment ? 1 : -1) * gtk_adjustment_get_page_increment (viewer->vadj));
 }
 
 
@@ -2496,7 +2524,7 @@ gth_image_viewer_show_cursor (GthImageViewer *viewer)
 		return;
 
 	viewer->priv->cursor_visible = TRUE;
-	gdk_window_set_cursor (GTK_WIDGET (viewer)->window, viewer->priv->cursor);
+	gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (viewer)), viewer->priv->cursor);
 }
 
 
@@ -2507,7 +2535,7 @@ gth_image_viewer_hide_cursor (GthImageViewer *viewer)
 		return;
 
 	viewer->priv->cursor_visible = FALSE;
-	gdk_window_set_cursor (GTK_WIDGET (viewer)->window, viewer->priv->cursor_void);
+	gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (viewer)), viewer->priv->cursor_void);
 }
 
 
@@ -2527,11 +2555,11 @@ gth_image_viewer_set_cursor (GthImageViewer *viewer,
 	else
 		viewer->priv->cursor = gdk_cursor_ref (viewer->priv->cursor_void);
 
-	if (! GTK_WIDGET_REALIZED (viewer))
+	if (! gtk_widget_get_realized (GTK_WIDGET (viewer)))
 		return;
 
 	if (viewer->priv->cursor_visible)
-		gdk_window_set_cursor (GTK_WIDGET (viewer)->window, viewer->priv->cursor);
+		gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (viewer)), viewer->priv->cursor);
 }
 
 
@@ -2693,8 +2721,10 @@ void
 gth_image_viewer_crop_area (GthImageViewer *viewer,
 			    GdkRectangle   *area)
 {
-	GtkWidget *widget = GTK_WIDGET (viewer);
+	GtkWidget     *widget = GTK_WIDGET (viewer);
+	GtkAllocation  allocation;
 
-	area->width = MIN (area->width, widget->allocation.width - viewer->priv->frame_border2);
-	area->width = MIN (area->height, widget->allocation.height - viewer->priv->frame_border2);
+	gtk_widget_get_allocation (widget, &allocation);
+	area->width = MIN (area->width, allocation.width - viewer->priv->frame_border2);
+	area->width = MIN (area->height, allocation.height - viewer->priv->frame_border2);
 }
diff --git a/gthumb/gth-info-bar.c b/gthumb/gth-info-bar.c
index 8490698..f67d0ae 100644
--- a/gthumb/gth-info-bar.c
+++ b/gthumb/gth-info-bar.c
@@ -101,7 +101,7 @@ gth_info_bar_construct (GthInfoBar *self)
 
 	self->priv->primary_text_label = primary_label = gtk_label_new (NULL);
 	gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
-	GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);
+	gtk_widget_set_can_focus (primary_label, TRUE);
 	gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
 	gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
 	gtk_misc_set_padding (GTK_MISC (primary_label), 0, 0);
@@ -111,7 +111,7 @@ gth_info_bar_construct (GthInfoBar *self)
 	
 	self->priv->secondary_text_label = secondary_label = gtk_label_new (NULL);
 	gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
-	GTK_WIDGET_SET_FLAGS (secondary_label, GTK_CAN_FOCUS);
+	gtk_widget_set_can_focus (secondary_label, TRUE);
 	gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
 	gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
 	gtk_misc_set_padding (GTK_MISC (secondary_label), 0, 0);
diff --git a/gthumb/gth-location-chooser.c b/gthumb/gth-location-chooser.c
index 51278db..cd43391 100644
--- a/gthumb/gth-location-chooser.c
+++ b/gthumb/gth-location-chooser.c
@@ -133,7 +133,7 @@ gth_location_chooser_class_init (GthLocationChooserClass *class)
 static void
 gth_location_chooser_init (GthLocationChooser *chooser)
 {
-	GTK_WIDGET_SET_FLAGS (chooser, GTK_CAN_FOCUS);
+	gtk_widget_set_can_focus (GTK_WIDGET (chooser), TRUE);
 	chooser->priv = g_new0 (GthLocationChooserPrivate, 1);
 }
 
diff --git a/gthumb/gth-tags-entry.c b/gthumb/gth-tags-entry.c
index 07560a5..f8251ae 100644
--- a/gthumb/gth-tags-entry.c
+++ b/gthumb/gth-tags-entry.c
@@ -627,7 +627,7 @@ tag_list_unmap_cb (GtkWidget    *widget,
         GdkGeometry  geometry;
 
         toplevel = gtk_widget_get_toplevel (widget);
-        if (! GTK_WIDGET_TOPLEVEL (toplevel))
+        if (! gtk_widget_is_toplevel (toplevel))
         	return;
 
         geometry.max_height = -1;
@@ -672,7 +672,7 @@ gth_tags_entry_instance_init (GthTagsEntry *self)
 	GtkTreeViewColumn *column;
 	GtkCellRenderer   *renderer;
 
-	GTK_WIDGET_SET_FLAGS (self, GTK_CAN_FOCUS);
+	gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
 
 	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_TAGS_ENTRY, GthTagsEntryPrivate);
 	self->priv->expanded_list.last_used = g_new0 (char *, 1);
diff --git a/gthumb/gth-test-selector.c b/gthumb/gth-test-selector.c
index 7f02580..36c37c8 100644
--- a/gthumb/gth-test-selector.c
+++ b/gthumb/gth-test-selector.c
@@ -223,7 +223,7 @@ gth_test_selector_construct (GthTestSelector *self,
 	GList           *tests;
 	GList           *scan;
 
-	GTK_BOX (self)->spacing = 6;
+	gtk_box_set_spacing (GTK_BOX (self), 6);
 	gtk_container_set_border_width (GTK_CONTAINER (self), 2);
 
 	/* scope combo box */
diff --git a/gthumb/gth-time-selector.c b/gthumb/gth-time-selector.c
index e489454..f9751c1 100644
--- a/gthumb/gth-time-selector.c
+++ b/gthumb/gth-time-selector.c
@@ -118,6 +118,7 @@ show_calendar_popup (GthTimeSelector *self)
 	GtkRequisition  popup_req;
 	int             x;
 	int             y;
+	GtkAllocation   allocation;
 	int             selector_height;
 	GdkScreen      *screen;
 	gint            monitor_num;
@@ -128,9 +129,10 @@ show_calendar_popup (GthTimeSelector *self)
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->priv->calendar_button), TRUE);
 
 	gdk_window_get_position (gtk_widget_get_window (GTK_WIDGET (self)), &x, &y);
-	x += self->priv->date_entry->allocation.x;
-	y += self->priv->date_entry->allocation.y;
-	selector_height = self->priv->date_entry->allocation.height;
+	gtk_widget_get_allocation (self->priv->date_entry, &allocation);
+	x += allocation.x;
+	y += allocation.y;
+	selector_height = allocation.height;
 
 	screen = gtk_widget_get_screen (GTK_WIDGET (self));
 	monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (GTK_WIDGET (self)));
diff --git a/gthumb/gth-toggle-menu-tool-button.c b/gthumb/gth-toggle-menu-tool-button.c
index 25f710d..bb7206c 100644
--- a/gthumb/gth-toggle-menu-tool-button.c
+++ b/gthumb/gth-toggle-menu-tool-button.c
@@ -124,19 +124,19 @@ gth_toggle_menu_tool_button_construct_contents (GtkToolItem *tool_item)
 			      "icon-spacing", &icon_spacing,
 			      NULL);
 
-	if (button->priv->icon_widget && button->priv->icon_widget->parent)
-		gtk_container_remove (GTK_CONTAINER (button->priv->icon_widget->parent),
+	if ((button->priv->icon_widget != NULL) && (gtk_widget_get_parent (button->priv->icon_widget) != NULL))
+		gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (button->priv->icon_widget)),
 				      button->priv->icon_widget);
 
-	if (button->priv->label_widget && button->priv->label_widget->parent)
-		gtk_container_remove (GTK_CONTAINER (button->priv->label_widget->parent),
+	if ((button->priv->label_widget != NULL) && (gtk_widget_get_parent (button->priv->label_widget) != NULL))
+		gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (button->priv->label_widget)),
 				      button->priv->label_widget);
 
-	if (GTK_BIN (button->priv->toggle_button)->child)
+	if (gtk_bin_get_child (GTK_BIN (button->priv->toggle_button)) != NULL)
 		/* Note: we are not destroying the label_widget or icon_widget
 		 * here because they were removed from their containers above
 		 */
-		gtk_widget_destroy (GTK_BIN (button->priv->toggle_button)->child);
+		gtk_widget_destroy (gtk_bin_get_child (GTK_BIN (button->priv->toggle_button)));
 
 	style = gtk_tool_item_get_toolbar_style (GTK_TOOL_ITEM (button));
 
@@ -339,7 +339,7 @@ gth_toggle_menu_tool_button_state_changed (GtkWidget    *widget,
 {
 	GthToggleMenuToolButton *button = GTH_TOGGLE_MENU_TOOL_BUTTON (widget);
 
-	if (! GTK_WIDGET_IS_SENSITIVE (widget) && (button->priv->menu != NULL))
+	if (! gtk_widget_is_sensitive (widget) && (button->priv->menu != NULL))
 		gtk_menu_shell_deactivate (GTK_MENU_SHELL (button->priv->menu));
 }
 
@@ -350,7 +350,7 @@ gth_toggle_menu_tool_button_update_icon_spacing (GthToggleMenuToolButton *button
 	GtkWidget *box;
 	guint spacing;
 
-	box = GTK_BIN (button->priv->toggle_button)->child;
+	box = gtk_bin_get_child (GTK_BIN (button->priv->toggle_button));
 	if (GTK_IS_BOX (box)) {
 		gtk_widget_style_get (GTK_WIDGET (button),
 				      "icon-spacing", &spacing,
@@ -464,6 +464,7 @@ menu_position_func (GtkMenu                 *menu,
 	GdkRectangle      monitor;
 	int               monitor_num;
 	GdkScreen        *screen;
+	GtkAllocation     allocation;
 
 	gtk_widget_size_request (GTK_WIDGET (button->priv->menu), &menu_req);
 
@@ -471,43 +472,44 @@ menu_position_func (GtkMenu                 *menu,
 	direction = gtk_widget_get_direction (widget);
 
 	screen = gtk_widget_get_screen (GTK_WIDGET (menu));
-	monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
+	monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget));
 	if (monitor_num < 0)
 		monitor_num = 0;
 	gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+	gtk_widget_get_allocation (widget, &allocation);
 
 	if (orientation == GTK_ORIENTATION_HORIZONTAL) {
-		gdk_window_get_origin (widget->window, x, y);
-		*x += widget->allocation.x;
-		*y += widget->allocation.y;
+		gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
+		*x += allocation.x;
+		*y += allocation.y;
 
 		if (direction == GTK_TEXT_DIR_LTR)
-			*x += MAX (widget->allocation.width - menu_req.width, 0);
-		else if (menu_req.width > widget->allocation.width)
-			*x -= menu_req.width - widget->allocation.width;
+			*x += MAX (allocation.width - menu_req.width, 0);
+		else if (menu_req.width > allocation.width)
+			*x -= menu_req.width - allocation.width;
 
-		if ((*y + widget->allocation.height + menu_req.height) <= monitor.y + monitor.height)
-			*y += widget->allocation.height;
+		if ((*y + allocation.height + menu_req.height) <= monitor.y + monitor.height)
+			*y += allocation.height;
 		else if ((*y - menu_req.height) >= monitor.y)
 			*y -= menu_req.height;
-		else if (monitor.y + monitor.height - (*y + widget->allocation.height) > *y)
-			*y += widget->allocation.height;
+		else if (monitor.y + monitor.height - (*y + allocation.height) > *y)
+			*y += allocation.height;
 		else
 			*y -= menu_req.height;
 	}
 	else {
-		gdk_window_get_origin (GTK_BUTTON (widget)->event_window, x, y);
+		gdk_window_get_origin (gtk_button_get_event_window (GTK_BUTTON (widget)), x, y);
 		gtk_widget_size_request (widget, &req);
 
 		if (direction == GTK_TEXT_DIR_LTR)
-			*x += widget->allocation.width;
+			*x += allocation.width;
 		else
 			*x -= menu_req.width;
 
 		if ((*y + menu_req.height > monitor.y + monitor.height) &&
-		    (*y + widget->allocation.height - monitor.y > monitor.y + monitor.height - *y))
+		    (*y + allocation.height - monitor.y > monitor.y + monitor.height - *y))
 		{
-			*y += widget->allocation.height - menu_req.height;
+			*y += allocation.height - menu_req.height;
 		}
 	}
 
@@ -547,7 +549,7 @@ real_button_toggled_cb (GtkToggleButton         *togglebutton,
 		button->priv->active = toggle_active;
 		g_object_notify (G_OBJECT (button), "active");
 
-		if (button->priv->active && ! GTK_WIDGET_VISIBLE (button->priv->menu)) {
+		if (button->priv->active && ! gtk_widget_get_visible (GTK_WIDGET (button->priv->menu))) {
 			/* we get here only when the menu is activated by a key
 			 * press, so that we can select the first menu item */
 			popup_menu_under_button (button, NULL);
@@ -1023,7 +1025,7 @@ gth_toggle_menu_tool_button_set_menu (GthToggleMenuToolButton *button,
 	g_return_if_fail (GTK_IS_MENU (menu) || menu == NULL);
 
 	if (button->priv->menu != GTK_MENU (menu)) {
-		if ((button->priv->menu != NULL) && GTK_WIDGET_VISIBLE (button->priv->menu))
+		if ((button->priv->menu != NULL) && gtk_widget_get_visible (GTK_WIDGET (button->priv->menu)))
 			gtk_menu_shell_deactivate (GTK_MENU_SHELL (button->priv->menu));
 
 		button->priv->menu = GTK_MENU (menu);
diff --git a/gthumb/gtk-utils.c b/gthumb/gtk-utils.c
index 2b72e6c..28edd2b 100644
--- a/gthumb/gtk-utils.c
+++ b/gthumb/gtk-utils.c
@@ -60,7 +60,7 @@ create_button (const char *stock_id,
 	hbox = gtk_hbox_new (FALSE, 2);
 	align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
 
-	GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+	gtk_widget_set_can_default (button, TRUE);
 	gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button));
 
 	gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
@@ -1000,15 +1000,15 @@ _gtk_widget_get_screen_size (GtkWidget *widget,
 			     int       *height)
 {
 	GdkScreen    *screen;
-	GdkRectangle  screen_geom;
+	GdkRectangle  geometry;
 
 	screen = gtk_widget_get_screen (widget);
 	gdk_screen_get_monitor_geometry (screen,
-					 gdk_screen_get_monitor_at_window (screen, widget->window),
-					 &screen_geom);
+					 gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget)),
+					 &geometry);
 
-	*width = screen_geom.width;
-	*height = screen_geom.height;
+	*width = geometry.width;
+	*height = geometry.height;
 }
 
 
@@ -1028,7 +1028,7 @@ _gtk_paned_get_position2 (GtkPaned *paned)
 	GtkRequisition  requisition;
 	int             size;
 
-	if (! GTK_WIDGET_VISIBLE (paned))
+	if (! gtk_widget_get_visible (GTK_WIDGET (paned)))
 		return 0;
 
 	pos = gtk_paned_get_position (paned);
@@ -1036,7 +1036,7 @@ _gtk_paned_get_position2 (GtkPaned *paned)
 		return 0;
 
 	w = gtk_widget_get_toplevel (GTK_WIDGET (paned));
-	if (! GTK_WIDGET_TOPLEVEL (w))
+	if (! gtk_widget_is_toplevel (w))
 		return 0;
 
 	gtk_window_get_size (GTK_WINDOW (w), &(requisition.width), &(requisition.height));
@@ -1056,17 +1056,19 @@ void
 _gtk_paned_set_position2 (GtkPaned *paned,
 			  int       pos)
 {
-	GtkWidget *top_level;
-	int        size;
+	GtkWidget     *top_level;
+	GtkAllocation  allocation;
+	int            size;
 
 	top_level = gtk_widget_get_toplevel (GTK_WIDGET (paned));
-	if (! GTK_WIDGET_TOPLEVEL (top_level))
+	if (! gtk_widget_is_toplevel (top_level))
 		return;
 
+	gtk_widget_get_allocation (top_level, &allocation);
 	if (gtk_orientable_get_orientation (GTK_ORIENTABLE (paned)) == GTK_ORIENTATION_HORIZONTAL)
-		size = top_level->allocation.width;
+		size = allocation.width;
 	else
-		size = top_level->allocation.height;
+		size = allocation.height;
 
 	if (pos > 0)
 		gtk_paned_set_position (paned, size - pos);



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