network: list the devices in approximate connection speed order
This commit is contained in:
parent
ad8223c284
commit
3e1053c502
4 changed files with 43 additions and 4 deletions
|
@ -43,6 +43,7 @@ enum {
|
|||
PANEL_DEVICES_COLUMN_ICON,
|
||||
PANEL_DEVICES_COLUMN_TITLE,
|
||||
PANEL_DEVICES_COLUMN_ID,
|
||||
PANEL_DEVICES_COLUMN_SORT,
|
||||
PANEL_DEVICES_COLUMN_TOOLTIP,
|
||||
PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE,
|
||||
PANEL_DEVICES_COLUMN_LAST
|
||||
|
@ -302,6 +303,7 @@ panel_add_device_to_listview (PanelDeviceItem *item)
|
|||
gtk_list_store_set (liststore_devices,
|
||||
&iter,
|
||||
PANEL_DEVICES_COLUMN_ICON, panel_device_type_to_icon_name (item->type),
|
||||
PANEL_DEVICES_COLUMN_SORT, panel_device_type_to_sortable_string (item->type),
|
||||
PANEL_DEVICES_COLUMN_TITLE, title,
|
||||
PANEL_DEVICES_COLUMN_ID, item->device_id,
|
||||
PANEL_DEVICES_COLUMN_TOOLTIP, "tooltip - FIXME!",
|
||||
|
@ -691,11 +693,11 @@ panel_add_devices_columns (CcNetworkPanel *panel, GtkTreeView *treeview)
|
|||
column = gtk_tree_view_column_new_with_attributes ("", renderer,
|
||||
"markup", PANEL_DEVICES_COLUMN_TITLE,
|
||||
NULL);
|
||||
gtk_tree_view_column_set_sort_column_id (column, PANEL_DEVICES_COLUMN_TITLE);
|
||||
gtk_tree_view_column_set_sort_column_id (column, PANEL_DEVICES_COLUMN_SORT);
|
||||
liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
|
||||
"liststore_devices"));
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (liststore_devices),
|
||||
PANEL_DEVICES_COLUMN_TITLE,
|
||||
PANEL_DEVICES_COLUMN_SORT,
|
||||
GTK_SORT_ASCENDING);
|
||||
gtk_tree_view_append_column (treeview, column);
|
||||
gtk_tree_view_column_set_expand (column, TRUE);
|
||||
|
@ -940,7 +942,7 @@ panel_add_proxy_device (CcNetworkPanel *panel)
|
|||
liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (panel->priv->builder,
|
||||
"liststore_devices"));
|
||||
title = g_strdup_printf ("<span size=\"large\">%s</span>",
|
||||
_("Network Proxy"));
|
||||
_("Network proxy"));
|
||||
|
||||
gtk_list_store_append (liststore_devices, &iter);
|
||||
gtk_list_store_set (liststore_devices,
|
||||
|
@ -948,6 +950,7 @@ panel_add_proxy_device (CcNetworkPanel *panel)
|
|||
PANEL_DEVICES_COLUMN_ICON, "preferences-system-network",
|
||||
PANEL_DEVICES_COLUMN_TITLE, title,
|
||||
PANEL_DEVICES_COLUMN_ID, NULL,
|
||||
PANEL_DEVICES_COLUMN_SORT, "9",
|
||||
PANEL_DEVICES_COLUMN_TOOLTIP, _("Set the system proxy settings"),
|
||||
PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE, NULL,
|
||||
-1);
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
<column type="gchararray"/>
|
||||
<!-- column-name id -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name sort -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name tooltip -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name proxy-device -->
|
||||
|
@ -57,7 +59,7 @@
|
|||
<property name="headers_visible">False</property>
|
||||
<property name="search_column">2</property>
|
||||
<property name="show_expanders">False</property>
|
||||
<property name="tooltip_column">3</property>
|
||||
<property name="tooltip_column">4</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -92,6 +92,39 @@ panel_device_type_to_localized_string (guint type)
|
|||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_device_type_to_sortable_string:
|
||||
*
|
||||
* Try to return order of approximate connection speed.
|
||||
**/
|
||||
const gchar *
|
||||
panel_device_type_to_sortable_string (guint type)
|
||||
{
|
||||
const gchar *value = NULL;
|
||||
switch (type) {
|
||||
case NM_DEVICE_TYPE_ETHERNET:
|
||||
value = "1";
|
||||
break;
|
||||
case NM_DEVICE_TYPE_WIFI:
|
||||
value = "2";
|
||||
break;
|
||||
case NM_DEVICE_TYPE_GSM:
|
||||
case NM_DEVICE_TYPE_CDMA:
|
||||
value = "3";
|
||||
break;
|
||||
case NM_DEVICE_TYPE_BLUETOOTH:
|
||||
value = "4";
|
||||
break;
|
||||
case NM_DEVICE_TYPE_MESH:
|
||||
value = "5";
|
||||
break;
|
||||
default:
|
||||
value = "6";
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* panel_ap_mode_to_localized_string:
|
||||
**/
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef enum {
|
|||
|
||||
const gchar *panel_device_type_to_icon_name (guint type);
|
||||
const gchar *panel_device_type_to_localized_string (guint type);
|
||||
const gchar *panel_device_type_to_sortable_string (guint type);
|
||||
const gchar *panel_ap_mode_to_localized_string (guint mode);
|
||||
const gchar *panel_device_state_to_localized_string (guint type);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue