diff --git a/README.md b/README.md index 59cfc3e..f37f2db 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ For testing the application and running it without (system-wide) installation, donwload/clone the code, build it with the `--prefix` option and install it with `ninja`: - $ meson --prefix $(pwd)/install build + $ meson setup --prefix $(pwd)/install build $ ninja -C build $ ninja -C build install diff --git a/data/ui/cover-panel.ui b/data/ui/cover-panel.ui index 75c8530..d869e76 100644 --- a/data/ui/cover-panel.ui +++ b/data/ui/cover-panel.ui @@ -141,6 +141,7 @@ vertical + start fill true False @@ -158,4 +159,3 @@ - diff --git a/meson.build b/meson.build index cdc1224..a8e88cc 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('mcg', - version: '4.0', + version: '4.0.1', meson_version: '>= 0.59.0', default_options: [ 'warning_level=2', diff --git a/src/coverpanel.py b/src/coverpanel.py index ba09e16..d9c5d31 100644 --- a/src/coverpanel.py +++ b/src/coverpanel.py @@ -180,6 +180,21 @@ class CoverPanel(Gtk.Overlay): length, Gtk.PositionType.RIGHT, "{0[0]:02d}:{0[1]:02d} minutes".format(divmod(length, 60))) + # Align marks + self._align_songs_scale_marks() + + def _align_songs_scale_marks(self): + self._align_songs_scale_mark(self.songs_scale) + + def _align_songs_scale_mark(self, widget): + child = widget.get_first_child() + while child: + if type(child) is Gtk.Label: + child.set_halign(Gtk.Align.START) + else: + self._align_songs_scale_mark(child) + child = child.get_next_sibling() + def _enable_tracklist(self): if self._current_album: # enable diff --git a/src/librarypanel.py b/src/librarypanel.py index 488528b..e2ae1fb 100644 --- a/src/librarypanel.py +++ b/src/librarypanel.py @@ -361,6 +361,7 @@ class LibraryPanel(Adw.Bin): self._library_lock.release() GObject.idle_add(self.stack.set_visible_child, self.scroll) self._sort_grid_model() + GObject.idle_add(self.library_grid.scroll_to, 0, Gtk.ListScrollFlags.NONE, None) def _set_widget_grid_size(self, grid_widget, size, vertical): self._library_stop.set() diff --git a/src/window.py b/src/window.py index 648853d..db10c23 100644 --- a/src/window.py +++ b/src/window.py @@ -75,6 +75,8 @@ class Window(Adw.ApplicationWindow): self._setting_volume = False self._headerbar_connection_button_active = True self._headerbar_playpause_button_active = True + self._width = 0 + self._height = 0 # Help/Shortcuts dialog self.set_help_overlay(ShortcutsDialog()) @@ -144,8 +146,6 @@ class Window(Adw.ApplicationWindow): self._settings.get_boolean(Window.SETTING_SORT_TYPE)) # Signals - self.connect("notify::default-width", self.on_resize) - self.connect("notify::default-height", self.on_resize) self.connect("notify::maximized", self.on_maximized) self.connect("notify::fullscreened", self.on_fullscreened) self._connection_panel.connect( @@ -258,6 +258,22 @@ class Window(Adw.ApplicationWindow): self.on_menu_search_library) self.add_action(self._search_library_action) + def do_size_allocate(self, width, height, baseline): + Gtk.ApplicationWindow().do_size_allocate(self, width, height, baseline) + + if self._width == width and self._height == height: + return + self._width = width + self._height = height + + if width > 0: + self._cover_panel.set_width(width) + if not self._state.get_property(WindowState.PROP_MAXIMIZED): + self._state.set_property(WindowState.PROP_WIDTH, width) + self._state.set_property(WindowState.PROP_HEIGHT, height) + GObject.idle_add(self._playlist_panel.set_size, width, height) + GObject.idle_add(self._library_panel.set_size, width, height) + # Menu callbacks def on_menu_connect(self, action, value): @@ -287,17 +303,6 @@ class Window(Adw.ApplicationWindow): # Window callbacks - def on_resize(self, widget, event): - width = self.get_size(Gtk.Orientation.HORIZONTAL) - height = self.get_size(Gtk.Orientation.VERTICAL) - if width > 0: - self._cover_panel.set_width(width) - if not self._state.get_property(WindowState.PROP_MAXIMIZED): - self._state.set_property(WindowState.PROP_WIDTH, width) - self._state.set_property(WindowState.PROP_HEIGHT, height) - GObject.idle_add(self._playlist_panel.set_size, width, height) - GObject.idle_add(self._library_panel.set_size, width, height) - def on_maximized(self, widget, maximized): self._state.set_property(WindowState.PROP_MAXIMIZED, maximized is True)