Просмотр исходного кода

tools: only activate action when 'Ok' is pressed

Fixes: #222
Daniele Bartolini 1 год назад
Родитель
Сommit
3a7f6fcdf1
2 измененных файлов с 4 добавлено и 3 удалено
  1. 1 0
      docs/changelog.rst
  2. 3 3
      tools/level_editor/project_browser.vala

+ 1 - 0
docs/changelog.rst

@@ -20,6 +20,7 @@ Changelog
 * Improved unit previews and thumbnails with better lighting/dimensionality.
 * Fixed Project Browser showing stale files in some circumnstances.
 * Items in the Level Tree can now be sorted by name or type.
+* Fixed an issue in the Project Browser that caused a new Unit to be always created even if the user cancelled the "New Unit..." action.
 
 **Runtime**
 

+ 3 - 3
tools/level_editor/project_browser.vala

@@ -133,10 +133,10 @@ private Gtk.Menu? project_entry_menu_create(string type, string name)
 						dg.destroy();
 						return;
 					}
-				}
 
-				var tuple = new GLib.Variant.tuple({(string)name, sb.text});
-				GLib.Application.get_default().activate_action("create-unit", tuple);
+					var tuple = new GLib.Variant.tuple({(string)name, sb.text});
+					GLib.Application.get_default().activate_action("create-unit", tuple);
+				}
 
 				dg.destroy();
 			});