コード例 #1
0
static void
setup_current_user (ShellStatusMenu *status)
{
  ShellStatusMenuPrivate *priv = status->priv;
  const char *name;

  priv->user = gdm_user_manager_get_user_by_uid (priv->manager, getuid ());
  if (priv->user != NULL)
    {
      g_object_ref (priv->user);
      name = gdm_user_get_real_name (priv->user);
    }
  else
    {
      name = _("Unknown");
    }

  update_name_text (status);

  if (priv->user != NULL)
    {
      reset_icon (status);

      priv->user_icon_changed_id =
        g_signal_connect (priv->user,
                          "icon-changed",
                          G_CALLBACK (on_user_icon_changed),
                          status);
      priv->user_notify_id =
        g_signal_connect (priv->user,
                          "notify::display-name",
                          G_CALLBACK (user_notify_display_name_cb),
                          status);
    }
}
コード例 #2
0
static void
update_name_text (ShellStatusMenu *status)
{
  ShellStatusMenuPrivate *priv = status->priv;

  clutter_text_set_text (priv->name,
                         gdm_user_get_real_name (GDM_USER (priv->user)));
}
コード例 #3
0
static void
update_name_text (ShellStatusMenu *status)
{
  ShellStatusMenuPrivate *priv = status->priv;
  char      *markup;

  markup = g_markup_printf_escaped("<b>%s</b>",
                                   gdm_user_get_real_name (GDM_USER (priv->user)));
  clutter_text_set_markup (priv->name, markup);
  g_free (markup);
}
コード例 #4
0
static void
add_user (GdmUserChooserWidget *widget,
          GdmUser              *user)
{
        GdkPixbuf    *pixbuf;
        char         *tooltip;
        gboolean      is_logged_in;
        int           size;

        if (!widget->priv->show_normal_users) {
                return;
        }

        size = get_icon_height_for_widget (widget);
        pixbuf = gdm_user_render_icon (user, size);
        if (pixbuf == NULL && widget->priv->stock_person_pixbuf != NULL) {
                pixbuf = g_object_ref (widget->priv->stock_person_pixbuf);
        }

        tooltip = g_strdup_printf (_("Log in as %s"),
                                   gdm_user_get_user_name (user));

        is_logged_in = gdm_user_get_num_sessions (user) > 0;

        g_debug ("GdmUserChooserWidget: User added name:%s logged-in:%d pixbuf:%p",
                 gdm_user_get_user_name (user),
                 is_logged_in,
                 pixbuf);

        gdm_chooser_widget_add_item (GDM_CHOOSER_WIDGET (widget),
                                     gdm_user_get_user_name (user),
                                     pixbuf,
                                     gdm_user_get_real_name (user),
                                     tooltip,
                                     gdm_user_get_login_frequency (user),
                                     is_logged_in,
                                     FALSE);
        g_free (tooltip);

        if (pixbuf != NULL) {
                g_object_unref (pixbuf);
        }
}