libsysprof-ui: stub out proxy source

The goal for this (which is unfinished) is to setup a dbus proxy to the
peer. That can be reused for both gtk and mutter, if configured correctly.

We'll likely need to allow some specific config tweaks in the UI.
This commit is contained in:
Christian Hergert
2019-05-19 22:46:22 -07:00
parent c368da09de
commit 588fd43d8b
10 changed files with 434 additions and 0 deletions

View File

@ -0,0 +1,116 @@
/* sysprof-proxy-source.c
*
* Copyright 2019 Christian Hergert <chergert@redhat.com>
*
* 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 3 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/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#define G_LOG_DOMAIN "sysprof-proxy-source"
#include "config.h"
#include "sysprof-proxy-source.h"
struct _SysprofProxySource
{
GObject parent_instance;
gchar *bus_name;
gchar *object_path;
GBusType bus_type;
};
static void
sysprof_proxy_source_prepare (SysprofSource *source)
{
SysprofProxySource *self = (SysprofProxySource *)source;
g_assert (SYSPROF_IS_PROXY_SOURCE (self));
}
static gboolean
sysprof_proxy_source_get_is_ready (SysprofSource *source)
{
SysprofProxySource *self = (SysprofProxySource *)source;
g_assert (SYSPROF_IS_PROXY_SOURCE (self));
return FALSE;
}
static void
sysprof_proxy_source_set_writer (SysprofSource *source,
SysprofCaptureWriter *writer)
{
SysprofProxySource *self = (SysprofProxySource *)source;
g_assert (SYSPROF_IS_PROXY_SOURCE (self));
g_assert (writer != NULL);
}
static void
source_iface_init (SysprofSourceInterface *iface)
{
iface->prepare = sysprof_proxy_source_prepare;
iface->set_writer = sysprof_proxy_source_set_writer;
iface->get_is_ready = sysprof_proxy_source_get_is_ready;
}
G_DEFINE_TYPE_WITH_CODE (SysprofProxySource, sysprof_proxy_source, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (SYSPROF_TYPE_SOURCE, source_iface_init))
static void
sysprof_proxy_source_finalize (GObject *object)
{
SysprofProxySource *self = (SysprofProxySource *)object;
g_clear_pointer (&self->bus_name, g_free);
g_clear_pointer (&self->object_path, g_free);
G_OBJECT_CLASS (sysprof_proxy_source_parent_class)->finalize (object);
}
static void
sysprof_proxy_source_class_init (SysprofProxySourceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = sysprof_proxy_source_finalize;
}
static void
sysprof_proxy_source_init (SysprofProxySource *self)
{
}
SysprofSource *
sysprof_proxy_source_new (GBusType bus_type,
const gchar *bus_name,
const gchar *object_path)
{
SysprofProxySource *self;
g_return_val_if_fail (bus_type == G_BUS_TYPE_SESSION || bus_type == G_BUS_TYPE_SYSTEM, NULL);
g_return_val_if_fail (bus_name != NULL, NULL);
g_return_val_if_fail (object_path != NULL, NULL);
self = g_object_new (SYSPROF_TYPE_PROXY_SOURCE, NULL);
self->bus_type = bus_type;
self->bus_name = g_strdup (bus_name);
self->object_path = g_strdup (object_path);
return SYSPROF_SOURCE (g_steal_pointer (&self));
}