mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-14 22:40:35 +01:00
Merge commit 'origin/master' into cert-paths
This commit is contained in:
commit
91bc44229e
4 changed files with 56 additions and 3 deletions
|
|
@ -45,6 +45,7 @@ typedef struct {
|
|||
DBusGProxy *proxy;
|
||||
GHashTable *connections;
|
||||
GHashTable *pending; /* Connections we don't have settings for yet */
|
||||
gboolean service_running;
|
||||
|
||||
DBusGProxy *dbus_proxy;
|
||||
|
||||
|
|
@ -57,6 +58,7 @@ enum {
|
|||
PROP_0,
|
||||
PROP_BUS,
|
||||
PROP_SCOPE,
|
||||
PROP_SERVICE_RUNNING,
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
|
|
@ -122,6 +124,10 @@ connection_init_result_cb (NMRemoteConnection *remote,
|
|||
}
|
||||
|
||||
g_hash_table_remove (priv->pending, path);
|
||||
|
||||
/* Let listeners know that all connections have been found */
|
||||
if (!g_hash_table_size (priv->pending))
|
||||
g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_CONNECTIONS_READ);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -169,6 +175,12 @@ fetch_connections_done (DBusGProxy *proxy,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Let listeners know we are done getting connections */
|
||||
if (connections->len == 0) {
|
||||
g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_CONNECTIONS_READ);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; connections && (i < connections->len); i++) {
|
||||
char *path = g_ptr_array_index (connections, i);
|
||||
|
||||
|
|
@ -283,10 +295,14 @@ name_owner_changed (DBusGProxy *proxy,
|
|||
if (priv->fetch_id)
|
||||
g_source_remove (priv->fetch_id);
|
||||
|
||||
if (new_owner && strlen (new_owner) > 0)
|
||||
if (new_owner && strlen (new_owner) > 0) {
|
||||
priv->fetch_id = g_idle_add (fetch_connections, self);
|
||||
else
|
||||
priv->service_running = TRUE;
|
||||
} else {
|
||||
priv->fetch_id = g_idle_add (remove_connections, self);
|
||||
priv->service_running = FALSE;
|
||||
}
|
||||
g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_SERVICE_RUNNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -339,6 +355,7 @@ constructor (GType type,
|
|||
GObject *object;
|
||||
NMRemoteSettingsPrivate *priv;
|
||||
const char *service = NM_DBUS_SERVICE_USER_SETTINGS;
|
||||
GError *error = NULL;
|
||||
|
||||
object = G_OBJECT_CLASS (nm_remote_settings_parent_class)->constructor (type, n_construct_params, construct_params);
|
||||
if (!object)
|
||||
|
|
@ -369,6 +386,19 @@ constructor (GType type,
|
|||
if (priv->scope == NM_CONNECTION_SCOPE_SYSTEM)
|
||||
service = NM_DBUS_SERVICE_SYSTEM_SETTINGS;
|
||||
|
||||
if (!dbus_g_proxy_call (priv->dbus_proxy, "NameHasOwner", &error,
|
||||
G_TYPE_STRING, service,
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_BOOLEAN, &priv->service_running,
|
||||
G_TYPE_INVALID)) {
|
||||
g_warning ("%s (NMRemoteSettings) error getting remote settings service status: (%d) %s\n",
|
||||
__func__,
|
||||
error ? error->code : -1,
|
||||
error && error->message ? error->message : "(unknown)");
|
||||
g_error_free (error);
|
||||
priv->service_running = FALSE;
|
||||
}
|
||||
|
||||
priv->proxy = dbus_g_proxy_new_for_name (priv->bus,
|
||||
service,
|
||||
NM_DBUS_PATH_SETTINGS,
|
||||
|
|
@ -447,6 +477,9 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_SCOPE:
|
||||
g_value_set_uint (value, priv->scope);
|
||||
break;
|
||||
case PROP_SERVICE_RUNNING:
|
||||
g_value_set_boolean (value, priv->service_running);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
|
@ -484,5 +517,13 @@ nm_remote_settings_class_init (NMRemoteSettingsClass *class)
|
|||
NM_CONNECTION_SCOPE_USER,
|
||||
NM_CONNECTION_SCOPE_USER,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_SERVICE_RUNNING,
|
||||
g_param_spec_boolean (NM_REMOTE_SETTINGS_SERVICE_RUNNING,
|
||||
"Service running",
|
||||
"Is service running",
|
||||
FALSE,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_REMOTE_SETTINGS_BUS "bus"
|
||||
#define NM_REMOTE_SETTINGS_SCOPE "scope"
|
||||
#define NM_REMOTE_SETTINGS_SERVICE_RUNNING "service-running"
|
||||
|
||||
typedef struct {
|
||||
GObject parent;
|
||||
|
|
|
|||
|
|
@ -162,6 +162,14 @@ nm_settings_interface_init (gpointer g_iface)
|
|||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
g_signal_new (NM_SETTINGS_INTERFACE_CONNECTIONS_READ,
|
||||
iface_type,
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMSettingsInterface, connections_read),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ GType nm_settings_interface_error_get_type (void);
|
|||
#define NM_IS_SETTINGS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTINGS_INTERFACE))
|
||||
#define NM_SETTINGS_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_SETTINGS_INTERFACE, NMSettingsInterface))
|
||||
|
||||
#define NM_SETTINGS_INTERFACE_NEW_CONNECTION "new-connection"
|
||||
#define NM_SETTINGS_INTERFACE_NEW_CONNECTION "new-connection"
|
||||
#define NM_SETTINGS_INTERFACE_CONNECTIONS_READ "connections-read"
|
||||
|
||||
typedef struct _NMSettingsInterface NMSettingsInterface;
|
||||
|
||||
|
|
@ -74,6 +75,8 @@ struct _NMSettingsInterface {
|
|||
/* Signals */
|
||||
void (*new_connection) (NMSettingsInterface *settings,
|
||||
NMSettingsConnectionInterface *connection);
|
||||
|
||||
void (*connections_read) (NMSettingsInterface *settings);
|
||||
};
|
||||
|
||||
GType nm_settings_interface_get_type (void);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue