[meld] Make edit command and text codec entry apply on focus-out and activate



commit 1a818e5283a3915e133a87565bf6d20838d6c87e
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Apr 30 18:00:17 2010 +1000

    Make edit command and text codec entry apply on focus-out and activate

 data/ui/preferences.glade |    4 ++++
 meld/preferences.py       |   16 +++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/data/ui/preferences.glade b/data/ui/preferences.glade
index a92f3f5..cab5ad7 100644
--- a/data/ui/preferences.glade
+++ b/data/ui/preferences.glade
@@ -386,6 +386,8 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="invisible_char">*</property>
+                                    <signal name="focus_out_event" handler="on_custom_edit_command_entry_activate"/>
+                                    <signal name="activate" handler="on_custom_edit_command_entry_activate"/>
                                   </widget>
                                   <packing>
                                     <property name="padding">5</property>
@@ -619,6 +621,8 @@
                                     <property name="can_focus">True</property>
                                     <property name="invisible_char">*</property>
                                     <property name="text">utf8 iso8859</property>
+                                    <signal name="focus_out_event" handler="on_entry_text_codecs_activate"/>
+                                    <signal name="activate" handler="on_entry_text_codecs_activate"/>
                                   </widget>
                                   <packing>
                                     <property name="expand">False</property>
diff --git a/meld/preferences.py b/meld/preferences.py
index 5a16bc2..9e48207 100644
--- a/meld/preferences.py
+++ b/meld/preferences.py
@@ -211,6 +211,10 @@ class PreferencesDialog(gnomeglade.Component):
         else:
             self.prefs.edit_command_type = "custom"
 
+    def on_custom_edit_command_entry_activate(self, entry, *args):
+        # Called on "activate" and "focus-out-event"
+        self.prefs.edit_command_custom = entry.props.text
+
     #
     # filters
     #
@@ -219,13 +223,11 @@ class PreferencesDialog(gnomeglade.Component):
     def on_checkbutton_ignore_blank_lines_toggled(self, check):
         self.prefs.ignore_blank_lines = check.get_active()
 
-    #
-    # Save text entry values into preferences
-    #
-    def on_response(self, dialog, arg):
-        if arg==gtk.RESPONSE_CLOSE:
-            self.prefs.text_codecs = self.entry_text_codecs.props.text
-            self.prefs.edit_command_custom = self.custom_edit_command_entry.props.text
+    def on_entry_text_codecs_activate(self, entry, *args):
+        # Called on "activate" and "focus-out-event"
+        self.prefs.text_codecs = entry.props.text
+
+    def on_response(self, dialog, response_id):
         self.widget.destroy()
 
 



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