|
|
|
@ -1,7 +1,68 @@
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/meson.build gnome-settings-daemon-3.32.0/meson.build
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/meson.build 2019-06-17 13:01:46.867338656 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/meson.build 2019-06-17 13:01:59.245311865 +0100
|
|
|
|
|
@@ -97,6 +97,7 @@ libcanberra_gtk_dep = dependency('libcan
|
|
|
|
|
From bee6d42503ec9b56f6e10704db02bcedb6a4fdf1 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Richard Hughes <rhughes@redhat.com>
|
|
|
|
|
Date: Thu, 20 Aug 2020 11:16:09 -0400
|
|
|
|
|
Subject: [PATCH 01/15] subman: Add a new plugin to provide system subscription
|
|
|
|
|
registration
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
meson.build | 1 +
|
|
|
|
|
plugins/meson.build | 1 +
|
|
|
|
|
plugins/subman/README.md | 56 +
|
|
|
|
|
plugins/subman/gsd-subman-common.c | 36 +
|
|
|
|
|
plugins/subman/gsd-subman-common.h | 40 +
|
|
|
|
|
plugins/subman/gsd-subman-helper.c | 378 +++++++
|
|
|
|
|
plugins/subman/gsd-subscription-manager.c | 982 ++++++++++++++++++
|
|
|
|
|
plugins/subman/gsd-subscription-manager.h | 63 ++
|
|
|
|
|
plugins/subman/main.c | 8 +
|
|
|
|
|
plugins/subman/meson.build | 56 +
|
|
|
|
|
...ome.SettingsDaemon.Subscription.desktop.in | 9 +
|
|
|
|
|
...ettings-daemon.plugins.subman.policy.in.in | 27 +
|
|
|
|
|
...gnome.settings-daemon.plugins.subman.rules | 7 +
|
|
|
|
|
13 files changed, 1664 insertions(+)
|
|
|
|
|
create mode 100644 plugins/subman/README.md
|
|
|
|
|
create mode 100644 plugins/subman/gsd-subman-common.c
|
|
|
|
|
create mode 100644 plugins/subman/gsd-subman-common.h
|
|
|
|
|
create mode 100644 plugins/subman/gsd-subman-helper.c
|
|
|
|
|
create mode 100644 plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
create mode 100644 plugins/subman/gsd-subscription-manager.h
|
|
|
|
|
create mode 100644 plugins/subman/main.c
|
|
|
|
|
create mode 100644 plugins/subman/meson.build
|
|
|
|
|
create mode 100644 plugins/subman/org.gnome.SettingsDaemon.Subscription.desktop.in
|
|
|
|
|
create mode 100644 plugins/subman/org.gnome.settings-daemon.plugins.subman.policy.in.in
|
|
|
|
|
create mode 100644 plugins/subman/org.gnome.settings-daemon.plugins.subman.rules
|
|
|
|
|
|
|
|
|
|
diff --git a/meson.build b/meson.build
|
|
|
|
|
index 1632ea05..27bf8c4c 100644
|
|
|
|
|
--- a/meson.build
|
|
|
|
|
+++ b/meson.build
|
|
|
|
|
@@ -70,60 +70,61 @@ if gsd_buildtype.contains('debug')
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
compiler_flags = cc.get_supported_arguments(test_cflags)
|
|
|
|
|
elif gsd_buildtype.contains('release')
|
|
|
|
|
common_flags += ['-DG_DISABLE_CAST_CHECKS']
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Workaround for meson's bug
|
|
|
|
|
# https://github.com/mesonbuild/meson/pull/1896
|
|
|
|
|
if get_option('b_ndebug') == true
|
|
|
|
|
common_flags += ['-DG_DISABLE_ASSERT']
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
add_project_arguments(common_flags + compiler_flags, language: 'c')
|
|
|
|
|
|
|
|
|
|
glib_dep = dependency('glib-2.0', version: '>= 2.56')
|
|
|
|
|
colord_dep = dependency('colord', version: '>= 1.0.2')
|
|
|
|
|
geocode_glib_dep = dependency('geocode-glib-1.0', version: '>= 3.10.0')
|
|
|
|
|
gio_dep = dependency('gio-2.0', version: '>= 2.53.0')
|
|
|
|
|
gio_unix_dep = dependency('gio-unix-2.0')
|
|
|
|
|
gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 3.11.1')
|
|
|
|
|
gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 3.27.90')
|
|
|
|
|
gtk_dep = dependency('gtk+-3.0', version: '>= 3.15.3')
|
|
|
|
|
gtk_x11_dep = dependency('gtk+-x11-3.0')
|
|
|
|
|
gweather_dep = dependency('gweather-3.0', version: '>= 3.9.5')
|
|
|
|
|
lcms_dep = dependency('lcms2', version: '>= 2.2')
|
|
|
|
|
libcanberra_gtk_dep = dependency('libcanberra-gtk3')
|
|
|
|
|
libgeoclue_dep = dependency('libgeoclue-2.0', version: '>= 2.3.1')
|
|
|
|
|
libnotify_dep = dependency('libnotify', version: '>= 0.7.3')
|
|
|
|
|
libpulse_mainloop_glib_dep = dependency('libpulse-mainloop-glib', version: '>= 2.0')
|
|
|
|
@ -9,10 +70,40 @@ diff -urNp gnome-settings-daemon-3.32.0.old/meson.build gnome-settings-daemon-3.
|
|
|
|
|
pango_dep = dependency('pango', version: '>= 1.20.0')
|
|
|
|
|
polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.103')
|
|
|
|
|
upower_glib_dep = dependency('upower-glib', version: '>= 0.99.0')
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/meson.build gnome-settings-daemon-3.32.0/plugins/meson.build
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/meson.build 2019-06-17 13:01:46.867338656 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/meson.build 2019-06-17 13:01:59.245311865 +0100
|
|
|
|
|
@@ -3,6 +3,7 @@ enabled_plugins = [
|
|
|
|
|
x11_dep = dependency('x11')
|
|
|
|
|
|
|
|
|
|
m_dep = cc.find_library('m')
|
|
|
|
|
dl_dep = cc.find_library('dl')
|
|
|
|
|
|
|
|
|
|
# ALSA integration (default enabled)
|
|
|
|
|
enable_alsa = get_option('alsa')
|
|
|
|
|
assert(enable_alsa or not host_is_linux, 'ALSA is not optional on Linux platforms')
|
|
|
|
|
|
|
|
|
|
libgvc = subproject(
|
|
|
|
|
'gvc',
|
|
|
|
|
default_options: [
|
|
|
|
|
'static=true',
|
|
|
|
|
'alsa=' + enable_alsa.to_string()
|
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
libgvc_dep = libgvc.get_variable('libgvc_dep')
|
|
|
|
|
|
|
|
|
|
# GUdev integration (default enabled)
|
|
|
|
|
enable_gudev = get_option('gudev')
|
|
|
|
|
if enable_gudev
|
|
|
|
|
gudev_dep = dependency('gudev-1.0')
|
|
|
|
|
endif
|
|
|
|
|
config_h.set10('HAVE_GUDEV', enable_gudev)
|
|
|
|
|
if host_is_linux
|
|
|
|
|
assert(enable_gudev, 'GUdev is not optional on Linux platforms')
|
|
|
|
|
endif
|
|
|
|
|
diff --git a/plugins/meson.build b/plugins/meson.build
|
|
|
|
|
index 3c4d42ac..4c9caf47 100644
|
|
|
|
|
--- a/plugins/meson.build
|
|
|
|
|
+++ b/plugins/meson.build
|
|
|
|
|
@@ -1,35 +1,36 @@
|
|
|
|
|
enabled_plugins = [
|
|
|
|
|
['a11y-settings', 'A11ySettings'],
|
|
|
|
|
['account', 'Account'],
|
|
|
|
|
['clipboard', 'Clipboard'],
|
|
|
|
|
['color', 'Color'],
|
|
|
|
@ -20,9 +111,100 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/meson.build gnome-settings-d
|
|
|
|
|
['datetime', 'Datetime'],
|
|
|
|
|
['dummy', ''],
|
|
|
|
|
['power', 'Power'],
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subman-common.c gnome-settings-daemon-3.32.0/plugins/subman/gsd-subman-common.c
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subman-common.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/gsd-subman-common.c 2019-06-17 13:01:59.246311863 +0100
|
|
|
|
|
['housekeeping', 'Housekeeping'],
|
|
|
|
|
['keyboard', 'Keyboard'],
|
|
|
|
|
['media-keys', 'MediaKeys'],
|
|
|
|
|
['mouse', 'Mouse'],
|
|
|
|
|
['screensaver-proxy', 'ScreensaverProxy'],
|
|
|
|
|
['sharing', 'Sharing'],
|
|
|
|
|
['sound', 'Sound'],
|
|
|
|
|
['xsettings', 'XSettings']
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
if enable_smartcard
|
|
|
|
|
enabled_plugins += [['smartcard', 'Smartcard']]
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if enable_wacom
|
|
|
|
|
enabled_plugins += [['wacom', 'Wacom']]
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if enable_cups
|
|
|
|
|
enabled_plugins += [['print-notifications', 'PrintNotifications']]
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
if enable_rfkill
|
|
|
|
|
enabled_plugins += [['rfkill', 'Rfkill']]
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
plugins_conf = configuration_data()
|
|
|
|
|
diff --git a/plugins/subman/README.md b/plugins/subman/README.md
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..3e1cc3cd
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/README.md
|
|
|
|
|
@@ -0,0 +1,56 @@
|
|
|
|
|
+GNOME Settings Daemon: Subscription Manager Plugin
|
|
|
|
|
+==================================================
|
|
|
|
|
+
|
|
|
|
|
+Testing:
|
|
|
|
|
+
|
|
|
|
|
+To add a test acccount on subscription.rhsm.stage.redhat.com, use Ethel:
|
|
|
|
|
+http://account-manager-stage.app.eng.rdu2.redhat.com/#view
|
|
|
|
|
+
|
|
|
|
|
+Register with a username and password
|
|
|
|
|
+-------------------------------------
|
|
|
|
|
+
|
|
|
|
|
+ gdbus call \
|
|
|
|
|
+ --session \
|
|
|
|
|
+ --dest org.gnome.SettingsDaemon.Subscription \
|
|
|
|
|
+ --object-path /org/gnome/SettingsDaemon/Subscription \
|
|
|
|
|
+ --method org.gnome.SettingsDaemon.Subscription.Register "{'kind':<'username'>,'hostname':<'subscription.rhsm.stage.redhat.com'>,'username':<'rhughes_test'>,'password':<'barbaz'>}"
|
|
|
|
|
+
|
|
|
|
|
+To register with a certificate
|
|
|
|
|
+------------------------------
|
|
|
|
|
+
|
|
|
|
|
+ gdbus call \
|
|
|
|
|
+ --session \
|
|
|
|
|
+ --dest org.gnome.SettingsDaemon.Subscription \
|
|
|
|
|
+ --object-path /org/gnome/SettingsDaemon/Subscription \
|
|
|
|
|
+ --method org.gnome.SettingsDaemon.Subscription.Register "{'kind':<'key'>,'hostname':<'subscription.rhsm.stage.redhat.com'>,'organisation':<'foo'>,'activation-key':<'barbaz'>}"
|
|
|
|
|
+
|
|
|
|
|
+To unregister
|
|
|
|
|
+-------------
|
|
|
|
|
+
|
|
|
|
|
+ gdbus call \
|
|
|
|
|
+ --session \
|
|
|
|
|
+ --dest org.gnome.SettingsDaemon.Subscription \
|
|
|
|
|
+ --object-path /org/gnome/SettingsDaemon/Subscription \
|
|
|
|
|
+ --method org.gnome.SettingsDaemon.Subscription.Unregister
|
|
|
|
|
+
|
|
|
|
|
+Debugging
|
|
|
|
|
+---------
|
|
|
|
|
+
|
|
|
|
|
+Get the UNIX socket using `Subscription.Register` then call something like:
|
|
|
|
|
+
|
|
|
|
|
+ sudo G_MESSAGES_DEBUG=all ./plugins/subman/gsd-subman-helper \
|
|
|
|
|
+ --address="unix:abstract=/var/run/dbus-ulGB1wfnbn,guid=71e6bf329d861ce366df7a1d5d036a5b" \
|
|
|
|
|
+ --kind="register-with-username" \
|
|
|
|
|
+ --username="rhughes_test" \
|
|
|
|
|
+ --password="barbaz" \
|
|
|
|
|
+ --hostname="subscription.rhsm.stage.redhat.com" \
|
|
|
|
|
+ --organisation=""
|
|
|
|
|
+
|
|
|
|
|
+You can all see some basic debugging running `rhsmd` in the foreground:
|
|
|
|
|
+
|
|
|
|
|
+ sudo /usr/libexec/rhsmd -d -k
|
|
|
|
|
+
|
|
|
|
|
+Known Limitations
|
|
|
|
|
+=================
|
|
|
|
|
+
|
|
|
|
|
+Proxy servers are not supported, nor are custom host ports or prefixes.
|
|
|
|
|
diff --git a/plugins/subman/gsd-subman-common.c b/plugins/subman/gsd-subman-common.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..e515131e
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/gsd-subman-common.c
|
|
|
|
|
@@ -0,0 +1,36 @@
|
|
|
|
|
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
|
|
|
|
+ *
|
|
|
|
@ -60,9 +242,11 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subman-common.c g
|
|
|
|
|
+ return "partially-valid";
|
|
|
|
|
+ return "unknown";
|
|
|
|
|
+}
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subman-common.h gnome-settings-daemon-3.32.0/plugins/subman/gsd-subman-common.h
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subman-common.h 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/gsd-subman-common.h 2019-06-17 13:01:59.246311863 +0100
|
|
|
|
|
diff --git a/plugins/subman/gsd-subman-common.h b/plugins/subman/gsd-subman-common.h
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..fccf9f6a
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/gsd-subman-common.h
|
|
|
|
|
@@ -0,0 +1,40 @@
|
|
|
|
|
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
|
|
|
|
+ *
|
|
|
|
@ -104,9 +288,11 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subman-common.h g
|
|
|
|
|
+G_END_DECLS
|
|
|
|
|
+
|
|
|
|
|
+#endif /* __GSD_SUBMAN_COMMON_H */
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subman-helper.c gnome-settings-daemon-3.32.0/plugins/subman/gsd-subman-helper.c
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subman-helper.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/gsd-subman-helper.c 2019-06-17 13:01:59.247311860 +0100
|
|
|
|
|
diff --git a/plugins/subman/gsd-subman-helper.c b/plugins/subman/gsd-subman-helper.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..182f7190
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/gsd-subman-helper.c
|
|
|
|
|
@@ -0,0 +1,378 @@
|
|
|
|
|
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
|
|
|
|
+ *
|
|
|
|
@ -486,10 +672,12 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subman-helper.c g
|
|
|
|
|
+
|
|
|
|
|
+ return EXIT_SUCCESS;
|
|
|
|
|
+}
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-manager.c gnome-settings-daemon-3.32.0/plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-manager.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/gsd-subscription-manager.c 2019-06-17 13:01:59.247311860 +0100
|
|
|
|
|
@@ -0,0 +1,998 @@
|
|
|
|
|
diff --git a/plugins/subman/gsd-subscription-manager.c b/plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..08b13fa6
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
@@ -0,0 +1,982 @@
|
|
|
|
|
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
|
|
|
|
+ *
|
|
|
|
|
+ * Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
|
|
|
|
@ -566,7 +754,6 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-mana
|
|
|
|
|
+ GHashTable *config; /* str:str */
|
|
|
|
|
+ gchar *address;
|
|
|
|
|
+
|
|
|
|
|
+ guint check_registration_timeout_id;
|
|
|
|
|
+ GTimer *timer_last_notified;
|
|
|
|
|
+ NotifyNotification *notification_expired;
|
|
|
|
|
+ NotifyNotification *notification_registered;
|
|
|
|
@ -613,6 +800,40 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-mana
|
|
|
|
|
+ return GSD_SUBMAN_SUBSCRIPTION_STATUS_UNKNOWN;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void
|
|
|
|
|
+_emit_property_changed (GsdSubscriptionManager *manager,
|
|
|
|
|
+ const gchar *property_name,
|
|
|
|
|
+ GVariant *property_value)
|
|
|
|
|
+{
|
|
|
|
|
+ GsdSubscriptionManagerPrivate *priv = manager->priv;
|
|
|
|
|
+ GVariantBuilder builder;
|
|
|
|
|
+ GVariantBuilder invalidated_builder;
|
|
|
|
|
+
|
|
|
|
|
+ /* not yet connected */
|
|
|
|
|
+ if (priv->connection == NULL)
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ /* build the dict */
|
|
|
|
|
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
|
|
|
|
|
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
|
|
|
|
|
+ g_variant_builder_add (&builder,
|
|
|
|
|
+ "{sv}",
|
|
|
|
|
+ property_name,
|
|
|
|
|
+ property_value);
|
|
|
|
|
+ g_dbus_connection_emit_signal (priv->connection,
|
|
|
|
|
+ NULL,
|
|
|
|
|
+ GSD_SUBSCRIPTION_DBUS_PATH,
|
|
|
|
|
+ "org.freedesktop.DBus.Properties",
|
|
|
|
|
+ "PropertiesChanged",
|
|
|
|
|
+ g_variant_new ("(sa{sv}as)",
|
|
|
|
|
+ GSD_SUBSCRIPTION_DBUS_INTERFACE,
|
|
|
|
|
+ &builder,
|
|
|
|
|
+ &invalidated_builder),
|
|
|
|
|
+ NULL);
|
|
|
|
|
+ g_variant_builder_clear (&builder);
|
|
|
|
|
+ g_variant_builder_clear (&invalidated_builder);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static gboolean
|
|
|
|
|
+_client_subscription_status_update (GsdSubscriptionManager *manager, GError **error)
|
|
|
|
|
+{
|
|
|
|
@ -651,6 +872,13 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-mana
|
|
|
|
|
+ status_txt = json_object_get_string_member (json_obj, "status");
|
|
|
|
|
+ g_debug ("Entitlement.GetStatus: %s", status_txt);
|
|
|
|
|
+ priv->subscription_status = _client_subscription_status_from_text (status_txt);
|
|
|
|
|
+
|
|
|
|
|
+ /* emit notification for g-c-c */
|
|
|
|
|
+ if (priv->subscription_status != priv->subscription_status_last) {
|
|
|
|
|
+ _emit_property_changed (manager, "SubscriptionStatus",
|
|
|
|
|
+ g_variant_new_uint32 (priv->subscription_status));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return TRUE;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
@ -1128,40 +1356,6 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-mana
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void
|
|
|
|
|
+emit_property_changed (GsdSubscriptionManager *manager,
|
|
|
|
|
+ const gchar *property_name,
|
|
|
|
|
+ GVariant *property_value)
|
|
|
|
|
+{
|
|
|
|
|
+ GsdSubscriptionManagerPrivate *priv = manager->priv;
|
|
|
|
|
+ GVariantBuilder builder;
|
|
|
|
|
+ GVariantBuilder invalidated_builder;
|
|
|
|
|
+
|
|
|
|
|
+ /* not yet connected */
|
|
|
|
|
+ if (priv->connection == NULL)
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ /* build the dict */
|
|
|
|
|
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
|
|
|
|
|
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
|
|
|
|
|
+ g_variant_builder_add (&builder,
|
|
|
|
|
+ "{sv}",
|
|
|
|
|
+ property_name,
|
|
|
|
|
+ property_value);
|
|
|
|
|
+ g_dbus_connection_emit_signal (priv->connection,
|
|
|
|
|
+ NULL,
|
|
|
|
|
+ GSD_SUBSCRIPTION_DBUS_PATH,
|
|
|
|
|
+ "org.freedesktop.DBus.Properties",
|
|
|
|
|
+ "PropertiesChanged",
|
|
|
|
|
+ g_variant_new ("(sa{sv}as)",
|
|
|
|
|
+ GSD_SUBSCRIPTION_DBUS_INTERFACE,
|
|
|
|
|
+ &builder,
|
|
|
|
|
+ &invalidated_builder),
|
|
|
|
|
+ NULL);
|
|
|
|
|
+ g_variant_builder_clear (&builder);
|
|
|
|
|
+ g_variant_builder_clear (&invalidated_builder);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void
|
|
|
|
|
+_launch_info_overview (void)
|
|
|
|
|
+{
|
|
|
|
|
+ const gchar *argv[] = { "gnome-control-center", "info-overview", NULL };
|
|
|
|
@ -1264,25 +1458,9 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-mana
|
|
|
|
|
+ manager->priv->name_id = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (manager->priv->check_registration_timeout_id)
|
|
|
|
|
+ g_source_remove (manager->priv->check_registration_timeout_id);
|
|
|
|
|
+
|
|
|
|
|
+ G_OBJECT_CLASS (gsd_subscription_manager_parent_class)->finalize (object);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static gboolean
|
|
|
|
|
+nlight_forced_timeout_cb (gpointer user_data)
|
|
|
|
|
+{
|
|
|
|
|
+ GsdSubscriptionManager *manager = GSD_SUBSCRIPTION_MANAGER (user_data);
|
|
|
|
|
+ GsdSubscriptionManagerPrivate *priv = manager->priv;
|
|
|
|
|
+
|
|
|
|
|
+ priv->check_registration_timeout_id = 0;
|
|
|
|
|
+ emit_property_changed (manager, "SubscriptionStatus",
|
|
|
|
|
+ g_variant_new_boolean (TRUE));
|
|
|
|
|
+
|
|
|
|
|
+ return G_SOURCE_REMOVE;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void
|
|
|
|
|
+handle_method_call (GDBusConnection *connection,
|
|
|
|
|
+ const gchar *sender,
|
|
|
|
@ -1294,11 +1472,9 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-mana
|
|
|
|
|
+ gpointer user_data)
|
|
|
|
|
+{
|
|
|
|
|
+ GsdSubscriptionManager *manager = GSD_SUBSCRIPTION_MANAGER (user_data);
|
|
|
|
|
+ GsdSubscriptionManagerPrivate *priv = manager->priv;
|
|
|
|
|
+ g_autoptr(GError) error = NULL;
|
|
|
|
|
+
|
|
|
|
|
+ if (g_strcmp0 (method_name, "Register") == 0) {
|
|
|
|
|
+ guint32 duration = 0;
|
|
|
|
|
+ const gchar *organisation = NULL;
|
|
|
|
|
+ const gchar *hostname = NULL;
|
|
|
|
|
+
|
|
|
|
@ -1356,10 +1532,6 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-mana
|
|
|
|
|
+
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (priv->check_registration_timeout_id)
|
|
|
|
|
+ g_source_remove (priv->check_registration_timeout_id);
|
|
|
|
|
+ priv->check_registration_timeout_id = g_timeout_add_seconds (duration, nlight_forced_timeout_cb, manager);
|
|
|
|
|
+
|
|
|
|
|
+ g_dbus_method_invocation_return_value (invocation, NULL);
|
|
|
|
|
+ } else if (g_strcmp0 (method_name, "Unregister") == 0) {
|
|
|
|
|
+ if (!_client_unregister (manager, &error)) {
|
|
|
|
@ -1488,9 +1660,11 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-mana
|
|
|
|
|
+
|
|
|
|
|
+ return GSD_SUBSCRIPTION_MANAGER (manager_object);
|
|
|
|
|
+}
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-manager.h gnome-settings-daemon-3.32.0/plugins/subman/gsd-subscription-manager.h
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-manager.h 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/gsd-subscription-manager.h 2019-06-17 13:01:59.248311858 +0100
|
|
|
|
|
diff --git a/plugins/subman/gsd-subscription-manager.h b/plugins/subman/gsd-subscription-manager.h
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..6a524b1b
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/gsd-subscription-manager.h
|
|
|
|
|
@@ -0,0 +1,63 @@
|
|
|
|
|
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
|
|
|
|
+ *
|
|
|
|
@ -1555,9 +1729,11 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/gsd-subscription-mana
|
|
|
|
|
+G_END_DECLS
|
|
|
|
|
+
|
|
|
|
|
+#endif /* __GSD_SUBSCRIPTION_MANAGER_H */
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/main.c gnome-settings-daemon-3.32.0/plugins/subman/main.c
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/main.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/main.c 2019-06-17 13:01:59.248311858 +0100
|
|
|
|
|
diff --git a/plugins/subman/main.c b/plugins/subman/main.c
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..28ac995b
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/main.c
|
|
|
|
|
@@ -0,0 +1,8 @@
|
|
|
|
|
+#define NEW gsd_subscription_manager_new
|
|
|
|
|
+#define START gsd_subscription_manager_start
|
|
|
|
@ -1567,9 +1743,11 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/main.c gnome-settings
|
|
|
|
|
+#include "gsd-subscription-manager.h"
|
|
|
|
|
+
|
|
|
|
|
+#include "daemon-skeleton-gtk.h"
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/meson.build gnome-settings-daemon-3.32.0/plugins/subman/meson.build
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/meson.build 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/meson.build 2019-06-17 13:01:59.248311858 +0100
|
|
|
|
|
diff --git a/plugins/subman/meson.build b/plugins/subman/meson.build
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..bfd073b6
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/meson.build
|
|
|
|
|
@@ -0,0 +1,56 @@
|
|
|
|
|
+sources = files(
|
|
|
|
|
+ 'gsd-subscription-manager.c',
|
|
|
|
@ -1627,10 +1805,27 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/meson.build gnome-set
|
|
|
|
|
+ install_rpath: gsd_pkglibdir,
|
|
|
|
|
+ install_dir: gsd_libexecdir
|
|
|
|
|
+)
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/org.gnome.settings-daemon.plugins.subman.policy.in.in gnome-settings-daemon-3.32.0/plugins/subman/org.gnome.settings-daemon.plugins.subman.policy.in.in
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/org.gnome.settings-daemon.plugins.subman.policy.in.in 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/org.gnome.settings-daemon.plugins.subman.policy.in.in 2019-06-17 13:01:59.248311858 +0100
|
|
|
|
|
@@ -0,0 +1,28 @@
|
|
|
|
|
diff --git a/plugins/subman/org.gnome.SettingsDaemon.Subscription.desktop.in b/plugins/subman/org.gnome.SettingsDaemon.Subscription.desktop.in
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..14fe5915
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/org.gnome.SettingsDaemon.Subscription.desktop.in
|
|
|
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
+[Desktop Entry]
|
|
|
|
|
+Type=Application
|
|
|
|
|
+Name=GNOME Settings Daemon's subscription manager plugin
|
|
|
|
|
+Exec=@libexecdir@/gsd-subman
|
|
|
|
|
+OnlyShowIn=GNOME;
|
|
|
|
|
+NoDisplay=true
|
|
|
|
|
+X-GNOME-Autostart-Phase=Initialization
|
|
|
|
|
+X-GNOME-Autostart-Notify=true
|
|
|
|
|
+X-GNOME-AutoRestart=true
|
|
|
|
|
diff --git a/plugins/subman/org.gnome.settings-daemon.plugins.subman.policy.in.in b/plugins/subman/org.gnome.settings-daemon.plugins.subman.policy.in.in
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..59e9fdd4
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/org.gnome.settings-daemon.plugins.subman.policy.in.in
|
|
|
|
|
@@ -0,0 +1,27 @@
|
|
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
+<!DOCTYPE policyconfig PUBLIC
|
|
|
|
|
+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
|
|
|
|
@ -1658,10 +1853,11 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/org.gnome.settings-da
|
|
|
|
|
+ </action>
|
|
|
|
|
+
|
|
|
|
|
+</policyconfig>
|
|
|
|
|
+
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/org.gnome.settings-daemon.plugins.subman.rules gnome-settings-daemon-3.32.0/plugins/subman/org.gnome.settings-daemon.plugins.subman.rules
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/org.gnome.settings-daemon.plugins.subman.rules 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/org.gnome.settings-daemon.plugins.subman.rules 2019-06-17 13:01:59.248311858 +0100
|
|
|
|
|
diff --git a/plugins/subman/org.gnome.settings-daemon.plugins.subman.rules b/plugins/subman/org.gnome.settings-daemon.plugins.subman.rules
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 00000000..1ed3a0ea
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/plugins/subman/org.gnome.settings-daemon.plugins.subman.rules
|
|
|
|
|
@@ -0,0 +1,7 @@
|
|
|
|
|
+polkit.addRule(function(action, subject) {
|
|
|
|
|
+ if (action.id == "org.gnome.settings-daemon.plugins.subman.register" &&
|
|
|
|
@ -1670,271 +1866,6 @@ diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/org.gnome.settings-da
|
|
|
|
|
+ return polkit.Result.YES;
|
|
|
|
|
+ }
|
|
|
|
|
+});
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/org.gnome.SettingsDaemon.Subscription.desktop.in gnome-settings-daemon-3.32.0/plugins/subman/org.gnome.SettingsDaemon.Subscription.desktop.in
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/org.gnome.SettingsDaemon.Subscription.desktop.in 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/org.gnome.SettingsDaemon.Subscription.desktop.in 2019-06-17 13:01:59.248311858 +0100
|
|
|
|
|
@@ -0,0 +1,9 @@
|
|
|
|
|
+[Desktop Entry]
|
|
|
|
|
+Type=Application
|
|
|
|
|
+Name=GNOME Settings Daemon's subscription manager plugin
|
|
|
|
|
+Exec=@libexecdir@/gsd-subman
|
|
|
|
|
+OnlyShowIn=GNOME;
|
|
|
|
|
+NoDisplay=true
|
|
|
|
|
+X-GNOME-Autostart-Phase=Initialization
|
|
|
|
|
+X-GNOME-Autostart-Notify=true
|
|
|
|
|
+X-GNOME-AutoRestart=true
|
|
|
|
|
diff -urNp gnome-settings-daemon-3.32.0.old/plugins/subman/README.md gnome-settings-daemon-3.32.0/plugins/subman/README.md
|
|
|
|
|
--- gnome-settings-daemon-3.32.0.old/plugins/subman/README.md 1970-01-01 01:00:00.000000000 +0100
|
|
|
|
|
+++ gnome-settings-daemon-3.32.0/plugins/subman/README.md 2019-06-17 13:01:59.246311863 +0100
|
|
|
|
|
@@ -0,0 +1,56 @@
|
|
|
|
|
+GNOME Settings Daemon: Subscription Manager Plugin
|
|
|
|
|
+==================================================
|
|
|
|
|
+
|
|
|
|
|
+Testing:
|
|
|
|
|
+
|
|
|
|
|
+To add a test acccount on subscription.rhsm.stage.redhat.com, use Ethel:
|
|
|
|
|
+http://account-manager-stage.app.eng.rdu2.redhat.com/#view
|
|
|
|
|
+
|
|
|
|
|
+Register with a username and password
|
|
|
|
|
+-------------------------------------
|
|
|
|
|
+
|
|
|
|
|
+ gdbus call \
|
|
|
|
|
+ --session \
|
|
|
|
|
+ --dest org.gnome.SettingsDaemon.Subscription \
|
|
|
|
|
+ --object-path /org/gnome/SettingsDaemon/Subscription \
|
|
|
|
|
+ --method org.gnome.SettingsDaemon.Subscription.Register "{'kind':<'username'>,'hostname':<'subscription.rhsm.stage.redhat.com'>,'username':<'rhughes_test'>,'password':<'barbaz'>}"
|
|
|
|
|
+
|
|
|
|
|
+To register with a certificate
|
|
|
|
|
+------------------------------
|
|
|
|
|
+
|
|
|
|
|
+ gdbus call \
|
|
|
|
|
+ --session \
|
|
|
|
|
+ --dest org.gnome.SettingsDaemon.Subscription \
|
|
|
|
|
+ --object-path /org/gnome/SettingsDaemon/Subscription \
|
|
|
|
|
+ --method org.gnome.SettingsDaemon.Subscription.Register "{'kind':<'key'>,'hostname':<'subscription.rhsm.stage.redhat.com'>,'organisation':<'foo'>,'activation-key':<'barbaz'>}"
|
|
|
|
|
+
|
|
|
|
|
+To unregister
|
|
|
|
|
+-------------
|
|
|
|
|
+
|
|
|
|
|
+ gdbus call \
|
|
|
|
|
+ --session \
|
|
|
|
|
+ --dest org.gnome.SettingsDaemon.Subscription \
|
|
|
|
|
+ --object-path /org/gnome/SettingsDaemon/Subscription \
|
|
|
|
|
+ --method org.gnome.SettingsDaemon.Subscription.Unregister
|
|
|
|
|
+
|
|
|
|
|
+Debugging
|
|
|
|
|
+---------
|
|
|
|
|
+
|
|
|
|
|
+Get the UNIX socket using `Subscription.Register` then call something like:
|
|
|
|
|
+
|
|
|
|
|
+ sudo G_MESSAGES_DEBUG=all ./plugins/subman/gsd-subman-helper \
|
|
|
|
|
+ --address="unix:abstract=/var/run/dbus-ulGB1wfnbn,guid=71e6bf329d861ce366df7a1d5d036a5b" \
|
|
|
|
|
+ --kind="register-with-username" \
|
|
|
|
|
+ --username="rhughes_test" \
|
|
|
|
|
+ --password="barbaz" \
|
|
|
|
|
+ --hostname="subscription.rhsm.stage.redhat.com" \
|
|
|
|
|
+ --organisation=""
|
|
|
|
|
+
|
|
|
|
|
+You can all see some basic debugging running `rhsmd` in the foreground:
|
|
|
|
|
+
|
|
|
|
|
+ sudo /usr/libexec/rhsmd -d -k
|
|
|
|
|
+
|
|
|
|
|
+Known Limitations
|
|
|
|
|
+=================
|
|
|
|
|
+
|
|
|
|
|
+Proxy servers are not supported, nor are custom host ports or prefixes.
|
|
|
|
|
From b35d9c75a7d9f51b24b86461a16dde323be91c2b Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Richard Hughes <richard@hughsie.com>
|
|
|
|
|
Date: Thu, 20 Jun 2019 15:14:29 +0100
|
|
|
|
|
Subject: [PATCH 1/2] f
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
plugins/subman/gsd-subscription-manager.c | 98 ++++++++++-------------
|
|
|
|
|
1 file changed, 41 insertions(+), 57 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/plugins/subman/gsd-subscription-manager.c b/plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
index 0f6466f8..37e53ed9 100644
|
|
|
|
|
--- a/plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
+++ b/plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
@@ -74,7 +74,6 @@ struct GsdSubscriptionManagerPrivate
|
|
|
|
|
GHashTable *config; /* str:str */
|
|
|
|
|
gchar *address;
|
|
|
|
|
|
|
|
|
|
- guint check_registration_timeout_id;
|
|
|
|
|
GTimer *timer_last_notified;
|
|
|
|
|
NotifyNotification *notification_expired;
|
|
|
|
|
NotifyNotification *notification_registered;
|
|
|
|
|
@@ -121,6 +120,40 @@ _client_subscription_status_from_text (const gchar *status_txt)
|
|
|
|
|
return GSD_SUBMAN_SUBSCRIPTION_STATUS_UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void
|
|
|
|
|
+_emit_property_changed (GsdSubscriptionManager *manager,
|
|
|
|
|
+ const gchar *property_name,
|
|
|
|
|
+ GVariant *property_value)
|
|
|
|
|
+{
|
|
|
|
|
+ GsdSubscriptionManagerPrivate *priv = manager->priv;
|
|
|
|
|
+ GVariantBuilder builder;
|
|
|
|
|
+ GVariantBuilder invalidated_builder;
|
|
|
|
|
+
|
|
|
|
|
+ /* not yet connected */
|
|
|
|
|
+ if (priv->connection == NULL)
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ /* build the dict */
|
|
|
|
|
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
|
|
|
|
|
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
|
|
|
|
|
+ g_variant_builder_add (&builder,
|
|
|
|
|
+ "{sv}",
|
|
|
|
|
+ property_name,
|
|
|
|
|
+ property_value);
|
|
|
|
|
+ g_dbus_connection_emit_signal (priv->connection,
|
|
|
|
|
+ NULL,
|
|
|
|
|
+ GSD_SUBSCRIPTION_DBUS_PATH,
|
|
|
|
|
+ "org.freedesktop.DBus.Properties",
|
|
|
|
|
+ "PropertiesChanged",
|
|
|
|
|
+ g_variant_new ("(sa{sv}as)",
|
|
|
|
|
+ GSD_SUBSCRIPTION_DBUS_INTERFACE,
|
|
|
|
|
+ &builder,
|
|
|
|
|
+ &invalidated_builder),
|
|
|
|
|
+ NULL);
|
|
|
|
|
+ g_variant_builder_clear (&builder);
|
|
|
|
|
+ g_variant_builder_clear (&invalidated_builder);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
static gboolean
|
|
|
|
|
_client_subscription_status_update (GsdSubscriptionManager *manager, GError **error)
|
|
|
|
|
{
|
|
|
|
|
@@ -159,6 +192,13 @@ _client_subscription_status_update (GsdSubscriptionManager *manager, GError **er
|
|
|
|
|
status_txt = json_object_get_string_member (json_obj, "status");
|
|
|
|
|
g_debug ("Entitlement.GetStatus: %s", status_txt);
|
|
|
|
|
priv->subscription_status = _client_subscription_status_from_text (status_txt);
|
|
|
|
|
+
|
|
|
|
|
+ /* enit notification for g-c-c */
|
|
|
|
|
+ if (priv->subscription_status != priv->subscription_status_last) {
|
|
|
|
|
+ _emit_property_changed (manager, "SubscriptionStatus",
|
|
|
|
|
+ g_variant_new_uint32 (priv->subscription_status));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -635,40 +675,6 @@ gsd_subscription_manager_class_init (GsdSubscriptionManagerClass *klass)
|
|
|
|
|
g_type_class_add_private (klass, sizeof (GsdSubscriptionManagerPrivate));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-static void
|
|
|
|
|
-emit_property_changed (GsdSubscriptionManager *manager,
|
|
|
|
|
- const gchar *property_name,
|
|
|
|
|
- GVariant *property_value)
|
|
|
|
|
-{
|
|
|
|
|
- GsdSubscriptionManagerPrivate *priv = manager->priv;
|
|
|
|
|
- GVariantBuilder builder;
|
|
|
|
|
- GVariantBuilder invalidated_builder;
|
|
|
|
|
-
|
|
|
|
|
- /* not yet connected */
|
|
|
|
|
- if (priv->connection == NULL)
|
|
|
|
|
- return;
|
|
|
|
|
-
|
|
|
|
|
- /* build the dict */
|
|
|
|
|
- g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
|
|
|
|
|
- g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
|
|
|
|
|
- g_variant_builder_add (&builder,
|
|
|
|
|
- "{sv}",
|
|
|
|
|
- property_name,
|
|
|
|
|
- property_value);
|
|
|
|
|
- g_dbus_connection_emit_signal (priv->connection,
|
|
|
|
|
- NULL,
|
|
|
|
|
- GSD_SUBSCRIPTION_DBUS_PATH,
|
|
|
|
|
- "org.freedesktop.DBus.Properties",
|
|
|
|
|
- "PropertiesChanged",
|
|
|
|
|
- g_variant_new ("(sa{sv}as)",
|
|
|
|
|
- GSD_SUBSCRIPTION_DBUS_INTERFACE,
|
|
|
|
|
- &builder,
|
|
|
|
|
- &invalidated_builder),
|
|
|
|
|
- NULL);
|
|
|
|
|
- g_variant_builder_clear (&builder);
|
|
|
|
|
- g_variant_builder_clear (&invalidated_builder);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
static void
|
|
|
|
|
_launch_info_overview (void)
|
|
|
|
|
{
|
|
|
|
|
@@ -772,25 +778,9 @@ gsd_subscription_manager_finalize (GObject *object)
|
|
|
|
|
manager->priv->name_id = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- if (manager->priv->check_registration_timeout_id)
|
|
|
|
|
- g_source_remove (manager->priv->check_registration_timeout_id);
|
|
|
|
|
-
|
|
|
|
|
G_OBJECT_CLASS (gsd_subscription_manager_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-static gboolean
|
|
|
|
|
-nlight_forced_timeout_cb (gpointer user_data)
|
|
|
|
|
-{
|
|
|
|
|
- GsdSubscriptionManager *manager = GSD_SUBSCRIPTION_MANAGER (user_data);
|
|
|
|
|
- GsdSubscriptionManagerPrivate *priv = manager->priv;
|
|
|
|
|
-
|
|
|
|
|
- priv->check_registration_timeout_id = 0;
|
|
|
|
|
- emit_property_changed (manager, "SubscriptionStatus",
|
|
|
|
|
- g_variant_new_boolean (TRUE));
|
|
|
|
|
-
|
|
|
|
|
- return G_SOURCE_REMOVE;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
static void
|
|
|
|
|
handle_method_call (GDBusConnection *connection,
|
|
|
|
|
const gchar *sender,
|
|
|
|
|
@@ -802,11 +792,9 @@ handle_method_call (GDBusConnection *connection,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
GsdSubscriptionManager *manager = GSD_SUBSCRIPTION_MANAGER (user_data);
|
|
|
|
|
- GsdSubscriptionManagerPrivate *priv = manager->priv;
|
|
|
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
|
|
|
|
|
|
if (g_strcmp0 (method_name, "Register") == 0) {
|
|
|
|
|
- guint32 duration = 0;
|
|
|
|
|
const gchar *organisation = NULL;
|
|
|
|
|
const gchar *hostname = NULL;
|
|
|
|
|
|
|
|
|
|
@@ -864,10 +852,6 @@ handle_method_call (GDBusConnection *connection,
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
- if (priv->check_registration_timeout_id)
|
|
|
|
|
- g_source_remove (priv->check_registration_timeout_id);
|
|
|
|
|
- priv->check_registration_timeout_id = g_timeout_add_seconds (duration, nlight_forced_timeout_cb, manager);
|
|
|
|
|
-
|
|
|
|
|
g_dbus_method_invocation_return_value (invocation, NULL);
|
|
|
|
|
} else if (g_strcmp0 (method_name, "Unregister") == 0) {
|
|
|
|
|
if (!_client_unregister (manager, &error)) {
|
|
|
|
|
--
|
|
|
|
|
2.21.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
From 3635202b7039cac15c258674e2170622ed0d5a42 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Kalev Lember <klember@redhat.com>
|
|
|
|
|
Date: Tue, 25 Jun 2019 14:12:04 +0200
|
|
|
|
|
Subject: [PATCH 2/2] subman: trivial: Fix typo
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
plugins/subman/gsd-subscription-manager.c | 2 +-
|
|
|
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/plugins/subman/gsd-subscription-manager.c b/plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
index 37e53ed9..08b13fa6 100644
|
|
|
|
|
--- a/plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
+++ b/plugins/subman/gsd-subscription-manager.c
|
|
|
|
|
@@ -193,7 +193,7 @@ _client_subscription_status_update (GsdSubscriptionManager *manager, GError **er
|
|
|
|
|
g_debug ("Entitlement.GetStatus: %s", status_txt);
|
|
|
|
|
priv->subscription_status = _client_subscription_status_from_text (status_txt);
|
|
|
|
|
|
|
|
|
|
- /* enit notification for g-c-c */
|
|
|
|
|
+ /* emit notification for g-c-c */
|
|
|
|
|
if (priv->subscription_status != priv->subscription_status_last) {
|
|
|
|
|
_emit_property_changed (manager, "SubscriptionStatus",
|
|
|
|
|
g_variant_new_uint32 (priv->subscription_status));
|
|
|
|
|
--
|
|
|
|
|
2.21.0
|
|
|
|
|
2.30.0
|
|
|
|
|
|
|
|
|
|