mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-06 19:50:32 +01:00
merge: branch 'dcbw/dupe-pc-signals-bgo764039'
This commit is contained in:
commit
299ef26c39
2 changed files with 29 additions and 29 deletions
|
|
@ -44,7 +44,7 @@ typedef struct {
|
|||
NMBusManager *bus_mgr;
|
||||
char *path;
|
||||
|
||||
GVariantBuilder pending_notifies;
|
||||
GHashTable *pending_notifies;
|
||||
guint notify_idle_id;
|
||||
|
||||
#ifdef _ASSERT_NO_EARLY_EXPORT
|
||||
|
|
@ -659,8 +659,7 @@ nm_exported_object_unexport (NMExportedObject *self)
|
|||
if (nm_clear_g_source (&priv->notify_idle_id)) {
|
||||
/* We had a notification queued. Since we removed all interfaces,
|
||||
* the notification is obsolete and must be cleaned up. */
|
||||
g_variant_builder_clear (&priv->pending_notifies);
|
||||
g_variant_builder_init (&priv->pending_notifies, G_VARIANT_TYPE_VARDICT);
|
||||
g_hash_table_remove_all (priv->pending_notifies);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -719,22 +718,33 @@ nm_exported_object_init (NMExportedObject *self)
|
|||
{
|
||||
NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (self);
|
||||
|
||||
g_variant_builder_init (&priv->pending_notifies, G_VARIANT_TYPE_VARDICT);
|
||||
priv->pending_notifies = g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
(GDestroyNotify) g_variant_unref);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
idle_emit_properties_changed (gpointer self)
|
||||
{
|
||||
NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (self);
|
||||
GVariant *notifies;
|
||||
GVariant *variant;
|
||||
GSList *iter;
|
||||
GDBusInterfaceSkeleton *interface = NULL;
|
||||
guint signal_id = 0;
|
||||
GHashTableIter hash_iter;
|
||||
const char *dbus_property_name;
|
||||
GVariantBuilder notifies;
|
||||
|
||||
priv->notify_idle_id = 0;
|
||||
notifies = g_variant_builder_end (&priv->pending_notifies);
|
||||
g_variant_ref_sink (notifies);
|
||||
g_variant_builder_init (&priv->pending_notifies, G_VARIANT_TYPE_VARDICT);
|
||||
|
||||
g_variant_builder_init (¬ifies, G_VARIANT_TYPE_VARDICT);
|
||||
g_hash_table_iter_init (&hash_iter, priv->pending_notifies);
|
||||
while (g_hash_table_iter_next (&hash_iter, (gpointer) &dbus_property_name, (gpointer) &variant))
|
||||
g_variant_builder_add (¬ifies, "{sv}", dbus_property_name, variant);
|
||||
g_hash_table_remove_all (priv->pending_notifies);
|
||||
variant = g_variant_builder_end (¬ifies);
|
||||
g_variant_ref_sink (variant);
|
||||
|
||||
for (iter = priv->interfaces; iter; iter = iter->next) {
|
||||
signal_id = g_signal_lookup ("properties-changed", G_OBJECT_TYPE (iter->data));
|
||||
|
|
@ -746,16 +756,14 @@ idle_emit_properties_changed (gpointer self)
|
|||
g_return_val_if_fail (signal_id != 0, FALSE);
|
||||
|
||||
if (nm_logging_enabled (LOGL_DEBUG, LOGD_DBUS_PROPS)) {
|
||||
char *notification;
|
||||
gs_free char *notification = g_variant_print (variant, TRUE);
|
||||
|
||||
notification = g_variant_print (notifies, TRUE);
|
||||
nm_log_dbg (LOGD_DBUS_PROPS, "PropertiesChanged %s %p: %s",
|
||||
G_OBJECT_TYPE_NAME (self), self, notification);
|
||||
g_free (notification);
|
||||
}
|
||||
|
||||
g_signal_emit (interface, signal_id, 0, notifies);
|
||||
g_variant_unref (notifies);
|
||||
g_signal_emit (interface, signal_id, 0, variant);
|
||||
g_variant_unref (variant);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -815,11 +823,10 @@ nm_exported_object_notify (GObject *object, GParamSpec *pspec)
|
|||
g_return_if_fail (vtype != NULL);
|
||||
|
||||
variant = g_dbus_gvalue_to_gvariant (&value, vtype);
|
||||
g_variant_builder_add (&priv->pending_notifies, "{sv}",
|
||||
dbus_property_name,
|
||||
variant);
|
||||
/* @dbus_property_name is inside classinfo and never freed, thus we don't clone it.
|
||||
* Also, we do a pointer, not string comparison. */
|
||||
g_hash_table_insert (priv->pending_notifies, (gpointer) dbus_property_name, variant);
|
||||
g_value_unset (&value);
|
||||
g_variant_unref (variant);
|
||||
|
||||
if (!priv->notify_idle_id)
|
||||
priv->notify_idle_id = g_idle_add (idle_emit_properties_changed, object);
|
||||
|
|
@ -858,7 +865,7 @@ nm_exported_object_dispose (GObject *object)
|
|||
} else
|
||||
g_clear_pointer (&priv->path, g_free);
|
||||
|
||||
g_variant_builder_clear (&priv->pending_notifies);
|
||||
g_clear_pointer (&priv->pending_notifies, g_hash_table_destroy);
|
||||
nm_clear_g_source (&priv->notify_idle_id);
|
||||
|
||||
G_OBJECT_CLASS (nm_exported_object_parent_class)->dispose (object);
|
||||
|
|
|
|||
|
|
@ -2716,19 +2716,12 @@ autoconnect_slaves (NMManager *self,
|
|||
static gboolean
|
||||
_internal_activate_vpn (NMManager *self, NMActiveConnection *active, GError **error)
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
g_assert (NM_IS_VPN_CONNECTION (active));
|
||||
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (active));
|
||||
success = nm_vpn_manager_activate_connection (NM_MANAGER_GET_PRIVATE (self)->vpn_manager,
|
||||
NM_VPN_CONNECTION (active),
|
||||
error);
|
||||
if (success)
|
||||
g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS);
|
||||
else
|
||||
nm_exported_object_unexport (NM_EXPORTED_OBJECT (active));
|
||||
return success;
|
||||
return nm_vpn_manager_activate_connection (NM_MANAGER_GET_PRIVATE (self)->vpn_manager,
|
||||
NM_VPN_CONNECTION (active),
|
||||
error);
|
||||
}
|
||||
|
||||
/* Traverse the device to disconnected state. This means that the device is ready
|
||||
|
|
@ -2951,7 +2944,6 @@ _internal_activate_device (NMManager *self, NMActiveConnection *active, GError *
|
|||
|
||||
/* Export the new ActiveConnection to clients and start it on the device */
|
||||
nm_exported_object_export (NM_EXPORTED_OBJECT (active));
|
||||
g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVE_CONNECTIONS);
|
||||
nm_device_queue_activation (device, NM_ACT_REQUEST (active));
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -3522,6 +3514,7 @@ activation_add_done (NMSettings *settings,
|
|||
FALSE,
|
||||
nm_active_connection_get_subject (active),
|
||||
error->message);
|
||||
g_object_unref (active);
|
||||
g_clear_error (&local);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue