[alacarte] ItemEditor: Make the name/exec fields required



commit 93e78f9c65e63ab5f67f80173fbcb17e5f224c1d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Jan 11 00:51:46 2013 -0500

    ItemEditor: Make the name/exec fields required
    
    You can't have a launcher without these.

 Alacarte/ItemEditor.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/Alacarte/ItemEditor.py b/Alacarte/ItemEditor.py
index bf8aa14..46f2da7 100644
--- a/Alacarte/ItemEditor.py
+++ b/Alacarte/ItemEditor.py
@@ -84,8 +84,20 @@ class LauncherEditor(object):
         self.builder.get_object('icon-button').connect('clicked', self.pick_icon)
         self.builder.get_object('exec-browse').connect('clicked', self.pick_exec)
 
+        self.builder.get_object('name-entry').connect('changed', self.resync_validity)
+        self.builder.get_object('exec-entry').connect('changed', self.resync_validity)
+
         self.item_path = item_path
         self.load()
+        self.resync_validity()
+
+    def resync_validity(self, *args):
+        name_text = self.builder.get_object('name-entry').get_text()
+        exec_text = self.builder.get_object('exec-entry').get_text()
+
+        valid = (name_text and exec_text)
+
+        self.builder.get_object('ok').set_sensitive(valid)
 
     def load(self):
         self.keyfile = GLib.KeyFile()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]