changeset 1043:5fc64d6252e7

Replaced gtk depreceated code.
author bruclik
date Sun, 07 Sep 2008 23:01:30 +0000
parents e59a9c96d290
children ea4e0c2df854
files src/collect-table.c src/dupe.c src/image-load.c src/image.c src/layout.c src/layout_image.c src/layout_util.h src/pixbuf-renderer.c src/pixbuf_util.c src/thumb.c src/ui_misc.c src/ui_tabcomp.c src/ui_tree_edit.c
diffstat 13 files changed, 96 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/collect-table.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/collect-table.c	Sun Sep 07 23:01:30 2008 +0000
@@ -1337,7 +1337,7 @@
 
 		pb = gdk_pixbuf_new_from_xpm_data((const gchar **)marker_xpm);
 		gdk_pixbuf_render_pixmap_and_mask(pb, &pixmap, &mask, 128);
-		gdk_pixbuf_unref(pb);
+		g_object_unref(pb);
 
 		gdk_drawable_get_size(pixmap, &w, &h);
 
--- a/src/dupe.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/dupe.c	Sun Sep 07 23:01:30 2008 +0000
@@ -1953,7 +1953,7 @@
 		gtk_box_pack_start(GTK_BOX(gd->vbox), image, FALSE, FALSE, 0);
 		gtk_widget_show(image);
 
-		gdk_pixbuf_unref(pixbuf);
+		g_object_unref(pixbuf);
 		}
 
 	gtk_widget_show(gd->dialog);
--- a/src/image-load.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/image-load.c	Sun Sep 07 23:01:30 2008 +0000
@@ -172,7 +172,8 @@
 		il->area_param_list = g_list_delete_link(il->area_param_list, il->area_param_list);
 		}
 
-	if (il->pixbuf) gdk_pixbuf_unref(il->pixbuf);
+	if (il->pixbuf) g_object_unref(il->pixbuf);
+
 	file_data_unref(il->fd);
 #ifdef HAVE_GTHREAD
 	g_mutex_free(il->data_mutex);
@@ -317,9 +318,11 @@
 		return;
 		}
 
-	if (il->pixbuf) gdk_pixbuf_unref(il->pixbuf);
+	if (il->pixbuf) g_object_unref(il->pixbuf);
+
 	il->pixbuf = pb;
-	if (il->pixbuf) gdk_pixbuf_ref(il->pixbuf);
+	if (il->pixbuf) g_object_ref(il->pixbuf);
+
 	g_mutex_unlock(il->data_mutex);
 }
 
--- a/src/image.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/image.c	Sun Sep 07 23:01:30 2008 +0000
@@ -540,7 +540,7 @@
 
 	if (options->image.enable_read_ahead && imd->image_fd && !imd->image_fd->pixbuf && image_loader_get_pixbuf(imd->il))
 		{
-		imd->image_fd->pixbuf = gdk_pixbuf_ref(image_loader_get_pixbuf(imd->il));
+		imd->image_fd->pixbuf = g_object_ref(image_loader_get_pixbuf(imd->il));
 		image_cache_set(imd, imd->image_fd);
 		}
 
@@ -1619,10 +1619,19 @@
 	if (frame)
 		{
 		imd->frame = gtk_frame_new(NULL);
-		gtk_widget_ref(imd->pr);
+#if GTK_CHECK_VERSION(2,12,0)
+        g_object_ref(imd->pr);
+#else
+        gtk_widget_ref(imd->pr);
+#endif
 		if (imd->has_frame != -1) gtk_container_remove(GTK_CONTAINER(imd->widget), imd->pr);
 		gtk_container_add(GTK_CONTAINER(imd->frame), imd->pr);
-		gtk_widget_unref(imd->pr);
+
+#if GTK_CHECK_VERSION(2,12,0)
+        g_object_unref(imd->pr);
+#else
+        gtk_widget_unref(imd->pr);
+#endif
 		g_signal_connect(G_OBJECT(imd->frame), "expose_event",
 		    		 G_CALLBACK(selectable_frame_expose_cb), NULL);
 
@@ -1641,7 +1650,11 @@
 		}
 	else
 		{
+#if GTK_CHECK_VERSION(2,12,0)
+		g_object_ref(imd->pr);
+#else
 		gtk_widget_ref(imd->pr);
+#endif
 		if (imd->frame)
 			{
 			gtk_container_remove(GTK_CONTAINER(imd->frame), imd->pr);
@@ -1649,7 +1662,12 @@
 			imd->frame = NULL;
 			}
 		gtk_box_pack_start_defaults(GTK_BOX(imd->widget), imd->pr);
-		gtk_widget_unref(imd->pr);
+
+#if GTK_CHECK_VERSION(2,12,0)
+	g_object_unref(imd->pr);
+#else
+	gtk_widget_unref(imd->pr);
+#endif
 		}
 
 	gtk_widget_show(imd->pr);
--- a/src/layout.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/layout.c	Sun Sep 07 23:01:30 2008 +0000
@@ -253,7 +253,11 @@
 static void layout_sort_menu_hide_cb(GtkWidget *widget, gpointer data)
 {
 	/* destroy the menu */
+#if GTK_CHECK_VERSION(2,12,0)
+	g_object_unref(widget);
+#else
 	gtk_widget_unref(GTK_WIDGET(widget));
+#endif
 }
 
 static void layout_sort_button_press_cb(GtkWidget *widget, gpointer data)
@@ -1985,7 +1989,7 @@
 
 		pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO);
 		image_change_pixbuf(lw->image, pixbuf, 1.0);
-		gdk_pixbuf_unref(pixbuf);
+		g_object_unref(pixbuf);
 		}
 
 	if (geometry)
--- a/src/layout_image.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/layout_image.c	Sun Sep 07 23:01:30 2008 +0000
@@ -1507,8 +1507,11 @@
 		{
 		lw->split_images[i] = image_new(TRUE);
 
+#if GTK_CHECK_VERSION(2,12,0)
+		g_object_ref(lw->split_images[i]->widget);
+#else
 		gtk_widget_ref(lw->split_images[i]->widget);
-
+#endif
 		image_background_set_color(lw->split_images[i], options->image.use_custom_border_color ? &options->image.border_color : NULL);
 
 		image_auto_refresh_enable(lw->split_images[i], TRUE);
@@ -1599,7 +1602,11 @@
 		{
 		if (lw->split_images[i])
 			{
+#if GTK_CHECK_VERSION(2,12,0)
+			g_object_unref(lw->split_images[i]->widget);
+#else
 			gtk_widget_unref(lw->split_images[i]->widget);
+#endif
 			lw->split_images[i] = NULL;
 			}
 		}
@@ -1653,7 +1660,11 @@
 		{
 		if (lw->split_images[i])
 			{
+#if GTK_CHECK_VERSION(2,12,0)
+			g_object_unref(lw->split_images[i]->widget);
+#else
 			gtk_widget_unref(lw->split_images[i]->widget);
+#endif
 			lw->split_images[i] = NULL;
 			}
 		}
@@ -1729,7 +1740,11 @@
 		{
 		if (lw->split_images[i])
 			{
+#if GTK_CHECK_VERSION(2,12,0)
+			g_object_unref(lw->split_images[i]->widget);
+#else
 			gtk_widget_unref(lw->split_images[i]->widget);
+#endif
 			lw->split_images[i] = NULL;
 			}
 		}
--- a/src/layout_util.h	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/layout_util.h	Sun Sep 07 23:01:30 2008 +0000
@@ -34,9 +34,7 @@
 void layout_actions_add_window(LayoutWindow *lw, GtkWidget *window);
 GtkWidget *layout_actions_menu_bar(LayoutWindow *lw);
 
-GtkWidget *layout_button(GtkWidget *box, gchar **pixmap_data, const gchar *stock_id, gint toggle,
-			 GtkTooltips *tooltips, const gchar *tip_text,
-			 GtkSignalFunc func, gpointer data);
+
 GtkWidget *layout_button_bar(LayoutWindow *lw);
 
 void layout_keyboard_init(LayoutWindow *lw, GtkWidget *window);
--- a/src/pixbuf-renderer.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/pixbuf-renderer.c	Sun Sep 07 23:01:30 2008 +0000
@@ -530,8 +530,9 @@
 	pr_queue_clear(pr);
 	pr_tile_free_all(pr);
 
+
 	if (pr->pixbuf) g_object_unref(pr->pixbuf);
-	if (pr->spare_tile) gdk_pixbuf_unref(pr->spare_tile);
+	if (pr->spare_tile) g_object_unref(pr->spare_tile);
 
 	pr_scroller_timer_set(pr, FALSE);
 	pr_overlay_list_clear(pr);
@@ -1837,7 +1838,7 @@
 {
 	if (!it) return;
 
-	if (it->pixbuf) gdk_pixbuf_unref(it->pixbuf);
+	if (it->pixbuf) g_object_unref(it->pixbuf);
 	if (it->pixmap) g_object_unref(it->pixmap);
 
 	g_free(it);
--- a/src/pixbuf_util.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/pixbuf_util.c	Sun Sep 07 23:01:30 2008 +0000
@@ -330,7 +330,7 @@
 			}
 		}
 
-	gdk_pixbuf_unref(buffer);
+	g_object_unref(buffer);
 
 #if 0
 	/* this is the simple version of rotation (roughly 2-4x slower) */
@@ -472,7 +472,7 @@
 			dest = gdk_pixbuf_copy(pixbuf);
 			break;
 		}
-	if (tmp) gdk_pixbuf_unref(tmp);
+	if (tmp) g_object_unref(tmp);
 	return dest;
 
 }
--- a/src/thumb.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/thumb.c	Sun Sep 07 23:01:30 2008 +0000
@@ -214,12 +214,13 @@
 			{
 			if (tl->fd->thumb_pixbuf) g_object_unref(tl->fd->thumb_pixbuf);
 			tl->fd->thumb_pixbuf = pixbuf;
-			gdk_pixbuf_ref(tl->fd->thumb_pixbuf);
+
+			g_object_ref(tl->fd->thumb_pixbuf);
 			}
 		save = image_loader_get_shrunk(il);
 		}
 
-	if (rotated) gdk_pixbuf_unref(rotated);
+	if (rotated) g_object_unref(rotated);
 	
 	/* save it ? */
 	if (tl->cache_enable && save)
@@ -651,7 +652,7 @@
 
 			tmp = pixbuf;
 			pixbuf = gdk_pixbuf_scale_simple(tmp, width, height, GDK_INTERP_NEAREST);
-			gdk_pixbuf_unref(tmp);
+			g_object_unref(tmp);
 			}
 
 		return pixbuf;
--- a/src/ui_misc.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/ui_misc.c	Sun Sep 07 23:01:30 2008 +0000
@@ -718,6 +718,8 @@
 	return spin;
 }
 
+#if ! GTK_CHECK_VERSION(2,12,0)
+
 static void pref_toolbar_destroy_cb(GtkWidget *widget, gpointer data)
 {
 	GtkTooltips *tips = data;
@@ -725,11 +727,15 @@
 	g_object_unref(G_OBJECT(tips));
 }
 
+#endif
+
 GtkWidget *pref_toolbar_new(GtkWidget *parent_box, GtkToolbarStyle style)
 {
 	GtkWidget *tbar;
+#if ! GTK_CHECK_VERSION(2,12,0)
 	GtkTooltips *tips;
-
+#endif
+	
 	tbar = gtk_toolbar_new();
 	gtk_toolbar_set_style(GTK_TOOLBAR(tbar), style);
 
@@ -739,23 +745,25 @@
 		gtk_widget_show(tbar);
 		}
 
+#if ! GTK_CHECK_VERSION(2,12,0)
 	tips = gtk_tooltips_new();
 
 	/* take ownership of tooltips */
-#ifdef GTK_OBJECT_FLOATING
+#  ifdef GTK_OBJECT_FLOATING
 	/* GTK+ < 2.10 */
 	g_object_ref(G_OBJECT(tips));
 	gtk_object_sink(GTK_OBJECT(tips));
-#else
+#  else
 	/* GTK+ >= 2.10 */
 	g_object_ref_sink(G_OBJECT(tips));
-#endif
+#  endif
 
 	g_object_set_data(G_OBJECT(tbar), "tooltips", tips);
 	g_signal_connect(G_OBJECT(tbar), "destroy",
 			 G_CALLBACK(pref_toolbar_destroy_cb), tips);
 
 	gtk_tooltips_enable(tips);
+#endif
 
 	return tbar;
 }
@@ -799,11 +807,18 @@
 
 	if (description)
 		{
+
+#if GTK_CHECK_VERSION(2,12,0)
+
+		gtk_widget_set_tooltip_text(GTK_TOOL_ITEM(item), description);
+			
+#else
 		GtkTooltips *tips;
 
 		tips = g_object_get_data(G_OBJECT(toolbar), "tooltips");
 		gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(item), tips, description, NULL);
-		}
+#endif
+	}
 
 	return item;
 }
--- a/src/ui_tabcomp.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/ui_tabcomp.c	Sun Sep 07 23:01:30 2008 +0000
@@ -205,8 +205,11 @@
 		/*close the menu */
 		gtk_menu_popdown(GTK_MENU(widget));
 		/* doing this does not emit the "selection done" signal, unref it ourselves */
+#if GTK_CHECK_VERSION(2,12,0)
+		g_object_unref(widget);
+#else
 		gtk_widget_unref(widget);
-
+#endif
 		return TRUE;
 		}
 
@@ -634,7 +637,8 @@
 
 	pixbuf = gdk_pixbuf_new_from_inline(-1, icon_tabcomp, FALSE, NULL);
 	icon = gtk_image_new_from_pixbuf(pixbuf);
-	gdk_pixbuf_unref(pixbuf);
+	g_object_unref(pixbuf);
+
 	gtk_container_add(GTK_CONTAINER(button), icon);
 	gtk_widget_show(icon);
 
--- a/src/ui_tree_edit.c	Sun Sep 07 19:42:19 2008 +0000
+++ b/src/ui_tree_edit.c	Sun Sep 07 23:01:30 2008 +0000
@@ -266,7 +266,11 @@
 	 * use x_offset instead for X scroll (sigh)
 	 */
 	gtk_tree_view_get_cell_area(widget, tpath, tv_column, &rect);
+#if GTK_CHECK_VERSION(2,12,0)
+	gtk_tree_view_convert_bin_window_to_widget_coords(widget, 0, 0, &x_offset, &y_offset);
+#else
 	gtk_tree_view_tree_to_widget_coords(widget, 0, 0, &x_offset, &y_offset);
+#endif
 	gdk_window_get_origin(GTK_WIDGET(widget)->window, &x_origin, &y_origin);
 
 	if (gtk_tree_view_get_headers_visible(widget))
@@ -358,7 +362,12 @@
 	gtk_tree_view_get_cell_area(widget, tpath, NULL, &crect);
 	gtk_tree_path_free(tpath);
 
+
+#if GTK_CHECK_VERSION(2,12,0)
+	gtk_tree_view_convert_bin_window_to_widget_coords(widget, crect.x, crect.y, &cx, &cy);
+#else
 	gtk_tree_view_widget_to_tree_coords(widget, crect.x, crect.y, &cx, &cy);
+#endif
 
 	if (fully_visible)
 		{