summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2010-12-15 19:37:52 +0000
committerRichard Hughes <richard@hughsie.com>2010-12-15 19:37:52 +0000
commit3e1053c502a54c6690ae02bea4f05acf5b4e461a (patch)
tree03f739b5b1aa8d783880ef53a3ab62eec8094523
parentad8223c284d6dddabb3a8f057ccbf2a7ed967e16 (diff)
network: list the devices in approximate connection speed order
-rw-r--r--panels/network/cc-network-panel.c9
-rw-r--r--panels/network/network.ui4
-rw-r--r--panels/network/panel-common.c33
-rw-r--r--panels/network/panel-common.h1
4 files changed, 43 insertions, 4 deletions
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 70f685bc4..2c2edeeb7 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -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);
diff --git a/panels/network/network.ui b/panels/network/network.ui
index b96dcbb6e..8dc60ea1f 100644
--- a/panels/network/network.ui
+++ b/panels/network/network.ui
@@ -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>
diff --git a/panels/network/panel-common.c b/panels/network/panel-common.c
index 3a19bd78e..07bac6c97 100644
--- a/panels/network/panel-common.c
+++ b/panels/network/panel-common.c
@@ -93,6 +93,39 @@ panel_device_type_to_localized_string (guint type)
}
/**
+ * 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:
**/
const gchar *
diff --git a/panels/network/panel-common.h b/panels/network/panel-common.h
index c92fd942b..57a7c1792 100644
--- a/panels/network/panel-common.h
+++ b/panels/network/panel-common.h
@@ -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);