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