From 55016f72f2fe91f088f5d2c12b1c5c38e42f8f3a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Javier=20Jard=C3=B3n?= Date: Thu, 23 Dec 2010 20:03:06 +0100 Subject: [PATCH] gtktexttag: Move public members to private header And fix gail to not poke at GtkTextTag internals --- gtk/gtktextbtree.c | 47 +- gtk/gtktextbuffer.c | 9 +- gtk/gtktextbufferserialize.c | 15 +- gtk/gtktextlayout.c | 10 +- gtk/gtktexttag.c | 492 +++++++++++---------- gtk/gtktexttag.h | 54 +-- gtk/gtktexttagprivate.h | 54 +++ gtk/gtktexttagtable.c | 29 +- modules/other/gail/libgail-util/gailmisc.c | 308 ++++++++----- 9 files changed, 570 insertions(+), 448 deletions(-) diff --git a/gtk/gtktextbtree.c b/gtk/gtktextbtree.c index b07a04ec1..c5124e7bd 100644 --- a/gtk/gtktextbtree.c +++ b/gtk/gtktextbtree.c @@ -59,6 +59,7 @@ #include #include #include "gtktexttag.h" +#include "gtktexttagprivate.h" #include "gtktexttagtable.h" #include "gtktextlayout.h" #include "gtktextiterprivate.h" @@ -1778,7 +1779,7 @@ _gtk_text_btree_tag (const GtkTextIter *start_orig, g_return_if_fail (GTK_IS_TEXT_TAG (tag)); g_return_if_fail (_gtk_text_iter_get_btree (start_orig) == _gtk_text_iter_get_btree (end_orig)); - g_return_if_fail (tag->table == _gtk_text_iter_get_btree (start_orig)->table); + g_return_if_fail (tag->priv->table == _gtk_text_iter_get_btree (start_orig)->table); #if 0 printf ("%s tag %s from %d to %d\n", @@ -2505,10 +2506,10 @@ _gtk_text_btree_char_is_invisible (const GtkTextIter *iter) || (seg->type == >k_text_toggle_off_type)) { tag = seg->body.toggle.info->tag; - if (tag->invisible_set) + if (tag->priv->invisible_set) { - tags[tag->priority] = tag; - tagCnts[tag->priority]++; + tags[tag->priv->priority] = tag; + tagCnts[tag->priv->priority]++; } } } @@ -2529,10 +2530,10 @@ _gtk_text_btree_char_is_invisible (const GtkTextIter *iter) || (seg->type == >k_text_toggle_off_type)) { tag = seg->body.toggle.info->tag; - if (tag->invisible_set) + if (tag->priv->invisible_set) { - tags[tag->priority] = tag; - tagCnts[tag->priority]++; + tags[tag->priv->priority] = tag; + tagCnts[tag->priv->priority]++; } } } @@ -2558,10 +2559,10 @@ _gtk_text_btree_char_is_invisible (const GtkTextIter *iter) if (summary->toggle_count & 1) { tag = summary->info->tag; - if (tag->invisible_set) + if (tag->priv->invisible_set) { - tags[tag->priority] = tag; - tagCnts[tag->priority] += summary->toggle_count; + tags[tag->priv->priority] = tag; + tagCnts[tag->priv->priority] += summary->toggle_count; } } } @@ -2588,7 +2589,7 @@ _gtk_text_btree_char_is_invisible (const GtkTextIter *iter) } #endif #endif - invisible = tags[i]->values->invisible; + invisible = tags[i]->priv->values->invisible; break; } } @@ -6798,7 +6799,7 @@ gtk_text_btree_node_check_consistency (GtkTextBTree *tree, break; } g_error ("gtk_text_btree_node_check_consistency: GtkTextBTreeNode tag \"%s\" not %s", - summary->info->tag->name, + summary->info->tag->priv->name, "present in parent summaries"); } if (summary->info == summary2->info) @@ -6834,7 +6835,7 @@ gtk_text_btree_node_check_consistency (GtkTextBTree *tree, if (summary->info->toggle_count == summary->toggle_count) { g_error ("gtk_text_btree_node_check_consistency: found unpruned root for \"%s\"", - summary->info->tag->name); + summary->info->tag->priv->name); } toggle_count = 0; if (node->level == 0) @@ -6888,7 +6889,7 @@ gtk_text_btree_node_check_consistency (GtkTextBTree *tree, if (summary2->info == summary->info) { g_error ("gtk_text_btree_node_check_consistency: duplicated GtkTextBTreeNode tag: %s", - summary->info->tag->name); + summary->info->tag->priv->name); } } } @@ -6940,19 +6941,19 @@ _gtk_text_btree_check (GtkTextBTree *tree) if (info->toggle_count != 0) { g_error ("_gtk_text_btree_check found \"%s\" with toggles (%d) but no root", - tag->name, info->toggle_count); + tag->priv->name, info->toggle_count); } continue; /* no ranges for the tag */ } else if (info->toggle_count == 0) { g_error ("_gtk_text_btree_check found root for \"%s\" with no toggles", - tag->name); + tag->priv->name); } else if (info->toggle_count & 1) { g_error ("_gtk_text_btree_check found odd toggle count for \"%s\" (%d)", - tag->name, info->toggle_count); + tag->priv->name, info->toggle_count); } for (summary = node->summary; summary != NULL; summary = summary->next) @@ -7007,7 +7008,7 @@ _gtk_text_btree_check (GtkTextBTree *tree) if (count != info->toggle_count) { g_error ("_gtk_text_btree_check toggle_count (%d) wrong for \"%s\" should be (%d)", - info->toggle_count, tag->name, count); + info->toggle_count, tag->priv->name, count); } } } @@ -7116,7 +7117,7 @@ _gtk_text_btree_spew (GtkTextBTree *tree) info = list->data; printf (" tag `%s': root at %p, toggle count %d\n", - info->tag->name, info->tag_root, info->toggle_count); + info->tag->priv->name, info->tag_root, info->toggle_count); list = g_slist_next (list); } @@ -7182,7 +7183,7 @@ _gtk_text_btree_spew_line_short (GtkTextLine *line, int indent) seg->type == >k_text_toggle_off_type) { printf ("%s tag `%s' %s\n", - spaces, seg->body.toggle.info->tag->name, + spaces, seg->body.toggle.info->tag->priv->name, seg->type == >k_text_toggle_off_type ? "off" : "on"); } @@ -7209,7 +7210,7 @@ _gtk_text_btree_spew_node (GtkTextBTreeNode *node, int indent) while (s) { printf ("%s %d toggles of `%s' below this node\n", - spaces, s->toggle_count, s->info->tag->name); + spaces, s->toggle_count, s->info->tag->priv->name); s = s->next; } @@ -7284,7 +7285,7 @@ _gtk_text_btree_spew_segment (GtkTextBTree* tree, GtkTextLineSegment * seg) seg->type == >k_text_toggle_off_type) { printf (" tag `%s' priority %d\n", - seg->body.toggle.info->tag->name, - seg->body.toggle.info->tag->priority); + seg->body.toggle.info->tag->priv->name, + seg->body.toggle.info->tag->priv->priority); } } diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index c71d79b96..050ac9bcf 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -38,6 +38,7 @@ #include "gtktextbufferrichtext.h" #include "gtktextbtree.h" #include "gtktextiterprivate.h" +#include "gtktexttagprivate.h" #include "gtkprivate.h" #include "gtkintl.h" @@ -2504,7 +2505,7 @@ gtk_text_buffer_real_apply_tag (GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end) { - if (tag->table != buffer->priv->tag_table) + if (tag->priv->table != buffer->priv->tag_table) { g_warning ("Can only apply tags that are in the tag table for the buffer"); return; @@ -2519,7 +2520,7 @@ gtk_text_buffer_real_remove_tag (GtkTextBuffer *buffer, const GtkTextIter *start, const GtkTextIter *end) { - if (tag->table != buffer->priv->tag_table) + if (tag->priv->table != buffer->priv->tag_table) { g_warning ("Can only remove tags that are in the tag table for the buffer"); return; @@ -2611,7 +2612,7 @@ gtk_text_buffer_apply_tag (GtkTextBuffer *buffer, g_return_if_fail (end != NULL); g_return_if_fail (gtk_text_iter_get_buffer (start) == buffer); g_return_if_fail (gtk_text_iter_get_buffer (end) == buffer); - g_return_if_fail (tag->table == buffer->priv->tag_table); + g_return_if_fail (tag->priv->table == buffer->priv->tag_table); gtk_text_buffer_emit_tag (buffer, tag, TRUE, start, end); } @@ -2640,7 +2641,7 @@ gtk_text_buffer_remove_tag (GtkTextBuffer *buffer, g_return_if_fail (end != NULL); g_return_if_fail (gtk_text_iter_get_buffer (start) == buffer); g_return_if_fail (gtk_text_iter_get_buffer (end) == buffer); - g_return_if_fail (tag->table == buffer->priv->tag_table); + g_return_if_fail (tag->priv->table == buffer->priv->tag_table); gtk_text_buffer_emit_tag (buffer, tag, FALSE, start, end); } diff --git a/gtk/gtktextbufferserialize.c b/gtk/gtktextbufferserialize.c index 526e9518a..e4b4f7300 100644 --- a/gtk/gtktextbufferserialize.c +++ b/gtk/gtktextbufferserialize.c @@ -32,6 +32,7 @@ #include "gdk-pixbuf/gdk-pixdata.h" #include "gtktextbufferserialize.h" +#include "gtktexttagprivate.h" #include "gtkintl.h" @@ -292,9 +293,9 @@ serialize_tag (gpointer key, g_string_append (context->tag_table_str, " name) + if (tag->priv->name) { - tag_name = g_markup_escape_text (tag->name, -1); + tag_name = g_markup_escape_text (tag->priv->name, -1); g_string_append_printf (context->tag_table_str, "name=\"%s\"", tag_name); g_free (tag_name); } @@ -305,7 +306,7 @@ serialize_tag (gpointer key, g_string_append_printf (context->tag_table_str, "id=\"%d\"", tag_id); } - g_string_append_printf (context->tag_table_str, " priority=\"%d\">\n", tag->priority); + g_string_append_printf (context->tag_table_str, " priority=\"%d\">\n", tag->priv->priority); /* Serialize properties */ pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (tag), &n_pspecs); @@ -489,9 +490,9 @@ serialize_text (GtkTextBuffer *buffer, /* Add it to the tag hash table */ g_hash_table_insert (context->tags, tag, tag); - if (tag->name) + if (tag->priv->name) { - tag_name = g_markup_escape_text (tag->name, -1); + tag_name = g_markup_escape_text (tag->priv->name, -1); g_string_append_printf (context->text_str, "", tag_name); g_free (tag_name); @@ -1481,10 +1482,10 @@ end_element_handler (GMarkupParseContext *context, pop_state (info); g_assert (peek_state (info) == STATE_TAGS); - if (info->current_tag->name) + if (info->current_tag->priv->name) { /* Add tag to defined tags hash */ - tmp = g_strdup (info->current_tag->name); + tmp = g_strdup (info->current_tag->priv->name); g_hash_table_insert (info->defined_tags, tmp, tmp); } diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 8344a1b64..35809873d 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -1283,8 +1283,8 @@ totally_invisible_line (GtkTextLayout *layout, invalidate_cached_style (layout); /* Bail out if an elision-unsetting tag begins */ - if (seg->body.toggle.info->tag->invisible_set && - !seg->body.toggle.info->tag->values->invisible) + if (seg->body.toggle.info->tag->priv->invisible_set && + !seg->body.toggle.info->tag->priv->values->invisible) break; } else if (seg->type == >k_text_toggle_off_type) @@ -1292,8 +1292,8 @@ totally_invisible_line (GtkTextLayout *layout, invalidate_cached_style (layout); /* Bail out if an elision-setting tag ends */ - if (seg->body.toggle.info->tag->invisible_set && - seg->body.toggle.info->tag->values->invisible) + if (seg->body.toggle.info->tag->priv->invisible_set && + seg->body.toggle.info->tag->priv->values->invisible) break; } @@ -2103,7 +2103,7 @@ tags_array_toggle_tag (GPtrArray *array, tags = (GtkTextTag**) array->pdata; - for (pos = 0; pos < array->len && tags[pos]->priority < tag->priority; pos++) ; + for (pos = 0; pos < array->len && tags[pos]->priv->priority < tag->priv->priority; pos++) ; if (pos < array->len && tags[pos] == tag) g_ptr_array_remove_index (array, pos); diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c index a77047c4b..cb62ebfa5 100644 --- a/gtk/gtktexttag.c +++ b/gtk/gtktexttag.c @@ -665,12 +665,21 @@ gtk_text_tag_class_init (GtkTextTagClass *klass) G_TYPE_OBJECT, GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE, GTK_TYPE_TEXT_ITER); + + g_type_class_add_private (klass, sizeof (GtkTextTagPrivate)); } static void gtk_text_tag_init (GtkTextTag *text_tag) { - text_tag->values = gtk_text_attributes_new (); + GtkTextTagPrivate *priv; + + text_tag->priv = G_TYPE_INSTANCE_GET_PRIVATE (text_tag, + GTK_TYPE_TEXT_TAG, + GtkTextTagPrivate); + priv = text_tag->priv; + + priv->values = gtk_text_attributes_new (); } /** @@ -695,20 +704,19 @@ gtk_text_tag_new (const gchar *name) static void gtk_text_tag_finalize (GObject *object) { - GtkTextTag *text_tag; + GtkTextTag *text_tag = GTK_TEXT_TAG (object); + GtkTextTagPrivate *priv = text_tag->priv; - text_tag = GTK_TEXT_TAG (object); + if (priv->table) + gtk_text_tag_table_remove (priv->table, text_tag); - if (text_tag->table) - gtk_text_tag_table_remove (text_tag->table, text_tag); + g_assert (priv->table == NULL); - g_assert (text_tag->table == NULL); + gtk_text_attributes_unref (priv->values); + priv->values = NULL; - gtk_text_attributes_unref (text_tag->values); - text_tag->values = NULL; - - g_free (text_tag->name); - text_tag->name = NULL; + g_free (priv->name); + priv->name = NULL; G_OBJECT_CLASS (gtk_text_tag_parent_class)->finalize (object); } @@ -716,21 +724,23 @@ gtk_text_tag_finalize (GObject *object) static void set_bg_color (GtkTextTag *tag, GdkColor *color) { + GtkTextTagPrivate *priv = tag->priv; + if (color) { - if (!tag->bg_color_set) + if (!priv->bg_color_set) { - tag->bg_color_set = TRUE; + priv->bg_color_set = TRUE; g_object_notify (G_OBJECT (tag), "background-set"); } - - tag->values->appearance.bg_color = *color; + + priv->values->appearance.bg_color = *color; } else { - if (tag->bg_color_set) + if (priv->bg_color_set) { - tag->bg_color_set = FALSE; + priv->bg_color_set = FALSE; g_object_notify (G_OBJECT (tag), "background-set"); } } @@ -739,20 +749,22 @@ set_bg_color (GtkTextTag *tag, GdkColor *color) static void set_fg_color (GtkTextTag *tag, GdkColor *color) { + GtkTextTagPrivate *priv = tag->priv; + if (color) { - if (!tag->fg_color_set) + if (!priv->fg_color_set) { - tag->fg_color_set = TRUE; + priv->fg_color_set = TRUE; g_object_notify (G_OBJECT (tag), "foreground-set"); } - tag->values->appearance.fg_color = *color; + priv->values->appearance.fg_color = *color; } else { - if (tag->fg_color_set) + if (priv->fg_color_set) { - tag->fg_color_set = FALSE; + priv->fg_color_set = FALSE; g_object_notify (G_OBJECT (tag), "foreground-set"); } } @@ -761,28 +773,30 @@ set_fg_color (GtkTextTag *tag, GdkColor *color) static void set_pg_bg_color (GtkTextTag *tag, GdkColor *color) { + GtkTextTagPrivate *priv = tag->priv; + if (color) { - if (!tag->pg_bg_color_set) + if (!priv->pg_bg_color_set) { - tag->pg_bg_color_set = TRUE; + priv->pg_bg_color_set = TRUE; g_object_notify (G_OBJECT (tag), "paragraph-background-set"); } else - gdk_color_free (tag->values->pg_bg_color); + gdk_color_free (priv->values->pg_bg_color); - tag->values->pg_bg_color = gdk_color_copy (color); + priv->values->pg_bg_color = gdk_color_copy (color); } else { - if (tag->pg_bg_color_set) + if (priv->pg_bg_color_set) { - tag->pg_bg_color_set = FALSE; + priv->pg_bg_color_set = FALSE; g_object_notify (G_OBJECT (tag), "paragraph-background-set"); - gdk_color_free (tag->values->pg_bg_color); + gdk_color_free (priv->values->pg_bg_color); } - tag->values->pg_bg_color = NULL; + priv->values->pg_bg_color = NULL; } } @@ -888,6 +902,7 @@ static void set_font_description (GtkTextTag *text_tag, PangoFontDescription *font_desc) { + GtkTextTagPrivate *priv = text_tag->priv; GObject *object = G_OBJECT (text_tag); PangoFontDescription *new_font_desc; PangoFontMask old_mask, new_mask, changed_mask, set_changed_mask; @@ -897,8 +912,8 @@ set_font_description (GtkTextTag *text_tag, else new_font_desc = pango_font_description_new (); - if (text_tag->values->font) - old_mask = pango_font_description_get_set_fields (text_tag->values->font); + if (priv->values->font) + old_mask = pango_font_description_get_set_fields (priv->values->font); else old_mask = 0; @@ -907,10 +922,10 @@ set_font_description (GtkTextTag *text_tag, changed_mask = old_mask | new_mask; set_changed_mask = old_mask ^ new_mask; - if (text_tag->values->font) - pango_font_description_free (text_tag->values->font); - text_tag->values->font = new_font_desc; - + if (priv->values->font) + pango_font_description_free (priv->values->font); + priv->values->font = new_font_desc; + g_object_freeze_notify (object); g_object_notify (object, "font-desc"); @@ -940,8 +955,10 @@ set_font_description (GtkTextTag *text_tag, static void gtk_text_tag_ensure_font (GtkTextTag *text_tag) { - if (!text_tag->values->font) - text_tag->values->font = pango_font_description_new (); + GtkTextTagPrivate *priv = text_tag->priv; + + if (!priv->values->font) + priv->values->font = pango_font_description_new (); } static void @@ -950,16 +967,15 @@ gtk_text_tag_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - GtkTextTag *text_tag; + GtkTextTag *text_tag = GTK_TEXT_TAG (object); + GtkTextTagPrivate *priv = text_tag->priv; gboolean size_changed = FALSE; - text_tag = GTK_TEXT_TAG (object); - switch (prop_id) { case PROP_NAME: - g_return_if_fail (text_tag->name == NULL); - text_tag->name = g_value_dup_string (value); + g_return_if_fail (priv->name == NULL); + priv->name = g_value_dup_string (value); break; case PROP_BACKGROUND: @@ -1049,44 +1065,44 @@ gtk_text_tag_set_property (GObject *object, PangoFontMask old_set_mask; gtk_text_tag_ensure_font (text_tag); - old_set_mask = pango_font_description_get_set_fields (text_tag->values->font); + old_set_mask = pango_font_description_get_set_fields (priv->values->font); switch (prop_id) { case PROP_FAMILY: - pango_font_description_set_family (text_tag->values->font, + pango_font_description_set_family (priv->values->font, g_value_get_string (value)); break; case PROP_STYLE: - pango_font_description_set_style (text_tag->values->font, + pango_font_description_set_style (priv->values->font, g_value_get_enum (value)); break; case PROP_VARIANT: - pango_font_description_set_variant (text_tag->values->font, + pango_font_description_set_variant (priv->values->font, g_value_get_enum (value)); break; case PROP_WEIGHT: - pango_font_description_set_weight (text_tag->values->font, + pango_font_description_set_weight (priv->values->font, g_value_get_int (value)); break; case PROP_STRETCH: - pango_font_description_set_stretch (text_tag->values->font, + pango_font_description_set_stretch (priv->values->font, g_value_get_enum (value)); break; case PROP_SIZE: - pango_font_description_set_size (text_tag->values->font, + pango_font_description_set_size (priv->values->font, g_value_get_int (value)); g_object_notify (object, "size-points"); break; case PROP_SIZE_POINTS: - pango_font_description_set_size (text_tag->values->font, + pango_font_description_set_size (priv->values->font, g_value_get_double (value) * PANGO_SCALE); g_object_notify (object, "size"); break; } size_changed = TRUE; - notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (text_tag->values->font)); + notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (priv->values->font)); g_object_notify (object, "font-desc"); g_object_notify (object, "font"); @@ -1094,117 +1110,117 @@ gtk_text_tag_set_property (GObject *object, } case PROP_SCALE: - text_tag->values->font_scale = g_value_get_double (value); - text_tag->scale_set = TRUE; + priv->values->font_scale = g_value_get_double (value); + priv->scale_set = TRUE; g_object_notify (object, "scale-set"); size_changed = TRUE; break; case PROP_PIXELS_ABOVE_LINES: - text_tag->pixels_above_lines_set = TRUE; - text_tag->values->pixels_above_lines = g_value_get_int (value); + priv->pixels_above_lines_set = TRUE; + priv->values->pixels_above_lines = g_value_get_int (value); g_object_notify (object, "pixels-above-lines-set"); size_changed = TRUE; break; case PROP_PIXELS_BELOW_LINES: - text_tag->pixels_below_lines_set = TRUE; - text_tag->values->pixels_below_lines = g_value_get_int (value); + priv->pixels_below_lines_set = TRUE; + priv->values->pixels_below_lines = g_value_get_int (value); g_object_notify (object, "pixels-below-lines-set"); size_changed = TRUE; break; case PROP_PIXELS_INSIDE_WRAP: - text_tag->pixels_inside_wrap_set = TRUE; - text_tag->values->pixels_inside_wrap = g_value_get_int (value); + priv->pixels_inside_wrap_set = TRUE; + priv->values->pixels_inside_wrap = g_value_get_int (value); g_object_notify (object, "pixels-inside-wrap-set"); size_changed = TRUE; break; case PROP_EDITABLE: - text_tag->editable_set = TRUE; - text_tag->values->editable = g_value_get_boolean (value); + priv->editable_set = TRUE; + priv->values->editable = g_value_get_boolean (value); g_object_notify (object, "editable-set"); break; case PROP_WRAP_MODE: - text_tag->wrap_mode_set = TRUE; - text_tag->values->wrap_mode = g_value_get_enum (value); + priv->wrap_mode_set = TRUE; + priv->values->wrap_mode = g_value_get_enum (value); g_object_notify (object, "wrap-mode-set"); size_changed = TRUE; break; case PROP_JUSTIFICATION: - text_tag->justification_set = TRUE; - text_tag->values->justification = g_value_get_enum (value); + priv->justification_set = TRUE; + priv->values->justification = g_value_get_enum (value); g_object_notify (object, "justification-set"); size_changed = TRUE; break; case PROP_DIRECTION: - text_tag->values->direction = g_value_get_enum (value); + priv->values->direction = g_value_get_enum (value); break; case PROP_LEFT_MARGIN: - text_tag->left_margin_set = TRUE; - text_tag->values->left_margin = g_value_get_int (value); + priv->left_margin_set = TRUE; + priv->values->left_margin = g_value_get_int (value); g_object_notify (object, "left-margin-set"); size_changed = TRUE; break; case PROP_INDENT: - text_tag->indent_set = TRUE; - text_tag->values->indent = g_value_get_int (value); + priv->indent_set = TRUE; + priv->values->indent = g_value_get_int (value); g_object_notify (object, "indent-set"); size_changed = TRUE; break; case PROP_STRIKETHROUGH: - text_tag->strikethrough_set = TRUE; - text_tag->values->appearance.strikethrough = g_value_get_boolean (value); + priv->strikethrough_set = TRUE; + priv->values->appearance.strikethrough = g_value_get_boolean (value); g_object_notify (object, "strikethrough-set"); break; case PROP_RIGHT_MARGIN: - text_tag->right_margin_set = TRUE; - text_tag->values->right_margin = g_value_get_int (value); + priv->right_margin_set = TRUE; + priv->values->right_margin = g_value_get_int (value); g_object_notify (object, "right-margin-set"); size_changed = TRUE; break; case PROP_UNDERLINE: - text_tag->underline_set = TRUE; - text_tag->values->appearance.underline = g_value_get_enum (value); + priv->underline_set = TRUE; + priv->values->appearance.underline = g_value_get_enum (value); g_object_notify (object, "underline-set"); break; case PROP_RISE: - text_tag->rise_set = TRUE; - text_tag->values->appearance.rise = g_value_get_int (value); + priv->rise_set = TRUE; + priv->values->appearance.rise = g_value_get_int (value); g_object_notify (object, "rise-set"); size_changed = TRUE; break; case PROP_BACKGROUND_FULL_HEIGHT: - text_tag->bg_full_height_set = TRUE; - text_tag->values->bg_full_height = g_value_get_boolean (value); + priv->bg_full_height_set = TRUE; + priv->values->bg_full_height = g_value_get_boolean (value); g_object_notify (object, "background-full-height-set"); break; case PROP_LANGUAGE: - text_tag->language_set = TRUE; - text_tag->values->language = pango_language_from_string (g_value_get_string (value)); + priv->language_set = TRUE; + priv->values->language = pango_language_from_string (g_value_get_string (value)); g_object_notify (object, "language-set"); break; case PROP_TABS: - text_tag->tabs_set = TRUE; + priv->tabs_set = TRUE; - if (text_tag->values->tabs) - pango_tab_array_free (text_tag->values->tabs); + if (priv->values->tabs) + pango_tab_array_free (priv->values->tabs); /* FIXME I'm not sure if this is a memleak or not */ - text_tag->values->tabs = + priv->values->tabs = pango_tab_array_copy (g_value_get_boxed (value)); g_object_notify (object, "tabs-set"); @@ -1213,8 +1229,8 @@ gtk_text_tag_set_property (GObject *object, break; case PROP_INVISIBLE: - text_tag->invisible_set = TRUE; - text_tag->values->invisible = g_value_get_boolean (value); + priv->invisible_set = TRUE; + priv->values->invisible = g_value_get_boolean (value); g_object_notify (object, "invisible-set"); size_changed = TRUE; break; @@ -1243,7 +1259,7 @@ gtk_text_tag_set_property (GObject *object, break; case PROP_ACCUMULATIVE_MARGIN: - text_tag->accumulative_margin = g_value_get_boolean (value); + priv->accumulative_margin = g_value_get_boolean (value); g_object_notify (object, "accumulative-margin"); size_changed = TRUE; break; @@ -1251,11 +1267,11 @@ gtk_text_tag_set_property (GObject *object, /* Whether the value should be used... */ case PROP_BACKGROUND_SET: - text_tag->bg_color_set = g_value_get_boolean (value); + priv->bg_color_set = g_value_get_boolean (value); break; case PROP_FOREGROUND_SET: - text_tag->fg_color_set = g_value_get_boolean (value); + priv->fg_color_set = g_value_get_boolean (value); break; case PROP_FAMILY_SET: @@ -1266,8 +1282,8 @@ gtk_text_tag_set_property (GObject *object, case PROP_SIZE_SET: if (!g_value_get_boolean (value)) { - if (text_tag->values->font) - pango_font_description_unset_fields (text_tag->values->font, + if (priv->values->font) + pango_font_description_unset_fields (priv->values->font, get_property_font_set_mask (prop_id)); } else @@ -1275,95 +1291,95 @@ gtk_text_tag_set_property (GObject *object, PangoFontMask changed_mask; gtk_text_tag_ensure_font (text_tag); - changed_mask = set_font_desc_fields (text_tag->values->font, + changed_mask = set_font_desc_fields (priv->values->font, get_property_font_set_mask (prop_id)); notify_fields_changed (G_OBJECT (text_tag), changed_mask); } break; case PROP_SCALE_SET: - text_tag->scale_set = g_value_get_boolean (value); + priv->scale_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_PIXELS_ABOVE_LINES_SET: - text_tag->pixels_above_lines_set = g_value_get_boolean (value); + priv->pixels_above_lines_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_PIXELS_BELOW_LINES_SET: - text_tag->pixels_below_lines_set = g_value_get_boolean (value); + priv->pixels_below_lines_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_PIXELS_INSIDE_WRAP_SET: - text_tag->pixels_inside_wrap_set = g_value_get_boolean (value); + priv->pixels_inside_wrap_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_EDITABLE_SET: - text_tag->editable_set = g_value_get_boolean (value); + priv->editable_set = g_value_get_boolean (value); break; case PROP_WRAP_MODE_SET: - text_tag->wrap_mode_set = g_value_get_boolean (value); + priv->wrap_mode_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_JUSTIFICATION_SET: - text_tag->justification_set = g_value_get_boolean (value); + priv->justification_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_LEFT_MARGIN_SET: - text_tag->left_margin_set = g_value_get_boolean (value); + priv->left_margin_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_INDENT_SET: - text_tag->indent_set = g_value_get_boolean (value); + priv->indent_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_STRIKETHROUGH_SET: - text_tag->strikethrough_set = g_value_get_boolean (value); + priv->strikethrough_set = g_value_get_boolean (value); break; case PROP_RIGHT_MARGIN_SET: - text_tag->right_margin_set = g_value_get_boolean (value); + priv->right_margin_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_UNDERLINE_SET: - text_tag->underline_set = g_value_get_boolean (value); + priv->underline_set = g_value_get_boolean (value); break; case PROP_RISE_SET: - text_tag->rise_set = g_value_get_boolean (value); + priv->rise_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_BACKGROUND_FULL_HEIGHT_SET: - text_tag->bg_full_height_set = g_value_get_boolean (value); + priv->bg_full_height_set = g_value_get_boolean (value); break; case PROP_LANGUAGE_SET: - text_tag->language_set = g_value_get_boolean (value); + priv->language_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_TABS_SET: - text_tag->tabs_set = g_value_get_boolean (value); + priv->tabs_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_INVISIBLE_SET: - text_tag->invisible_set = g_value_get_boolean (value); + priv->invisible_set = g_value_get_boolean (value); size_changed = TRUE; break; case PROP_PARAGRAPH_BACKGROUND_SET: - text_tag->pg_bg_color_set = g_value_get_boolean (value); + priv->pg_bg_color_set = g_value_get_boolean (value); break; default: @@ -1381,8 +1397,8 @@ gtk_text_tag_set_property (GObject *object, * signal here, but the two objects are already tightly bound. */ - if (text_tag->table) - g_signal_emit_by_name (text_tag->table, + if (priv->table) + g_signal_emit_by_name (priv->table, "tag_changed", text_tag, size_changed); } @@ -1393,22 +1409,21 @@ gtk_text_tag_get_property (GObject *object, GValue *value, GParamSpec *pspec) { - GtkTextTag *tag; - - tag = GTK_TEXT_TAG (object); + GtkTextTag *tag = GTK_TEXT_TAG (object); + GtkTextTagPrivate *priv = tag->priv; switch (prop_id) { case PROP_NAME: - g_value_set_string (value, tag->name); + g_value_set_string (value, priv->name); break; case PROP_BACKGROUND_GDK: - g_value_set_boxed (value, &tag->values->appearance.bg_color); + g_value_set_boxed (value, &priv->values->appearance.bg_color); break; case PROP_FOREGROUND_GDK: - g_value_set_boxed (value, &tag->values->appearance.fg_color); + g_value_set_boxed (value, &priv->values->appearance.fg_color); break; case PROP_FONT: @@ -1416,15 +1431,15 @@ gtk_text_tag_get_property (GObject *object, gchar *str; gtk_text_tag_ensure_font (tag); - - str = pango_font_description_to_string (tag->values->font); + + str = pango_font_description_to_string (priv->values->font); g_value_take_string (value, str); } break; case PROP_FONT_DESC: gtk_text_tag_ensure_font (tag); - g_value_set_boxed (value, tag->values->font); + g_value_set_boxed (value, priv->values->font); break; case PROP_FAMILY: @@ -1438,122 +1453,122 @@ gtk_text_tag_get_property (GObject *object, switch (prop_id) { case PROP_FAMILY: - g_value_set_string (value, pango_font_description_get_family (tag->values->font)); + g_value_set_string (value, pango_font_description_get_family (priv->values->font)); break; case PROP_STYLE: - g_value_set_enum (value, pango_font_description_get_style (tag->values->font)); + g_value_set_enum (value, pango_font_description_get_style (priv->values->font)); break; case PROP_VARIANT: - g_value_set_enum (value, pango_font_description_get_variant (tag->values->font)); + g_value_set_enum (value, pango_font_description_get_variant (priv->values->font)); break; case PROP_WEIGHT: - g_value_set_int (value, pango_font_description_get_weight (tag->values->font)); + g_value_set_int (value, pango_font_description_get_weight (priv->values->font)); break; case PROP_STRETCH: - g_value_set_enum (value, pango_font_description_get_stretch (tag->values->font)); + g_value_set_enum (value, pango_font_description_get_stretch (priv->values->font)); break; case PROP_SIZE: - g_value_set_int (value, pango_font_description_get_size (tag->values->font)); + g_value_set_int (value, pango_font_description_get_size (priv->values->font)); break; case PROP_SIZE_POINTS: - g_value_set_double (value, ((double)pango_font_description_get_size (tag->values->font)) / (double)PANGO_SCALE); + g_value_set_double (value, ((double)pango_font_description_get_size (priv->values->font)) / (double)PANGO_SCALE); break; } break; case PROP_SCALE: - g_value_set_double (value, tag->values->font_scale); + g_value_set_double (value, priv->values->font_scale); break; case PROP_PIXELS_ABOVE_LINES: - g_value_set_int (value, tag->values->pixels_above_lines); + g_value_set_int (value, priv->values->pixels_above_lines); break; case PROP_PIXELS_BELOW_LINES: - g_value_set_int (value, tag->values->pixels_below_lines); + g_value_set_int (value, priv->values->pixels_below_lines); break; case PROP_PIXELS_INSIDE_WRAP: - g_value_set_int (value, tag->values->pixels_inside_wrap); + g_value_set_int (value, priv->values->pixels_inside_wrap); break; case PROP_EDITABLE: - g_value_set_boolean (value, tag->values->editable); + g_value_set_boolean (value, priv->values->editable); break; case PROP_WRAP_MODE: - g_value_set_enum (value, tag->values->wrap_mode); + g_value_set_enum (value, priv->values->wrap_mode); break; case PROP_JUSTIFICATION: - g_value_set_enum (value, tag->values->justification); + g_value_set_enum (value, priv->values->justification); break; case PROP_DIRECTION: - g_value_set_enum (value, tag->values->direction); + g_value_set_enum (value, priv->values->direction); break; case PROP_LEFT_MARGIN: - g_value_set_int (value, tag->values->left_margin); + g_value_set_int (value, priv->values->left_margin); break; case PROP_INDENT: - g_value_set_int (value, tag->values->indent); + g_value_set_int (value, priv->values->indent); break; case PROP_STRIKETHROUGH: - g_value_set_boolean (value, tag->values->appearance.strikethrough); + g_value_set_boolean (value, priv->values->appearance.strikethrough); break; case PROP_RIGHT_MARGIN: - g_value_set_int (value, tag->values->right_margin); + g_value_set_int (value, priv->values->right_margin); break; case PROP_UNDERLINE: - g_value_set_enum (value, tag->values->appearance.underline); + g_value_set_enum (value, priv->values->appearance.underline); break; case PROP_RISE: - g_value_set_int (value, tag->values->appearance.rise); + g_value_set_int (value, priv->values->appearance.rise); break; case PROP_BACKGROUND_FULL_HEIGHT: - g_value_set_boolean (value, tag->values->bg_full_height); + g_value_set_boolean (value, priv->values->bg_full_height); break; case PROP_LANGUAGE: - g_value_set_string (value, pango_language_to_string (tag->values->language)); + g_value_set_string (value, pango_language_to_string (priv->values->language)); break; case PROP_TABS: - if (tag->values->tabs) - g_value_set_boxed (value, tag->values->tabs); + if (priv->values->tabs) + g_value_set_boxed (value, priv->values->tabs); break; case PROP_INVISIBLE: - g_value_set_boolean (value, tag->values->invisible); + g_value_set_boolean (value, priv->values->invisible); break; case PROP_PARAGRAPH_BACKGROUND_GDK: - g_value_set_boxed (value, tag->values->pg_bg_color); + g_value_set_boxed (value, priv->values->pg_bg_color); break; case PROP_ACCUMULATIVE_MARGIN: - g_value_set_boolean (value, tag->accumulative_margin); + g_value_set_boolean (value, priv->accumulative_margin); break; case PROP_BACKGROUND_SET: - g_value_set_boolean (value, tag->bg_color_set); + g_value_set_boolean (value, priv->bg_color_set); break; case PROP_FOREGROUND_SET: - g_value_set_boolean (value, tag->fg_color_set); + g_value_set_boolean (value, priv->fg_color_set); break; case PROP_FAMILY_SET: @@ -1563,7 +1578,7 @@ gtk_text_tag_get_property (GObject *object, case PROP_STRETCH_SET: case PROP_SIZE_SET: { - PangoFontMask set_mask = tag->values->font ? pango_font_description_get_set_fields (tag->values->font) : 0; + PangoFontMask set_mask = priv->values->font ? pango_font_description_get_set_fields (priv->values->font) : 0; PangoFontMask test_mask = get_property_font_set_mask (prop_id); g_value_set_boolean (value, (set_mask & test_mask) != 0); @@ -1571,75 +1586,75 @@ gtk_text_tag_get_property (GObject *object, } case PROP_SCALE_SET: - g_value_set_boolean (value, tag->scale_set); + g_value_set_boolean (value, priv->scale_set); break; case PROP_PIXELS_ABOVE_LINES_SET: - g_value_set_boolean (value, tag->pixels_above_lines_set); + g_value_set_boolean (value, priv->pixels_above_lines_set); break; case PROP_PIXELS_BELOW_LINES_SET: - g_value_set_boolean (value, tag->pixels_below_lines_set); + g_value_set_boolean (value, priv->pixels_below_lines_set); break; case PROP_PIXELS_INSIDE_WRAP_SET: - g_value_set_boolean (value, tag->pixels_inside_wrap_set); + g_value_set_boolean (value, priv->pixels_inside_wrap_set); break; case PROP_EDITABLE_SET: - g_value_set_boolean (value, tag->editable_set); + g_value_set_boolean (value, priv->editable_set); break; case PROP_WRAP_MODE_SET: - g_value_set_boolean (value, tag->wrap_mode_set); + g_value_set_boolean (value, priv->wrap_mode_set); break; case PROP_JUSTIFICATION_SET: - g_value_set_boolean (value, tag->justification_set); + g_value_set_boolean (value, priv->justification_set); break; case PROP_LEFT_MARGIN_SET: - g_value_set_boolean (value, tag->left_margin_set); + g_value_set_boolean (value, priv->left_margin_set); break; case PROP_INDENT_SET: - g_value_set_boolean (value, tag->indent_set); + g_value_set_boolean (value, priv->indent_set); break; case PROP_STRIKETHROUGH_SET: - g_value_set_boolean (value, tag->strikethrough_set); + g_value_set_boolean (value, priv->strikethrough_set); break; case PROP_RIGHT_MARGIN_SET: - g_value_set_boolean (value, tag->right_margin_set); + g_value_set_boolean (value, priv->right_margin_set); break; case PROP_UNDERLINE_SET: - g_value_set_boolean (value, tag->underline_set); + g_value_set_boolean (value, priv->underline_set); break; case PROP_RISE_SET: - g_value_set_boolean (value, tag->rise_set); + g_value_set_boolean (value, priv->rise_set); break; case PROP_BACKGROUND_FULL_HEIGHT_SET: - g_value_set_boolean (value, tag->bg_full_height_set); + g_value_set_boolean (value, priv->bg_full_height_set); break; case PROP_LANGUAGE_SET: - g_value_set_boolean (value, tag->language_set); + g_value_set_boolean (value, priv->language_set); break; case PROP_TABS_SET: - g_value_set_boolean (value, tag->tabs_set); + g_value_set_boolean (value, priv->tabs_set); break; case PROP_INVISIBLE_SET: - g_value_set_boolean (value, tag->invisible_set); + g_value_set_boolean (value, priv->invisible_set); break; case PROP_PARAGRAPH_BACKGROUND_SET: - g_value_set_boolean (value, tag->pg_bg_color_set); + g_value_set_boolean (value, priv->pg_bg_color_set); break; case PROP_BACKGROUND: @@ -1665,10 +1680,11 @@ typedef struct { static void delta_priority_foreach (GtkTextTag *tag, gpointer user_data) { + GtkTextTagPrivate *priv = tag->priv; DeltaData *dd = user_data; - if (tag->priority >= dd->low && tag->priority <= dd->high) - tag->priority += dd->delta; + if (priv->priority >= dd->low && priv->priority <= dd->high) + priv->priority += dd->delta; } /** @@ -1684,7 +1700,7 @@ gtk_text_tag_get_priority (GtkTextTag *tag) { g_return_val_if_fail (GTK_IS_TEXT_TAG (tag), 0); - return tag->priority; + return tag->priv->priority; } /** @@ -1708,34 +1724,38 @@ void gtk_text_tag_set_priority (GtkTextTag *tag, gint priority) { + GtkTextTagPrivate *priv; DeltaData dd; g_return_if_fail (GTK_IS_TEXT_TAG (tag)); - g_return_if_fail (tag->table != NULL); + + priv = tag->priv; + + g_return_if_fail (priv->table != NULL); g_return_if_fail (priority >= 0); - g_return_if_fail (priority < gtk_text_tag_table_get_size (tag->table)); + g_return_if_fail (priority < gtk_text_tag_table_get_size (priv->table)); - if (priority == tag->priority) + if (priority == priv->priority) return; - if (priority < tag->priority) + if (priority < priv->priority) { dd.low = priority; - dd.high = tag->priority - 1; + dd.high = priv->priority - 1; dd.delta = 1; } else { - dd.low = tag->priority + 1; + dd.low = priv->priority + 1; dd.high = priority; dd.delta = -1; } - gtk_text_tag_table_foreach (tag->table, + gtk_text_tag_table_foreach (priv->table, delta_priority_foreach, &dd); - tag->priority = priority; + priv->priority = priority; } /** @@ -1779,7 +1799,7 @@ tag_sort_func (gconstpointer first, gconstpointer second) tag1 = * (GtkTextTag **) first; tag2 = * (GtkTextTag **) second; - return tag1->priority - tag2->priority; + return tag1->priv->priority - tag2->priv->priority; } void @@ -1801,10 +1821,10 @@ _gtk_text_tag_array_sort (GtkTextTag** tag_array_p, for (i = len-1; i > 0; i--, iter++) { maxPtrPtr = tag = iter; - prio = tag[0]->priority; + prio = tag[0]->priv->priority; for (j = i, tag++; j > 0; j--, tag++) { - if (tag[0]->priority < prio) { - prio = tag[0]->priority; + if (tag[0]->priv->priority < prio) { + prio = tag[0]->priv->priority; maxPtrPtr = tag; } } @@ -1989,22 +2009,22 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest, while (n < n_tags) { GtkTextTag *tag = tags[n]; - GtkTextAttributes *vals = tag->values; + GtkTextAttributes *vals = tag->priv->values; - g_assert (tag->table != NULL); + g_assert (tag->priv->table != NULL); if (n > 0) - g_assert (tags[n]->priority > tags[n-1]->priority); + g_assert (tags[n]->priv->priority > tags[n-1]->priv->priority); - if (tag->bg_color_set) + if (tag->priv->bg_color_set) { dest->appearance.bg_color = vals->appearance.bg_color; dest->appearance.draw_bg = TRUE; } - if (tag->fg_color_set) + if (tag->priv->fg_color_set) dest->appearance.fg_color = vals->appearance.fg_color; - - if (tag->pg_bg_color_set) + + if (tag->priv->pg_bg_color_set) { dest->pg_bg_color = gdk_color_copy (vals->pg_bg_color); } @@ -2018,72 +2038,72 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest, } /* multiply all the scales together to get a composite */ - if (tag->scale_set) + if (tag->priv->scale_set) dest->font_scale *= vals->font_scale; - - if (tag->justification_set) + + if (tag->priv->justification_set) dest->justification = vals->justification; if (vals->direction != GTK_TEXT_DIR_NONE) dest->direction = vals->direction; - if (tag->left_margin_set) + if (tag->priv->left_margin_set) { - if (tag->accumulative_margin) + if (tag->priv->accumulative_margin) left_margin_accumulative += vals->left_margin; else dest->left_margin = vals->left_margin; } - if (tag->indent_set) + if (tag->priv->indent_set) dest->indent = vals->indent; - if (tag->rise_set) + if (tag->priv->rise_set) dest->appearance.rise = vals->appearance.rise; - if (tag->right_margin_set) + if (tag->priv->right_margin_set) { - if (tag->accumulative_margin) + if (tag->priv->accumulative_margin) right_margin_accumulative += vals->right_margin; else dest->right_margin = vals->right_margin; } - if (tag->pixels_above_lines_set) + if (tag->priv->pixels_above_lines_set) dest->pixels_above_lines = vals->pixels_above_lines; - if (tag->pixels_below_lines_set) + if (tag->priv->pixels_below_lines_set) dest->pixels_below_lines = vals->pixels_below_lines; - if (tag->pixels_inside_wrap_set) + if (tag->priv->pixels_inside_wrap_set) dest->pixels_inside_wrap = vals->pixels_inside_wrap; - if (tag->tabs_set) + if (tag->priv->tabs_set) { if (dest->tabs) pango_tab_array_free (dest->tabs); dest->tabs = pango_tab_array_copy (vals->tabs); } - if (tag->wrap_mode_set) + if (tag->priv->wrap_mode_set) dest->wrap_mode = vals->wrap_mode; - if (tag->underline_set) + if (tag->priv->underline_set) dest->appearance.underline = vals->appearance.underline; - if (tag->strikethrough_set) + if (tag->priv->strikethrough_set) dest->appearance.strikethrough = vals->appearance.strikethrough; - if (tag->invisible_set) + if (tag->priv->invisible_set) dest->invisible = vals->invisible; - if (tag->editable_set) + if (tag->priv->editable_set) dest->editable = vals->editable; - if (tag->bg_full_height_set) + if (tag->priv->bg_full_height_set) dest->bg_full_height = vals->bg_full_height; - if (tag->language_set) + if (tag->priv->language_set) dest->language = vals->language; ++n; @@ -2096,34 +2116,34 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest, gboolean _gtk_text_tag_affects_size (GtkTextTag *tag) { - g_return_val_if_fail (GTK_IS_TEXT_TAG (tag), FALSE); + GtkTextTagPrivate *priv = tag->priv; return - (tag->values->font && pango_font_description_get_set_fields (tag->values->font) != 0) || - tag->scale_set || - tag->justification_set || - tag->left_margin_set || - tag->indent_set || - tag->rise_set || - tag->right_margin_set || - tag->pixels_above_lines_set || - tag->pixels_below_lines_set || - tag->pixels_inside_wrap_set || - tag->tabs_set || - tag->underline_set || - tag->wrap_mode_set || - tag->invisible_set; + (priv->values->font && pango_font_description_get_set_fields (priv->values->font) != 0) || + priv->scale_set || + priv->justification_set || + priv->left_margin_set || + priv->indent_set || + priv->rise_set || + priv->right_margin_set || + priv->pixels_above_lines_set || + priv->pixels_below_lines_set || + priv->pixels_inside_wrap_set || + priv->tabs_set || + priv->underline_set || + priv->wrap_mode_set || + priv->invisible_set; } gboolean _gtk_text_tag_affects_nonsize_appearance (GtkTextTag *tag) { - g_return_val_if_fail (GTK_IS_TEXT_TAG (tag), FALSE); + GtkTextTagPrivate *priv = tag->priv; return - tag->bg_color_set || - tag->fg_color_set || - tag->strikethrough_set || - tag->bg_full_height_set || - tag->pg_bg_color_set; + priv->bg_color_set || + priv->fg_color_set || + priv->strikethrough_set || + priv->bg_full_height_set || + priv->pg_bg_color_set; } diff --git a/gtk/gtktexttag.h b/gtk/gtktexttag.h index 20d631af9..cca6f4df0 100644 --- a/gtk/gtktexttag.h +++ b/gtk/gtktexttag.h @@ -75,61 +75,15 @@ typedef struct _GtkTextAttributes GtkTextAttributes; #define GTK_TYPE_TEXT_ATTRIBUTES (gtk_text_attributes_get_type ()) -typedef struct _GtkTextTag GtkTextTag; -typedef struct _GtkTextTagClass GtkTextTagClass; +typedef struct _GtkTextTag GtkTextTag; +typedef struct _GtkTextTagPrivate GtkTextTagPrivate; +typedef struct _GtkTextTagClass GtkTextTagClass; struct _GtkTextTag { GObject parent_instance; - GtkTextTagTable *GSEAL (table); - - char *GSEAL (name); /* Name of this tag. This field is actually - * a pointer to the key from the entry in - * tkxt->tagTable, so it needn't be freed - * explicitly. */ - int GSEAL (priority); /* Priority of this tag within widget. 0 - * means lowest priority. Exactly one tag - * has each integer value between 0 and - * numTags-1. */ - /* - * Information for displaying text with this tag. The information - * belows acts as an override on information specified by lower-priority - * tags. If no value is specified, then the next-lower-priority tag - * on the text determins the value. The text widget itself provides - * defaults if no tag specifies an override. - */ - - GtkTextAttributes *GSEAL (values); - - /* Flags for whether a given value is set; if a value is unset, then - * this tag does not affect it. - */ - guint GSEAL (bg_color_set) : 1; - guint GSEAL (fg_color_set) : 1; - guint GSEAL (scale_set) : 1; - guint GSEAL (justification_set) : 1; - guint GSEAL (left_margin_set) : 1; - guint GSEAL (indent_set) : 1; - guint GSEAL (rise_set) : 1; - guint GSEAL (strikethrough_set) : 1; - guint GSEAL (right_margin_set) : 1; - guint GSEAL (pixels_above_lines_set) : 1; - guint GSEAL (pixels_below_lines_set) : 1; - guint GSEAL (pixels_inside_wrap_set) : 1; - guint GSEAL (tabs_set) : 1; - guint GSEAL (underline_set) : 1; - guint GSEAL (wrap_mode_set) : 1; - guint GSEAL (bg_full_height_set) : 1; - guint GSEAL (invisible_set) : 1; - guint GSEAL (editable_set) : 1; - guint GSEAL (language_set) : 1; - guint GSEAL (pg_bg_color_set) : 1; - - /* Whether these margins accumulate or override */ - guint GSEAL (accumulative_margin) : 1; - - guint GSEAL (pad1) : 1; + GtkTextTagPrivate *priv; }; struct _GtkTextTagClass diff --git a/gtk/gtktexttagprivate.h b/gtk/gtktexttagprivate.h index afc3a9b34..2eb1f6bc3 100644 --- a/gtk/gtktexttagprivate.h +++ b/gtk/gtktexttagprivate.h @@ -31,6 +31,60 @@ typedef struct _GtkTextBTreeNode GtkTextBTreeNode; + +struct _GtkTextTagPrivate +{ + GtkTextTagTable *table; + + char *name; /* Name of this tag. This field is actually + * a pointer to the key from the entry in + * tkxt->tagTable, so it needn't be freed + * explicitly. */ + int priority; /* Priority of this tag within widget. 0 + * means lowest priority. Exactly one tag + * has each integer value between 0 and + * numTags-1. */ + /* + * Information for displaying text with this tag. The information + * belows acts as an override on information specified by lower-priority + * tags. If no value is specified, then the next-lower-priority tag + * on the text determins the value. The text widget itself provides + * defaults if no tag specifies an override. + */ + + GtkTextAttributes *values; + + /* Flags for whether a given value is set; if a value is unset, then + * this tag does not affect it. + */ + guint bg_color_set : 1; + guint fg_color_set : 1; + guint scale_set : 1; + guint justification_set : 1; + guint left_margin_set : 1; + guint indent_set : 1; + guint rise_set : 1; + guint strikethrough_set : 1; + guint right_margin_set : 1; + guint pixels_above_lines_set : 1; + guint pixels_below_lines_set : 1; + guint pixels_inside_wrap_set : 1; + guint tabs_set : 1; + guint underline_set : 1; + guint wrap_mode_set : 1; + guint bg_full_height_set : 1; + guint invisible_set : 1; + guint editable_set : 1; + guint language_set : 1; + guint pg_bg_color_set : 1; + + /* Whether these margins accumulate or override */ + guint accumulative_margin : 1; + + guint pad1 : 1; +}; + + /* values should already have desired defaults; this function will override * the defaults with settings in the given tags, which should be sorted in * ascending order of priority diff --git a/gtk/gtktexttagtable.c b/gtk/gtktexttagtable.c index 0bded236a..b1a99ffd1 100644 --- a/gtk/gtktexttagtable.c +++ b/gtk/gtktexttagtable.c @@ -25,7 +25,10 @@ */ #include "config.h" + #include "gtktexttagtable.h" + +#include "gtktexttagprivate.h" #include "gtkmarshalers.h" #include "gtktextbuffer.h" /* just for the lame notify_will_remove_tag hack */ #include "gtkintl.h" @@ -176,7 +179,7 @@ gtk_text_tag_table_new (void) static void foreach_unref (GtkTextTag *tag, gpointer data) { - GtkTextTagTable *table = GTK_TEXT_TAG_TABLE (tag->table); + GtkTextTagTable *table = GTK_TEXT_TAG_TABLE (tag->priv->table); GtkTextTagTablePrivate *priv = table->priv; GSList *tmp; @@ -193,7 +196,7 @@ foreach_unref (GtkTextTag *tag, gpointer data) tmp = tmp->next; } - tag->table = NULL; + tag->priv->table = NULL; g_object_unref (tag); } @@ -263,35 +266,35 @@ gtk_text_tag_table_add (GtkTextTagTable *table, g_return_if_fail (GTK_IS_TEXT_TAG_TABLE (table)); g_return_if_fail (GTK_IS_TEXT_TAG (tag)); - g_return_if_fail (tag->table == NULL); + g_return_if_fail (tag->priv->table == NULL); priv = table->priv; - if (tag->name && g_hash_table_lookup (priv->hash, tag->name)) + if (tag->priv->name && g_hash_table_lookup (priv->hash, tag->priv->name)) { g_warning ("A tag named '%s' is already in the tag table.", - tag->name); + tag->priv->name); return; } g_object_ref (tag); - if (tag->name) - g_hash_table_insert (priv->hash, tag->name, tag); + if (tag->priv->name) + g_hash_table_insert (priv->hash, tag->priv->name, tag); else { priv->anonymous = g_slist_prepend (priv->anonymous, tag); priv->anon_count += 1; } - tag->table = table; + tag->priv->table = table; /* We get the highest tag priority, as the most-recently-added tag. Note that we do NOT use gtk_text_tag_set_priority, as it assumes the tag is already in the table. */ size = gtk_text_tag_table_get_size (table); g_assert (size > 0); - tag->priority = size - 1; + tag->priv->priority = size - 1; g_signal_emit (table, signals[TAG_ADDED], 0, tag); } @@ -337,7 +340,7 @@ gtk_text_tag_table_remove (GtkTextTagTable *table, g_return_if_fail (GTK_IS_TEXT_TAG_TABLE (table)); g_return_if_fail (GTK_IS_TEXT_TAG (tag)); - g_return_if_fail (tag->table == table); + g_return_if_fail (tag->priv->table == table); priv = table->priv; @@ -358,10 +361,10 @@ gtk_text_tag_table_remove (GtkTextTagTable *table, priorities of the tags in the table. */ gtk_text_tag_set_priority (tag, gtk_text_tag_table_get_size (table) - 1); - tag->table = NULL; + tag->priv->table = NULL; - if (tag->name) - g_hash_table_remove (priv->hash, tag->name); + if (tag->priv->name) + g_hash_table_remove (priv->hash, tag->priv->name); else { priv->anonymous = g_slist_remove (priv->anonymous, tag); diff --git a/modules/other/gail/libgail-util/gailmisc.c b/modules/other/gail/libgail-util/gailmisc.c index 83910bb56..a9291e4d4 100644 --- a/modules/other/gail/libgail-util/gailmisc.c +++ b/modules/other/gail/libgail-util/gailmisc.c @@ -697,7 +697,6 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, GSList *tags, *temp_tags; gdouble scale = 1; gboolean val_set = FALSE; - PangoFontMask mask; gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset); @@ -716,17 +715,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, while (temp_tags && !val_set) { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - PangoFontDescription *font; - font = tag->values->font; - - if (font) + g_object_get (tag, "style-set", &val_set, NULL); + if (val_set) { - mask = pango_font_description_get_set_fields (font); - val_set = mask & PANGO_FONT_MASK_STYLE; - if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_STYLE); + PangoStyle style; + gchar *value; + + g_object_get (tag, "style", &style, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STYLE, style)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_STYLE, value); } temp_tags = temp_tags->next; } @@ -736,17 +734,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, while (temp_tags && !val_set) { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - PangoFontDescription *font; - font = tag->values->font; - - if (font) + g_object_get (tag, "variant-set", &val_set, NULL); + if (val_set) { - mask = pango_font_description_get_set_fields (font); - val_set = mask & PANGO_FONT_MASK_VARIANT; - if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_VARIANT); + PangoVariant variant; + gchar *value; + + g_object_get (tag, "variant", &variant, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_VARIANT, variant)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_VARIANT, value); } temp_tags = temp_tags->next; } @@ -756,17 +753,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, while (temp_tags && !val_set) { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - PangoFontDescription *font; - font = tag->values->font; - - if (font) + g_object_get (tag, "stretch-set", &val_set, NULL); + if (val_set) { - mask = pango_font_description_get_set_fields (font); - val_set = mask & PANGO_FONT_MASK_STRETCH; - if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_STRETCH); + PangoStretch stretch; + gchar *value; + + g_object_get (tag, "stretch", &stretch, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STRETCH, stretch)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_STRETCH, value); } temp_tags = temp_tags->next; } @@ -777,10 +773,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->justification_set; + g_object_get (tag, "justification-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_JUSTIFICATION); + { + GtkJustification justification; + gchar *value; + + g_object_get (tag, "justification", &justification, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_JUSTIFICATION, justification)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_JUSTIFICATION, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -789,12 +791,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, while (temp_tags && !val_set) { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); + GtkTextDirection direction; + + g_object_get (tag, "direction", &direction, NULL); - if (tag->values->direction != GTK_TEXT_DIR_NONE) + if (direction != GTK_TEXT_DIR_NONE) { + gchar *value; val_set = TRUE; - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_DIRECTION); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_DIRECTION, direction)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_DIRECTION, value); } temp_tags = temp_tags->next; } @@ -805,10 +811,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->wrap_mode_set; + g_object_get (tag, "wrap-mode-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_WRAP_MODE); + { + GtkWrapMode wrap_mode; + gchar *value; + + g_object_get (tag, "wrap-mode", &wrap_mode, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_WRAP_MODE, wrap_mode)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_WRAP_MODE, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -818,10 +830,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->fg_color_set; + g_object_get (tag, "foreground-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_FG_COLOR); + { + GdkColor c; + gchar *value; + + g_object_get (tag, "foreground-gdk", &c, NULL); + value = g_strdup_printf ("%u,%u,%u", c.red, c.green, c.blue); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_FG_COLOR, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -830,11 +848,17 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, while (temp_tags && !val_set) { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - - val_set = tag->bg_color_set; + + g_object_get (tag, "background-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_BG_COLOR); + { + GdkColor c; + gchar *value; + + g_object_get (tag, "background-gdk", &c, NULL); + value = g_strdup_printf ("%u,%u,%u", c.red, c.green, c.blue); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_BG_COLOR, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -843,17 +867,14 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, while (temp_tags && !val_set) { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - PangoFontDescription *font; - font = tag->values->font; + g_object_get (tag, "family-set", &val_set, NULL); - if (font) + if (val_set) { - mask = pango_font_description_get_set_fields (font); - val_set = mask & PANGO_FONT_MASK_FAMILY; - if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_FAMILY_NAME); + gchar *value; + g_object_get (tag, "family", &value, NULL); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_FAMILY_NAME, value); } temp_tags = temp_tags->next; } @@ -864,10 +885,14 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->language_set; + g_object_get (tag, "language-set", &val_set, NULL); + if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_LANGUAGE); + { + gchar *value; + g_object_get (tag, "language", &value, NULL); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_LANGUAGE, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -876,17 +901,17 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, while (temp_tags && !val_set) { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - PangoFontDescription *font; - font = tag->values->font; + g_object_get (tag, "weight-set", &val_set, NULL); - if (font) + if (val_set) { - mask = pango_font_description_get_set_fields (font); - val_set = mask & PANGO_FONT_MASK_WEIGHT; - if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_WEIGHT); + gint weight; + gchar *value; + + g_object_get (tag, "weight", &weight, NULL); + value = g_strdup_printf ("%d", weight); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_WEIGHT, value); } temp_tags = temp_tags->next; } @@ -901,11 +926,16 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, while (temp_tags) { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); + gboolean scale_set; - if (tag->scale_set) + g_object_get (tag, "scale-set", &scale_set, NULL); + if (scale_set) { + gdouble font_scale; + + g_object_get (tag, "scale", &font_scale, NULL); val_set = TRUE; - scale *= tag->values->font_scale; + scale *= font_scale; } temp_tags = temp_tags->next; } @@ -922,17 +952,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, while (temp_tags && !val_set) { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - PangoFontDescription *font; - font = tag->values->font; - - if (font) + g_object_get (tag, "size-set", &val_set, NULL); + if (val_set) { - mask = pango_font_description_get_set_fields (font); - val_set = mask & PANGO_FONT_MASK_SIZE; - if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_SIZE); + gint size; + gchar *value; + g_object_get (tag, "size", &size, NULL); + value = g_strdup_printf ("%i", size); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_SIZE, value); } temp_tags = temp_tags->next; } @@ -943,10 +971,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->strikethrough_set; + g_object_get (tag, "strikethrough-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_STRIKETHROUGH); + { + gboolean strikethrough; + gchar *value; + g_object_get (tag, "strikethrough", &strikethrough, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_STRIKETHROUGH, strikethrough)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_STRIKETHROUGH, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -956,10 +989,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->underline_set; + g_object_get (tag, "underline-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_UNDERLINE); + { + PangoUnderline underline; + gchar *value; + g_object_get (tag, "underline", &underline, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_UNDERLINE, underline)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_UNDERLINE, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -969,10 +1007,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->rise_set; + g_object_get (tag, "rise-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_RISE); + { + gint rise; + gchar *value; + g_object_get (tag, "rise", &rise, NULL); + value = g_strdup_printf ("%i", rise); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_RISE, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -982,10 +1025,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->bg_full_height_set; + g_object_get (tag, "background-full-height-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_BG_FULL_HEIGHT); + { + gboolean bg_full_height; + gchar *value; + g_object_get (tag, "background-full-height", &bg_full_height, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_BG_FULL_HEIGHT, bg_full_height)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_BG_FULL_HEIGHT, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -995,10 +1043,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->pixels_inside_wrap_set; + g_object_get (tag, "pixels-inside-wrap-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP); + { + gint pixels; + gchar *value; + g_object_get (tag, "pixels-inside-wrap", &pixels, NULL); + value = g_strdup_printf ("%i", pixels); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -1008,10 +1061,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->pixels_below_lines_set; + g_object_get (tag, "pixels-below-lines-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_PIXELS_BELOW_LINES); + { + gint pixels; + gchar *value; + g_object_get (tag, "pixels-below-lines", &pixels, NULL); + value = g_strdup_printf ("%i", pixels); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_PIXELS_BELOW_LINES, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -1021,10 +1079,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->pixels_above_lines_set; + g_object_get (tag, "pixels-above-lines-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_PIXELS_ABOVE_LINES); + { + gint pixels; + gchar *value; + g_object_get (tag, "pixels-above-lines", &pixels, NULL); + value = g_strdup_printf ("%i", pixels); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_PIXELS_ABOVE_LINES, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -1034,10 +1097,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->editable_set; + g_object_get (tag, "editable-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_EDITABLE); + { + gboolean editable; + gchar *value; + g_object_get (tag, "editable", &editable, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_EDITABLE, editable)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_EDITABLE, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -1047,10 +1115,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->invisible_set; + g_object_get (tag, "invisible-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_INVISIBLE); + { + gboolean invisible; + gchar *value; + g_object_get (tag, "invisible", &invisible, NULL); + value = g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_INVISIBLE, invisible)); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_INVISIBLE, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -1060,10 +1133,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->indent_set; + g_object_get (tag, "indent-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_INDENT); + { + gint indent; + gchar *value; + g_object_get (tag, "indent", &indent, NULL); + value = g_strdup_printf ("%i", indent); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_INDENT, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -1073,10 +1151,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->right_margin_set; + g_object_get (tag, "right-margin-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_RIGHT_MARGIN); + { + gint margin; + gchar *value; + g_object_get (tag, "right-margin", &margin, NULL); + value = g_strdup_printf ("%i", margin); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_RIGHT_MARGIN, value); + } temp_tags = temp_tags->next; } val_set = FALSE; @@ -1086,10 +1169,15 @@ gail_misc_buffer_get_run_attributes (GtkTextBuffer *buffer, { GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data); - val_set = tag->left_margin_set; + g_object_get (tag, "left-margin-set", &val_set, NULL); if (val_set) - attrib_set = gail_misc_add_to_attr_set (attrib_set, tag->values, - ATK_TEXT_ATTR_LEFT_MARGIN); + { + gint margin; + gchar *value; + g_object_get (tag, "left-margin", &margin, NULL); + value = g_strdup_printf ("%i", margin); + gail_misc_add_attribute (attrib_set, ATK_TEXT_ATTR_LEFT_MARGIN, value); + } temp_tags = temp_tags->next; } val_set = FALSE; -- 2.43.2