~unity8-desktop-session-team/indicator-session/indicator-session-using-upstart

« back to all changes in this revision

Viewing changes to src/service.c

  • Committer: Charles Kerr
  • Date: 2013-06-25 16:16:34 UTC
  • mto: This revision was merged to the branch mainline in revision 399.
  • Revision ID: charles.kerr@canonical.com-20130625161634-ht9ef3n5s63rnmmr
in IndicatorSessionUsers, use the uid as the user's key. Users.ActivateUser is now green.

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
static GMenuModel * create_switch_section (IndicatorSessionService * self);
207
207
 
208
208
static void
209
 
add_user (IndicatorSessionService * self, const gchar * key)
 
209
add_user (IndicatorSessionService * self, guint uid)
210
210
{
211
211
  IndicatorSessionUser * u;
212
212
 
213
213
  /* update our user table */
214
 
  u = indicator_session_users_get_user (self->priv->backend_users, key);
215
 
  g_hash_table_insert (self->priv->users, g_strdup(key), u);
 
214
  u = indicator_session_users_get_user (self->priv->backend_users, uid);
 
215
  g_hash_table_insert (self->priv->users, GUINT_TO_POINTER(uid), u);
216
216
 
217
217
  /* enqueue rebuilds for the affected sections */
218
218
  rebuild_switch_section_soon (self);
222
222
 
223
223
static void
224
224
on_user_added (IndicatorSessionUsers * backend_users G_GNUC_UNUSED,
225
 
               const char            * key,
 
225
               guint                   uid,
226
226
               gpointer                gself)
227
227
{
228
 
  add_user (INDICATOR_SESSION_SERVICE(gself), key);
 
228
  add_user (INDICATOR_SESSION_SERVICE(gself), uid);
229
229
}
230
230
 
231
231
static void
232
232
on_user_changed (IndicatorSessionUsers * backend_users G_GNUC_UNUSED,
233
 
                 const char            * key,
 
233
                 guint                   uid,
234
234
                 gpointer                gself)
235
235
{
236
 
  add_user (INDICATOR_SESSION_SERVICE(gself), key);
 
236
  add_user (INDICATOR_SESSION_SERVICE(gself), uid);
237
237
}
238
238
 
239
239
static void
240
240
on_user_removed (IndicatorSessionUsers * backend_users G_GNUC_UNUSED,
241
 
                 const char            * key,
 
241
                 guint                   uid,
242
242
                 gpointer                gself)
243
243
{
244
244
  IndicatorSessionService * self = INDICATOR_SESSION_SERVICE (gself);
245
245
  g_return_if_fail (self != NULL);
246
246
 
247
247
  /* update our user table */
248
 
  g_hash_table_remove (self->priv->users, key);
 
248
  g_hash_table_remove (self->priv->users, GUINT_TO_POINTER(uid));
249
249
 
250
250
  /* enqueue rebuilds for the affected sections */
251
251
  rebuild_switch_section_soon (self);
334
334
  GVariantBuilder * b;
335
335
  GVariant * val;
336
336
  GHashTableIter ht_iter;
337
 
  gpointer ht_key, ht_value;
 
337
  gpointer ht_value;
338
338
  const char * current_user;
339
339
 
340
340
  current_user = "";
341
341
  a = g_variant_builder_new (G_VARIANT_TYPE("as"));
342
342
  g_hash_table_iter_init (&ht_iter, self->priv->users);
343
 
  while (g_hash_table_iter_next (&ht_iter, &ht_key, &ht_value))
 
343
  while (g_hash_table_iter_next (&ht_iter, NULL, &ht_value))
344
344
    {
345
345
      const IndicatorSessionUser * u = ht_value;
346
346
 
950
950
/* cppcheck-suppress unusedFunction */
951
951
indicator_session_service_init (IndicatorSessionService * self)
952
952
{
953
 
  int i;
954
 
  GStrv keys;
 
953
  GList * l;
 
954
  GList * uids;
955
955
  priv_t * p;
956
956
  gpointer gp;
957
957
 
970
970
                               &p->backend_guest);
971
971
 
972
972
  /* init our key-to-User table */
973
 
  p->users = g_hash_table_new_full (g_str_hash,
974
 
                                    g_str_equal,
975
 
                                    g_free,
 
973
  p->users = g_hash_table_new_full (g_direct_hash,
 
974
                                    g_direct_equal,
 
975
                                    NULL,
976
976
                                    (GDestroyNotify)indicator_session_user_free);
977
 
  keys = indicator_session_users_get_keys (p->backend_users);
978
 
  for (i=0; keys && keys[i]; ++i)
979
 
    add_user (self, keys[i]);
980
 
  g_strfreev (keys);
 
977
  uids = indicator_session_users_get_uids (p->backend_users);
 
978
  for (l=uids; l!=NULL; l=l->next)
 
979
    add_user (self, GPOINTER_TO_UINT(l->data));
 
980
  g_list_free (uids);
981
981
 
982
982
  init_gactions (self);
983
983