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"
29 #include "nm-core-internal.h"
31 #include "nm-remote-connection.h"
32 #include "nm-remote-connection-private.h"
33 #include "nm-object-private.h"
34 #include "nm-dbus-helpers.h"
36 #include "nmdbus-settings-connection.h"
38 static void nm_remote_connection_connection_iface_init (NMConnectionInterface *iface);
39 static void nm_remote_connection_initable_iface_init (GInitableIface *iface);
40 static void nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface);
41 static GInitableIface *nm_remote_connection_parent_initable_iface;
42 static GAsyncInitableIface *nm_remote_connection_parent_async_initable_iface;
44 G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_TYPE_OBJECT,
45 G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION, nm_remote_connection_connection_iface_init);
46 G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, nm_remote_connection_initable_iface_init);
47 G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, nm_remote_connection_async_initable_iface_init);
59 NMDBusSettingsConnection *proxy;
64 } NMRemoteConnectionPrivate;
66 #define NM_REMOTE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionPrivate))
68 /****************************************************************/
71 * nm_remote_connection_commit_changes:
72 * @connection: the #NMRemoteConnection
73 * @save_to_disk: whether to persist the changes to disk
74 * @cancellable: a #GCancellable, or %NULL
75 * @error: location for a #GError, or %NULL
77 * Send any local changes to the settings and properties of @connection to
78 * NetworkManager. If @save_to_disk is %TRUE, the updated connection will be saved to
79 * disk; if %FALSE, then only the in-memory representation will be changed.
81 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
84 nm_remote_connection_commit_changes (NMRemoteConnection *connection,
85 gboolean save_to_disk,
86 GCancellable *cancellable,
89 NMRemoteConnectionPrivate *priv;
93 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
95 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
97 settings = nm_connection_to_dbus (NM_CONNECTION (connection), NM_CONNECTION_SERIALIZE_ALL);
99 ret = nmdbus_settings_connection_call_update_sync (priv->proxy,
103 ret = nmdbus_settings_connection_call_update_unsaved_sync (priv->proxy,
108 g_dbus_error_strip_remote_error (*error);
113 update_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
115 GSimpleAsyncResult *simple = user_data;
116 gboolean (*finish_func) (NMDBusSettingsConnection *, GAsyncResult *, GError **);
117 GError *error = NULL;
119 finish_func = g_object_get_data (G_OBJECT (simple), "finish_func");
120 if (finish_func (NMDBUS_SETTINGS_CONNECTION (proxy), result, &error))
121 g_simple_async_result_set_op_res_gboolean (simple, TRUE);
123 g_dbus_error_strip_remote_error (error);
124 g_simple_async_result_take_error (simple, error);
126 g_simple_async_result_complete (simple);
127 g_object_unref (simple);
131 * nm_remote_connection_commit_changes_async:
132 * @connection: the #NMRemoteConnection
133 * @save_to_disk: whether to save the changes to persistent storage
134 * @cancellable: a #GCancellable, or %NULL
135 * @callback: callback to be called when the commit operation completes
136 * @user_data: caller-specific data passed to @callback
138 * Asynchronously sends any local changes to the settings and properties of
139 * @connection to NetworkManager. If @save is %TRUE, the updated connection will
140 * be saved to disk; if %FALSE, then only the in-memory representation will be
144 nm_remote_connection_commit_changes_async (NMRemoteConnection *connection,
145 gboolean save_to_disk,
146 GCancellable *cancellable,
147 GAsyncReadyCallback callback,
150 NMRemoteConnectionPrivate *priv;
151 GSimpleAsyncResult *simple;
154 g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
156 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
158 simple = g_simple_async_result_new (G_OBJECT (connection), callback, user_data,
159 nm_remote_connection_commit_changes_async);
161 settings = nm_connection_to_dbus (NM_CONNECTION (connection), NM_CONNECTION_SERIALIZE_ALL);
163 g_object_set_data (G_OBJECT (simple), "finish_func",
164 nmdbus_settings_connection_call_update_finish);
165 nmdbus_settings_connection_call_update (priv->proxy,
170 g_object_set_data (G_OBJECT (simple), "finish_func",
171 nmdbus_settings_connection_call_update_unsaved_finish);
172 nmdbus_settings_connection_call_update_unsaved (priv->proxy,
180 * nm_remote_connection_commit_changes_finish:
181 * @connection: the #NMRemoteConnection
182 * @result: the result passed to the #GAsyncReadyCallback
183 * @error: location for a #GError, or %NULL
185 * Gets the result of a call to nm_remote_connection_commit_changes_async().
187 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
190 nm_remote_connection_commit_changes_finish (NMRemoteConnection *connection,
191 GAsyncResult *result,
194 GSimpleAsyncResult *simple;
196 g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (connection), nm_remote_connection_commit_changes_async), FALSE);
198 simple = G_SIMPLE_ASYNC_RESULT (result);
199 if (g_simple_async_result_propagate_error (simple, error))
202 return g_simple_async_result_get_op_res_gboolean (simple);
206 * nm_remote_connection_save:
207 * @connection: the #NMRemoteConnection
208 * @cancellable: a #GCancellable, or %NULL
209 * @error: location for a #GError, or %NULL
211 * Saves the connection to disk if the connection has changes that have not yet
212 * been written to disk, or if the connection has never been saved.
214 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
217 nm_remote_connection_save (NMRemoteConnection *connection,
218 GCancellable *cancellable,
221 NMRemoteConnectionPrivate *priv;
224 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
226 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
228 ret = nmdbus_settings_connection_call_save_sync (priv->proxy, cancellable, error);
230 g_dbus_error_strip_remote_error (*error);
235 save_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
237 GSimpleAsyncResult *simple = user_data;
238 GError *error = NULL;
240 if (nmdbus_settings_connection_call_save_finish (NMDBUS_SETTINGS_CONNECTION (proxy),
242 g_simple_async_result_set_op_res_gboolean (simple, TRUE);
244 g_dbus_error_strip_remote_error (error);
245 g_simple_async_result_take_error (simple, error);
247 g_simple_async_result_complete (simple);
248 g_object_unref (simple);
252 * nm_remote_connection_save_async:
253 * @connection: the #NMRemoteConnection
254 * @cancellable: a #GCancellable, or %NULL
255 * @callback: callback to be called when the save operation completes
256 * @user_data: caller-specific data passed to @callback
258 * Saves the connection to disk if the connection has changes that have not yet
259 * been written to disk, or if the connection has never been saved.
262 nm_remote_connection_save_async (NMRemoteConnection *connection,
263 GCancellable *cancellable,
264 GAsyncReadyCallback callback,
267 NMRemoteConnectionPrivate *priv;
268 GSimpleAsyncResult *simple;
270 g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
272 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
274 simple = g_simple_async_result_new (G_OBJECT (connection), callback, user_data,
275 nm_remote_connection_save_async);
276 nmdbus_settings_connection_call_save (priv->proxy, cancellable, save_cb, simple);
280 * nm_remote_connection_save_finish:
281 * @connection: the #NMRemoteConnection
282 * @result: the result passed to the #GAsyncReadyCallback
283 * @error: location for a #GError, or %NULL
285 * Gets the result of a call to nm_remote_connection_save_async().
287 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
290 nm_remote_connection_save_finish (NMRemoteConnection *connection,
291 GAsyncResult *result,
294 GSimpleAsyncResult *simple;
296 g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (connection), nm_remote_connection_save_async), FALSE);
298 simple = G_SIMPLE_ASYNC_RESULT (result);
299 if (g_simple_async_result_propagate_error (simple, error))
302 return g_simple_async_result_get_op_res_gboolean (simple);
306 * nm_remote_connection_delete:
307 * @connection: the #NMRemoteConnection
308 * @cancellable: a #GCancellable, or %NULL
309 * @error: location for a #GError, or %NULL
311 * Deletes the connection.
313 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
316 nm_remote_connection_delete (NMRemoteConnection *connection,
317 GCancellable *cancellable,
320 NMRemoteConnectionPrivate *priv;
323 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
325 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
327 ret = nmdbus_settings_connection_call_delete_sync (priv->proxy, cancellable, error);
329 g_dbus_error_strip_remote_error (*error);
334 delete_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
336 GSimpleAsyncResult *simple = user_data;
337 GError *error = NULL;
339 if (nmdbus_settings_connection_call_delete_finish (NMDBUS_SETTINGS_CONNECTION (proxy),
341 g_simple_async_result_set_op_res_gboolean (simple, TRUE);
343 g_dbus_error_strip_remote_error (error);
344 g_simple_async_result_take_error (simple, error);
346 g_simple_async_result_complete (simple);
347 g_object_unref (simple);
351 * nm_remote_connection_delete_async:
352 * @connection: the #NMRemoteConnection
353 * @cancellable: a #GCancellable, or %NULL
354 * @callback: callback to be called when the delete operation completes
355 * @user_data: caller-specific data passed to @callback
357 * Asynchronously deletes the connection.
360 nm_remote_connection_delete_async (NMRemoteConnection *connection,
361 GCancellable *cancellable,
362 GAsyncReadyCallback callback,
365 NMRemoteConnectionPrivate *priv;
366 GSimpleAsyncResult *simple;
368 g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
370 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
372 simple = g_simple_async_result_new (G_OBJECT (connection), callback, user_data,
373 nm_remote_connection_delete_async);
374 nmdbus_settings_connection_call_delete (priv->proxy, cancellable, delete_cb, simple);
378 * nm_remote_connection_delete_finish:
379 * @connection: the #NMRemoteConnection
380 * @result: the result passed to the #GAsyncReadyCallback
381 * @error: location for a #GError, or %NULL
383 * Gets the result of a call to nm_remote_connection_delete_async().
385 * Returns: %TRUE on success, %FALSE on error, in which case @error will be set.
388 nm_remote_connection_delete_finish (NMRemoteConnection *connection,
389 GAsyncResult *result,
392 GSimpleAsyncResult *simple;
394 g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (connection), nm_remote_connection_delete_async), FALSE);
396 simple = G_SIMPLE_ASYNC_RESULT (result);
397 if (g_simple_async_result_propagate_error (simple, error))
400 return g_simple_async_result_get_op_res_gboolean (simple);
404 * nm_remote_connection_get_secrets:
405 * @connection: the #NMRemoteConnection
406 * @setting_name: the #NMSetting object name to get secrets for
407 * @cancellable: a #GCancellable, or %NULL
408 * @error: location for a #GError, or %NULL
410 * Request the connection's secrets. Note that this is a blocking D-Bus call,
411 * not a simple property accessor.
413 * Returns: a #GVariant of type %NM_VARIANT_TYPE_CONNECTION containing
414 * @connection's secrets, or %NULL on error.
417 nm_remote_connection_get_secrets (NMRemoteConnection *connection,
418 const char *setting_name,
419 GCancellable *cancellable,
422 NMRemoteConnectionPrivate *priv;
425 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), NULL);
427 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
429 if (nmdbus_settings_connection_call_get_secrets_sync (priv->proxy,
436 g_dbus_error_strip_remote_error (*error);
442 get_secrets_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
444 GSimpleAsyncResult *simple = user_data;
445 GVariant *secrets = NULL;
446 GError *error = NULL;
448 if (nmdbus_settings_connection_call_get_secrets_finish (NMDBUS_SETTINGS_CONNECTION (proxy),
449 &secrets, result, &error))
450 g_simple_async_result_set_op_res_gpointer (simple, secrets, (GDestroyNotify) g_variant_unref);
452 g_dbus_error_strip_remote_error (error);
453 g_simple_async_result_take_error (simple, error);
456 g_simple_async_result_complete (simple);
457 g_object_unref (simple);
461 * nm_remote_connection_get_secrets_async:
462 * @connection: the #NMRemoteConnection
463 * @setting_name: the #NMSetting object name to get secrets for
464 * @cancellable: a #GCancellable, or %NULL
465 * @callback: callback to be called when the secret request completes
466 * @user_data: caller-specific data passed to @callback
468 * Asynchronously requests the connection's secrets.
471 nm_remote_connection_get_secrets_async (NMRemoteConnection *connection,
472 const char *setting_name,
473 GCancellable *cancellable,
474 GAsyncReadyCallback callback,
477 NMRemoteConnectionPrivate *priv;
478 GSimpleAsyncResult *simple;
480 g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
482 priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
484 simple = g_simple_async_result_new (G_OBJECT (connection), callback, user_data,
485 nm_remote_connection_get_secrets_async);
487 nmdbus_settings_connection_call_get_secrets (priv->proxy,
490 get_secrets_cb, simple);
494 * nm_remote_connection_get_secrets_finish:
495 * @connection: the #NMRemoteConnection
496 * @result: the result passed to the #GAsyncReadyCallback
497 * @error: location for a #GError, or %NULL
499 * Gets the result of a call to nm_remote_connection_get_secrets_async().
501 * Returns: (transfer full): a #GVariant of type %NM_VARIANT_TYPE_CONNECTION
502 * containing @connection's secrets, or %NULL on error.
505 nm_remote_connection_get_secrets_finish (NMRemoteConnection *connection,
506 GAsyncResult *result,
509 GSimpleAsyncResult *simple;
511 g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (connection), nm_remote_connection_get_secrets_async), FALSE);
513 simple = G_SIMPLE_ASYNC_RESULT (result);
514 if (g_simple_async_result_propagate_error (simple, error))
517 return g_variant_ref (g_simple_async_result_get_op_res_gpointer (simple));
521 * nm_remote_connection_get_unsaved:
522 * @connection: the #NMRemoteConnection
524 * Returns: %TRUE if the remote connection contains changes that have not
525 * been saved to disk, %FALSE if the connection is the same as its on-disk
529 nm_remote_connection_get_unsaved (NMRemoteConnection *connection)
531 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
533 return NM_REMOTE_CONNECTION_GET_PRIVATE (connection)->unsaved;
537 * nm_remote_connection_get_visible:
538 * @connection: the #NMRemoteConnection
540 * Checks if the connection is visible to the current user. If the
541 * connection is not visible then it is essentially useless; it will
542 * not contain any settings, and operations such as
543 * nm_remote_connection_save() and nm_remote_connection_delete() will
544 * always fail. (#NMRemoteSettings will not normally return
545 * non-visible connections to callers, but it is possible for a
546 * connection's visibility to change after you already have a
549 * Returns: %TRUE if the remote connection is visible to the current
550 * user, %FALSE if not.
553 nm_remote_connection_get_visible (NMRemoteConnection *connection)
555 g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
557 return NM_REMOTE_CONNECTION_GET_PRIVATE (connection)->visible;
560 /****************************************************************/
563 replace_settings (NMRemoteConnection *self, GVariant *new_settings)
565 GError *error = NULL;
567 if (!_nm_connection_replace_settings ((NMConnection *) self,
569 NM_SETTING_PARSE_FLAGS_BEST_EFFORT,
571 g_clear_error (&error);
575 updated_get_settings_cb (GObject *proxy,
576 GAsyncResult *result,
579 NMRemoteConnection *self = user_data;
580 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
581 GVariant *new_settings;
584 if (!nmdbus_settings_connection_call_get_settings_finish (priv->proxy, &new_settings,
586 /* Connection is no longer visible to this user. */
587 nm_connection_clear_settings (NM_CONNECTION (self));
591 replace_settings (self, new_settings);
592 g_variant_unref (new_settings);
597 if (visible != priv->visible) {
598 priv->visible = visible;
599 g_object_notify (G_OBJECT (self), NM_REMOTE_CONNECTION_VISIBLE);
602 g_object_unref (self);
606 updated_cb (NMDBusSettingsConnection *proxy, gpointer user_data)
608 NMRemoteConnection *self = NM_REMOTE_CONNECTION (user_data);
609 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
611 /* The connection got updated; request the replacement settings */
612 nmdbus_settings_connection_call_get_settings (priv->proxy,
614 updated_get_settings_cb,
615 g_object_ref (self));
618 /****************************************************************/
621 init_dbus (NMObject *object)
623 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
624 const NMPropertiesInfo property_info[] = {
625 { NM_REMOTE_CONNECTION_UNSAVED, &priv->unsaved },
629 NM_OBJECT_CLASS (nm_remote_connection_parent_class)->init_dbus (object);
631 priv->proxy = NMDBUS_SETTINGS_CONNECTION (_nm_object_get_proxy (object, NM_DBUS_INTERFACE_SETTINGS_CONNECTION));
632 g_assert (priv->proxy);
634 _nm_object_register_properties (object,
635 NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
638 g_signal_connect (priv->proxy, "updated",
639 G_CALLBACK (updated_cb), object);
643 init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
645 NMRemoteConnection *self = NM_REMOTE_CONNECTION (initable);
646 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable);
649 if (!nm_remote_connection_parent_initable_iface->init (initable, cancellable, error))
652 if (!nmdbus_settings_connection_call_get_settings_sync (priv->proxy,
654 cancellable, error)) {
656 g_dbus_error_strip_remote_error (*error);
660 priv->visible = TRUE;
661 replace_settings (self, settings);
662 g_variant_unref (settings);
668 NMRemoteConnection *connection;
669 GCancellable *cancellable;
670 GSimpleAsyncResult *result;
671 } NMRemoteConnectionInitData;
674 init_async_complete (NMRemoteConnectionInitData *init_data, GError *error)
677 g_simple_async_result_take_error (init_data->result, error);
679 g_simple_async_result_set_op_res_gboolean (init_data->result, TRUE);
681 g_simple_async_result_complete (init_data->result);
682 g_object_unref (init_data->result);
683 g_clear_object (&init_data->cancellable);
684 g_slice_free (NMRemoteConnectionInitData, init_data);
688 init_get_settings_cb (GObject *proxy,
689 GAsyncResult *result,
692 NMRemoteConnectionInitData *init_data = user_data;
693 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
695 GError *error = NULL;
697 if (!nmdbus_settings_connection_call_get_settings_finish (priv->proxy, &settings,
699 g_dbus_error_strip_remote_error (error);
700 init_async_complete (init_data, error);
704 priv->visible = TRUE;
705 replace_settings (init_data->connection, settings);
706 g_variant_unref (settings);
708 init_async_complete (init_data, NULL);
712 init_async_parent_inited (GObject *source, GAsyncResult *result, gpointer user_data)
714 NMRemoteConnectionInitData *init_data = user_data;
715 NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
716 GError *error = NULL;
718 if (!nm_remote_connection_parent_async_initable_iface->init_finish (G_ASYNC_INITABLE (source), result, &error)) {
719 init_async_complete (init_data, error);
723 nmdbus_settings_connection_call_get_settings (priv->proxy,
724 init_data->cancellable,
725 init_get_settings_cb, init_data);
729 init_async (GAsyncInitable *initable, int io_priority,
730 GCancellable *cancellable, GAsyncReadyCallback callback,
733 NMRemoteConnectionInitData *init_data;
735 init_data = g_slice_new0 (NMRemoteConnectionInitData);
736 init_data->connection = NM_REMOTE_CONNECTION (initable);
737 init_data->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
738 init_data->result = g_simple_async_result_new (G_OBJECT (initable), callback,
739 user_data, init_async);
741 nm_remote_connection_parent_async_initable_iface->
742 init_async (initable, io_priority, cancellable, init_async_parent_inited, init_data);
746 init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error)
748 GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
750 if (g_simple_async_result_propagate_error (simple, error))
757 nm_remote_connection_init (NMRemoteConnection *self)
762 get_property (GObject *object, guint prop_id,
763 GValue *value, GParamSpec *pspec)
767 g_value_set_boolean (value, NM_REMOTE_CONNECTION_GET_PRIVATE (object)->unsaved);
770 g_value_set_boolean (value, NM_REMOTE_CONNECTION_GET_PRIVATE (object)->visible);
773 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
779 constructed (GObject *object)
781 nm_connection_set_path (NM_CONNECTION (object),
782 nm_object_get_path (NM_OBJECT (object)));
786 nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
788 GObjectClass *object_class = G_OBJECT_CLASS (remote_class);
789 NMObjectClass *nm_object_class = NM_OBJECT_CLASS (remote_class);
791 g_type_class_add_private (object_class, sizeof (NMRemoteConnectionPrivate));
793 _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_SETTINGS_CONNECTION);
794 _nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
795 NMDBUS_TYPE_SETTINGS_CONNECTION_PROXY);
797 /* virtual methods */
798 object_class->constructed = constructed;
799 object_class->get_property = get_property;
801 nm_object_class->init_dbus = init_dbus;
805 * NMRemoteConnection:unsaved:
807 * %TRUE if the remote connection contains changes that have not been saved
808 * to disk, %FALSE if the connection is the same as its on-disk representation.
810 g_object_class_install_property
811 (object_class, PROP_UNSAVED,
812 g_param_spec_boolean (NM_REMOTE_CONNECTION_UNSAVED, "", "",
815 G_PARAM_STATIC_STRINGS));
818 * NMRemoteConnection:visible:
820 * %TRUE if the remote connection is visible to the current user, %FALSE if
821 * not. If the connection is not visible then it is essentially useless; it
822 * will not contain any settings, and operations such as
823 * nm_remote_connection_save() and nm_remote_connection_delete() will always
824 * fail. (#NMRemoteSettings will not normally return non-visible connections
825 * to callers, but it is possible for a connection's visibility to change
826 * after you already have a reference to it.)
828 g_object_class_install_property
829 (object_class, PROP_VISIBLE,
830 g_param_spec_boolean (NM_REMOTE_CONNECTION_VISIBLE, "", "",
833 G_PARAM_STATIC_STRINGS));
837 nm_remote_connection_connection_iface_init (NMConnectionInterface *iface)
842 nm_remote_connection_initable_iface_init (GInitableIface *iface)
844 nm_remote_connection_parent_initable_iface = g_type_interface_peek_parent (iface);
846 iface->init = init_sync;
850 nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface)
852 nm_remote_connection_parent_async_initable_iface = g_type_interface_peek_parent (iface);
854 iface->init_async = init_async;
855 iface->init_finish = init_finish;