[gnome-music/gbsneto/untangle-player-window-mpris: 4/7] gstplayer: Use active window for missing codecs dialog



commit d6d41b5f3cc78afd2dd5e85208a7a89a6ace65b8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Apr 10 12:02:11 2019 -0300

    gstplayer: Use active window for missing codecs dialog
    
    GstPlayer was introduced by 84edf8832 as a factoring of
    Player, isolating the GStreamer-specific logic. However,
    it tries to access Player._parent_window to display the
    missing codecs page, a field that naturally does not
    exist anymore.
    
    Fix that by receiving the application at construction time,
    and using its active window when displaying the missing
    codecs dialog.

 gnomemusic/gstplayer.py | 6 ++++--
 gnomemusic/player.py    | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index 16435c15..4bc3ee09 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -61,11 +61,12 @@ class GstPlayer(GObject.GObject):
         return '<GstPlayer>'
 
     @log
-    def __init__(self):
+    def __init__(self, application):
         super().__init__()
 
         Gst.init(None)
 
+        self._application = application
         self._duration = -1.
 
         self._missing_plugin_messages = []
@@ -344,7 +345,8 @@ class GstPlayer(GObject.GObject):
     @log
     def _show_codec_confirmation_dialog(
             self, install_helper_name, missing_plugin_messages):
-        dialog = MissingCodecsDialog(self._parent_window, install_helper_name)
+        active_window = self._application.props.active_window
+        dialog = MissingCodecsDialog(active_window, install_helper_name)
 
         def on_dialog_response(dialog, response_type):
             if response_type == Gtk.ResponseType.ACCEPT:
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index f9c7963e..7429d270 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -582,7 +582,7 @@ class Player(GObject.GObject):
         Gst.init(None)
         GstPbutils.pb_utils_init()
 
-        self._gst_player = GstPlayer()
+        self._gst_player = GstPlayer(application)
         self._gst_player.connect('clock-tick', self._on_clock_tick)
         self._gst_player.connect('eos', self._on_eos)
         self._gst_player.bind_property(


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