Răsfoiți Sursa

tools: force project-browser panel to show when revealing resources

Fixes: #296
Daniele Bartolini 11 luni în urmă
părinte
comite
6d718dc9db

+ 13 - 1
tools/level_editor/level_editor.vala

@@ -559,7 +559,8 @@ public class LevelEditorApplication : Gtk.Application
 		{ "create-script",    on_create_script,    "(ssb)", null },
 		{ "create-unit",      on_create_unit,      "(ss)",  null },
 		{ "open-containing",  on_open_containing,  "s",     null },
-		{ "texture-settings", on_texture_settings, "s",     null }
+		{ "texture-settings", on_texture_settings, "s",     null },
+		{ "reveal-resource",  on_reveal,           "(ss)",  null }
 	};
 
 	private const GLib.ActionEntry[] action_entries_package =
@@ -2462,6 +2463,17 @@ public class LevelEditorApplication : Gtk.Application
 		_texture_settings_dialog.present();
 	}
 
+	private void on_reveal(GLib.SimpleAction action, GLib.Variant? param)
+	{
+		string type = (string)param.get_child_value(0);
+		string name = (string)param.get_child_value(1);
+
+		if (!_project_notebook.is_visible())
+			_project_notebook.show_all();
+
+		_project_browser.reveal(type, name);
+	}
+
 	private int run_level_changed_dialog(Gtk.Window? parent)
 	{
 		Gtk.MessageDialog md = new Gtk.MessageDialog(parent

+ 6 - 15
tools/level_editor/project_browser.vala

@@ -1217,7 +1217,6 @@ public class ProjectBrowser : Gtk.Bin
 		// Actions.
 		GLib.ActionEntry[] action_entries =
 		{
-			{ "reveal-resource",     on_reveal,              "(ss)", null },
 			{ "open-directory",      on_open_directory,      "s",    null },
 			{ "favorite-resource",   on_favorite_resource,   "(ss)", null },
 			{ "unfavorite-resource", on_unfavorite_resource, "(ss)", null }
@@ -1267,8 +1266,13 @@ public class ProjectBrowser : Gtk.Bin
 			;
 	}
 
-	private void reveal(string type, string name)
+	public void reveal(string type, string name)
 	{
+		if (name.has_prefix("core/")) {
+			_hide_core_resources = false;
+			_tree_filter.refilter();
+		}
+
 		string parent_type = type;
 		string parent_name = name;
 		Gtk.TreePath filter_path = null;
@@ -1299,19 +1303,6 @@ public class ProjectBrowser : Gtk.Bin
 		} while (filter_path == null);
 	}
 
-	private void on_reveal(GLib.SimpleAction action, GLib.Variant? param)
-	{
-		string type = (string)param.get_child_value(0);
-		string name = (string)param.get_child_value(1);
-
-		if (name.has_prefix("core/")) {
-			_hide_core_resources = false;
-			_tree_filter.refilter();
-		}
-
-		reveal(type, name);
-	}
-
 	private void on_open_directory(GLib.SimpleAction action, GLib.Variant? param)
 	{
 		string dir_name = param.get_string();