176
162
public void buildUI() {
177
cellTrack = new CellRendererText();
178
cellTitle = new CellRendererText();
179
cellLength = new CellRendererText();
180
cellArtist = new CellRendererText();
181
cellAlbum = new SmartAlbumRenderer();
182
cellGenre = new CellRendererText();
183
cellYear = new CellRendererText();
184
cellRating = new CellRendererPixbuf();
185
cellSkips = new CellRendererText();
186
cellPlays = new CellRendererText();
187
cellBitrate = new CellRendererText();
189
cellRating.xalign = 0.0f;
191
//cellTitle.editable = false;
192
//cellTitle.edited.connect(cellTitleEdited);
194
var to_use = new GLib.List<TreeViewColumn>();
195
var originalOrder = new GLib.List<TreeViewColumn>();
196
var correctStringOrder = new GLib.List<string>();
197
to_use = tvs.get_columns();
199
foreach(var tvc in to_use) {
200
originalOrder.append(tvc);
201
correctStringOrder.append(tvc.title);
205
foreach(TreeViewColumn tvc in originalOrder) {
206
if(!(tvc.title == " " || tvc.title == "id")) {
207
if(tvc.title == "Bitrate")
208
insert_column_with_data_func(-1, tvc.title, cellBitrate, cellHelper.bitrateTreeViewFiller);
209
else if(tvc.title == "Length")
210
insert_column_with_data_func(-1, tvc.title, cellLength, cellHelper.lengthTreeViewFiller);
211
else if(tvc.title == "Date Added")
212
insert_column_with_data_func(-1, tvc.title, new CellRendererText(), cellHelper.dateTreeViewFiller);
213
else if(tvc.title == "Last Played")
214
insert_column_with_data_func(-1, tvc.title, new CellRendererText(), cellHelper.dateTreeViewFiller);
215
else if(tvc.title == "Rating")
216
insert_column_with_data_func(-1, tvc.title, cellRating, cellHelper.ratingTreeViewFiller);
217
else if(tvc.title == "Year")
218
insert_column_with_data_func(-1, tvc.title, cellYear, cellHelper.intelligentTreeViewFiller);
219
else if(tvc.title == "#")
220
insert_column_with_data_func(-1, tvc.title, new CellRendererText(), cellHelper.intelligentTreeViewFiller);
221
else if(tvc.title == "Track")
222
insert_column_with_data_func(-1, tvc.title, cellTrack, cellHelper.intelligentTreeViewFiller);
223
else if(tvc.title == "Plays")
224
insert_column_with_data_func(-1, tvc.title, cellPlays, cellHelper.intelligentTreeViewFiller);
225
else if(tvc.title == "Skips")
226
insert_column_with_data_func(-1, tvc.title, cellSkips, cellHelper.intelligentTreeViewFiller);
227
else if(tvc.title == "Title")
228
insert_column_with_data_func(-1, tvc.title, cellTitle, cellHelper.stringTreeViewFiller);
229
else if(tvc.title == "Artist")
230
insert_column_with_data_func(-1, tvc.title, cellArtist, cellHelper.stringTreeViewFiller);
231
else if(tvc.title == "Album")
232
insert_column_with_data_func(-1, tvc.title, cellAlbum, cellHelper.smartAlbumFiller);
233
else if(tvc.title == "Genre")
234
insert_column_with_data_func(-1, tvc.title, cellGenre, cellHelper.stringTreeViewFiller);
235
else if(tvc.title == "BPM")
236
insert_column_with_data_func(-1, tvc.title, new CellRendererText(), cellHelper.intelligentTreeViewFiller);
238
insert_column(tvc, index);
241
get_column(index).resizable = true;
242
get_column(index).reorderable = false;
243
get_column(index).clickable = true;
244
get_column(index).sort_column_id = index;
245
get_column(index).set_sort_indicator(false);
246
get_column(index).visible = tvc.visible;
247
get_column(index).sizing = Gtk.TreeViewColumnSizing.FIXED;
248
get_column(index).fixed_width = tvc.fixed_width;
250
else if(tvc.title == " ") {
251
insert_column(tvc, index);
253
tvc.fixed_width = 24;
254
tvc.clickable = false;
255
tvc.sort_column_id = -1;
256
tvc.resizable = false;
257
tvc.reorderable = false;
259
tvc.clear_attributes (tvc.get_cells().nth_data(0));
260
tvc.clear_attributes (tvc.get_cells().nth_data(1));
262
tvc.set_cell_data_func(tvc.get_cells().nth_data(0), iconDataFunc);
263
tvc.set_cell_data_func(tvc.get_cells().nth_data(1), iconDataFunc);
265
else if(tvc.title == "id") {
266
insert_column(tvc, index);
269
insert_column(tvc, index);
272
get_column(index).get_button().button_press_event.connect(viewHeaderClick);
273
get_column(index).notify["width"].connect(viewHeadersResized);
278
165
set_compare_func(view_compare_func);
279
166
set_search_func(view_search_func);
280
167
set_value_func(view_value_func);
282
//rearrangeColumns(correctStringOrder);
283
//viewColumnsChanged();
285
//enable_grid_lines = TreeViewGridLines.VERTICAL; // will require special theming to work properly
287
169
button_press_event.connect(viewClick);
289
//cursor_changed.connect_after(() => { update_rating_menu(); });
290
170
button_release_event.connect(viewClickRelease);
291
//columns_changed.connect(viewColumnsChanged);
293
172
// column chooser menu
294
columnChooserMenu = new Gtk.Menu();
295
173
columnNumber = new CheckMenuItem.with_label(_("#"));
296
174
columnTrack = new CheckMenuItem.with_label(_("Track"));
297
175
columnTitle = new CheckMenuItem.with_label(_("Title"));