diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2009-12-22 20:21:47 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2009-12-22 20:21:47 +0100 |
commit | d7427af59c06fe1186b97998df4f0f158e0ef818 (patch) | |
tree | 63d2bae5d7b0aefbe44867b41d77595c6a5e55c1 | |
parent | f8ef07d58d8412759c15269abcb03bbeed1f52db (diff) |
Fixed columns.
-rw-r--r-- | walls_model.c | 24 | ||||
-rw-r--r-- | walls_model.h | 1 | ||||
-rw-r--r-- | window_main.c | 12 |
3 files changed, 24 insertions, 13 deletions
diff --git a/walls_model.c b/walls_model.c index 0cfc4f8..f7f9bb0 100644 --- a/walls_model.c +++ b/walls_model.c @@ -74,12 +74,11 @@ static void walls_model_init(WallsModel *walls_model) { walls_model->n_columns = WALLS_MODEL_N_COLUMNS; walls_model->column_types[0] = G_TYPE_STRING; - walls_model->column_types[1] = G_TYPE_UINT64; - walls_model->column_types[2] = G_TYPE_INT; - walls_model->column_types[3] = G_TYPE_INT; - walls_model->column_types[4] = G_TYPE_INT; + walls_model->column_types[1] = G_TYPE_STRING; + walls_model->column_types[2] = G_TYPE_STRING; + walls_model->column_types[3] = G_TYPE_STRING; - g_assert(WALLS_MODEL_N_COLUMNS == 5); + g_assert(WALLS_MODEL_N_COLUMNS == 4); walls_model->num_rows = 0; walls_model->rows = g_array_new(TRUE, FALSE, sizeof(WallsModelRecord)); @@ -277,7 +276,11 @@ static void walls_model_get_value(GtkTreeModel *tree_model, GtkTreeIter *iter, g // g_return_if_reached(); if(record->type == WALLS_MODEL_TYPE_DIR) { - g_value_set_string(value, record->dir.name); + if(column == WALLS_MODEL_COL_NAME) { + g_value_set_string(value, record->dir.name); + } else { + g_value_set_string(value, ""); + } return; } @@ -285,17 +288,14 @@ static void walls_model_get_value(GtkTreeModel *tree_model, GtkTreeIter *iter, g case WALLS_MODEL_COL_NAME: g_value_set_string(value, record->wall.filepath); break; - case WALLS_MODEL_COL_ID: - g_value_set_uint64(value, record->wall.id); - break; case WALLS_MODEL_COL_SIZE: - g_value_set_int(value, record->wall.size); + g_value_set_string_take_ownership(value, g_strdup_printf("%d", record->wall.size)); break; case WALLS_MODEL_COL_WIDTH: - g_value_set_int(value, record->wall.width); + g_value_set_string_take_ownership(value, g_strdup_printf("%d", record->wall.width)); break; case WALLS_MODEL_COL_HEIGHT: - g_value_set_int(value, record->wall.height); + g_value_set_string_take_ownership(value, g_strdup_printf("%d", record->wall.height)); break; } } diff --git a/walls_model.h b/walls_model.h index a5cc779..4f9f43a 100644 --- a/walls_model.h +++ b/walls_model.h @@ -20,7 +20,6 @@ enum { enum { WALLS_MODEL_COL_NAME = 0, - WALLS_MODEL_COL_ID, WALLS_MODEL_COL_SIZE, WALLS_MODEL_COL_WIDTH, WALLS_MODEL_COL_HEIGHT, diff --git a/window_main.c b/window_main.c index 376d604..bca438a 100644 --- a/window_main.c +++ b/window_main.c @@ -36,6 +36,18 @@ inline static void filetree_init(GtkTreeView *filetree) { gtk_tree_view_column_pack_start(col1, renderer, TRUE); gtk_tree_view_column_add_attribute(col1, renderer, "text", 0); + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_column_pack_start(col2, renderer, TRUE); + gtk_tree_view_column_add_attribute(col2, renderer, "text", 1); + + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_column_pack_start(col3, renderer, TRUE); + gtk_tree_view_column_add_attribute(col3, renderer, "text", 2); + + renderer = gtk_cell_renderer_text_new(); + gtk_tree_view_column_pack_start(col4, renderer, TRUE); + gtk_tree_view_column_add_attribute(col4, renderer, "text", 3); + filetree_create_model(filetree); } |