[gtk+] gdk: Use G_PARAM_SPEC_STATIC_STRINGS throughout



commit a129053ed9450886c7e5b3edc52a129599880c08
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Nov 17 21:38:08 2017 -0500

    gdk: Use G_PARAM_SPEC_STATIC_STRINGS throughout
    
    This avoids some string copies at startup.

 gdk/gdkcursor.c                |   15 ++++++++++-----
 gdk/gdkdevice.c                |    6 ++----
 gdk/gdkdevicetool.c            |    9 ++++++---
 gdk/gdkdisplay.c               |    4 ++--
 gdk/gdkdisplaymanager.c        |    3 +--
 gdk/gdkmonitor.c               |   24 ++++++++++++------------
 gdk/gdkwindow.c                |    4 ++--
 gdk/x11/gdkdevice-xi2.c        |    3 ++-
 gdk/x11/gdkdevicemanager-xi2.c |    9 ++++++---
 9 files changed, 43 insertions(+), 34 deletions(-)
---
diff --git a/gdk/gdkcursor.c b/gdk/gdkcursor.c
index 6b50345..75c8661 100644
--- a/gdk/gdkcursor.c
+++ b/gdk/gdkcursor.c
@@ -183,35 +183,40 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
                                                         P_("Fallback"),
                                                         P_("Cursor image to fall back to if this cursor 
cannot be displayed"),
                                                         GDK_TYPE_CURSOR,
-                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+                                                        G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (object_class,
                                   PROP_HOTSPOT_X,
                                   g_param_spec_int ("hotspot-x",
                                                      P_("Hotspot X"),
                                                      P_("Horizontal offset of the cursor hotspot"),
                                                      0, G_MAXINT, 0,
-                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+                                                     G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (object_class,
                                   PROP_HOTSPOT_Y,
                                   g_param_spec_int ("hotspot-y",
                                                      P_("Hotspot Y"),
                                                      P_("Vertical offset of the cursor hotspot"),
                                                      0, G_MAXINT, 0,
-                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+                                                     G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (object_class,
                                   PROP_NAME,
                                   g_param_spec_string ("name",
                                                         P_("Name"),
                                                         P_("Name of this cursor"),
                                                         NULL,
-                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+                                                        G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (object_class,
                                   PROP_TEXTURE,
                                   g_param_spec_object ("texture",
                                                         P_("Texture"),
                                                         P_("The texture displayed by this cursor"),
                                                         GDK_TYPE_TEXTURE,
-                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                        G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+                                                        G_PARAM_STATIC_STRINGS));
 }
 
 static void
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index e6aa335..4a2aee9 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -123,8 +123,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
                            P_("Device Display"),
                            P_("Display which the device belongs to"),
                            GDK_TYPE_DISPLAY,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
-                           G_PARAM_STATIC_STRINGS);
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
   /**
    * GdkDevice:device-manager:
@@ -138,8 +137,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
                            P_("Device manager"),
                            P_("Device manager which the device belongs to"),
                            GDK_TYPE_DEVICE_MANAGER,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
-                           G_PARAM_STATIC_STRINGS);
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
   /**
    * GdkDevice:name:
    *
diff --git a/gdk/gdkdevicetool.c b/gdk/gdkdevicetool.c
index 1b1cd38..be81225 100644
--- a/gdk/gdkdevicetool.c
+++ b/gdk/gdkdevicetool.c
@@ -106,14 +106,16 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
                                                       "Serial number",
                                                       0, G_MAXUINT64, 0,
                                                       G_PARAM_READWRITE |
-                                                      G_PARAM_CONSTRUCT_ONLY);
+                                                      G_PARAM_CONSTRUCT_ONLY |
+                                                      G_PARAM_STATIC_STRINGS);
   tool_props[TOOL_PROP_TOOL_TYPE] = g_param_spec_enum ("tool-type",
                                                        "Tool type",
                                                        "Tool type",
                                                        GDK_TYPE_DEVICE_TOOL_TYPE,
                                                        GDK_DEVICE_TOOL_TYPE_UNKNOWN,
                                                        G_PARAM_READWRITE |
-                                                       G_PARAM_CONSTRUCT_ONLY);
+                                                       G_PARAM_CONSTRUCT_ONLY |
+                                                       G_PARAM_STATIC_STRINGS);
   tool_props[TOOL_PROP_AXES] = g_param_spec_flags ("axes",
                                                    "Axes",
                                                    "Tool axes",
@@ -125,7 +127,8 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
                                                            "Hardware ID",
                                                            0, G_MAXUINT64, 0,
                                                            G_PARAM_READWRITE |
-                                                           G_PARAM_CONSTRUCT_ONLY);
+                                                           G_PARAM_CONSTRUCT_ONLY |
+                                                           G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, N_TOOL_PROPS, tool_props);
 }
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 39e9884..0d51b96 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -214,7 +214,7 @@ gdk_display_class_init (GdkDisplayClass *class)
                           P_("Composited"),
                           P_("Composited"),
                           TRUE,
-                          G_PARAM_READABLE);
+                          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
   /**
    * GdkDisplay:rgba:
@@ -229,7 +229,7 @@ gdk_display_class_init (GdkDisplayClass *class)
                           P_("RGBA"),
                           P_("RGBA"),
                           TRUE,
-                          G_PARAM_READABLE);
+                          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, LAST_PROP, props);
 
diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c
index 6d328d8..3faaf82 100644
--- a/gdk/gdkdisplaymanager.c
+++ b/gdk/gdkdisplaymanager.c
@@ -168,8 +168,7 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
                                                         P_("Default Display"),
                                                         P_("The default display for GDK"),
                                                         GDK_TYPE_DISPLAY,
-                                                        G_PARAM_READWRITE|G_PARAM_STATIC_NAME|
-                                                        G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
+                                                        G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
 }
 
 static void
diff --git a/gdk/gdkmonitor.c b/gdk/gdkmonitor.c
index 3e8ec27..d36670e 100644
--- a/gdk/gdkmonitor.c
+++ b/gdk/gdkmonitor.c
@@ -178,76 +178,76 @@ gdk_monitor_class_init (GdkMonitorClass *class)
                          "Display",
                          "The display of the monitor",
                          GDK_TYPE_DISPLAY,
-                         G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY);
+                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
   props[PROP_MANUFACTURER] =
     g_param_spec_string ("manufacturer",
                          "Manufacturer",
                          "The manufacturer name",
                          NULL,
-                         G_PARAM_READABLE);
+                         G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   props[PROP_MODEL] =
     g_param_spec_string ("model",
                          "Model",
                          "The model name",
                          NULL,
-                         G_PARAM_READABLE);
+                         G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   props[PROP_SCALE_FACTOR] =
     g_param_spec_int ("scale-factor",
                       "Scale factor",
                       "The scale factor",
                       0, G_MAXINT,
                       1,
-                      G_PARAM_READABLE);
+                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   props[PROP_GEOMETRY] =
     g_param_spec_boxed ("geometry",
                         "Geometry",
                         "The geometry of the monitor",
                         GDK_TYPE_RECTANGLE,
-                        G_PARAM_READABLE);
+                        G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   props[PROP_WORKAREA] =
     g_param_spec_boxed ("workarea",
                         "Workarea",
                         "The workarea of the monitor",
                         GDK_TYPE_RECTANGLE,
-                        G_PARAM_READABLE);
+                        G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   props[PROP_WIDTH_MM] =
     g_param_spec_int ("width-mm",
                       "Physical width",
                       "The width of the monitor, in millimeters",
                       0, G_MAXINT,
                       0,
-                      G_PARAM_READABLE);
+                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   props[PROP_HEIGHT_MM] =
     g_param_spec_int ("height-mm",
                       "Physical height",
                       "The height of the monitor, in millimeters",
                       0, G_MAXINT,
                       0,
-                      G_PARAM_READABLE);
+                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   props[PROP_REFRESH_RATE] =
     g_param_spec_int ("refresh-rate",
                       "Refresh rate",
                       "The refresh rate, in millihertz",
                       0, G_MAXINT,
                       0,
-                      G_PARAM_READABLE);
+                      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   props[PROP_SUBPIXEL_LAYOUT] =
     g_param_spec_enum ("subpixel-layout",
                        "Subpixel layout",
                        "The subpixel layout",
                        GDK_TYPE_SUBPIXEL_LAYOUT,
                        GDK_SUBPIXEL_LAYOUT_UNKNOWN,
-                       G_PARAM_READABLE);
+                       G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
   props[PROP_VALID] =
     g_param_spec_boolean ("valid",
                           "Valid",
                           "Whether the monitor is still valid",
                           TRUE,
-                          G_PARAM_READABLE);
+                          G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, LAST_PROP, props);
 
-  signals[INVALIDATE] = g_signal_new ("invalidate",
+  signals[INVALIDATE] = g_signal_new (g_intern_static_string ("invalidate"),
                                       G_TYPE_FROM_CLASS (object_class),
                                       G_SIGNAL_RUN_FIRST,
                                       0,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 148596b..1fbd5d0 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -258,7 +258,7 @@ gdk_window_class_init (GdkWindowClass *klass)
                            P_("Cursor"),
                            P_("Cursor"),
                            GDK_TYPE_CURSOR,
-                           G_PARAM_READWRITE);
+                           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
    * GdkWindow:display:
@@ -273,7 +273,7 @@ gdk_window_class_init (GdkWindowClass *klass)
                            P_("Display"),
                            P_("Display"),
                            GDK_TYPE_DISPLAY,
-                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
   g_object_class_install_properties (object_class, LAST_PROP, properties);
 
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index c23654f..ab266b6 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -141,7 +141,8 @@ gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
                                                      P_("Device ID"),
                                                      P_("Device identifier"),
                                                      0, G_MAXINT, 0,
-                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+                                                     G_PARAM_STATIC_STRINGS));
 }
 
 static void
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index aafc040..51a89db 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -115,21 +115,24 @@ gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass)
                                                      P_("Opcode"),
                                                      P_("Opcode for XInput2 requests"),
                                                      0, G_MAXINT, 0,
-                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+                                                     G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (object_class,
                                    PROP_MAJOR,
                                    g_param_spec_int ("major",
                                                      P_("Major"),
                                                      P_("Major version number"),
                                                      0, G_MAXINT, 0,
-                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+                                                     G_PARAM_STATIC_STRINGS));
   g_object_class_install_property (object_class,
                                    PROP_MINOR,
                                    g_param_spec_int ("minor",
                                                      P_("Minor"),
                                                      P_("Minor version number"),
                                                      0, G_MAXINT, 0,
-                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
+                                                     G_PARAM_STATIC_STRINGS));
 }
 
 static void


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