cue function prototype added
[omnplay] / src / ui.c
index 5d8b116..bdd95b0 100644 (file)
--- 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",
@@ -130,16 +130,36 @@ static GtkWidget* create_treeview(GtkWidget* top, char* name, const column_desc_
     gtk_widget_show (treeview);
 
     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 +517,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;
 }