[pitivi] dialogs: Fix clip media props cannot be closed



commit c33f2197d49ae892a59efbd55dc7dc2432a861ac
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue Jun 28 16:37:12 2016 +0200

    dialogs: Fix clip media props cannot be closed
    
    It can actually be closed using the x button in the top-right but only
    if it's clicked twice. The first click was not doing anything.
    
    Removed some handles for the two buttons at the bottom and used the
    "response" signal instead.
    
    Differential Revision: https://phabricator.freedesktop.org/D1141

 data/ui/clipmediaprops.ui        |   15 ++++++++-------
 pitivi/dialogs/clipmediaprops.py |    9 +++++----
 2 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/data/ui/clipmediaprops.ui b/data/ui/clipmediaprops.ui
index 8503a73..69a0c9c 100644
--- a/data/ui/clipmediaprops.ui
+++ b/data/ui/clipmediaprops.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.1 -->
+<!-- Generated with glade 3.20.0 -->
 <interface>
   <requires lib="gtk+" version="3.10"/>
   <object class="GtkDialog" id="Import Settings">
@@ -19,13 +19,12 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button1">
+              <object class="GtkButton" id="cancel_button">
                 <property name="label" translatable="yes">_Cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_underline">True</property>
-                <signal name="clicked" handler="_cancelButtonCb" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -34,13 +33,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button2">
+              <object class="GtkButton" id="apply_button">
                 <property name="label" translatable="yes">_Apply to project</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_underline">True</property>
-                <signal name="clicked" handler="_applyButtonCb" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -374,8 +372,11 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="0">button1</action-widget>
-      <action-widget response="0">button2</action-widget>
+      <action-widget response="2">cancel_button</action-widget>
+      <action-widget response="1">apply_button</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
diff --git a/pitivi/dialogs/clipmediaprops.py b/pitivi/dialogs/clipmediaprops.py
index 6a6fb66..b2a4cbd 100644
--- a/pitivi/dialogs/clipmediaprops.py
+++ b/pitivi/dialogs/clipmediaprops.py
@@ -135,9 +135,10 @@ class ClipMediaPropsDialog(object):
             self.video_header_label.set_markup("<b>" + _("Image:") + "</b>")
 
         self.dialog.connect("key-press-event", self._keyPressCb)
+        self.dialog.connect("response", self.__response_cb)
         self.dialog.run()
 
-    def _applyButtonCb(self, unused_button):
+    def _apply(self):
         """Applies the widgets values to the project."""
         project = self.project
         if self.has_video:
@@ -158,10 +159,10 @@ class ClipMediaPropsDialog(object):
                 project.audiochannels = audio.get_channels()
             if self.samplerate_checkbutton.get_active():
                 project.audiorate = audio.get_sample_rate()
-        self.dialog.destroy()
 
-    def _cancelButtonCb(self, unused_button):
-        """Destroys the dialog."""
+    def __response_cb(self, unused_dialog, response_id):
+        if response_id == 1:
+            self._apply()
         self.dialog.destroy()
 
     def _keyPressCb(self, unused_widget, event):


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