diff options
author | Jesús González <jgonzalez@gdr-sistemas.com> | 2014-09-30 01:42:38 +0200 |
---|---|---|
committer | Jesús González <jgonzalez@gdr-sistemas.com> | 2014-09-30 01:42:38 +0200 |
commit | 013cdf4ccd52d6f97cafcdd0bdd7dbc2b71fda1a (patch) | |
tree | 6151ff138b44891f11bebed596f0b8ad11df372c | |
parent | 5a4aebf77fdd5fb190622ddc18987047fdbc4ca9 (diff) | |
download | lightdm-013cdf4ccd52d6f97cafcdd0bdd7dbc2b71fda1a.tar.gz |
Refactored code to replace hardcoded signal identification strings by constants.
40 files changed, 190 insertions, 123 deletions
diff --git a/common/user-list.c b/common/user-list.c index 3b8d5a15..996ece8b 100644 --- a/common/user-list.c +++ b/common/user-list.c @@ -407,7 +407,7 @@ load_passwd_file (CommonUserList *user_list, gboolean emit_add_signal) { CommonUser *info = link->data; g_debug ("User %s added", common_user_get_name (info)); - g_signal_connect (info, "changed", G_CALLBACK (user_changed_cb), NULL); + g_signal_connect (info, USER_SIGNAL_CHANGED, G_CALLBACK (user_changed_cb), NULL); if (emit_add_signal) g_signal_emit (user_list, list_signals[USER_ADDED], 0, info); } @@ -603,7 +603,7 @@ add_accounts_user (CommonUserList *user_list, const gchar *path, gboolean emit_s g_debug ("User %s added", path); priv->user_list = user_list; priv->path = g_strdup (path); - g_signal_connect (user, "changed", G_CALLBACK (user_changed_cb), NULL); + g_signal_connect (user, USER_SIGNAL_CHANGED, G_CALLBACK (user_changed_cb), NULL); if (load_accounts_user (user)) { list_priv->users = g_list_insert_sorted (list_priv->users, user, compare_user); @@ -1090,7 +1090,7 @@ common_user_list_class_init (CommonUserListClass *klass) * The ::user-added signal gets emitted when a user account is created. **/ list_signals[USER_ADDED] = - g_signal_new ("user-added", + g_signal_new (USER_LIST_SIGNAL_USER_ADDED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CommonUserListClass, user_added), @@ -1106,7 +1106,7 @@ common_user_list_class_init (CommonUserListClass *klass) * The ::user-changed signal gets emitted when a user account is modified. **/ list_signals[USER_CHANGED] = - g_signal_new ("user-changed", + g_signal_new (USER_LIST_SIGNAL_USER_CHANGED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CommonUserListClass, user_changed), @@ -1122,7 +1122,7 @@ common_user_list_class_init (CommonUserListClass *klass) * The ::user-removed signal gets emitted when a user account is removed. **/ list_signals[USER_REMOVED] = - g_signal_new ("user-removed", + g_signal_new (USER_LIST_SIGNAL_USER_REMOVED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CommonUserListClass, user_removed), @@ -1763,7 +1763,7 @@ common_user_class_init (CommonUserClass *klass) * The ::changed signal gets emitted this user account is modified. **/ user_signals[CHANGED] = - g_signal_new ("changed", + g_signal_new (USER_SIGNAL_CHANGED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (CommonUserClass, changed), diff --git a/common/user-list.h b/common/user-list.h index 0d38cfe9..8d16e8d0 100644 --- a/common/user-list.h +++ b/common/user-list.h @@ -32,6 +32,12 @@ G_BEGIN_DECLS #define COMMON_IS_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COMMON_TYPE_USER)) #define COMMON_USER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), COMMON_TYPE_USER, CommonUserClass)) +#define USER_LIST_SIGNAL_USER_ADDED "user-added" +#define USER_LIST_SIGNAL_USER_CHANGED "user-changed" +#define USER_LIST_SIGNAL_USER_REMOVED "user-removed" + +#define USER_SIGNAL_CHANGED "changed" + typedef struct { GObject parent_instance; diff --git a/liblightdm-gobject/greeter.c b/liblightdm-gobject/greeter.c index 8214490c..1c281450 100644 --- a/liblightdm-gobject/greeter.c +++ b/liblightdm-gobject/greeter.c @@ -1804,7 +1804,7 @@ lightdm_greeter_class_init (LightDMGreeterClass *klass) * lightdm_greeter_cancel_authentication() to abort the authentication. **/ signals[SHOW_PROMPT] = - g_signal_new ("show-prompt", + g_signal_new (LIGHTDM_GREETER_SIGNAL_SHOW_PROMPT, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMGreeterClass, show_prompt), @@ -1822,7 +1822,7 @@ lightdm_greeter_class_init (LightDMGreeterClass *klass) * should show a message to the user. **/ signals[SHOW_MESSAGE] = - g_signal_new ("show-message", + g_signal_new (LIGHTDM_GREETER_SIGNAL_SHOW_MESSAGE, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMGreeterClass, show_message), @@ -1841,7 +1841,7 @@ lightdm_greeter_class_init (LightDMGreeterClass *klass) * was successful. **/ signals[AUTHENTICATION_COMPLETE] = - g_signal_new ("authentication-complete", + g_signal_new (LIGHTDM_GREETER_SIGNAL_AUTHENTICATION_COMPLETE, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMGreeterClass, authentication_complete), @@ -1857,7 +1857,7 @@ lightdm_greeter_class_init (LightDMGreeterClass *klass) * The application should then call lightdm_greeter_login(). **/ signals[AUTOLOGIN_TIMER_EXPIRED] = - g_signal_new ("autologin-timer-expired", + g_signal_new (LIGHTDM_GREETER_SIGNAL_AUTOLOGIN_TIMER_EXPIRED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMGreeterClass, autologin_timer_expired), @@ -1876,7 +1876,7 @@ lightdm_greeter_class_init (LightDMGreeterClass *klass) * resettable using lightdm_greeter_set_resettable(). **/ signals[IDLE] = - g_signal_new ("idle", + g_signal_new (LIGHTDM_GREETER_SIGNAL_IDLE, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMGreeterClass, idle), @@ -1895,7 +1895,7 @@ lightdm_greeter_class_init (LightDMGreeterClass *klass) * resettable using lightdm_greeter_set_resettable(). **/ signals[RESET] = - g_signal_new ("reset", + g_signal_new (LIGHTDM_GREETER_SIGNAL_RESET, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMGreeterClass, reset), diff --git a/liblightdm-gobject/lightdm/greeter.h b/liblightdm-gobject/lightdm/greeter.h index 68a81b54..0d046479 100644 --- a/liblightdm-gobject/lightdm/greeter.h +++ b/liblightdm-gobject/lightdm/greeter.h @@ -23,6 +23,13 @@ G_BEGIN_DECLS #define LIGHTDM_IS_GREETER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LIGHTDM_TYPE_GREETER)) #define LIGHTDM_GREETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LIGHTDM_TYPE_GREETER, LightDMGreeterClass)) +#define LIGHTDM_GREETER_SIGNAL_SHOW_PROMPT "show-prompt" +#define LIGHTDM_GREETER_SIGNAL_SHOW_MESSAGE "show-message" +#define LIGHTDM_GREETER_SIGNAL_AUTHENTICATION_COMPLETE "authentication-complete" +#define LIGHTDM_GREETER_SIGNAL_AUTOLOGIN_TIMER_EXPIRED "autologin-timer-expired" +#define LIGHTDM_GREETER_SIGNAL_IDLE "idle" +#define LIGHTDM_GREETER_SIGNAL_RESET "reset" + /** * LightDMPromptType: * @LIGHTDM_PROMPT_TYPE_QUESTION: Prompt is a question. The information can be shown as it is entered. diff --git a/liblightdm-gobject/lightdm/user.h b/liblightdm-gobject/lightdm/user.h index f955ab29..f2bea3fc 100644 --- a/liblightdm-gobject/lightdm/user.h +++ b/liblightdm-gobject/lightdm/user.h @@ -29,6 +29,12 @@ G_BEGIN_DECLS #define LIGHTDM_IS_USER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LIGHTDM_TYPE_USER)) #define LIGHTDM_USER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), LIGHTDM_TYPE_USER, LightDMUserClass)) +#define LIGHTDM_USER_LIST_SIGNAL_USER_ADDED "user-added" +#define LIGHTDM_USER_LIST_SIGNAL_USER_CHANGED "user-changed" +#define LIGHTDM_USER_LIST_SIGNAL_USER_REMOVED "user-removed" + +#define LIGHTDM_SIGNAL_USER_CHANGED "changed" + typedef struct { GObject parent_instance; diff --git a/liblightdm-gobject/user.c b/liblightdm-gobject/user.c index c4e5661e..f8355df2 100644 --- a/liblightdm-gobject/user.c +++ b/liblightdm-gobject/user.c @@ -104,7 +104,7 @@ static LightDMUser * wrap_common_user (CommonUser *user) { LightDMUser *lightdm_user = g_object_new (LIGHTDM_TYPE_USER, "common-user", user, NULL); - g_signal_connect (user, "changed", G_CALLBACK (user_changed_cb), lightdm_user); + g_signal_connect (user, USER_SIGNAL_CHANGED, G_CALLBACK (user_changed_cb), lightdm_user); return lightdm_user; } @@ -167,9 +167,9 @@ initialize_user_list_if_needed (LightDMUserList *user_list) priv->lightdm_list = g_list_reverse (priv->lightdm_list); CommonUserList *common_list = common_user_list_get_instance (); - g_signal_connect (common_list, "user-added", G_CALLBACK (user_list_added_cb), user_list); - g_signal_connect (common_list, "user-changed", G_CALLBACK (user_list_changed_cb), user_list); - g_signal_connect (common_list, "user-removed", G_CALLBACK (user_list_removed_cb), user_list); + g_signal_connect (common_list, USER_LIST_SIGNAL_USER_ADDED, G_CALLBACK (user_list_added_cb), user_list); + g_signal_connect (common_list, USER_LIST_SIGNAL_USER_CHANGED, G_CALLBACK (user_list_changed_cb), user_list); + g_signal_connect (common_list, USER_LIST_SIGNAL_USER_REMOVED, G_CALLBACK (user_list_removed_cb), user_list); priv->initialized = TRUE; } @@ -306,7 +306,7 @@ lightdm_user_list_class_init (LightDMUserListClass *klass) * The ::user-added signal gets emitted when a user account is created. **/ list_signals[USER_ADDED] = - g_signal_new ("user-added", + g_signal_new (LIGHTDM_USER_LIST_SIGNAL_USER_ADDED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMUserListClass, user_added), @@ -322,7 +322,7 @@ lightdm_user_list_class_init (LightDMUserListClass *klass) * The ::user-changed signal gets emitted when a user account is modified. **/ list_signals[USER_CHANGED] = - g_signal_new ("user-changed", + g_signal_new (LIGHTDM_USER_LIST_SIGNAL_USER_CHANGED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMUserListClass, user_changed), @@ -338,7 +338,7 @@ lightdm_user_list_class_init (LightDMUserListClass *klass) * The ::user-removed signal gets emitted when a user account is removed. **/ list_signals[USER_REMOVED] = - g_signal_new ("user-removed", + g_signal_new (LIGHTDM_USER_LIST_SIGNAL_USER_REMOVED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMUserListClass, user_removed), @@ -752,7 +752,7 @@ lightdm_user_class_init (LightDMUserClass *klass) * The ::changed signal gets emitted this user account is modified. **/ user_signals[CHANGED] = - g_signal_new ("changed", + g_signal_new (LIGHTDM_SIGNAL_USER_CHANGED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (LightDMUserClass, changed), diff --git a/liblightdm-qt/greeter.cpp b/liblightdm-qt/greeter.cpp index 3ef6996b..382e3e1e 100644 --- a/liblightdm-qt/greeter.cpp +++ b/liblightdm-qt/greeter.cpp @@ -48,12 +48,12 @@ GreeterPrivate::GreeterPrivate(Greeter *parent) : #endif ldmGreeter = lightdm_greeter_new(); - g_signal_connect (ldmGreeter, "show-prompt", G_CALLBACK (cb_showPrompt), this); - g_signal_connect (ldmGreeter, "show-message", G_CALLBACK (cb_showMessage), this); - g_signal_connect (ldmGreeter, "authentication-complete", G_CALLBACK (cb_authenticationComplete), this); - g_signal_connect (ldmGreeter, "autologin-timer-expired", G_CALLBACK (cb_autoLoginExpired), this); - g_signal_connect (ldmGreeter, "idle", G_CALLBACK (cb_idle), this); - g_signal_connect (ldmGreeter, "reset", G_CALLBACK (cb_reset), this); + g_signal_connect (ldmGreeter, LIGHTDM_GREETER_SIGNAL_SHOW_PROMPT, G_CALLBACK (cb_showPrompt), this); + g_signal_connect (ldmGreeter, LIGHTDM_GREETER_SIGNAL_SHOW_MESSAGE, G_CALLBACK (cb_showMessage), this); + g_signal_connect (ldmGreeter, LIGHTDM_GREETER_SIGNAL_AUTHENTICATION_COMPLETE, G_CALLBACK (cb_authenticationComplete), this); + g_signal_connect (ldmGreeter, LIGHTDM_GREETER_SIGNAL_AUTOLOGIN_TIMER_EXPIRED, G_CALLBACK (cb_autoLoginExpired), this); + g_signal_connect (ldmGreeter, LIGHTDM_GREETER_SIGNAL_IDLE, G_CALLBACK (cb_idle), this); + g_signal_connect (ldmGreeter, LIGHTDM_GREETER_SIGNAL_RESET, G_CALLBACK (cb_reset), this); } void GreeterPrivate::cb_showPrompt(LightDMGreeter *greeter, const gchar *text, LightDMPromptType type, gpointer data) diff --git a/liblightdm-qt/usersmodel.cpp b/liblightdm-qt/usersmodel.cpp index 558cd329..14d8df1f 100644 --- a/liblightdm-qt/usersmodel.cpp +++ b/liblightdm-qt/usersmodel.cpp @@ -106,9 +106,9 @@ void UsersModelPrivate::loadUsers() q->endInsertRows(); } - g_signal_connect(lightdm_user_list_get_instance(), "user-added", G_CALLBACK (cb_userAdded), this); - g_signal_connect(lightdm_user_list_get_instance(), "user-changed", G_CALLBACK (cb_userChanged), this); - g_signal_connect(lightdm_user_list_get_instance(), "user-removed", G_CALLBACK (cb_userRemoved), this); + g_signal_connect(lightdm_user_list_get_instance(), LIGHTDM_USER_LIST_SIGNAL_USER_ADDED, G_CALLBACK (cb_userAdded), this); + g_signal_connect(lightdm_user_list_get_instance(), LIGHTDM_USER_LIST_SIGNAL_USER_CHANGED, G_CALLBACK (cb_userChanged), this); + g_signal_connect(lightdm_user_list_get_instance(), LIGHTDM_USER_LIST_SIGNAL_USER_REMOVED, G_CALLBACK (cb_userRemoved), this); } void UsersModelPrivate::cb_userAdded(LightDMUserList *user_list, LightDMUser *ldmUser, gpointer data) diff --git a/src/display-manager.c b/src/display-manager.c index bf8d24ae..b683fdaa 100644 --- a/src/display-manager.c +++ b/src/display-manager.c @@ -111,7 +111,7 @@ display_manager_add_seat (DisplayManager *manager, Seat *seat) return FALSE; manager->priv->seats = g_list_append (manager->priv->seats, g_object_ref (seat)); - g_signal_connect (seat, "stopped", G_CALLBACK (seat_stopped_cb), manager); + g_signal_connect (seat, SEAT_SIGNAL_STOPPED, G_CALLBACK (seat_stopped_cb), manager); g_signal_emit (manager, signals[SEAT_ADDED], 0, seat); return TRUE; @@ -195,7 +195,7 @@ display_manager_class_init (DisplayManagerClass *klass) g_type_class_add_private (klass, sizeof (DisplayManagerPrivate)); signals[SEAT_ADDED] = - g_signal_new ("seat-added", + g_signal_new (DISPLAY_MANAGER_SIGNAL_SEAT_ADDED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (DisplayManagerClass, seat_added), @@ -203,7 +203,7 @@ display_manager_class_init (DisplayManagerClass *klass) NULL, G_TYPE_NONE, 1, SEAT_TYPE); signals[SEAT_REMOVED] = - g_signal_new ("seat-removed", + g_signal_new (DISPLAY_MANAGER_SIGNAL_SEAT_REMOVED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (DisplayManagerClass, seat_removed), @@ -211,7 +211,7 @@ display_manager_class_init (DisplayManagerClass *klass) NULL, G_TYPE_NONE, 1, SEAT_TYPE); signals[STOPPED] = - g_signal_new ("stopped", + g_signal_new (DISPLAY_MANAGER_SIGNAL_STOPPED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (DisplayManagerClass, stopped), diff --git a/src/display-manager.h b/src/display-manager.h index c4b7d939..bc3ec517 100644 --- a/src/display-manager.h +++ b/src/display-manager.h @@ -21,6 +21,10 @@ G_BEGIN_DECLS #define DISPLAY_MANAGER_TYPE (display_manager_get_type()) #define DISPLAY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DISPLAY_MANAGER_TYPE, DisplayManager)); +#define DISPLAY_MANAGER_SIGNAL_SEAT_ADDED "seat-added" +#define DISPLAY_MANAGER_SIGNAL_SEAT_REMOVED "seat-removed" +#define DISPLAY_MANAGER_SIGNAL_STOPPED "stopped" + typedef struct DisplayManagerPrivate DisplayManagerPrivate; typedef struct diff --git a/src/display-server.c b/src/display-server.c index 19098d2c..336a6eed 100644 --- a/src/display-server.c +++ b/src/display-server.c @@ -179,7 +179,7 @@ display_server_class_init (DisplayServerClass *klass) g_type_class_add_private (klass, sizeof (DisplayServerPrivate)); signals[READY] = - g_signal_new ("ready", + g_signal_new (DISPLAY_SERVER_SIGNAL_READY, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (DisplayServerClass, ready), @@ -187,7 +187,7 @@ display_server_class_init (DisplayServerClass *klass) NULL, G_TYPE_NONE, 0); signals[STOPPED] = - g_signal_new ("stopped", + g_signal_new (DISPLAY_SERVER_SIGNAL_STOPPED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (DisplayServerClass, stopped), diff --git a/src/display-server.h b/src/display-server.h index c31d096e..4d6f888a 100644 --- a/src/display-server.h +++ b/src/display-server.h @@ -26,6 +26,9 @@ G_BEGIN_DECLS #define DISPLAY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DISPLAY_SERVER_TYPE, DisplayServerClass)) #define DISPLAY_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DISPLAY_SERVER_TYPE, DisplayServerClass)) +#define DISPLAY_SERVER_SIGNAL_READY "ready" +#define DISPLAY_SERVER_SIGNAL_STOPPED "stopped" + typedef struct DisplayServerPrivate DisplayServerPrivate; struct DisplayServer diff --git a/src/greeter.c b/src/greeter.c index 980fa8eb..e1d47f86 100644 --- a/src/greeter.c +++ b/src/greeter.c @@ -436,7 +436,7 @@ handle_login (Greeter *greeter, guint32 sequence_number, const gchar *username) if (greeter->priv->active_username) g_free (greeter->priv->active_username); greeter->priv->active_username = g_strdup (username); - g_object_notify (G_OBJECT (greeter), "active-username"); + g_object_notify (G_OBJECT (greeter), GREETER_PROPERTY_ACTIVE_USERNAME); greeter->priv->authentication_sequence_number = sequence_number; g_signal_emit (greeter, signals[CREATE_SESSION], 0, &greeter->priv->authentication_session); @@ -446,8 +446,8 @@ handle_login (Greeter *greeter, guint32 sequence_number, const gchar *username) return; } - g_signal_connect (G_OBJECT (greeter->priv->authentication_session), "got-messages", G_CALLBACK (pam_messages_cb), greeter); - g_signal_connect (G_OBJECT (greeter->priv->authentication_session), "authentication-complete", G_CALLBACK (authentication_complete_cb), greeter); + g_signal_connect (G_OBJECT (greeter->priv->authentication_session), SESSION_SIGNAL_GOT_MESSAGES, G_CALLBACK (pam_messages_cb), greeter); + g_signal_connect (G_OBJECT (greeter->priv->authentication_session), SESSION_SIGNAL_AUTHENTICATION_COMPLETE, G_CALLBACK (authentication_complete_cb), greeter); /* Use non-interactive service for autologin user */ autologin_username = g_hash_table_lookup (greeter->priv->hints, "autologin-user"); @@ -550,8 +550,8 @@ handle_login_remote (Greeter *greeter, const gchar *session_name, const gchar *u g_signal_emit (greeter, signals[CREATE_SESSION], 0, &greeter->priv->authentication_session); if (greeter->priv->authentication_session) { - g_signal_connect (G_OBJECT (greeter->priv->authentication_session), "got-messages", G_CALLBACK (pam_messages_cb), greeter); - g_signal_connect (G_OBJECT (greeter->priv->authentication_session), "authentication-complete", G_CALLBACK (authentication_complete_cb), greeter); + g_signal_connect (G_OBJECT (greeter->priv->authentication_session), SESSION_SIGNAL_GOT_MESSAGES, G_CALLBACK (pam_messages_cb), greeter); + g_signal_connect (G_OBJECT (greeter->priv->authentication_session), SESSION_SIGNAL_AUTHENTICATION_COMPLETE, G_CALLBACK (authentication_complete_cb), greeter); /* Run the session process */ session_set_pam_service (greeter->priv->authentication_session, service); @@ -1101,7 +1101,7 @@ greeter_class_init (GreeterClass *klass) object_class->set_property = greeter_set_property; signals[CONNECTED] = - g_signal_new ("connected", + g_signal_new (GREETER_SIGNAL_CONNECTED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GreeterClass, connected), @@ -1110,7 +1110,7 @@ greeter_class_init (GreeterClass *klass) G_TYPE_NONE, 0); signals[CREATE_SESSION] = - g_signal_new ("create-session", + g_signal_new (GREETER_SIGNAL_CREATE_SESSION, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GreeterClass, create_session), @@ -1120,7 +1120,7 @@ greeter_class_init (GreeterClass *klass) SESSION_TYPE, 0); signals[START_SESSION] = - g_signal_new ("start-session", + g_signal_new (GREETER_SIGNAL_START_SESSION, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GreeterClass, start_session), @@ -1131,8 +1131,8 @@ greeter_class_init (GreeterClass *klass) g_object_class_install_property (object_class, PROP_ACTIVE_USERNAME, - g_param_spec_string ("active-username", - "active-username", + g_param_spec_string (GREETER_PROPERTY_ACTIVE_USERNAME, + GREETER_PROPERTY_ACTIVE_USERNAME, "Active username", NULL, G_PARAM_READABLE)); diff --git a/src/greeter.h b/src/greeter.h index 47929ac1..32b76b5e 100644 --- a/src/greeter.h +++ b/src/greeter.h @@ -22,6 +22,14 @@ G_BEGIN_DECLS #define GREETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GREETER_TYPE, GreeterClass)) #define IS_GREETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GREETER_TYPE)) +#define GREETER_SIGNAL_CONNECTED "connected" +#define GREETER_SIGNAL_CREATE_SESSION "create-session" +#define GREETER_SIGNAL_START_SESSION "start-session" + +#define GREETER_PROPERTY_ACTIVE_USERNAME "active-username" + +#define GREETER_SIGNAL_ACTIVE_USERNAME_CHANGED "notify::" GREETER_PROPERTY_ACTIVE_USERNAME + typedef struct GreeterPrivate GreeterPrivate; typedef struct diff --git a/src/lightdm.c b/src/lightdm.c index f48af8bb..9f26d463 100644 --- a/src/lightdm.c +++ b/src/lightdm.c @@ -705,8 +705,8 @@ seat_added_cb (DisplayManager *display_manager, Seat *seat) emit_object_value_changed (bus, "/org/freedesktop/DisplayManager", "org.freedesktop.DisplayManager", "Seats", get_seat_list ()); emit_object_signal (bus, "/org/freedesktop/DisplayManager", "SeatAdded", entry->path); - g_signal_connect (seat, "running-user-session", G_CALLBACK (running_user_session_cb), NULL); - g_signal_connect (seat, "session-removed", G_CALLBACK (session_removed_cb), NULL); + g_signal_connect (seat, SEAT_SIGNAL_RUNNING_USER_SESSION, G_CALLBACK (running_user_session_cb), NULL); + g_signal_connect (seat, SEAT_SIGNAL_SESSION_REMOVED, G_CALLBACK (session_removed_cb), NULL); } static void @@ -838,8 +838,8 @@ bus_acquired_cb (GDBusConnection *connection, seat_bus_entries = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, seat_bus_entry_free); session_bus_entries = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, session_bus_entry_free); - g_signal_connect (display_manager, "seat-added", G_CALLBACK (seat_added_cb), NULL); - g_signal_connect (display_manager, "seat-removed", G_CALLBACK (seat_removed_cb), NULL); + g_signal_connect (display_manager, DISPLAY_MANAGER_SIGNAL_SEAT_ADDED, G_CALLBACK (seat_added_cb), NULL); + g_signal_connect (display_manager, DISPLAY_MANAGER_SIGNAL_SEAT_REMOVED, G_CALLBACK (seat_removed_cb), NULL); for (link = display_manager_get_seats (display_manager); link; link = link->next) seat_added_cb (display_manager, (Seat *) link->data); @@ -858,7 +858,7 @@ bus_acquired_cb (GDBusConnection *connection, if (port > 0) xdmcp_server_set_port (xdmcp_server, port); } - g_signal_connect (xdmcp_server, "new-session", G_CALLBACK (xdmcp_session_cb), NULL); + g_signal_connect (xdmcp_server, XDMCP_SERVER_SIGNAL_NEW_SESSION, G_CALLBACK (xdmcp_session_cb), NULL); key_name = config_get_string (config_get_instance (), "XDMCPServer", "key"); if (key_name) @@ -911,7 +911,7 @@ bus_acquired_cb (GDBusConnection *connection, if (port > 0) vnc_server_set_port (vnc_server, port); } - g_signal_connect (vnc_server, "new-connection", G_CALLBACK (vnc_connection_cb), NULL); + g_signal_connect (vnc_server, VNC_SERVER_SIGNAL_NEW_CONNECTION, G_CALLBACK (vnc_connection_cb), NULL); g_debug ("Starting VNC server on TCP/IP port %d", vnc_server_get_port (vnc_server)); vnc_server_start (vnc_server); @@ -1035,7 +1035,7 @@ update_login1_seat (Login1Seat *login1_seat) if (seat) { if (seat_get_is_stopping (seat)) - g_signal_connect (seat, "stopped", G_CALLBACK (seat_stopped_cb), login1_seat); + g_signal_connect (seat, SEAT_SIGNAL_STOPPED, G_CALLBACK (seat_stopped_cb), login1_seat); return TRUE; } @@ -1064,7 +1064,7 @@ login1_service_seat_added_cb (Login1Service *service, Login1Seat *login1_seat) g_debug ("Seat %s added from logind without graphical output", login1_seat_get_id (login1_seat)); if (config_get_boolean (config_get_instance (), "LightDM", "logind-check-graphical")) - g_signal_connect (login1_seat, "can-graphical-changed", G_CALLBACK (login1_can_graphical_changed_cb), NULL); + g_signal_connect (login1_seat, LOGIN1_SEAT_SIGNAL_CAN_GRAPHICAL_CHANGED, G_CALLBACK (login1_can_graphical_changed_cb), NULL); update_login1_seat (login1_seat); } @@ -1137,7 +1137,7 @@ main (int argc, char **argv) messages = g_list_append (messages, g_strdup_printf ("Starting Light Display Manager %s, UID=%i PID=%i", VERSION, getuid (), getpid ())); - g_signal_connect (process_get_current (), "got-signal", G_CALLBACK (signal_cb), NULL); + g_signal_connect (process_get_current (), PROCESS_SIGNAL_GOT_SIGNAL, G_CALLBACK (signal_cb), NULL); option_context = g_option_context_new (/* Arguments and description for --help test */ _("- Display Manager")); @@ -1401,8 +1401,8 @@ main (int argc, char **argv) g_debug ("Using Xephyr for X servers"); display_manager = display_manager_new (); - g_signal_connect (display_manager, "stopped", G_CALLBACK (display_manager_stopped_cb), NULL); - g_signal_connect (display_manager, "seat-removed", G_CALLBACK (display_manager_seat_removed_cb), NULL); + g_signal_connect (display_manager, DISPLAY_MANAGER_SIGNAL_STOPPED, G_CALLBACK (display_manager_stopped_cb), NULL); + g_signal_connect (display_manager, DISPLAY_MANAGER_SIGNAL_SEAT_REMOVED, G_CALLBACK (display_manager_seat_removed_cb), NULL); shared_data_manager_start (shared_data_manager_get_instance ()); @@ -1414,14 +1414,14 @@ main (int argc, char **argv) if (config_get_boolean (config_get_instance (), "LightDM", "start-default-seat")) { - g_signal_connect (login1_service_get_instance (), "seat-added", G_CALLBACK (login1_service_seat_added_cb), NULL); - g_signal_connect (login1_service_get_instance (), "seat-removed", G_CALLBACK (login1_service_seat_removed_cb), NULL); + g_signal_connect (login1_service_get_instance (), LOGIN1_SERVICE_SIGNAL_SEAT_ADDED, G_CALLBACK (login1_service_seat_added_cb), NULL); + g_signal_connect (login1_service_get_instance (), LOGIN1_SERVICE_SIGNAL_SEAT_REMOVED, G_CALLBACK (login1_service_seat_removed_cb), NULL); for (link = login1_service_get_seats (login1_service_get_instance ()); link; link = link->next) { Login1Seat *login1_seat = link->data; if (config_get_boolean (config_get_instance (), "LightDM", "logind-check-graphical")) - g_signal_connect (login1_seat, "can-graphical-changed", G_CALLBACK (login1_can_graphical_changed_cb), NULL); + g_signal_connect (login1_seat, LOGIN1_SEAT_SIGNAL_CAN_GRAPHICAL_CHANGED, G_CALLBACK (login1_can_graphical_changed_cb), NULL); if (!update_login1_seat (login1_seat)) return EXIT_FAILURE; } diff --git a/src/login1.c b/src/login1.c index f799e3ed..1bdf5b21 100644 --- a/src/login1.c +++ b/src/login1.c @@ -451,7 +451,7 @@ login1_service_class_init (Login1ServiceClass *klass) g_type_class_add_private (klass, sizeof (Login1ServicePrivate)); service_signals[SEAT_ADDED] = - g_signal_new ("seat-added", + g_signal_new (LOGIN1_SERVICE_SIGNAL_SEAT_ADDED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (Login1ServiceClass, seat_added), @@ -459,7 +459,7 @@ login1_service_class_init (Login1ServiceClass *klass) NULL, G_TYPE_NONE, 1, LOGIN1_SEAT_TYPE); service_signals[SEAT_REMOVED] = - g_signal_new ("seat-removed", + g_signal_new (LOGIN1_SERVICE_SIGNAL_SEAT_REMOVED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (Login1ServiceClass, seat_removed), @@ -518,7 +518,7 @@ login1_seat_class_init (Login1SeatClass *klass) g_type_class_add_private (klass, sizeof (Login1SeatPrivate)); seat_signals[CAN_GRAPHICAL_CHANGED] = - g_signal_new ("can-graphical-changed", + g_signal_new (LOGIN1_SEAT_SIGNAL_CAN_GRAPHICAL_CHANGED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (Login1SeatClass, can_graphical_changed), diff --git a/src/login1.h b/src/login1.h index af9f2a96..c266e23d 100644 --- a/src/login1.h +++ b/src/login1.h @@ -22,6 +22,11 @@ G_BEGIN_DECLS #define LOGIN1_SERVICE_TYPE (login1_service_get_type()) #define LOGIN1_SERVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LOGIN1_SERVICE_TYPE, Login1Service)); +#define LOGIN1_SERVICE_SIGNAL_SEAT_ADDED "seat-added" +#define LOGIN1_SERVICE_SIGNAL_SEAT_REMOVED "seat-removed" + +#define LOGIN1_SEAT_SIGNAL_CAN_GRAPHICAL_CHANGED "can-graphical-changed" + typedef struct Login1SeatPrivate Login1SeatPrivate; typedef struct diff --git a/src/process.c b/src/process.c index adb06f78..50c0a9b0 100644 --- a/src/process.c +++ b/src/process.c @@ -432,7 +432,7 @@ process_class_init (ProcessClass *klass) g_type_class_add_private (klass, sizeof (ProcessPrivate)); signals[GOT_DATA] = - g_signal_new ("got-data", + g_signal_new (PROCESS_SIGNAL_GOT_DATA, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ProcessClass, got_data), @@ -440,7 +440,7 @@ process_class_init (ProcessClass *klass) NULL, G_TYPE_NONE, 0); signals[GOT_SIGNAL] = - g_signal_new ("got-signal", + g_signal_new (PROCESS_SIGNAL_GOT_SIGNAL, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ProcessClass, got_signal), @@ -448,7 +448,7 @@ process_class_init (ProcessClass *klass) NULL, G_TYPE_NONE, 1, G_TYPE_INT); signals[STOPPED] = - g_signal_new ("stopped", + g_signal_new (PROCESS_SIGNAL_STOPPED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ProcessClass, stopped), diff --git a/src/process.h b/src/process.h index d15477b1..b8c50926 100644 --- a/src/process.h +++ b/src/process.h @@ -21,6 +21,10 @@ G_BEGIN_DECLS #define PROCESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROCESS_TYPE, Process)) #define PROCESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROCESS_TYPE, ProcessClass)) +#define PROCESS_SIGNAL_GOT_DATA "got-data" +#define PROCESS_SIGNAL_GOT_SIGNAL "got-signal" +#define PROCESS_SIGNAL_STOPPED "stopped" + typedef struct ProcessPrivate ProcessPrivate; typedef struct diff --git a/src/seat-unity.c b/src/seat-unity.c index bc08437d..32d30b23 100644 --- a/src/seat-unity.c +++ b/src/seat-unity.c @@ -127,7 +127,7 @@ compositor_ready_cb (UnitySystemCompositor *compositor, SeatUnity *seat) g_key_file_free (keys); } - g_signal_connect (seat->priv->xdmcp_x_server, "stopped", G_CALLBACK (xdmcp_x_server_stopped_cb), seat); + g_signal_connect (seat->priv->xdmcp_x_server, DISPLAY_SERVER_SIGNAL_STOPPED, G_CALLBACK (xdmcp_x_server_stopped_cb), seat); if (!display_server_start (DISPLAY_SERVER (seat->priv->xdmcp_x_server))) seat_stop (SEAT (seat)); } @@ -182,8 +182,8 @@ seat_unity_start (Seat *seat) timeout = 60; SEAT_UNITY (seat)->priv->compositor = unity_system_compositor_new (); - g_signal_connect (SEAT_UNITY (seat)->priv->compositor, "ready", G_CALLBACK (compositor_ready_cb), seat); - g_signal_connect (SEAT_UNITY (seat)->priv->compositor, "stopped", G_CALLBACK (compositor_stopped_cb), seat); + g_signal_connect (SEAT_UNITY (seat)->priv->compositor, DISPLAY_SERVER_SIGNAL_READY, G_CALLBACK (compositor_ready_cb), seat); + g_signal_connect (SEAT_UNITY (seat)->priv->compositor, DISPLAY_SERVER_SIGNAL_STOPPED, G_CALLBACK (compositor_stopped_cb), seat); unity_system_compositor_set_command (SEAT_UNITY (seat)->priv->compositor, seat_get_string_property (SEAT (seat), "unity-compositor-command")); unity_system_compositor_set_vt (SEAT_UNITY (seat)->priv->compositor, vt); unity_system_compositor_set_timeout (SEAT_UNITY (seat)->priv->compositor, timeout); diff --git a/src/seat-xlocal.c b/src/seat-xlocal.c index 04a76982..7b5ec7ed 100644 --- a/src/seat-xlocal.c +++ b/src/seat-xlocal.c @@ -110,7 +110,7 @@ seat_xlocal_start (Seat *seat) g_key_file_free (keys); } - g_signal_connect (s->priv->xdmcp_x_server, "stopped", G_CALLBACK (xdmcp_x_server_stopped_cb), seat); + g_signal_connect (s->priv->xdmcp_x_server, DISPLAY_SERVER_SIGNAL_STOPPED, G_CALLBACK (xdmcp_x_server_stopped_cb), seat); return display_server_start (DISPLAY_SERVER (s->priv->xdmcp_x_server)); } @@ -150,8 +150,8 @@ get_vt (Seat *seat, DisplayServer *display_server) if (active_vt >= vt_get_min ()) { vt = active_vt; - g_signal_connect (display_server, "ready", G_CALLBACK (display_server_ready_cb), seat); - g_signal_connect (display_server, "stopped", G_CALLBACK (display_server_transition_plymouth_cb), seat); + g_signal_connect (display_server, DISPLAY_SERVER_SIGNAL_READY, G_CALLBACK (display_server_ready_cb), seat); + g_signal_connect (display_server, DISPLAY_SERVER_SIGNAL_STOPPED, G_CALLBACK (display_server_transition_plymouth_cb), seat); plymouth_deactivate (); } else @@ -851,8 +851,8 @@ create_session (Seat *seat, gboolean autostart) session = SEAT_GET_CLASS (seat)->create_session (seat); seat->priv->sessions = g_list_append (seat->priv->sessions, session); if (autostart) - g_signal_connect (session, "authentication-complete", G_CALLBACK (session_authentication_complete_cb), seat); - g_signal_connect (session, "stopped", G_CALLBACK (session_stopped_cb), seat); + g_signal_connect (session, SESSION_SIGNAL_AUTHENTICATION_COMPLETE, G_CALLBACK (session_authentication_complete_cb), seat); + g_signal_connect (session, SESSION_SIGNAL_STOPPED, G_CALLBACK (session_stopped_cb), seat); set_session_env (session); @@ -1212,9 +1212,9 @@ create_greeter_session (Seat *seat) greeter_session = SEAT_GET_CLASS (seat)->create_greeter_session (seat); session_set_config (SESSION (greeter_session), session_config); seat->priv->sessions = g_list_append (seat->priv->sessions, SESSION (greeter_session)); - g_signal_connect (greeter_session, "notify::active-username", G_CALLBACK (greeter_active_username_changed_cb), seat); - g_signal_connect (greeter_session, "authentication-complete", G_CALLBACK (session_authentication_complete_cb), seat); - g_signal_connect (greeter_session, "stopped", G_CALLBACK (session_stopped_cb), seat); + g_signal_connect (greeter_session, GREETER_SIGNAL_ACTIVE_USERNAME_CHANGED, G_CALLBACK (greeter_active_username_changed_cb), seat); + g_signal_connect (greeter_session, SESSION_SIGNAL_AUTHENTICATION_COMPLETE, G_CALLBACK (session_authentication_complete_cb), seat); + g_signal_connect (greeter_session, SESSION_SIGNAL_STOPPED, G_CALLBACK (session_stopped_cb), seat); set_session_env (SESSION (greeter_session)); session_set_env (SESSION (greeter_session), "XDG_SESSION_CLASS", "greeter"); @@ -1238,8 +1238,8 @@ create_greeter_session (Seat *seat) greeter_set_pam_services (greeter_session, seat_get_string_property (seat, "pam-service"), seat_get_string_property (seat, "pam-autologin-service")); - g_signal_connect (greeter_session, "create-session", G_CALLBACK (greeter_create_session_cb), seat); - g_signal_connect (greeter_session, "start-session", G_CALLBACK (greeter_start_session_cb), seat); + g_signal_connect (greeter_session, GREETER_SIGNAL_CREATE_SESSION, G_CALLBACK (greeter_create_session_cb), seat); + g_signal_connect (greeter_session, GREETER_SIGNAL_START_SESSION, G_CALLBACK (greeter_start_session_cb), seat); /* Set hints to greeter */ greeter_set_allow_guest (greeter_session, seat_get_allow_guest (seat)); @@ -1335,8 +1335,8 @@ create_display_server (Seat *seat, Session *session) return NULL; seat->priv->display_servers = g_list_append (seat->priv->display_servers, display_server); - g_signal_connect (display_server, "ready", G_CALLBACK (display_server_ready_cb), seat); - g_signal_connect (display_server, "stopped", G_CALLBACK (display_server_stopped_cb), seat); + g_signal_connect (display_server, DISPLAY_SERVER_SIGNAL_READY, G_CALLBACK (display_server_ready_cb), seat); + g_signal_connect (display_server, DISPLAY_SERVER_SIGNAL_STOPPED, G_CALLBACK (display_server_stopped_cb), seat); return display_server; } @@ -1467,7 +1467,7 @@ seat_switch_to_user (Seat *seat, const gchar *username, const gchar *session_nam /* Attempt to authenticate them */ session = create_user_session (seat, username, FALSE); - g_signal_connect (session, "authentication-complete", G_CALLBACK (switch_authentication_complete_cb), seat); + g_signal_connect (session, SESSION_SIGNAL_AUTHENTICATION_COMPLETE, G_CALLBACK (switch_authentication_complete_cb), seat); session_set_pam_service (session, seat_get_string_property (seat, "pam-service")); return session_start (session); @@ -1834,7 +1834,7 @@ seat_class_init (SeatClass *klass) g_type_class_add_private (klass, sizeof (SeatPrivate)); signals[SESSION_ADDED] = - g_signal_new ("session-added", + g_signal_new (SEAT_SIGNAL_SESSION_ADDED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SeatClass, session_added), @@ -1842,7 +1842,7 @@ seat_class_init (SeatClass *klass) NULL, G_TYPE_NONE, 1, SESSION_TYPE); signals[RUNNING_USER_SESSION] = - g_signal_new ("running-user-session", + g_signal_new (SEAT_SIGNAL_RUNNING_USER_SESSION, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SeatClass, running_user_session), @@ -1850,7 +1850,7 @@ seat_class_init (SeatClass *klass) NULL, G_TYPE_NONE, 1, SESSION_TYPE); signals[SESSION_REMOVED] = - g_signal_new ("session-removed", + g_signal_new (SEAT_SIGNAL_SESSION_REMOVED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SeatClass, session_removed), @@ -1858,7 +1858,7 @@ seat_class_init (SeatClass *klass) NULL, G_TYPE_NONE, 1, SESSION_TYPE); signals[STOPPED] = - g_signal_new ("stopped", + g_signal_new (SEAT_SIGNAL_STOPPED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SeatClass, stopped), @@ -26,6 +26,11 @@ G_BEGIN_DECLS #define SEAT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAT_TYPE, SeatClass)) #define SEAT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAT_TYPE, SeatClass)) +#define SEAT_SIGNAL_SESSION_ADDED "session-added" +#define SEAT_SIGNAL_RUNNING_USER_SESSION "running-user-session" +#define SEAT_SIGNAL_SESSION_REMOVED "session-removed" +#define SEAT_SIGNAL_STOPPED "stopped" + typedef struct SeatPrivate SeatPrivate; typedef struct diff --git a/src/session.c b/src/session.c index c0729df3..1ac16109 100644 --- a/src/session.c +++ b/src/session.c @@ -958,7 +958,7 @@ session_class_init (SessionClass *klass) g_type_class_add_private (klass, sizeof (SessionPrivate)); signals[GOT_MESSAGES] = - g_signal_new ("got-messages", + g_signal_new (SESSION_SIGNAL_GOT_MESSAGES, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SessionClass, got_messages), @@ -967,7 +967,7 @@ session_class_init (SessionClass *klass) G_TYPE_NONE, 0); signals[AUTHENTICATION_COMPLETE] = - g_signal_new ("authentication-complete", + g_signal_new (SESSION_SIGNAL_AUTHENTICATION_COMPLETE, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SessionClass, authentication_complete), @@ -976,7 +976,7 @@ session_class_init (SessionClass *klass) G_TYPE_NONE, 0); signals[STOPPED] = - g_signal_new ("stopped", + g_signal_new (SESSION_SIGNAL_STOPPED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (SessionClass, stopped), diff --git a/src/session.h b/src/session.h index b79a53d8..513fd12d 100644 --- a/src/session.h +++ b/src/session.h @@ -31,6 +31,10 @@ G_BEGIN_DECLS #define SESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SESSION_TYPE, SessionClass)) #define SESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SESSION_TYPE, SessionClass)) +#define SESSION_SIGNAL_GOT_MESSAGES "got-messages" +#define SESSION_SIGNAL_AUTHENTICATION_COMPLETE "authentication-complete" +#define SESSION_SIGNAL_STOPPED "stopped" + typedef struct SessionPrivate SessionPrivate; struct Session diff --git a/src/shared-data-manager.c b/src/shared-data-manager.c index 5b667647..47f1c10d 100644 --- a/src/shared-data-manager.c +++ b/src/shared-data-manager.c @@ -227,7 +227,7 @@ shared_data_manager_start (SharedDataManager *manager) g_object_unref (file); /* And listen for user removals. */ - g_signal_connect (common_user_list_get_instance (), "user-removed", G_CALLBACK (user_removed_cb), manager); + g_signal_connect (common_user_list_get_instance (), USER_LIST_SIGNAL_USER_REMOVED, G_CALLBACK (user_removed_cb), manager); } static void diff --git a/src/unity-system-compositor.c b/src/unity-system-compositor.c index 40502557..7c81f0b3 100644 --- a/src/unity-system-compositor.c +++ b/src/unity-system-compositor.c @@ -438,7 +438,7 @@ unity_system_compositor_start (DisplayServer *server) g_string_free (command, TRUE); /* Start the compositor */ - g_signal_connect (compositor->priv->process, "stopped", G_CALLBACK (stopped_cb), compositor); + g_signal_connect (compositor->priv->process, PROCESS_SIGNAL_STOPPED, G_CALLBACK (stopped_cb), compositor); result = process_start (compositor->priv->process, FALSE); /* Close compostor ends of the pipes */ diff --git a/src/vnc-server.c b/src/vnc-server.c index 1755ffdb..2ccb2292 100644 --- a/src/vnc-server.c +++ b/src/vnc-server.c @@ -168,7 +168,7 @@ vnc_server_class_init (VNCServerClass *klass) g_type_class_add_private (klass, sizeof (VNCServerPrivate)); signals[NEW_CONNECTION] = - g_signal_new ("new-connection", + g_signal_new (VNC_SERVER_SIGNAL_NEW_CONNECTION, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (VNCServerClass, new_connection), diff --git a/src/vnc-server.h b/src/vnc-server.h index 109dc904..64fe1daf 100644 --- a/src/vnc-server.h +++ b/src/vnc-server.h @@ -19,6 +19,8 @@ G_BEGIN_DECLS #define VNC_SERVER_TYPE (vnc_server_get_type()) #define VNC_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VNC_SERVER_TYPE, VNCServer)); +#define VNC_SERVER_SIGNAL_NEW_CONNECTION "new-connection" + typedef struct VNCServerPrivate VNCServerPrivate; typedef struct diff --git a/src/x-server-local.c b/src/x-server-local.c index 3f58e0b7..b6a55aa9 100644 --- a/src/x-server-local.c +++ b/src/x-server-local.c @@ -439,8 +439,8 @@ x_server_local_start (DisplayServer *display_server) server->priv->x_server_process = process_new (run_cb, server); process_set_clear_environment (server->priv->x_server_process, TRUE); - g_signal_connect (server->priv->x_server_process, "got-signal", G_CALLBACK (got_signal_cb), server); - g_signal_connect (server->priv->x_server_process, "stopped", G_CALLBACK (stopped_cb), server); + g_signal_connect (server->priv->x_server_process, PROCESS_SIGNAL_GOT_SIGNAL, G_CALLBACK (got_signal_cb), server); + g_signal_connect (server->priv->x_server_process, PROCESS_SIGNAL_STOPPED, G_CALLBACK (stopped_cb), server); /* Setup logging */ filename = g_strdup_printf ("%s.log", display_server_get_name (display_server)); diff --git a/src/x-server-xvnc.c b/src/x-server-xvnc.c index cea1782a..a48290e5 100644 --- a/src/x-server-xvnc.c +++ b/src/x-server-xvnc.c @@ -195,8 +195,8 @@ x_server_xvnc_start (DisplayServer *display_server) server->priv->x_server_process = process_new (run_cb, server); process_set_clear_environment (server->priv->x_server_process, TRUE); - g_signal_connect (server->priv->x_server_process, "got-signal", G_CALLBACK (got_signal_cb), server); - g_signal_connect (server->priv->x_server_process, "stopped", G_CALLBACK (stopped_cb), server); + g_signal_connect (server->priv->x_server_process, PROCESS_SIGNAL_GOT_SIGNAL, G_CALLBACK (got_signal_cb), server); + g_signal_connect (server->priv->x_server_process, PROCESS_SIGNAL_STOPPED, G_CALLBACK (stopped_cb), server); /* Setup logging */ filename = g_strdup_printf ("%s.log", display_server_get_name (display_server)); diff --git a/src/xdmcp-server.c b/src/xdmcp-server.c index 4d45fb40..d240e380 100644 --- a/src/xdmcp-server.c +++ b/src/xdmcp-server.c @@ -703,7 +703,7 @@ xdmcp_server_class_init (XDMCPServerClass *klass) g_type_class_add_private (klass, sizeof (XDMCPServerPrivate)); signals[NEW_SESSION] = - g_signal_new ("new-session", + g_signal_new (XDMCP_SERVER_SIGNAL_NEW_SESSION, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XDMCPServerClass, new_session), diff --git a/src/xdmcp-server.h b/src/xdmcp-server.h index 31cd0fb6..32ca63b4 100644 --- a/src/xdmcp-server.h +++ b/src/xdmcp-server.h @@ -21,6 +21,8 @@ G_BEGIN_DECLS #define XDMCP_SERVER_TYPE (xdmcp_server_get_type()) #define XDMCP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDMCP_SERVER_TYPE, XDMCPServer)); +#define XDMCP_SERVER_SIGNAL_NEW_SESSION "new-session" + typedef struct XDMCPServerPrivate XDMCPServerPrivate; typedef struct diff --git a/tests/src/X.c b/tests/src/X.c index 2fd722da..2ad77b21 100644 --- a/tests/src/X.c +++ b/tests/src/X.c @@ -317,8 +317,8 @@ main (int argc, char **argv) status_connect (request_cb, id); xserver = x_server_new (display_number); - g_signal_connect (xserver, "client-connected", G_CALLBACK (client_connected_cb), NULL); - g_signal_connect (xserver, "client-disconnected", G_CALLBACK (client_disconnected_cb), NULL); + g_signal_connect (xserver, X_SERVER_SIGNAL_CLIENT_CONNECTED, G_CALLBACK (client_connected_cb), NULL); + g_signal_connect (xserver, X_SERVER_SIGNAL_CLIENT_DISCONNECTED, G_CALLBACK (client_disconnected_cb), NULL); status_text = g_string_new (""); g_string_printf (status_text, "%s START", id); @@ -415,11 +415,11 @@ main (int argc, char **argv) xdmcp_client_set_hostname (xdmcp_client, xdmcp_host); if (xdmcp_port > 0) xdmcp_client_set_port (xdmcp_client, xdmcp_port); - g_signal_connect (xdmcp_client, "query", G_CALLBACK (xdmcp_query_cb), NULL); - g_signal_connect (xdmcp_client, "willing", G_CALLBACK (xdmcp_willing_cb), NULL); - g_signal_connect (xdmcp_client, "accept", G_CALLBACK (xdmcp_accept_cb), NULL); - g_signal_connect (xdmcp_client, "decline", G_CALLBACK (xdmcp_decline_cb), NULL); - g_signal_connect (xdmcp_client, "failed", G_CALLBACK (xdmcp_failed_cb), NULL); + g_signal_connect (xdmcp_client, XDMCP_CLIENT_SIGNAL_QUERY, G_CALLBACK (xdmcp_query_cb), NULL); + g_signal_connect (xdmcp_client, XDMCP_CLIENT_SIGNAL_WILLING, G_CALLBACK (xdmcp_willing_cb), NULL); + g_signal_connect (xdmcp_client, XDMCP_CLIENT_SIGNAL_ACCEPT, G_CALLBACK (xdmcp_accept_cb), NULL); + g_signal_connect (xdmcp_client, XDMCP_CLIENT_SIGNAL_DECLINE, G_CALLBACK (xdmcp_decline_cb), NULL); + g_signal_connect (xdmcp_client, XDMCP_CLIENT_SIGNAL_FAILED, G_CALLBACK (xdmcp_failed_cb), NULL); } g_main_loop_run (loop); diff --git a/tests/src/Xvnc.c b/tests/src/Xvnc.c index 79f9193e..971ddcef 100644 --- a/tests/src/Xvnc.c +++ b/tests/src/Xvnc.c @@ -225,8 +225,8 @@ main (int argc, char **argv) status_connect (request_cb, id); xserver = x_server_new (display_number); - g_signal_connect (xserver, "client-connected", G_CALLBACK (client_connected_cb), NULL); - g_signal_connect (xserver, "client-disconnected", G_CALLBACK (client_disconnected_cb), NULL); + g_signal_connect (xserver, X_SERVER_SIGNAL_CLIENT_CONNECTED, G_CALLBACK (client_connected_cb), NULL); + g_signal_connect (xserver, X_SERVER_SIGNAL_CLIENT_DISCONNECTED, G_CALLBACK (client_disconnected_cb), NULL); status_notify ("%s START GEOMETRY=%s DEPTH=%d OPTION=%s", id, geometry, depth, has_option ? "TRUE" : "FALSE"); diff --git a/tests/src/test-gobject-greeter.c b/tests/src/test-gobject-greeter.c index 76d4df21..5277df00 100644 --- a/tests/src/test-gobject-greeter.c +++ b/tests/src/test-gobject-greeter.c @@ -238,7 +238,7 @@ request_cb (const gchar *name, GHashTable *params) username = g_hash_table_lookup (params, "USERNAME"); user = lightdm_user_list_get_user_by_name (lightdm_user_list_get_instance (), username); if (user) - g_signal_connect (user, "changed", G_CALLBACK (user_changed_cb), NULL); + g_signal_connect (user, LIGHTDM_SIGNAL_USER_CHANGED, G_CALLBACK (user_changed_cb), NULL); status_notify ("%s WATCH-USER USERNAME=%s", greeter_id, username); } @@ -482,21 +482,21 @@ main (int argc, char **argv) } greeter = lightdm_greeter_new (); - g_signal_connect (greeter, "show-message", G_CALLBACK (show_message_cb), NULL); - g_signal_connect (greeter, "show-prompt", G_CALLBACK (show_prompt_cb), NULL); - g_signal_connect (greeter, "authentication-complete", G_CALLBACK (authentication_complete_cb), NULL); - g_signal_connect (greeter, "autologin-timer-expired", G_CALLBACK (autologin_timer_expired_cb), NULL); + g_signal_connect (greeter, LIGHTDM_GREETER_SIGNAL_SHOW_MESSAGE, G_CALLBACK (show_message_cb), NULL); + g_signal_connect (greeter, LIGHTDM_GREETER_SIGNAL_SHOW_PROMPT, G_CALLBACK (show_prompt_cb), NULL); + g_signal_connect (greeter, LIGHTDM_GREETER_SIGNAL_AUTHENTICATION_COMPLETE, G_CALLBACK (authentication_complete_cb), NULL); + g_signal_connect (greeter, LIGHTDM_GREETER_SIGNAL_AUTOLOGIN_TIMER_EXPIRED, G_CALLBACK (autologin_timer_expired_cb), NULL); if (g_key_file_get_boolean (config, "test-greeter-config", "resettable", NULL)) { lightdm_greeter_set_resettable (greeter, TRUE); - g_signal_connect (greeter, "idle", G_CALLBACK (idle_cb), NULL); - g_signal_connect (greeter, "reset", G_CALLBACK (reset_cb), NULL); + g_signal_connect (greeter, LIGHTDM_GREETER_SIGNAL_IDLE, G_CALLBACK (idle_cb), NULL); + g_signal_connect (greeter, LIGHTDM_GREETER_SIGNAL_RESET, G_CALLBACK (reset_cb), NULL); } if (g_key_file_get_boolean (config, "test-greeter-config", "log-user-changes", NULL)) { - g_signal_connect (lightdm_user_list_get_instance (), "user-added", G_CALLBACK (user_added_cb), NULL); - g_signal_connect (lightdm_user_list_get_instance (), "user-removed", G_CALLBACK (user_removed_cb), NULL); + g_signal_connect (lightdm_user_list_get_instance (), LIGHTDM_USER_LIST_SIGNAL_USER_ADDED, G_CALLBACK (user_added_cb), NULL); + g_signal_connect (lightdm_user_list_get_instance (), LIGHTDM_USER_LIST_SIGNAL_USER_REMOVED, G_CALLBACK (user_removed_cb), NULL); } status_notify ("%s CONNECT-TO-DAEMON", greeter_id); diff --git a/tests/src/x-server.c b/tests/src/x-server.c index ab604fdf..d756c58c 100644 --- a/tests/src/x-server.c +++ b/tests/src/x-server.c @@ -90,7 +90,7 @@ x_client_class_init (XClientClass *klass) g_type_class_add_private (klass, sizeof (XClientPrivate)); x_client_signals[X_CLIENT_DISCONNECTED] = - g_signal_new ("disconnected", + g_signal_new (X_CLIENT_SIGNAL_DISCONNECTED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XClientClass, disconnected), @@ -132,7 +132,7 @@ socket_connect_cb (GIOChannel *channel, GIOCondition condition, gpointer data) client = g_object_new (x_client_get_type (), NULL); client->priv->server = server; - g_signal_connect (client, "disconnected", G_CALLBACK (x_client_disconnected_cb), server); + g_signal_connect (client, X_CLIENT_SIGNAL_DISCONNECTED, G_CALLBACK (x_client_disconnected_cb), server); client->priv->socket = data_socket; client->priv->channel = g_io_channel_unix_new (g_socket_get_fd (data_socket)); g_hash_table_insert (server->priv->clients, client->priv->channel, client); @@ -195,7 +195,7 @@ x_server_class_init (XServerClass *klass) object_class->finalize = x_server_finalize; g_type_class_add_private (klass, sizeof (XServerPrivate)); x_server_signals[X_SERVER_CLIENT_CONNECTED] = - g_signal_new ("client-connected", + g_signal_new (X_SERVER_SIGNAL_CLIENT_CONNECTED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XServerClass, client_connected), @@ -203,7 +203,7 @@ x_server_class_init (XServerClass *klass) NULL, G_TYPE_NONE, 1, x_client_get_type ()); x_server_signals[X_SERVER_CLIENT_DISCONNECTED] = - g_signal_new ("client-disconnected", + g_signal_new (X_SERVER_SIGNAL_CLIENT_DISCONNECTED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XServerClass, client_disconnected), diff --git a/tests/src/x-server.h b/tests/src/x-server.h index 5f5b4728..7ce8c3fe 100644 --- a/tests/src/x-server.h +++ b/tests/src/x-server.h @@ -6,6 +6,11 @@ G_BEGIN_DECLS +#define X_CLIENT_SIGNAL_DISCONNECTED "disconnected" + +#define X_SERVER_SIGNAL_CLIENT_CONNECTED "client-connected" +#define X_SERVER_SIGNAL_CLIENT_DISCONNECTED "client-disconnected" + typedef struct XClientPrivate XClientPrivate; typedef struct diff --git a/tests/src/xdmcp-client.c b/tests/src/xdmcp-client.c index 63c5dba1..985745f7 100644 --- a/tests/src/xdmcp-client.c +++ b/tests/src/xdmcp-client.c @@ -438,7 +438,7 @@ xdmcp_client_class_init (XDMCPClientClass *klass) object_class->finalize = xdmcp_client_finalize; g_type_class_add_private (klass, sizeof (XDMCPClientPrivate)); xdmcp_client_signals[XDMCP_CLIENT_QUERY] = - g_signal_new ("query", + g_signal_new (XDMCP_CLIENT_SIGNAL_QUERY, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XDMCPClientClass, query), @@ -446,7 +446,7 @@ xdmcp_client_class_init (XDMCPClientClass *klass) NULL, G_TYPE_NONE, 0); xdmcp_client_signals[XDMCP_CLIENT_WILLING] = - g_signal_new ("willing", + g_signal_new (XDMCP_CLIENT_SIGNAL_WILLING, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XDMCPClientClass, willing), @@ -454,7 +454,7 @@ xdmcp_client_class_init (XDMCPClientClass *klass) NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); xdmcp_client_signals[XDMCP_CLIENT_ACCEPT] = - g_signal_new ("accept", + g_signal_new (XDMCP_CLIENT_SIGNAL_ACCEPT, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XDMCPClientClass, accept), @@ -462,7 +462,7 @@ xdmcp_client_class_init (XDMCPClientClass *klass) NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); xdmcp_client_signals[XDMCP_CLIENT_DECLINE] = - g_signal_new ("decline", + g_signal_new (XDMCP_CLIENT_SIGNAL_DECLINE, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XDMCPClientClass, decline), @@ -470,7 +470,7 @@ xdmcp_client_class_init (XDMCPClientClass *klass) NULL, G_TYPE_NONE, 1, G_TYPE_POINTER); xdmcp_client_signals[XDMCP_CLIENT_FAILED] = - g_signal_new ("failed", + g_signal_new (XDMCP_CLIENT_SIGNAL_FAILED, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XDMCPClientClass, failed), diff --git a/tests/src/xdmcp-client.h b/tests/src/xdmcp-client.h index 0f08fcc6..7b865abd 100644 --- a/tests/src/xdmcp-client.h +++ b/tests/src/xdmcp-client.h @@ -7,6 +7,12 @@ #define XDMCP_VERSION 1 #define XDMCP_PORT 177 +#define XDMCP_CLIENT_SIGNAL_QUERY "query" +#define XDMCP_CLIENT_SIGNAL_WILLING "willing" +#define XDMCP_CLIENT_SIGNAL_ACCEPT "accept" +#define XDMCP_CLIENT_SIGNAL_DECLINE "decline" +#define XDMCP_CLIENT_SIGNAL_FAILED "failed" + typedef struct { gchar *authentication_name; |