From 80686bc1812c9906c0aecd7fed4cdb5860dbb17b Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 19 Dec 2008 21:19:09 -0500 Subject: [PATCH] [libnm-glib] Deprecate the NMIP4Config 'hostname' property NM doesn't implement it, but we forgot about it for 0.7 and now we have to live with it, so just deprecate it and make it return NULL. --- libnm-glib/libnm-glib-test.c | 2 -- libnm-glib/nm-ip4-config.c | 25 +++++-------------------- libnm-glib/nm-ip4-config.h | 4 ++-- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/libnm-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c index 6b1f7d2372..bf9c76cb62 100644 --- a/libnm-glib/libnm-glib-test.c +++ b/libnm-glib/libnm-glib-test.c @@ -112,8 +112,6 @@ dump_ip4_config (NMIP4Config *cfg) g_free (tmp); } - g_print ("IP4 hostname: %s\n", nm_ip4_config_get_hostname (cfg)); - array = nm_ip4_config_get_nameservers (cfg); if (array) { g_print ("IP4 DNS:\n"); diff --git a/libnm-glib/nm-ip4-config.c b/libnm-glib/nm-ip4-config.c index 3af0f8d71e..d4c791faf7 100644 --- a/libnm-glib/nm-ip4-config.c +++ b/libnm-glib/nm-ip4-config.c @@ -38,7 +38,6 @@ typedef struct { DBusGProxy *proxy; GSList *addresses; - char *hostname; GArray *nameservers; GPtrArray *domains; GSList *routes; @@ -117,7 +116,6 @@ register_for_property_changed (NMIP4Config *config) NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); const NMPropertiesChangedInfo property_changed_info[] = { { NM_IP4_CONFIG_ADDRESSES, demarshal_ip4_address_array, &priv->addresses }, - { NM_IP4_CONFIG_HOSTNAME, _nm_object_demarshal_generic, &priv->hostname }, { NM_IP4_CONFIG_NAMESERVERS, demarshal_ip4_array, &priv->nameservers }, { NM_IP4_CONFIG_DOMAINS, demarshal_domains, &priv->domains }, { NM_IP4_CONFIG_ROUTES, demarshal_ip4_routes_array, &priv->routes }, @@ -168,7 +166,6 @@ finalize (GObject *object) g_slist_foreach (priv->routes, (GFunc) g_free, NULL); g_slist_free (priv->routes); - g_free (priv->hostname); if (priv->nameservers) g_array_free (priv->nameservers, TRUE); @@ -196,7 +193,7 @@ get_property (GObject *object, nm_utils_ip4_addresses_to_gvalue (priv->addresses, value); break; case PROP_HOSTNAME: - g_value_set_string (value, nm_ip4_config_get_hostname (self)); + g_value_set_string (value, NULL); break; case PROP_NAMESERVERS: g_value_set_boxed (value, nm_ip4_config_get_nameservers (self)); @@ -242,7 +239,7 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class) /** * NMIP4Config:hostname: * - * The host name string of the configuration. + * DEPRECATED. Don't use. **/ g_object_class_install_property (object_class, PROP_HOSTNAME, @@ -347,26 +344,14 @@ nm_ip4_config_get_addresses (NMIP4Config *config) * nm_ip4_config_get_hostname: * @config: a #NMIP4Config * - * Gets the host name. + * DEPRECATED. Don't use. * - * Returns: the host name from the configuration. This is the internal copy used by the - * configuration and must not be modified. + * Returns: NULL **/ const char * nm_ip4_config_get_hostname (NMIP4Config *config) { - NMIP4ConfigPrivate *priv; - - g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL); - - priv = NM_IP4_CONFIG_GET_PRIVATE (config); - if (!priv->hostname) { - priv->hostname = _nm_object_get_string_property (NM_OBJECT (config), - NM_DBUS_INTERFACE_IP4_CONFIG, - "Hostname"); - } - - return priv->hostname; + return NULL; } /** diff --git a/libnm-glib/nm-ip4-config.h b/libnm-glib/nm-ip4-config.h index c8dbe19847..7807d98dbf 100644 --- a/libnm-glib/nm-ip4-config.h +++ b/libnm-glib/nm-ip4-config.h @@ -47,7 +47,7 @@ typedef struct { } NMIP4ConfigClass; #define NM_IP4_CONFIG_ADDRESSES "addresses" -#define NM_IP4_CONFIG_HOSTNAME "hostname" +#define NM_IP4_CONFIG_HOSTNAME "hostname" /* DEPRECATED */ #define NM_IP4_CONFIG_NAMESERVERS "nameservers" #define NM_IP4_CONFIG_DOMAINS "domains" #define NM_IP4_CONFIG_ROUTES "routes" @@ -57,7 +57,7 @@ GType nm_ip4_config_get_type (void); GObject *nm_ip4_config_new (DBusGConnection *connection, const char *object_path); const GSList * nm_ip4_config_get_addresses (NMIP4Config *config); -const char * nm_ip4_config_get_hostname (NMIP4Config *config); +const char * nm_ip4_config_get_hostname (NMIP4Config *config); /* DEPRECATED */ const GArray * nm_ip4_config_get_nameservers (NMIP4Config *config); const GPtrArray *nm_ip4_config_get_domains (NMIP4Config *config); const GSList * nm_ip4_config_get_routes (NMIP4Config *config);