[pitivi] medialibrary: Use a standard close button for the errors infobar



commit 1886f64174e034d123b18be32fd9ebb360c2e635
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Wed Feb 10 09:27:16 2016 +0100

    medialibrary: Use a standard close button for the errors infobar
    
    Differential Revision: https://phabricator.freedesktop.org/D756

 data/ui/medialibrary.ui |   24 ++----------------------
 pitivi/medialibrary.py  |   10 ++++++----
 2 files changed, 8 insertions(+), 26 deletions(-)
---
diff --git a/data/ui/medialibrary.ui b/data/ui/medialibrary.ui
index 88260c1..672269c 100644
--- a/data/ui/medialibrary.ui
+++ b/data/ui/medialibrary.ui
@@ -149,6 +149,7 @@
     <property name="app_paintable">True</property>
     <property name="can_focus">False</property>
     <property name="message_type">warning</property>
+    <property name="show_close_button">True</property>
     <child internal-child="action_area">
       <object class="GtkButtonBox" id="infobar-action_area3">
         <property name="can_focus">False</property>
@@ -160,7 +161,6 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
-            <signal name="clicked" handler="_viewErrorsButtonClickedCb" swapped="no"/>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -168,21 +168,6 @@
             <property name="position">0</property>
           </packing>
         </child>
-        <child>
-          <object class="GtkButton" id="warnings_dismiss_button">
-            <property name="label">✖</property>
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">True</property>
-            <property name="tooltip_text" translatable="yes">Close this message</property>
-            <signal name="clicked" handler="_warningInfoBarDismissedCb" swapped="no"/>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -191,8 +176,7 @@
       </packing>
     </child>
     <action-widgets>
-      <action-widget response="0">view_error_button</action-widget>
-      <action-widget response="0">warnings_dismiss_button</action-widget>
+      <action-widget response="-5">view_error_button</action-widget>
     </action-widgets>
     <child internal-child="content_area">
       <object class="GtkBox" id="infobar-content_area3">
@@ -219,10 +203,6 @@
         <property name="position">0</property>
       </packing>
     </child>
-    <action-widgets>
-      <action-widget response="0">view_error_button</action-widget>
-      <action-widget response="0">warnings_dismiss_button</action-widget>
-    </action-widgets>
   </object>
   <object class="GtkInfoBar" id="welcome_infobar">
     <property name="visible">True</property>
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index df4365a..20756e2 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -271,6 +271,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
         self._project_settings_set_infobar.connect("response", self.__projectSettingsSetInfobarCb)
         self._import_warning_infobar = builder.get_object("warning_infobar")
         self._import_warning_infobar.hide()
+        self._import_warning_infobar.connect("response", self.__warningInfobarCb)
         self._warning_label = builder.get_object("warning_label")
         self._view_error_button = builder.get_object("view_error_button")
         toolbar = builder.get_object("medialibrary_toolbar")
@@ -1108,14 +1109,17 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
         dialog.dialog.set_transient_for(self.app.gui)
         dialog.run()
 
-    def _warningInfoBarDismissedCb(self, unused_button):
+    def __warningInfobarCb(self, infobar, response_id):
+        if response_id == Gtk.ResponseType.OK:
+            self.__showErrors()
         self._resetErrorList()
+        infobar.hide()
 
     def _resetErrorList(self):
         self._errors = []
         self._import_warning_infobar.hide()
 
-    def _viewErrorsButtonClickedCb(self, unused_button):
+    def __showErrors(self):
         """
         Show a FileListErrorDialog to display import _errors.
         """
@@ -1133,8 +1137,6 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
             error_dialogbox.addFailedFile(uri, reason, extra)
         error_dialogbox.window.set_transient_for(self.app.gui)
         error_dialogbox.window.show()
-        # Reset the error list, since the user has read them.
-        self._resetErrorList()
 
     def _toggleViewTypeCb(self, widget):
         if widget.get_active():


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