From 440f713b91146a44b5a4a4ae3ce495b5aaef6d4b Mon Sep 17 00:00:00 2001 From: Qball Cow Date: Tue, 27 Dec 2011 18:12:24 +0100 Subject: [PATCH] Allow setting of stock-id on the Sidebar Cell Renderer --- src/Widgets/gmpc-sidebar-view.vala | 7 ++++++- src/browsers/playlist3-find2-browser.c | 4 +++- src/playlist3.c | 4 +++- src/plugin.h | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Widgets/gmpc-sidebar-view.vala b/src/Widgets/gmpc-sidebar-view.vala index 974e9aaa..116e10e8 100644 --- a/src/Widgets/gmpc-sidebar-view.vala +++ b/src/Widgets/gmpc-sidebar-view.vala @@ -37,6 +37,11 @@ public class MyCellRenderer : Gtk.CellRenderer cr_pb.icon_name = value; } } + public string stock_id { + set{ + cr_pb.stock_id = value; + } + } public int weight { set { cr_text.weight = value;}} public bool weight_set { set { cr_text.weight_set = value;}} @@ -122,7 +127,7 @@ public class MyCellRenderer : Gtk.CellRenderer ca.width = image_width+6;//cell_area.height; ca.height = cell_area.height; - if(cr_pb.icon_name != null ) + if(cr_pb.icon_name != null || cr_pb.stock_id != null ) { cr_pb.render(window, widget, background_area, ca, expose_area, flags); diff --git a/src/browsers/playlist3-find2-browser.c b/src/browsers/playlist3-find2-browser.c index 51033444..a5118b44 100644 --- a/src/browsers/playlist3-find2-browser.c +++ b/src/browsers/playlist3-find2-browser.c @@ -306,7 +306,9 @@ static void pl3_find2_browser_add(GtkWidget * cat_tree) playlist3_insert_browser(&iter, PL3_CAT_BROWSER_LIBRARY+pos%PL3_CAT_BROWSER_LIBRARY); gtk_list_store_set(GTK_LIST_STORE(pl3_tree), &iter, PL3_CAT_TYPE, find2_browser_plug.id, - PL3_CAT_TITLE, _("Search"), PL3_CAT_ICON_ID, GTK_STOCK_FIND, -1); + PL3_CAT_TITLE, _("Search"), + PL3_CAT_STOCK_ID, GTK_STOCK_FIND, + -1); if (pl3_find2_ref) { diff --git a/src/playlist3.c b/src/playlist3.c index 315b7c2b..f78b9c1f 100644 --- a/src/playlist3.c +++ b/src/playlist3.c @@ -1036,7 +1036,8 @@ void create_playlist3(void) G_TYPE_STRING, /* full path and stuff for backend */ G_TYPE_STRING, /* icon id */ G_TYPE_INT, /* ordering */ - G_TYPE_INT + G_TYPE_INT, /* Bold */ + G_TYPE_STRING /* stock id */ }; /* song id, song title */ pl3_tree = (GtkTreeModel *) gmpc_tools_liststore_sort_new(); @@ -1089,6 +1090,7 @@ void create_playlist3(void) } gtk_tree_view_column_set_attributes(column, renderer, "icon-name", PL3_CAT_ICON_ID, + "stock-id", PL3_CAT_STOCK_ID, "text", PL3_CAT_TITLE, "weight", PL3_CAT_BOLD, NULL); g_object_set(renderer, "weight-set", TRUE, NULL); diff --git a/src/plugin.h b/src/plugin.h index 2182170e..5ad1fa36 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -62,6 +62,7 @@ typedef enum PL3_CAT_ICON_ID, /* icon id */ PL3_CAT_ORDER, /* int for sorting the list */ PL3_CAT_BOLD, + PL3_CAT_STOCK_ID, PL3_CAT_NROWS } pl3_cat_store; -- 2.11.4.GIT