diff --git a/gtk/a11y/gtkbooleancellaccessible.c b/gtk/a11y/gtkbooleancellaccessible.c index af64c58be0..eaa20f0435 100644 --- a/gtk/a11y/gtkbooleancellaccessible.c +++ b/gtk/a11y/gtkbooleancellaccessible.c @@ -105,11 +105,14 @@ gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell) GtkBooleanCellAccessible *boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (cell); gboolean active; gboolean sensitive; + GtkCellRenderer *renderer; - g_object_get (G_OBJECT (GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer), + g_object_get (cell, "renderer", &renderer, NULL); + g_object_get (renderer, "active", &active, "sensitive", &sensitive, NULL); + g_object_unref (renderer); if (boolean_cell->priv->cell_value != active) { diff --git a/gtk/a11y/gtkimagecellaccessible.c b/gtk/a11y/gtkimagecellaccessible.c index 9463c9e47f..705756cc4a 100644 --- a/gtk/a11y/gtkimagecellaccessible.c +++ b/gtk/a11y/gtkimagecellaccessible.c @@ -101,10 +101,11 @@ gtk_image_cell_accessible_get_image_size (AtkImage *image, *width = 0; *height = 0; - cell_renderer = GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer; - g_object_get (GTK_CELL_RENDERER_PIXBUF (cell_renderer), + g_object_get (cell, "renderer", &cell_renderer, NULL); + g_object_get (cell_renderer, "pixbuf", &pixbuf, NULL); + g_object_unref (cell_renderer); if (pixbuf) { diff --git a/gtk/a11y/gtkrenderercellaccessible.c b/gtk/a11y/gtkrenderercellaccessible.c index 700f929c65..6c26897980 100644 --- a/gtk/a11y/gtkrenderercellaccessible.c +++ b/gtk/a11y/gtkrenderercellaccessible.c @@ -21,6 +21,10 @@ #include "gtkrenderercellaccessible.h" #include "gtkintl.h" +struct _GtkRendererCellAccessiblePrivate +{ + GtkCellRenderer *renderer; +}; enum { PROP_0, @@ -40,7 +44,7 @@ gtk_renderer_cell_accessible_set_property (GObject *object, switch (prop_id) { case PROP_RENDERER: - accessible->renderer = g_value_dup_object (value); + accessible->priv->renderer = g_value_dup_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -59,7 +63,7 @@ gtk_renderer_cell_accessible_get_property (GObject *object, switch (prop_id) { case PROP_RENDERER: - g_value_set_object (value, accessible->renderer); + g_value_set_object (value, accessible->priv->renderer); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -72,8 +76,8 @@ gtk_renderer_cell_accessible_finalize (GObject *object) { GtkRendererCellAccessible *renderer_cell = GTK_RENDERER_CELL_ACCESSIBLE (object); - if (renderer_cell->renderer) - g_object_unref (renderer_cell->renderer); + if (renderer_cell->priv->renderer) + g_object_unref (renderer_cell->priv->renderer); G_OBJECT_CLASS (_gtk_renderer_cell_accessible_parent_class)->finalize (object); } @@ -94,11 +98,16 @@ _gtk_renderer_cell_accessible_class_init (GtkRendererCellAccessibleClass *klass) P_("The cell renderer represented by this accessible"), GTK_TYPE_CELL_RENDERER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_type_class_add_private (klass, sizeof (GtkRendererCellAccessiblePrivate)); } static void _gtk_renderer_cell_accessible_init (GtkRendererCellAccessible *renderer_cell) { + renderer_cell->priv = G_TYPE_INSTANCE_GET_PRIVATE (renderer_cell, + GTK_TYPE_RENDERER_CELL_ACCESSIBLE, + GtkRendererCellAccessiblePrivate); } AtkObject * diff --git a/gtk/a11y/gtkrenderercellaccessible.h b/gtk/a11y/gtkrenderercellaccessible.h index 3e36f5e09d..6c08b94c99 100644 --- a/gtk/a11y/gtkrenderercellaccessible.h +++ b/gtk/a11y/gtkrenderercellaccessible.h @@ -30,13 +30,15 @@ G_BEGIN_DECLS #define GTK_IS_RENDERER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RENDERER_CELL_ACCESSIBLE)) #define GTK_RENDERER_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RENDERER_CELL_ACCESSIBLE, GtkRendererCellAccessibleClass)) -typedef struct _GtkRendererCellAccessible GtkRendererCellAccessible; -typedef struct _GtkRendererCellAccessibleClass GtkRendererCellAccessibleClass; +typedef struct _GtkRendererCellAccessible GtkRendererCellAccessible; +typedef struct _GtkRendererCellAccessibleClass GtkRendererCellAccessibleClass; +typedef struct _GtkRendererCellAccessiblePrivate GtkRendererCellAccessiblePrivate; struct _GtkRendererCellAccessible { GtkCellAccessible parent; - GtkCellRenderer *renderer; + + GtkRendererCellAccessiblePrivate *priv; }; struct _GtkRendererCellAccessibleClass diff --git a/gtk/a11y/gtktextcellaccessible.c b/gtk/a11y/gtktextcellaccessible.c index cf24b493ac..25031c9391 100644 --- a/gtk/a11y/gtktextcellaccessible.c +++ b/gtk/a11y/gtktextcellaccessible.c @@ -126,10 +126,13 @@ gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell) gboolean rv = FALSE; gint temp_length; gchar *text; + GtkCellRenderer *renderer; - g_object_get (G_OBJECT (GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer), + g_object_get (cell, "renderer", &renderer, NULL); + g_object_get (renderer, "text", &text, NULL); + g_object_unref (renderer); if (text_cell->cell_text) { @@ -392,7 +395,7 @@ create_pango_layout (GtkTextCellAccessible *text) GtkCellRendererText *gtk_renderer; gail_renderer = GTK_RENDERER_CELL_ACCESSIBLE (text); - gtk_renderer = GTK_CELL_RENDERER_TEXT (gail_renderer->renderer); + g_object_get (gail_renderer, "renderer", >k_renderer, NULL); g_object_get (gtk_renderer, "text", &renderer_text, @@ -409,6 +412,7 @@ create_pango_layout (GtkTextCellAccessible *text) "rise-set", &rise_set, "rise", &rise, NULL); + g_object_unref (gtk_renderer); layout = gtk_widget_create_pango_layout (get_widget (text), renderer_text); @@ -539,11 +543,14 @@ gtk_text_cell_accessible_get_character_extents (AtkText *text, return; } gail_renderer = GTK_RENDERER_CELL_ACCESSIBLE (text); - gtk_renderer = GTK_CELL_RENDERER_TEXT (gail_renderer->renderer); - + g_object_get (gail_renderer, "renderer", >k_renderer, NULL); g_object_get (gtk_renderer, "text", &renderer_text, NULL); + g_object_unref (gtk_renderer); if (renderer_text == NULL) - return; + { + g_object_unref (gtk_renderer); + return; + } parent = atk_object_get_parent (ATK_OBJECT (text)); if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent)) @@ -569,7 +576,7 @@ gtk_text_cell_accessible_get_character_extents (AtkText *text, index = g_utf8_offset_to_pointer (renderer_text, offset) - renderer_text; pango_layout_index_to_pos (layout, index, &char_rect); - gtk_cell_renderer_get_padding (gail_renderer->renderer, &xpad, &ypad); + gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (gtk_renderer), &xpad, &ypad); get_origins (widget, &x_window, &y_window, &x_toplevel, &y_toplevel); @@ -593,6 +600,7 @@ gtk_text_cell_accessible_get_character_extents (AtkText *text, g_free (renderer_text); g_object_unref (layout); + g_object_unref (gtk_renderer); } static gint @@ -620,12 +628,13 @@ gtk_text_cell_accessible_get_offset_at_point (AtkText *text, return -1; gail_renderer = GTK_RENDERER_CELL_ACCESSIBLE (text); - gtk_renderer = GTK_CELL_RENDERER_TEXT (gail_renderer->renderer); + g_object_get (gail_renderer, "renderer", >k_renderer, NULL); parent = atk_object_get_parent (ATK_OBJECT (text)); g_object_get (gtk_renderer, "text", &renderer_text, NULL); if (text == NULL) { + g_object_unref (gtk_renderer); g_free (renderer_text); return -1; } @@ -651,7 +660,7 @@ gtk_text_cell_accessible_get_offset_at_point (AtkText *text, layout = create_pango_layout (GTK_TEXT_CELL_ACCESSIBLE (text)); - gtk_cell_renderer_get_padding (gail_renderer->renderer, &xpad, &ypad); + gtk_cell_renderer_get_padding (GTK_CELL_RENDERER (gtk_renderer), &xpad, &ypad); get_origins (widget, &x_window, &y_window, &x_toplevel, &y_toplevel); @@ -678,6 +687,8 @@ gtk_text_cell_accessible_get_offset_at_point (AtkText *text, } g_object_unref (layout); + g_object_unref (gtk_renderer); + if (index == -1) { if (coords == ATK_XY_WINDOW || coords == ATK_XY_SCREEN)