[alacarte] ItemEditor: Clean up validation logic a tiny bit
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [alacarte] ItemEditor: Clean up validation logic a tiny bit
- Date: Fri, 18 Apr 2014 14:09:16 +0000 (UTC)
commit ca7d05cc060e0a31039bb8186da35058f6b02cd1
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Apr 18 10:08:27 2014 -0400
ItemEditor: Clean up validation logic a tiny bit
When g_shell_parse_argv returns FALSE, it means an error has been
thrown, so we don't need to check it ourselves.
Alacarte/ItemEditor.py | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/Alacarte/ItemEditor.py b/Alacarte/ItemEditor.py
index e89c0ff..7b9d47a 100644
--- a/Alacarte/ItemEditor.py
+++ b/Alacarte/ItemEditor.py
@@ -181,15 +181,11 @@ class LauncherEditor(ItemEditor):
def exec_line_is_valid(self, exec_text):
try:
- # Attempting to parse command - commands are not simply program names or paths... Errors are
raised for blank or invalid input (e.g. missing closing quote)
- result = GLib.shell_parse_argv(exec_text)
- if result[0]:
- # Parsing succeeded - making sure program (first part of the command) is in the path
- command = result[1][0]
- return (GLib.find_program_in_path(command) is not None)
- else:
- # Parsing failure, but not reported via raised GError?
- return False
+ success, parsed = GLib.shell_parse_argv(exec_text)
+
+ # Make sure program (first part of the command) is in the path
+ command = parsed[0]
+ return (GLib.find_program_in_path(command) is not None)
except GLib.GError:
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]