From: Svjatoslav Agejenko Date: Thu, 27 Nov 2014 12:18:24 +0000 (+0200) Subject: fixed opening of new nautilus window X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=e83e5b610b7fe67d66fc01c634975a6af7f54dad;p=instantlauncher.git fixed opening of new nautilus window --- diff --git a/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java b/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java index a10dabe..f66f952 100755 --- a/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java +++ b/src/main/java/eu/svjatoslav/instantlauncher/menu/MultiLevelMenu.java @@ -42,8 +42,9 @@ public class MultiLevelMenu implements MenuListener { public boolean addMenu(final File directory) { final int newMenuHorizontalIndex = menus.size(); - if (newMenuHorizontalIndex >= VERTICAL_MENUS_COUNT) + if (newMenuHorizontalIndex >= VERTICAL_MENUS_COUNT) { return false; + } final Menu menu = new Menu(directory); menu.addMenuListener(this); @@ -85,8 +86,9 @@ public class MultiLevelMenu implements MenuListener { public int getMenuIndex(final Menu menu) { int i = 0; for (final Menu m : menus) { - if (m == menu) + if (m == menu) { return i; + } i++; } return -1; @@ -111,17 +113,19 @@ public class MultiLevelMenu implements MenuListener { @Override public void menuItemSelected(final Menu menu, final File chosenFile) { - if (chosenFile.isFile()) - if (chosenFile.canExecute()) + if (chosenFile.isFile()) { + if (chosenFile.canExecute()) { executeCommand(chosenFile.getAbsolutePath()); - else { + } else { final boolean fileOpened = FileAssociationManager.openFile(chosenFile); - if (fileOpened) + if (fileOpened) { InstantLauncher.exitProgram(); + } } + } if (chosenFile.isDirectory()) { - executeCommand("nautilus", "-n", chosenFile.getAbsolutePath()); + executeCommand("nautilus", "-w", chosenFile.getAbsolutePath()); } } @@ -137,9 +141,9 @@ public class MultiLevelMenu implements MenuListener { @Override public void menuItemSelectedAlternative(final Menu menu, final File chosenFile) { - if (chosenFile.isFile()) + if (chosenFile.isFile()) { chosenFile.setExecutable(!chosenFile.canExecute()); - else { + } else { executeCommand("gnome-terminal", "--working-directory=" + chosenFile.getAbsolutePath()); } } @@ -151,8 +155,9 @@ public class MultiLevelMenu implements MenuListener { jPanel.removeAll(); } - while (menus.size() > fromIndex) + while (menus.size() > fromIndex) { menus.remove(fromIndex); + } } @Override