[gtk/wip/otte/whatever: 2/15] stringlist: Make property not construct-only



commit e6756f605e9ea402ca52db7de0e19ca41b8a2cf6
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jun 30 00:35:25 2020 +0200

    stringlist: Make property not construct-only
    
    Massively speeds up creation of long stringlists.

 gtk/gtkstringlist.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkstringlist.c b/gtk/gtkstringlist.c
index 61e8847d6d..2b43f70e5d 100644
--- a/gtk/gtkstringlist.c
+++ b/gtk/gtkstringlist.c
@@ -138,8 +138,7 @@ gtk_string_object_class_init (GtkStringObjectClass *class)
 
   pspec = g_param_spec_string ("string", "String", "String",
                                NULL,
-                               G_PARAM_READWRITE |
-                               G_PARAM_CONSTRUCT_ONLY |
+                               G_PARAM_READABLE |
                                G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_property (object_class, PROP_STRING, pspec);
@@ -149,7 +148,12 @@ gtk_string_object_class_init (GtkStringObjectClass *class)
 static GtkStringObject *
 gtk_string_object_new (const char *string)
 {
-  return g_object_new (GTK_TYPE_STRING_OBJECT, "string", string, NULL);
+  GtkStringObject *result;
+
+  result = g_object_new (GTK_TYPE_STRING_OBJECT, NULL);
+  result->string = g_strdup (string);
+
+  return result;
 }
 
 static GtkStringObject *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]