summaryrefslogtreecommitdiff
path: root/rcm-client-hardware-list.c
diff options
context:
space:
mode:
Diffstat (limited to 'rcm-client-hardware-list.c')
-rw-r--r--rcm-client-hardware-list.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/rcm-client-hardware-list.c b/rcm-client-hardware-list.c
index 81f0707..ec29b46 100644
--- a/rcm-client-hardware-list.c
+++ b/rcm-client-hardware-list.c
@@ -84,6 +84,13 @@ hardware_properties_cb(GtkButton *button, gpointer user_data)
gtk_widget_hide(dialog);
}
+static gint
+rcdev_sort(GtkListBoxRow *a, GtkListBoxRow *b, gpointer user_data)
+{
+ return strcmp(g_object_get_data(G_OBJECT(a), "rcdev"),
+ g_object_get_data(G_OBJECT(b), "rcdev"));
+}
+
void rcng_client_hardware_list_add(GDBusObject *hw)
{
GList *interfaces;
@@ -122,6 +129,8 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
rcdevice_get_hardware_type(object));
row = gtk_list_box_row_new();
+ g_object_set_data_full(G_OBJECT(row), "rcdev", rcdevice_dup_sys_name(object), g_free);
+
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
gtk_widget_set_margin_top(box, 6);
gtk_widget_set_margin_bottom(box, 6);
@@ -165,6 +174,7 @@ void rcng_client_hardware_list_add(GDBusObject *hw)
if (!hw_list_box) {
hw_list_box = gtk_list_box_new();
gtk_list_box_set_selection_mode(GTK_LIST_BOX(hw_list_box), GTK_SELECTION_NONE);
+ gtk_list_box_set_sort_func(GTK_LIST_BOX(hw_list_box), rcdev_sort, NULL, NULL);
gtk_container_add(GTK_CONTAINER(hw_list_swin), hw_list_box);
gtk_widget_show_all(hw_list_swin);
}