[pitivi] medialibrary: Make infobars reusable



commit 3fe6abaea7fa3b5b6599a6e240f4a4c67ab31e66
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Wed Jun 22 09:09:29 2016 +0200

    medialibrary: Make infobars reusable
    
    Work around https://bugzilla.gnome.org/show_bug.cgi?id=710888 which
    prevents an infobar to be displayed twice.
    
    Fixes https://phabricator.freedesktop.org/T7444
    
    Differential Revision: https://phabricator.freedesktop.org/D1103

 pitivi/clipproperties.py        |    2 ++
 pitivi/dialogs/startupwizard.py |    2 ++
 pitivi/medialibrary.py          |    4 ++++
 pitivi/titleeditor.py           |    2 ++
 pitivi/transitions.py           |    2 ++
 pitivi/utils/ui.py              |    9 +++++++++
 6 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index c7f175c..e63622d 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -36,6 +36,7 @@ from pitivi.undo.timeline import CommitTimelineFinalizingAction
 from pitivi.utils.loggable import Loggable
 from pitivi.utils.ui import disable_scroll
 from pitivi.utils.ui import EFFECT_TARGET_ENTRY
+from pitivi.utils.ui import fix_infobar
 from pitivi.utils.ui import PADDING
 from pitivi.utils.ui import SPACING
 
@@ -92,6 +93,7 @@ class ClipProperties(Gtk.ScrolledWindow, Loggable):
         label = Gtk.Label(label=text)
         label.set_line_wrap(True)
         infobar = Gtk.InfoBar()
+        fix_infobar(infobar)
         infobar.props.message_type = Gtk.MessageType.OTHER
         infobar.get_content_area().add(label)
         self.infobar_box.pack_start(infobar, False, False, 0)
diff --git a/pitivi/dialogs/startupwizard.py b/pitivi/dialogs/startupwizard.py
index ac8bc50..d126da0 100644
--- a/pitivi/dialogs/startupwizard.py
+++ b/pitivi/dialogs/startupwizard.py
@@ -28,6 +28,7 @@ from pitivi.configure import get_ui_dir
 from pitivi.dialogs.depsmanager import DepsManager
 from pitivi.shortcutswindow import show_shortcuts
 from pitivi.utils.misc import show_user_manual
+from pitivi.utils.ui import fix_infobar
 
 
 class StartUpWizard(object):
@@ -83,6 +84,7 @@ class StartUpWizard(object):
 
         vbox = self.builder.get_object("topvbox")
         self.infobar = Gtk.InfoBar()
+        fix_infobar(self.infobar)
         vbox.pack_start(self.infobar, True, True, 0)
         if self.app.getLatest():
             self._appVersionInfoReceivedCb(self.app, None)
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index cb63c3b..5084a24 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -58,6 +58,7 @@ from pitivi.utils.ui import beautify_asset
 from pitivi.utils.ui import beautify_ETA
 from pitivi.utils.ui import beautify_length
 from pitivi.utils.ui import FILE_TARGET_ENTRY
+from pitivi.utils.ui import fix_infobar
 from pitivi.utils.ui import info_name
 from pitivi.utils.ui import SPACING
 from pitivi.utils.ui import URI_TARGET_ENTRY
@@ -271,13 +272,16 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
         builder.add_from_file(os.path.join(get_ui_dir(), "medialibrary.ui"))
         builder.connect_signals(self)
         self._welcome_infobar = builder.get_object("welcome_infobar")
+        fix_infobar(self._welcome_infobar)
         self._project_settings_set_infobar = Gtk.InfoBar()
         self._project_settings_set_infobar.hide()
         self._project_settings_set_infobar.set_message_type(Gtk.MessageType.OTHER)
         self._project_settings_set_infobar.set_show_close_button(True)
         self._project_settings_set_infobar.add_button(_("Project Settings"), Gtk.ResponseType.OK)
         self._project_settings_set_infobar.connect("response", self.__projectSettingsSetInfobarCb)
+        fix_infobar(self._project_settings_set_infobar)
         self._import_warning_infobar = builder.get_object("warning_infobar")
+        fix_infobar(self._import_warning_infobar)
         self._import_warning_infobar.hide()
         self._import_warning_infobar.connect("response", self.__warningInfobarCb)
         self._warning_label = builder.get_object("warning_label")
diff --git a/pitivi/titleeditor.py b/pitivi/titleeditor.py
index 86b45d1..82d9d87 100644
--- a/pitivi/titleeditor.py
+++ b/pitivi/titleeditor.py
@@ -28,6 +28,7 @@ from pitivi.configure import get_ui_dir
 from pitivi.utils.loggable import Loggable
 from pitivi.utils.timeline import SELECT
 from pitivi.utils.ui import argb_to_gdk_rgba
+from pitivi.utils.ui import fix_infobar
 from pitivi.utils.ui import gdk_rgba_to_argb
 
 
@@ -70,6 +71,7 @@ class TitleEditor(Loggable):
         builder.connect_signals(self)
         self.widget = builder.get_object("box1")  # To be used by tabsmanager
         self.infobar = builder.get_object("infobar")
+        fix_infobar(self.infobar)
         self.editing_box = builder.get_object("editing_box")
         self.textarea = builder.get_object("textview")
         toolbar = builder.get_object("toolbar")
diff --git a/pitivi/transitions.py b/pitivi/transitions.py
index 4ed0a89..235ee1d 100644
--- a/pitivi/transitions.py
+++ b/pitivi/transitions.py
@@ -27,6 +27,7 @@ from gi.repository import Gtk
 from pitivi.configure import get_pixmap_dir
 from pitivi.utils.loggable import Loggable
 from pitivi.utils.misc import disconnectAllByFunc
+from pitivi.utils.ui import fix_infobar
 from pitivi.utils.ui import PADDING
 from pitivi.utils.ui import SPACING
 
@@ -100,6 +101,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
         self.__updateBorderScale()
 
         self.infobar = Gtk.InfoBar()
+        fix_infobar(self.infobar)
         self.infobar.props.message_type = Gtk.MessageType.OTHER
         txtlabel = Gtk.Label()
         txtlabel.set_line_wrap(True)
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index 22e220d..3cf94ac 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -523,6 +523,15 @@ def disable_scroll(widget):
     widget.connect("scroll-event", scroll_event_cb)
 
 
+def fix_infobar(infobar):
+    # Work around https://bugzilla.gnome.org/show_bug.cgi?id=710888
+    def make_sure_revealer_does_nothing(widget):
+        if not isinstance(widget, Gtk.Revealer):
+            return
+        widget.set_transition_type(Gtk.RevealerTransitionType.NONE)
+    infobar.forall(make_sure_revealer_does_nothing)
+
+
 # ----------------------- encoding datas --------------------------------------- #
 # FIXME This should into a special file
 frame_rates = model((str, object), (


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