From db5200e2468df55f2488b177747d3fb261aca534 Mon Sep 17 00:00:00 2001 From: Martin Wagner Date: Wed, 16 Sep 2020 14:51:28 +0200 Subject: [PATCH] simplified custom signal definitions --- bin/mpdevil | 46 +++++----------------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/bin/mpdevil b/bin/mpdevil index 8d61e75..dc89d0d 100755 --- a/bin/mpdevil +++ b/bin/mpdevil @@ -648,39 +648,9 @@ class MpdEventEmitter(GObject.Object): super().__init__() # gsignals - def do_update(self): - pass - - def do_disconnected(self): - pass - - def do_reconnected(self): - pass - def do_connection_error(self): print("Connection error!") - def do_current_file_changed(self): - pass - - def do_state(self, state): - pass - - def do_elapsed_changed(self, elapsed, duration): - pass - - def do_volume_changed(self, volume): - pass - - def do_playlist_changed(self, version): - pass - - def do_audio(self, sampelrate, bits, channels): - pass - - def do_bitrate(self, rate): - pass - class Client(MPDClient): def __init__(self, settings): super().__init__() @@ -1270,6 +1240,8 @@ class AlbumDialog(Gtk.Dialog): self.destroy() class GenreSelect(Gtk.ComboBoxText): + __gsignals__={'genre_changed': (GObject.SignalFlags.RUN_FIRST, None, ())} + def __init__(self, client): super().__init__() @@ -1296,10 +1268,6 @@ class GenreSelect(Gtk.ComboBoxText): else: return self.get_active_text() - @GObject.Signal - def genre_changed(self): - pass - def _refresh(self, *args): self.handler_block(self._changed) self.remove_all() @@ -1321,6 +1289,8 @@ class GenreSelect(Gtk.ComboBoxText): self.set_sensitive(True) class ArtistWindow(FocusFrame): + __gsignals__={'artists_changed': (GObject.SignalFlags.RUN_FIRST, None, ())} + def __init__(self, client, settings, genre_select): super().__init__() @@ -1405,10 +1375,6 @@ class ArtistWindow(FocusFrame): self._treeview.set_cursor(path, None, False) break - @GObject.Signal - def artists_changed(self): - pass - def _refresh(self, *args): self._selection.set_mode(Gtk.SelectionMode.NONE) self._clear() @@ -1712,9 +1678,7 @@ class AlbumWindow(FocusFrame): GLib.idle_add(callback) class Browser(Gtk.Paned): - __gsignals__={ - 'search_focus_changed': (GObject.SignalFlags.RUN_FIRST, None, (bool,)) - } + __gsignals__={'search_focus_changed': (GObject.SignalFlags.RUN_FIRST, None, (bool,))} def __init__(self, client, settings, window): super().__init__(orientation=Gtk.Orientation.HORIZONTAL) # paned1