]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktexttag.c
GtkToggleButton: Make it able to be prelight and active at the same time.
[~andy/gtk] / gtk / gtktexttag.c
index 3cb2fcad984c29ec16ca40c95079868a7fa23228..a77047c4be1604d0287f93d9cdd2e307ddc85961 100644 (file)
  *
  */
 
+#include "config.h"
 #include "gtkmain.h"
 #include "gtktexttag.h"
 #include "gtktexttypes.h"
 #include "gtktexttagtable.h"
-#include "gtksignal.h"
-#include "gtkmain.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
-#include "gtktypebuiltins.h"
+#include "gtkprivate.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -75,8 +74,6 @@ enum {
   PROP_FOREGROUND,
   PROP_BACKGROUND_GDK,
   PROP_FOREGROUND_GDK,
-  PROP_BACKGROUND_STIPPLE,
-  PROP_FOREGROUND_STIPPLE,
   PROP_FONT,
   PROP_FONT_DESC,
   PROP_FAMILY,
@@ -100,16 +97,19 @@ enum {
   PROP_RIGHT_MARGIN,
   PROP_UNDERLINE,
   PROP_RISE,
-  PROP_BG_FULL_HEIGHT,
+  PROP_BACKGROUND_FULL_HEIGHT,
   PROP_LANGUAGE,
   PROP_TABS,
   PROP_INVISIBLE,
+  PROP_PARAGRAPH_BACKGROUND,
+  PROP_PARAGRAPH_BACKGROUND_GDK,
+
+  /* Behavior args */
+  PROP_ACCUMULATIVE_MARGIN,
   
   /* Whether-a-style-arg-is-set args */
   PROP_BACKGROUND_SET,
   PROP_FOREGROUND_SET,
-  PROP_BACKGROUND_STIPPLE_SET,
-  PROP_FOREGROUND_STIPPLE_SET,
   PROP_FAMILY_SET,
   PROP_STYLE_SET,
   PROP_VARIANT_SET,
@@ -129,15 +129,14 @@ enum {
   PROP_RIGHT_MARGIN_SET,
   PROP_UNDERLINE_SET,
   PROP_RISE_SET,
-  PROP_BG_FULL_HEIGHT_SET,
+  PROP_BACKGROUND_FULL_HEIGHT_SET,
   PROP_LANGUAGE_SET,
   PROP_TABS_SET,
   PROP_INVISIBLE_SET,
+  PROP_PARAGRAPH_BACKGROUND_SET,
 
   LAST_ARG
 };
-static void gtk_text_tag_init         (GtkTextTag      *text_tag);
-static void gtk_text_tag_class_init   (GtkTextTagClass *klass);
 static void gtk_text_tag_finalize     (GObject         *object);
 static void gtk_text_tag_set_property (GObject         *object,
                                        guint            prop_id,
@@ -148,45 +147,15 @@ static void gtk_text_tag_get_property (GObject         *object,
                                        GValue          *value,
                                        GParamSpec      *pspec);
 
-static GObjectClass *parent_class = NULL;
 static guint signals[LAST_SIGNAL] = { 0 };
 
-GType
-gtk_text_tag_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (our_type == 0)
-    {
-      static const GTypeInfo our_info =
-      {
-        sizeof (GtkTextTagClass),
-        (GBaseInitFunc) NULL,
-        (GBaseFinalizeFunc) NULL,
-        (GClassInitFunc) gtk_text_tag_class_init,
-        NULL,           /* class_finalize */
-        NULL,           /* class_data */
-        sizeof (GtkTextTag),
-        0,              /* n_preallocs */
-        (GInstanceInitFunc) gtk_text_tag_init
-      };
-
-      our_type = g_type_register_static (G_TYPE_OBJECT,
-                                         "GtkTextTag",
-                                         &our_info,
-                                         0);
-    }
-
-  return our_type;
-}
+G_DEFINE_TYPE (GtkTextTag, gtk_text_tag, G_TYPE_OBJECT)
 
 static void
 gtk_text_tag_class_init (GtkTextTagClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  parent_class = g_type_class_peek_parent (klass);
-
   object_class->set_property = gtk_text_tag_set_property;
   object_class->get_property = gtk_text_tag_get_property;
   
@@ -196,431 +165,499 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
   g_object_class_install_property (object_class,
                                    PROP_NAME,
                                    g_param_spec_string ("name",
-                                                        _("Tag name"),
-                                                        _("Name used to refer to the text tag. NULL for anonymous tags."),
+                                                        P_("Tag name"),
+                                                        P_("Name used to refer to the text tag. NULL for anonymous tags"),
                                                         NULL,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+                                                        GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
   /* Style args */
 
   g_object_class_install_property (object_class,
                                    PROP_BACKGROUND,
                                    g_param_spec_string ("background",
-                                                        _("Background color name"),
-                                                        _("Background color as a string"),
+                                                        P_("Background color name"),
+                                                        P_("Background color as a string"),
                                                         NULL,
-                                                        G_PARAM_WRITABLE));
+                                                        GTK_PARAM_WRITABLE));
 
   g_object_class_install_property (object_class,
                                    PROP_BACKGROUND_GDK,
-                                   g_param_spec_boxed ("background_gdk",
-                                                       _("Background color"),
-                                                       _("Background color as a (possibly unallocated) GdkColor"),
+                                   g_param_spec_boxed ("background-gdk",
+                                                       P_("Background color"),
+                                                       P_("Background color as a (possibly unallocated) GdkColor"),
                                                        GDK_TYPE_COLOR,
-                                                       G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                       GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
-                                   PROP_BG_FULL_HEIGHT,
-                                   g_param_spec_boolean ("background_full_height",
-                                                         _("Background full height"),
-                                                         _("Whether the background color fills the entire line height or only the height of the tagged characters"),
+                                   PROP_BACKGROUND_FULL_HEIGHT,
+                                   g_param_spec_boolean ("background-full-height",
+                                                         P_("Background full height"),
+                                                         P_("Whether the background color fills the entire line height or only the height of the tagged characters"),
                                                          FALSE,
-                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));
-
+                                                         GTK_PARAM_READWRITE));
   
-  g_object_class_install_property (object_class,
-                                   PROP_BACKGROUND_STIPPLE,
-                                   g_param_spec_object ("background_stipple",
-                                                        _("Background stipple mask"),
-                                                        _("Bitmap to use as a mask when drawing the text background"),
-                                                        GDK_TYPE_PIXMAP,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));  
-
-
   g_object_class_install_property (object_class,
                                    PROP_FOREGROUND,
                                    g_param_spec_string ("foreground",
-                                                        _("Foreground color name"),
-                                                        _("Foreground color as a string"),
+                                                        P_("Foreground color name"),
+                                                        P_("Foreground color as a string"),
                                                         NULL,
-                                                        G_PARAM_WRITABLE));
+                                                        GTK_PARAM_WRITABLE));
 
   g_object_class_install_property (object_class,
                                    PROP_FOREGROUND_GDK,
-                                   g_param_spec_boxed ("foreground_gdk",
-                                                       _("Foreground color"),
-                                                       _("Foreground color as a (possibly unallocated) GdkColor"),
+                                   g_param_spec_boxed ("foreground-gdk",
+                                                       P_("Foreground color"),
+                                                       P_("Foreground color as a (possibly unallocated) GdkColor"),
                                                        GDK_TYPE_COLOR,
-                                                       G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                       GTK_PARAM_READWRITE));
 
-  
-  g_object_class_install_property (object_class,
-                                   PROP_FOREGROUND_STIPPLE,
-                                   g_param_spec_object ("foreground_stipple",
-                                                        _("Foreground stipple mask"),
-                                                        _("Bitmap to use as a mask when drawing the text foreground"),
-                                                        GDK_TYPE_PIXMAP,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));  
-  
   g_object_class_install_property (object_class,
                                    PROP_DIRECTION,
                                    g_param_spec_enum ("direction",
-                                                      _("Text direction"),
-                                                      _("Text direction, e.g. right-to-left or left-to-right"),
+                                                      P_("Text direction"),
+                                                      P_("Text direction, e.g. right-to-left or left-to-right"),
                                                       GTK_TYPE_TEXT_DIRECTION,
-                                                      GTK_TEXT_DIR_LTR,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                      GTK_TEXT_DIR_NONE,
+                                                      GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_EDITABLE,
                                    g_param_spec_boolean ("editable",
-                                                         _("Editable"),
-                                                         _("Whether the text can be modified by the user"),
+                                                         P_("Editable"),
+                                                         P_("Whether the text can be modified by the user"),
                                                          TRUE,
-                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));
-
+                                                         GTK_PARAM_READWRITE));
+
+  /**
+   * GtkTextTag:font:
+   *
+   * Font description as string, e.g. \"Sans Italic 12\". 
+   *
+   * Note that the initial value of this property depends on
+   * the internals of #PangoFontDescription.
+   */
   g_object_class_install_property (object_class,
                                    PROP_FONT,
                                    g_param_spec_string ("font",
-                                                        _("Font"),
-                                                        _("Font description as a string, e.g. \"Sans Italic 12\""),
+                                                        P_("Font"),
+                                                        P_("Font description as a string, e.g. \"Sans Italic 12\""),
                                                         NULL,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                        GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_FONT_DESC,
-                                   g_param_spec_boxed ("font_desc",
-                                                       _("Font"),
-                                                       _("Font description as a PangoFontDescription struct"),
+                                   g_param_spec_boxed ("font-desc",
+                                                       P_("Font"),
+                                                       P_("Font description as a PangoFontDescription struct"),
                                                        PANGO_TYPE_FONT_DESCRIPTION,
-                                                       G_PARAM_READABLE | G_PARAM_WRITABLE));
-
+                                                       GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_FAMILY,
                                    g_param_spec_string ("family",
-                                                        _("Font family"),
-                                                        _("Name of the font family, e.g. Sans, Helvetica, Times, Monospace"),
+                                                        P_("Font family"),
+                                                        P_("Name of the font family, e.g. Sans, Helvetica, Times, Monospace"),
                                                         NULL,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                        GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_STYLE,
                                    g_param_spec_enum ("style",
-                                                      _("Font style"),
-                                                      _("Font style as a PangoStyle, e.g. PANGO_STYLE_ITALIC."),
+                                                      P_("Font style"),
+                                                      P_("Font style as a PangoStyle, e.g. PANGO_STYLE_ITALIC"),
                                                       PANGO_TYPE_STYLE,
                                                       PANGO_STYLE_NORMAL,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                      GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_VARIANT,
                                    g_param_spec_enum ("variant",
-                                                     _("Font variant"),
-                                                     _("Font variant as a PangoVariant, e.g. PANGO_VARIANT_SMALL_CAPS."),
+                                                     P_("Font variant"),
+                                                     P_("Font variant as a PangoVariant, e.g. PANGO_VARIANT_SMALL_CAPS"),
                                                       PANGO_TYPE_VARIANT,
                                                       PANGO_VARIANT_NORMAL,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                      GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_WEIGHT,
                                    g_param_spec_int ("weight",
-                                                     _("Font weight"),
-                                                     _("Font weight as an integer, see predefined values in PangoWeight; for example, PANGO_WEIGHT_BOLD."),
+                                                     P_("Font weight"),
+                                                     P_("Font weight as an integer, see predefined values in PangoWeight; for example, PANGO_WEIGHT_BOLD"),
                                                      0,
                                                      G_MAXINT,
                                                      PANGO_WEIGHT_NORMAL,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
   
 
   g_object_class_install_property (object_class,
                                    PROP_STRETCH,
                                    g_param_spec_enum ("stretch",
-                                                      _("Font stretch"),
-                                                      _("Font stretch as a PangoStretch, e.g. PANGO_STRETCH_CONDENSED."),
+                                                      P_("Font stretch"),
+                                                      P_("Font stretch as a PangoStretch, e.g. PANGO_STRETCH_CONDENSED"),
                                                       PANGO_TYPE_STRETCH,
                                                       PANGO_STRETCH_NORMAL,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                      GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_SIZE,
                                    g_param_spec_int ("size",
-                                                     _("Font size"),
-                                                     _("Font size in Pango units."),
+                                                     P_("Font size"),
+                                                     P_("Font size in Pango units"),
                                                      0,
                                                      G_MAXINT,
                                                      0,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_SCALE,
                                    g_param_spec_double ("scale",
-                                                        _("Font scale"),
-                                                        _("Font size as a scale factor relative to the default font size. This properly adapts to theme changes etc. so is recommended. Pango predefines some scales such as PANGO_SCALE_X_LARGE."),
+                                                        P_("Font scale"),
+                                                        P_("Font size as a scale factor relative to the default font size. This properly adapts to theme changes etc. so is recommended. Pango predefines some scales such as PANGO_SCALE_X_LARGE"),
                                                         0.0,
                                                         G_MAXDOUBLE,
                                                         1.0,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                        GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_SIZE_POINTS,
-                                   g_param_spec_double ("size_points",
-                                                        _("Font points"),
-                                                        _("Font size in points"),
+                                   g_param_spec_double ("size-points",
+                                                        P_("Font points"),
+                                                        P_("Font size in points"),
                                                         0.0,
                                                         G_MAXDOUBLE,
                                                         0.0,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));  
+                                                        GTK_PARAM_READWRITE));  
 
   g_object_class_install_property (object_class,
                                    PROP_JUSTIFICATION,
                                    g_param_spec_enum ("justification",
-                                                      _("Justification"),
-                                                      _("Left, right, or center justification"),
+                                                      P_("Justification"),
+                                                      P_("Left, right, or center justification"),
                                                       GTK_TYPE_JUSTIFICATION,
                                                       GTK_JUSTIFY_LEFT,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
-  
+                                                      GTK_PARAM_READWRITE));
+
+  /**
+   * GtkTextTag:language:
+   *
+   * The language this text is in, as an ISO code. Pango can use this as a 
+   * hint when rendering the text. If not set, an appropriate default will be 
+   * used.
+   *
+   * Note that the initial value of this property depends on the current
+   * locale, see also gtk_get_default_language().
+   */
   g_object_class_install_property (object_class,
                                    PROP_LANGUAGE,
                                    g_param_spec_string ("language",
-                                                        _("Language"),
-                                                        _("The language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If you don't understand this parameter, you probably don't need it."),
+                                                        P_("Language"),
+                                                        P_("The language this text is in, as an ISO code. Pango can use this as a hint when rendering the text. If not set, an appropriate default will be used."),
                                                         NULL,
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));  
+                                                        GTK_PARAM_READWRITE));  
 
   g_object_class_install_property (object_class,
                                    PROP_LEFT_MARGIN,
-                                   g_param_spec_int ("left_margin",
-                                                     _("Left margin"),
-                                                     _("Width of the left margin in pixels"),
+                                   g_param_spec_int ("left-margin",
+                                                     P_("Left margin"),
+                                                     P_("Width of the left margin in pixels"),
                                                      0,
                                                      G_MAXINT,
                                                      0,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_RIGHT_MARGIN,
-                                   g_param_spec_int ("right_margin",
-                                                     _("Right margin"),
-                                                     _("Width of the right margin in pixels"),
+                                   g_param_spec_int ("right-margin",
+                                                     P_("Right margin"),
+                                                     P_("Width of the right margin in pixels"),
                                                      0,
                                                      G_MAXINT,
                                                      0,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   
   g_object_class_install_property (object_class,
                                    PROP_INDENT,
                                    g_param_spec_int ("indent",
-                                                     _("Indent"),
-                                                     _("Amount to indent the paragraph, in pixels"),
+                                                     P_("Indent"),
+                                                     P_("Amount to indent the paragraph, in pixels"),
                                                      G_MININT,
                                                      G_MAXINT,
                                                      0,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   
   g_object_class_install_property (object_class,
                                    PROP_RISE,
                                    g_param_spec_int ("rise",
-                                                     _("Rise"),
-                                                     _("Offset of text above the baseline (below the baseline if rise is negative) in pixels"),
+                                                     P_("Rise"),
+                                                     P_("Offset of text above the baseline (below the baseline if rise is negative) in Pango units"),
                                                     G_MININT,
                                                      G_MAXINT,
                                                      0,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_PIXELS_ABOVE_LINES,
-                                   g_param_spec_int ("pixels_above_lines",
-                                                     _("Pixels above lines"),
-                                                     _("Pixels of blank space above paragraphs"),
+                                   g_param_spec_int ("pixels-above-lines",
+                                                     P_("Pixels above lines"),
+                                                     P_("Pixels of blank space above paragraphs"),
                                                      0,
                                                      G_MAXINT,
                                                      0,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_PIXELS_BELOW_LINES,
-                                   g_param_spec_int ("pixels_below_lines",
-                                                     _("Pixels below lines"),
-                                                     _("Pixels of blank space below paragraphs"),
+                                   g_param_spec_int ("pixels-below-lines",
+                                                     P_("Pixels below lines"),
+                                                     P_("Pixels of blank space below paragraphs"),
                                                      0,
                                                      G_MAXINT,
                                                      0,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_PIXELS_INSIDE_WRAP,
-                                   g_param_spec_int ("pixels_inside_wrap",
-                                                     _("Pixels inside wrap"),
-                                                     _("Pixels of blank space between wrapped lines in a paragraph"),
+                                   g_param_spec_int ("pixels-inside-wrap",
+                                                     P_("Pixels inside wrap"),
+                                                     P_("Pixels of blank space between wrapped lines in a paragraph"),
                                                      0,
                                                      G_MAXINT,
                                                      0,
-                                                     G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                     GTK_PARAM_READWRITE));
 
   g_object_class_install_property (object_class,
                                    PROP_STRIKETHROUGH,
                                    g_param_spec_boolean ("strikethrough",
-                                                         _("Strikethrough"),
-                                                         _("Whether to strike through the text"),
+                                                         P_("Strikethrough"),
+                                                         P_("Whether to strike through the text"),
                                                          FALSE,
-                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                         GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_UNDERLINE,
                                    g_param_spec_enum ("underline",
-                                                      _("Underline"),
-                                                      _("Style of underline for this text"),
+                                                      P_("Underline"),
+                                                      P_("Style of underline for this text"),
                                                       PANGO_TYPE_UNDERLINE,
                                                       PANGO_UNDERLINE_NONE,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                      GTK_PARAM_READWRITE));
   
   g_object_class_install_property (object_class,
                                    PROP_WRAP_MODE,
-                                   g_param_spec_enum ("wrap_mode",
-                                                     _("Wrap mode"),
-                                                     _("Whether to wrap lines never, at word boundaries, or at character boundaries"),
+                                   g_param_spec_enum ("wrap-mode",
+                                                     P_("Wrap mode"),
+                                                     P_("Whether to wrap lines never, at word boundaries, or at character boundaries"),
                                                       GTK_TYPE_WRAP_MODE,
                                                       GTK_WRAP_NONE,
-                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                      GTK_PARAM_READWRITE));
   
 
   g_object_class_install_property (object_class,
                                    PROP_TABS,
                                    g_param_spec_boxed ("tabs",
-                                                       _("Tabs"),
-                                                       _("Custom tabs for this text"),
+                                                       P_("Tabs"),
+                                                       P_("Custom tabs for this text"),
                                                        PANGO_TYPE_TAB_ARRAY,
-                                                       G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                       GTK_PARAM_READWRITE));
   
+  /**
+   * GtkTextTag:invisible:
+   *
+   * Whether this text is hidden.
+   *
+   * Note that there may still be problems with the support for invisible 
+   * text, in particular when navigating programmatically inside a buffer
+   * containing invisible segments. 
+   *
+   * Since: 2.8
+   */
   g_object_class_install_property (object_class,
                                    PROP_INVISIBLE,
                                    g_param_spec_boolean ("invisible",
-                                                         _("Invisible"),
-                                                         _("Whether this text is hidden. Not implemented in GTK 2.0"),
+                                                         P_("Invisible"),
+                                                         P_("Whether this text is hidden."),
                                                          FALSE,
-                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));
+                                                         GTK_PARAM_READWRITE));
+
+  /**
+   * GtkTextTag:paragraph-background:
+   *
+   * The paragraph background color as a string.
+   *
+   * Since: 2.8
+   */
+  g_object_class_install_property (object_class,
+                                   PROP_PARAGRAPH_BACKGROUND,
+                                   g_param_spec_string ("paragraph-background",
+                                                        P_("Paragraph background color name"),
+                                                        P_("Paragraph background color as a string"),
+                                                        NULL,
+                                                        GTK_PARAM_WRITABLE));
+
+  /**
+   * GtkTextTag:paragraph-background-gdk:
+   *
+   * The paragraph background color as a as a (possibly unallocated) 
+   * #GdkColor.
+   *
+   * Since: 2.8
+   */
+  g_object_class_install_property (object_class,
+                                   PROP_PARAGRAPH_BACKGROUND_GDK,
+                                   g_param_spec_boxed ("paragraph-background-gdk",
+                                                       P_("Paragraph background color"),
+                                                       P_("Paragraph background color as a (possibly unallocated) GdkColor"),
+                                                       GDK_TYPE_COLOR,
+                                                       GTK_PARAM_READWRITE));
+
+  /**
+   * GtkTextTag:accumulative-margin:
+   *
+   * Whether the margins accumulate or override each other.
+   *
+   * When set to %TRUE the margins of this tag are added to the margins 
+   * of any other non-accumulative margins present. When set to %FALSE 
+   * the margins override one another (the default).
+   *
+   * Since: 2.12
+   */
+  g_object_class_install_property (object_class,
+                                   PROP_ACCUMULATIVE_MARGIN,
+                                   g_param_spec_boolean ("accumulative-margin",
+                                                         P_("Margin Accumulates"),
+                                                         P_("Whether left and right margins accumulate."),
+                                                         FALSE,
+                                                         GTK_PARAM_READWRITE));
 
   /* Style props are set or not */
 
-#define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (object_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, G_PARAM_READABLE | G_PARAM_WRITABLE))
+#define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (object_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, GTK_PARAM_READWRITE))
 
-  ADD_SET_PROP ("background_set", PROP_BACKGROUND_SET,
-                _("Background set"),
-                _("Whether this tag affects the background color"));
+  ADD_SET_PROP ("background-set", PROP_BACKGROUND_SET,
+                P_("Background set"),
+                P_("Whether this tag affects the background color"));
   
-  ADD_SET_PROP ("background_full_height_set", PROP_BG_FULL_HEIGHT_SET,
-                _("Background full height set"),
-                _("Whether this tag affects background height"));
+  ADD_SET_PROP ("background-full-height-set", PROP_BACKGROUND_FULL_HEIGHT_SET,
+                P_("Background full height set"),
+                P_("Whether this tag affects background height"));
 
-  ADD_SET_PROP ("background_stipple_set", PROP_BACKGROUND_STIPPLE_SET,
-                _("Background stipple set"),
-                _("Whether this tag affects the background stipple"));  
+  ADD_SET_PROP ("foreground-set", PROP_FOREGROUND_SET,
+                P_("Foreground set"),
+                P_("Whether this tag affects the foreground color"));
 
-  ADD_SET_PROP ("foreground_set", PROP_FOREGROUND_SET,
-                _("Foreground set"),
-                _("Whether this tag affects the foreground color"));
-
-  ADD_SET_PROP ("foreground_stipple_set", PROP_FOREGROUND_STIPPLE_SET,
-                _("Foreground stipple set"),
-                _("Whether this tag affects the foreground stipple"));
-  
-  ADD_SET_PROP ("editable_set", PROP_EDITABLE_SET,
-                _("Editability set"),
-                _("Whether this tag affects text editability"));
+  ADD_SET_PROP ("editable-set", PROP_EDITABLE_SET,
+                P_("Editability set"),
+                P_("Whether this tag affects text editability"));
 
-  ADD_SET_PROP ("family_set", PROP_FAMILY_SET,
-                _("Font family set"),
-                _("Whether this tag affects the font family"));  
+  ADD_SET_PROP ("family-set", PROP_FAMILY_SET,
+                P_("Font family set"),
+                P_("Whether this tag affects the font family"));  
 
-  ADD_SET_PROP ("style_set", PROP_STYLE_SET,
-                _("Font style set"),
-                _("Whether this tag affects the font style"));
+  ADD_SET_PROP ("style-set", PROP_STYLE_SET,
+                P_("Font style set"),
+                P_("Whether this tag affects the font style"));
 
-  ADD_SET_PROP ("variant_set", PROP_VARIANT_SET,
-                _("Font variant set"),
-                _("Whether this tag affects the font variant"));
+  ADD_SET_PROP ("variant-set", PROP_VARIANT_SET,
+                P_("Font variant set"),
+                P_("Whether this tag affects the font variant"));
 
-  ADD_SET_PROP ("weight_set", PROP_WEIGHT_SET,
-                _("Font weight set"),
-                _("Whether this tag affects the font weight"));
+  ADD_SET_PROP ("weight-set", PROP_WEIGHT_SET,
+                P_("Font weight set"),
+                P_("Whether this tag affects the font weight"));
 
-  ADD_SET_PROP ("stretch_set", PROP_STRETCH_SET,
-                _("Font stretch set"),
-                _("Whether this tag affects the font stretch"));
+  ADD_SET_PROP ("stretch-set", PROP_STRETCH_SET,
+                P_("Font stretch set"),
+                P_("Whether this tag affects the font stretch"));
 
-  ADD_SET_PROP ("size_set", PROP_SIZE_SET,
-                _("Font size set"),
-                _("Whether this tag affects the font size"));
+  ADD_SET_PROP ("size-set", PROP_SIZE_SET,
+                P_("Font size set"),
+                P_("Whether this tag affects the font size"));
 
-  ADD_SET_PROP ("scale_set", PROP_SCALE_SET,
-                _("Font scale set"),
-                _("Whether this tag scales the font size by a factor"));
+  ADD_SET_PROP ("scale-set", PROP_SCALE_SET,
+                P_("Font scale set"),
+                P_("Whether this tag scales the font size by a factor"));
   
-  ADD_SET_PROP ("justification_set", PROP_JUSTIFICATION_SET,
-                _("Justification set"),
-                _("Whether this tag affects paragraph justification"));
+  ADD_SET_PROP ("justification-set", PROP_JUSTIFICATION_SET,
+                P_("Justification set"),
+                P_("Whether this tag affects paragraph justification"));
   
-  ADD_SET_PROP ("language_set", PROP_LANGUAGE_SET,
-                _("Language set"),
-                _("Whether this tag affects the language the text is rendered as"));
+  ADD_SET_PROP ("language-set", PROP_LANGUAGE_SET,
+                P_("Language set"),
+                P_("Whether this tag affects the language the text is rendered as"));
 
-  ADD_SET_PROP ("left_margin_set", PROP_LEFT_MARGIN_SET,
-                _("Left margin set"),
-                _("Whether this tag affects the left margin"));
+  ADD_SET_PROP ("left-margin-set", PROP_LEFT_MARGIN_SET,
+                P_("Left margin set"),
+                P_("Whether this tag affects the left margin"));
 
-  ADD_SET_PROP ("indent_set", PROP_INDENT_SET,
-                _("Indent set"),
-                _("Whether this tag affects indentation"));
+  ADD_SET_PROP ("indent-set", PROP_INDENT_SET,
+                P_("Indent set"),
+                P_("Whether this tag affects indentation"));
 
-  ADD_SET_PROP ("rise_set", PROP_RISE_SET,
-                _("Rise set"),
-                _("Whether this tag affects the rise"));
+  ADD_SET_PROP ("rise-set", PROP_RISE_SET,
+                P_("Rise set"),
+                P_("Whether this tag affects the rise"));
 
-  ADD_SET_PROP ("pixels_above_lines_set", PROP_PIXELS_ABOVE_LINES_SET,
-                _("Pixels above lines set"),
-                _("Whether this tag affects the number of pixels above lines"));
+  ADD_SET_PROP ("pixels-above-lines-set", PROP_PIXELS_ABOVE_LINES_SET,
+                P_("Pixels above lines set"),
+                P_("Whether this tag affects the number of pixels above lines"));
 
-  ADD_SET_PROP ("pixels_below_lines_set", PROP_PIXELS_BELOW_LINES_SET,
-                _("Pixels below lines set"),
-                _("Whether this tag affects the number of pixels above lines"));
+  ADD_SET_PROP ("pixels-below-lines-set", PROP_PIXELS_BELOW_LINES_SET,
+                P_("Pixels below lines set"),
+                P_("Whether this tag affects the number of pixels above lines"));
 
-  ADD_SET_PROP ("pixels_inside_wrap_set", PROP_PIXELS_INSIDE_WRAP_SET,
-                _("Pixels inside wrap set"),
-                _("Whether this tag affects the number of pixels between wrapped lines"));
+  ADD_SET_PROP ("pixels-inside-wrap-set", PROP_PIXELS_INSIDE_WRAP_SET,
+                P_("Pixels inside wrap set"),
+                P_("Whether this tag affects the number of pixels between wrapped lines"));
 
-  ADD_SET_PROP ("strikethrough_set", PROP_STRIKETHROUGH_SET,
-                _("Strikethrough set"),
-                _("Whether this tag affects strikethrough"));
+  ADD_SET_PROP ("strikethrough-set", PROP_STRIKETHROUGH_SET,
+                P_("Strikethrough set"),
+                P_("Whether this tag affects strikethrough"));
   
-  ADD_SET_PROP ("right_margin_set", PROP_RIGHT_MARGIN_SET,
-                _("Right margin set"),
-                _("Whether this tag affects the right margin"));
-
-  ADD_SET_PROP ("underline_set", PROP_UNDERLINE_SET,
-                _("Underline set"),
-                _("Whether this tag affects underlining"));
-
-  ADD_SET_PROP ("wrap_mode_set", PROP_WRAP_MODE_SET,
-                _("Wrap mode set"),
-                _("Whether this tag affects line wrap mode"));
-
-  ADD_SET_PROP ("tabs_set", PROP_TABS_SET,
-                _("Tabs set"),
-                _("Whether this tag affects tabs"));
-
-  ADD_SET_PROP ("invisible_set", PROP_INVISIBLE_SET,
-                _("Invisible set"),
-                _("Whether this tag affects text visibility"));
-
+  ADD_SET_PROP ("right-margin-set", PROP_RIGHT_MARGIN_SET,
+                P_("Right margin set"),
+                P_("Whether this tag affects the right margin"));
+
+  ADD_SET_PROP ("underline-set", PROP_UNDERLINE_SET,
+                P_("Underline set"),
+                P_("Whether this tag affects underlining"));
+
+  ADD_SET_PROP ("wrap-mode-set", PROP_WRAP_MODE_SET,
+                P_("Wrap mode set"),
+                P_("Whether this tag affects line wrap mode"));
+
+  ADD_SET_PROP ("tabs-set", PROP_TABS_SET,
+                P_("Tabs set"),
+                P_("Whether this tag affects tabs"));
+
+  ADD_SET_PROP ("invisible-set", PROP_INVISIBLE_SET,
+                P_("Invisible set"),
+                P_("Whether this tag affects text visibility"));
+
+  ADD_SET_PROP ("paragraph-background-set", PROP_PARAGRAPH_BACKGROUND_SET,
+                P_("Paragraph background set"),
+                P_("Whether this tag affects the paragraph background color"));
+
+  /**
+   * GtkTextTag::event:
+   * @tag: the #GtkTextTag on which the signal is emitted
+   * @object: the object the event was fired from (typically a #GtkTextView)
+   * @event: the event which triggered the signal
+   * @iter: a #GtkTextIter pointing at the location the event occured
+   *
+   * The ::event signal is emitted when an event occurs on a region of the
+   * buffer marked with this tag.
+   *
+   * Returns: %TRUE to stop other handlers from being invoked for the
+   * event. %FALSE to propagate the event further.
+   */
   signals[EVENT] =
-    g_signal_new ("event",
+    g_signal_new (I_("event"),
                   G_OBJECT_CLASS_TYPE (object_class),
                   G_SIGNAL_RUN_LAST,
-                  GTK_SIGNAL_OFFSET (GtkTextTagClass, event),
+                  G_STRUCT_OFFSET (GtkTextTagClass, event),
                   _gtk_boolean_handled_accumulator, NULL,
                   _gtk_marshal_BOOLEAN__OBJECT_BOXED_BOXED,
                   G_TYPE_BOOLEAN,
@@ -633,15 +670,12 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
 static void
 gtk_text_tag_init (GtkTextTag *text_tag)
 {
-  /* 0 is basically a fine way to initialize everything in the
-     entire struct */
-  
   text_tag->values = gtk_text_attributes_new ();
 }
 
 /**
  * gtk_text_tag_new:
- * @name: tag name, or %NULL
+ * @name: (allow-none): tag name, or %NULL
  * 
  * Creates a #GtkTextTag. Configure the tag using object arguments,
  * i.e. using g_object_set().
@@ -653,9 +687,7 @@ gtk_text_tag_new (const gchar *name)
 {
   GtkTextTag *tag;
 
-  tag = GTK_TEXT_TAG (g_object_new (gtk_text_tag_get_type (),
-                                    "name", name,
-                                    NULL));
+  tag = g_object_new (GTK_TYPE_TEXT_TAG, "name", name, NULL);
 
   return tag;
 }
@@ -667,8 +699,6 @@ gtk_text_tag_finalize (GObject *object)
 
   text_tag = GTK_TEXT_TAG (object);
 
-  g_assert (!text_tag->values->realized);
-
   if (text_tag->table)
     gtk_text_tag_table_remove (text_tag->table, text_tag);
 
@@ -680,7 +710,7 @@ gtk_text_tag_finalize (GObject *object)
   g_free (text_tag->name);
   text_tag->name = NULL;
 
-  (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+  G_OBJECT_CLASS (gtk_text_tag_parent_class)->finalize (object);
 }
 
 static void
@@ -691,7 +721,7 @@ set_bg_color (GtkTextTag *tag, GdkColor *color)
       if (!tag->bg_color_set)
         {
           tag->bg_color_set = TRUE;
-          g_object_notify (G_OBJECT (tag), "background_set");
+          g_object_notify (G_OBJECT (tag), "background-set");
         }
       
       tag->values->appearance.bg_color = *color;
@@ -701,7 +731,7 @@ set_bg_color (GtkTextTag *tag, GdkColor *color)
       if (tag->bg_color_set)
         {
           tag->bg_color_set = FALSE;
-          g_object_notify (G_OBJECT (tag), "background_set");
+          g_object_notify (G_OBJECT (tag), "background-set");
         }
     }
 }
@@ -714,7 +744,7 @@ set_fg_color (GtkTextTag *tag, GdkColor *color)
       if (!tag->fg_color_set)
         {
           tag->fg_color_set = TRUE;
-          g_object_notify (G_OBJECT (tag), "foreground_set");
+          g_object_notify (G_OBJECT (tag), "foreground-set");
         }
       tag->values->appearance.fg_color = *color;
     }
@@ -723,11 +753,39 @@ set_fg_color (GtkTextTag *tag, GdkColor *color)
       if (tag->fg_color_set)
         {
           tag->fg_color_set = FALSE;
-          g_object_notify (G_OBJECT (tag), "foreground_set");
+          g_object_notify (G_OBJECT (tag), "foreground-set");
         }
     }
 }
 
+static void
+set_pg_bg_color (GtkTextTag *tag, GdkColor *color)
+{
+  if (color)
+    {
+      if (!tag->pg_bg_color_set)
+        {
+          tag->pg_bg_color_set = TRUE;
+          g_object_notify (G_OBJECT (tag), "paragraph-background-set");
+        }
+      else
+       gdk_color_free (tag->values->pg_bg_color);
+
+      tag->values->pg_bg_color = gdk_color_copy (color);
+    }
+  else
+    {
+      if (tag->pg_bg_color_set)
+        {
+          tag->pg_bg_color_set = FALSE;
+          g_object_notify (G_OBJECT (tag), "paragraph-background-set");
+         gdk_color_free (tag->values->pg_bg_color);
+        }
+
+      tag->values->pg_bg_color = NULL;
+    }
+}
+
 static PangoFontMask
 get_property_font_set_mask (guint prop_id)
 {
@@ -795,17 +853,17 @@ notify_set_changed (GObject       *object,
                    PangoFontMask  changed_mask)
 {
   if (changed_mask & PANGO_FONT_MASK_FAMILY)
-    g_object_notify (object, "family_set");
+    g_object_notify (object, "family-set");
   if (changed_mask & PANGO_FONT_MASK_STYLE)
-    g_object_notify (object, "style_set");
+    g_object_notify (object, "style-set");
   if (changed_mask & PANGO_FONT_MASK_VARIANT)
-    g_object_notify (object, "variant_set");
+    g_object_notify (object, "variant-set");
   if (changed_mask & PANGO_FONT_MASK_WEIGHT)
-    g_object_notify (object, "weight_set");
+    g_object_notify (object, "weight-set");
   if (changed_mask & PANGO_FONT_MASK_STRETCH)
-    g_object_notify (object, "stretch_set");
+    g_object_notify (object, "stretch-set");
   if (changed_mask & PANGO_FONT_MASK_SIZE)
-    g_object_notify (object, "size_set");
+    g_object_notify (object, "size-set");
 }
 
 static void
@@ -855,7 +913,7 @@ set_font_description (GtkTextTag           *text_tag,
   
   g_object_freeze_notify (object);
 
-  g_object_notify (object, "font_desc");
+  g_object_notify (object, "font-desc");
   g_object_notify (object, "font");
   
   if (changed_mask & PANGO_FONT_MASK_FAMILY)
@@ -871,7 +929,7 @@ set_font_description (GtkTextTag           *text_tag,
   if (changed_mask & PANGO_FONT_MASK_SIZE)
     {
       g_object_notify (object, "size");
-      g_object_notify (object, "size_points");
+      g_object_notify (object, "size-points");
     }
 
   notify_set_changed (object, set_changed_mask);
@@ -897,25 +955,25 @@ gtk_text_tag_set_property (GObject      *object,
 
   text_tag = GTK_TEXT_TAG (object);
 
-  g_return_if_fail (!text_tag->values->realized);
-
   switch (prop_id)
     {
     case PROP_NAME:
       g_return_if_fail (text_tag->name == NULL);
-      text_tag->name = g_strdup (g_value_get_string (value));
+      text_tag->name = g_value_dup_string (value);
       break;
 
     case PROP_BACKGROUND:
       {
         GdkColor color;
 
-        if (gdk_color_parse (g_value_get_string (value), &color))
+        if (!g_value_get_string (value))
+          set_bg_color (text_tag, NULL);       /* reset to background_set to FALSE */
+        else if (gdk_color_parse (g_value_get_string (value), &color))
           set_bg_color (text_tag, &color);
         else
           g_warning ("Don't know color `%s'", g_value_get_string (value));
 
-        g_object_notify (object, "background_gdk");
+        g_object_notify (object, "background-gdk");
       }
       break;
 
@@ -923,12 +981,14 @@ gtk_text_tag_set_property (GObject      *object,
       {
         GdkColor color;
 
-        if (gdk_color_parse (g_value_get_string (value), &color))
+        if (!g_value_get_string (value))
+          set_fg_color (text_tag, NULL);       /* reset to foreground_set to FALSE */
+        else if (gdk_color_parse (g_value_get_string (value), &color))
           set_fg_color (text_tag, &color);
         else
           g_warning ("Don't know color `%s'", g_value_get_string (value));
 
-        g_object_notify (object, "foreground_gdk");
+        g_object_notify (object, "foreground-gdk");
       }
       break;
 
@@ -948,46 +1008,6 @@ gtk_text_tag_set_property (GObject      *object,
       }
       break;
 
-    case PROP_BACKGROUND_STIPPLE:
-      {
-        GdkBitmap *bitmap = g_value_get_object (value);
-
-        text_tag->bg_stipple_set = TRUE;
-        g_object_notify (object, "background_stipple_set");
-        
-        if (text_tag->values->appearance.bg_stipple != bitmap)
-          {
-            if (bitmap != NULL)
-              gdk_bitmap_ref (bitmap);
-
-            if (text_tag->values->appearance.bg_stipple)
-              gdk_bitmap_unref (text_tag->values->appearance.bg_stipple);
-
-            text_tag->values->appearance.bg_stipple = bitmap;
-          }
-      }
-      break;
-
-    case PROP_FOREGROUND_STIPPLE:
-      {
-        GdkBitmap *bitmap = g_value_get_object (value);
-
-        text_tag->fg_stipple_set = TRUE;
-        g_object_notify (object, "foreground_stipple_set");
-
-        if (text_tag->values->appearance.fg_stipple != bitmap)
-          {
-            if (bitmap != NULL)
-              gdk_bitmap_ref (bitmap);
-
-            if (text_tag->values->appearance.fg_stipple)
-              gdk_bitmap_unref (text_tag->values->appearance.fg_stipple);
-
-            text_tag->values->appearance.fg_stipple = bitmap;
-          }
-      }
-      break;
-
     case PROP_FONT:
       {
         PangoFontDescription *font_desc = NULL;
@@ -1056,7 +1076,7 @@ gtk_text_tag_set_property (GObject      *object,
          case PROP_SIZE:
            pango_font_description_set_size (text_tag->values->font,
                                             g_value_get_int (value));
-           g_object_notify (object, "size_points");
+           g_object_notify (object, "size-points");
            break;
          case PROP_SIZE_POINTS:
            pango_font_description_set_size (text_tag->values->font,
@@ -1067,7 +1087,7 @@ gtk_text_tag_set_property (GObject      *object,
 
        size_changed = TRUE;
        notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (text_tag->values->font));
-       g_object_notify (object, "font_desc");
+       g_object_notify (object, "font-desc");
        g_object_notify (object, "font");
 
        break;
@@ -1076,48 +1096,48 @@ 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;
-      g_object_notify (object, "scale_set");
+      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);
-      g_object_notify (object, "pixels_above_lines_set");
+      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);
-      g_object_notify (object, "pixels_below_lines_set");
+      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);
-      g_object_notify (object, "pixels_inside_wrap_set");
+      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);
-      g_object_notify (object, "editable_set");
+      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);
-      g_object_notify (object, "wrap_mode_set");
+      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);
-      g_object_notify (object, "justification_set");
+      g_object_notify (object, "justification-set");
       size_changed = TRUE;
       break;
 
@@ -1128,53 +1148,53 @@ gtk_text_tag_set_property (GObject      *object,
     case PROP_LEFT_MARGIN:
       text_tag->left_margin_set = TRUE;
       text_tag->values->left_margin = g_value_get_int (value);
-      g_object_notify (object, "left_margin_set");
+      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);
-      g_object_notify (object, "indent_set");
+      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);
-      g_object_notify (object, "strikethrough_set");
+      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);
-      g_object_notify (object, "right_margin_set");
+      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);
-      g_object_notify (object, "underline_set");
+      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);
-      g_object_notify (object, "rise_set");
+      g_object_notify (object, "rise-set");
       size_changed = TRUE;      
       break;
 
-    case PROP_BG_FULL_HEIGHT:
+    case PROP_BACKGROUND_FULL_HEIGHT:
       text_tag->bg_full_height_set = TRUE;
       text_tag->values->bg_full_height = g_value_get_boolean (value);
-      g_object_notify (object, "background_full_height_set");
+      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));
-      g_object_notify (object, "language_set");
+      g_object_notify (object, "language-set");
       break;
 
     case PROP_TABS:
@@ -1187,19 +1207,47 @@ gtk_text_tag_set_property (GObject      *object,
       text_tag->values->tabs =
         pango_tab_array_copy (g_value_get_boxed (value));
 
-      g_object_notify (object, "tabs_set");
+      g_object_notify (object, "tabs-set");
       
       size_changed = TRUE;
       break;
 
     case PROP_INVISIBLE:
-      g_warning ("The \"invisible\" property on GtkTextTag is not supported for GTK 2.0, it will be added in a future release. see http://bugzilla.gnome.org bug #66194 for status.");
       text_tag->invisible_set = TRUE;
       text_tag->values->invisible = g_value_get_boolean (value);
-      g_object_notify (object, "invisible_set");
+      g_object_notify (object, "invisible-set");
       size_changed = TRUE;
       break;
       
+    case PROP_PARAGRAPH_BACKGROUND:
+      {
+        GdkColor color;
+
+        if (!g_value_get_string (value))
+          set_pg_bg_color (text_tag, NULL);       /* reset to paragraph_background_set to FALSE */
+        else if (gdk_color_parse (g_value_get_string (value), &color))
+          set_pg_bg_color (text_tag, &color);
+        else
+          g_warning ("Don't know color `%s'", g_value_get_string (value));
+
+        g_object_notify (object, "paragraph-background-gdk");
+      }
+      break;
+
+    case PROP_PARAGRAPH_BACKGROUND_GDK:
+      {
+        GdkColor *color = g_value_get_boxed (value);
+
+        set_pg_bg_color (text_tag, color);
+      }
+      break;
+
+    case PROP_ACCUMULATIVE_MARGIN:
+      text_tag->accumulative_margin = g_value_get_boolean (value);
+      g_object_notify (object, "accumulative-margin");
+      size_changed = TRUE;
+      break;
+
       /* Whether the value should be used... */
 
     case PROP_BACKGROUND_SET:
@@ -1210,26 +1258,6 @@ gtk_text_tag_set_property (GObject      *object,
       text_tag->fg_color_set = g_value_get_boolean (value);
       break;
 
-    case PROP_BACKGROUND_STIPPLE_SET:
-      text_tag->bg_stipple_set = g_value_get_boolean (value);
-      if (!text_tag->bg_stipple_set &&
-          text_tag->values->appearance.bg_stipple)
-        {
-          g_object_unref (G_OBJECT (text_tag->values->appearance.bg_stipple));
-          text_tag->values->appearance.bg_stipple = NULL;
-        }
-      break;
-
-    case PROP_FOREGROUND_STIPPLE_SET:
-      text_tag->fg_stipple_set = g_value_get_boolean (value);
-      if (!text_tag->fg_stipple_set &&
-          text_tag->values->appearance.fg_stipple)
-        {
-          g_object_unref (G_OBJECT (text_tag->values->appearance.fg_stipple));
-          text_tag->values->appearance.fg_stipple = NULL;
-        }
-      break;
-
     case PROP_FAMILY_SET:
     case PROP_STYLE_SET:
     case PROP_VARIANT_SET:
@@ -1315,7 +1343,7 @@ gtk_text_tag_set_property (GObject      *object,
       size_changed = TRUE;
       break;
 
-    case PROP_BG_FULL_HEIGHT_SET:
+    case PROP_BACKGROUND_FULL_HEIGHT_SET:
       text_tag->bg_full_height_set = g_value_get_boolean (value);
       break;
 
@@ -1334,6 +1362,10 @@ gtk_text_tag_set_property (GObject      *object,
       size_changed = TRUE;
       break;
       
+    case PROP_PARAGRAPH_BACKGROUND_SET:
+      text_tag->pg_bg_color_set = g_value_get_boolean (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1350,18 +1382,11 @@ gtk_text_tag_set_property (GObject      *object,
    */
 
   if (text_tag->table)
-    g_signal_emit_by_name (G_OBJECT (text_tag->table),
+    g_signal_emit_by_name (text_tag->table,
                            "tag_changed",
                            text_tag, size_changed);
 }
 
-static void
-get_color_arg (GValue *value, GdkColor *orig)
-{
-  g_value_init (value, GDK_TYPE_COLOR);
-  g_value_set_boxed (value, orig);
-}
-
 static void
 gtk_text_tag_get_property (GObject      *object,
                            guint         prop_id,
@@ -1379,35 +1404,21 @@ gtk_text_tag_get_property (GObject      *object,
       break;
 
     case PROP_BACKGROUND_GDK:
-      get_color_arg (value, &tag->values->appearance.bg_color);
+      g_value_set_boxed (value, &tag->values->appearance.bg_color);
       break;
 
     case PROP_FOREGROUND_GDK:
-      get_color_arg (value, &tag->values->appearance.fg_color);
-      break;
-
-    case PROP_BACKGROUND_STIPPLE:
-      if (tag->bg_stipple_set)
-        g_value_set_boxed (value, tag->values->appearance.bg_stipple);
-      break;
-
-    case PROP_FOREGROUND_STIPPLE:
-      if (tag->fg_stipple_set)
-        g_value_set_boxed (value, tag->values->appearance.fg_stipple);
+      g_value_set_boxed (value, &tag->values->appearance.fg_color);
       break;
 
     case PROP_FONT:
         {
-          /* FIXME GValue imposes a totally gratuitous string copy
-           * here, we could just hand off string ownership
-           */
           gchar *str;
 
          gtk_text_tag_ensure_font (tag);
          
          str = pango_font_description_to_string (tag->values->font);
-          g_value_set_string (value, str);
-          g_free (str);
+          g_value_take_string (value, str);
         }
       break;
 
@@ -1512,7 +1523,7 @@ gtk_text_tag_get_property (GObject      *object,
       g_value_set_int (value, tag->values->appearance.rise);
       break;
 
-    case PROP_BG_FULL_HEIGHT:
+    case PROP_BACKGROUND_FULL_HEIGHT:
       g_value_set_boolean (value, tag->values->bg_full_height);
       break;
 
@@ -1529,20 +1540,20 @@ gtk_text_tag_get_property (GObject      *object,
       g_value_set_boolean (value, tag->values->invisible);
       break;
       
-    case PROP_BACKGROUND_SET:
-      g_value_set_boolean (value, tag->bg_color_set);
+    case PROP_PARAGRAPH_BACKGROUND_GDK:
+      g_value_set_boxed (value, tag->values->pg_bg_color);
       break;
 
-    case PROP_FOREGROUND_SET:
-      g_value_set_boolean (value, tag->fg_color_set);
+    case PROP_ACCUMULATIVE_MARGIN:
+      g_value_set_boolean (value, tag->accumulative_margin);
       break;
 
-    case PROP_BACKGROUND_STIPPLE_SET:
-      g_value_set_boolean (value, tag->bg_stipple_set);
+    case PROP_BACKGROUND_SET:
+      g_value_set_boolean (value, tag->bg_color_set);
       break;
 
-    case PROP_FOREGROUND_STIPPLE_SET:
-      g_value_set_boolean (value, tag->fg_stipple_set);
+    case PROP_FOREGROUND_SET:
+      g_value_set_boolean (value, tag->fg_color_set);
       break;
 
     case PROP_FAMILY_SET:
@@ -1611,7 +1622,7 @@ gtk_text_tag_get_property (GObject      *object,
       g_value_set_boolean (value, tag->rise_set);
       break;
 
-    case PROP_BG_FULL_HEIGHT_SET:
+    case PROP_BACKGROUND_FULL_HEIGHT_SET:
       g_value_set_boolean (value, tag->bg_full_height_set);
       break;
 
@@ -1627,9 +1638,14 @@ gtk_text_tag_get_property (GObject      *object,
       g_value_set_boolean (value, tag->invisible_set);
       break;
       
+    case PROP_PARAGRAPH_BACKGROUND_SET:
+      g_value_set_boolean (value, tag->pg_bg_color_set);
+      break;
+
     case PROP_BACKGROUND:
     case PROP_FOREGROUND:
-      g_warning ("'foreground' and 'background' properties are not readable, use 'foreground_gdk' and 'background_gdk'");
+    case PROP_PARAGRAPH_BACKGROUND:
+      g_warning ("'foreground', 'background' and 'paragraph_background' properties are not readable, use 'foreground_gdk', 'background_gdk' and 'paragraph_background_gdk'");
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1745,7 +1761,7 @@ gtk_text_tag_event (GtkTextTag        *tag,
   g_return_val_if_fail (G_IS_OBJECT (event_object), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
 
-  g_signal_emit (G_OBJECT (tag),
+  g_signal_emit (tag,
                  signals[EVENT],
                  0,
                  event_object,
@@ -1842,7 +1858,9 @@ gtk_text_attributes_new (void)
   values->language = gtk_get_default_language ();
 
   values->font_scale = 1.0;
-  
+
+  values->editable = TRUE;
+      
   return values;
 }
 
@@ -1865,18 +1883,9 @@ gtk_text_attributes_copy (GtkTextAttributes *src)
   return dest;
 }
 
-GType
-gtk_text_attributes_get_type (void)
-{
-  static GType our_type = 0;
-  
-  if (our_type == 0)
-    our_type = g_boxed_type_register_static ("GtkTextAttributes",
-                                            (GBoxedCopyFunc) gtk_text_attributes_ref,
-                                            (GBoxedFreeFunc) gtk_text_attributes_unref);
-
-  return our_type;
-}
+G_DEFINE_BOXED_TYPE (GtkTextAttributes, gtk_text_attributes,
+                     gtk_text_attributes_ref,
+                     gtk_text_attributes_unref)
 
 /**
  * gtk_text_attributes_copy_values:
@@ -1892,27 +1901,11 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
 {
   guint orig_refcount;
 
-  g_return_if_fail (!dest->realized);
-
   if (src == dest)
     return;
 
-  /* Add refs */
-
-  if (src->appearance.bg_stipple)
-    gdk_bitmap_ref (src->appearance.bg_stipple);
-
-  if (src->appearance.fg_stipple)
-    gdk_bitmap_ref (src->appearance.fg_stipple);
-
   /* Remove refs */
 
-  if (dest->appearance.bg_stipple)
-    gdk_bitmap_unref (dest->appearance.bg_stipple);
-
-  if (dest->appearance.fg_stipple)
-    gdk_bitmap_unref (dest->appearance.fg_stipple);
-
   if (dest->font)
     pango_font_description_free (dest->font);
   
@@ -1929,8 +1922,10 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
   if (dest->font)
     dest->font = pango_font_description_copy (src->font);
   
+  if (src->pg_bg_color)
+    dest->pg_bg_color = gdk_color_copy (src->pg_bg_color);
+
   dest->refcount = orig_refcount;
-  dest->realized = FALSE;
 }
 
 /**
@@ -1938,13 +1933,17 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
  * @values: a #GtkTextAttributes
  * 
  * Increments the reference count on @values.
+ *
+ * Returns: the #GtkTextAttributes that were passed in
  **/
-void
+GtkTextAttributes *
 gtk_text_attributes_ref (GtkTextAttributes *values)
 {
-  g_return_if_fail (values != NULL);
+  g_return_val_if_fail (values != NULL, NULL);
 
   values->refcount += 1;
+
+  return values;
 }
 
 /**
@@ -1964,65 +1963,17 @@ gtk_text_attributes_unref (GtkTextAttributes *values)
 
   if (values->refcount == 0)
     {
-      g_assert (!values->realized);
-
-      if (values->appearance.bg_stipple)
-        gdk_bitmap_unref (values->appearance.bg_stipple);
-
-      if (values->appearance.fg_stipple)
-        gdk_bitmap_unref (values->appearance.fg_stipple);
-
       if (values->tabs)
         pango_tab_array_free (values->tabs);
 
       if (values->font)
        pango_font_description_free (values->font);
-      
-      g_free (values);
-    }
-}
-
-void
-_gtk_text_attributes_realize (GtkTextAttributes *values,
-                              GdkColormap *cmap,
-                              GdkVisual *visual)
-{
-  g_return_if_fail (values != NULL);
-  g_return_if_fail (values->refcount > 0);
-  g_return_if_fail (!values->realized);
-
-  /* It is wrong to use this colormap, FIXME */
-  gdk_colormap_alloc_color (cmap,
-                            &values->appearance.fg_color,
-                            FALSE, TRUE);
-
-  gdk_colormap_alloc_color (cmap,
-                            &values->appearance.bg_color,
-                            FALSE, TRUE);
 
-  values->realized = TRUE;
-}
-
-void
-_gtk_text_attributes_unrealize (GtkTextAttributes *values,
-                                GdkColormap *cmap,
-                                GdkVisual *visual)
-{
-  g_return_if_fail (values != NULL);
-  g_return_if_fail (values->refcount > 0);
-  g_return_if_fail (values->realized);
+      if (values->pg_bg_color)
+       gdk_color_free (values->pg_bg_color);
 
-  gdk_colormap_free_colors (cmap,
-                            &values->appearance.fg_color, 1);
-
-
-  gdk_colormap_free_colors (cmap,
-                            &values->appearance.bg_color, 1);
-
-  values->appearance.fg_color.pixel = 0;
-  values->appearance.bg_color.pixel = 0;
-
-  values->realized = FALSE;
+      g_free (values);
+    }
 }
 
 void
@@ -2032,7 +1983,8 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
 {
   guint n = 0;
 
-  g_return_if_fail (!dest->realized);
+  guint left_margin_accumulative = 0;
+  guint right_margin_accumulative = 0;
 
   while (n < n_tags)
     {
@@ -2052,22 +2004,9 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
       if (tag->fg_color_set)
         dest->appearance.fg_color = vals->appearance.fg_color;
       
-      if (tag->bg_stipple_set)
-        {
-          gdk_bitmap_ref (vals->appearance.bg_stipple);
-          if (dest->appearance.bg_stipple)
-            gdk_bitmap_unref (dest->appearance.bg_stipple);
-          dest->appearance.bg_stipple = vals->appearance.bg_stipple;
-
-          dest->appearance.draw_bg = TRUE;
-        }
-
-      if (tag->fg_stipple_set)
+      if (tag->pg_bg_color_set)
         {
-          gdk_bitmap_ref (vals->appearance.fg_stipple);
-          if (dest->appearance.fg_stipple)
-            gdk_bitmap_unref (dest->appearance.fg_stipple);
-          dest->appearance.fg_stipple = vals->appearance.fg_stipple;
+          dest->pg_bg_color = gdk_color_copy (vals->pg_bg_color);
         }
 
       if (vals->font)
@@ -2088,8 +2027,13 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
       if (vals->direction != GTK_TEXT_DIR_NONE)
         dest->direction = vals->direction;
 
-      if (tag->left_margin_set)
-        dest->left_margin = vals->left_margin;
+      if (tag->left_margin_set) 
+        {
+          if (tag->accumulative_margin)
+            left_margin_accumulative += vals->left_margin;
+          else
+            dest->left_margin = vals->left_margin;
+        }
 
       if (tag->indent_set)
         dest->indent = vals->indent;
@@ -2097,8 +2041,13 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
       if (tag->rise_set)
         dest->appearance.rise = vals->appearance.rise;
 
-      if (tag->right_margin_set)
-        dest->right_margin = vals->right_margin;
+      if (tag->right_margin_set) 
+        {
+          if (tag->accumulative_margin)
+            right_margin_accumulative += vals->right_margin;
+          else
+            dest->right_margin = vals->right_margin;
+        }
 
       if (tag->pixels_above_lines_set)
         dest->pixels_above_lines = vals->pixels_above_lines;
@@ -2139,6 +2088,9 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
 
       ++n;
     }
+
+  dest->left_margin += left_margin_accumulative;
+  dest->right_margin += right_margin_accumulative;
 }
 
 gboolean
@@ -2170,9 +2122,8 @@ _gtk_text_tag_affects_nonsize_appearance (GtkTextTag *tag)
 
   return
     tag->bg_color_set ||
-    tag->bg_stipple_set ||
     tag->fg_color_set ||
-    tag->fg_stipple_set ||
     tag->strikethrough_set ||
-    tag->bg_full_height_set;
+    tag->bg_full_height_set ||
+    tag->pg_bg_color_set;
 }