[gtk/wip/otte/listview: 43/150] testlistview: Show the row number
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/listview: 43/150] testlistview: Show the row number
- Date: Sun, 8 Dec 2019 05:32:01 +0000 (UTC)
commit 9435b7135d960ab16aba72a24508e5aeaf1069d7
Author: Benjamin Otte <otte redhat com>
Date: Wed Sep 26 01:41:39 2018 +0200
testlistview: Show the row number
Always show the current row. This is mostly useful for debugging, not
for beauty.
tests/testlistview.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/tests/testlistview.c b/tests/testlistview.c
index 0608370fb1..a423d2c0f6 100644
--- a/tests/testlistview.c
+++ b/tests/testlistview.c
@@ -163,7 +163,7 @@ create_list_model_for_directory (gpointer file)
static void
bind_widget (GtkListItem *list_item,
- gpointer unused)
+ gpointer unused)
{
GtkWidget *box, *child;
GFileInfo *info;
@@ -171,12 +171,19 @@ bind_widget (GtkListItem *list_item,
guint depth;
GIcon *icon;
gpointer item;
+ char *s;
item = gtk_list_item_get_item (list_item);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_list_item_set_child (list_item, box);
+ child = gtk_label_new (NULL);
+ gtk_label_set_width_chars (GTK_LABEL (child), 5);
+ gtk_label_set_xalign (GTK_LABEL (child), 1.0);
+ g_object_bind_property (list_item, "position", child, "label", G_BINDING_SYNC_CREATE);
+ gtk_container_add (GTK_CONTAINER (box), child);
+
depth = gtk_tree_list_row_get_depth (item);
if (depth > 0)
{
@@ -216,7 +223,9 @@ bind_widget (GtkListItem *list_item,
}
file = g_object_get_data (G_OBJECT (info), "file");
- child = gtk_label_new (g_file_get_basename (file));
+ s = g_file_get_basename (file);
+ child = gtk_label_new (s);
+ g_free (s);
g_object_unref (info);
gtk_container_add (GTK_CONTAINER (box), child);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]