aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2009-09-22 16:57:01 -0500
committerCody Russell <crussell@canonical.com>2009-09-22 16:57:01 -0500
commitc4ff339c7576c83000b1a3695918d70e0124c098 (patch)
tree701ffaff23b5d40a4cb13b7b7e51e9941602830b
parent15e2e5192dce211e3d6d8f4dfa0bf1690ca3a77d (diff)
downloadayatana-indicator-session-c4ff339c7576c83000b1a3695918d70e0124c098.tar.gz
ayatana-indicator-session-c4ff339c7576c83000b1a3695918d70e0124c098.tar.bz2
ayatana-indicator-session-c4ff339c7576c83000b1a3695918d70e0124c098.zip
fix dbus fu
-rw-r--r--src/users-service-dbus.c47
-rw-r--r--src/users-service-dbus.h3
-rw-r--r--src/users-service.c7
3 files changed, 17 insertions, 40 deletions
diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c
index 18a1b2a..e044fe8 100644
--- a/src/users-service-dbus.c
+++ b/src/users-service-dbus.c
@@ -80,8 +80,6 @@ struct _UsersServiceDbusPrivate
DBusGProxy *dbus_proxy_session;
DBusGProxy *dbus_proxy_system;
DBusGProxy *gdm_proxy;
-
- gchar *error;
};
#define USERS_SERVICE_DBUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbusPrivate))
@@ -160,8 +158,6 @@ users_service_dbus_init (UsersServiceDbus *self)
g_error ("Unable to get session bus: %s", error->message);
g_error_free (error);
- priv->error = g_strdup ("Failed to get session bus");
-
return;
}
@@ -170,8 +166,6 @@ users_service_dbus_init (UsersServiceDbus *self)
g_error("Unable to get system bus: %s", error->message);
g_error_free(error);
- priv->error = g_strdup ("Failed to get system bus");
-
return;
}
@@ -190,8 +184,6 @@ users_service_dbus_init (UsersServiceDbus *self)
g_error ("Unable to get dbus proxy on session bus: %s", error->message);
g_error_free (error);
- priv->error = g_strdup ("Failed to get session proxy");
-
return;
}
@@ -205,12 +197,10 @@ users_service_dbus_init (UsersServiceDbus *self)
g_error ("Unable to get dbus proxy on system bus: %s", error->message);
g_error_free (error);
- priv->error = g_strdup ("Failed to get system proxy");
-
return;
}
- priv->gdm_proxy = dbus_g_proxy_new_for_name_owner (priv->system_bus, // XXX ?
+ priv->gdm_proxy = dbus_g_proxy_new_for_name_owner (priv->system_bus,
"org.gnome.DisplayManager",
"/org/gnome/DisplayManager/UserManager",
"org.gnome.DisplayManager.UserManager",
@@ -220,8 +210,6 @@ users_service_dbus_init (UsersServiceDbus *self)
{
g_error ("Unable to get DisplayManager proxy on system bus: %s", error->message);
g_error_free (error);
-
- priv->error = g_strdup_printf ("Unable to get DisplayManager proxy: %s", error->message);
}
dbus_g_object_register_marshaller (_users_service_marshal_VOID__INT64,
@@ -294,8 +282,8 @@ users_loaded (DBusGProxy *proxy,
UsersServiceDbus *service;
UsersServiceDbusPrivate *priv;
GError *error = NULL;
- GArray *uids;
- GPtrArray *users_info;
+ GArray *uids = NULL;
+ GPtrArray *users_info = NULL;
gint count;
int i;
@@ -307,7 +295,6 @@ users_loaded (DBusGProxy *proxy,
&error))
{
g_warning ("failed to retrieve user count: %s", error->message);
- priv->error = g_strdup_printf ("Failed to retrieve user count: %s", error->message);
g_error_free (error);
return;
@@ -315,26 +302,26 @@ users_loaded (DBusGProxy *proxy,
priv->count = count;
+ uids = g_array_new (FALSE, FALSE, sizeof (gint64));
+
if (!org_gnome_DisplayManager_UserManager_get_user_list (proxy,
&uids,
&error))
{
g_warning ("failed to retrieve user list: %s", error->message);
- priv->error = g_strdup_printf ("Failed to retrieve user list: %s", error->message);
- g_print ("priv->error == %s\n", priv->error);
g_error_free (error);
return;
}
+ users_info = g_ptr_array_new ();
+
if (!org_gnome_DisplayManager_UserManager_get_users_info (proxy,
uids,
&users_info,
&error))
{
g_warning ("failed to retrieve user info: %s", error->message);
- priv->error = g_strdup_printf ("Failed to get user info: %s", error->message);
- g_print ("priv->error == %s\n", priv->error);
g_error_free (error);
return;
@@ -342,13 +329,19 @@ users_loaded (DBusGProxy *proxy,
for (i = 0; i < users_info->len; i++)
{
+ GValueArray *values;
UserData *data;
- g_print (" -> setting up user %d\n", i);
+ values = g_ptr_array_index (users_info, i);
- data = g_ptr_array_index (users_info, i);
+ data = g_new0 (UserData, 1);
- g_print (" * user_name: %s\n", data->user_name);
+ data->uid = g_value_get_int64 (g_value_array_get_nth (values, 0));
+ data->user_name = g_strdup (g_value_get_string (g_value_array_get_nth (values, 1)));
+ data->real_name = g_strdup (g_value_get_string (g_value_array_get_nth (values, 2)));
+ data->shell = g_strdup (g_value_get_string (g_value_array_get_nth (values, 3)));
+ data->login_count = g_value_get_int (g_value_array_get_nth (values, 4));
+ data->icon_url = g_strdup (g_value_get_string (g_value_array_get_nth (values, 5)));
priv->users = g_list_prepend (priv->users, data);
}
@@ -499,11 +492,3 @@ _users_service_server_get_users_info (UsersServiceDbus *service,
{
return TRUE;
}
-
-gchar *
-users_service_dbus_get_error (UsersServiceDbus *self)
-{
- UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
-
- return priv->error;
-}
diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h
index 370df2e..ecfaf6d 100644
--- a/src/users-service-dbus.h
+++ b/src/users-service-dbus.h
@@ -38,7 +38,7 @@ typedef struct _UserData UserData;
struct _UserData
{
- uid_t uid;
+ gint64 uid;
gchar *user_name;
gchar *real_name;
gchar *shell;
@@ -68,7 +68,6 @@ GType users_service_dbus_get_type (void) G_GNUC_CONST;
gint users_service_dbus_get_user_count (UsersServiceDbus *self);
GList *users_service_dbus_get_user_list (UsersServiceDbus *self);
-gchar *users_service_dbus_get_error (UsersServiceDbus *self);
G_END_DECLS
diff --git a/src/users-service.c b/src/users-service.c
index c7c2a53..0a98983 100644
--- a/src/users-service.c
+++ b/src/users-service.c
@@ -135,7 +135,6 @@ rebuild_items (DbusmenuMenuitem *root,
DbusmenuMenuitem *mi = NULL;
GList *u;
UserData *user;
- gchar *error;
dbusmenu_menuitem_foreach (root, remove_menu_item, NULL);
@@ -150,12 +149,6 @@ rebuild_items (DbusmenuMenuitem *root,
dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, g_strdup_printf ("START (count is %d)", count));
dbusmenu_menuitem_child_append (root, mi);
- error = users_service_dbus_get_error (service);
-
- mi = dbusmenu_menuitem_new ();
- dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, g_strdup_printf ("ERROR: %s", error));
- dbusmenu_menuitem_child_append (root, mi);
-
g_print ("count == %d\n", count);
if (count > 1 && count < 7)