[libgnomecanvas] Cleanups to remove deprecated api
- From: Andre Klapper <aklapper src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgnomecanvas] Cleanups to remove deprecated api
- Date: Sat, 8 Aug 2009 13:39:09 +0000 (UTC)
commit b7b5fc64b1699aac5401e8217131d0c431dd5abf
Author: Kjartan Maraas <kmaraas gnome org>
Date: Sat Aug 8 15:36:24 2009 +0200
Cleanups to remove deprecated api
demos/canvas-curve.c | 2 +-
demos/canvas-primitives.c | 14 +++++++-------
libgnomecanvas/gnome-canvas-bpath.c | 2 +-
libgnomecanvas/gnome-canvas-line.c | 18 +++++++++---------
libgnomecanvas/gnome-canvas-pixbuf.c | 24 +++++++++++-------------
libgnomecanvas/gnome-canvas-polygon.c | 3 ---
libgnomecanvas/gnome-canvas-rich-text.c | 24 ++++++++++++------------
libgnomecanvas/gnome-canvas-shape.c | 28 ++++++++++++++--------------
libgnomecanvas/gnome-canvas-text.c | 18 +++++++++---------
libgnomecanvas/gnome-canvas.c | 29 +++++++++++++----------------
10 files changed, 77 insertions(+), 85 deletions(-)
---
diff --git a/demos/canvas-curve.c b/demos/canvas-curve.c
index 76227ba..9afdb8a 100644
--- a/demos/canvas-curve.c
+++ b/demos/canvas-curve.c
@@ -234,7 +234,7 @@ create_canvas (gboolean aa)
GtkWidget *canvas = NULL;
GtkWidget *frame;
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
+ gtk_widget_push_colormap (gdk_rgb_get_colormap ());
if (aa)
canvas = gnome_canvas_new_aa ();
diff --git a/demos/canvas-primitives.c b/demos/canvas-primitives.c
index 1f52b75..a79afcd 100644
--- a/demos/canvas-primitives.c
+++ b/demos/canvas-primitives.c
@@ -236,7 +236,7 @@ setup_rectangles (GnomeCanvasGroup *root)
"outline_color", "black",
"width_units", 4.0,
NULL));
- gdk_bitmap_unref (stipple);
+ g_object_unref (stipple);
}
setup_item (gnome_canvas_item_new (root,
@@ -299,7 +299,7 @@ setup_ellipses (GnomeCanvasGroup *root)
"outline_color", "black",
"width_pixels", 0,
NULL));
- gdk_bitmap_unref (stipple);
+ g_object_unref (stipple);
}
}
@@ -355,7 +355,7 @@ setup_texts (GnomeCanvasGroup *root)
"fill_color", "blue",
"fill_stipple", stipple,
NULL);
- gdk_bitmap_unref (stipple);
+ g_object_unref (stipple);
}
gnome_canvas_item_new (make_anchor (root, 470.0, 75.0),
@@ -536,7 +536,7 @@ make_hilbert (GnomeCanvasGroup *root)
"cap_style", GDK_CAP_PROJECTING,
"join_style", GDK_JOIN_MITER,
NULL));
- gdk_bitmap_unref (stipple);
+ g_object_unref (stipple);
}
gnome_canvas_points_free (points);
@@ -658,7 +658,7 @@ setup_polygons (GnomeCanvasGroup *root)
"fill_stipple", stipple,
"outline_color", "black",
NULL));
- gdk_bitmap_unref (stipple);
+ g_object_unref (stipple);
}
gnome_canvas_points_free (points);
@@ -769,7 +769,7 @@ create_canvas_primitives (gint aa)
/* Create the canvas */
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
+ gtk_widget_push_colormap (gdk_rgb_get_colormap ());
if (aa)
canvas = gnome_canvas_new_aa ();
else
@@ -814,7 +814,7 @@ create_canvas_primitives (gint aa)
gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
gtk_widget_show (w);
- adj = GTK_ADJUSTMENT (gtk_adjustment_new (1.00, 0.05, 5.00, 0.05, 0.50, 0.50));
+ adj = GTK_ADJUSTMENT (gtk_adjustment_new (1.00, 0.05, 5.00, 0.05, 0.50, 0));
g_signal_connect (adj, "value_changed",
G_CALLBACK (zoom_changed),
canvas);
diff --git a/libgnomecanvas/gnome-canvas-bpath.c b/libgnomecanvas/gnome-canvas-bpath.c
index 48b11c1..a1cee22 100644
--- a/libgnomecanvas/gnome-canvas-bpath.c
+++ b/libgnomecanvas/gnome-canvas-bpath.c
@@ -50,7 +50,7 @@ static void gnome_canvas_bpath_update (GnomeCanvasItem *item, double *aff
static GnomeCanvasShapeClass *parent_class;
-GtkType
+GType
gnome_canvas_bpath_get_type (void)
{
static GType bpath_type;
diff --git a/libgnomecanvas/gnome-canvas-line.c b/libgnomecanvas/gnome-canvas-line.c
index 8546c44..13ba7c7 100644
--- a/libgnomecanvas/gnome-canvas-line.c
+++ b/libgnomecanvas/gnome-canvas-line.c
@@ -309,7 +309,7 @@ gnome_canvas_line_destroy (GtkObject *object)
line->last_coords = NULL;
if (line->stipple)
- gdk_bitmap_unref (line->stipple);
+ g_object_unref (line->stipple);
line->stipple = NULL;
if (line->fill_svp)
@@ -622,11 +622,11 @@ static void
set_stipple (GnomeCanvasLine *line, GdkBitmap *stipple, int reconfigure)
{
if (line->stipple && !reconfigure)
- gdk_bitmap_unref (line->stipple);
+ g_object_unref (line->stipple);
line->stipple = stipple;
if (stipple && !reconfigure)
- gdk_bitmap_ref (stipple);
+ g_object_ref (stipple);
if (line->gc) {
if (stipple) {
@@ -883,11 +883,11 @@ gnome_canvas_line_get_property (GObject *object,
break;
case PROP_FILL_COLOR:
- g_value_set_string_take_ownership (value,
- g_strdup_printf ("#%02x%02x%02x",
- line->fill_rgba >> 24,
- (line->fill_rgba >> 16) & 0xff,
- (line->fill_rgba >> 8) & 0xff));
+ g_value_take_string (value,
+ g_strdup_printf ("#%02x%02x%02x",
+ line->fill_rgba >> 24,
+ (line->fill_rgba >> 16) & 0xff,
+ (line->fill_rgba >> 8) & 0xff));
break;
case PROP_FILL_COLOR_GDK: {
@@ -1116,7 +1116,7 @@ gnome_canvas_line_unrealize (GnomeCanvasItem *item)
line = GNOME_CANVAS_LINE (item);
- gdk_gc_unref (line->gc);
+ g_object_unref (line->gc);
line->gc = NULL;
if (parent_class->unrealize)
diff --git a/libgnomecanvas/gnome-canvas-pixbuf.c b/libgnomecanvas/gnome-canvas-pixbuf.c
index 86d596d..15f2475 100644
--- a/libgnomecanvas/gnome-canvas-pixbuf.c
+++ b/libgnomecanvas/gnome-canvas-pixbuf.c
@@ -279,7 +279,7 @@ gnome_canvas_pixbuf_destroy (GtkObject *object)
gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
if (priv->pixbuf)
- gdk_pixbuf_unref (priv->pixbuf);
+ g_object_unref (priv->pixbuf);
g_free (priv);
gcp->priv = NULL;
@@ -327,11 +327,11 @@ gnome_canvas_pixbuf_set_property (GObject *object,
g_return_if_fail
(gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
- gdk_pixbuf_ref (pixbuf);
+ g_object_ref (pixbuf);
}
if (priv->pixbuf)
- gdk_pixbuf_unref (priv->pixbuf);
+ g_object_unref (priv->pixbuf);
priv->pixbuf = pixbuf;
}
@@ -884,16 +884,14 @@ gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
w * 4,
NULL, NULL);
- gdk_pixbuf_render_to_drawable_alpha (pixbuf, drawable,
- 0, 0,
- d_rect.x0 - x, d_rect.y0 - y,
- w, h,
- GDK_PIXBUF_ALPHA_FULL,
- 0,
- GDK_RGB_DITHER_MAX,
- d_rect.x0, d_rect.y0);
+ gdk_draw_pixbuf (drawable, NULL, pixbuf,
+ 0, 0,
+ d_rect.x0 - x, d_rect.y0 - y,
+ w, h,
+ GDK_RGB_DITHER_MAX,
+ d_rect.x0, d_rect.y0);
- gdk_pixbuf_unref (pixbuf);
+ g_object_unref (pixbuf);
g_free (buf);
}
@@ -961,7 +959,7 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
GDK_INTERP_BILINEAR,
255);
- gdk_pixbuf_unref (dest_pixbuf);
+ g_object_unref (dest_pixbuf);
}
else if (gdk_pixbuf_get_has_alpha(priv->pixbuf))
art_rgb_rgba_affine (buf->buf,
diff --git a/libgnomecanvas/gnome-canvas-polygon.c b/libgnomecanvas/gnome-canvas-polygon.c
index 20c6c0f..f4553cb 100644
--- a/libgnomecanvas/gnome-canvas-polygon.c
+++ b/libgnomecanvas/gnome-canvas-polygon.c
@@ -42,16 +42,13 @@
#include "gnome-canvas-shape.h"
-
#define NUM_STATIC_POINTS 256 /* Number of static points to use to avoid allocating arrays */
-
enum {
PROP_0,
PROP_POINTS
};
-
static void gnome_canvas_polygon_class_init (GnomeCanvasPolygonClass *class);
static void gnome_canvas_polygon_init (GnomeCanvasPolygon *poly);
static void gnome_canvas_polygon_destroy (GtkObject *object);
diff --git a/libgnomecanvas/gnome-canvas-rich-text.c b/libgnomecanvas/gnome-canvas-rich-text.c
index 23ade38..f0bf332 100644
--- a/libgnomecanvas/gnome-canvas-rich-text.c
+++ b/libgnomecanvas/gnome-canvas-rich-text.c
@@ -24,10 +24,10 @@
#include <stdio.h>
#include <string.h>
-#define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#include <gtk/gtktextlayout.h>
+#define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API
+#include <gtk/gtktextdisplay.h>
#include "gnome-canvas.h"
#include "gnome-canvas-util.h"
@@ -1252,7 +1252,7 @@ gnome_canvas_rich_text_button_press_event(GnomeCanvasItem *item,
event_type = event->type;
if (event_type == GDK_BUTTON_PRESS) {
text->_priv->clicks++;
- text->_priv->click_timeout = gtk_timeout_add(400, _click, text);
+ text->_priv->click_timeout = g_timeout_add(400, _click, text);
if (text->_priv->clicks > 3)
text->_priv->clicks = text->_priv->clicks % 3;
@@ -1616,10 +1616,10 @@ blink_cb(gpointer data)
visible = gtk_text_layout_get_cursor_visible(text->_priv->layout);
if (visible)
- text->_priv->blink_timeout = gtk_timeout_add(
+ text->_priv->blink_timeout = g_timeout_add(
CURSOR_OFF_TIME, blink_cb, text);
else
- text->_priv->blink_timeout = gtk_timeout_add(
+ text->_priv->blink_timeout = g_timeout_add(
CURSOR_ON_TIME, blink_cb, text);
gtk_text_layout_set_cursor_visible(text->_priv->layout, !visible);
@@ -1639,25 +1639,25 @@ gnome_canvas_rich_text_start_cursor_blink(GnomeCanvasRichText *text,
return;
if (text->_priv->preblink_timeout != 0) {
- gtk_timeout_remove(text->_priv->preblink_timeout);
+ g_source_remove(text->_priv->preblink_timeout);
text->_priv->preblink_timeout = 0;
}
if (with_delay) {
if (text->_priv->blink_timeout != 0) {
- gtk_timeout_remove(text->_priv->blink_timeout);
+ g_source_remove(text->_priv->blink_timeout);
text->_priv->blink_timeout = 0;
}
gtk_text_layout_set_cursor_visible(text->_priv->layout, TRUE);
- text->_priv->preblink_timeout = gtk_timeout_add(
+ text->_priv->preblink_timeout = g_timeout_add(
PREBLINK_TIME, preblink_cb, text);
}
else {
if (text->_priv->blink_timeout == 0) {
gtk_text_layout_set_cursor_visible(text->_priv->layout, TRUE);
- text->_priv->blink_timeout = gtk_timeout_add(
+ text->_priv->blink_timeout = g_timeout_add(
CURSOR_ON_TIME, blink_cb, text);
}
}
@@ -1667,7 +1667,7 @@ static void
gnome_canvas_rich_text_stop_cursor_blink(GnomeCanvasRichText *text)
{
if (text->_priv->blink_timeout) {
- gtk_timeout_remove(text->_priv->blink_timeout);
+ g_source_remove(text->_priv->blink_timeout);
text->_priv->blink_timeout = 0;
}
} /* gnome_canvas_rich_text_stop_cursor_blink */
@@ -1697,7 +1697,7 @@ invalidated_handler(GtkTextLayout *layout, gpointer data)
/* We are called from the update cycle; gotta put this in an idle
loop. */
- gtk_idle_add(request_update, text);
+ g_idle_add(request_update, text);
} /* invalidated_handler */
static void
@@ -1747,7 +1747,7 @@ changed_handler(GtkTextLayout *layout, gint start_y,
/* We are called from the update cycle; gotta put this in an idle
loop. */
- gtk_idle_add(request_update, text);
+ g_idle_add(request_update, text);
} /* changed_handler */
diff --git a/libgnomecanvas/gnome-canvas-shape.c b/libgnomecanvas/gnome-canvas-shape.c
index 5d1e1c7..5af1a05 100644
--- a/libgnomecanvas/gnome-canvas-shape.c
+++ b/libgnomecanvas/gnome-canvas-shape.c
@@ -667,10 +667,10 @@ gnome_canvas_shape_unrealize (GnomeCanvasItem *item)
if (!item->canvas->aa) {
g_assert (shape->priv->gdk != NULL);
- gdk_gc_unref (shape->priv->gdk->fill_gc);
+ g_object_unref (shape->priv->gdk->fill_gc);
shape->priv->gdk->fill_gc = NULL;
- gdk_gc_unref (shape->priv->gdk->outline_gc);
+ g_object_unref (shape->priv->gdk->outline_gc);
shape->priv->gdk->outline_gc = NULL;
}
@@ -1285,11 +1285,11 @@ static void
set_stipple (GdkGC *gc, GdkBitmap **internal_stipple, GdkBitmap *stipple, int reconfigure)
{
if (*internal_stipple && !reconfigure)
- gdk_bitmap_unref (*internal_stipple);
+ g_object_unref (*internal_stipple);
*internal_stipple = stipple;
if (stipple && !reconfigure)
- gdk_bitmap_ref (stipple);
+ g_object_ref (stipple);
if (gc) {
if (stipple) {
@@ -1351,10 +1351,10 @@ gcbp_destroy_gdk (GnomeCanvasShape * shape)
g_assert (!gdk->outline_gc);
if (gdk->fill_stipple)
- gdk_bitmap_unref (gdk->fill_stipple);
+ g_object_unref (gdk->fill_stipple);
if (gdk->outline_stipple)
- gdk_bitmap_unref (gdk->outline_stipple);
+ g_object_unref (gdk->outline_stipple);
if (gdk->points)
g_free (gdk->points);
@@ -1433,10 +1433,10 @@ gcbp_ensure_mask (GnomeCanvasShape * shape, gint width, gint height)
window = ((GtkWidget *) (((GnomeCanvasItem *) shape)->canvas))->window;
- if (ctx->clear_gc) gdk_gc_unref (ctx->clear_gc);
- if (ctx->xor_gc) gdk_gc_unref (ctx->xor_gc);
- if (ctx->mask) gdk_bitmap_unref (ctx->mask);
- if (ctx->clip) gdk_bitmap_unref (ctx->clip);
+ if (ctx->clear_gc) g_object_unref (ctx->clear_gc);
+ if (ctx->xor_gc) g_object_unref (ctx->xor_gc);
+ if (ctx->mask) g_object_unref (ctx->mask);
+ if (ctx->clip) g_object_unref (ctx->clip);
ctx->mask = gdk_pixmap_new (window, width, height, 1);
ctx->clip = NULL;
@@ -1456,14 +1456,14 @@ gcbp_draw_ctx_unref (GCBPDrawCtx * ctx)
{
if (--ctx->refcount < 1) {
if (ctx->clear_gc)
- gdk_gc_unref (ctx->clear_gc);
+ g_object_unref (ctx->clear_gc);
if (ctx->xor_gc)
- gdk_gc_unref (ctx->xor_gc);
+ g_object_unref (ctx->xor_gc);
if (ctx->mask)
- gdk_bitmap_unref (ctx->mask);
+ g_object_unref (ctx->mask);
if (ctx->clip)
- gdk_bitmap_unref (ctx->clip);
+ g_object_unref (ctx->clip);
g_object_set_data (G_OBJECT (ctx->canvas), "BpathDrawCtx", NULL);
g_free (ctx);
diff --git a/libgnomecanvas/gnome-canvas-text.c b/libgnomecanvas/gnome-canvas-text.c
index 9beba5d..2b12fcb 100644
--- a/libgnomecanvas/gnome-canvas-text.c
+++ b/libgnomecanvas/gnome-canvas-text.c
@@ -578,7 +578,7 @@ gnome_canvas_text_destroy (GtkObject *object)
text->attr_list = NULL;
if (text->stipple)
- gdk_bitmap_unref (text->stipple);
+ g_object_unref (text->stipple);
text->stipple = NULL;
if (text->priv && text->priv->bitmap.buffer) {
@@ -696,11 +696,11 @@ static void
set_stipple (GnomeCanvasText *text, GdkBitmap *stipple, int reconfigure)
{
if (text->stipple && !reconfigure)
- gdk_bitmap_unref (text->stipple);
+ g_object_unref (text->stipple);
text->stipple = stipple;
if (stipple && !reconfigure)
- gdk_bitmap_ref (stipple);
+ g_object_ref (stipple);
if (text->gc) {
if (stipple) {
@@ -1259,11 +1259,11 @@ gnome_canvas_text_get_property (GObject *object,
break;
case PROP_FILL_COLOR:
- g_value_set_string_take_ownership (value,
- g_strdup_printf ("#%02x%02x%02x",
- text->rgba >> 24,
- (text->rgba >> 16) & 0xff,
- (text->rgba >> 8) & 0xff));
+ g_value_take_string (value,
+ g_strdup_printf ("#%02x%02x%02x",
+ text->rgba >> 24,
+ (text->rgba >> 16) & 0xff,
+ (text->rgba >> 8) & 0xff));
break;
case PROP_FILL_COLOR_GDK: {
@@ -1435,7 +1435,7 @@ gnome_canvas_text_unrealize (GnomeCanvasItem *item)
text = GNOME_CANVAS_TEXT (item);
- gdk_gc_unref (text->gc);
+ g_object_unref (text->gc);
text->gc = NULL;
if (parent_class->unrealize)
diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c
index b015dd1..54a9398 100644
--- a/libgnomecanvas/gnome-canvas.c
+++ b/libgnomecanvas/gnome-canvas.c
@@ -1833,8 +1833,7 @@ gnome_canvas_group_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
static void
group_add (GnomeCanvasGroup *group, GnomeCanvasItem *item)
{
- g_object_ref (G_OBJECT (item));
- gtk_object_sink (GTK_OBJECT (item));
+ g_object_ref_sink (G_OBJECT (item));
if (!group->item_list) {
group->item_list = g_list_append (group->item_list, item);
@@ -2129,8 +2128,7 @@ gnome_canvas_init (GnomeCanvas *canvas)
canvas->root = GNOME_CANVAS_ITEM (g_object_new (gnome_canvas_group_get_type (), NULL));
canvas->root->canvas = canvas;
- g_object_ref (canvas->root);
- gtk_object_sink (GTK_OBJECT (canvas->root));
+ g_object_ref_sink (canvas->root);
canvas->root_destroy_id = g_signal_connect (canvas->root, "destroy",
G_CALLBACK (panic_root_destroyed),
@@ -2146,7 +2144,7 @@ remove_idle (GnomeCanvas *canvas)
if (canvas->idle_id == 0)
return;
- gtk_idle_remove (canvas->idle_id);
+ g_source_remove (canvas->idle_id);
canvas->idle_id = 0;
}
@@ -2330,7 +2328,7 @@ gnome_canvas_unrealize (GtkWidget *widget)
(* GNOME_CANVAS_ITEM_GET_CLASS (canvas->root)->unrealize) (canvas->root);
- gdk_gc_destroy (canvas->pixmap_gc);
+ g_object_unref (canvas->pixmap_gc);
canvas->pixmap_gc = NULL;
if (GTK_WIDGET_CLASS (canvas_parent_class)->unrealize)
@@ -2952,7 +2950,6 @@ gnome_canvas_paint_rect (GnomeCanvas *canvas, gint x0, gint y0, gint x1, gint y1
buf.rect.x1 = draw_x2;
buf.rect.y1 = draw_y2;
color = &widget->style->bg[GTK_STATE_NORMAL];
- buf.bg_color = (((color->red & 0xff00) << 8) | (color->green & 0xff00) | (color->blue >> 8));
buf.is_bg = 1;
buf.is_buf = 0;
@@ -2962,7 +2959,7 @@ gnome_canvas_paint_rect (GnomeCanvas *canvas, gint x0, gint y0, gint x1, gint y1
(* GNOME_CANVAS_ITEM_GET_CLASS (canvas->root)->render) (canvas->root, &buf);
if (buf.is_bg) {
- gdk_rgb_gc_set_foreground (canvas->pixmap_gc, buf.bg_color);
+ gdk_gc_set_rgb_fg_color (canvas->pixmap_gc, color);
gdk_draw_rectangle (canvas->layout.bin_window,
canvas->pixmap_gc,
TRUE,
@@ -3000,15 +2997,15 @@ gnome_canvas_paint_rect (GnomeCanvas *canvas, gint x0, gint y0, gint x1, gint y1
/* Copy the pixmap to the window and clean up */
- gdk_draw_pixmap (canvas->layout.bin_window,
- canvas->pixmap_gc,
- pixmap,
- 0, 0,
- draw_x1 + canvas->zoom_xofs,
- draw_y1 + canvas->zoom_yofs,
- draw_width, draw_height);
+ gdk_draw_drawable (canvas->layout.bin_window,
+ canvas->pixmap_gc,
+ pixmap,
+ 0, 0,
+ draw_x1 + canvas->zoom_xofs,
+ draw_y1 + canvas->zoom_yofs,
+ draw_width, draw_height);
- gdk_pixmap_unref (pixmap);
+ g_object_unref (pixmap);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]