[sysprof/wip/chergert/sysprof-3] libsysprof: serialize dbus proxy settings
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/chergert/sysprof-3] libsysprof: serialize dbus proxy settings
- Date: Fri, 24 May 2019 01:18:42 +0000 (UTC)
commit f61e2d89b0a86e151760b53837d091b1fbd1c2c2
Author: Christian Hergert <chergert redhat com>
Date: Thu May 23 18:18:35 2019 -0700
libsysprof: serialize dbus proxy settings
src/libsysprof/sysprof-proxy-source.c | 41 +++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
---
diff --git a/src/libsysprof/sysprof-proxy-source.c b/src/libsysprof/sysprof-proxy-source.c
index 186b3db..d38716b 100644
--- a/src/libsysprof/sysprof-proxy-source.c
+++ b/src/libsysprof/sysprof-proxy-source.c
@@ -537,6 +537,45 @@ sysprof_proxy_source_modify_spawn (SysprofSource *source,
sysprof_proxy_source_take_monitor (self, g_steal_pointer (&monitor));
}
+static void
+sysprof_proxy_source_serialize (SysprofSource *source,
+ GKeyFile *keyfile,
+ const gchar *group)
+{
+ SysprofProxySource *self = (SysprofProxySource *)source;
+
+ g_assert (SYSPROF_IS_PROXY_SOURCE (self));
+ g_assert (keyfile != NULL);
+ g_assert (group != NULL);
+
+ g_key_file_set_string (keyfile, group, "bus-name", self->bus_name ?: "");
+ g_key_file_set_string (keyfile, group, "object-path", self->object_path ?: "");
+ g_key_file_set_integer (keyfile, group, "bus-type", self->bus_type);
+}
+
+static void
+sysprof_proxy_source_deserialize (SysprofSource *source,
+ GKeyFile *keyfile,
+ const gchar *group)
+{
+ SysprofProxySource *self = (SysprofProxySource *)source;
+ gint bus_type;
+
+ g_assert (SYSPROF_IS_PROXY_SOURCE (self));
+ g_assert (keyfile != NULL);
+ g_assert (group != NULL);
+
+ g_clear_pointer (&self->bus_name, g_free);
+ g_clear_pointer (&self->object_path, g_free);
+
+ self->bus_name = g_key_file_get_string (keyfile, group, "bus-name", NULL);
+ self->object_path = g_key_file_get_string (keyfile, group, "object-path", NULL);
+
+ bus_type = g_key_file_get_integer (keyfile, group, "bus-type", NULL);
+ if (bus_type == G_BUS_TYPE_SESSION || bus_type == G_BUS_TYPE_SYSTEM)
+ self->bus_type = bus_type;
+}
+
static void
source_iface_init (SysprofSourceInterface *iface)
{
@@ -547,6 +586,8 @@ source_iface_init (SysprofSourceInterface *iface)
iface->stop = sysprof_proxy_source_stop;
iface->start = sysprof_proxy_source_start;
iface->modify_spawn = sysprof_proxy_source_modify_spawn;
+ iface->serialize = sysprof_proxy_source_serialize;
+ iface->deserialize = sysprof_proxy_source_deserialize;
}
G_DEFINE_TYPE_WITH_CODE (SysprofProxySource, sysprof_proxy_source, G_TYPE_OBJECT,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]