Skip to content

Commit

Permalink
Merge pull request #835 from rdbende/hide-player
Browse files Browse the repository at this point in the history
Hide media controller bar when there's no playback
  • Loading branch information
geigi authored Feb 3, 2024
2 parents 8f0b6bf + d9a76e1 commit aa3881e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
12 changes: 3 additions & 9 deletions cozy/ui/media_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class MediaController(Adw.BreakpointBin):
def __init__(self, main_window_builder: Gtk.Builder):
super().__init__()

media_control_box: Gtk.Box = main_window_builder.get_object("media_control_box")
media_control_box.append(self)
self.container_bar: Gtk.Revealer = main_window_builder.get_object("media_control_box")
self.container_bar.set_child(self)

self.seek_bar = SeekBar()
self.seek_bar_container.append(self.seek_bar)
Expand Down Expand Up @@ -127,13 +127,7 @@ def _on_length_changed(self):

def _on_lock_ui_changed(self):
sensitive = not self._playback_control_view_model.lock_ui
self.seek_bar.sensitive = sensitive
self.prev_button.set_sensitive(sensitive)
self.next_button.set_sensitive(sensitive)
self.play_button.set_sensitive(sensitive)
self.volume_button.set_sensitive(sensitive)
self.playback_speed_button.set_sensitive(sensitive)
self.timer_button.set_sensitive(sensitive)
self.container_bar.set_reveal_child(sensitive)

def _on_volume_changed(self):
self.volume_button.set_value(self._playback_control_view_model.volume)
Expand Down
6 changes: 1 addition & 5 deletions data/ui/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,7 @@
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="media_control_box">
<style>
<class name="player_bar"/>
</style>
</object>
<object class="GtkRevealer" id="media_control_box"/>
</child>
<child>
<object class="AdwViewSwitcherBar" id="mobile_view_switcher">
Expand Down
5 changes: 0 additions & 5 deletions data/ui/media_controller.ui
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="prev_button">
<property name="sensitive">false</property>
<property name="focusable">true</property>
<property name="receives-default">true</property>
<property name="tooltip-text" translatable="true">Rewind</property>
Expand All @@ -126,7 +125,6 @@
<object class="GtkButton" id="play_button">
<property name="width-request">42</property>
<property name="height-request">42</property>
<property name="sensitive">false</property>
<property name="focusable">true</property>
<property name="receives-default">true</property>
<property name="tooltip-text" translatable="true">Start playback</property>
Expand All @@ -145,7 +143,6 @@
</child>
<child>
<object class="GtkButton" id="next_button">
<property name="sensitive">false</property>
<property name="focusable">true</property>
<property name="receives-default">true</property>
<property name="tooltip-text" translatable="true">Forward</property>
Expand Down Expand Up @@ -200,7 +197,6 @@ audio-volume-medium-symbolic</property>
</child>
<child>
<object class="GtkMenuButton" id="playback_speed_button">
<property name="sensitive">false</property>
<property name="focusable">true</property>
<property name="receives-default">true</property>
<property name="tooltip-text" translatable="true">Playback speed</property>
Expand All @@ -212,7 +208,6 @@ audio-volume-medium-symbolic</property>
</child>
<child>
<object class="GtkMenuButton" id="timer_button">
<property name="sensitive">false</property>
<property name="focusable">true</property>
<property name="receives-default">true</property>
<property name="tooltip-text" translatable="true">Sleep timer</property>
Expand Down
1 change: 0 additions & 1 deletion data/ui/seek_bar.ui
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
<child>
<object class="GtkScale" id="progress_scale">
<property name="width-request">150</property>
<property name="sensitive">false</property>
<property name="focusable">true</property>
<property name="tooltip-text" translatable="true">Jump to position in current chapter</property>
<property name="valign">center</property>
Expand Down

0 comments on commit aa3881e

Please sign in to comment.