Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.83 KB | None | 0 0
  1. public void smartPixTextColumnData(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) {
  2.         GLib.Object o = null;
  3.         string title = "";
  4.         tree_model.get(iter, 0, out o, 2, out title);
  5.        
  6.         if(cell is CellRendererText) {
  7.             string text;
  8.             tree_model.get(iter, 2, out text);
  9.             ((CellRendererText)cell).text = text;
  10.         }
  11.         else if(cell is CellRendererPixbuf && title == "Song Info") {
  12.             //stdout.printf("song info\n");
  13.             ((CellRendererPixbuf)cell).pixbuf = get_pixbuf_from_stock("info", IconSize.MENU);
  14.         }
  15.         else if(cell is CellRendererPixbuf && title == "Collection") {
  16.             stdout.printf("collection\n");
  17.             ((CellRendererPixbuf)cell).pixbuf = get_pixbuf_from_stock("media-audio", IconSize.MENU);
  18.             ((CellRendererPixbuf)cell).stock_id = "media-audio";
  19.         }
  20.         else if(cell is CellRendererPixbuf && title == "Queue") {
  21.             ((CellRendererPixbuf)cell).pixbuf = get_pixbuf_from_stock("media-audio", IconSize.MENU);
  22.             ((CellRendererPixbuf)cell).stock_id = "media-audio";
  23.         }
  24.         else if(cell is CellRendererPixbuf && title == "Already Played") {
  25.             ((CellRendererPixbuf)cell).pixbuf = get_pixbuf_from_stock("playlist-automatic", IconSize.MENU);
  26.         }
  27.         else if(cell is CellRendererPixbuf && o is SmartPlaylist) {
  28.             ((CellRendererPixbuf)cell).pixbuf = get_pixbuf_from_stock("playlist-automatic", IconSize.MENU);
  29.         }
  30.         else if(cell is CellRendererPixbuf && o is Playlist) {
  31.             ((CellRendererPixbuf)cell).pixbuf = new Gdk.Pixbuf.from_file("/home/scott/elementaryicons/elementary-icon-theme/elementary/mimes/16/playlist.svg");
  32.         }
  33.     }
  34.    
  35.     Gdk.Pixbuf get_pixbuf_from_stock (string stock_id, Gtk.IconSize size)
  36.     {
  37.       Gdk.Pixbuf pixbuf;
  38.       Gtk.Invisible w;
  39.      
  40.       w = new Gtk.Invisible ();
  41.       pixbuf = w.render_icon(stock_id, size, "vala");
  42.      
  43.       if(pixbuf == null)
  44.         stdout.printf("null\n");
  45.      
  46.       return pixbuf;
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement