hammond-gtk: Add more GActions and wire the EpisodeWidget.
This commit is contained in:
parent
fdd63afdfe
commit
ac286888bd
@ -196,6 +196,7 @@
|
|||||||
<property name="no_show_all">True</property>
|
<property name="no_show_all">True</property>
|
||||||
<property name="halign">end</property>
|
<property name="halign">end</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="action_name">app.refresh_episodes</property>
|
||||||
<property name="always_show_image">True</property>
|
<property name="always_show_image">True</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
@ -218,6 +219,7 @@
|
|||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="no_show_all">True</property>
|
<property name="no_show_all">True</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<property name="action_name">app.refresh_episodes</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkImage">
|
<object class="GtkImage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|||||||
@ -73,10 +73,26 @@ impl App {
|
|||||||
|
|
||||||
let refresh = gio::SimpleAction::new("refresh", None);
|
let refresh = gio::SimpleAction::new("refresh", None);
|
||||||
let content = self.content.clone();
|
let content = self.content.clone();
|
||||||
update.connect_activate(move |_, _| {
|
refresh.connect_activate(move |_, _| {
|
||||||
content.update();
|
content.update();
|
||||||
});
|
});
|
||||||
self.app_instance.add_action(&refresh);
|
self.app_instance.add_action(&refresh);
|
||||||
|
|
||||||
|
let refresh_episodes = gio::SimpleAction::new("refresh_episodes", None);
|
||||||
|
let content = self.content.clone();
|
||||||
|
refresh_episodes.connect_activate(move |_, _| {
|
||||||
|
if content.get_stack().get_visible_child_name() != Some(String::from("episodes")) {
|
||||||
|
content.update_episode_view();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
self.app_instance.add_action(&refresh_episodes);
|
||||||
|
|
||||||
|
let refresh_shows = gio::SimpleAction::new("refresh_shows", None);
|
||||||
|
let content = self.content.clone();
|
||||||
|
refresh_shows.connect_activate(move |_, _| {
|
||||||
|
content.update_shows_view();
|
||||||
|
});
|
||||||
|
self.app_instance.add_action(&refresh_shows);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setup_timed_callbacks(&self) {
|
pub fn setup_timed_callbacks(&self) {
|
||||||
|
|||||||
@ -37,10 +37,18 @@ impl Content {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&self) {
|
pub fn update(&self) {
|
||||||
self.shows.update();
|
self.update_shows_view();
|
||||||
|
self.update_episode_view();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn update_episode_view(&self) {
|
||||||
self.episodes.update();
|
self.episodes.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn update_shows_view(&self) {
|
||||||
|
self.shows.update();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_stack(&self) -> gtk::Stack {
|
pub fn get_stack(&self) -> gtk::Stack {
|
||||||
self.stack.clone()
|
self.stack.clone()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user