add row background support
authorMaksym Veremeyenko <verem@m1stereo.tv>
Wed, 22 Jun 2011 15:30:24 +0000 (18:30 +0300)
committerMaksym Veremeyenko <verem@m1stereo.tv>
Wed, 22 Jun 2011 15:30:24 +0000 (18:30 +0300)
src/library.c
src/playlist.c
src/ui.c

index e547b5c..0f3c8b7 100644 (file)
@@ -263,6 +263,8 @@ void omnplay_library_draw(omnplay_instance_t* app)
             1, frames2tc(app->library.item[i].dur, 25.0, tc),
             2, app->library.item[i].title,
             3, i,
+            4, FALSE,
+            5, "red",
             -1 );
     }
 
index 1a4f207..fcc4b0b 100644 (file)
@@ -218,6 +218,8 @@ void omnplay_playlist_draw(omnplay_instance_t* app)
             5, frames2tc(app->playlist.item[i].dur, 25.0, tc2),
             6, app->playlist.item[i].title,
             7, i,
+            8, (app->playlist.item[i].error != 0),
+            9, (app->playlist.item[i].error & PLAYLIST_ITEM_ERROR_LIB)?"red":"orange",
             -1 );
     }
 
@@ -254,6 +256,8 @@ static gboolean omnplay_playlist_draw_item_proc(
         5, frames2tc(app->playlist.item[i].dur, 25.0, tc2),
         6, app->playlist.item[i].title,
         7, i,
+        8, (app->playlist.item[i].error != 0),
+        9, (app->playlist.item[i].error & PLAYLIST_ITEM_ERROR_LIB)?"red":"orange",
         -1 );
 
     return TRUE;
index c8912db..988561b 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -131,6 +131,7 @@ static GtkWidget* create_treeview(GtkWidget* top, char* name, const column_desc_
 
     treeview = gtk_tree_view_new ();
     gtk_widget_show (treeview);
+    gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
 
     selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
     gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
@@ -138,14 +139,17 @@ static GtkWidget* create_treeview(GtkWidget* top, char* name, const column_desc_
     for(i = 0, count = 0; columns[i].title; i++, count++)
         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_types[count + 1] = G_TYPE_BOOLEAN;
+    list_store_types[count + 2] = G_TYPE_STRING;
 
-    list_store = gtk_list_store_newv(count + 1, list_store_types);
+    list_store = gtk_list_store_newv(count + 3, list_store_types);
 
     gtk_tree_view_set_model( GTK_TREE_VIEW( treeview ), GTK_TREE_MODEL( list_store ) );
 
     for(i = 0; columns[i].title; i++)
     {
         char* prop;
+        column = NULL;
 
         if(columns[i].type == G_TYPE_OBJECT)
         {
@@ -162,10 +166,21 @@ static GtkWidget* create_treeview(GtkWidget* top, char* name, const column_desc_
         {
             renderer = gtk_cell_renderer_text_new();
             prop = "text";
+
+            column = gtk_tree_view_column_new_with_attributes(
+                columns[i].title, renderer,
+                    prop, i,
+                    "background-set", count + 1,
+                    "background", count + 2,
+                    NULL);
         }
 
-        column = gtk_tree_view_column_new_with_attributes(
-            columns[i].title, renderer, prop, i, NULL);
+        if(!column)
+            column = gtk_tree_view_column_new_with_attributes(
+                columns[i].title, renderer,
+                    prop, i,
+                    NULL);
+
         gtk_tree_view_append_column(GTK_TREE_VIEW( treeview ), column);
     };