[libpeas] Intern all signal names



commit cbcd46be0f17e652028ee5fcce78b6aa6b2f1fc2
Author: Garrett Regier <garrettregier gmail com>
Date:   Mon Sep 21 20:54:08 2015 -0700

    Intern all signal names
    
    This avoids pointless allocations.

 libpeas-gtk/peas-gtk-plugin-manager-view.c |    2 +-
 libpeas/peas-engine.c                      |    4 ++--
 libpeas/peas-extension-set.c               |    8 +++++---
 libpeas/peas-i18n.h                        |    3 +++
 po/POTFILES.in                             |    1 +
 5 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-view.c b/libpeas-gtk/peas-gtk-plugin-manager-view.c
index c4d0c3f..8e8a603 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-view.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-view.c
@@ -818,7 +818,7 @@ peas_gtk_plugin_manager_view_class_init (PeasGtkPluginManagerViewClass *klass)
    * connect to this signal and add your menuitems to the @menu.
    */
   signals[POPULATE_POPUP] =
-    g_signal_new ("populate-popup",
+    g_signal_new (I_("populate-popup"),
                   the_type,
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (PeasGtkPluginManagerViewClass, populate_popup),
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index 8562a25..d953f55 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -599,7 +599,7 @@ peas_engine_class_init (PeasEngineClass *klass)
    * g_signal_connect_after().
    */
   signals[LOAD_PLUGIN] =
-    g_signal_new ("load-plugin",
+    g_signal_new (I_("load-plugin"),
                   the_type,
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (PeasEngineClass, load_plugin),
@@ -624,7 +624,7 @@ peas_engine_class_init (PeasEngineClass *klass)
    * use g_signal_connect_after().
    */
   signals[UNLOAD_PLUGIN] =
-    g_signal_new ("unload-plugin",
+    g_signal_new (I_("unload-plugin"),
                   the_type,
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (PeasEngineClass, unload_plugin),
diff --git a/libpeas/peas-extension-set.c b/libpeas/peas-extension-set.c
index a81e110..10d39ab 100644
--- a/libpeas/peas-extension-set.c
+++ b/libpeas/peas-extension-set.c
@@ -26,10 +26,12 @@
 #include <string.h>
 
 #include "peas-extension-set.h"
+
+#include "peas-i18n.h"
+#include "peas-introspection.h"
 #include "peas-plugin-info.h"
 #include "peas-marshal.h"
 #include "peas-utils.h"
-#include "peas-introspection.h"
 
 /**
  * SECTION:peas-extension-set
@@ -363,7 +365,7 @@ peas_extension_set_class_init (PeasExtensionSetClass *klass)
    * was created. You should set those up by yourself.
    */
   signals[EXTENSION_ADDED] =
-    g_signal_new ("extension-added",
+    g_signal_new (I_("extension-added"),
                   the_type,
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (PeasExtensionSetClass, extension_added),
@@ -391,7 +393,7 @@ peas_extension_set_class_init (PeasExtensionSetClass *klass)
    * instance is destroyed. You should clean those up by yourself.
    */
   signals[EXTENSION_REMOVED] =
-    g_signal_new ("extension-removed",
+    g_signal_new (I_("extension-removed"),
                   the_type,
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (PeasExtensionSetClass, extension_removed),
diff --git a/libpeas/peas-i18n.h b/libpeas/peas-i18n.h
index fc1ed58..26b0d47 100644
--- a/libpeas/peas-i18n.h
+++ b/libpeas/peas-i18n.h
@@ -66,6 +66,9 @@ G_BEGIN_DECLS
 
 const gchar *peas_gettext (const char *msgid) G_GNUC_FORMAT(1);
 
+/* not really I18N-related, but also a string marker macro */
+#define I_(string) g_intern_static_string (string)
+
 G_END_DECLS
 
 #endif /* __PEAS_I18N_H__ */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ffd1b95..03fd91d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,6 +4,7 @@
 data/glade/libpeas-gtk.xml.in
 libpeas/peas-dirs.c
 libpeas/peas-engine.c
+libpeas/peas-extension-set.c
 libpeas/peas-object-module.c
 libpeas/peas-plugin-info.c
 libpeas/peas-plugin-loader.c


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