Add Show title in the Headerbar when switching to ShowWidget.
This commit is contained in:
parent
6284c8828b
commit
4b0a6ea0f7
@ -66,7 +66,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="seperator1">
|
||||
<object class="GtkLabel" id="separator1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="label" translatable="yes">·</property>
|
||||
@ -93,7 +93,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="seperator2">
|
||||
<object class="GtkLabel" id="separator2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">·</property>
|
||||
|
||||
@ -156,30 +156,39 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="switch">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="menu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<object class="GtkStackSwitcher" id="switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">open-menu-symbolic</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="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="show_title">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="label" translatable="yes">Show Title</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="ref_button">
|
||||
@ -202,5 +211,24 @@
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="menu">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">open-menu-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
@ -16,7 +16,7 @@ pub struct Header {
|
||||
add_toggle: gtk::MenuButton,
|
||||
switch: gtk::StackSwitcher,
|
||||
back_button: gtk::Button,
|
||||
// show_title: gtk::Label,
|
||||
show_title: gtk::Label,
|
||||
}
|
||||
|
||||
impl Header {
|
||||
@ -28,7 +28,7 @@ impl Header {
|
||||
let add_toggle: gtk::MenuButton = builder.get_object("add_toggle_button").unwrap();
|
||||
let switch: gtk::StackSwitcher = builder.get_object("switch").unwrap();
|
||||
let back_button: gtk::Button = builder.get_object("back_button").unwrap();
|
||||
// let show_title: gtk::Label = builder.get_object("show_title").unwrap();
|
||||
let show_title: gtk::Label = builder.get_object("show_title").unwrap();
|
||||
|
||||
switch.set_halign(gtk::Align::Center);
|
||||
switch.show();
|
||||
@ -39,6 +39,7 @@ impl Header {
|
||||
add_toggle,
|
||||
switch,
|
||||
back_button,
|
||||
show_title,
|
||||
})
|
||||
}
|
||||
|
||||
@ -70,25 +71,31 @@ impl Header {
|
||||
|
||||
let switch = &self.switch;
|
||||
let add_toggle = &self.add_toggle;
|
||||
self.back_button
|
||||
.connect_clicked(clone!(content, switch, add_toggle => move |back| {
|
||||
let show_title = &self.show_title;
|
||||
self.back_button.connect_clicked(
|
||||
clone!(content, switch, add_toggle, show_title => move |back| {
|
||||
switch.show();
|
||||
add_toggle.show();
|
||||
back.hide();
|
||||
show_title.hide();
|
||||
content.shows.stack.set_visible_child_full("podcasts", gtk::StackTransitionType::SlideRight);
|
||||
}));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn switch_to_back(&self) {
|
||||
pub fn switch_to_back(&self, title: &str) {
|
||||
self.switch.hide();
|
||||
self.add_toggle.hide();
|
||||
self.back_button.show();
|
||||
self.show_title.set_text(title);
|
||||
self.show_title.show();
|
||||
}
|
||||
|
||||
pub fn switch_to_normal(&self) {
|
||||
self.switch.show();
|
||||
self.add_toggle.show();
|
||||
self.back_button.hide();
|
||||
self.show_title.hide();
|
||||
}
|
||||
|
||||
// pub fn set_show_title(&self, title: &str) {
|
||||
|
||||
@ -62,8 +62,7 @@ impl ShowsPopulated {
|
||||
let pd = dbqueries::get_podcast_from_id(id).unwrap();
|
||||
|
||||
show.replace_widget(&pd);
|
||||
// header.set_show_title(pd.title());
|
||||
header.switch_to_back();
|
||||
header.switch_to_back(pd.title());
|
||||
show.switch_widget_animated();
|
||||
}));
|
||||
// Populate the flowbox with the Podcasts.
|
||||
|
||||
@ -65,8 +65,8 @@ impl EpisodeWidget {
|
||||
let size: gtk::Label = builder.get_object("size_label").unwrap();
|
||||
let progress_label: gtk::Label = builder.get_object("progress_label").unwrap();
|
||||
|
||||
let sep1: gtk::Label = builder.get_object("seperator1").unwrap();
|
||||
let sep2: gtk::Label = builder.get_object("seperator2").unwrap();
|
||||
let sep1: gtk::Label = builder.get_object("separator1").unwrap();
|
||||
let sep2: gtk::Label = builder.get_object("separator2").unwrap();
|
||||
|
||||
// Dim(grey out) the labels.
|
||||
// If it's possible through glade, feel free to open a PR.
|
||||
@ -269,6 +269,7 @@ fn receive() -> glib::Continue {
|
||||
pub fn episodes_listbox(pd: &Podcast) -> Result<gtk::ListBox> {
|
||||
let episodes = dbqueries::get_pd_episodeswidgets(pd)?;
|
||||
|
||||
// TODO: add a separator
|
||||
let list = gtk::ListBox::new();
|
||||
episodes.into_iter().for_each(|mut ep| {
|
||||
let widget = EpisodeWidget::new_initialized(&mut ep, pd);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user