[gtk/wip/otte/whatever: 78/83] stringlist: Make property not construct-only
- From: Benjamin Otte <otte src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gtk/wip/otte/whatever: 78/83] stringlist: Make property not construct-only
 
- Date: Tue, 30 Jun 2020 02:24:45 +0000 (UTC)
 
commit 8c478f8a4cdff677552cc0c478b65a77e9cfffb9
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]