瀏覽代碼

tools: add name column with full resource name

Daniele Bartolini 1 年之前
父節點
當前提交
61f7788765
共有 1 個文件被更改,包括 17 次插入0 次删除
  1. 17 0
      tools/level_editor/project_browser.vala

+ 17 - 0
tools/level_editor/project_browser.vala

@@ -442,6 +442,12 @@ public class ProjectFolderView : Gtk.Bin
 		column.set_cell_data_func(cell_text, list_view_mtime_text_func);
 		_list_view.append_column(column);
 
+		column = new Gtk.TreeViewColumn();
+		column.title = "Name";
+		column.pack_start(cell_text, true);
+		column.set_cell_data_func(cell_text, list_view_name_text_func);
+		_list_view.append_column(column);
+
 		_empty_pixbuf = new Gdk.Pixbuf.from_data({ 0x00, 0x00, 0x00, 0x00 }, Gdk.Colorspace.RGB, true, 8, 1, 1, 4);
 
 		_showing_project_folder = true;
@@ -670,6 +676,17 @@ public class ProjectFolderView : Gtk.Bin
 		}
 	}
 
+	private void list_view_name_text_func(Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
+	{
+		Value name;
+		model.get_value(iter, Column.NAME, out name);
+
+		if (name == "..")
+			cell.set_property("text", "n/a");
+		else
+			cell.set_property("text", (string)name);
+	}
+
 	public void reveal(string type, string name)
 	{
 		_list_store.foreach((model, path, iter) => {