2010-10-30 16:14:30 -04:00
|
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2009-2010 Red Hat, Inc,
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2012-09-06 07:43:05 -04:00
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
2010-10-30 16:14:30 -04:00
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-23 12:57:27 +01:00
|
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2010-10-30 16:14:30 -04:00
|
|
|
|
*
|
|
|
|
|
* Written by: Matthias Clasen <mclasen@redhat.com>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
#include "cc-user-panel.h"
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/types.h>
|
2013-07-31 13:53:18 +02:00
|
|
|
|
#include <locale.h>
|
2019-02-20 23:42:38 -06:00
|
|
|
|
#include <errno.h>
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <glib/gi18n.h>
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
#include <polkit/polkit.h>
|
2012-12-04 12:48:57 -05:00
|
|
|
|
#include <act/act.h>
|
2015-01-13 16:31:10 +01:00
|
|
|
|
#include <cairo-gobject.h>
|
2013-07-31 13:53:18 +02:00
|
|
|
|
|
|
|
|
|
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
|
|
|
|
#include <libgnome-desktop/gnome-languages.h>
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-03-26 14:20:44 +05:30
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
#include <libmalcontent/malcontent.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-11-07 11:56:00 +13:00
|
|
|
|
#include "cc-add-user-dialog.h"
|
2018-11-07 16:36:24 +13:00
|
|
|
|
#include "cc-avatar-chooser.h"
|
2018-11-07 16:28:36 +13:00
|
|
|
|
#include "cc-carousel.h"
|
2011-08-20 02:17:06 -04:00
|
|
|
|
#include "cc-language-chooser.h"
|
2018-11-07 09:38:10 +13:00
|
|
|
|
#include "cc-login-history-dialog.h"
|
2018-11-07 09:28:46 +13:00
|
|
|
|
#include "cc-password-dialog.h"
|
2018-11-08 10:56:19 +13:00
|
|
|
|
#include "cc-realm-manager.h"
|
2018-11-07 11:56:00 +13:00
|
|
|
|
#include "cc-user-accounts-resources.h"
|
2018-11-07 16:24:37 +13:00
|
|
|
|
#include "cc-user-image.h"
|
2020-04-10 16:40:27 +02:00
|
|
|
|
#include "cc-fingerprint-manager.h"
|
|
|
|
|
#include "cc-fingerprint-dialog.h"
|
2018-11-08 11:00:37 +13:00
|
|
|
|
#include "user-utils.h"
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2011-01-24 18:15:03 +00:00
|
|
|
|
#include "cc-common-language.h"
|
2019-12-19 15:51:38 +01:00
|
|
|
|
#include "cc-permission-infobar.h"
|
2016-02-12 23:06:59 +00:00
|
|
|
|
#include "cc-util.h"
|
2020-01-13 15:35:09 +01:00
|
|
|
|
#include "list-box-helper.h"
|
2011-01-24 18:15:03 +00:00
|
|
|
|
|
2012-08-18 18:32:34 +01:00
|
|
|
|
#define USER_ACCOUNTS_PERMISSION "org.gnome.controlcenter.user-accounts.administration"
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
struct _CcUserPanel {
|
|
|
|
|
CcPanel parent_instance;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUserManager *um;
|
2015-02-23 11:47:13 +01:00
|
|
|
|
GSettings *login_screen_settings;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GtkBox *accounts_box;
|
2020-01-13 15:35:09 +01:00
|
|
|
|
GtkBox *account_settings_box;
|
|
|
|
|
GtkListBox *account_settings_listbox;
|
|
|
|
|
GtkListBox *authentication_and_login_listbox;
|
|
|
|
|
GtkListBoxRow *account_type_row;
|
|
|
|
|
GtkSwitch *account_type_switch;
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GtkButton *add_user_button;
|
2020-01-13 15:35:09 +01:00
|
|
|
|
GtkListBoxRow *autologin_row;
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GtkSwitch *autologin_switch;
|
2018-11-07 16:28:36 +13:00
|
|
|
|
CcCarousel *carousel;
|
2020-01-13 15:35:09 +01:00
|
|
|
|
GtkLabel *fingerprint_state_label;
|
|
|
|
|
GtkListBoxRow *fingerprint_row;
|
2020-01-13 12:34:22 +01:00
|
|
|
|
GtkStack *full_name_stack;
|
|
|
|
|
GtkLabel *full_name_label;
|
|
|
|
|
GtkToggleButton *full_name_edit_button;
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GtkEntry *full_name_entry;
|
|
|
|
|
GtkLabel *language_button_label;
|
2020-01-13 15:35:09 +01:00
|
|
|
|
GtkListBoxRow *language_row;
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GtkLabel *last_login_button_label;
|
2020-01-13 15:35:09 +01:00
|
|
|
|
GtkListBoxRow *last_login_row;
|
2019-11-20 15:14:31 +13:00
|
|
|
|
GtkBox *no_users_box;
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GtkRevealer *notification_revealer;
|
|
|
|
|
GtkLabel *password_button_label;
|
2020-03-26 14:20:44 +05:30
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
GtkLabel *parental_controls_button_label;
|
|
|
|
|
GtkImage *parental_control_go_next;
|
|
|
|
|
GtkListBoxRow *parental_controls_row;
|
|
|
|
|
#endif
|
2020-01-13 15:35:09 +01:00
|
|
|
|
GtkListBoxRow *password_row;
|
2019-12-19 15:51:38 +01:00
|
|
|
|
CcPermissionInfobar *permission_infobar;
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GtkButton *remove_user_button;
|
|
|
|
|
GtkStack *stack;
|
|
|
|
|
GtkToggleButton *user_icon_button;
|
2018-11-07 16:24:37 +13:00
|
|
|
|
CcUserImage *user_icon_image;
|
|
|
|
|
CcUserImage *user_icon_image2;
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GtkStack *user_icon_stack;
|
2019-11-20 15:14:31 +13:00
|
|
|
|
GtkOverlay *users_overlay;
|
2018-10-16 11:23:40 +13:00
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
ActUser *selected_user;
|
2010-11-15 14:02:27 -05:00
|
|
|
|
GPermission *permission;
|
2018-06-29 16:50:43 +12:00
|
|
|
|
CcLanguageChooser *language_chooser;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-11-07 16:36:24 +13:00
|
|
|
|
CcAvatarChooser *avatar_chooser;
|
2013-03-21 15:15:16 +01:00
|
|
|
|
|
2020-04-06 22:48:02 +02:00
|
|
|
|
CcFingerprintManager *fingerprint_manager;
|
2020-03-26 06:44:55 +01:00
|
|
|
|
|
2013-03-21 15:15:16 +01:00
|
|
|
|
gint other_accounts;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
};
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
CC_PANEL_REGISTER (CcUserPanel, cc_user_panel)
|
|
|
|
|
|
|
|
|
|
static void show_restart_notification (CcUserPanel *self, const gchar *locale);
|
2017-02-13 09:16:59 +01:00
|
|
|
|
static gint user_compare (gconstpointer i, gconstpointer u);
|
2014-09-17 14:35:46 +02:00
|
|
|
|
|
2014-09-30 11:08:08 +02:00
|
|
|
|
typedef struct {
|
|
|
|
|
CcUserPanel *self;
|
|
|
|
|
GCancellable *cancellable;
|
|
|
|
|
gchar *login;
|
|
|
|
|
} AsyncDeleteData;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
async_delete_data_free (AsyncDeleteData *data)
|
|
|
|
|
{
|
|
|
|
|
g_object_unref (data->self);
|
|
|
|
|
g_object_unref (data->cancellable);
|
|
|
|
|
g_free (data->login);
|
|
|
|
|
g_slice_free (AsyncDeleteData, data);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-30 08:54:16 +02:00
|
|
|
|
static void
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show_error_dialog (CcUserPanel *self,
|
2014-09-30 08:54:16 +02:00
|
|
|
|
const gchar *message,
|
|
|
|
|
GError *error)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
|
2014-09-30 08:54:16 +02:00
|
|
|
|
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_USE_HEADER_BAR,
|
|
|
|
|
GTK_MESSAGE_ERROR,
|
|
|
|
|
GTK_BUTTONS_CLOSE,
|
|
|
|
|
"%s", message);
|
|
|
|
|
|
|
|
|
|
if (error != NULL) {
|
|
|
|
|
g_dbus_error_strip_remote_error (error);
|
|
|
|
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
|
|
|
|
"%s", error->message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 12:48:57 -05:00
|
|
|
|
static ActUser *
|
2018-05-31 10:42:09 +12:00
|
|
|
|
get_selected_user (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2018-05-31 10:42:09 +12:00
|
|
|
|
return self->selected_user;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-05 16:54:17 -05:00
|
|
|
|
static const gchar *
|
|
|
|
|
get_real_or_user_name (ActUser *user)
|
|
|
|
|
{
|
|
|
|
|
const gchar *name;
|
|
|
|
|
|
|
|
|
|
name = act_user_get_real_name (user);
|
|
|
|
|
if (name == NULL)
|
|
|
|
|
name = act_user_get_user_name (user);
|
|
|
|
|
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
static void show_user (ActUser *user, CcUserPanel *self);
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2018-11-07 16:28:36 +13:00
|
|
|
|
set_selected_user (CcUserPanel *self, CcCarouselItem *item)
|
2011-05-11 17:25:03 +01:00
|
|
|
|
{
|
2016-11-15 14:40:54 +01:00
|
|
|
|
uid_t uid;
|
|
|
|
|
|
|
|
|
|
uid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "uid"));
|
2020-03-26 06:41:33 +01:00
|
|
|
|
g_set_object (&self->selected_user,
|
|
|
|
|
act_user_manager_get_user_by_id (self->um, uid));
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
if (self->selected_user != NULL) {
|
|
|
|
|
show_user (self->selected_user, self);
|
2016-11-15 14:40:54 +01:00
|
|
|
|
}
|
2011-05-11 17:25:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
static GtkWidget *
|
2018-05-31 10:42:09 +12:00
|
|
|
|
create_carousel_entry (CcUserPanel *self, ActUser *user)
|
2016-11-15 14:40:54 +01:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *box, *widget;
|
2016-12-18 14:33:32 +01:00
|
|
|
|
gchar *label;
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
2016-12-18 14:39:04 +01:00
|
|
|
|
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
2018-11-07 16:24:37 +13:00
|
|
|
|
widget = cc_user_image_new ();
|
|
|
|
|
cc_user_image_set_user (CC_USER_IMAGE (widget), user);
|
2016-11-15 14:40:54 +01:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
|
|
|
|
|
|
2019-08-29 12:03:44 +08:00
|
|
|
|
label = g_markup_printf_escaped ("<b>%s</b>",
|
|
|
|
|
get_real_or_user_name (user));
|
2016-12-18 14:33:32 +01:00
|
|
|
|
widget = gtk_label_new (label);
|
|
|
|
|
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
|
2019-02-07 16:07:52 -02:00
|
|
|
|
gtk_label_set_ellipsize (GTK_LABEL (widget), PANGO_ELLIPSIZE_END);
|
2016-12-18 14:39:04 +01:00
|
|
|
|
gtk_widget_set_margin_top (widget, 5);
|
2016-11-15 14:40:54 +01:00
|
|
|
|
gtk_box_pack_start (GTK_BOX (box), widget, FALSE, TRUE, 0);
|
2016-12-18 14:33:32 +01:00
|
|
|
|
g_free (label);
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
2016-12-18 14:39:04 +01:00
|
|
|
|
if (act_user_get_uid (user) == getuid ())
|
2017-02-24 17:12:10 +01:00
|
|
|
|
label = g_strdup_printf ("<small>%s</small>", _("Your account"));
|
2016-12-18 14:39:04 +01:00
|
|
|
|
else
|
|
|
|
|
label = g_strdup (" ");
|
|
|
|
|
|
|
|
|
|
widget = gtk_label_new (label);
|
|
|
|
|
gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
|
|
|
|
|
g_free (label);
|
|
|
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (box), widget, FALSE, TRUE, 0);
|
|
|
|
|
gtk_style_context_add_class (gtk_widget_get_style_context (widget),
|
|
|
|
|
"dim-label");
|
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
return box;
|
|
|
|
|
}
|
2016-07-21 16:10:35 +02:00
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
static void
|
2018-10-16 11:47:51 +13:00
|
|
|
|
user_added (CcUserPanel *self, ActUser *user)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2016-11-15 14:40:54 +01:00
|
|
|
|
GtkWidget *item, *widget;
|
|
|
|
|
gboolean show_carousel;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2013-06-25 16:07:51 +02:00
|
|
|
|
if (act_user_is_system_account (user)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-05 16:54:17 -05:00
|
|
|
|
g_debug ("user added: %d %s\n", act_user_get_uid (user), get_real_or_user_name (user));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
widget = create_carousel_entry (self, user);
|
2018-11-07 16:28:36 +13:00
|
|
|
|
item = cc_carousel_item_new ();
|
2016-11-15 14:40:54 +01:00
|
|
|
|
gtk_container_add (GTK_CONTAINER (item), widget);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
g_object_set_data (G_OBJECT (item), "uid", GINT_TO_POINTER (act_user_get_uid (user)));
|
2018-05-31 10:42:09 +12:00
|
|
|
|
gtk_container_add (GTK_CONTAINER (self->carousel), item);
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
|
|
|
|
if (act_user_get_uid (user) != getuid ()) {
|
2018-05-31 10:42:09 +12:00
|
|
|
|
self->other_accounts++;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
/* Show heading for other accounts if new one have been added. */
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show_carousel = (self->other_accounts > 0);
|
|
|
|
|
gtk_revealer_set_reveal_child (GTK_REVEALER (self->carousel), show_carousel);
|
2017-12-05 16:22:29 +01:00
|
|
|
|
|
2019-11-20 15:14:31 +13:00
|
|
|
|
gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->users_overlay));
|
2016-11-15 14:40:54 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
sort_users (gconstpointer a, gconstpointer b)
|
|
|
|
|
{
|
|
|
|
|
ActUser *ua, *ub;
|
|
|
|
|
gchar *name1, *name2;
|
|
|
|
|
gint result;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
ua = ACT_USER (a);
|
|
|
|
|
ub = ACT_USER (b);
|
|
|
|
|
|
|
|
|
|
/* Make sure the current user is shown first */
|
|
|
|
|
if (act_user_get_uid (ua) == getuid ()) {
|
|
|
|
|
result = -G_MAXINT32;
|
|
|
|
|
}
|
|
|
|
|
else if (act_user_get_uid (ub) == getuid ()) {
|
|
|
|
|
result = G_MAXINT32;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
2016-11-15 14:40:54 +01:00
|
|
|
|
else {
|
|
|
|
|
name1 = g_utf8_collate_key (get_real_or_user_name (ua), -1);
|
|
|
|
|
name2 = g_utf8_collate_key (get_real_or_user_name (ub), -1);
|
2013-03-21 15:15:16 +01:00
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
result = strcmp (name1, name2);
|
|
|
|
|
|
|
|
|
|
g_free (name1);
|
|
|
|
|
g_free (name2);
|
2013-03-21 15:15:16 +01:00
|
|
|
|
}
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
|
|
|
|
return result;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-05-31 10:42:09 +12:00
|
|
|
|
reload_users (CcUserPanel *self, ActUser *selected_user)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2016-11-15 14:40:54 +01:00
|
|
|
|
GSList *list, *l;
|
2018-11-07 16:28:36 +13:00
|
|
|
|
CcCarouselItem *item = NULL;
|
2017-02-13 09:16:59 +01:00
|
|
|
|
GtkSettings *settings;
|
|
|
|
|
gboolean animations;
|
2020-03-26 14:20:44 +05:30
|
|
|
|
guint users_count;
|
2017-02-13 09:16:59 +01:00
|
|
|
|
|
2019-01-17 16:38:06 +00:00
|
|
|
|
settings = gtk_widget_get_settings (GTK_WIDGET (self->carousel));
|
2017-02-13 09:16:59 +01:00
|
|
|
|
|
|
|
|
|
g_object_get (settings, "gtk-enable-animations", &animations, NULL);
|
|
|
|
|
g_object_set (settings, "gtk-enable-animations", FALSE, NULL);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-11-07 16:28:36 +13:00
|
|
|
|
cc_carousel_purge_items (self->carousel);
|
2018-05-31 10:42:09 +12:00
|
|
|
|
self->other_accounts = 0;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
list = act_user_manager_list_users (self->um);
|
2020-03-26 14:20:44 +05:30
|
|
|
|
users_count = g_slist_length (list);
|
|
|
|
|
g_debug ("Got %d users\n", users_count);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
list = g_slist_sort (list, (GCompareFunc) sort_users);
|
|
|
|
|
for (l = list; l; l = l->next) {
|
|
|
|
|
user = l->data;
|
|
|
|
|
g_debug ("adding user %s\n", get_real_or_user_name (user));
|
2018-10-16 11:47:51 +13:00
|
|
|
|
user_added (self, user);
|
2016-11-15 14:40:54 +01:00
|
|
|
|
}
|
|
|
|
|
g_slist_free (list);
|
2017-02-13 09:16:59 +01:00
|
|
|
|
|
2018-11-07 16:28:36 +13:00
|
|
|
|
if (cc_carousel_get_item_count (self->carousel) == 0)
|
2019-11-20 15:14:31 +13:00
|
|
|
|
gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->no_users_box));
|
2018-05-31 10:42:09 +12:00
|
|
|
|
if (self->other_accounts == 0)
|
|
|
|
|
gtk_revealer_set_reveal_child (GTK_REVEALER (self->carousel), FALSE);
|
2017-12-05 16:22:29 +01:00
|
|
|
|
|
|
|
|
|
if (selected_user)
|
2018-11-07 16:28:36 +13:00
|
|
|
|
item = cc_carousel_find_item (self->carousel, selected_user, user_compare);
|
|
|
|
|
cc_carousel_select_item (self->carousel, item);
|
2017-02-13 09:16:59 +01:00
|
|
|
|
|
|
|
|
|
g_object_set (settings, "gtk-enable-animations", animations, NULL);
|
2020-03-26 14:20:44 +05:30
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
/* Parental Controls row not to be shown for single user setups. */
|
|
|
|
|
gtk_widget_set_visible (GTK_WIDGET (self->parental_controls_row), users_count > 1);
|
|
|
|
|
#endif
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
static gint
|
|
|
|
|
user_compare (gconstpointer i,
|
|
|
|
|
gconstpointer u)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2018-11-07 16:28:36 +13:00
|
|
|
|
CcCarouselItem *item;
|
2016-11-15 14:40:54 +01:00
|
|
|
|
ActUser *user;
|
|
|
|
|
gint uid_a, uid_b;
|
|
|
|
|
gint result;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-11-07 16:28:36 +13:00
|
|
|
|
item = (CcCarouselItem *) i;
|
2016-11-15 14:40:54 +01:00
|
|
|
|
user = ACT_USER (u);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
uid_a = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "uid"));
|
|
|
|
|
uid_b = act_user_get_uid (user);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
result = uid_a - uid_b;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
return result;
|
|
|
|
|
}
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2016-11-15 14:40:54 +01:00
|
|
|
|
static void
|
2018-10-16 11:47:51 +13:00
|
|
|
|
user_changed (CcUserPanel *self, ActUser *user)
|
2016-11-15 14:40:54 +01:00
|
|
|
|
{
|
2018-05-31 10:42:09 +12:00
|
|
|
|
reload_users (self, self->selected_user);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-11-07 16:05:32 +13:00
|
|
|
|
add_user (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2018-11-07 11:56:00 +13:00
|
|
|
|
CcAddUserDialog *dialog;
|
2019-02-04 15:46:16 +00:00
|
|
|
|
g_autoptr(GdkPixbuf) pixbuf = NULL;
|
2018-11-07 16:05:32 +13:00
|
|
|
|
GtkWindow *toplevel;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2012-06-06 22:51:19 +02:00
|
|
|
|
|
2018-11-07 16:05:32 +13:00
|
|
|
|
dialog = cc_add_user_dialog_new (self->permission);
|
|
|
|
|
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), toplevel);
|
2012-08-14 17:04:41 +02:00
|
|
|
|
|
2018-11-07 16:05:32 +13:00
|
|
|
|
gtk_dialog_run (GTK_DIALOG (dialog));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-11-07 16:05:32 +13:00
|
|
|
|
user = cc_add_user_dialog_get_user (dialog);
|
2019-02-08 09:45:35 +01:00
|
|
|
|
if (user != NULL) {
|
2019-05-03 09:00:56 +02:00
|
|
|
|
set_default_avatar (user);
|
2018-11-07 16:05:32 +13:00
|
|
|
|
reload_users (self, user);
|
2019-02-08 09:45:35 +01:00
|
|
|
|
}
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-11-07 16:05:32 +13:00
|
|
|
|
gtk_widget_destroy (GTK_WIDGET (dialog));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-05-31 10:42:09 +12:00
|
|
|
|
delete_user_done (ActUserManager *manager,
|
|
|
|
|
GAsyncResult *res,
|
|
|
|
|
CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
|
|
|
|
GError *error;
|
|
|
|
|
|
|
|
|
|
error = NULL;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
if (!act_user_manager_delete_user_finish (manager, res, &error)) {
|
2014-09-30 08:54:16 +02:00
|
|
|
|
if (!g_error_matches (error, ACT_USER_MANAGER_ERROR,
|
|
|
|
|
ACT_USER_MANAGER_ERROR_PERMISSION_DENIED))
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show_error_dialog (self, _("Failed to delete user"), error);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-11-22 13:10:38 +13:00
|
|
|
|
delete_user_response (CcUserPanel *self,
|
2018-05-31 10:42:09 +12:00
|
|
|
|
gint response_id,
|
2019-11-22 13:10:38 +13:00
|
|
|
|
GtkWidget *dialog)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
gboolean remove_files;
|
|
|
|
|
|
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
|
|
|
|
|
|
if (response_id == GTK_RESPONSE_CANCEL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (response_id == GTK_RESPONSE_NO) {
|
|
|
|
|
remove_files = TRUE;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
remove_files = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2013-04-24 09:23:10 +02:00
|
|
|
|
/* remove autologin */
|
|
|
|
|
if (act_user_get_automatic_login (user)) {
|
|
|
|
|
act_user_set_automatic_login (user, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
act_user_manager_delete_user_async (self->um,
|
2012-12-04 12:48:57 -05:00
|
|
|
|
user,
|
|
|
|
|
remove_files,
|
|
|
|
|
NULL,
|
|
|
|
|
(GAsyncReadyCallback)delete_user_done,
|
2018-05-31 10:42:09 +12:00
|
|
|
|
self);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-09-30 11:08:08 +02:00
|
|
|
|
enterprise_user_revoked (GObject *source,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
AsyncDeleteData *data = user_data;
|
2018-05-31 10:42:09 +12:00
|
|
|
|
CcUserPanel *self = data->self;
|
2018-11-08 10:56:19 +13:00
|
|
|
|
CcRealmCommon *common = CC_REALM_COMMON (source);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
if (g_cancellable_is_cancelled (data->cancellable)) {
|
|
|
|
|
async_delete_data_free (data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-08 10:56:19 +13:00
|
|
|
|
cc_realm_common_call_change_login_policy_finish (common, result, &error);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
if (error != NULL) {
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show_error_dialog (self, _("Failed to revoke remotely managed user"), error);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
g_error_free (error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async_delete_data_free (data);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-08 10:56:19 +13:00
|
|
|
|
static CcRealmCommon *
|
|
|
|
|
find_matching_realm (CcRealmManager *realm_manager, const gchar *login)
|
2014-09-30 11:08:08 +02:00
|
|
|
|
{
|
2018-11-08 10:56:19 +13:00
|
|
|
|
CcRealmCommon *common = NULL;
|
2014-09-30 11:08:08 +02:00
|
|
|
|
GList *realms, *l;
|
|
|
|
|
|
2018-11-08 10:56:19 +13:00
|
|
|
|
realms = cc_realm_manager_get_realms (realm_manager);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
for (l = realms; l != NULL; l = g_list_next (l)) {
|
|
|
|
|
const gchar * const *permitted_logins;
|
|
|
|
|
gint i;
|
|
|
|
|
|
2018-11-08 10:56:19 +13:00
|
|
|
|
common = cc_realm_object_get_common (l->data);
|
2015-02-25 14:31:28 +01:00
|
|
|
|
if (common == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
|
2018-11-08 10:56:19 +13:00
|
|
|
|
permitted_logins = cc_realm_common_get_permitted_logins (common);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
for (i = 0; permitted_logins[i] != NULL; i++) {
|
|
|
|
|
if (g_strcmp0 (permitted_logins[i], login) == 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (permitted_logins[i] != NULL)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
g_clear_object (&common);
|
|
|
|
|
}
|
|
|
|
|
g_list_free_full (realms, g_object_unref);
|
|
|
|
|
|
|
|
|
|
return common;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
realm_manager_found (GObject *source,
|
|
|
|
|
GAsyncResult *result,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
AsyncDeleteData *data = user_data;
|
2018-05-31 10:42:09 +12:00
|
|
|
|
CcUserPanel *self = data->self;
|
2018-11-08 10:56:19 +13:00
|
|
|
|
CcRealmCommon *common;
|
|
|
|
|
CcRealmManager *realm_manager;
|
2014-09-30 11:08:08 +02:00
|
|
|
|
const gchar *add[1];
|
|
|
|
|
const gchar *remove[2];
|
|
|
|
|
GVariant *options;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
if (g_cancellable_is_cancelled (data->cancellable)) {
|
|
|
|
|
async_delete_data_free (data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-08 10:56:19 +13:00
|
|
|
|
realm_manager = cc_realm_manager_new_finish (result, &error);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
if (error != NULL) {
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show_error_dialog (self, _("Failed to revoke remotely managed user"), error);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
g_error_free (error);
|
|
|
|
|
async_delete_data_free (data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Find matching realm */
|
|
|
|
|
common = find_matching_realm (realm_manager, data->login);
|
|
|
|
|
if (common == NULL) {
|
|
|
|
|
/* The realm was probably left */
|
|
|
|
|
async_delete_data_free (data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Remove the user from permitted logins */
|
|
|
|
|
g_debug ("Denying future login for: %s", data->login);
|
|
|
|
|
|
|
|
|
|
add[0] = NULL;
|
|
|
|
|
remove[0] = data->login;
|
|
|
|
|
remove[1] = NULL;
|
|
|
|
|
|
|
|
|
|
options = g_variant_new_array (G_VARIANT_TYPE ("{sv}"), NULL, 0);
|
2018-11-08 10:56:19 +13:00
|
|
|
|
cc_realm_common_call_change_login_policy (common, "",
|
2014-09-30 11:08:08 +02:00
|
|
|
|
add, remove, options,
|
|
|
|
|
data->cancellable,
|
|
|
|
|
enterprise_user_revoked,
|
|
|
|
|
data);
|
|
|
|
|
|
|
|
|
|
g_object_unref (common);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
enterprise_user_uncached (GObject *source,
|
|
|
|
|
GAsyncResult *res,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
AsyncDeleteData *data = user_data;
|
2018-05-31 10:42:09 +12:00
|
|
|
|
CcUserPanel *self = data->self;
|
2014-09-30 11:08:08 +02:00
|
|
|
|
ActUserManager *manager = ACT_USER_MANAGER (source);
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
if (g_cancellable_is_cancelled (data->cancellable)) {
|
|
|
|
|
async_delete_data_free (data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
act_user_manager_uncache_user_finish (manager, res, &error);
|
|
|
|
|
if (error == NULL) {
|
|
|
|
|
/* Find realm manager */
|
2020-01-31 10:30:10 +13:00
|
|
|
|
cc_realm_manager_new (cc_panel_get_cancellable (CC_PANEL (self)), realm_manager_found, data);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
}
|
|
|
|
|
else {
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show_error_dialog (self, _("Failed to revoke remotely managed user"), error);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
g_error_free (error);
|
|
|
|
|
async_delete_data_free (data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-11-22 13:10:38 +13:00
|
|
|
|
delete_enterprise_user_response (CcUserPanel *self,
|
|
|
|
|
gint response_id,
|
|
|
|
|
GtkWidget *dialog)
|
2014-09-30 11:08:08 +02:00
|
|
|
|
{
|
|
|
|
|
AsyncDeleteData *data;
|
|
|
|
|
ActUser *user;
|
|
|
|
|
|
|
|
|
|
gtk_widget_destroy (dialog);
|
|
|
|
|
|
|
|
|
|
if (response_id != GTK_RESPONSE_ACCEPT) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
|
|
|
|
|
data = g_slice_new (AsyncDeleteData);
|
|
|
|
|
data->self = g_object_ref (self);
|
2020-01-31 10:30:10 +13:00
|
|
|
|
data->cancellable = g_object_ref (cc_panel_get_cancellable (CC_PANEL (self)));
|
2014-09-30 11:08:08 +02:00
|
|
|
|
data->login = g_strdup (act_user_get_user_name (user));
|
|
|
|
|
|
|
|
|
|
/* Uncache the user account from the accountsservice */
|
|
|
|
|
g_debug ("Uncaching remote user: %s", data->login);
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
act_user_manager_uncache_user_async (self->um, data->login,
|
2014-09-30 11:08:08 +02:00
|
|
|
|
data->cancellable,
|
|
|
|
|
enterprise_user_uncached,
|
|
|
|
|
data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
delete_user (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
if (user == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-12-04 12:48:57 -05:00
|
|
|
|
else if (act_user_get_uid (user) == getuid ()) {
|
2018-10-16 11:23:40 +13:00
|
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
|
2010-10-30 16:14:30 -04:00
|
|
|
|
0,
|
|
|
|
|
GTK_MESSAGE_INFO,
|
|
|
|
|
GTK_BUTTONS_CLOSE,
|
|
|
|
|
_("You cannot delete your own account."));
|
|
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
|
G_CALLBACK (gtk_widget_destroy), NULL);
|
|
|
|
|
}
|
2014-01-10 12:52:37 -05:00
|
|
|
|
else if (act_user_is_logged_in_anywhere (user)) {
|
2018-10-16 11:23:40 +13:00
|
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
|
2010-10-30 16:14:30 -04:00
|
|
|
|
0,
|
|
|
|
|
GTK_MESSAGE_INFO,
|
|
|
|
|
GTK_BUTTONS_CLOSE,
|
|
|
|
|
_("%s is still logged in"),
|
2013-01-05 16:54:17 -05:00
|
|
|
|
get_real_or_user_name (user));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
|
|
|
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
|
|
|
|
_("Deleting a user while they are logged in can leave the system in an inconsistent state."));
|
|
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
|
G_CALLBACK (gtk_widget_destroy), NULL);
|
|
|
|
|
}
|
2014-09-30 11:08:08 +02:00
|
|
|
|
else if (act_user_is_local_account (user)) {
|
2018-10-16 11:23:40 +13:00
|
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
|
2010-10-30 16:14:30 -04:00
|
|
|
|
0,
|
|
|
|
|
GTK_MESSAGE_QUESTION,
|
|
|
|
|
GTK_BUTTONS_NONE,
|
2016-10-03 14:48:16 +02:00
|
|
|
|
_("Do you want to keep %s’s files?"),
|
2013-01-05 16:54:17 -05:00
|
|
|
|
get_real_or_user_name (user));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
|
|
|
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
|
|
|
|
_("It is possible to keep the home directory, mail spool and temporary files around when deleting a user account."));
|
|
|
|
|
|
|
|
|
|
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
|
|
|
|
_("_Delete Files"), GTK_RESPONSE_NO,
|
|
|
|
|
_("_Keep Files"), GTK_RESPONSE_YES,
|
|
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
gtk_window_set_icon_name (GTK_WINDOW (dialog), "system-users");
|
|
|
|
|
|
2019-11-22 13:10:38 +13:00
|
|
|
|
g_signal_connect_object (dialog, "response",
|
|
|
|
|
G_CALLBACK (delete_user_response), self, G_CONNECT_SWAPPED);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
2014-09-30 11:08:08 +02:00
|
|
|
|
else {
|
2018-10-16 11:23:40 +13:00
|
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
|
2014-09-30 11:08:08 +02:00
|
|
|
|
0,
|
|
|
|
|
GTK_MESSAGE_QUESTION,
|
|
|
|
|
GTK_BUTTONS_NONE,
|
2016-10-03 14:48:16 +02:00
|
|
|
|
_("Are you sure you want to revoke remotely managed %s’s account?"),
|
2014-09-30 11:08:08 +02:00
|
|
|
|
get_real_or_user_name (user));
|
|
|
|
|
|
|
|
|
|
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
|
|
|
|
_("_Delete"), GTK_RESPONSE_ACCEPT,
|
|
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
gtk_window_set_icon_name (GTK_WINDOW (dialog), "system-users");
|
|
|
|
|
|
2019-11-22 13:10:38 +13:00
|
|
|
|
g_signal_connect_object (dialog, "response",
|
|
|
|
|
G_CALLBACK (delete_enterprise_user_response), self, G_CONNECT_SWAPPED);
|
2014-09-30 11:08:08 +02:00
|
|
|
|
}
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
|
|
|
|
g_signal_connect (dialog, "close",
|
|
|
|
|
G_CALLBACK (gtk_widget_destroy), NULL);
|
|
|
|
|
|
|
|
|
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
|
|
|
|
|
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-23 21:46:37 -05:00
|
|
|
|
static const gchar *
|
|
|
|
|
get_invisible_text (void)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *entry;
|
|
|
|
|
gunichar invisible_char;
|
|
|
|
|
static gchar invisible_text[40];
|
|
|
|
|
gchar *p;
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
entry = gtk_entry_new ();
|
|
|
|
|
invisible_char = gtk_entry_get_invisible_char (GTK_ENTRY (entry));
|
|
|
|
|
if (invisible_char == 0)
|
|
|
|
|
invisible_char = 0x2022;
|
|
|
|
|
|
|
|
|
|
g_object_ref_sink (entry);
|
|
|
|
|
g_object_unref (entry);
|
|
|
|
|
|
|
|
|
|
/* five bullets */
|
|
|
|
|
p = invisible_text;
|
|
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
|
p += g_unichar_to_utf8 (invisible_char, p);
|
|
|
|
|
*p = 0;
|
|
|
|
|
|
|
|
|
|
return invisible_text;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
static const gchar *
|
2012-12-04 12:48:57 -05:00
|
|
|
|
get_password_mode_text (ActUser *user)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
|
|
|
|
const gchar *text;
|
|
|
|
|
|
2012-12-04 12:48:57 -05:00
|
|
|
|
if (act_user_get_locked (user)) {
|
2010-10-30 16:14:30 -04:00
|
|
|
|
text = C_("Password mode", "Account disabled");
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-12-04 12:48:57 -05:00
|
|
|
|
switch (act_user_get_password_mode (user)) {
|
|
|
|
|
case ACT_USER_PASSWORD_MODE_REGULAR:
|
2011-02-23 21:46:37 -05:00
|
|
|
|
text = get_invisible_text ();
|
2010-10-30 16:14:30 -04:00
|
|
|
|
break;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
case ACT_USER_PASSWORD_MODE_SET_AT_LOGIN:
|
2010-10-30 16:14:30 -04:00
|
|
|
|
text = C_("Password mode", "To be set at next login");
|
|
|
|
|
break;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
case ACT_USER_PASSWORD_MODE_NONE:
|
2010-10-30 16:14:30 -04:00
|
|
|
|
text = C_("Password mode", "None");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-24 20:23:01 -05:00
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
autologin_changed (CcUserPanel *self)
|
2011-01-24 20:23:01 -05:00
|
|
|
|
{
|
|
|
|
|
gboolean active;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2011-01-24 20:23:01 -05:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
active = gtk_switch_get_active (self->autologin_switch);
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2011-01-24 20:23:01 -05:00
|
|
|
|
|
2012-12-04 12:48:57 -05:00
|
|
|
|
if (active != act_user_get_automatic_login (user)) {
|
|
|
|
|
act_user_set_automatic_login (user, active);
|
|
|
|
|
if (act_user_get_automatic_login (user)) {
|
2011-01-24 20:23:01 -05:00
|
|
|
|
GSList *list;
|
|
|
|
|
GSList *l;
|
2018-05-31 10:42:09 +12:00
|
|
|
|
list = act_user_manager_list_users (self->um);
|
2011-01-24 20:23:01 -05:00
|
|
|
|
for (l = list; l != NULL; l = l->next) {
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *u = l->data;
|
|
|
|
|
if (act_user_get_uid (u) != act_user_get_uid (user)) {
|
|
|
|
|
act_user_set_automatic_login (user, FALSE);
|
2011-01-24 20:23:01 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_slist_free (list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-22 15:14:13 +01:00
|
|
|
|
static gchar *
|
2012-12-04 12:48:57 -05:00
|
|
|
|
get_login_time_text (ActUser *user)
|
2012-11-22 15:14:13 +01:00
|
|
|
|
{
|
|
|
|
|
gchar *text, *date_str, *time_str;
|
|
|
|
|
GDateTime *date_time;
|
|
|
|
|
gint64 time;
|
|
|
|
|
|
2012-12-04 12:48:57 -05:00
|
|
|
|
time = act_user_get_login_time (user);
|
|
|
|
|
if (act_user_is_logged_in (user)) {
|
2012-11-22 15:14:13 +01:00
|
|
|
|
text = g_strdup (_("Logged in"));
|
|
|
|
|
}
|
|
|
|
|
else if (time > 0) {
|
|
|
|
|
date_time = g_date_time_new_from_unix_local (time);
|
2016-02-12 23:06:59 +00:00
|
|
|
|
date_str = cc_util_get_smart_date (date_time);
|
2013-08-12 14:49:43 +09:00
|
|
|
|
/* Translators: This is a time format string in the style of "22:58".
|
|
|
|
|
It indicates a login time which follows a date. */
|
|
|
|
|
time_str = g_date_time_format (date_time, C_("login date-time", "%k:%M"));
|
2012-11-22 15:14:13 +01:00
|
|
|
|
|
2013-08-12 14:49:43 +09:00
|
|
|
|
/* Translators: This indicates a login date-time.
|
|
|
|
|
The first %s is a date, and the second %s a time. */
|
|
|
|
|
text = g_strdup_printf(C_("login date-time", "%s, %s"), date_str, time_str);
|
2012-11-22 15:14:13 +01:00
|
|
|
|
|
|
|
|
|
g_date_time_unref (date_time);
|
|
|
|
|
g_free (date_str);
|
|
|
|
|
g_free (time_str);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
text = g_strdup ("—");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-04 14:51:35 +01:00
|
|
|
|
static gboolean
|
|
|
|
|
get_autologin_possible (ActUser *user)
|
|
|
|
|
{
|
|
|
|
|
gboolean locked;
|
|
|
|
|
gboolean set_password_at_login;
|
|
|
|
|
|
|
|
|
|
locked = act_user_get_locked (user);
|
|
|
|
|
set_password_at_login = (act_user_get_password_mode (user) == ACT_USER_PASSWORD_MODE_SET_AT_LOGIN);
|
|
|
|
|
|
|
|
|
|
return !(locked || set_password_at_login);
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
static void on_permission_changed (CcUserPanel *self);
|
2020-01-13 12:34:22 +01:00
|
|
|
|
static void full_name_edit_button_toggled (CcUserPanel *self);
|
2013-08-02 13:31:51 -03:00
|
|
|
|
|
2020-03-26 14:20:44 +05:30
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
static gboolean
|
|
|
|
|
is_parental_controls_enabled_for_user (ActUser *user)
|
|
|
|
|
{
|
|
|
|
|
g_autoptr(MctManager) manager = NULL;
|
|
|
|
|
g_autoptr(MctAppFilter) app_filter = NULL;
|
|
|
|
|
g_autoptr(GDBusConnection) system_bus = NULL;
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
|
|
|
|
|
/* FIXME: should become asynchronous */
|
|
|
|
|
system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
|
|
|
|
|
if (system_bus == NULL) {
|
|
|
|
|
g_warning ("Error getting system bus while trying to show user details: %s", error->message);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
manager = mct_manager_new (system_bus);
|
|
|
|
|
app_filter = mct_manager_get_app_filter (manager,
|
|
|
|
|
act_user_get_uid (user),
|
|
|
|
|
MCT_GET_APP_FILTER_FLAGS_NONE,
|
|
|
|
|
NULL,
|
|
|
|
|
&error);
|
|
|
|
|
if (error) {
|
|
|
|
|
if (!g_error_matches (error, MCT_MANAGER_ERROR, MCT_MANAGER_ERROR_DISABLED))
|
|
|
|
|
g_warning ("Error retrieving app filter for user %s: %s",
|
|
|
|
|
act_user_get_user_name (user),
|
|
|
|
|
error->message);
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mct_app_filter_is_enabled (app_filter);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-04-06 22:48:02 +02:00
|
|
|
|
static void
|
|
|
|
|
update_fingerprint_row_state (CcUserPanel *self, GParamSpec *spec, CcFingerprintManager *fingerprint_manager)
|
|
|
|
|
{
|
|
|
|
|
CcFingerprintState state = cc_fingerprint_manager_get_state (fingerprint_manager);
|
|
|
|
|
|
2020-04-14 00:51:05 +02:00
|
|
|
|
if (state != CC_FINGERPRINT_STATE_UPDATING) {
|
|
|
|
|
gtk_widget_set_visible (GTK_WIDGET (self->fingerprint_row),
|
|
|
|
|
state != CC_FINGERPRINT_STATE_NONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->fingerprint_row),
|
|
|
|
|
state != CC_FINGERPRINT_STATE_UPDATING);
|
2020-04-06 22:48:02 +02:00
|
|
|
|
|
|
|
|
|
if (state == CC_FINGERPRINT_STATE_ENABLED)
|
|
|
|
|
gtk_label_set_text (self->fingerprint_state_label, _("Enabled"));
|
|
|
|
|
else if (state == CC_FINGERPRINT_STATE_DISABLED)
|
|
|
|
|
gtk_label_set_text (self->fingerprint_state_label, _("Disabled"));
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
static void
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show_user (ActUser *user, CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2016-07-21 16:10:35 +02:00
|
|
|
|
gchar *lang, *text, *name;
|
2012-09-17 12:33:51 +01:00
|
|
|
|
gboolean show, enable;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *current;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
self->selected_user = user;
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
2018-11-07 16:24:37 +13:00
|
|
|
|
cc_user_image_set_user (self->user_icon_image, user);
|
|
|
|
|
cc_user_image_set_user (self->user_icon_image2, user);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-11-07 16:36:24 +13:00
|
|
|
|
cc_avatar_chooser_set_user (self->avatar_chooser, user);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-01-13 12:34:22 +01:00
|
|
|
|
gtk_label_set_label (self->full_name_label, act_user_get_real_name (user));
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_entry_set_text (self->full_name_entry, act_user_get_real_name (user));
|
2020-01-13 12:34:22 +01:00
|
|
|
|
gtk_widget_set_tooltip_text (GTK_WIDGET (self->full_name_label), act_user_get_user_name (user));
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func (self->full_name_edit_button, full_name_edit_button_toggled, self);
|
|
|
|
|
gtk_stack_set_visible_child (self->full_name_stack, GTK_WIDGET (self->full_name_label));
|
|
|
|
|
gtk_toggle_button_set_active (self->full_name_edit_button, FALSE);
|
|
|
|
|
g_signal_handlers_unblock_by_func (self->full_name_edit_button, full_name_edit_button_toggled, self);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
enable = (act_user_get_account_type (user) == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR);
|
|
|
|
|
gtk_switch_set_active (self->account_type_switch, enable);
|
2016-05-31 12:00:47 +02:00
|
|
|
|
|
2016-07-21 16:10:35 +02:00
|
|
|
|
/* Do not show the "Account Type" option when there's a single user account. */
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show = (self->other_accounts != 0);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_visible (GTK_WIDGET (self->account_settings_box), show);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_label_set_label (self->password_button_label, get_password_mode_text (user));
|
2012-12-04 12:48:57 -05:00
|
|
|
|
enable = act_user_is_local_account (user);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->password_button_label), enable);
|
2011-08-25 12:41:18 -04:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
g_signal_handlers_block_by_func (self->autologin_switch, autologin_changed, self);
|
|
|
|
|
gtk_switch_set_active (self->autologin_switch, act_user_get_automatic_login (user));
|
|
|
|
|
g_signal_handlers_unblock_by_func (self->autologin_switch, autologin_changed, self);
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->autologin_switch), get_autologin_possible (user));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2014-10-15 12:41:51 +02:00
|
|
|
|
name = NULL;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
lang = g_strdup (act_user_get_language (user));
|
2014-05-30 13:02:00 +02:00
|
|
|
|
|
2014-10-15 12:41:51 +02:00
|
|
|
|
if (lang && *lang != '\0') {
|
|
|
|
|
name = gnome_get_language_from_locale (lang, NULL);
|
2016-07-20 10:28:06 +02:00
|
|
|
|
} else {
|
|
|
|
|
name = g_strdup ("—");
|
2014-05-30 13:02:00 +02:00
|
|
|
|
}
|
2016-07-20 10:28:06 +02:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_label_set_label (self->language_button_label, name);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
g_free (lang);
|
2014-10-15 12:41:51 +02:00
|
|
|
|
g_free (name);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2015-02-23 11:47:13 +01:00
|
|
|
|
/* Fingerprint: show when self, local, enabled, and possible */
|
2012-12-04 12:48:57 -05:00
|
|
|
|
show = (act_user_get_uid (user) == getuid() &&
|
|
|
|
|
act_user_is_local_account (user) &&
|
2018-05-31 10:42:09 +12:00
|
|
|
|
(self->login_screen_settings &&
|
2020-03-26 06:41:06 +01:00
|
|
|
|
g_settings_get_boolean (self->login_screen_settings,
|
|
|
|
|
"enable-fingerprint-authentication")));
|
|
|
|
|
|
2020-04-06 22:48:02 +02:00
|
|
|
|
if (show) {
|
|
|
|
|
if (!self->fingerprint_manager) {
|
|
|
|
|
self->fingerprint_manager = cc_fingerprint_manager_new (user);
|
|
|
|
|
g_signal_connect_object (self->fingerprint_manager,
|
|
|
|
|
"notify::state",
|
|
|
|
|
G_CALLBACK (update_fingerprint_row_state),
|
|
|
|
|
self, G_CONNECT_SWAPPED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update_fingerprint_row_state (self, NULL, self->fingerprint_manager);
|
2020-04-03 17:36:39 +02:00
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_visible (GTK_WIDGET (self->fingerprint_row), FALSE);
|
2020-03-26 06:41:06 +01:00
|
|
|
|
}
|
2012-08-14 18:34:22 +02:00
|
|
|
|
|
|
|
|
|
/* Autologin: show when local account */
|
2012-12-04 12:48:57 -05:00
|
|
|
|
show = act_user_is_local_account (user);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_visible (GTK_WIDGET (self->autologin_row), show);
|
2012-11-22 15:14:13 +01:00
|
|
|
|
|
2020-03-26 14:20:44 +05:30
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
/* Parental Controls: Unavailable if user is admin */
|
|
|
|
|
if (act_user_get_account_type (user) == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR) {
|
|
|
|
|
gtk_widget_hide (GTK_WIDGET (self->parental_control_go_next));
|
|
|
|
|
/* TRANSLATORS: Status of Parental Controls setup */
|
|
|
|
|
gtk_label_set_text (self->parental_controls_button_label, _("Unavailable"));
|
|
|
|
|
} else {
|
|
|
|
|
if (is_parental_controls_enabled_for_user (user))
|
|
|
|
|
/* TRANSLATORS: Status of Parental Controls setup */
|
|
|
|
|
gtk_label_set_text (self->parental_controls_button_label, _("Enabled"));
|
|
|
|
|
else
|
|
|
|
|
/* TRANSLATORS: Status of Parental Controls setup */
|
|
|
|
|
gtk_label_set_text (self->parental_controls_button_label, _("Disabled"));
|
|
|
|
|
|
|
|
|
|
gtk_widget_show (GTK_WIDGET (self->parental_control_go_next));
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-06-13 14:27:30 +02:00
|
|
|
|
/* Language: do not show for current user */
|
|
|
|
|
show = act_user_get_uid (user) != getuid();
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_visible (GTK_WIDGET (self->language_row), show);
|
2016-06-13 14:27:30 +02:00
|
|
|
|
|
2012-11-22 15:14:13 +01:00
|
|
|
|
/* Last login: show when administrator or current user */
|
2018-05-31 10:42:09 +12:00
|
|
|
|
current = act_user_manager_get_user_by_id (self->um, getuid ());
|
2012-12-04 12:48:57 -05:00
|
|
|
|
show = act_user_get_uid (user) == getuid () ||
|
|
|
|
|
act_user_get_account_type (current) == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR;
|
2012-11-22 15:14:13 +01:00
|
|
|
|
if (show) {
|
|
|
|
|
text = get_login_time_text (user);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_label_set_label (self->last_login_button_label, text);
|
2012-11-22 15:14:13 +01:00
|
|
|
|
g_free (text);
|
|
|
|
|
}
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_visible (GTK_WIDGET (self->last_login_row), show);
|
2012-11-22 15:18:09 +01:00
|
|
|
|
|
|
|
|
|
enable = act_user_get_login_history (user) != NULL;
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->last_login_row), enable);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
if (self->permission != NULL)
|
2018-10-16 11:23:40 +13:00
|
|
|
|
on_permission_changed (self);
|
2013-08-02 13:31:51 -03:00
|
|
|
|
}
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
|
|
|
|
static void
|
2020-01-13 12:34:22 +01:00
|
|
|
|
full_name_entry_activate (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
|
|
|
|
const gchar *text;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
text = gtk_entry_get_text (self->full_name_entry);
|
2013-05-08 17:05:56 +01:00
|
|
|
|
if (g_strcmp0 (text, act_user_get_real_name (user)) != 0 &&
|
|
|
|
|
is_valid_name (text)) {
|
2012-12-04 12:48:57 -05:00
|
|
|
|
act_user_set_real_name (user, text);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
2020-01-13 12:34:22 +01:00
|
|
|
|
|
|
|
|
|
gtk_toggle_button_set_active (self->full_name_edit_button, FALSE);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-07-20 11:26:56 +02:00
|
|
|
|
static void
|
2020-01-13 12:34:22 +01:00
|
|
|
|
full_name_edit_button_toggled (CcUserPanel *self)
|
|
|
|
|
{
|
|
|
|
|
if (gtk_stack_get_visible_child (self->full_name_stack) == GTK_WIDGET (self->full_name_label)) {
|
|
|
|
|
gtk_stack_set_visible_child (self->full_name_stack, GTK_WIDGET (self->full_name_entry));
|
|
|
|
|
|
|
|
|
|
gtk_widget_grab_focus (GTK_WIDGET (self->full_name_entry));
|
|
|
|
|
} else {
|
|
|
|
|
gtk_stack_set_visible_child (self->full_name_stack, GTK_WIDGET (self->full_name_label));
|
|
|
|
|
|
|
|
|
|
full_name_entry_activate (self);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
full_name_entry_key_press_cb (CcUserPanel *self,
|
|
|
|
|
GdkEvent *event)
|
2016-07-20 11:26:56 +02:00
|
|
|
|
{
|
2020-01-13 12:34:22 +01:00
|
|
|
|
GdkEventKey *key = (GdkEventKey *)event;
|
|
|
|
|
|
|
|
|
|
if (key->keyval == GDK_KEY_Escape) {
|
|
|
|
|
gtk_entry_set_text (self->full_name_entry, act_user_get_real_name (self->selected_user));
|
|
|
|
|
|
|
|
|
|
full_name_entry_activate (self);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
2016-07-20 11:26:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
account_type_changed (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2014-09-17 14:35:46 +02:00
|
|
|
|
gboolean self_selected;
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gboolean is_admin;
|
|
|
|
|
ActUserAccountType account_type;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2014-09-17 14:35:46 +02:00
|
|
|
|
self_selected = act_user_get_uid (user) == geteuid ();
|
2020-01-13 15:35:09 +01:00
|
|
|
|
is_admin = gtk_switch_get_active (self->account_type_switch);
|
2011-08-25 23:43:48 -04:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
account_type = is_admin ? ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR : ACT_USER_ACCOUNT_TYPE_STANDARD;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
if (account_type != act_user_get_account_type (user)) {
|
|
|
|
|
act_user_set_account_type (user, account_type);
|
2014-09-17 14:35:46 +02:00
|
|
|
|
|
|
|
|
|
if (self_selected)
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show_restart_notification (self, NULL);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-27 16:37:45 +01:00
|
|
|
|
static void
|
2018-05-31 10:42:09 +12:00
|
|
|
|
dismiss_notification (CcUserPanel *self)
|
2016-11-27 16:37:45 +01:00
|
|
|
|
{
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_revealer_set_reveal_child (self->notification_revealer, FALSE);
|
2016-11-27 16:37:45 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-31 13:53:18 +02:00
|
|
|
|
static void
|
2018-05-31 10:42:09 +12:00
|
|
|
|
restart_now (CcUserPanel *self)
|
2013-07-31 13:53:18 +02:00
|
|
|
|
{
|
|
|
|
|
GDBusConnection *bus;
|
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_revealer_set_reveal_child (self->notification_revealer, FALSE);
|
2013-07-31 13:53:18 +02:00
|
|
|
|
|
|
|
|
|
bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
|
|
|
|
|
g_dbus_connection_call (bus,
|
|
|
|
|
"org.gnome.SessionManager",
|
|
|
|
|
"/org/gnome/SessionManager",
|
|
|
|
|
"org.gnome.SessionManager",
|
|
|
|
|
"Logout",
|
|
|
|
|
g_variant_new ("(u)", 0),
|
|
|
|
|
NULL, 0, G_MAXINT,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
g_object_unref (bus);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-05-31 10:42:09 +12:00
|
|
|
|
show_restart_notification (CcUserPanel *self, const gchar *locale)
|
2013-07-31 13:53:18 +02:00
|
|
|
|
{
|
2019-02-20 23:42:38 -06:00
|
|
|
|
locale_t current_locale;
|
|
|
|
|
locale_t new_locale;
|
2013-07-31 13:53:18 +02:00
|
|
|
|
|
|
|
|
|
if (locale) {
|
2019-02-20 23:42:38 -06:00
|
|
|
|
new_locale = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0);
|
|
|
|
|
if (new_locale == (locale_t) 0)
|
|
|
|
|
g_warning ("Failed to create locale %s: %s", locale, g_strerror (errno));
|
|
|
|
|
else
|
|
|
|
|
current_locale = uselocale (new_locale);
|
2013-07-31 13:53:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_revealer_set_reveal_child (self->notification_revealer, TRUE);
|
2013-07-31 13:53:18 +02:00
|
|
|
|
|
2019-02-20 23:42:38 -06:00
|
|
|
|
if (locale && new_locale != (locale_t) 0) {
|
|
|
|
|
uselocale (current_locale);
|
|
|
|
|
freelocale (new_locale);
|
2013-07-31 13:53:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
static void
|
2019-11-22 13:10:38 +13:00
|
|
|
|
language_response (CcUserPanel *self,
|
2018-05-31 10:42:09 +12:00
|
|
|
|
gint response_id,
|
2019-11-22 13:10:38 +13:00
|
|
|
|
GtkDialog *dialog)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2015-01-16 09:11:00 +01:00
|
|
|
|
const gchar *lang, *account_language;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2014-10-15 12:41:51 +02:00
|
|
|
|
if (response_id != GTK_RESPONSE_OK) {
|
|
|
|
|
gtk_widget_hide (GTK_WIDGET (dialog));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2015-01-16 09:11:00 +01:00
|
|
|
|
account_language = act_user_get_language (user);
|
2011-08-25 23:43:48 -04:00
|
|
|
|
|
2018-06-29 16:50:43 +12:00
|
|
|
|
lang = cc_language_chooser_get_language (CC_LANGUAGE_CHOOSER (dialog));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
if (lang) {
|
2018-10-16 11:23:40 +13:00
|
|
|
|
g_autofree gchar *name = NULL;
|
2015-01-16 09:11:00 +01:00
|
|
|
|
if (g_strcmp0 (lang, account_language) != 0) {
|
2012-12-04 12:48:57 -05:00
|
|
|
|
act_user_set_language (user, lang);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
2014-10-15 12:41:51 +02:00
|
|
|
|
|
|
|
|
|
name = gnome_get_language_from_locale (lang, NULL);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_label_set_label (self->language_button_label, name);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-15 12:41:51 +02:00
|
|
|
|
gtk_widget_hide (GTK_WIDGET (dialog));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
change_language (CcUserPanel *self)
|
2014-10-15 12:41:51 +02:00
|
|
|
|
{
|
|
|
|
|
const gchar *current_language;
|
|
|
|
|
ActUser *user;
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2014-10-15 12:41:51 +02:00
|
|
|
|
current_language = act_user_get_language (user);
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
if (self->language_chooser) {
|
|
|
|
|
cc_language_chooser_clear_filter (self->language_chooser);
|
|
|
|
|
cc_language_chooser_set_language (self->language_chooser, NULL);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
2014-10-07 09:03:05 +02:00
|
|
|
|
else {
|
2018-06-29 16:50:43 +12:00
|
|
|
|
self->language_chooser = cc_language_chooser_new ();
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (self->language_chooser),
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2019-11-22 13:10:38 +13:00
|
|
|
|
g_signal_connect_object (self->language_chooser, "response",
|
|
|
|
|
G_CALLBACK (language_response), self, G_CONNECT_SWAPPED);
|
2018-05-31 10:42:09 +12:00
|
|
|
|
g_signal_connect (self->language_chooser, "delete-event",
|
2014-10-07 09:03:05 +02:00
|
|
|
|
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
|
2011-08-20 02:17:06 -04:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gdk_window_set_cursor (gtk_widget_get_window (gtk_widget_get_toplevel (GTK_WIDGET (self))), NULL);
|
2014-10-07 09:03:05 +02:00
|
|
|
|
}
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2014-10-07 09:03:05 +02:00
|
|
|
|
if (current_language && *current_language != '\0')
|
2018-05-31 10:42:09 +12:00
|
|
|
|
cc_language_chooser_set_language (self->language_chooser, current_language);
|
|
|
|
|
gtk_window_present (GTK_WINDOW (self->language_chooser));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
change_password (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2018-11-07 09:28:46 +13:00
|
|
|
|
CcPasswordDialog *dialog;
|
2018-11-06 15:42:06 +13:00
|
|
|
|
GtkWindow *parent;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2018-11-07 09:28:46 +13:00
|
|
|
|
dialog = cc_password_dialog_new (user);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-11-06 15:42:06 +13:00
|
|
|
|
parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
|
|
|
|
|
|
|
|
|
|
gtk_dialog_run (GTK_DIALOG (dialog));
|
|
|
|
|
gtk_widget_destroy (GTK_WIDGET (dialog));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
change_fingerprint (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2020-04-10 16:40:27 +02:00
|
|
|
|
GtkWindow *top_level;
|
|
|
|
|
CcFingerprintDialog *dialog;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2020-04-10 16:40:27 +02:00
|
|
|
|
top_level = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
|
2011-08-25 23:43:48 -04:00
|
|
|
|
|
2012-12-04 12:48:57 -05:00
|
|
|
|
g_assert (g_strcmp0 (g_get_user_name (), act_user_get_user_name (user)) == 0);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-04-10 16:40:27 +02:00
|
|
|
|
dialog = cc_fingerprint_dialog_new (self->fingerprint_manager);
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), top_level);
|
|
|
|
|
gtk_widget_show (GTK_WIDGET (dialog));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2012-11-22 15:18:09 +01:00
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
show_history (CcUserPanel *self)
|
2012-11-22 15:18:09 +01:00
|
|
|
|
{
|
2018-11-07 09:38:10 +13:00
|
|
|
|
CcLoginHistoryDialog *dialog;
|
2012-11-22 15:18:09 +01:00
|
|
|
|
ActUser *user;
|
2018-11-06 14:16:45 +13:00
|
|
|
|
GtkWindow *parent;
|
|
|
|
|
gint parent_width;
|
2012-11-22 15:18:09 +01:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
user = get_selected_user (self);
|
2018-11-07 09:38:10 +13:00
|
|
|
|
dialog = cc_login_history_dialog_new (user);
|
2018-11-06 14:16:45 +13:00
|
|
|
|
|
|
|
|
|
parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
|
|
|
|
|
gtk_window_get_size (parent, &parent_width, NULL);
|
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (dialog), parent_width * 0.6, -1);
|
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
|
2012-11-22 15:18:09 +01:00
|
|
|
|
|
2018-11-06 14:16:45 +13:00
|
|
|
|
gtk_dialog_run (GTK_DIALOG (dialog));
|
|
|
|
|
|
|
|
|
|
gtk_widget_destroy (GTK_WIDGET (dialog));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-26 14:20:44 +05:30
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
static void
|
|
|
|
|
spawn_malcontent_control (CcUserPanel *self)
|
|
|
|
|
{
|
|
|
|
|
ActUser *user;
|
|
|
|
|
|
|
|
|
|
user = get_selected_user (self);
|
|
|
|
|
|
|
|
|
|
/* no-op if the user is administrator */
|
|
|
|
|
if (act_user_get_account_type (user) != ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR) {
|
|
|
|
|
const gchar *argv[] = { "malcontent-control", NULL };
|
|
|
|
|
g_spawn_async (NULL, (char **)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
static void
|
|
|
|
|
activate_row (GtkListBox *box, GtkListBoxRow *row, CcUserPanel *self)
|
|
|
|
|
{
|
|
|
|
|
if (!gtk_widget_get_sensitive (GTK_WIDGET (row)))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (row == self->language_row) {
|
|
|
|
|
change_language (self);
|
|
|
|
|
} else if (row == self->password_row) {
|
|
|
|
|
change_password (self);
|
|
|
|
|
} else if (row == self->fingerprint_row) {
|
|
|
|
|
change_fingerprint (self);
|
|
|
|
|
} else if (row == self->last_login_row) {
|
|
|
|
|
show_history (self);
|
|
|
|
|
}
|
2020-03-26 14:20:44 +05:30
|
|
|
|
|
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
if (row == self->parental_controls_row) {
|
|
|
|
|
spawn_malcontent_control (self);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2020-01-13 15:35:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
static void
|
2018-10-16 11:47:51 +13:00
|
|
|
|
users_loaded (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *dialog;
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
if (act_user_manager_no_service (self->um)) {
|
2018-10-16 11:23:40 +13:00
|
|
|
|
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
|
2010-10-30 16:14:30 -04:00
|
|
|
|
GTK_DIALOG_MODAL,
|
|
|
|
|
GTK_MESSAGE_OTHER,
|
|
|
|
|
GTK_BUTTONS_CLOSE,
|
|
|
|
|
_("Failed to contact the accounts service"));
|
|
|
|
|
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
|
|
|
|
_("Please make sure that the AccountService is installed and enabled."));
|
2019-11-22 13:10:38 +13:00
|
|
|
|
g_signal_connect (dialog, "response",
|
|
|
|
|
G_CALLBACK (gtk_widget_destroy),
|
|
|
|
|
NULL);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
gtk_widget_show (dialog);
|
2011-03-23 22:00:58 -04:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->accounts_box), FALSE);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2018-10-16 11:47:51 +13:00
|
|
|
|
g_signal_connect_object (self->um, "user-changed", G_CALLBACK (user_changed), self, G_CONNECT_SWAPPED);
|
|
|
|
|
g_signal_connect_object (self->um, "user-is-logged-in-changed", G_CALLBACK (user_changed), self, G_CONNECT_SWAPPED);
|
|
|
|
|
g_signal_connect_object (self->um, "user-added", G_CALLBACK (user_added), self, G_CONNECT_SWAPPED);
|
|
|
|
|
g_signal_connect_object (self->um, "user-removed", G_CALLBACK (user_changed), self, G_CONNECT_SWAPPED);
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
reload_users (self, NULL);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
add_unlock_tooltip (GtkWidget *widget)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2010-11-15 14:02:27 -05:00
|
|
|
|
gchar *names[3];
|
2010-10-30 16:14:30 -04:00
|
|
|
|
GIcon *icon;
|
|
|
|
|
|
2011-10-25 17:56:03 +01:00
|
|
|
|
names[0] = "changes-allow-symbolic";
|
|
|
|
|
names[1] = "changes-allow";
|
2010-10-30 16:14:30 -04:00
|
|
|
|
names[2] = NULL;
|
2010-11-15 14:02:27 -05:00
|
|
|
|
icon = (GIcon *)g_themed_icon_new_from_names (names, -1);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
setup_tooltip_with_embedded_icon (widget,
|
2017-01-27 23:02:44 +01:00
|
|
|
|
/* Translator comments:
|
|
|
|
|
* We split the line in 2 here to "make it look good", as there's
|
|
|
|
|
* no good way to do this in GTK+ for tooltips. See:
|
|
|
|
|
* https://bugzilla.gnome.org/show_bug.cgi?id=657168 */
|
2010-10-30 16:14:30 -04:00
|
|
|
|
_("To make changes,\nclick the * icon first"),
|
|
|
|
|
"*",
|
|
|
|
|
icon);
|
|
|
|
|
g_object_unref (icon);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
g_signal_connect (widget, "button-release-event",
|
2010-10-30 16:14:30 -04:00
|
|
|
|
G_CALLBACK (show_tooltip_now), NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
remove_unlock_tooltip (GtkWidget *widget)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2018-10-16 11:23:40 +13:00
|
|
|
|
setup_tooltip_with_embedded_icon (widget, NULL, NULL, NULL);
|
|
|
|
|
g_signal_handlers_disconnect_by_func (widget,
|
2010-10-30 16:14:30 -04:00
|
|
|
|
G_CALLBACK (show_tooltip_now), NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-09 09:32:00 +13:00
|
|
|
|
static guint
|
|
|
|
|
get_num_active_admin (ActUserManager *um)
|
|
|
|
|
{
|
|
|
|
|
GSList *list;
|
|
|
|
|
GSList *l;
|
|
|
|
|
guint num_admin = 0;
|
|
|
|
|
|
|
|
|
|
list = act_user_manager_list_users (um);
|
|
|
|
|
for (l = list; l != NULL; l = l->next) {
|
|
|
|
|
ActUser *u = l->data;
|
|
|
|
|
if (act_user_get_account_type (u) == ACT_USER_ACCOUNT_TYPE_ADMINISTRATOR && !act_user_get_locked (u)) {
|
|
|
|
|
num_admin++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_slist_free (list);
|
|
|
|
|
|
|
|
|
|
return num_admin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
would_demote_only_admin (ActUser *user)
|
|
|
|
|
{
|
|
|
|
|
ActUserManager *um = act_user_manager_get_default ();
|
|
|
|
|
|
|
|
|
|
/* Prevent the user from demoting the only admin account.
|
|
|
|
|
* Returns TRUE when user is an administrator and there is only
|
|
|
|
|
* one enabled administrator. */
|
|
|
|
|
|
|
|
|
|
if (act_user_get_account_type (user) == ACT_USER_ACCOUNT_TYPE_STANDARD ||
|
|
|
|
|
act_user_get_locked (user))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (get_num_active_admin (um) > 1)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
static void
|
2018-10-16 11:23:40 +13:00
|
|
|
|
on_permission_changed (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
|
|
|
|
gboolean is_authorized;
|
|
|
|
|
gboolean self_selected;
|
2012-12-04 12:48:57 -05:00
|
|
|
|
ActUser *user;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
is_authorized = g_permission_get_allowed (G_PERMISSION (self->permission));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2019-12-19 15:51:38 +01:00
|
|
|
|
gtk_widget_set_visible (GTK_WIDGET (self->add_user_button), is_authorized);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-05-05 08:52:09 +02:00
|
|
|
|
user = get_selected_user (self);
|
|
|
|
|
if (!user) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self_selected = act_user_get_uid (user) == geteuid ();
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->remove_user_button), is_authorized && !self_selected
|
2013-06-04 16:53:22 +01:00
|
|
|
|
&& !would_demote_only_admin (user));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
if (is_authorized) {
|
2018-10-16 11:23:40 +13:00
|
|
|
|
setup_tooltip_with_embedded_icon (GTK_WIDGET (self->remove_user_button), _("Delete the selected user account"), NULL, NULL);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
else {
|
2010-11-15 14:02:27 -05:00
|
|
|
|
gchar *names[3];
|
2010-10-30 16:14:30 -04:00
|
|
|
|
GIcon *icon;
|
|
|
|
|
|
2011-10-25 17:56:03 +01:00
|
|
|
|
names[0] = "changes-allow-symbolic";
|
|
|
|
|
names[1] = "changes-allow";
|
2010-10-30 16:14:30 -04:00
|
|
|
|
names[2] = NULL;
|
2010-11-15 14:02:27 -05:00
|
|
|
|
icon = (GIcon *)g_themed_icon_new_from_names (names, -1);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
setup_tooltip_with_embedded_icon (GTK_WIDGET (self->remove_user_button),
|
2011-10-25 17:56:44 +01:00
|
|
|
|
_("To delete the selected user account,\nclick the * icon first"),
|
2010-10-30 16:14:30 -04:00
|
|
|
|
"*",
|
|
|
|
|
icon);
|
|
|
|
|
g_object_unref (icon);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-04 12:48:57 -05:00
|
|
|
|
if (!act_user_is_local_account (user)) {
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->account_type_row), FALSE);
|
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->account_type_row));
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->autologin_row), FALSE);
|
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->autologin_row));
|
2012-08-14 18:34:22 +02:00
|
|
|
|
|
2012-12-04 12:48:57 -05:00
|
|
|
|
} else if (is_authorized && act_user_is_local_account (user)) {
|
2013-06-04 16:53:22 +01:00
|
|
|
|
if (would_demote_only_admin (user)) {
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->account_type_row), FALSE);
|
2013-05-29 17:16:47 -07:00
|
|
|
|
} else {
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->account_type_row), TRUE);
|
2013-05-29 17:16:47 -07:00
|
|
|
|
}
|
2020-01-13 15:35:09 +01:00
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->account_type_row));
|
2013-06-04 14:51:35 +01:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->autologin_row), get_autologin_possible (user));
|
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->autologin_row));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
else {
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->account_type_row), FALSE);
|
2013-06-04 16:53:22 +01:00
|
|
|
|
if (would_demote_only_admin (user)) {
|
2020-01-13 15:35:09 +01:00
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->account_type_row));
|
2013-05-29 17:16:47 -07:00
|
|
|
|
} else {
|
2020-01-13 15:35:09 +01:00
|
|
|
|
add_unlock_tooltip (GTK_WIDGET (self->account_type_row));
|
2013-05-29 17:16:47 -07:00
|
|
|
|
}
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->autologin_row), FALSE);
|
|
|
|
|
add_unlock_tooltip (GTK_WIDGET (self->autologin_row));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-14 18:34:22 +02:00
|
|
|
|
/* The full name entry: insensitive if remote or not authorized and not self */
|
2012-12-04 12:48:57 -05:00
|
|
|
|
if (!act_user_is_local_account (user)) {
|
2020-01-13 12:34:22 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->full_name_edit_button), FALSE);
|
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->full_name_stack));
|
2012-08-14 18:34:22 +02:00
|
|
|
|
|
|
|
|
|
} else if (is_authorized || self_selected) {
|
2020-01-13 12:34:22 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->full_name_edit_button), TRUE);
|
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->full_name_stack));
|
2012-08-14 18:34:22 +02:00
|
|
|
|
|
|
|
|
|
} else {
|
2020-01-13 12:34:22 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->full_name_edit_button), FALSE);
|
|
|
|
|
add_unlock_tooltip (GTK_WIDGET (self->full_name_stack));
|
2012-08-14 18:34:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
if (is_authorized || self_selected) {
|
2020-04-14 00:51:05 +02:00
|
|
|
|
CcFingerprintState fingerprint_state = CC_FINGERPRINT_STATE_NONE;
|
|
|
|
|
|
|
|
|
|
if (self->fingerprint_manager)
|
|
|
|
|
fingerprint_state = cc_fingerprint_manager_get_state (self->fingerprint_manager);
|
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_stack_set_visible_child (self->user_icon_stack, GTK_WIDGET (self->user_icon_button));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->language_row), TRUE);
|
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->language_row));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->password_row), TRUE);
|
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->password_row));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-04-14 00:51:05 +02:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->fingerprint_row),
|
|
|
|
|
fingerprint_state != CC_FINGERPRINT_STATE_UPDATING);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->fingerprint_row));
|
2016-12-22 11:03:10 +01:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->last_login_row), TRUE);
|
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->last_login_row));
|
2020-03-26 14:20:44 +05:30
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->parental_controls_row), TRUE);
|
|
|
|
|
remove_unlock_tooltip (GTK_WIDGET (self->parental_controls_row));
|
|
|
|
|
#endif
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
else {
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_stack_set_visible_child (self->user_icon_stack, GTK_WIDGET (self->user_icon_image));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->language_row), FALSE);
|
|
|
|
|
add_unlock_tooltip (GTK_WIDGET (self->language_row));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->password_row), FALSE);
|
|
|
|
|
add_unlock_tooltip (GTK_WIDGET (self->password_row));
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->fingerprint_row), FALSE);
|
|
|
|
|
add_unlock_tooltip (GTK_WIDGET (self->fingerprint_row));
|
2016-12-22 11:03:10 +01:00
|
|
|
|
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->last_login_row), FALSE);
|
|
|
|
|
add_unlock_tooltip (GTK_WIDGET (self->last_login_row));
|
2020-03-26 14:20:44 +05:30
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (self->parental_controls_row), FALSE);
|
|
|
|
|
add_unlock_tooltip (GTK_WIDGET (self->parental_controls_row));
|
|
|
|
|
#endif
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-09-30 11:08:08 +02:00
|
|
|
|
setup_main_window (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
|
|
|
|
GIcon *icon;
|
2012-08-18 18:32:34 +01:00
|
|
|
|
GError *error = NULL;
|
2010-11-15 14:02:27 -05:00
|
|
|
|
gchar *names[3];
|
2013-01-29 16:40:23 -05:00
|
|
|
|
gboolean loaded;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
self->other_accounts = 0;
|
2016-11-15 14:40:54 +01:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
add_unlock_tooltip (GTK_WIDGET (self->user_icon_image));
|
2012-11-22 15:18:09 +01:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
self->permission = (GPermission *)polkit_permission_new_sync (USER_ACCOUNTS_PERMISSION, NULL, NULL, &error);
|
|
|
|
|
if (self->permission != NULL) {
|
2018-10-16 11:23:40 +13:00
|
|
|
|
g_signal_connect_object (self->permission, "notify",
|
|
|
|
|
G_CALLBACK (on_permission_changed), self, G_CONNECT_SWAPPED);
|
|
|
|
|
on_permission_changed (self);
|
2012-08-18 18:32:34 +01:00
|
|
|
|
} else {
|
|
|
|
|
g_warning ("Cannot create '%s' permission: %s", USER_ACCOUNTS_PERMISSION, error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
}
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2011-10-25 17:56:03 +01:00
|
|
|
|
names[0] = "changes-allow-symbolic";
|
|
|
|
|
names[1] = "changes-allow";
|
2010-10-30 16:14:30 -04:00
|
|
|
|
names[2] = NULL;
|
2010-11-15 14:02:27 -05:00
|
|
|
|
icon = (GIcon *)g_themed_icon_new_from_names (names, -1);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
setup_tooltip_with_embedded_icon (GTK_WIDGET (self->remove_user_button),
|
2011-10-25 17:56:44 +01:00
|
|
|
|
_("To delete the selected user account,\nclick the * icon first"),
|
2010-10-30 16:14:30 -04:00
|
|
|
|
"*",
|
|
|
|
|
icon);
|
|
|
|
|
g_object_unref (icon);
|
2013-01-29 16:40:23 -05:00
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
g_object_get (self->um, "is-loaded", &loaded, NULL);
|
2013-01-29 16:40:23 -05:00
|
|
|
|
if (loaded)
|
2018-10-16 11:47:51 +13:00
|
|
|
|
users_loaded (self);
|
2013-01-29 16:40:23 -05:00
|
|
|
|
else
|
2018-10-16 11:47:51 +13:00
|
|
|
|
g_signal_connect_object (self->um, "notify::is-loaded", G_CALLBACK (users_loaded), self, G_CONNECT_SWAPPED);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
|
|
|
|
|
gtk_list_box_set_header_func (self->account_settings_listbox,
|
|
|
|
|
cc_list_box_update_header_func,
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
gtk_list_box_set_header_func (self->authentication_and_login_listbox,
|
|
|
|
|
cc_list_box_update_header_func,
|
|
|
|
|
NULL, NULL);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-07 15:38:07 +02:00
|
|
|
|
static GSettings *
|
|
|
|
|
settings_or_null (const gchar *schema)
|
|
|
|
|
{
|
|
|
|
|
GSettingsSchemaSource *source = NULL;
|
|
|
|
|
gchar **non_relocatable = NULL;
|
|
|
|
|
gchar **relocatable = NULL;
|
|
|
|
|
GSettings *settings = NULL;
|
|
|
|
|
|
|
|
|
|
source = g_settings_schema_source_get_default ();
|
|
|
|
|
if (!source)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
g_settings_schema_source_list_schemas (source, TRUE, &non_relocatable, &relocatable);
|
|
|
|
|
|
|
|
|
|
if (g_strv_contains ((const gchar * const *)non_relocatable, schema) ||
|
|
|
|
|
g_strv_contains ((const gchar * const *)relocatable, schema))
|
|
|
|
|
settings = g_settings_new (schema);
|
|
|
|
|
|
|
|
|
|
g_strfreev (non_relocatable);
|
|
|
|
|
g_strfreev (relocatable);
|
|
|
|
|
return settings;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-20 14:20:34 +02:00
|
|
|
|
static void
|
|
|
|
|
cc_user_panel_constructed (GObject *object)
|
|
|
|
|
{
|
2018-11-06 16:00:36 +13:00
|
|
|
|
CcUserPanel *self = CC_USER_PANEL (object);
|
2016-07-20 14:20:34 +02:00
|
|
|
|
CcShell *shell;
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (cc_user_panel_parent_class)->constructed (object);
|
|
|
|
|
|
|
|
|
|
shell = cc_panel_get_shell (CC_PANEL (self));
|
2019-12-19 15:51:38 +01:00
|
|
|
|
cc_shell_embed_widget_in_header (shell, GTK_WIDGET (self->add_user_button), GTK_POS_RIGHT);
|
2016-07-20 14:20:34 +02:00
|
|
|
|
|
2019-12-19 15:51:38 +01:00
|
|
|
|
cc_permission_infobar_set_permission (self->permission_infobar, self->permission);
|
2016-07-20 14:20:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
static void
|
2012-12-11 11:46:28 +01:00
|
|
|
|
cc_user_panel_init (CcUserPanel *self)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2011-02-04 15:43:40 -05:00
|
|
|
|
volatile GType type G_GNUC_UNUSED;
|
2017-04-05 13:31:42 +02:00
|
|
|
|
GtkCssProvider *provider;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-11-08 10:23:00 +13:00
|
|
|
|
g_resources_register (cc_user_accounts_get_resource ());
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
|
|
|
|
/* register types that the builder might need */
|
2018-11-07 16:24:37 +13:00
|
|
|
|
type = cc_user_image_get_type ();
|
2018-11-07 16:28:36 +13:00
|
|
|
|
type = cc_carousel_get_type ();
|
2019-12-19 15:51:38 +01:00
|
|
|
|
type = cc_permission_infobar_get_type ();
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_init_template (GTK_WIDGET (self));
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
self->um = act_user_manager_get_default ();
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2017-04-05 13:31:42 +02:00
|
|
|
|
provider = gtk_css_provider_new ();
|
|
|
|
|
gtk_css_provider_load_from_resource (provider, "/org/gnome/control-center/user-accounts/user-accounts-dialog.css");
|
|
|
|
|
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
|
|
|
|
|
GTK_STYLE_PROVIDER (provider),
|
|
|
|
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
|
|
|
|
g_object_unref (provider);
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
self->login_screen_settings = settings_or_null ("org.gnome.login-screen");
|
2015-02-23 11:47:13 +01:00
|
|
|
|
|
2018-11-07 16:36:24 +13:00
|
|
|
|
self->avatar_chooser = cc_avatar_chooser_new (GTK_WIDGET (self->user_icon_button));
|
2014-09-30 11:08:08 +02:00
|
|
|
|
setup_main_window (self);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2012-12-11 11:46:28 +01:00
|
|
|
|
cc_user_panel_dispose (GObject *object)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2018-11-06 16:00:36 +13:00
|
|
|
|
CcUserPanel *self = CC_USER_PANEL (object);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2020-03-26 06:41:33 +01:00
|
|
|
|
g_clear_object (&self->selected_user);
|
|
|
|
|
|
2018-05-31 10:42:09 +12:00
|
|
|
|
g_clear_object (&self->login_screen_settings);
|
2015-02-23 11:47:13 +01:00
|
|
|
|
|
2018-08-15 15:11:09 +02:00
|
|
|
|
g_clear_pointer ((GtkWidget **)&self->language_chooser, gtk_widget_destroy);
|
2018-05-31 10:42:09 +12:00
|
|
|
|
g_clear_object (&self->permission);
|
2012-12-11 11:46:28 +01:00
|
|
|
|
G_OBJECT_CLASS (cc_user_panel_parent_class)->dispose (object);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-18 17:08:52 +02:00
|
|
|
|
static const char *
|
2012-12-11 11:46:28 +01:00
|
|
|
|
cc_user_panel_get_help_uri (CcPanel *panel)
|
2012-05-18 17:08:52 +02:00
|
|
|
|
{
|
|
|
|
|
return "help:gnome-help/user-accounts";
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-30 16:14:30 -04:00
|
|
|
|
static void
|
2012-12-11 11:46:28 +01:00
|
|
|
|
cc_user_panel_class_init (CcUserPanelClass *klass)
|
2010-10-30 16:14:30 -04:00
|
|
|
|
{
|
2018-10-16 11:23:40 +13:00
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
|
|
|
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2012-12-11 11:46:28 +01:00
|
|
|
|
object_class->dispose = cc_user_panel_dispose;
|
2016-07-20 14:20:34 +02:00
|
|
|
|
object_class->constructed = cc_user_panel_constructed;
|
2010-10-30 16:14:30 -04:00
|
|
|
|
|
2012-12-11 11:46:28 +01:00
|
|
|
|
panel_class->get_help_uri = cc_user_panel_get_help_uri;
|
2018-10-16 11:23:40 +13:00
|
|
|
|
|
|
|
|
|
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/user-accounts/cc-user-panel.ui");
|
|
|
|
|
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, accounts_box);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, account_settings_box);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, account_settings_listbox);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, authentication_and_login_listbox);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, account_type_row);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, account_type_switch);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, add_user_button);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, autologin_row);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, autologin_switch);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, carousel);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, fingerprint_state_label);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, fingerprint_row);
|
2020-01-13 12:34:22 +01:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, full_name_stack);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, full_name_label);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, full_name_edit_button);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, full_name_entry);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, language_button_label);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, language_row);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, last_login_button_label);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, last_login_row);
|
2019-11-20 15:14:31 +13:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, no_users_box);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, notification_revealer);
|
2020-03-26 14:20:44 +05:30
|
|
|
|
#ifdef HAVE_MALCONTENT
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, parental_controls_button_label);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, parental_control_go_next);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, parental_controls_row);
|
|
|
|
|
#endif
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, password_button_label);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, password_row);
|
2019-12-19 15:51:38 +01:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, permission_infobar);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, remove_user_button);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, stack);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, user_icon_button);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, user_icon_image);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, user_icon_image2);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, user_icon_stack);
|
2019-11-20 15:14:31 +13:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, CcUserPanel, users_overlay);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, account_type_changed);
|
2020-01-13 15:35:09 +01:00
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, activate_row);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, add_user);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, autologin_changed);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, change_fingerprint);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, change_language);
|
2020-01-13 12:34:22 +01:00
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, full_name_edit_button_toggled);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, full_name_entry_activate);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, full_name_entry_key_press_cb);
|
2018-10-16 11:23:40 +13:00
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, change_password);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, delete_user);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, dismiss_notification);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, restart_now);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, set_selected_user);
|
2010-10-30 16:14:30 -04:00
|
|
|
|
}
|