import gnome-settings-daemon-3.32.0-4.el8

This commit is contained in:
CentOS Sources 2019-11-05 14:37:45 -05:00 committed by Andrew Lukoshko
parent 5dd1d7f399
commit 40908dc720
9 changed files with 18129 additions and 198 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/gnome-settings-daemon-3.28.1.tar.xz
SOURCES/gnome-settings-daemon-3.32.0.tar.xz

View File

@ -1 +1 @@
a9799a2a036b87e13fe814351e392987c6f95dd2 SOURCES/gnome-settings-daemon-3.28.1.tar.xz
92145a7a5714ebf3aeb90baaacb7e6955335731b SOURCES/gnome-settings-daemon-3.32.0.tar.xz

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,183 +0,0 @@
From b7e1d695935ffafdb838b61afa7041c54b3f92bd Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 25 Sep 2018 20:19:39 +0200
Subject: [PATCH] keyboard: Enable ibus for OSK purposes
As gnome-shell relies on IBus for focus tracking, enable this IM whenever
the conditions for OSK popping up might arise.
Closes: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/95
---
plugins/keyboard/gsd-keyboard-manager.c | 75 +++++++++++++++++++++----
1 file changed, 65 insertions(+), 10 deletions(-)
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
index ea67dda1..31bfade7 100644
--- a/plugins/keyboard/gsd-keyboard-manager.c
+++ b/plugins/keyboard/gsd-keyboard-manager.c
@@ -78,11 +78,15 @@
#define DEFAULT_LAYOUT "us"
+#define GNOME_A11Y_APPLICATIONS_INTERFACE_DIR "org.gnome.desktop.a11y.applications"
+#define KEY_OSK_ENABLED "screen-keyboard-enabled"
+
struct GsdKeyboardManagerPrivate
{
guint start_idle_id;
GSettings *settings;
GSettings *input_sources_settings;
+ GSettings *a11y_settings;
GDBusProxy *localed;
GCancellable *cancellable;
@@ -90,12 +94,15 @@ struct GsdKeyboardManagerPrivate
GsdNumLockState old_state;
GdkDeviceManager *device_manager;
guint device_added_id;
+ guint device_removed_id;
};
static void gsd_keyboard_manager_class_init (GsdKeyboardManagerClass *klass);
static void gsd_keyboard_manager_init (GsdKeyboardManager *keyboard_manager);
static void gsd_keyboard_manager_finalize (GObject *object);
+static void update_gtk_im_module (GsdKeyboardManager *manager);
+
G_DEFINE_TYPE (GsdKeyboardManager, gsd_keyboard_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
@@ -363,9 +370,23 @@ device_added_cb (GdkDeviceManager *device_manager,
if (source == GDK_SOURCE_KEYBOARD) {
g_debug ("New keyboard plugged in, applying all settings");
apply_numlock (manager);
+ } else if (source == GDK_SOURCE_TOUCHSCREEN) {
+ update_gtk_im_module (manager);
}
}
+static void
+device_removed_cb (GdkDeviceManager *device_manager,
+ GdkDevice *device,
+ GsdKeyboardManager *manager)
+{
+ GdkInputSource source;
+
+ source = gdk_device_get_source (device);
+ if (source == GDK_SOURCE_TOUCHSCREEN)
+ update_gtk_im_module (manager);
+}
+
static void
set_devicepresence_handler (GsdKeyboardManager *manager)
{
@@ -378,6 +399,8 @@ set_devicepresence_handler (GsdKeyboardManager *manager)
manager->priv->device_added_id = g_signal_connect (G_OBJECT (device_manager), "device-added",
G_CALLBACK (device_added_cb), manager);
+ manager->priv->device_removed_id = g_signal_connect (G_OBJECT (device_manager), "device-removed",
+ G_CALLBACK (device_removed_cb), manager);
manager->priv->device_manager = device_manager;
}
@@ -395,14 +418,37 @@ need_ibus (GVariant *sources)
return FALSE;
}
+static gboolean
+need_osk (GsdKeyboardManager *manager)
+{
+ GSettings *a11y_settings;
+ gboolean has_touchscreen = FALSE;
+ GList *devices, *l;
+ GdkSeat *seat;
+
+ if (g_settings_get_boolean (manager->priv->a11y_settings,
+ KEY_OSK_ENABLED))
+ return TRUE;
+
+ seat = gdk_display_get_default_seat (gdk_display_get_default ());
+ devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_TOUCH);
+
+ has_touchscreen = devices != NULL;
+
+ g_list_free (devices);
+
+ return has_touchscreen;
+}
+
static void
-set_gtk_im_module (GSettings *settings,
- GVariant *sources)
+set_gtk_im_module (GsdKeyboardManager *manager,
+ GSettings *settings,
+ GVariant *sources)
{
const gchar *new_module;
gchar *current_module;
- if (need_ibus (sources))
+ if (need_ibus (sources) || need_osk (manager))
new_module = GTK_IM_MODULE_IBUS;
else
new_module = GTK_IM_MODULE_SIMPLE;
@@ -414,20 +460,20 @@ set_gtk_im_module (GSettings *settings,
}
static void
-input_sources_changed (GSettings *settings,
- const char *key,
- GsdKeyboardManager *manager)
+update_gtk_im_module (GsdKeyboardManager *manager)
{
GSettings *interface_settings;
GVariant *sources;
+
/* Gtk+ uses the IM module advertised in XSETTINGS so, if we
* have IBus input sources, we want it to load that
* module. Otherwise we can use the default "simple" module
* which is builtin gtk+
*/
- sources = g_settings_get_value (settings, KEY_INPUT_SOURCES);
interface_settings = g_settings_new (GNOME_DESKTOP_INTERFACE_DIR);
- set_gtk_im_module (interface_settings, sources);
+ sources = g_settings_get_value (manager->priv->input_sources_settings,
+ KEY_INPUT_SOURCES);
+ set_gtk_im_module (manager, interface_settings, sources);
g_object_unref (interface_settings);
g_variant_unref (sources);
}
@@ -686,8 +732,15 @@ start_keyboard_idle_cb (GsdKeyboardManager *manager)
set_devicepresence_handler (manager);
manager->priv->input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR);
- g_signal_connect (manager->priv->input_sources_settings, "changed::"KEY_INPUT_SOURCES,
- G_CALLBACK (input_sources_changed), manager);
+ g_signal_connect_swapped (manager->priv->input_sources_settings,
+ "changed::" KEY_INPUT_SOURCES,
+ G_CALLBACK (update_gtk_im_module), manager);
+
+ manager->priv->a11y_settings = g_settings_new (GNOME_A11Y_APPLICATIONS_INTERFACE_DIR);
+ g_signal_connect_swapped (manager->priv->a11y_settings,
+ "changed::" KEY_OSK_ENABLED,
+ G_CALLBACK (update_gtk_im_module), manager);
+ update_gtk_im_module (manager);
manager->priv->cancellable = g_cancellable_new ();
@@ -750,10 +803,12 @@ gsd_keyboard_manager_stop (GsdKeyboardManager *manager)
g_clear_object (&p->settings);
g_clear_object (&p->input_sources_settings);
+ g_clear_object (&p->a11y_settings);
g_clear_object (&p->localed);
if (p->device_manager != NULL) {
g_signal_handler_disconnect (p->device_manager, p->device_added_id);
+ g_signal_handler_disconnect (p->device_manager, p->device_removed_id);
p->device_manager = NULL;
}
--
2.19.2

View File

@ -0,0 +1,271 @@
From ad0fd6c905011b7bb9eac9fa8cb91f58d71e4a29 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 6 Nov 2017 15:49:58 -0500
Subject: [PATCH 2/4] account: reshow the notification when screen unlocks
---
plugins/account/gsd-account-manager.c | 48 ++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 5 deletions(-)
diff --git a/plugins/account/gsd-account-manager.c b/plugins/account/gsd-account-manager.c
index 40b91cb6..cb37f466 100644
--- a/plugins/account/gsd-account-manager.c
+++ b/plugins/account/gsd-account-manager.c
@@ -11,72 +11,75 @@
* 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/>.
*
*/
#include "config.h"
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <locale.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <cups/cups.h>
#include <cups/ppd.h>
#include <libnotify/notify.h>
#include "gnome-settings-profile.h"
+#include "gnome-settings-bus.h"
#include "gsd-account-manager.h"
#include "org.freedesktop.Accounts.h"
#include "org.freedesktop.Accounts.User.h"
#define GSD_ACCOUNT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_ACCOUNT_MANAGER, GsdAccountManagerPrivate))
struct GsdAccountManagerPrivate
{
GsdAccounts *accounts_proxy;
GsdAccountsUser *accounts_user_proxy;
GCancellable *cancellable;
+ GsdScreenSaver *screensaver_proxy;
+
gint64 expiration_time;
gint64 last_change_time;
gint64 min_days_between_changes;
gint64 max_days_between_changes;
gint64 days_to_warn;
gint64 days_after_expiration_until_lock;
NotifyNotification *notification;
};
static void gsd_account_manager_class_init (GsdAccountManagerClass *klass);
static void gsd_account_manager_init (GsdAccountManager *account_manager);
static void gsd_account_manager_finalize (GObject *object);
G_DEFINE_TYPE (GsdAccountManager, gsd_account_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
static void
on_notification_closed (NotifyNotification *notification,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_clear_object (&manager->priv->notification);
}
static void
hide_notification (GsdAccountManager *manager)
{
@@ -221,77 +224,111 @@ on_got_password_expiration_policy (GsdAccountsUser *accounts_user_proxy,
gint64 days_after_expiration_until_lock;
gnome_settings_profile_start (NULL);
succeeded = gsd_accounts_user_call_get_password_expiration_policy_finish (accounts_user_proxy,
&expiration_time,
&last_change_time,
&min_days_between_changes,
&max_days_between_changes,
&days_to_warn,
&days_after_expiration_until_lock,
res,
&error);
if (!succeeded) {
g_warning ("Failed to get password expiration policy for user: %s", error->message);
goto out;
}
set_policy_number (&manager->priv->expiration_time, expiration_time);
set_policy_number (&manager->priv->last_change_time, last_change_time);
set_policy_number (&manager->priv->min_days_between_changes, min_days_between_changes);
set_policy_number (&manager->priv->max_days_between_changes, max_days_between_changes);
set_policy_number (&manager->priv->days_to_warn, days_to_warn);
set_policy_number (&manager->priv->days_after_expiration_until_lock, days_after_expiration_until_lock);
update_password_notification (manager);
out:
gnome_settings_profile_end (NULL);
}
+static void
+fetch_password_expiration_policy (GsdAccountManager *manager)
+{
+ gsd_accounts_user_call_get_password_expiration_policy (manager->priv->accounts_user_proxy,
+ manager->priv->cancellable,
+ (GAsyncReadyCallback)
+ on_got_password_expiration_policy,
+ manager);
+}
+
+static void
+on_screensaver_signal (GDBusProxy *proxy,
+ const gchar *sender_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ GsdAccountManager *manager = user_data;
+
+ if (g_strcmp0 (signal_name, "ActiveChanged") == 0) {
+ gboolean active;
+
+ g_variant_get (parameters, "(b)", &active);
+
+ if (!active) {
+ fetch_password_expiration_policy (manager);
+ }
+ }
+}
+
static void
on_got_accounts_user_proxy (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_autoptr(GError) error = NULL;
gnome_settings_profile_start (NULL);
manager->priv->accounts_user_proxy = gsd_accounts_user_proxy_new_finish (res, &error);
if (manager->priv->accounts_user_proxy != NULL) {
- gsd_accounts_user_call_get_password_expiration_policy (manager->priv->accounts_user_proxy,
- manager->priv->cancellable,
- (GAsyncReadyCallback)
- on_got_password_expiration_policy,
- manager);
+ fetch_password_expiration_policy (manager);
+
+ manager->priv->screensaver_proxy = gnome_settings_bus_get_screen_saver_proxy ();
+
+ g_signal_connect (manager->priv->screensaver_proxy,
+ "g-signal",
+ G_CALLBACK (on_screensaver_signal),
+ manager);
+
} else {
g_warning ("Failed to get user proxy to accounts service: %s", error->message);
goto out;
}
out:
gnome_settings_profile_end (NULL);
}
static void
on_got_user_object_path (GsdAccounts *accounts_proxy,
GAsyncResult *res,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_autoptr(GError) error = NULL;
gboolean succeeded;
gchar *object_path;
GDBusConnection *connection;
gnome_settings_profile_start (NULL);
succeeded = gsd_accounts_call_find_user_by_id_finish (accounts_proxy,
&object_path,
res,
&error);
if (!succeeded) {
g_warning ("Unable to find current user in accounts service: %s",
error->message);
@@ -343,60 +380,61 @@ gsd_account_manager_start (GsdAccountManager *manager,
g_debug ("Starting accounts manager");
gnome_settings_profile_start (NULL);
manager->priv->cancellable = g_cancellable_new ();
gsd_accounts_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.Accounts",
"/org/freedesktop/Accounts",
manager->priv->cancellable,
(GAsyncReadyCallback)
on_got_accounts_proxy,
manager);
gnome_settings_profile_end (NULL);
return TRUE;
}
void
gsd_account_manager_stop (GsdAccountManager *manager)
{
g_debug ("Stopping accounts manager");
if (manager->priv->cancellable != NULL) {
g_cancellable_cancel (manager->priv->cancellable);
g_clear_object (&manager->priv->cancellable);
}
g_clear_object (&manager->priv->accounts_proxy);
g_clear_object (&manager->priv->accounts_user_proxy);
g_clear_object (&manager->priv->notification);
+ g_clear_object (&manager->priv->screensaver_proxy);
}
static void
gsd_account_manager_class_init (GsdAccountManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gsd_account_manager_finalize;
notify_init ("gnome-settings-daemon");
g_type_class_add_private (klass, sizeof (GsdAccountManagerPrivate));
}
static void
gsd_account_manager_init (GsdAccountManager *manager)
{
manager->priv = GSD_ACCOUNT_MANAGER_GET_PRIVATE (manager);
}
static void
gsd_account_manager_finalize (GObject *object)
{
GsdAccountManager *manager;
g_return_if_fail (object != NULL);
g_return_if_fail (GSD_IS_ACCOUNT_MANAGER (object));
manager = GSD_ACCOUNT_MANAGER (object);
--
2.21.0

View File

@ -0,0 +1,451 @@
From 31844edad70876e26ab995179bc67fb3b23a1793 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 6 Nov 2017 16:39:55 -0500
Subject: [PATCH 3/4] account: display nag screen periodically
This is configurable via a gsettings key.
---
data/meson.build | 1 +
...ings-daemon.plugins.account.gschema.xml.in | 9 +++
plugins/account/gsd-account-manager.c | 55 +++++++++++++++++++
3 files changed, 65 insertions(+)
create mode 100644 data/org.gnome.settings-daemon.plugins.account.gschema.xml.in
diff --git a/data/meson.build b/data/meson.build
index e93ba641..5a2cd5a7 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,36 +1,37 @@
data_inc = include_directories('.')
schemas = [
'org.gnome.settings-daemon.peripherals.gschema.xml',
'org.gnome.settings-daemon.peripherals.wacom.gschema.xml',
'org.gnome.settings-daemon.plugins.gschema.xml',
+ 'org.gnome.settings-daemon.plugins.account.gschema.xml',
'org.gnome.settings-daemon.plugins.color.gschema.xml',
'org.gnome.settings-daemon.plugins.housekeeping.gschema.xml',
'org.gnome.settings-daemon.plugins.media-keys.gschema.xml',
'org.gnome.settings-daemon.plugins.power.gschema.xml',
'org.gnome.settings-daemon.plugins.sharing.gschema.xml',
'org.gnome.settings-daemon.plugins.xsettings.gschema.xml'
]
schema_conf = configuration_data()
schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
schemas_xml = []
foreach schema: schemas
schemas_xml += [configure_file(
input: schema + '.in',
output: schema,
configuration: schema_conf,
install: true,
install_dir: gsd_schemadir
)]
endforeach
enums_header = files('gsd-enums.h')
mkenums = gnome.mkenums(
'org.gnome.settings-daemon.enums.xml',
sources: enums_header,
comments: '<!-- @comment@ -->',
fhead: '<schemalist>',
vhead: ' <@type@ id="org.gnome.settings-daemon.@EnumName@">',
diff --git a/data/org.gnome.settings-daemon.plugins.account.gschema.xml.in b/data/org.gnome.settings-daemon.plugins.account.gschema.xml.in
new file mode 100644
index 00000000..f3d59e81
--- /dev/null
+++ b/data/org.gnome.settings-daemon.plugins.account.gschema.xml.in
@@ -0,0 +1,9 @@
+<schemalist>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.account" path="/org/gnome/settings-daemon/plugins/account/">
+ <key name="notify-period" type="i">
+ <default>1440</default>
+ <summary>Time before repeated warning about account password expiration</summary>
+ <description>If a user's account is expiring, a notification will get displayed periodically after the specified number of minutes</description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/plugins/account/gsd-account-manager.c b/plugins/account/gsd-account-manager.c
index cb37f466..ff054edd 100644
--- a/plugins/account/gsd-account-manager.c
+++ b/plugins/account/gsd-account-manager.c
@@ -20,126 +20,135 @@
#include "config.h"
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <locale.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <cups/cups.h>
#include <cups/ppd.h>
#include <libnotify/notify.h>
#include "gnome-settings-profile.h"
#include "gnome-settings-bus.h"
#include "gsd-account-manager.h"
#include "org.freedesktop.Accounts.h"
#include "org.freedesktop.Accounts.User.h"
#define GSD_ACCOUNT_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_ACCOUNT_MANAGER, GsdAccountManagerPrivate))
struct GsdAccountManagerPrivate
{
+ GSettings *settings;
+
GsdAccounts *accounts_proxy;
GsdAccountsUser *accounts_user_proxy;
GCancellable *cancellable;
GsdScreenSaver *screensaver_proxy;
gint64 expiration_time;
gint64 last_change_time;
gint64 min_days_between_changes;
gint64 max_days_between_changes;
gint64 days_to_warn;
gint64 days_after_expiration_until_lock;
NotifyNotification *notification;
+
+ gint64 last_notify_time;
+ int notify_period;
+ guint notify_period_timeout_id;
};
static void gsd_account_manager_class_init (GsdAccountManagerClass *klass);
static void gsd_account_manager_init (GsdAccountManager *account_manager);
static void gsd_account_manager_finalize (GObject *object);
+static void fetch_password_expiration_policy (GsdAccountManager *manager);
G_DEFINE_TYPE (GsdAccountManager, gsd_account_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
static void
on_notification_closed (NotifyNotification *notification,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_clear_object (&manager->priv->notification);
}
static void
hide_notification (GsdAccountManager *manager)
{
if (manager->priv->notification == NULL)
return;
notify_notification_close (manager->priv->notification, NULL);
g_clear_object (&manager->priv->notification);
}
static void
show_notification (GsdAccountManager *manager,
const char *primary_text,
const char *secondary_text)
{
g_assert (manager->priv->notification == NULL);
manager->priv->notification = notify_notification_new (primary_text,
secondary_text,
"avatar-default-symbolic");
notify_notification_set_app_name (manager->priv->notification, _("User Account"));
notify_notification_set_hint (manager->priv->notification,
"resident",
g_variant_new_boolean (TRUE));
notify_notification_set_timeout (manager->priv->notification,
NOTIFY_EXPIRES_NEVER);
g_signal_connect (manager->priv->notification,
"closed",
G_CALLBACK (on_notification_closed),
manager);
notify_notification_show (manager->priv->notification, NULL);
+
+ manager->priv->last_notify_time = g_get_monotonic_time ();
}
static void
update_password_notification (GsdAccountManager *manager)
{
gint64 days_since_epoch;
gint64 days_until_expiration = -1;
gint64 days_since_last_change = -1;
gint64 days_left = -1;
g_autofree char *primary_text = NULL;
g_autofree char *secondary_text = NULL;
gboolean password_already_expired = FALSE;
hide_notification (manager);
days_since_epoch = g_get_real_time () / G_USEC_PER_SEC / 60 / 60 / 24;
if (manager->priv->expiration_time > 0) {
days_until_expiration = manager->priv->expiration_time - days_since_epoch;
if (days_until_expiration <= 0) {
password_already_expired = TRUE;
goto out;
}
}
if (manager->priv->last_change_time == 0) {
password_already_expired = TRUE;
goto out;
}
@@ -181,99 +190,127 @@ out:
primary_text = g_strdup_printf (_("Password Expired"));
secondary_text = g_strdup_printf (_("Your password is expired. Please update it."));
} else if (days_left >= 0) {
primary_text = g_strdup_printf (_("Password Expiring Soon"));
if (days_left == 0)
secondary_text = g_strdup_printf (_("Your password is expiring today."));
else if (days_left == 1)
secondary_text = g_strdup_printf (_("Your password is expiring in a day."));
else
secondary_text = g_strdup_printf (_("Your password is expiring in %ld days."),
days_left);
}
if (primary_text != NULL && secondary_text != NULL)
show_notification (manager,
primary_text,
secondary_text);
}
static gboolean
set_policy_number (gint64 *destination,
gint64 source)
{
if (*destination == source)
return FALSE;
*destination = source;
return TRUE;
}
+static gboolean
+on_notify_period_elapsed (GsdAccountManager *manager)
+{
+ manager->priv->notify_period_timeout_id = 0;
+ fetch_password_expiration_policy (manager);
+ return G_SOURCE_REMOVE;
+}
+
+static void
+queue_periodic_timeout (GsdAccountManager *manager)
+{
+ if (manager->priv->notify_period_timeout_id != 0) {
+ g_source_remove (manager->priv->notify_period_timeout_id);
+ manager->priv->notify_period_timeout_id = 0;
+ }
+
+ if (manager->priv->notify_period > 0) {
+ gint64 already_elapsed_time;
+
+ already_elapsed_time = MAX (0, (g_get_monotonic_time () - manager->priv->last_notify_time) / G_USEC_PER_SEC);
+
+ manager->priv->notify_period_timeout_id = g_timeout_add_seconds (MAX (0, manager->priv->notify_period * 60 - already_elapsed_time),
+ (GSourceFunc) on_notify_period_elapsed,
+ manager);
+ }
+}
+
static void
on_got_password_expiration_policy (GsdAccountsUser *accounts_user_proxy,
GAsyncResult *res,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_autoptr(GError) error = NULL;
gboolean succeeded;
gint64 expiration_time;
gint64 last_change_time;
gint64 min_days_between_changes;
gint64 max_days_between_changes;
gint64 days_to_warn;
gint64 days_after_expiration_until_lock;
gnome_settings_profile_start (NULL);
succeeded = gsd_accounts_user_call_get_password_expiration_policy_finish (accounts_user_proxy,
&expiration_time,
&last_change_time,
&min_days_between_changes,
&max_days_between_changes,
&days_to_warn,
&days_after_expiration_until_lock,
res,
&error);
if (!succeeded) {
g_warning ("Failed to get password expiration policy for user: %s", error->message);
goto out;
}
set_policy_number (&manager->priv->expiration_time, expiration_time);
set_policy_number (&manager->priv->last_change_time, last_change_time);
set_policy_number (&manager->priv->min_days_between_changes, min_days_between_changes);
set_policy_number (&manager->priv->max_days_between_changes, max_days_between_changes);
set_policy_number (&manager->priv->days_to_warn, days_to_warn);
set_policy_number (&manager->priv->days_after_expiration_until_lock, days_after_expiration_until_lock);
update_password_notification (manager);
+ queue_periodic_timeout (manager);
out:
gnome_settings_profile_end (NULL);
}
static void
fetch_password_expiration_policy (GsdAccountManager *manager)
{
gsd_accounts_user_call_get_password_expiration_policy (manager->priv->accounts_user_proxy,
manager->priv->cancellable,
(GAsyncReadyCallback)
on_got_password_expiration_policy,
manager);
}
static void
on_screensaver_signal (GDBusProxy *proxy,
const gchar *sender_name,
const gchar *signal_name,
GVariant *parameters,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
if (g_strcmp0 (signal_name, "ActiveChanged") == 0) {
gboolean active;
g_variant_get (parameters, "(b)", &active);
if (!active) {
fetch_password_expiration_policy (manager);
@@ -346,91 +383,109 @@ on_got_user_object_path (GsdAccounts *accounts_proxy,
manager);
out:
gnome_settings_profile_end (NULL);
}
static void
on_got_accounts_proxy (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_autoptr(GError) error = NULL;
gnome_settings_profile_start (NULL);
manager->priv->accounts_proxy = gsd_accounts_proxy_new_for_bus_finish (res, &error);
if (manager->priv->accounts_proxy != NULL) {
gsd_accounts_call_find_user_by_id (manager->priv->accounts_proxy,
getuid (),
manager->priv->cancellable,
(GAsyncReadyCallback)
on_got_user_object_path,
manager);
} else {
g_warning ("Failed to get proxy to accounts service: %s", error->message);
}
gnome_settings_profile_end (NULL);
}
+static void
+on_notify_period_changed (GsdAccountManager *manager)
+{
+ manager->priv->notify_period = g_settings_get_int (manager->priv->settings, "notify-period");
+
+ queue_periodic_timeout (manager);
+}
+
gboolean
gsd_account_manager_start (GsdAccountManager *manager,
GError **error)
{
g_debug ("Starting accounts manager");
gnome_settings_profile_start (NULL);
manager->priv->cancellable = g_cancellable_new ();
+ manager->priv->settings = g_settings_new ("org.gnome.settings-daemon.plugins.account");
+
+ manager->priv->notify_period = g_settings_get_int (manager->priv->settings, "notify-period");
+ g_signal_connect_object (G_OBJECT (manager->priv->settings),
+ "changed::notify-period",
+ G_CALLBACK (on_notify_period_changed),
+ manager,
+ G_CONNECT_SWAPPED);
+
gsd_accounts_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.Accounts",
"/org/freedesktop/Accounts",
manager->priv->cancellable,
(GAsyncReadyCallback)
on_got_accounts_proxy,
manager);
gnome_settings_profile_end (NULL);
return TRUE;
}
void
gsd_account_manager_stop (GsdAccountManager *manager)
{
g_debug ("Stopping accounts manager");
if (manager->priv->cancellable != NULL) {
g_cancellable_cancel (manager->priv->cancellable);
g_clear_object (&manager->priv->cancellable);
}
+ g_clear_object (&manager->priv->settings);
g_clear_object (&manager->priv->accounts_proxy);
g_clear_object (&manager->priv->accounts_user_proxy);
g_clear_object (&manager->priv->notification);
g_clear_object (&manager->priv->screensaver_proxy);
}
static void
gsd_account_manager_class_init (GsdAccountManagerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gsd_account_manager_finalize;
notify_init ("gnome-settings-daemon");
g_type_class_add_private (klass, sizeof (GsdAccountManagerPrivate));
}
static void
gsd_account_manager_init (GsdAccountManager *manager)
{
manager->priv = GSD_ACCOUNT_MANAGER_GET_PRIVATE (manager);
}
static void
gsd_account_manager_finalize (GObject *object)
{
GsdAccountManager *manager;
g_return_if_fail (object != NULL);
--
2.21.0

View File

@ -0,0 +1,110 @@
From ff98c03c88e53041dcc861de3b3a3351d55297fe Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 9 Nov 2018 10:39:11 -0500
Subject: [PATCH 4/4] account: don't poll more frequently than notification
period
At the moment, if an account has no reason to receive a notification,
the account plugin ends up polling continuously, desperately,
and unsuccessfully trying to find a reason to notify. That leads
to unnecessary CPU utilization.
The reason is an apparent think-o in the code. The code tracks
the last time a notification was shown, so it knows when to show
the next notification later, even if the notification period, or
account policy is updated by the admin in the interim.
The problem is that it's wrong to look at the last notification
time if there's no reason to show a notification. In that case
the wakeup is merely to poll updates on the account policy.
This commit addresses the problem by only looking at the previous
notification time, if it was within the current notification period.
---
plugins/account/gsd-account-manager.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/plugins/account/gsd-account-manager.c b/plugins/account/gsd-account-manager.c
index ff054edd..b48c0fe8 100644
--- a/plugins/account/gsd-account-manager.c
+++ b/plugins/account/gsd-account-manager.c
@@ -207,65 +207,73 @@ out:
}
static gboolean
set_policy_number (gint64 *destination,
gint64 source)
{
if (*destination == source)
return FALSE;
*destination = source;
return TRUE;
}
static gboolean
on_notify_period_elapsed (GsdAccountManager *manager)
{
manager->priv->notify_period_timeout_id = 0;
fetch_password_expiration_policy (manager);
return G_SOURCE_REMOVE;
}
static void
queue_periodic_timeout (GsdAccountManager *manager)
{
if (manager->priv->notify_period_timeout_id != 0) {
g_source_remove (manager->priv->notify_period_timeout_id);
manager->priv->notify_period_timeout_id = 0;
}
if (manager->priv->notify_period > 0) {
- gint64 already_elapsed_time;
+ gint64 seconds_since_last_notification;
+ guint seconds_between_notifications;
+ guint seconds_until_next_notification;
- already_elapsed_time = MAX (0, (g_get_monotonic_time () - manager->priv->last_notify_time) / G_USEC_PER_SEC);
+ seconds_since_last_notification = MAX (0, (g_get_monotonic_time () - manager->priv->last_notify_time) / G_USEC_PER_SEC);
+ seconds_between_notifications = manager->priv->notify_period * 60;
- manager->priv->notify_period_timeout_id = g_timeout_add_seconds (MAX (0, manager->priv->notify_period * 60 - already_elapsed_time),
+ if (seconds_since_last_notification > seconds_between_notifications)
+ seconds_until_next_notification = seconds_between_notifications;
+ else
+ seconds_until_next_notification = seconds_between_notifications - seconds_since_last_notification;
+
+ manager->priv->notify_period_timeout_id = g_timeout_add_seconds (seconds_until_next_notification,
(GSourceFunc) on_notify_period_elapsed,
manager);
}
}
static void
on_got_password_expiration_policy (GsdAccountsUser *accounts_user_proxy,
GAsyncResult *res,
gpointer user_data)
{
GsdAccountManager *manager = user_data;
g_autoptr(GError) error = NULL;
gboolean succeeded;
gint64 expiration_time;
gint64 last_change_time;
gint64 min_days_between_changes;
gint64 max_days_between_changes;
gint64 days_to_warn;
gint64 days_after_expiration_until_lock;
gnome_settings_profile_start (NULL);
succeeded = gsd_accounts_user_call_get_password_expiration_policy_finish (accounts_user_proxy,
&expiration_time,
&last_change_time,
&min_days_between_changes,
&max_days_between_changes,
&days_to_warn,
&days_after_expiration_until_lock,
res,
&error);
--
2.21.0

View File

@ -1,26 +1,25 @@
%global glib2_version 2.53.0
%global gtk3_version 3.15.3
%global gnome_desktop_version 3.27.90
%global libgweather_version 3.9.5
%global gsettings_desktop_schemas_version 3.23.3
%global glib2_version 2.56
%global geocode_glib_version 3.10.0
%global gnome_desktop_version 3.27.90
%global gsettings_desktop_schemas_version 3.27.90
%global gtk3_version 3.15.3
%global libgweather_version 3.9.5
%global geoclue_version 2.3.1
Name: gnome-settings-daemon
Version: 3.28.1
Release: 2%{?dist}
Version: 3.32.0
Release: 4%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
License: GPLv2+
URL: https://download.gnome.org/sources/%{name}
Source0: https://download.gnome.org/sources/%{name}/3.28/%{name}-%{version}.tar.xz
Source0: https://download.gnome.org/sources/%{name}/3.32/%{name}-%{version}.tar.xz
Source1: org.gnome.settings-daemon.plugins.power.gschema.override
Patch0: 0001-keyboard-Enable-ibus-for-OSK-purposes.patch
BuildRequires: meson >= 0.44.0
BuildRequires: gcc
BuildRequires: cups-devel
BuildRequires: gettext
BuildRequires: meson
BuildRequires: perl-interpreter
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(colord) >= 1.0.2
@ -46,7 +45,6 @@ BuildRequires: pkgconfig(polkit-gobject-1)
BuildRequires: pkgconfig(upower-glib)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xi)
BuildRequires: pkgconfig(xtst)
BuildRequires: pkgconfig(wayland-client)
%ifnarch s390 s390x
BuildRequires: pkgconfig(libwacom) >= 0.7
@ -77,6 +75,13 @@ Conflicts: gnome-session < 3.27.90
# older gdm, gnome-session and gnome-shell releases that expect the functionality
Conflicts: gnome-shell < 3.25.4
Patch00001: 0001-account-first-cut-at-account-plugin.patch
Patch00002: 0002-account-reshow-the-notification-when-screen-unlocks.patch
Patch00003: 0003-account-display-nag-screen-periodically.patch
Patch00004: 0004-account-don-t-poll-more-frequently-than-notification.patch
Patch10001: 0001-housekeeping-Add-a-GPU-memory-usage-notification.patch
%description
A daemon to share settings from GNOME to other applications. It also
handles global keybindings, as well as a number of desktop-wide settings.
@ -111,6 +116,10 @@ mkdir $RPM_BUILD_ROOT%{_libdir}/gnome-settings-daemon-3.0/gtk-modules
# list daemons explicitly, so we notice if one goes missing
# some of these don't have a separate gschema
%{_libexecdir}/gsd-account
%{_sysconfdir}/xdg/autostart/org.gnome.SettingsDaemon.Account.desktop
%{_datadir}/glib-2.0/schemas/org.gnome.settings-daemon.plugins.account.gschema.xml
%{_libexecdir}/gsd-clipboard
%{_sysconfdir}/xdg/autostart/org.gnome.SettingsDaemon.Clipboard.desktop
@ -195,9 +204,24 @@ mkdir $RPM_BUILD_ROOT%{_libdir}/gnome-settings-daemon-3.0/gtk-modules
%files devel
%{_includedir}/gnome-settings-daemon-3.0
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
%{_libexecdir}/gsd-test-input-helper
%changelog
* Tue Jul 09 2019 Richard Hughes <rhughes@redhat.com> - 3.32.0-4
- Remove the subman plugin -- move to a 8.2 feature instead.
- Resolves: #1720249
* Mon Jun 17 2019 Richard Hughes <rhughes@redhat.com> - 3.32.0-3
- Add a new plugin to provide system subscription information
- Resolves: #1720249
* Mon Jun 10 2019 Ray Strode <rstrode@redhat.com> - 3.32.0-2
- Add dropped patches
Related: #1674382
* Thu May 23 2019 Florian Müllner <fmuellner@redhat.com> - 3.32.0-1
- Update to 3.32.0
Resolves: #1698929
* Mon Jan 14 2019 Carlos Garnacho <cgarnach@redhat.com> - 3.28.1-2
- Enable IBus for OSK purposes, necessary for focus tracking
Resolves: #1626105