changeset 1810:c416d099a3dc

GTK marks several functions as deprecated The following functions has been replaced and deprecated by version 2.20: - GTK_WIDGET_CAN_FOCUS - GTK_WIDGET_DRAWABLE - GTK_WIDGET_HAS_FOCUS - GTK_WIDGET_HAS_GRAB - GTK_WIDGET_IS_SENSITIVE - GTK_WIDGET_NO_WINDOW - GTK_WIDGET_REALIZED - GTK_WIDGET_SENSITIVE - GTK_WIDGET_STATE - GTK_WIDGET_TOPLEVEL - GTK_WIDGET_VISIBLE
author mow
date Mon, 10 May 2010 11:32:56 +0000
parents e1c18f81e637
children f405ec9b696b
files src/bar.c src/bar_comment.c src/bar_exif.c src/bar_histogram.c src/bar_keywords.c src/bar_sort.c src/cache_maint.c src/cellrenderericon.c src/collect-table.c src/dupe.c src/image.c src/layout.c src/layout_util.c src/logwindow.c src/pan-view.c src/pixbuf-renderer.c src/print.c src/search.c src/ui_misc.c src/ui_tabcomp.c src/ui_tree_edit.c src/ui_utildlg.c src/view_dir_list.c src/view_file.c src/view_file_icon.c
diffstat 25 files changed, 307 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/bar.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/bar.c	Mon May 10 11:32:56 2010 +0000
@@ -457,7 +457,11 @@
 	if (!bd) return;
 
 	WRITE_NL(); WRITE_STRING("<bar ");
+#if GTK_CHECK_VERSION(2,20,0)
+	write_bool_option(outstr, indent, "enabled", gtk_widget_get_visible(bar));
+#else
 	write_bool_option(outstr, indent, "enabled", GTK_WIDGET_VISIBLE(bar));
+#endif
 	write_uint_option(outstr, indent, "width", bd->width);
 	WRITE_STRING(">");
 	
--- a/src/bar_comment.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/bar_comment.c	Mon May 10 11:32:56 2010 +0000
@@ -141,7 +141,11 @@
 	pcd = g_object_get_data(G_OBJECT(bar), "pane_data");
 	if (!pcd) return FALSE;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_has_focus(pcd->comment_view)) return gtk_widget_event(pcd->comment_view, event);
+#else
 	if (GTK_WIDGET_HAS_FOCUS(pcd->comment_view)) return gtk_widget_event(pcd->comment_view, event);
+#endif
 
 	return FALSE;
 }
--- a/src/bar_exif.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/bar_exif.c	Mon May 10 11:32:56 2010 +0000
@@ -301,7 +301,11 @@
 		ExifEntry *ee = g_object_get_data(G_OBJECT(entry), "entry_data");
 		work = work->next;
 
+#if GTK_CHECK_VERSION(2,20,0)
+		if (ee->editable && gtk_widget_has_focus(ee->value_widget)) ret = gtk_widget_event(ee->value_widget, event);
+#else
 		if (ee->editable && GTK_WIDGET_HAS_FOCUS(ee->value_widget)) ret = gtk_widget_event(ee->value_widget, event);
+#endif
 		}
 	g_list_free(list);
 	return ret;
@@ -396,7 +400,11 @@
 		
 		if (entry == new_entry) continue;
 		
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_is_drawable(entry) &&
+#else
 		if (GTK_WIDGET_DRAWABLE(entry) && 
+#endif
 		    gtk_widget_translate_coordinates(pane, entry, x, y, &nx, &ny) &&
 		    ny < entry->allocation.height / 2) break;
 		pos++;
--- a/src/bar_histogram.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/bar_histogram.c	Mon May 10 11:32:56 2010 +0000
@@ -61,7 +61,11 @@
 	/* histmap_get is relatively expensive, run it only when we really need it
 	   and with lower priority than pixbuf_renderer 
 	   FIXME: this does not work for fullscreen*/
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_is_drawable(phd->drawing_area))
+#else
 	if (GTK_WIDGET_DRAWABLE(phd->drawing_area))
+#endif
 		{
 		if (!phd->idle_id)
 			{
@@ -153,7 +157,11 @@
 	if (!phd->pixbuf) return TRUE;
 	
 	gdk_draw_pixbuf(widget->window,
+#if GTK_CHECK_VERSION(2,20,0)
+			widget->style->fg_gc[gtk_widget_get_state(widget)],
+#else
 			widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+#endif
 			phd->pixbuf,
 			0, 0,
 			0, 0,
--- a/src/bar_keywords.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/bar_keywords.c	Mon May 10 11:32:56 2010 +0000
@@ -264,7 +264,11 @@
 	pkd = g_object_get_data(G_OBJECT(bar), "pane_data");
 	if (!pkd) return FALSE;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_has_focus(pkd->keyword_view)) return gtk_widget_event(pkd->keyword_view, event);
+#else
 	if (GTK_WIDGET_HAS_FOCUS(pkd->keyword_view)) return gtk_widget_event(pkd->keyword_view, event);
+#endif
 
 	return FALSE;
 }
--- a/src/bar_sort.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/bar_sort.c	Mon May 10 11:32:56 2010 +0000
@@ -724,7 +724,11 @@
 	if (!sd) return;
 
 	WRITE_NL(); WRITE_STRING("<bar_sort ");
+#if GTK_CHECK_VERSION(2,20,0)
+	write_bool_option(outstr, indent, "enabled", gtk_widget_get_visible(bar));
+#else
 	write_bool_option(outstr, indent, "enabled", GTK_WIDGET_VISIBLE(bar));
+#endif
 	WRITE_INT(*sd, mode);
 	WRITE_INT(*sd, action);
 	WRITE_INT(*sd, selection);
--- a/src/cache_maint.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/cache_maint.c	Mon May 10 11:32:56 2010 +0000
@@ -256,7 +256,11 @@
 {
 	CMData *cm = data;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!gtk_widget_get_sensitive(cm->button_close)) return;
+#else
 	if (!GTK_WIDGET_SENSITIVE(cm->button_close)) return;
+#endif
 
 	cache_maintain_home_close(cm);
 }
@@ -708,7 +712,11 @@
 {
 	CleanData *cd = data;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!gtk_widget_get_sensitive(cd->button_close)) return;
+#else
 	if (!GTK_WIDGET_SENSITIVE(cd->button_close)) return;
+#endif
 
 	cache_manager_render_reset(cd);
 	generic_dialog_close(cd->gd);
@@ -823,7 +831,11 @@
 	CleanData *cd = data;
 	gchar *path;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (cd->list || !gtk_widget_get_sensitive(cd->button_start)) return;
+#else
 	if (cd->list || !GTK_WIDGET_SENSITIVE(cd->button_start)) return;
+#endif
 
 	path = remove_trailing_slash((gtk_entry_get_text(GTK_ENTRY(cd->entry))));
 	parse_out_relatives(path);
@@ -920,7 +932,11 @@
 {
 	CleanData *cd = data;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!gtk_widget_get_sensitive(cd->button_close)) return;
+#else
 	if (!GTK_WIDGET_SENSITIVE(cd->button_close)) return;
+#endif
 
 	generic_dialog_close(cd->gd);
 
@@ -1033,7 +1049,11 @@
 	gchar *path;
 	FileData *dir_fd;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (cd->list || !gtk_widget_get_sensitive(cd->button_start)) return;
+#else
 	if (cd->list || !GTK_WIDGET_SENSITIVE(cd->button_start)) return;
+#endif
 
 	gtk_widget_set_sensitive(cd->button_start, FALSE);
 	gtk_widget_set_sensitive(cd->button_stop, TRUE);
--- a/src/cellrenderericon.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/cellrenderericon.c	Mon May 10 11:32:56 2010 +0000
@@ -20,6 +20,7 @@
  */
 
 #include <stdlib.h>
+#include <gtk/gtk.h> /* To define GTK_CHECK_VERSION */
 #include "cellrenderericon.h"
 #include "intl.h"
 
@@ -646,14 +647,22 @@
 
 	if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_has_focus(widget))
+#else
 		if (GTK_WIDGET_HAS_FOCUS(widget))
+#endif
 			state = GTK_STATE_SELECTED;
 		else
 			state = GTK_STATE_ACTIVE;
 		}
 	else
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_state(widget) == GTK_STATE_INSENSITIVE)
+#else
 		if (GTK_WIDGET_STATE(widget) == GTK_STATE_INSENSITIVE)
+#endif
 			state = GTK_STATE_INSENSITIVE;
 		else
 			state = GTK_STATE_NORMAL;
@@ -756,7 +765,11 @@
 			}
                 }
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (cellicon->focused && gtk_widget_has_focus(widget))
+#else
 	if (cellicon->focused && GTK_WIDGET_HAS_FOCUS(widget))
+#endif
 		{
 		gtk_paint_focus(widget->style, window,
 				state,
--- a/src/collect-table.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/collect-table.c	Mon May 10 11:32:56 2010 +0000
@@ -537,7 +537,11 @@
 
 	gdk_window_get_pointer(NULL, &x, &y, NULL);
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!gtk_widget_get_realized(ct->tip_window)) gtk_widget_realize(ct->tip_window);
+#else
 	if (!GTK_WIDGET_REALIZED(ct->tip_window)) gtk_widget_realize(ct->tip_window);
+#endif
 	gtk_window_move(GTK_WINDOW(ct->tip_window), x + 16, y + 16);
 	gtk_widget_show(ct->tip_window);
 }
@@ -1550,7 +1554,11 @@
 					layout_image_set_collection(NULL, ct->cd, info);
 					}
 				}
+#if GTK_CHECK_VERSION(2,20,0)
+			else if (!gtk_widget_has_focus(ct->listview))
+#else
 			else if (!GTK_WIDGET_HAS_FOCUS(ct->listview))
+#endif
 				{
 				gtk_widget_grab_focus(ct->listview);
 				}
@@ -1716,7 +1724,11 @@
 							     "show_text", ct->show_text, NULL);
 				}
 			}
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_realized(ct->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(ct->listview));
+#else
 		if (GTK_WIDGET_REALIZED(ct->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(ct->listview));
+#endif
 		}
 
 	row = -1;
--- a/src/dupe.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/dupe.c	Mon May 10 11:32:56 2010 +0000
@@ -2216,7 +2216,11 @@
 {
 	GList *list;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_has_focus(dw->second_listview))
+#else
 	if (GTK_WIDGET_HAS_FOCUS(dw->second_listview))
+#endif
 		{
 		list = dupe_listview_get_selection(dw, dw->second_listview);
 		}
@@ -2860,7 +2864,11 @@
 	GList *slist;
 	DupeItem *di = NULL;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	on_second = gtk_widget_has_focus(dw->second_listview);
+#else
 	on_second = GTK_WIDGET_HAS_FOCUS(dw->second_listview);
+#endif
 
 	if (on_second)
 		{
--- a/src/image.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/image.c	Mon May 10 11:32:56 2010 +0000
@@ -905,7 +905,11 @@
 {
 	ImageWindow *imd = data;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	image_focus_paint(imd, gtk_widget_has_focus(widget), &event->area);
+#else
 	image_focus_paint(imd, GTK_WIDGET_HAS_FOCUS(widget), &event->area);
+#endif
 	return TRUE;
 }
 
--- a/src/layout.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/layout.c	Mon May 10 11:32:56 2010 +0000
@@ -1143,7 +1143,11 @@
 {
 	if (!layout_valid(&lw)) return FALSE;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!lw->tools || !gtk_widget_get_visible(lw->tools))
+#else
 	if (!lw->tools || !GTK_WIDGET_VISIBLE(lw->tools))
+#endif
 		{
 		/* use the stored values (sort of breaks success return value) */
 
@@ -1179,7 +1183,11 @@
 
 	if (hide)
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_visible(lw->tools))
+#else
 		if (GTK_WIDGET_VISIBLE(lw->tools))
+#endif
 			{
 			layout_tools_geometry_sync(lw);
 			gtk_widget_hide(lw->tools);
@@ -1187,7 +1195,11 @@
 		}
 	else
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (!gtk_widget_get_visible(lw->tools))
+#else
 		if (!GTK_WIDGET_VISIBLE(lw->tools))
+#endif
 			{
 			gtk_widget_show(lw->tools);
 			if (lw->vf) vf_refresh(lw->vf);
@@ -1713,11 +1725,19 @@
 
 	if (lw->options.toolbar_hidden)
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]);
+#else
 		if (GTK_WIDGET_VISIBLE(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]);
+#endif
 		}
 	else
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (!gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]);
+#else
 		if (!GTK_WIDGET_VISIBLE(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]);
+#endif
 		}
 }
 
--- a/src/layout_util.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/layout_util.c	Mon May 10 11:32:56 2010 +0000
@@ -89,7 +89,11 @@
 	gint x = 0;
 	gint y = 0;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (lw->path_entry && gtk_widget_has_focus(lw->path_entry))
+#else
 	if (lw->path_entry && GTK_WIDGET_HAS_FOCUS(lw->path_entry))
+#endif
 		{
 		if (event->keyval == GDK_Escape && lw->dir_fd)
 			{
@@ -104,7 +108,11 @@
 			return TRUE;
 			}
 		}
+#if GTK_CHECK_VERSION(2,20,0)
+	if (lw->vd && lw->options.dir_view_type == DIRVIEW_TREE && gtk_widget_has_focus(lw->vd->view) &&
+#else
 	if (lw->vd && lw->options.dir_view_type == DIRVIEW_TREE && GTK_WIDGET_HAS_FOCUS(lw->vd->view) &&
+#endif
 	    !layout_key_match(event->keyval) &&
 	    gtk_widget_event(lw->vd->view, (GdkEvent *)event))
 		{
@@ -123,7 +131,11 @@
 */
 
 	if (lw->image &&
+#if GTK_CHECK_VERSION(2,20,0)
+	    (gtk_widget_has_focus(lw->image->widget) || (lw->tools && widget == lw->window) || lw->full_screen) )
+#else
 	    (GTK_WIDGET_HAS_FOCUS(lw->image->widget) || (lw->tools && widget == lw->window) || lw->full_screen) )
+#endif
 		{
 		stop_signal = TRUE;
 		switch (event->keyval)
@@ -2393,7 +2405,11 @@
 
 static gboolean layout_bar_enabled(LayoutWindow *lw)
 {
+#if GTK_CHECK_VERSION(2,20,0)
+	return lw->bar && gtk_widget_get_visible(lw->bar);
+#else
 	return lw->bar && GTK_WIDGET_VISIBLE(lw->bar);
+#endif
 }
 
 static void layout_bar_destroyed(GtkWidget *widget, gpointer data)
@@ -2486,7 +2502,11 @@
 
 static gboolean layout_bar_sort_enabled(LayoutWindow *lw)
 {
+#if GTK_CHECK_VERSION(2,20,0)
+	return lw->bar_sort && gtk_widget_get_visible(lw->bar_sort);
+#else
 	return lw->bar_sort && GTK_WIDGET_VISIBLE(lw->bar_sort);
+#endif
 }
 
 
--- a/src/logwindow.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/logwindow.c	Mon May 10 11:32:56 2010 +0000
@@ -268,7 +268,11 @@
 
 	log_window_insert_text(buffer, &iter, str, logdefs[type].tag);
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_get_visible(text))
+#else
 	if (GTK_WIDGET_VISIBLE(text))
+#endif
 		{
 		GtkTextMark *mark;
 		
--- a/src/pan-view.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/pan-view.c	Mon May 10 11:32:56 2010 +0000
@@ -1212,9 +1212,15 @@
 	pr = PIXBUF_RENDERER(pw->imd->pr);
 	fd = pan_menu_click_fd(pw);
 
+#if GTK_CHECK_VERSION(2,20,0)
+	focused = (pw->fs || gtk_widget_has_focus(GTK_WIDGET(pw->imd->widget)));
+	on_entry = (gtk_widget_has_focus(pw->path_entry) ||
+		    gtk_widget_has_focus(pw->search_entry));
+#else
 	focused = (pw->fs || GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(pw->imd->widget)));
 	on_entry = (GTK_WIDGET_HAS_FOCUS(pw->path_entry) ||
 		    GTK_WIDGET_HAS_FOCUS(pw->search_entry));
+#endif
 
 	if (focused)
 		{
@@ -1967,7 +1973,11 @@
 	PanWindow *pw = data;
 	gboolean visible;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	visible = gtk_widget_get_visible(pw->search_box);
+#else
 	visible = GTK_WIDGET_VISIBLE(pw->search_box);
+#endif
 	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)) == visible) return;
 
 	if (visible)
@@ -1989,7 +1999,11 @@
 
 	if (enable)
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_visible(pw->search_box))
+#else
 		if (GTK_WIDGET_VISIBLE(pw->search_box))
+#endif
 			{
 			gtk_widget_grab_focus(pw->search_entry);
 			}
@@ -2000,9 +2014,17 @@
 		}
 	else
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_visible(pw->search_entry))
+#else
 		if (GTK_WIDGET_VISIBLE(pw->search_entry))
+#endif
 			{
+#if GTK_CHECK_VERSION(2,20,0)
+			if (gtk_widget_has_focus(pw->search_entry))
+#else
 			if (GTK_WIDGET_HAS_FOCUS(pw->search_entry))
+#endif
 				{
 				gtk_widget_grab_focus(GTK_WIDGET(pw->imd->widget));
 				}
--- a/src/pixbuf-renderer.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/pixbuf-renderer.c	Mon May 10 11:32:56 2010 +0000
@@ -704,9 +704,17 @@
 
 static gboolean pixbuf_renderer_expose(GtkWidget *widget, GdkEventExpose *event)
 {
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_is_drawable(widget))
+#else
 	if (GTK_WIDGET_DRAWABLE(widget))
+#endif
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_has_window(widget))
+#else
 		if (!GTK_WIDGET_NO_WINDOW(widget))
+#endif
 			{
 			if (event->window != widget->window)
 				{
@@ -927,18 +935,30 @@
 
 			if (it)
 				{
+#if GTK_CHECK_VERSION(2,20,0)
+				gdk_draw_drawable(pr->overlay_buffer, box->style->fg_gc[gtk_widget_get_state(box)],
+#else
 				gdk_draw_drawable(pr->overlay_buffer, box->style->fg_gc[GTK_WIDGET_STATE(box)],
+#endif
 						  it->pixmap,
 						  rx - (pr->x_offset + (it->x - pr->x_scroll)),
 						  ry - (pr->y_offset + (it->y - pr->y_scroll)),
 						  0, 0, rw, rh);
 				gdk_draw_pixbuf(pr->overlay_buffer,
+#if GTK_CHECK_VERSION(2,20,0)
+						box->style->fg_gc[gtk_widget_get_state(box)],
+#else
 						box->style->fg_gc[GTK_WIDGET_STATE(box)],
+#endif
 						od->pixbuf,
 						rx - px, ry - py,
 						0, 0, rw, rh,
 						pr->dither_quality, rx, ry);
+#if GTK_CHECK_VERSION(2,20,0)
+				gdk_draw_drawable(od->window, box->style->fg_gc[gtk_widget_get_state(box)],
+#else
 				gdk_draw_drawable(od->window, box->style->fg_gc[GTK_WIDGET_STATE(box)],
+#endif
 						  pr->overlay_buffer,
 						  0, 0,
 						  rx - px, ry - py, rw, rh);
@@ -957,15 +977,27 @@
 					sh = MIN(ry + rh - sy, pr->tile_height);
 
 					gdk_draw_rectangle(pr->overlay_buffer,
+#if GTK_CHECK_VERSION(2,20,0)
+							   box->style->bg_gc[gtk_widget_get_state(box)], TRUE,
+#else
 							   box->style->bg_gc[GTK_WIDGET_STATE(box)], TRUE,
+#endif
 							   0, 0, sw, sh);
 					gdk_draw_pixbuf(pr->overlay_buffer,
+#if GTK_CHECK_VERSION(2,20,0)
+							box->style->fg_gc[gtk_widget_get_state(box)],
+#else
 							box->style->fg_gc[GTK_WIDGET_STATE(box)],
+#endif
 							od->pixbuf,
 							sx - px, sy - py,
 							0, 0, sw, sh,
 							pr->dither_quality, sx, sy);
+#if GTK_CHECK_VERSION(2,20,0)
+					gdk_draw_drawable(od->window, box->style->fg_gc[gtk_widget_get_state(box)],
+#else
 					gdk_draw_drawable(od->window, box->style->fg_gc[GTK_WIDGET_STATE(box)],
+#endif
 							  pr->overlay_buffer,
 							  0, 0,
 							  sx - px, sy - py, sw, sh);
@@ -1423,7 +1455,11 @@
 
 	gtk_widget_set_style(widget, style);
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_get_visible(widget)) pr_border_clear(pr);
+#else
 	if (GTK_WIDGET_VISIBLE(widget)) pr_border_clear(pr);
+#endif
 }
 
 
@@ -1690,7 +1726,11 @@
 				else /* (pr->zoom == 1.0 || pr->scale == 1.0) */
 					{
 					gdk_draw_pixbuf(it->pixmap,
+#if GTK_CHECK_VERSION(2,20,0)
+							box->style->fg_gc[gtk_widget_get_state(box)],
+#else
 							box->style->fg_gc[GTK_WIDGET_STATE(box)],
+#endif
 							st->pixbuf,
 							rx - st->x, ry - st->y,
 							rx - it->x, ry - it->y,
@@ -2624,7 +2664,11 @@
 				{
 				/* faster, simple, base orientation, no postprocessing */
 				gdk_draw_pixbuf(it->pixmap,
+#if GTK_CHECK_VERSION(2,20,0)
+						box->style->fg_gc[gtk_widget_get_state(box)],
+#else
 						box->style->fg_gc[GTK_WIDGET_STATE(box)],
+#endif
 						pr->pixbuf,
 						it->x + x, it->y + y,
 						x, y,
@@ -2714,7 +2758,11 @@
 			pr->func_post_process(pr, &it->pixbuf, x, y, w, h, pr->post_process_user_data);
 
 		gdk_draw_pixbuf(it->pixmap,
+#if GTK_CHECK_VERSION(2,20,0)
+				box->style->fg_gc[gtk_widget_get_state(box)],
+#else
 				box->style->fg_gc[GTK_WIDGET_STATE(box)],
+#endif
 				it->pixbuf,
 				x, y,
 				x, y,
@@ -2742,7 +2790,11 @@
 
 	box = GTK_WIDGET(pr);
 
+#if GTK_CHECK_VERSION(2,20,0)
+	gdk_draw_drawable(box->window, box->style->fg_gc[gtk_widget_get_state(box)],
+#else
 	gdk_draw_drawable(box->window, box->style->fg_gc[GTK_WIDGET_STATE(box)],
+#endif
 			  it->pixmap, x, y,
 			  pr->x_offset + (it->x - pr->x_scroll) + x, pr->y_offset + (it->y - pr->y_scroll) + y, w, h);
 
@@ -2862,7 +2914,11 @@
 		fast = FALSE;
 		}
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_get_realized(pr))
+#else
 	if (GTK_WIDGET_REALIZED(pr))
+#endif
 		{
 		if (pr_tile_is_visible(pr, qd->it))
 			{
@@ -3848,7 +3904,11 @@
 		}
 
 	parent = gtk_widget_get_parent(widget);
+#if GTK_CHECK_VERSION(2,20,0)
+	if (widget && gtk_widget_get_can_focus(parent))
+#else
 	if (widget && GTK_WIDGET_CAN_FOCUS(parent))
+#endif
 		{
 		gtk_widget_grab_focus(parent);
 		}
@@ -3868,7 +3928,11 @@
 		return TRUE;
 		}
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gdk_pointer_is_grabbed() && gtk_widget_has_grab(pr))
+#else
 	if (gdk_pointer_is_grabbed() && GTK_WIDGET_HAS_GRAB(pr))
+#endif
 		{
 		gtk_grab_remove(widget);
 		gdk_pointer_ungrab(bevent->time);
@@ -3984,7 +4048,11 @@
 
 		box = GTK_WIDGET(pr);
 
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_realized(box))
+#else
 		if (GTK_WIDGET_REALIZED(box))
+#endif
 			{
 			gdk_window_clear(box->window);
 			pr_overlay_draw(pr, 0, 0, pr->window_width, pr->window_height, NULL);
--- a/src/print.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/print.c	Mon May 10 11:32:56 2010 +0000
@@ -1959,7 +1959,11 @@
 	GtkWidget *label;
 	gchar *buf;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_get_visible(pw->dialog->dialog)) parent = pw->dialog->dialog;
+#else
 	if (GTK_WIDGET_VISIBLE(pw->dialog->dialog)) parent = pw->dialog->dialog;
+#endif
 
 	gd = generic_dialog_new(_("Printing error"), "print_warning",
 				parent, TRUE, NULL, NULL);
@@ -2481,7 +2485,11 @@
 		pw->job_pixbuf = NULL;
 		}
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (pw->dialog && !gtk_widget_get_visible(pw->dialog->dialog))
+#else
 	if (pw->dialog && !GTK_WIDGET_VISIBLE(pw->dialog->dialog))
+#endif
 		{
 		g_idle_add_full(G_PRIORITY_HIGH_IDLE, print_job_close_finish_cb, pw, NULL);
 		}
--- a/src/search.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/search.c	Mon May 10 11:32:56 2010 +0000
@@ -2361,11 +2361,19 @@
 {
 	if (visible)
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (!gtk_widget_get_visible(widget)) gtk_widget_show(widget);
+#else
 		if (!GTK_WIDGET_VISIBLE(widget)) gtk_widget_show(widget);
+#endif
 		}
 	else
 		{
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_visible(widget)) gtk_widget_hide(widget);
+#else
 		if (GTK_WIDGET_VISIBLE(widget)) gtk_widget_hide(widget);
+#endif
 		}
 }
 
--- a/src/ui_misc.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/ui_misc.c	Mon May 10 11:32:56 2010 +0000
@@ -551,7 +551,11 @@
 {
 	GtkWidget *widget = data;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	gtk_widget_set_sensitive(widget, gtk_widget_is_sensitive(watch));
+#else
 	gtk_widget_set_sensitive(widget, GTK_WIDGET_IS_SENSITIVE(watch));
+#endif
 }
 
 void pref_link_sensitivity(GtkWidget *widget, GtkWidget *watch)
@@ -876,7 +880,11 @@
 {
 	if (!ds->window) return;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_has_grab(ds->window))
+#else
 	if (GTK_WIDGET_HAS_GRAB(ds->window))
+#endif
 		{
 		gtk_grab_remove(ds->window);
 		gdk_keyboard_ungrab(GDK_CURRENT_TIME);
@@ -1289,7 +1297,11 @@
 
 	if (bevent->button != MOUSE_BUTTON_LEFT) return FALSE;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gdk_pointer_is_grabbed() && gtk_widget_has_grab(sd->sizer))
+#else
 	if (gdk_pointer_is_grabbed() && GTK_WIDGET_HAS_GRAB(sd->sizer))
+#endif
 		{
 		gtk_grab_remove(sd->sizer);
 		gdk_pointer_ungrab(bevent->time);
--- a/src/ui_tabcomp.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/ui_tabcomp.c	Mon May 10 11:32:56 2010 +0000
@@ -206,7 +206,11 @@
 	TabCompData *td = data;
 	GtkWidget *child;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!gtk_widget_get_visible(widget)) return;
+#else
 	if (!GTK_WIDGET_VISIBLE(widget)) return;
+#endif
 
 	child = gtk_bin_get_child(GTK_BIN(widget));
 	if (GTK_IS_LABEL(child)) {
@@ -646,7 +650,11 @@
 
 	if (!td) return;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!gtk_widget_has_focus(entry))
+#else
 	if (!GTK_WIDGET_HAS_FOCUS(entry))
+#endif
 		{
 		gtk_widget_grab_focus(entry);
 		}
--- a/src/ui_tree_edit.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/ui_tree_edit.c	Mon May 10 11:32:56 2010 +0000
@@ -184,7 +184,11 @@
 	GList *work;
 
 	if (!edit_func) return FALSE;
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!gtk_widget_get_visible(tree)) return FALSE;
+#else
 	if (!GTK_WIDGET_VISIBLE(tree)) return FALSE;
+#endif
 
 	tcolumn = gtk_tree_view_get_column(tree, column);
 	if (!tcolumn) return FALSE;
--- a/src/ui_utildlg.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/ui_utildlg.c	Mon May 10 11:32:56 2010 +0000
@@ -62,7 +62,11 @@
 {
 	GenericDialog *gd = data;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (event->keyval == GDK_Return && gtk_widget_has_focus(widget)
+#else
 	if (event->keyval == GDK_Return && GTK_WIDGET_HAS_FOCUS(widget)
+#endif
 	    && gd->default_cb)
 		{
 		gboolean auto_close;
@@ -234,7 +238,11 @@
 			GtkWidget *top;
 
 			top = gtk_widget_get_toplevel(parent);
+#if GTK_CHECK_VERSION(2,20,0)
+			if (GTK_IS_WINDOW(top) && gtk_widget_is_toplevel(top)) window = GTK_WINDOW(top);
+#else
 			if (GTK_IS_WINDOW(top) && GTK_WIDGET_TOPLEVEL(top)) window = GTK_WINDOW(top);
+#endif
 			}
 
 		if (window) gtk_window_set_transient_for(GTK_WINDOW(gd->dialog), window);
--- a/src/view_dir_list.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/view_dir_list.c	Mon May 10 11:32:56 2010 +0000
@@ -96,7 +96,11 @@
 {
 	GtkTreeIter iter;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_get_realized(vd->view) && vd_find_row(vd, fd, &iter))
+#else
 	if (GTK_WIDGET_REALIZED(vd->view) && vd_find_row(vd, fd, &iter))
+#endif
 		{
 		GtkTreeModel *store;
 		GtkTreePath *tpath;
@@ -107,7 +111,11 @@
 		gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE);
 		gtk_tree_path_free(tpath);
 
+#if GTK_CHECK_VERSION(2,20,0)
+		if (!gtk_widget_has_focus(vd->view)) gtk_widget_grab_focus(vd->view);
+#else
 		if (!GTK_WIDGET_HAS_FOCUS(vd->view)) gtk_widget_grab_focus(vd->view);
+#endif
 		}
 }
 
@@ -331,7 +339,11 @@
 		return ret;
 		}
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_get_realized(vd->view))
+#else
 	if (GTK_WIDGET_REALIZED(vd->view))
+#endif
 		{
 		gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(vd->view), 0, 0);
 		}
--- a/src/view_file.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/view_file.c	Mon May 10 11:32:56 2010 +0000
@@ -878,7 +878,11 @@
 {
 	FileData *fd = NULL;
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!gtk_widget_get_realized(vf->listview))
+#else
 	if (!GTK_WIDGET_REALIZED(vf->listview))
+#endif
 		{
 		vf_thumb_status(vf, 0.0, NULL);
 		return FALSE;
--- a/src/view_file_icon.c	Sun Feb 28 22:55:37 2010 +0000
+++ b/src/view_file_icon.c	Mon May 10 11:32:56 2010 +0000
@@ -431,7 +431,11 @@
 
 	gdk_window_get_pointer(NULL, &x, &y, NULL);
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (!gtk_widget_get_realized(VFICON(vf)->tip_window)) gtk_widget_realize(VFICON(vf)->tip_window);
+#else
 	if (!GTK_WIDGET_REALIZED(VFICON(vf)->tip_window)) gtk_widget_realize(VFICON(vf)->tip_window);
+#endif
 	gtk_window_move(GTK_WINDOW(VFICON(vf)->tip_window), x + 16, y + 16);
 	gtk_widget_show(VFICON(vf)->tip_window);
 }
@@ -451,7 +455,11 @@
 
 	window = gtk_widget_get_toplevel(vf->listview);
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (gtk_widget_get_sensitive(window) &&
+#else
 	if (GTK_WIDGET_SENSITIVE(window) &&
+#endif
 	    GTK_WINDOW(window)->has_focus)
 		{
 		tip_show(vf);
@@ -1440,7 +1448,11 @@
 	switch (bevent->button)
 		{
 		case MOUSE_BUTTON_LEFT:
+#if GTK_CHECK_VERSION(2,20,0)
+			if (!gtk_widget_has_focus(vf->listview))
+#else
 			if (!GTK_WIDGET_HAS_FOCUS(vf->listview))
+#endif
 				{
 				gtk_widget_grab_focus(vf->listview);
 				}
@@ -1603,7 +1615,11 @@
 
 	store = gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview));
 
+#if GTK_CHECK_VERSION(2,20,0)
+	if (keep_position && gtk_widget_get_realized(vf->listview) &&
+#else
 	if (keep_position && GTK_WIDGET_REALIZED(vf->listview) &&
+#endif
 	    gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vf->listview), 0, 0, &tpath, NULL, NULL, NULL))
 		{
 		GtkTreeIter iter;
@@ -1654,7 +1670,11 @@
 							     NULL);
 				}
 			}
+#if GTK_CHECK_VERSION(2,20,0)
+		if (gtk_widget_get_realized(vf->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(vf->listview));
+#else
 		if (GTK_WIDGET_REALIZED(vf->listview)) gtk_tree_view_columns_autosize(GTK_TREE_VIEW(vf->listview));
+#endif
 		}
 
 	r = -1;