privacy: Cache D-Bus proxies

This commit is contained in:
Georges Basile Stavracas Neto 2018-03-27 18:04:28 -03:00
parent 28ad1d1602
commit 754434fa0d

View file

@ -18,6 +18,7 @@
* Author: Matthias Clasen <mclasen@redhat.com>
*/
#include "shell/cc-object-storage.h"
#include "shell/list-box-helper.h"
#include "cc-privacy-panel.h"
#include "cc-privacy-resources.h"
@ -463,7 +464,7 @@ on_gclue_manager_ready (GObject *source_object,
GDBusProxy *proxy;
GError *error = NULL;
proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
proxy = cc_object_storage_create_dbus_proxy_finish (res, &error);
if (proxy == NULL)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@ -475,10 +476,11 @@ on_gclue_manager_ready (GObject *source_object,
self = user_data;
self->priv->gclue_manager = proxy;
g_signal_connect (self->priv->gclue_manager,
"g-properties-changed",
G_CALLBACK (on_gclue_manager_props_changed),
self);
g_signal_connect_object (self->priv->gclue_manager,
"g-properties-changed",
G_CALLBACK (on_gclue_manager_props_changed),
self,
0);
update_location_label (self);
}
@ -783,7 +785,7 @@ on_perm_store_ready (GObject *source_object,
GVariant *params;
GError *error = NULL;
proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
proxy = cc_object_storage_create_dbus_proxy_finish (res, &error);
if (proxy == NULL)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@ -842,25 +844,23 @@ add_location (CcPrivacyPanel *self)
g_free,
g_object_unref);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.freedesktop.GeoClue2",
"/org/freedesktop/GeoClue2/Manager",
"org.freedesktop.GeoClue2.Manager",
priv->cancellable,
on_gclue_manager_ready,
self);
cc_object_storage_create_dbus_proxy (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.GeoClue2",
"/org/freedesktop/GeoClue2/Manager",
"org.freedesktop.GeoClue2.Manager",
priv->cancellable,
on_gclue_manager_ready,
self);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.freedesktop.impl.portal.PermissionStore",
"/org/freedesktop/impl/portal/PermissionStore",
"org.freedesktop.impl.portal.PermissionStore",
priv->cancellable,
on_perm_store_ready,
self);
cc_object_storage_create_dbus_proxy (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.impl.portal.PermissionStore",
"/org/freedesktop/impl/portal/PermissionStore",
"org.freedesktop.impl.portal.PermissionStore",
priv->cancellable,
on_perm_store_ready,
self);
}
static void