1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301 USA.
18 * Copyright 2007 - 2008 Novell, Inc.
19 * Copyright 2007 - 2011 Red Hat, Inc.
22 #include "nm-default.h"
26 #include "nm-dbus-interface.h"
28 #include "nm-setting-connection.h"
30 #include "nm-remote-connection.h"
31 #include "nm-remote-connection-private.h"
32 #include "nm-object-private.h"
33 #include "nm-dbus-helpers.h"
35 #include "nmdbus-settings-connection.h"
37 static void nm_remote_connection_connection_iface_init (NMConnectionInterface *iface);
38 static void nm_remote_connection_initable_iface_init (GInitableIface *iface);
39 static void nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface);
40 static GInitableIface *nm_remote_connection_parent_initable_iface;
41 static GAsyncInitableIface *nm_remote_connection_parent_async_initable_iface;
43 G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_TYPE_OBJECT,
44 G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION, nm_remote_connection_connection_iface_init);
45 G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, nm_remote_connection_initable_iface_init);
46 G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, nm_remote_connection_async_initable_iface_init);
58 NMDBusSettingsConnection *proxy;
63 } NMRemoteConnectionPrivate;
65 #define NM_REMOTE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionPrivate))
67 /****************************************************************/
70 * nm_remote_connection_commit_changes:
71 * @connection: the #NMRemoteConnection
72 * @save_to_disk: whether to persist the changes to disk
73 * @cancellable: a #GCancellable, or %NULL
74 * @error: location for a #GError, or %NULL
76 * Send any local changes to the settings and properties of @connection to
77 * NetworkManager. If @save_to_disk is %TRUE, the updated connection will be saved to
78 * disk; if %FALSE, then only the in-memory representation will be changed.
80 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
83 nm_remote_connection_commit_changes (NMRemoteConnection *connection,
84 gboolean save_to_disk,
85 GCancellable *cancellable,
88 NMRemoteConnectionPrivate *priv;
92 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
94 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
96 settings = nm_connection_to_dbus (NM_CONNECTION (connection), NM_CONNECTION_SERIALIZE_ALL);
98 ret = nmdbus_settings_connection_call_update_sync (priv->proxy,
102 ret = nmdbus_settings_connection_call_update_unsaved_sync (priv->proxy,
107 g_dbus_error_strip_remote_error (*error);
112 update_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
114 GSimpleAsyncResult *simple = user_data;
115 gboolean (*finish_func) (NMDBusSettingsConnection *, GAsyncResult *, GError **);
116 GError *error = NULL;
118 finish_func = g_object_get_data (G_OBJECT (simple), "finish_func");
119 if (finish_func (NMDBUS_SETTINGS_CONNECTION (proxy), result, &error))
120 g_simple_async_result_set_op_res_gboolean (simple, TRUE);
122 g_dbus_error_strip_remote_error (error);
123 g_simple_async_result_take_error (simple, error);
125 g_simple_async_result_complete (simple);
126 g_object_unref (simple);
130 * nm_remote_connection_commit_changes_async:
131 * @connection: the #NMRemoteConnection
132 * @save_to_disk: whether to save the changes to persistent storage
133 * @cancellable: a #GCancellable, or %NULL
134 * @callback: callback to be called when the commit operation completes
135 * @user_data: caller-specific data passed to @callback
137 * Asynchronously sends any local changes to the settings and properties of
138 * @connection to NetworkManager. If @save is %TRUE, the updated connection will
139 * be saved to disk; if %FALSE, then only the in-memory representation will be
143 nm_remote_connection_commit_changes_async (NMRemoteConnection *connection,
144 gboolean save_to_disk,
145 GCancellable *cancellable,
146 GAsyncReadyCallback callback,
149 NMRemoteConnectionPrivate *priv;
150 GSimpleAsyncResult *simple;
153 g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
155 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
157 simple = g_simple_async_result_new (G_OBJECT (connection), callback, user_data,
158 nm_remote_connection_commit_changes_async);
160 settings = nm_connection_to_dbus (NM_CONNECTION (connection), NM_CONNECTION_SERIALIZE_ALL);
162 g_object_set_data (G_OBJECT (simple), "finish_func",
163 nmdbus_settings_connection_call_update_finish);
164 nmdbus_settings_connection_call_update (priv->proxy,
169 g_object_set_data (G_OBJECT (simple), "finish_func",
170 nmdbus_settings_connection_call_update_unsaved_finish);
171 nmdbus_settings_connection_call_update_unsaved (priv->proxy,
179 * nm_remote_connection_commit_changes_finish:
180 * @connection: the #NMRemoteConnection
181 * @result: the result passed to the #GAsyncReadyCallback
182 * @error: location for a #GError, or %NULL
184 * Gets the result of a call to nm_remote_connection_commit_changes_async().
186 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
189 nm_remote_connection_commit_changes_finish (NMRemoteConnection *connection,
190 GAsyncResult *result,
193 GSimpleAsyncResult *simple;
195 g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (connection), nm_remote_connection_commit_changes_async), FALSE);
197 simple = G_SIMPLE_ASYNC_RESULT (result);
198 if (g_simple_async_result_propagate_error (simple, error))
201 return g_simple_async_result_get_op_res_gboolean (simple);
205 * nm_remote_connection_save:
206 * @connection: the #NMRemoteConnection
207 * @cancellable: a #GCancellable, or %NULL
208 * @error: location for a #GError, or %NULL
210 * Saves the connection to disk if the connection has changes that have not yet
211 * been written to disk, or if the connection has never been saved.
213 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
216 nm_remote_connection_save (NMRemoteConnection *connection,
217 GCancellable *cancellable,
220 NMRemoteConnectionPrivate *priv;
223 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
225 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
227 ret = nmdbus_settings_connection_call_save_sync (priv->proxy, cancellable, error);
229 g_dbus_error_strip_remote_error (*error);
234 save_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
236 GSimpleAsyncResult *simple = user_data;
237 GError *error = NULL;
239 if (nmdbus_settings_connection_call_save_finish (NMDBUS_SETTINGS_CONNECTION (proxy),
241 g_simple_async_result_set_op_res_gboolean (simple, TRUE);
243 g_dbus_error_strip_remote_error (error);
244 g_simple_async_result_take_error (simple, error);
246 g_simple_async_result_complete (simple);
247 g_object_unref (simple);
251 * nm_remote_connection_save_async:
252 * @connection: the #NMRemoteConnection
253 * @cancellable: a #GCancellable, or %NULL
254 * @callback: callback to be called when the save operation completes
255 * @user_data: caller-specific data passed to @callback
257 * Saves the connection to disk if the connection has changes that have not yet
258 * been written to disk, or if the connection has never been saved.
261 nm_remote_connection_save_async (NMRemoteConnection *connection,
262 GCancellable *cancellable,
263 GAsyncReadyCallback callback,
266 NMRemoteConnectionPrivate *priv;
267 GSimpleAsyncResult *simple;
269 g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
271 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
273 simple = g_simple_async_result_new (G_OBJECT (connection), callback, user_data,
274 nm_remote_connection_save_async);
275 nmdbus_settings_connection_call_save (priv->proxy, cancellable, save_cb, simple);
279 * nm_remote_connection_save_finish:
280 * @connection: the #NMRemoteConnection
281 * @result: the result passed to the #GAsyncReadyCallback
282 * @error: location for a #GError, or %NULL
284 * Gets the result of a call to nm_remote_connection_save_async().
286 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
289 nm_remote_connection_save_finish (NMRemoteConnection *connection,
290 GAsyncResult *result,
293 GSimpleAsyncResult *simple;
295 g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (connection), nm_remote_connection_save_async), FALSE);
297 simple = G_SIMPLE_ASYNC_RESULT (result);
298 if (g_simple_async_result_propagate_error (simple, error))
301 return g_simple_async_result_get_op_res_gboolean (simple);
305 * nm_remote_connection_delete:
306 * @connection: the #NMRemoteConnection
307 * @cancellable: a #GCancellable, or %NULL
308 * @error: location for a #GError, or %NULL
310 * Deletes the connection.
312 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
315 nm_remote_connection_delete (NMRemoteConnection *connection,
316 GCancellable *cancellable,
319 NMRemoteConnectionPrivate *priv;
322 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
324 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
326 ret = nmdbus_settings_connection_call_delete_sync (priv->proxy, cancellable, error);
328 g_dbus_error_strip_remote_error (*error);
333 delete_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
335 GSimpleAsyncResult *simple = user_data;
336 GError *error = NULL;
338 if (nmdbus_settings_connection_call_delete_finish (NMDBUS_SETTINGS_CONNECTION (proxy),
340 g_simple_async_result_set_op_res_gboolean (simple, TRUE);
342 g_dbus_error_strip_remote_error (error);
343 g_simple_async_result_take_error (simple, error);
345 g_simple_async_result_complete (simple);
346 g_object_unref (simple);
350 * nm_remote_connection_delete_async:
351 * @connection: the #NMRemoteConnection
352 * @cancellable: a #GCancellable, or %NULL
353 * @callback: callback to be called when the delete operation completes
354 * @user_data: caller-specific data passed to @callback
356 * Asynchronously deletes the connection.
359 nm_remote_connection_delete_async (NMRemoteConnection *connection,
360 GCancellable *cancellable,
361 GAsyncReadyCallback callback,
364 NMRemoteConnectionPrivate *priv;
365 GSimpleAsyncResult *simple;
367 g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
369 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
371 simple = g_simple_async_result_new (G_OBJECT (connection), callback, user_data,
372 nm_remote_connection_delete_async);
373 nmdbus_settings_connection_call_delete (priv->proxy, cancellable, delete_cb, simple);
377 * nm_remote_connection_delete_finish:
378 * @connection: the #NMRemoteConnection
379 * @result: the result passed to the #GAsyncReadyCallback
380 * @error: location for a #GError, or %NULL
382 * Gets the result of a call to nm_remote_connection_delete_async().
384 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
387 nm_remote_connection_delete_finish (NMRemoteConnection *connection,
388 GAsyncResult *result,
391 GSimpleAsyncResult *simple;
393 g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (connection), nm_remote_connection_delete_async), FALSE);
395 simple = G_SIMPLE_ASYNC_RESULT (result);
396 if (g_simple_async_result_propagate_error (simple, error))
399 return g_simple_async_result_get_op_res_gboolean (simple);
403 * nm_remote_connection_get_secrets:
404 * @connection: the #NMRemoteConnection
405 * @setting_name: the #NMSetting object name to get secrets for
406 * @cancellable: a #GCancellable, or %NULL
407 * @error: location for a #GError, or %NULL
409 * Request the connection's secrets. Note that this is a blocking D-Bus call,
410 * not a simple property accessor.
412 * Returns: a #GVariant of type %NM_VARIANT_TYPE_CONNECTION containing
413 * @connection's secrets, or %NULL on error.
416 nm_remote_connection_get_secrets (NMRemoteConnection *connection,
417 const char *setting_name,
418 GCancellable *cancellable,
421 NMRemoteConnectionPrivate *priv;
424 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), NULL);
426 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
428 if (nmdbus_settings_connection_call_get_secrets_sync (priv->proxy,
435 g_dbus_error_strip_remote_error (*error);
441 get_secrets_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
443 GSimpleAsyncResult *simple = user_data;
444 GVariant *secrets = NULL;
445 GError *error = NULL;
447 if (nmdbus_settings_connection_call_get_secrets_finish (NMDBUS_SETTINGS_CONNECTION (proxy),
448 &secrets, result, &error))
449 g_simple_async_result_set_op_res_gpointer (simple, secrets, (GDestroyNotify) g_variant_unref);
451 g_dbus_error_strip_remote_error (error);
452 g_simple_async_result_take_error (simple, error);
455 g_simple_async_result_complete (simple);
456 g_object_unref (simple);
460 * nm_remote_connection_get_secrets_async:
461 * @connection: the #NMRemoteConnection
462 * @setting_name: the #NMSetting object name to get secrets for
463 * @cancellable: a #GCancellable, or %NULL
464 * @callback: callback to be called when the secret request completes
465 * @user_data: caller-specific data passed to @callback
467 * Asynchronously requests the connection's secrets.
470 nm_remote_connection_get_secrets_async (NMRemoteConnection *connection,
471 const char *setting_name,
472 GCancellable *cancellable,
473 GAsyncReadyCallback callback,
476 NMRemoteConnectionPrivate *priv;
477 GSimpleAsyncResult *simple;
479 g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
481 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
483 simple = g_simple_async_result_new (G_OBJECT (connection), callback, user_data,
484 nm_remote_connection_get_secrets_async);
486 nmdbus_settings_connection_call_get_secrets (priv->proxy,
489 get_secrets_cb, simple);
493 * nm_remote_connection_get_secrets_finish:
494 * @connection: the #NMRemoteConnection
495 * @result: the result passed to the #GAsyncReadyCallback
496 * @error: location for a #GError, or %NULL
498 * Gets the result of a call to nm_remote_connection_get_secrets_async().
500 * Returns: (transfer full): a #GVariant of type %NM_VARIANT_TYPE_CONNECTION
501 * containing @connection's secrets, or %NULL on error.
504 nm_remote_connection_get_secrets_finish (NMRemoteConnection *connection,
505 GAsyncResult *result,
508 GSimpleAsyncResult *simple;
510 g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (connection), nm_remote_connection_get_secrets_async), FALSE);
512 simple = G_SIMPLE_ASYNC_RESULT (result);
513 if (g_simple_async_result_propagate_error (simple, error))
516 return g_variant_ref (g_simple_async_result_get_op_res_gpointer (simple));
520 * nm_remote_connection_get_unsaved:
521 * @connection: the #NMRemoteConnection
523 * Returns: %TRUE if the remote connection contains changes that have not
524 * been saved to disk, %FALSE if the connection is the same as its on-disk
528 nm_remote_connection_get_unsaved (NMRemoteConnection *connection)
530 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
532 return NM_REMOTE_CONNECTION_GET_PRIVATE (connection)->unsaved;
536 * nm_remote_connection_get_visible:
537 * @connection: the #NMRemoteConnection
539 * Checks if the connection is visible to the current user. If the
540 * connection is not visible then it is essentially useless; it will
541 * not contain any settings, and operations such as
542 * nm_remote_connection_save() and nm_remote_connection_delete() will
543 * always fail. (#NMRemoteSettings will not normally return
544 * non-visible connections to callers, but it is possible for a
545 * connection's visibility to change after you already have a
548 * Returns: %TRUE if the remote connection is visible to the current
549 * user, %FALSE if not.
552 nm_remote_connection_get_visible (NMRemoteConnection *connection)
554 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
556 return NM_REMOTE_CONNECTION_GET_PRIVATE (connection)->visible;
559 /****************************************************************/
562 replace_settings (NMRemoteConnection *self, GVariant *new_settings)
564 GError *error = NULL;
566 if (!nm_connection_replace_settings (NM_CONNECTION (self), new_settings, &error)) {
567 g_warning ("%s: error updating connection %s settings: %s",
569 nm_connection_get_path (NM_CONNECTION (self)),
571 g_clear_error (&error);
576 updated_get_settings_cb (GObject *proxy,
577 GAsyncResult *result,
580 NMRemoteConnection *self = user_data;
581 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
582 GVariant *new_settings;
585 if (!nmdbus_settings_connection_call_get_settings_finish (priv->proxy, &new_settings,
587 /* Connection is no longer visible to this user. */
588 nm_connection_clear_settings (NM_CONNECTION (self));
592 replace_settings (self, new_settings);
593 g_variant_unref (new_settings);
598 if (visible != priv->visible) {
599 priv->visible = visible;
600 g_object_notify (G_OBJECT (self), NM_REMOTE_CONNECTION_VISIBLE);
603 g_object_unref (self);
607 updated_cb (NMDBusSettingsConnection *proxy, gpointer user_data)
609 NMRemoteConnection *self = NM_REMOTE_CONNECTION (user_data);
610 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
612 /* The connection got updated; request the replacement settings */
613 nmdbus_settings_connection_call_get_settings (priv->proxy,
615 updated_get_settings_cb,
616 g_object_ref (self));
619 /****************************************************************/
622 init_dbus (NMObject *object)
624 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
625 const NMPropertiesInfo property_info[] = {
626 { NM_REMOTE_CONNECTION_UNSAVED, &priv->unsaved },
630 NM_OBJECT_CLASS (nm_remote_connection_parent_class)->init_dbus (object);
632 priv->proxy = NMDBUS_SETTINGS_CONNECTION (_nm_object_get_proxy (object, NM_DBUS_INTERFACE_SETTINGS_CONNECTION));
633 g_assert (priv->proxy);
635 _nm_object_register_properties (object,
636 NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
639 g_signal_connect (priv->proxy, "updated",
640 G_CALLBACK (updated_cb), object);
644 init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
646 NMRemoteConnection *self = NM_REMOTE_CONNECTION (initable);
647 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable);
650 if (!nm_remote_connection_parent_initable_iface->init (initable, cancellable, error))
653 if (!nmdbus_settings_connection_call_get_settings_sync (priv->proxy,
655 cancellable, error)) {
657 g_dbus_error_strip_remote_error (*error);
661 priv->visible = TRUE;
662 replace_settings (self, settings);
663 g_variant_unref (settings);
669 NMRemoteConnection *connection;
670 GCancellable *cancellable;
671 GSimpleAsyncResult *result;
672 } NMRemoteConnectionInitData;
675 init_async_complete (NMRemoteConnectionInitData *init_data, GError *error)
678 g_simple_async_result_take_error (init_data->result, error);
680 g_simple_async_result_set_op_res_gboolean (init_data->result, TRUE);
682 g_simple_async_result_complete (init_data->result);
683 g_object_unref (init_data->result);
684 g_clear_object (&init_data->cancellable);
685 g_slice_free (NMRemoteConnectionInitData, init_data);
689 init_get_settings_cb (GObject *proxy,
690 GAsyncResult *result,
693 NMRemoteConnectionInitData *init_data = user_data;
694 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
696 GError *error = NULL;
698 if (!nmdbus_settings_connection_call_get_settings_finish (priv->proxy, &settings,
700 g_dbus_error_strip_remote_error (error);
701 init_async_complete (init_data, error);
705 priv->visible = TRUE;
706 replace_settings (init_data->connection, settings);
707 g_variant_unref (settings);
709 init_async_complete (init_data, NULL);
713 init_async_parent_inited (GObject *source, GAsyncResult *result, gpointer user_data)
715 NMRemoteConnectionInitData *init_data = user_data;
716 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
717 GError *error = NULL;
719 if (!nm_remote_connection_parent_async_initable_iface->init_finish (G_ASYNC_INITABLE (source), result, &error)) {
720 init_async_complete (init_data, error);
724 nmdbus_settings_connection_call_get_settings (priv->proxy,
725 init_data->cancellable,
726 init_get_settings_cb, init_data);
730 init_async (GAsyncInitable *initable, int io_priority,
731 GCancellable *cancellable, GAsyncReadyCallback callback,
734 NMRemoteConnectionInitData *init_data;
736 init_data = g_slice_new0 (NMRemoteConnectionInitData);
737 init_data->connection = NM_REMOTE_CONNECTION (initable);
738 init_data->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
739 init_data->result = g_simple_async_result_new (G_OBJECT (initable), callback,
740 user_data, init_async);
742 nm_remote_connection_parent_async_initable_iface->
743 init_async (initable, io_priority, cancellable, init_async_parent_inited, init_data);
747 init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error)
749 GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
751 if (g_simple_async_result_propagate_error (simple, error))
758 nm_remote_connection_init (NMRemoteConnection *self)
763 get_property (GObject *object, guint prop_id,
764 GValue *value, GParamSpec *pspec)
768 g_value_set_boolean (value, NM_REMOTE_CONNECTION_GET_PRIVATE (object)->unsaved);
771 g_value_set_boolean (value, NM_REMOTE_CONNECTION_GET_PRIVATE (object)->visible);
774 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
780 constructed (GObject *object)
782 nm_connection_set_path (NM_CONNECTION (object),
783 nm_object_get_path (NM_OBJECT (object)));
787 nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
789 GObjectClass *object_class = G_OBJECT_CLASS (remote_class);
790 NMObjectClass *nm_object_class = NM_OBJECT_CLASS (remote_class);
792 g_type_class_add_private (object_class, sizeof (NMRemoteConnectionPrivate));
794 _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_SETTINGS_CONNECTION);
795 _nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
796 NMDBUS_TYPE_SETTINGS_CONNECTION_PROXY);
798 /* virtual methods */
799 object_class->constructed = constructed;
800 object_class->get_property = get_property;
802 nm_object_class->init_dbus = init_dbus;
806 * NMRemoteConnection:unsaved:
808 * %TRUE if the remote connection contains changes that have not been saved
809 * to disk, %FALSE if the connection is the same as its on-disk representation.
811 g_object_class_install_property
812 (object_class, PROP_UNSAVED,
813 g_param_spec_boolean (NM_REMOTE_CONNECTION_UNSAVED, "", "",
816 G_PARAM_STATIC_STRINGS));
819 * NMRemoteConnection:visible:
821 * %TRUE if the remote connection is visible to the current user, %FALSE if
822 * not. If the connection is not visible then it is essentially useless; it
823 * will not contain any settings, and operations such as
824 * nm_remote_connection_save() and nm_remote_connection_delete() will always
825 * fail. (#NMRemoteSettings will not normally return non-visible connections
826 * to callers, but it is possible for a connection's visibility to change
827 * after you already have a reference to it.)
829 g_object_class_install_property
830 (object_class, PROP_VISIBLE,
831 g_param_spec_boolean (NM_REMOTE_CONNECTION_VISIBLE, "", "",
834 G_PARAM_STATIC_STRINGS));
838 nm_remote_connection_connection_iface_init (NMConnectionInterface *iface)
843 nm_remote_connection_initable_iface_init (GInitableIface *iface)
845 nm_remote_connection_parent_initable_iface = g_type_interface_peek_parent (iface);
847 iface->init = init_sync;
851 nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface)
853 nm_remote_connection_parent_async_initable_iface = g_type_interface_peek_parent (iface);
855 iface->init_async = init_async;
856 iface->init_finish = init_finish;