Commit b2d71a03 authored by Jordan Petridis's avatar Jordan Petridis 🌱

Headerbar: Remove the update indicator

parent 019ec897
......@@ -271,41 +271,5 @@ Tobias Bernard
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="update_notification">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<child>
<object class="GtkSpinner" id="update_spinner">
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="update_label">
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Fetching new episodes</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
</object>
</interface>
......@@ -58,8 +58,6 @@ pub(crate) enum Action {
ShowShowsAnimated,
HeaderBarShowTile(String),
HeaderBarNormal,
HeaderBarShowUpdateIndicator,
HeaderBarHideUpdateIndicator,
MarkAllPlayerNotification(Arc<Show>),
ShowUpdateNotif(Receiver<bool>),
RemoveShow(Arc<Show>),
......@@ -299,8 +297,6 @@ impl App {
}
Action::HeaderBarShowTile(title) => self.headerbar.switch_to_back(&title),
Action::HeaderBarNormal => self.headerbar.switch_to_normal(),
Action::HeaderBarShowUpdateIndicator => self.headerbar.show_update_notification(),
Action::HeaderBarHideUpdateIndicator => self.headerbar.hide_update_notification(),
Action::MarkAllPlayerNotification(pd) => {
let notif = mark_all_notif(pd, &self.sender);
notif.show(&self.overlay);
......@@ -320,9 +316,11 @@ impl App {
notif.show(&self.overlay);
}
Action::ShowUpdateNotif(receiver) => {
let sender = self.sender.clone();
let callback = move |revealer: gtk::Revealer| {
if let Some(_) = receiver.try_recv() {
revealer.set_reveal_child(false);
sender.send(Action::RefreshAllViews);
return glib::Continue(false);
}
......
......@@ -26,34 +26,10 @@ pub(crate) struct Header {
back: gtk::Button,
show_title: gtk::Label,
hamburger: gtk::MenuButton,
updater: UpdateIndicator,
add: AddPopover,
dots: gtk::MenuButton,
}
#[derive(Debug, Clone)]
struct UpdateIndicator {
container: gtk::Box,
text: gtk::Label,
spinner: gtk::Spinner,
}
impl UpdateIndicator {
fn show(&self) {
self.spinner.start();
self.spinner.show();
self.container.show();
self.text.show();
}
fn hide(&self) {
self.spinner.stop();
self.spinner.hide();
self.container.hide();
self.text.hide();
}
}
#[derive(Debug, Clone)]
struct AddPopover {
container: gtk::Popover,
......@@ -158,16 +134,6 @@ impl Default for Header {
// The 3 dots secondary menu
let dots = builder.get_object("secondary_menu").unwrap();
let update_box = builder.get_object("update_notification").unwrap();
let update_label = builder.get_object("update_label").unwrap();
let update_spinner = builder.get_object("update_spinner").unwrap();
let updater = UpdateIndicator {
container: update_box,
text: update_label,
spinner: update_spinner,
};
let add_toggle = builder.get_object("add_toggle").unwrap();
let add_popover = builder.get_object("add_popover").unwrap();
let new_url = builder.get_object("new_url").unwrap();
......@@ -187,7 +153,6 @@ impl Default for Header {
back,
show_title,
hamburger,
updater,
add,
dots,
}
......@@ -248,14 +213,6 @@ impl Header {
self.show_title.set_text(title)
}
pub(crate) fn show_update_notification(&self) {
self.updater.show();
}
pub(crate) fn hide_update_notification(&self) {
self.updater.hide();
}
pub(crate) fn open_menu(&self) {
self.hamburger.clicked();
}
......
......@@ -200,7 +200,6 @@ fn refresh_feed<S>(source: Option<S>, sender: Sender<Action>) -> Result<(), Erro
where
S: IntoIterator<Item = Source> + Send + 'static,
{
sender.send(Action::HeaderBarShowUpdateIndicator);
let (up_sender, up_receiver) = bounded(1);
sender.send(Action::ShowUpdateNotif(up_receiver));
......@@ -221,8 +220,6 @@ where
};
up_sender.send(true);
sender.send(Action::HeaderBarHideUpdateIndicator);
sender.send(Action::RefreshAllViews);
});
Ok(())
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment