[libpeas] Install the property just once.



commit 61622ba573ed1473263a3629852890dd0df36fa2
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed Jul 28 13:05:10 2010 +0200

    Install the property just once.

 libpeas/peas-activatable.c |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/libpeas/peas-activatable.c b/libpeas/peas-activatable.c
index f8d73dd..9640fbc 100644
--- a/libpeas/peas-activatable.c
+++ b/libpeas/peas-activatable.c
@@ -50,21 +50,26 @@ G_DEFINE_INTERFACE(PeasActivatable, peas_activatable, G_TYPE_OBJECT)
 void
 peas_activatable_default_init (PeasActivatableInterface *iface)
 {
-  /**
-   * PeasActivatable:object:
-   *
-   * The object property contains the targetted object for this
-   * #PeasActivatable instance, for example a toplevel window in a typical
-   * windowed application. It is set at construction time and won't change.
-   */
-  g_object_interface_install_property (iface,
-                                       g_param_spec_object ("object",
-                                                            "Object",
-                                                            "Object",
-                                                            G_TYPE_OBJECT,
-                                                            G_PARAM_READWRITE |
-                                                            G_PARAM_CONSTRUCT_ONLY |
-                                                            G_PARAM_STATIC_STRINGS));
+  static gboolean initialized = FALSE;
+
+  if (!initialized)
+    {
+      /**
+       * PeasActivatable:object:
+       *
+       * The object property contains the targetted object for this
+       * #PeasActivatable instance, for example a toplevel window in a typical
+       * windowed application. It is set at construction time and won't change.
+       */
+      g_object_interface_install_property (iface,
+                                           g_param_spec_object ("object",
+                                                                "Object",
+                                                                "Object",
+                                                                G_TYPE_OBJECT,
+                                                                G_PARAM_READWRITE |
+                                                                G_PARAM_CONSTRUCT_ONLY |
+                                                                G_PARAM_STATIC_STRINGS));
+    }
 }
 
 /**



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