diff options
author | David Härdeman <david@hardeman.nu> | 2015-08-13 21:10:17 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2015-08-13 21:10:17 +0200 |
commit | f1d9e707d0875ef418d2b8c570afcea522101a62 (patch) | |
tree | 2ab51355dcceb125fb77f500b3b222feda5b2b2d /rcm-client-hardware-list.c | |
parent | e0da79284bf42590fc815a5c9d542a40446e39d4 (diff) |
Prettify hardware list
Diffstat (limited to 'rcm-client-hardware-list.c')
-rw-r--r-- | rcm-client-hardware-list.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/rcm-client-hardware-list.c b/rcm-client-hardware-list.c index 0f9fecb..597e26c 100644 --- a/rcm-client-hardware-list.c +++ b/rcm-client-hardware-list.c @@ -66,7 +66,8 @@ void rcng_client_hardware_list_add(GDBusObject *hw) GtkWidget *button; struct hwentry *hwe; gchar *labeltxt; - GtkListBox *hw_list_box; + GtkWidget *hw_list_swin; + GtkWidget *hw_list_box; g_print(" - Object at %s\n", g_dbus_object_get_object_path(hw)); @@ -98,10 +99,19 @@ void rcng_client_hardware_list_add(GDBusObject *hw) gtk_container_add(GTK_CONTAINER(row), box); gtk_widget_show_all(row); - hw_list_box = GTK_LIST_BOX(gtk_stack_get_child_by_name(global->stack, "hardware_page")); - gtk_list_box_insert(hw_list_box, row, -1); + hw_list_swin = GTK_WIDGET(gtk_builder_get_object(global->builder, "hardware_page_swin")); + hw_list_box = gtk_bin_get_child(GTK_BIN(hw_list_swin)); + + 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_container_add(GTK_CONTAINER(hw_list_swin), hw_list_box); + gtk_widget_show_all(hw_list_swin); + } + + gtk_list_box_insert(GTK_LIST_BOX(hw_list_box), row, -1); if (!hw_list) - gtk_stack_set_visible_child(global->stack, GTK_WIDGET(hw_list_box)); + gtk_stack_set_visible_child_name(global->stack, "hardware_page"); hwe = g_malloc(sizeof(*hwe)); hwe->hw = hw; |