static void
show_user (UmUser *user, UmUserPanelPrivate *d)
{
    GtkWidget *image;
    GtkWidget *label;
    GtkWidget *label2;
    GtkWidget *label3;
    GdkPixbuf *pixbuf;
    gchar *lang;
    GtkWidget *widget;
    GtkTreeModel *model;
    GtkTreeIter iter;
    gboolean show, enable;

    pixbuf = um_user_render_icon (user, FALSE, 48);
    image = get_widget (d, "user-icon-image");
    gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
    image = get_widget (d, "user-icon-image2");
    gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
    g_object_unref (pixbuf);

    um_photo_dialog_set_user (d->photo_dialog, user);

    widget = get_widget (d, "full-name-entry");
    cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), um_user_get_real_name (user));
    gtk_widget_set_tooltip_text (widget, um_user_get_user_name (user));

    widget = get_widget (d, "account-type-combo");
    um_editable_combo_set_active (UM_EDITABLE_COMBO (widget), um_user_get_account_type (user));

    widget = get_widget (d, "account-password-button");
    um_editable_button_set_text (UM_EDITABLE_BUTTON (widget), get_password_mode_text (user));
    enable = um_user_is_local_account (user);
    gtk_widget_set_sensitive (widget, enable);

    widget = get_widget (d, "account-language-combo");
    model = um_editable_combo_get_model (UM_EDITABLE_COMBO (widget));
    cc_add_user_languages (model);

    lang = g_strdup (um_user_get_language (user));
    if (!lang)
        lang = cc_common_language_get_current_language ();
    cc_common_language_get_iter_for_language (model, lang, &iter);
    um_editable_combo_set_active_iter (UM_EDITABLE_COMBO (widget), &iter);
    g_free (lang);

    /* Fingerprint: show when self, possible, and local account */
    widget = get_widget (d, "account-fingerprint-notebook");
    label = get_widget (d, "account-fingerprint-label");
    label2 = get_widget (d, "account-fingerprint-value-label");
    label3 = get_widget (d, "account-fingerprint-button-label");
    show = (um_user_get_uid (user) == getuid() &&
            um_user_is_local_account (user) &&
            set_fingerprint_label (label2, label3));
    gtk_widget_set_visible (label, show);
    gtk_widget_set_visible (widget, show);
}
Exemplo n.º 2
0
static void
show_user (UmUser *user, UmUserPanelPrivate *d)
{
        GtkWidget *image;
        GtkWidget *label;
        GtkWidget *label2;
        GtkWidget *label3;
        GdkPixbuf *pixbuf;
        gchar *lang;
        GtkWidget *widget;
        GtkTreeModel *model;
        GtkTreeIter iter;

        pixbuf = um_user_render_icon (user, FALSE, 48);
        image = get_widget (d, "user-icon-image");
        gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
        image = get_widget (d, "user-icon-image2");
        gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
        g_object_unref (pixbuf);

        um_photo_dialog_set_user (d->photo_dialog, user);

        widget = get_widget (d, "full-name-entry");
        cc_editable_entry_set_text (CC_EDITABLE_ENTRY (widget), um_user_get_real_name (user));
        gtk_widget_set_tooltip_text (widget, um_user_get_user_name (user));

        widget = get_widget (d, "account-type-combo");
        um_editable_combo_set_active (UM_EDITABLE_COMBO (widget), um_user_get_account_type (user));

        widget = get_widget (d, "account-password-button");
        um_editable_button_set_text (UM_EDITABLE_BUTTON (widget), get_password_mode_text (user));

        widget = get_widget (d, "autologin-switch");
        g_signal_handlers_block_by_func (widget, autologin_changed, d);
        gtk_switch_set_active (GTK_SWITCH (widget), um_user_get_automatic_login (user));
        g_signal_handlers_unblock_by_func (widget, autologin_changed, d);

        gtk_widget_set_sensitive (widget, !um_user_get_locked (user));

        widget = get_widget (d, "account-language-combo");
        model = um_editable_combo_get_model (UM_EDITABLE_COMBO (widget));
        cc_add_user_languages (model);

        lang = g_strdup (um_user_get_language (user));
        if (!lang)
                lang = cc_common_language_get_current_language ();
        cc_common_language_get_iter_for_language (model, lang, &iter);
        um_editable_combo_set_active_iter (UM_EDITABLE_COMBO (widget), &iter);
        g_free (lang);

        widget = get_widget (d, "account-fingerprint-notebook");
        label = get_widget (d, "account-fingerprint-label");
        label2 = get_widget (d, "account-fingerprint-value-label");
        label3 = get_widget (d, "account-fingerprint-button-label");
        if (um_user_get_uid (user) != getuid() ||
            !set_fingerprint_label (label2, label3)) {
                gtk_widget_hide (label);
                gtk_widget_hide (widget);
        } else {
                gtk_widget_show (label);
                gtk_widget_show (widget);
        }
}