summaryrefslogtreecommitdiff
path: root/src/nm-active-connection.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-01-25 12:41:03 -0600
committerDan Williams <dcbw@redhat.com>2011-01-25 12:41:03 -0600
commitbc6fc7b910435aae00ef54db972a3e8359700d09 (patch)
tree413de52202a34a5cbd102e8e30e7a4b2d92871b3 /src/nm-active-connection.c
parentd884aadc3d9fe60adf3babe19a003b74c2674a23 (diff)
downloadNetworkManager-bc6fc7b910435aae00ef54db972a3e8359700d09.tar.gz
vpn: fix VPN active connection D-Bus API handling (bgo #569294)
Due to limitations in dbus-glib, where one GObject cannot have more than one introspection XML object attached to it, we used to include more than one <interface> in the VPNConnection object introspection XML. This was suboptimal for two reasons: 1) it duplicated the Connection.Active introspection XML which made it harder for clients to use the introspection data in a dynamic fashion, besides looking ugly in the docs 2) not many other programs use this feature of dbus-glib, which means it didn't get a lot of testing, and broke, which sucks for NM. To fix this issue, create a base class for NMVpnConnection that handles the Connection.Active API, and make NMVpnConnection itself handle just the VPN pieces that it layers on top. This makes dbus-glib happy because we aren't using two <interface> blocks in the same introspection XML, and it makes the NM code more robust because we can re-use the existing Connection.Active introspection XML in the NMVpnConnectionBase class.
Diffstat (limited to 'src/nm-active-connection.c')
-rw-r--r--src/nm-active-connection.c78
1 files changed, 70 insertions, 8 deletions
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index 4207e14504..90495bd2c1 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -21,8 +21,8 @@
#include <glib.h>
#include "nm-active-connection.h"
#include "NetworkManager.h"
-#include "nm-active-connection-glue.h"
#include "nm-logging.h"
+#include "nm-dbus-glib-types.h"
char *
nm_active_connection_get_next_object_path (void)
@@ -33,13 +33,6 @@ nm_active_connection_get_next_object_path (void)
}
void
-nm_active_connection_install_type_info (GObjectClass *klass)
-{
- dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass),
- &dbus_glib_nm_active_connection_object_info);
-}
-
-void
nm_active_connection_scope_to_value (NMConnection *connection, GValue *value)
{
if (!connection) {
@@ -60,4 +53,73 @@ nm_active_connection_scope_to_value (NMConnection *connection, GValue *value)
}
}
+void
+nm_active_connection_install_properties (GObjectClass *object_class,
+ guint prop_service_name,
+ guint prop_connection,
+ guint prop_specific_object,
+ guint prop_devices,
+ guint prop_state,
+ guint prop_default,
+ guint prop_default6,
+ guint prop_vpn)
+{
+ g_object_class_install_property (object_class, prop_service_name,
+ g_param_spec_string (NM_ACTIVE_CONNECTION_SERVICE_NAME,
+ "Service name",
+ "Service name",
+ NULL,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, prop_connection,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_CONNECTION,
+ "Connection",
+ "Connection",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, prop_specific_object,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT,
+ "Specific object",
+ "Specific object",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, prop_devices,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES,
+ "Devices",
+ "Devices",
+ DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, prop_state,
+ g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE,
+ "State",
+ "State",
+ NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
+ NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
+ NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, prop_default,
+ g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT,
+ "Default",
+ "Is the default IPv4 active connection",
+ FALSE,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, prop_default6,
+ g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6,
+ "Default6",
+ "Is the default IPv6 active connection",
+ FALSE,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, prop_vpn,
+ g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN,
+ "VPN",
+ "Is a VPN connection",
+ FALSE,
+ G_PARAM_READABLE));
+}