gio: Intern all signal names beforehand

This avoids pointless copying of static strings.
This commit is contained in:
Matthias Clasen 2015-09-12 00:00:40 -04:00
parent c90f283be3
commit 9acd0ddbf3
18 changed files with 39 additions and 36 deletions

View File

@ -837,7 +837,7 @@ g_app_launch_context_class_init (GAppLaunchContextClass *klass)
*
* Since: 2.36
*/
signals[LAUNCH_FAILED] = g_signal_new ("launch-failed",
signals[LAUNCH_FAILED] = g_signal_new (I_("launch-failed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GAppLaunchContextClass, launch_failed),
@ -858,7 +858,7 @@ g_app_launch_context_class_init (GAppLaunchContextClass *klass)
*
* Since: 2.36
*/
signals[LAUNCHED] = g_signal_new ("launched",
signals[LAUNCHED] = g_signal_new (I_("launched"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GAppLaunchContextClass, launched),
@ -1102,7 +1102,7 @@ g_app_info_monitor_class_init (GAppInfoMonitorClass *class)
* Signal emitted when the app info database for changes (ie: newly installed
* or removed applications).
**/
g_app_info_monitor_changed_signal = g_signal_new ("changed", G_TYPE_APP_INFO_MONITOR, G_SIGNAL_RUN_FIRST,
g_app_info_monitor_changed_signal = g_signal_new (I_("changed"), G_TYPE_APP_INFO_MONITOR, G_SIGNAL_RUN_FIRST,
0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
object_class->finalize = g_app_info_monitor_finalize;

View File

@ -1373,7 +1373,7 @@ g_application_class_init (GApplicationClass *class)
* after registration. See g_application_register().
*/
g_application_signals[SIGNAL_STARTUP] =
g_signal_new ("startup", G_TYPE_APPLICATION, G_SIGNAL_RUN_FIRST,
g_signal_new (I_("startup"), G_TYPE_APPLICATION, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GApplicationClass, startup),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
@ -1385,7 +1385,7 @@ g_application_class_init (GApplicationClass *class)
* immediately after the main loop terminates.
*/
g_application_signals[SIGNAL_SHUTDOWN] =
g_signal_new ("shutdown", G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
g_signal_new (I_("shutdown"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GApplicationClass, shutdown),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
@ -1397,7 +1397,7 @@ g_application_class_init (GApplicationClass *class)
* activation occurs. See g_application_activate().
*/
g_application_signals[SIGNAL_ACTIVATE] =
g_signal_new ("activate", G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
g_signal_new (I_("activate"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GApplicationClass, activate),
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
@ -1413,7 +1413,7 @@ g_application_class_init (GApplicationClass *class)
* files to open. See g_application_open() for more information.
*/
g_application_signals[SIGNAL_OPEN] =
g_signal_new ("open", G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
g_signal_new (I_("open"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GApplicationClass, open),
NULL, NULL, NULL,
G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING);
@ -1432,7 +1432,7 @@ g_application_class_init (GApplicationClass *class)
* process. See g_application_command_line_set_exit_status().
*/
g_application_signals[SIGNAL_COMMAND_LINE] =
g_signal_new ("command-line", G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
g_signal_new (I_("command-line"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GApplicationClass, command_line),
g_signal_accumulator_first_wins, NULL,
NULL,
@ -1493,7 +1493,7 @@ g_application_class_init (GApplicationClass *class)
* Since: 2.40
**/
g_application_signals[SIGNAL_HANDLE_LOCAL_OPTIONS] =
g_signal_new ("handle-local-options", G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
g_signal_new (I_("handle-local-options"), G_TYPE_APPLICATION, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GApplicationClass, handle_local_options),
g_application_handle_local_options_accumulator, NULL, NULL,
G_TYPE_INT, 1, G_TYPE_VARIANT_DICT);

View File

@ -166,7 +166,7 @@ g_dbus_auth_observer_class_init (GDBusAuthObserverClass *klass)
* Since: 2.26
*/
signals[AUTHORIZE_AUTHENTICATED_PEER_SIGNAL] =
g_signal_new ("authorize-authenticated-peer",
g_signal_new (I_("authorize-authenticated-peer"),
G_TYPE_DBUS_AUTH_OBSERVER,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusAuthObserverClass, authorize_authenticated_peer),
@ -190,7 +190,7 @@ g_dbus_auth_observer_class_init (GDBusAuthObserverClass *klass)
* Since: 2.34
*/
signals[ALLOW_MECHANISM_SIGNAL] =
g_signal_new ("allow-mechanism",
g_signal_new (I_("allow-mechanism"),
G_TYPE_DBUS_AUTH_OBSERVER,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusAuthObserverClass, allow_mechanism),

View File

@ -1047,7 +1047,7 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
*
* Since: 2.26
*/
signals[CLOSED_SIGNAL] = g_signal_new ("closed",
signals[CLOSED_SIGNAL] = g_signal_new (I_("closed"),
G_TYPE_DBUS_CONNECTION,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusConnectionClass, closed),

View File

@ -1695,7 +1695,7 @@ g_dbus_daemon_class_init (GDBusDaemonClass *klass)
gobject_class->get_property = g_dbus_daemon_get_property;
g_dbus_daemon_signals[SIGNAL_IDLE_TIMEOUT] =
g_signal_new ("idle-timeout",
g_signal_new (I_("idle-timeout"),
G_TYPE_DBUS_DAEMON,
G_SIGNAL_RUN_LAST,
0,

View File

@ -242,7 +242,7 @@ g_dbus_interface_skeleton_class_init (GDBusInterfaceSkeletonClass *klass)
* Since: 2.30
*/
signals[G_AUTHORIZE_METHOD_SIGNAL] =
g_signal_new ("g-authorize-method",
g_signal_new (I_("g-authorize-method"),
G_TYPE_DBUS_INTERFACE_SKELETON,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusInterfaceSkeletonClass, g_authorize_method),

View File

@ -59,7 +59,7 @@ g_dbus_object_default_init (GDBusObjectIface *iface)
*
* Since: 2.30
*/
g_signal_new ("interface-added",
g_signal_new (I_("interface-added"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectIface, interface_added),
@ -79,7 +79,7 @@ g_dbus_object_default_init (GDBusObjectIface *iface)
*
* Since: 2.30
*/
g_signal_new ("interface-removed",
g_signal_new (I_("interface-removed"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectIface, interface_removed),

View File

@ -63,7 +63,7 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface)
*
* Since: 2.30
*/
g_signal_new ("object-added",
g_signal_new (I_("object-added"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, object_added),
@ -83,7 +83,7 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface)
*
* Since: 2.30
*/
g_signal_new ("object-removed",
g_signal_new (I_("object-removed"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, object_removed),
@ -107,7 +107,7 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface)
*
* Since: 2.30
*/
g_signal_new ("interface-added",
g_signal_new (I_("interface-added"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_added),
@ -132,7 +132,7 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface)
*
* Since: 2.30
*/
g_signal_new ("interface-removed",
g_signal_new (I_("interface-removed"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_removed),

View File

@ -511,7 +511,7 @@ g_dbus_object_manager_client_class_init (GDBusObjectManagerClientClass *klass)
* Since: 2.30
*/
signals[INTERFACE_PROXY_SIGNAL_SIGNAL] =
g_signal_new ("interface-proxy-signal",
g_signal_new (I_("interface-proxy-signal"),
G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerClientClass, interface_proxy_signal),
@ -549,7 +549,7 @@ g_dbus_object_manager_client_class_init (GDBusObjectManagerClientClass *klass)
* Since: 2.30
*/
signals[INTERFACE_PROXY_PROPERTIES_CHANGED_SIGNAL] =
g_signal_new ("interface-proxy-properties-changed",
g_signal_new (I_("interface-proxy-properties-changed"),
G_TYPE_DBUS_OBJECT_MANAGER_CLIENT,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerClientClass, interface_proxy_properties_changed),

View File

@ -184,7 +184,7 @@ g_dbus_object_skeleton_class_init (GDBusObjectSkeletonClass *klass)
* Since: 2.30
*/
signals[AUTHORIZE_METHOD_SIGNAL] =
g_signal_new ("authorize-method",
g_signal_new (I_("authorize-method"),
G_TYPE_DBUS_OBJECT_SKELETON,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectSkeletonClass, authorize_method),

View File

@ -590,7 +590,7 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
*
* Since: 2.26
*/
signals[PROPERTIES_CHANGED_SIGNAL] = g_signal_new ("g-properties-changed",
signals[PROPERTIES_CHANGED_SIGNAL] = g_signal_new (I_("g-properties-changed"),
G_TYPE_DBUS_PROXY,
G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
G_STRUCT_OFFSET (GDBusProxyClass, g_properties_changed),
@ -613,7 +613,7 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
*
* Since: 2.26
*/
signals[SIGNAL_SIGNAL] = g_signal_new ("g-signal",
signals[SIGNAL_SIGNAL] = g_signal_new (I_("g-signal"),
G_TYPE_DBUS_PROXY,
G_SIGNAL_RUN_LAST | G_SIGNAL_MUST_COLLECT,
G_STRUCT_OFFSET (GDBusProxyClass, g_signal),

View File

@ -419,7 +419,7 @@ g_dbus_server_class_init (GDBusServerClass *klass)
*
* Since: 2.26
*/
_signals[NEW_CONNECTION_SIGNAL] = g_signal_new ("new-connection",
_signals[NEW_CONNECTION_SIGNAL] = g_signal_new (I_("new-connection"),
G_TYPE_DBUS_SERVER,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusServerClass, new_connection),

View File

@ -23,6 +23,7 @@
#include "config.h"
#include "glistmodel.h"
#include "glibintl.h"
G_DEFINE_INTERFACE (GListModel, g_list_model, G_TYPE_OBJECT);
@ -119,7 +120,7 @@ g_list_model_default_init (GListModelInterface *iface)
*
* Since: 2.44
*/
g_list_model_changed_signal = g_signal_new ("items-changed",
g_list_model_changed_signal = g_signal_new (I_("items-changed"),
G_TYPE_LIST_MODEL,
G_SIGNAL_RUN_LAST,
0,

View File

@ -21,6 +21,8 @@
#include "gmenumodel.h"
#include "glibintl.h"
/**
* SECTION:gmenumodel
* @title: GMenuModel
@ -448,7 +450,7 @@ g_menu_model_class_init (GMenuModelClass *class)
* reported. The signal is emitted after the modification.
**/
g_menu_model_items_changed_signal =
g_signal_new ("items-changed", G_TYPE_MENU_MODEL,
g_signal_new (I_("items-changed"), G_TYPE_MENU_MODEL,
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
g_cclosure_marshal_generic, G_TYPE_NONE,
3, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);

View File

@ -732,7 +732,7 @@ g_settings_class_init (GSettingsClass *class)
* when key "x" changes.
*/
g_settings_signals[SIGNAL_CHANGED] =
g_signal_new ("changed", G_TYPE_SETTINGS,
g_signal_new (I_("changed"), G_TYPE_SETTINGS,
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
G_STRUCT_OFFSET (GSettingsClass, changed),
NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE,
@ -765,7 +765,7 @@ g_settings_class_init (GSettingsClass *class)
* event. FALSE to propagate the event further.
*/
g_settings_signals[SIGNAL_CHANGE_EVENT] =
g_signal_new ("change-event", G_TYPE_SETTINGS,
g_signal_new (I_("change-event"), G_TYPE_SETTINGS,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GSettingsClass, change_event),
g_signal_accumulator_true_handled, NULL,
@ -786,7 +786,7 @@ g_settings_class_init (GSettingsClass *class)
* callbacks when the writability of "x" changes.
*/
g_settings_signals[SIGNAL_WRITABLE_CHANGED] =
g_signal_new ("writable-changed", G_TYPE_SETTINGS,
g_signal_new (I_("writable-changed"), G_TYPE_SETTINGS,
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
G_STRUCT_OFFSET (GSettingsClass, writable_changed),
NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE,
@ -820,7 +820,7 @@ g_settings_class_init (GSettingsClass *class)
* event. FALSE to propagate the event further.
*/
g_settings_signals[SIGNAL_WRITABLE_CHANGE_EVENT] =
g_signal_new ("writable-change-event", G_TYPE_SETTINGS,
g_signal_new (I_("writable-change-event"), G_TYPE_SETTINGS,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GSettingsClass, writable_change_event),
g_signal_accumulator_true_handled, NULL,

View File

@ -337,7 +337,7 @@ g_socket_service_class_init (GSocketServiceClass *class)
* Since: 2.22
*/
g_socket_service_incoming_signal =
g_signal_new ("incoming", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
g_signal_new (I_("incoming"), G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GSocketServiceClass, incoming),
g_signal_accumulator_true_handled, NULL,
NULL, G_TYPE_BOOLEAN,

View File

@ -231,7 +231,7 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
* Returns: %TRUE to stop further signal handlers from being called
*/
g_threaded_socket_service_run_signal =
g_signal_new ("run", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
g_signal_new (I_("run"), G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GThreadedSocketServiceClass, run),
g_signal_accumulator_true_handled, NULL,
NULL, G_TYPE_BOOLEAN,

View File

@ -1481,7 +1481,7 @@ g_unix_mount_monitor_class_init (GUnixMountMonitorClass *klass)
* Emitted when the unix mounts have changed.
*/
signals[MOUNTS_CHANGED] =
g_signal_new ("mounts-changed",
g_signal_new (I_("mounts-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
@ -1496,7 +1496,7 @@ g_unix_mount_monitor_class_init (GUnixMountMonitorClass *klass)
* Emitted when the unix mount points have changed.
*/
signals[MOUNTPOINTS_CHANGED] =
g_signal_new ("mountpoints-changed",
g_signal_new (I_("mountpoints-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,