2007-10-05 Dan Williams <dcbw@redhat.com>

* libnm-glib/nm-access-point.c
	  libnm-glib/nm-access-point.h
		- (nm_access_point_get_hw_address): return 'const char *', not 'char *'
			because the value is cached internally now.  Callers should not
			free the internal value.
		- Make signal name defines private

	* test/nm-tool.c
	  libnm-glib/libnm-glib-test.c
		- Don't free value returned from nm_access_point_get_hw_address()



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2935 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2007-10-05 16:00:06 +00:00
parent 7732fd87d6
commit 37f9149cb7
5 changed files with 29 additions and 20 deletions

View File

@@ -1,3 +1,16 @@
2007-10-05 Dan Williams <dcbw@redhat.com>
* libnm-glib/nm-access-point.c
libnm-glib/nm-access-point.h
- (nm_access_point_get_hw_address): return 'const char *', not 'char *'
because the value is cached internally now. Callers should not
free the internal value.
- Make signal name defines private
* test/nm-tool.c
libnm-glib/libnm-glib-test.c
- Don't free value returned from nm_access_point_get_hw_address()
2007-10-04 Dan Williams <dcbw@redhat.com> 2007-10-04 Dan Williams <dcbw@redhat.com>
* introspection/nm-device-802-11-wireless.xml * introspection/nm-device-802-11-wireless.xml

View File

@@ -166,7 +166,7 @@ static void
dump_access_point (NMAccessPoint *ap) dump_access_point (NMAccessPoint *ap)
{ {
const GByteArray * ssid; const GByteArray * ssid;
char * str; const char * str;
ssid = nm_access_point_get_ssid (ap); ssid = nm_access_point_get_ssid (ap);
g_print ("\tSsid: %s\n", g_print ("\tSsid: %s\n",
@@ -174,7 +174,6 @@ dump_access_point (NMAccessPoint *ap)
str = nm_access_point_get_hw_address (ap); str = nm_access_point_get_hw_address (ap);
g_print ("\tMAC Address: %s\n", str); g_print ("\tMAC Address: %s\n", str);
g_free (str);
g_print ("\tFlags: 0x%X\n", nm_access_point_get_flags (ap)); g_print ("\tFlags: 0x%X\n", nm_access_point_get_flags (ap));
g_print ("\tWPA Flags: 0x%X\n", nm_access_point_get_wpa_flags (ap)); g_print ("\tWPA Flags: 0x%X\n", nm_access_point_get_wpa_flags (ap));

View File

@@ -38,6 +38,16 @@ enum {
LAST_PROP LAST_PROP
}; };
#define NM_ACCESS_POINT_FLAGS "flags"
#define NM_ACCESS_POINT_WPA_FLAGS "wpa_flags"
#define NM_ACCESS_POINT_RSN_FLAGS "rsn_flags"
#define NM_ACCESS_POINT_SSID "ssid"
#define NM_ACCESS_POINT_FREQUENCY "frequency"
#define NM_ACCESS_POINT_HW_ADDRESS "hw_address"
#define NM_ACCESS_POINT_MODE "mode"
#define NM_ACCESS_POINT_RATE "rate"
#define NM_ACCESS_POINT_STRENGTH "strength"
#define DBUS_PROP_FLAGS "Flags" #define DBUS_PROP_FLAGS "Flags"
#define DBUS_PROP_WPA_FLAGS "WpaFlags" #define DBUS_PROP_WPA_FLAGS "WpaFlags"
#define DBUS_PROP_RSN_FLAGS "RsnFlags" #define DBUS_PROP_RSN_FLAGS "RsnFlags"
@@ -437,7 +447,7 @@ nm_access_point_get_frequency (NMAccessPoint *ap)
return priv->frequency; return priv->frequency;
} }
char * const char *
nm_access_point_get_hw_address (NMAccessPoint *ap) nm_access_point_get_hw_address (NMAccessPoint *ap)
{ {
NMAccessPointPrivate *priv; NMAccessPointPrivate *priv;

View File

@@ -22,16 +22,6 @@ typedef struct {
NMObjectClass parent; NMObjectClass parent;
} NMAccessPointClass; } NMAccessPointClass;
#define NM_ACCESS_POINT_FLAGS "flags"
#define NM_ACCESS_POINT_WPA_FLAGS "wpa_flags"
#define NM_ACCESS_POINT_RSN_FLAGS "rsn_flags"
#define NM_ACCESS_POINT_SSID "ssid"
#define NM_ACCESS_POINT_FREQUENCY "frequency"
#define NM_ACCESS_POINT_HW_ADDRESS "hw_address"
#define NM_ACCESS_POINT_MODE "mode"
#define NM_ACCESS_POINT_RATE "rate"
#define NM_ACCESS_POINT_STRENGTH "strength"
GType nm_access_point_get_type (void); GType nm_access_point_get_type (void);
NMAccessPoint *nm_access_point_new (DBusGConnection *connection, const char *path); NMAccessPoint *nm_access_point_new (DBusGConnection *connection, const char *path);
@@ -41,7 +31,7 @@ guint32 nm_access_point_get_wpa_flags (NMAccessPoint *ap);
guint32 nm_access_point_get_rsn_flags (NMAccessPoint *ap); guint32 nm_access_point_get_rsn_flags (NMAccessPoint *ap);
const GByteArray * nm_access_point_get_ssid (NMAccessPoint *ap); const GByteArray * nm_access_point_get_ssid (NMAccessPoint *ap);
guint32 nm_access_point_get_frequency (NMAccessPoint *ap); guint32 nm_access_point_get_frequency (NMAccessPoint *ap);
char * nm_access_point_get_hw_address (NMAccessPoint *ap); const char * nm_access_point_get_hw_address (NMAccessPoint *ap);
int nm_access_point_get_mode (NMAccessPoint *ap); int nm_access_point_get_mode (NMAccessPoint *ap);
guint32 nm_access_point_get_rate (NMAccessPoint *ap); guint32 nm_access_point_get_rate (NMAccessPoint *ap);
gint8 nm_access_point_get_strength (NMAccessPoint *ap); gint8 nm_access_point_get_strength (NMAccessPoint *ap);

View File

@@ -156,11 +156,9 @@ detail_access_point (gpointer data, gpointer user_data)
rsn_flags = nm_access_point_get_rsn_flags (ap); rsn_flags = nm_access_point_get_rsn_flags (ap);
if (active_bssid) { if (active_bssid) {
char *current_bssid = nm_access_point_get_hw_address (ap); const char *current_bssid = nm_access_point_get_hw_address (ap);
if (current_bssid && !strcmp (current_bssid, active_bssid)) if (current_bssid && !strcmp (current_bssid, active_bssid))
active = TRUE; active = TRUE;
g_free (current_bssid);
} }
str = g_string_new (NULL); str = g_string_new (NULL);
@@ -285,7 +283,7 @@ detail_device (gpointer data, gpointer user_data)
if ((NM_IS_DEVICE_802_11_WIRELESS (device))) { if ((NM_IS_DEVICE_802_11_WIRELESS (device))) {
guint32 wcaps; guint32 wcaps;
NMAccessPoint *active_ap = NULL; NMAccessPoint *active_ap = NULL;
char *active_bssid = NULL; const char *active_bssid = NULL;
GSList *aps; GSList *aps;
printf ("\n Wireless Settings\n"); printf ("\n Wireless Settings\n");
@@ -307,8 +305,7 @@ detail_device (gpointer data, gpointer user_data)
printf ("\n Wireless Access Points%s\n", active_ap ? "(* = Current AP)" : ""); printf ("\n Wireless Access Points%s\n", active_ap ? "(* = Current AP)" : "");
aps = nm_device_802_11_wireless_get_access_points (NM_DEVICE_802_11_WIRELESS (device)); aps = nm_device_802_11_wireless_get_access_points (NM_DEVICE_802_11_WIRELESS (device));
g_slist_foreach (aps, detail_access_point, active_bssid); g_slist_foreach (aps, detail_access_point, (gpointer) active_bssid);
g_free (active_bssid);
g_slist_free (aps); g_slist_free (aps);
} else if (NM_IS_DEVICE_802_3_ETHERNET (device)) { } else if (NM_IS_DEVICE_802_3_ETHERNET (device)) {
printf ("\n Wired Settings\n"); printf ("\n Wired Settings\n");