X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fui.c;h=be485aef731794e26a8f16307c58dfadc7bc339b;hb=1b0cbf16ff4f6ecd6da9d0d2b132620622280731;hp=5d8b1166b922220530194a2c08f25942d9248440;hpb=a41504c32c80fc50842c67d2da6a1f9a275d8dda;p=omnplay diff --git a/src/ui.c b/src/ui.c index 5d8b116..be485ae 100644 --- a/src/ui.c +++ b/src/ui.c @@ -41,7 +41,7 @@ typedef struct column_desc GType type; } column_desc_t; -const static column_desc_t playlist_columns[] = +static const column_desc_t playlist_columns[] = { { "REM", @@ -49,7 +49,7 @@ const static column_desc_t playlist_columns[] = }, { "B", - G_TYPE_STRING + G_TYPE_OBJECT }, { "CH", @@ -121,6 +121,7 @@ static GtkWidget* create_treeview(GtkWidget* top, char* name, const column_desc_ int i, count; GtkWidget *treeview; + GtkTreeSelection *selection; GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkListStore *list_store; @@ -129,17 +130,40 @@ static GtkWidget* create_treeview(GtkWidget* top, char* name, const column_desc_ treeview = gtk_tree_view_new (); gtk_widget_show (treeview); + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); + gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); + for(i = 0, count = 0; columns[i].title; i++, count++) - list_store_types[i] = columns[i].type; + list_store_types[i] = (columns[i].type == G_TYPE_OBJECT)?GDK_TYPE_PIXBUF:columns[i].type; + list_store_types[count] = G_TYPE_INT; + + list_store = gtk_list_store_newv(count + 1, list_store_types); - list_store = gtk_list_store_newv(count, list_store_types); gtk_tree_view_set_model( GTK_TREE_VIEW( treeview ), GTK_TREE_MODEL( list_store ) ); for(i = 0; columns[i].title; i++) { - renderer = gtk_cell_renderer_toggle_new(); + char* prop; + + if(columns[i].type == G_TYPE_OBJECT) + { + renderer = gtk_cell_renderer_pixbuf_new(); + gtk_cell_renderer_set_padding(renderer, 0, 0); + prop = "pixbuf"; + } + else if(columns[i].type == G_TYPE_BOOLEAN) + { + renderer = gtk_cell_renderer_toggle_new(); + prop = "active"; + } + else + { + renderer = gtk_cell_renderer_text_new(); + prop = "text"; + } + column = gtk_tree_view_column_new_with_attributes( - columns[i].title, renderer, "text", i, NULL); + columns[i].title, renderer, prop, i, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW( treeview ), column); }; @@ -497,5 +521,22 @@ GtkWidget* ui_omnplay (omnplay_instance_t* app) gtk_container_add (GTK_CONTAINER (wnd), pane_top(wnd, app)); + app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_BLOCK_BEGIN] = + create_pixbuf("block_type_block_start_16x16.png"); + app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_BLOCK_BODY] = + create_pixbuf("block_type_block_middle_16x16.png"); + app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_BLOCK_END] = + create_pixbuf("block_type_block_end_16x16.png"); + app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_BLOCK_SINGLE] = + create_pixbuf("block_type_block_single_16x16.png"); + app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_LOOP_BEGIN] = + create_pixbuf("block_type_loop_start_16x16.png"); + app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_LOOP_BODY] = + create_pixbuf("block_type_loop_middle_16x16.png"); + app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_LOOP_END] = + create_pixbuf("block_type_loop_end_16x16.png"); + app->playlist.block_icons[OMNPLAY_PLAYLIST_ITEM_LOOP_SINGLE] = + create_pixbuf("block_type_block_loop_16x16.png"); + return wnd; }