summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-11-21 03:35:25 +0000
committerJakob Bornecrantz <wallbraker@gmail.com>2009-11-28 21:42:32 +0000
commit7bc8bc88df414f0de8d41293c163a46814fda28c (patch)
treee8eae375fac3a2633f2c873590c55567a7a19eb1
parent1660c30b40629583ef1308d43342c48e2d8dfefa (diff)
Show some info about the texture
-rw-r--r--res/main.xml13
-rw-r--r--src/main.c12
-rw-r--r--src/program.h2
-rw-r--r--src/texture.c7
4 files changed, 29 insertions, 5 deletions
diff --git a/res/main.xml b/res/main.xml
index b9d9cf3..0baadcd 100644
--- a/res/main.xml
+++ b/res/main.xml
@@ -12,6 +12,10 @@
<column type="gchararray"/>
<!-- column-name pixbuf -->
<column type="GdkPixbuf"/>
+ <!-- column-name short_string -->
+ <column type="gchararray"/>
+ <!-- column-name long_string -->
+ <column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="window">
@@ -239,8 +243,8 @@
<property name="headers_clickable">False</property>
<property name="search_column">0</property>
<child>
- <object class="GtkTreeViewColumn" id="col_string">
- <property name="title">Name</property>
+ <object class="GtkTreeViewColumn" id="col_type">
+ <property name="title">Type</property>
</object>
</child>
<child>
@@ -253,6 +257,11 @@
<property name="sizing">autosize</property>
</object>
</child>
+ <child>
+ <object class="GtkTreeViewColumn" id="col_info">
+ <property name="title">Info</property>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/src/main.c b/src/main.c
index aae22c6..85ec359 100644
--- a/src/main.c
+++ b/src/main.c
@@ -194,18 +194,24 @@ static void setup_cols(GtkBuilder *builder, GtkTreeView *view, struct program *p
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_add_attribute(col, renderer, "text", COLUMN_ID);
- /* column format */
- col = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder, "col_string"));
+ /* column type */
+ col = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder, "col_type"));
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_add_attribute(col, renderer, "text", COLUMN_TYPENAME);
- /* column format */
+ /* column icon */
col = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder, "col_icon"));
renderer = gtk_cell_renderer_pixbuf_new();
gtk_tree_view_column_pack_start(col, renderer, TRUE);
gtk_tree_view_column_add_attribute(col, renderer, "pixbuf", COLUMN_PIXBUF);
+ /* column info */
+ col = GTK_TREE_VIEW_COLUMN(gtk_builder_get_object(builder, "col_info"));
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_column_pack_start(col, renderer, TRUE);
+ gtk_tree_view_column_add_attribute(col, renderer, "text", COLUMN_INFO_SHORT);
+
g_object_set(G_OBJECT(renderer), "xalign", (gfloat)0.0f, NULL);
}
diff --git a/src/program.h b/src/program.h
index 3d8b779..462e714 100644
--- a/src/program.h
+++ b/src/program.h
@@ -44,6 +44,8 @@ enum columns {
COLUMN_TYPE,
COLUMN_TYPENAME,
COLUMN_PIXBUF,
+ COLUMN_INFO_SHORT, /* used for info feild */
+ COLUMN_INFO_LONG, /* used for statusbar */
};
enum types {
diff --git a/src/texture.c b/src/texture.c
index f99d84a..cefccd0 100644
--- a/src/texture.c
+++ b/src/texture.c
@@ -434,6 +434,7 @@ static gboolean texture_action_read_info(struct rbug_event *e,
struct rbug_proto_texture_info_reply *info;
struct texture_action_read *action;
uint32_t serial = 0;
+ char info_string[128];
GdkPixbuf *buf = NULL;
info = (struct rbug_proto_texture_info_reply *)header;
@@ -485,7 +486,13 @@ static gboolean texture_action_read_info(struct rbug_event *e,
}
+
gtk_tree_store_set(p->main.treestore, &action->iter, COLUMN_PIXBUF, buf, -1);
+ snprintf(info_string, 128, "%ux%ux%u", info->width[0], info->height[0], info->depth[0]);
+ gtk_tree_store_set(p->main.treestore, &action->iter, COLUMN_INFO_SHORT, info_string, -1);
+ snprintf(info_string, 128, "%s (%ux%ux%u) %u", pf_name(info->format), info->width[0], info->height[0], info->depth[0], info->last_level);
+ gtk_tree_store_set(p->main.treestore, &action->iter, COLUMN_INFO_LONG, info_string + 12, -1);
+
/* no longer interested in this action */
if (!action->running || p->texture.read != action)