aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-02 11:51:27 -0600
committerTed Gould <ted@gould.cx>2010-03-02 11:51:27 -0600
commite5dd34b95bb29d4d1dc294c84bdbfe4c90f57b02 (patch)
treea49f55af71a47bfe4a7ef594cd6b35dc232a5746 /src
parent40ef68c195d63a7d19e1ad237fc7ebed00c9c0c2 (diff)
downloadayatana-indicator-session-e5dd34b95bb29d4d1dc294c84bdbfe4c90f57b02.tar.gz
ayatana-indicator-session-e5dd34b95bb29d4d1dc294c84bdbfe4c90f57b02.tar.bz2
ayatana-indicator-session-e5dd34b95bb29d4d1dc294c84bdbfe4c90f57b02.zip
Restructuring callbacks to not need the count variable.
Diffstat (limited to 'src')
-rw-r--r--src/session-service.c41
1 files changed, 9 insertions, 32 deletions
diff --git a/src/session-service.c b/src/session-service.c
index 30c14cf..42901a1 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -556,36 +556,13 @@ rebuild_items (DbusmenuMenuitem *root,
/* Signal called when a user is added. It updates the count and
rebuilds the menu */
static void
-user_added (UsersServiceDbus *service,
- UserData *user,
- gpointer user_data)
+user_change (UsersServiceDbus *service,
+ UserData *user,
+ gpointer user_data)
{
- DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;
-
- rebuild_items (root, service);
-}
-
-/* Signal called when a user is deleted. It updates the count and
- rebuilds the menu */
-static void
-user_removed (UsersServiceDbus *service,
- UserData *user,
- gpointer user_data)
-{
- DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;
-
- rebuild_items (root, service);
-}
-
-/* Wrapper around rebuild_items that is used on the first call
- so that we can initialize the count variable. */
-static void
-create_items (DbusmenuMenuitem *root,
- UsersServiceDbus *service)
-{
- g_return_if_fail (IS_USERS_SERVICE_DBUS (service));
-
- rebuild_items (root, service);
+ DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;
+ rebuild_items (root, service);
+ return;
}
/* When the service interface starts to shutdown, we
@@ -626,15 +603,15 @@ main (int argc, char ** argv)
dbus_interface = g_object_new (USERS_SERVICE_DBUS_TYPE, NULL);
- create_items (root_menuitem, dbus_interface);
+ rebuild_items (root_menuitem, dbus_interface);
g_signal_connect (G_OBJECT (dbus_interface),
"user-added",
- G_CALLBACK (user_added),
+ G_CALLBACK (user_change),
root_menuitem);
g_signal_connect (G_OBJECT (dbus_interface),
"user-removed",
- G_CALLBACK (user_removed),
+ G_CALLBACK (user_change),
root_menuitem);
setup_up();