2005-09-01 Dan Williams <dcbw@redhat.com>
* gnome/applet/applet-dbus-devices.c - Sort both wireless networks and devices again, which got broken when removing threading git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@921 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2005-09-01 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* gnome/applet/applet-dbus-devices.c
|
||||||
|
- Sort both wireless networks and devices again, which got
|
||||||
|
broken when removing threading
|
||||||
|
|
||||||
2005-09-01 Christopher Aillon <caillon@redhat.com>
|
2005-09-01 Christopher Aillon <caillon@redhat.com>
|
||||||
|
|
||||||
* gnome/applet/applet.c:
|
* gnome/applet/applet.c:
|
||||||
|
@@ -528,9 +528,10 @@ static void nmwa_dbus_net_properties_cb (DBusPendingCall *pcall, void *user_data
|
|||||||
wireless_network_set_strength (net, strength);
|
wireless_network_set_strength (net, strength);
|
||||||
if (act_net && strlen (act_net) && (strcmp (act_net, op) == 0))
|
if (act_net && strlen (act_net) && (strcmp (act_net, op) == 0))
|
||||||
wireless_network_set_active (net, TRUE);
|
wireless_network_set_active (net, TRUE);
|
||||||
|
g_free (act_net);
|
||||||
|
|
||||||
network_device_add_wireless_network (dev, net);
|
network_device_add_wireless_network (dev, net);
|
||||||
g_free (act_net);
|
network_device_sort_wireless_networks (dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbus_message_unref (reply);
|
dbus_message_unref (reply);
|
||||||
@@ -596,6 +597,52 @@ void nmwa_dbus_device_remove_one_network (NMWirelessApplet *applet, const char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* sort_devices_function
|
||||||
|
*
|
||||||
|
* Sort the devices for display... Wired devices at the top.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
sort_devices_function (gconstpointer a, gconstpointer b)
|
||||||
|
{
|
||||||
|
NetworkDevice *dev_a = (NetworkDevice *) a;
|
||||||
|
NetworkDevice *dev_b = (NetworkDevice *) b;
|
||||||
|
const char *name_a;
|
||||||
|
const char *name_b;
|
||||||
|
|
||||||
|
if (network_device_get_desc (dev_a))
|
||||||
|
name_a = network_device_get_desc (dev_a);
|
||||||
|
else if (network_device_get_nm_path (dev_a))
|
||||||
|
name_a = network_device_get_nm_path (dev_a);
|
||||||
|
else
|
||||||
|
name_a = "";
|
||||||
|
|
||||||
|
if (network_device_get_desc (dev_b))
|
||||||
|
name_b = network_device_get_desc (dev_b);
|
||||||
|
else if (network_device_get_nm_path (dev_b))
|
||||||
|
name_b = network_device_get_nm_path (dev_b);
|
||||||
|
else
|
||||||
|
name_b = "";
|
||||||
|
|
||||||
|
if (network_device_get_type (dev_a) == network_device_get_type (dev_b))
|
||||||
|
{
|
||||||
|
return strcmp (name_a, name_b);
|
||||||
|
}
|
||||||
|
if (network_device_is_wired (dev_a))
|
||||||
|
return -1;
|
||||||
|
if (network_device_is_wired (dev_b))
|
||||||
|
return 1;
|
||||||
|
if (network_device_is_wireless (dev_a))
|
||||||
|
return -1;
|
||||||
|
if (network_device_is_wireless (dev_b))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* Unknown device types. Sort by name only at this point. */
|
||||||
|
return strcmp (name_a, name_b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nmwa_dbus_device_properties_cb
|
* nmwa_dbus_device_properties_cb
|
||||||
*
|
*
|
||||||
@@ -669,8 +716,6 @@ static void nmwa_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_d
|
|||||||
network_device_unref (tmp_dev);
|
network_device_unref (tmp_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
applet->device_list = g_slist_append (applet->device_list, dev);
|
|
||||||
|
|
||||||
nmwa_dbus_update_device_info_from_hal (dev, applet);
|
nmwa_dbus_update_device_info_from_hal (dev, applet);
|
||||||
|
|
||||||
if (type == DEVICE_TYPE_WIRELESS_ETHERNET)
|
if (type == DEVICE_TYPE_WIRELESS_ETHERNET)
|
||||||
@@ -686,8 +731,10 @@ static void nmwa_dbus_device_properties_cb (DBusPendingCall *pcall, void *user_d
|
|||||||
nmwa_dbus_device_update_one_network (applet, op, *item, active_network_path);
|
nmwa_dbus_device_update_one_network (applet, op, *item, active_network_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbus_free_string_array (networks);
|
dbus_free_string_array (networks);
|
||||||
|
|
||||||
|
applet->device_list = g_slist_append (applet->device_list, dev);
|
||||||
|
applet->device_list = g_slist_sort (applet->device_list, (GCompareFunc) sort_devices_function);
|
||||||
}
|
}
|
||||||
dbus_message_unref (reply);
|
dbus_message_unref (reply);
|
||||||
|
|
||||||
@@ -1125,49 +1172,3 @@ gboolean nmwa_dbus_update_device_strength (NMWirelessApplet *applet)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* sort_devices_function
|
|
||||||
*
|
|
||||||
* Sort the devices for display... Wired devices at the top.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
sort_devices_function (gconstpointer a, gconstpointer b)
|
|
||||||
{
|
|
||||||
NetworkDevice *dev_a = (NetworkDevice *) a;
|
|
||||||
NetworkDevice *dev_b = (NetworkDevice *) b;
|
|
||||||
const char *name_a;
|
|
||||||
const char *name_b;
|
|
||||||
|
|
||||||
if (network_device_get_desc (dev_a))
|
|
||||||
name_a = network_device_get_desc (dev_a);
|
|
||||||
else if (network_device_get_nm_path (dev_a))
|
|
||||||
name_a = network_device_get_nm_path (dev_a);
|
|
||||||
else
|
|
||||||
name_a = "";
|
|
||||||
|
|
||||||
if (network_device_get_desc (dev_b))
|
|
||||||
name_b = network_device_get_desc (dev_b);
|
|
||||||
else if (network_device_get_nm_path (dev_b))
|
|
||||||
name_b = network_device_get_nm_path (dev_b);
|
|
||||||
else
|
|
||||||
name_b = "";
|
|
||||||
|
|
||||||
if (network_device_get_type (dev_a) == network_device_get_type (dev_b))
|
|
||||||
{
|
|
||||||
return strcmp (name_a, name_b);
|
|
||||||
}
|
|
||||||
if (network_device_is_wired (dev_a))
|
|
||||||
return -1;
|
|
||||||
if (network_device_is_wired (dev_b))
|
|
||||||
return 1;
|
|
||||||
if (network_device_is_wireless (dev_a))
|
|
||||||
return -1;
|
|
||||||
if (network_device_is_wireless (dev_b))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* Unknown device types. Sort by name only at this point. */
|
|
||||||
return strcmp (name_a, name_b);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user