mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 04:50:30 +01:00
2005-04-04 Dan Williams <dcbw@redhat.com>
* panel-applet/NMWirelessAppletDbus.c - (nmwa_dbus_call_nm_method): remove some commented code * src/NetworkManagerAPList.[ch] - (nm_ap_list_remove_ap_by_essid): new function * src/NetworkManagerDevice.c - (nm_device_wireless_force_use): remove access points from the ignore list when the user forces them * src/nm-dbus-device.c - (nm_dbus_device_get_active_network): fix up escaping of object paths git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@557 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
1dfcbf9ecf
commit
044014b1be
6 changed files with 62 additions and 29 deletions
15
ChangeLog
15
ChangeLog
|
|
@ -1,3 +1,18 @@
|
|||
2005-04-04 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* panel-applet/NMWirelessAppletDbus.c
|
||||
- (nmwa_dbus_call_nm_method): remove some commented code
|
||||
|
||||
* src/NetworkManagerAPList.[ch]
|
||||
- (nm_ap_list_remove_ap_by_essid): new function
|
||||
|
||||
* src/NetworkManagerDevice.c
|
||||
- (nm_device_wireless_force_use): remove access points from the ignore list
|
||||
when the user forces them
|
||||
|
||||
* src/nm-dbus-device.c
|
||||
- (nm_dbus_device_get_active_network): fix up escaping of object paths
|
||||
|
||||
2005-04-04 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Patch from Tom Parker: include "nm-utils.h" for backend files that need it
|
||||
|
|
|
|||
|
|
@ -173,28 +173,11 @@ static int nmwa_dbus_call_nm_method (DBusConnection *con, const char *path, cons
|
|||
|
||||
switch (arg_type)
|
||||
{
|
||||
/*
|
||||
case DBUS_TYPE_OBJECT_PATH:
|
||||
*((char **)(arg)) = nm_dbus_unescape_object_path (dbus_string);
|
||||
break;
|
||||
case NM_DBUS_TYPE_OBJECT_PATH_ARRAY:
|
||||
{
|
||||
int i;
|
||||
|
||||
*((char ***) (arg)) = g_new0 (char *, num_items + 1);
|
||||
|
||||
for (i = 0; i < num_items; i++)
|
||||
(*((char ***) (arg)))[i] = nm_dbus_unescape_object_path (dbus_array[i]);
|
||||
|
||||
*item_count = num_items;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case DBUS_TYPE_OBJECT_PATH:
|
||||
case DBUS_TYPE_STRING:
|
||||
*((char **)(arg)) = g_strdup (dbus_string);
|
||||
break;
|
||||
case NM_DBUS_TYPE_OBJECT_PATH_ARRAY:
|
||||
case NM_DBUS_TYPE_OBJECT_PATH_ARRAY:
|
||||
case NM_DBUS_TYPE_STRING_ARRAY:
|
||||
*((char ***)(arg)) = g_strdupv (dbus_array);
|
||||
*item_count = num_items;
|
||||
|
|
|
|||
|
|
@ -192,6 +192,41 @@ void nm_ap_list_remove_ap (NMAccessPointList *list, NMAccessPoint *ap)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_ap_list_remove_ap_by_essid
|
||||
*
|
||||
* Helper to remove an AP from an AP list by the AP's ESSID.
|
||||
*
|
||||
*/
|
||||
void nm_ap_list_remove_ap_by_essid (NMAccessPointList *list, const char *network)
|
||||
{
|
||||
GSList *elt = NULL;
|
||||
|
||||
g_return_if_fail (list != NULL);
|
||||
g_return_if_fail (network != NULL);
|
||||
|
||||
if (!nm_ap_list_lock (list))
|
||||
{
|
||||
nm_warning ("nm_ap_list_append_ap() could not acquire AP list mutex." );
|
||||
return;
|
||||
}
|
||||
|
||||
for (elt = list->ap_list; elt; elt = g_slist_next (elt))
|
||||
{
|
||||
NMAccessPoint *list_ap = (NMAccessPoint *)(elt->data);
|
||||
|
||||
if (nm_null_safe_strcmp (nm_ap_get_essid (list_ap), network) == 0)
|
||||
{
|
||||
list->ap_list = g_slist_remove_link (list->ap_list, elt);
|
||||
nm_ap_unref (list_ap);
|
||||
g_slist_free (elt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
nm_ap_list_unlock (list);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nm_ap_list_get_ap_by_essid
|
||||
*
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ gboolean nm_ap_list_is_empty (NMAccessPointList *list);
|
|||
|
||||
void nm_ap_list_append_ap (NMAccessPointList *list, NMAccessPoint *ap);
|
||||
void nm_ap_list_remove_ap (NMAccessPointList *list, NMAccessPoint *ap);
|
||||
void nm_ap_list_remove_ap_by_essid (NMAccessPointList *list, const char *network);
|
||||
|
||||
NMAccessPoint * nm_ap_list_get_ap_by_essid (NMAccessPointList *list, const char *network);
|
||||
NMAccessPoint * nm_ap_list_get_ap_by_address (NMAccessPointList *list, const struct ether_addr *addr);
|
||||
|
|
|
|||
|
|
@ -3325,6 +3325,13 @@ static gboolean nm_device_wireless_force_use (NMDevice *dev, const char *essid,
|
|||
nm_ap_list_append_ap (nm_device_ap_list_get (dev), ap);
|
||||
nm_ap_unref (ap);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the AP is in the ignore list, we have to remove it since
|
||||
* the User Knows What's Best.
|
||||
*/
|
||||
nm_ap_list_remove_ap_by_essid (dev->app_data->invalid_ap_list, nm_ap_get_essid (ap));
|
||||
}
|
||||
|
||||
/* Now that this AP has an essid, copy over encryption keys and whatnot */
|
||||
if ((tmp_ap = nm_ap_list_get_ap_by_essid (dev->app_data->allowed_ap_list, nm_ap_get_essid (ap))))
|
||||
|
|
|
|||
|
|
@ -210,24 +210,16 @@ static DBusMessage *nm_dbus_device_get_active_network (DBusConnection *connectio
|
|||
if ((best_ap = nm_device_get_best_ap (dev)))
|
||||
{
|
||||
NMAccessPoint *tmp_ap;
|
||||
char *object_path, *escaped_object_path;
|
||||
|
||||
object_path = g_strdup_printf ("%s/%s/Networks/", NM_DBUS_PATH_DEVICES, nm_device_get_iface (dev));
|
||||
escaped_object_path = nm_dbus_escape_object_path (object_path);
|
||||
g_free (object_path);
|
||||
char *object_path = NULL;
|
||||
|
||||
if ( (tmp_ap = nm_device_ap_list_get_ap_by_essid (dev, nm_ap_get_essid (best_ap)))
|
||||
&& (object_path = nm_device_get_path_for_ap (dev, tmp_ap)))
|
||||
{
|
||||
|
||||
escaped_object_path = nm_dbus_escape_object_path (object_path);
|
||||
dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &object_path, DBUS_TYPE_INVALID);
|
||||
g_free (object_path);
|
||||
|
||||
dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &escaped_object_path, DBUS_TYPE_INVALID);
|
||||
success = TRUE;
|
||||
}
|
||||
nm_ap_unref (best_ap);
|
||||
g_free (escaped_object_path);
|
||||
}
|
||||
if (!success)
|
||||
{
|
||||
|
|
@ -278,7 +270,7 @@ static DBusMessage *nm_dbus_device_get_networks (DBusConnection *connection, DBu
|
|||
{
|
||||
object_path = g_strdup_printf ("%s/%s/Networks/%s", NM_DBUS_PATH_DEVICES,
|
||||
nm_device_get_iface (dev), nm_ap_get_essid (ap));
|
||||
escaped_object_path = nm_dbus_escape_object_path (object_path);
|
||||
escaped_object_path = nm_dbus_escape_object_path (object_path);
|
||||
g_free (object_path);
|
||||
dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_OBJECT_PATH,
|
||||
&escaped_object_path);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue