From: Maksym Veremeyenko Date: Wed, 22 Jun 2011 15:30:24 +0000 (+0300) Subject: add row background support X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=ee9061a5a0c2551a337d809c7040ec5790b10e0d;p=melted_gui add row background support --- diff --git a/src/library.c b/src/library.c index e547b5c..0f3c8b7 100644 --- a/src/library.c +++ b/src/library.c @@ -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 ); } diff --git a/src/playlist.c b/src/playlist.c index 1a4f207..fcc4b0b 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -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; diff --git a/src/ui.c b/src/ui.c index c8912db..988561b 100644 --- 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); };