]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtktexttag.c
Get rid of incorrect calls to g_value_init(). (#100669, Johan Dahlin,
[~andy/gtk] / gtk / gtktexttag.c
index 8c530c8a58e128a8c69c1b34a28b8b5d6e4584b1..38c314e8e083cfb76bf4fba1f2778aa4abded84b 100644 (file)
 #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 <stdlib.h>
 #include <string.h>
@@ -171,10 +169,8 @@ gtk_text_tag_get_type (void)
         (GInstanceInitFunc) gtk_text_tag_init
       };
 
-      our_type = g_type_register_static (G_TYPE_OBJECT,
-                                         "GtkTextTag",
-                                         &our_info,
-                                         0);
+      our_type = g_type_register_static (G_TYPE_OBJECT, "GtkTextTag",
+                                         &our_info, 0);
     }
 
   return our_type;
@@ -197,7 +193,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                                    PROP_NAME,
                                    g_param_spec_string ("name",
                                                         _("Tag name"),
-                                                        _("Name used to refer to the text tag. NULL for anonymous tags."),
+                                                        _("Name used to refer to the text tag. NULL for anonymous tags"),
                                                         NULL,
                                                         G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
 
@@ -308,7 +304,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                                    PROP_STYLE,
                                    g_param_spec_enum ("style",
                                                       _("Font style"),
-                                                      _("Font style as a PangoStyle, e.g. PANGO_STYLE_ITALIC."),
+                                                      _("Font style as a PangoStyle, e.g. PANGO_STYLE_ITALIC"),
                                                       PANGO_TYPE_STYLE,
                                                       PANGO_STYLE_NORMAL,
                                                       G_PARAM_READABLE | G_PARAM_WRITABLE));
@@ -317,7 +313,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                                    PROP_VARIANT,
                                    g_param_spec_enum ("variant",
                                                      _("Font variant"),
-                                                     _("Font variant as a PangoVariant, e.g. PANGO_VARIANT_SMALL_CAPS."),
+                                                     _("Font variant as a PangoVariant, e.g. PANGO_VARIANT_SMALL_CAPS"),
                                                       PANGO_TYPE_VARIANT,
                                                       PANGO_VARIANT_NORMAL,
                                                       G_PARAM_READABLE | G_PARAM_WRITABLE));
@@ -326,7 +322,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                                    PROP_WEIGHT,
                                    g_param_spec_int ("weight",
                                                      _("Font weight"),
-                                                     _("Font weight as an integer, see predefined values in PangoWeight; for example, PANGO_WEIGHT_BOLD."),
+                                                     _("Font weight as an integer, see predefined values in PangoWeight; for example, PANGO_WEIGHT_BOLD"),
                                                      0,
                                                      G_MAXINT,
                                                      PANGO_WEIGHT_NORMAL,
@@ -337,7 +333,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                                    PROP_STRETCH,
                                    g_param_spec_enum ("stretch",
                                                       _("Font stretch"),
-                                                      _("Font stretch as a PangoStretch, e.g. PANGO_STRETCH_CONDENSED."),
+                                                      _("Font stretch as a PangoStretch, e.g. PANGO_STRETCH_CONDENSED"),
                                                       PANGO_TYPE_STRETCH,
                                                       PANGO_STRETCH_NORMAL,
                                                       G_PARAM_READABLE | G_PARAM_WRITABLE));
@@ -346,7 +342,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                                    PROP_SIZE,
                                    g_param_spec_int ("size",
                                                      _("Font size"),
-                                                     _("Font size in Pango units."),
+                                                     _("Font size in Pango units"),
                                                      0,
                                                      G_MAXINT,
                                                      0,
@@ -356,7 +352,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                                    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."),
+                                                        _("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,
@@ -385,7 +381,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
                                    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."),
+                                                        _("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"),
                                                         NULL,
                                                         G_PARAM_READABLE | G_PARAM_WRITABLE));  
 
@@ -620,7 +616,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
     g_signal_new ("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,
@@ -653,9 +649,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;
 }
@@ -958,10 +952,10 @@ gtk_text_tag_set_property (GObject      *object,
         if (text_tag->values->appearance.bg_stipple != bitmap)
           {
             if (bitmap != NULL)
-              gdk_bitmap_ref (bitmap);
+              g_object_ref (bitmap);
 
             if (text_tag->values->appearance.bg_stipple)
-              gdk_bitmap_unref (text_tag->values->appearance.bg_stipple);
+              g_object_unref (text_tag->values->appearance.bg_stipple);
 
             text_tag->values->appearance.bg_stipple = bitmap;
           }
@@ -978,10 +972,10 @@ gtk_text_tag_set_property (GObject      *object,
         if (text_tag->values->appearance.fg_stipple != bitmap)
           {
             if (bitmap != NULL)
-              gdk_bitmap_ref (bitmap);
+              g_object_ref (bitmap);
 
             if (text_tag->values->appearance.fg_stipple)
-              gdk_bitmap_unref (text_tag->values->appearance.fg_stipple);
+              g_object_unref (text_tag->values->appearance.fg_stipple);
 
             text_tag->values->appearance.fg_stipple = bitmap;
           }
@@ -1168,7 +1162,7 @@ gtk_text_tag_set_property (GObject      *object,
     case PROP_BG_FULL_HEIGHT:
       text_tag->bg_full_height_set = TRUE;
       text_tag->values->bg_full_height = g_value_get_boolean (value);
-      g_object_notify (object, "bg_full_height_set");
+      g_object_notify (object, "background_full_height_set");
       break;
 
     case PROP_LANGUAGE:
@@ -1215,7 +1209,7 @@ gtk_text_tag_set_property (GObject      *object,
       if (!text_tag->bg_stipple_set &&
           text_tag->values->appearance.bg_stipple)
         {
-          g_object_unref (G_OBJECT (text_tag->values->appearance.bg_stipple));
+          g_object_unref (text_tag->values->appearance.bg_stipple);
           text_tag->values->appearance.bg_stipple = NULL;
         }
       break;
@@ -1225,7 +1219,7 @@ gtk_text_tag_set_property (GObject      *object,
       if (!text_tag->fg_stipple_set &&
           text_tag->values->appearance.fg_stipple)
         {
-          g_object_unref (G_OBJECT (text_tag->values->appearance.fg_stipple));
+          g_object_unref (text_tag->values->appearance.fg_stipple);
           text_tag->values->appearance.fg_stipple = NULL;
         }
       break;
@@ -1350,18 +1344,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,11 +1366,11 @@ 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);
+      g_value_set_boxed (value, &tag->values->appearance.fg_color);
       break;
 
     case PROP_BACKGROUND_STIPPLE:
@@ -1745,7 +1732,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,
@@ -1871,7 +1858,7 @@ gtk_text_attributes_get_type (void)
   static GType our_type = 0;
   
   if (our_type == 0)
-    our_type = g_boxed_type_register_static ("GtkTypeTextAttributes",
+    our_type = g_boxed_type_register_static ("GtkTextAttributes",
                                             (GBoxedCopyFunc) gtk_text_attributes_ref,
                                             (GBoxedFreeFunc) gtk_text_attributes_unref);
 
@@ -1900,18 +1887,18 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src,
   /* Add refs */
 
   if (src->appearance.bg_stipple)
-    gdk_bitmap_ref (src->appearance.bg_stipple);
+    g_object_ref (src->appearance.bg_stipple);
 
   if (src->appearance.fg_stipple)
-    gdk_bitmap_ref (src->appearance.fg_stipple);
+    g_object_ref (src->appearance.fg_stipple);
 
   /* Remove refs */
 
   if (dest->appearance.bg_stipple)
-    gdk_bitmap_unref (dest->appearance.bg_stipple);
+    g_object_unref (dest->appearance.bg_stipple);
 
   if (dest->appearance.fg_stipple)
-    gdk_bitmap_unref (dest->appearance.fg_stipple);
+    g_object_unref (dest->appearance.fg_stipple);
 
   if (dest->font)
     pango_font_description_free (dest->font);
@@ -1967,10 +1954,10 @@ gtk_text_attributes_unref (GtkTextAttributes *values)
       g_assert (!values->realized);
 
       if (values->appearance.bg_stipple)
-        gdk_bitmap_unref (values->appearance.bg_stipple);
+        g_object_unref (values->appearance.bg_stipple);
 
       if (values->appearance.fg_stipple)
-        gdk_bitmap_unref (values->appearance.fg_stipple);
+        g_object_unref (values->appearance.fg_stipple);
 
       if (values->tabs)
         pango_tab_array_free (values->tabs);
@@ -2054,9 +2041,9 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
       
       if (tag->bg_stipple_set)
         {
-          gdk_bitmap_ref (vals->appearance.bg_stipple);
+          g_object_ref (vals->appearance.bg_stipple);
           if (dest->appearance.bg_stipple)
-            gdk_bitmap_unref (dest->appearance.bg_stipple);
+            g_object_unref (dest->appearance.bg_stipple);
           dest->appearance.bg_stipple = vals->appearance.bg_stipple;
 
           dest->appearance.draw_bg = TRUE;
@@ -2064,9 +2051,9 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
 
       if (tag->fg_stipple_set)
         {
-          gdk_bitmap_ref (vals->appearance.fg_stipple);
+          g_object_ref (vals->appearance.fg_stipple);
           if (dest->appearance.fg_stipple)
-            gdk_bitmap_unref (dest->appearance.fg_stipple);
+            g_object_unref (dest->appearance.fg_stipple);
           dest->appearance.fg_stipple = vals->appearance.fg_stipple;
         }