]> Pileus Git - ~andy/gtk/blobdiff - modules/other/gail/libgail-util/gailmisc.c
gtktexttag: Move public members to private header
[~andy/gtk] / modules / other / gail / libgail-util / gailmisc.c
index 83910bb562296f97f0ff6698a24c99f29673f6f0..a9291e4d46319eec3620c87043bced8d0bbba94c 100644 (file)
@@ -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;