gnome-control-center/panels/user-accounts/um-carousel.h
Ondrej Holy 4e43bd6ce8 user-accounts: Prevent crashes if current user is not in carousel
In a specific cases, current user doesn't have to be returned from
accountsservice, or can be skipped by act_user_is_system_account check.
System users should not be shown. This is expected for root account,
but should not happen with regular user accounts. It needs to be fixed
in accountsservice if you see this happening with regular user accounts.
We have to be just sure that Users panel doesn't crash in such cases
and show all non-system user accounts returned from accountsservice.
Empty page is shown currently only if act_user_manager_list_users
returns nothing, but it has to be also shown if only system accounts
are returned. To fix this issue, do not try to show current user, but
show first user account in carousel instead if there is any. First user
account is current user in normal case.

The patch also fixes problems that current user account is sometimes
selected instead of currently selected user account. This is because
of preselection of first item in um_carousel_add, which causes unwanted
signal emissions...

https://bugzilla.gnome.org/show_bug.cgi?id=773673
2018-02-02 13:40:37 +01:00

53 lines
1.7 KiB
C

/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright 2016 (c) 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
* the Free Software Foundation; either version 2 of the License, or
* (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
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Author: Felipe Borges <felipeborges@gnome.org>
*/
#ifndef UM_CAROUSEL_H
#define UM_CAROUSEL_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define UM_TYPE_CAROUSEL_ITEM (um_carousel_item_get_type ())
G_DECLARE_FINAL_TYPE (UmCarouselItem, um_carousel_item, UM, CAROUSEL_ITEM, GtkRadioButton)
#define UM_TYPE_CAROUSEL (um_carousel_get_type())
G_DECLARE_FINAL_TYPE (UmCarousel, um_carousel, UM, CAROUSEL, GtkRevealer)
GtkWidget *um_carousel_item_new (void);
UmCarousel *um_carousel_new (void);
void um_carousel_purge_items (UmCarousel *self);
UmCarouselItem *um_carousel_find_item (UmCarousel *self,
gconstpointer data,
GCompareFunc func);
void um_carousel_select_item (UmCarousel *self,
UmCarouselItem *item);
guint um_carousel_get_item_count (UmCarousel *self);
G_END_DECLS
#endif /* UM_CAROUSEL_H */