EpisodesView: Ugly and Hacky Prototype of episode splitting.
This commit is contained in:
parent
ace62f7ed6
commit
c070fc3032
@ -44,15 +44,50 @@
|
|||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="spacing">7</property>
|
<property name="spacing">7</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="today_label">
|
<object class="GtkBox" id="today_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<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="halign">start</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="label" translatable="yes">Today</property>
|
<child>
|
||||||
<attributes>
|
<object class="GtkLabel" id="today_label">
|
||||||
<attribute name="weight" value="bold"/>
|
<property name="visible">True</property>
|
||||||
</attributes>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label" translatable="yes">Today</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="today_list">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="selection_mode">none</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label_item">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -61,22 +96,49 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFrame">
|
<object class="GtkBox" id="yday_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<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_xalign">0</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="shadow_type">in</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBox" id="today_box">
|
<object class="GtkLabel" id="yday_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="no_show_all">True</property>
|
<property name="halign">start</property>
|
||||||
<property name="selection_mode">none</property>
|
<property name="label" translatable="yes">Yesterday</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="label_item">
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="yday_list">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="selection_mode">none</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label_item">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@ -86,15 +148,50 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="yday_label">
|
<object class="GtkBox" id="week_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<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="halign">start</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="label" translatable="yes">Yesterday</property>
|
<child>
|
||||||
<attributes>
|
<object class="GtkLabel" id="week_label">
|
||||||
<attribute name="weight" value="bold"/>
|
<property name="visible">True</property>
|
||||||
</attributes>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label" translatable="yes">This Week</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="week_list">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="selection_mode">none</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label_item">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -103,20 +200,49 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFrame">
|
<object class="GtkBox" id="month_box">
|
||||||
<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_xalign">0</property>
|
<property name="no_show_all">True</property>
|
||||||
<property name="shadow_type">in</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBox" id="yday_box">
|
<object class="GtkLabel" id="month_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="selection_mode">none</property>
|
<property name="halign">start</property>
|
||||||
|
<property name="label" translatable="yes">This Month</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="label_item">
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="month_list">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="selection_mode">none</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label_item">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@ -126,15 +252,50 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="week_label">
|
<object class="GtkBox" id="year_box">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<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="halign">start</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="label" translatable="yes">This Week</property>
|
<child>
|
||||||
<attributes>
|
<object class="GtkLabel" id="year_label">
|
||||||
<attribute name="weight" value="bold"/>
|
<property name="visible">True</property>
|
||||||
</attributes>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="label" translatable="yes">This Year</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="year_list">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="selection_mode">none</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label_item">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -143,20 +304,50 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFrame">
|
<object class="GtkBox" id="rest_box">
|
||||||
<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_xalign">0</property>
|
<property name="no_show_all">True</property>
|
||||||
<property name="shadow_type">in</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBox" id="week_box">
|
<object class="GtkLabel" id="rest_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="selection_mode">none</property>
|
<property name="halign">start</property>
|
||||||
|
<property name="label" translatable="yes">Older than a Year</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="weight" value="bold"/>
|
||||||
|
</attributes>
|
||||||
</object>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="label_item">
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkListBox" id="rest_list">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="no_show_all">True</property>
|
||||||
|
<property name="selection_mode">none</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label_item">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@ -165,46 +356,6 @@
|
|||||||
<property name="position">5</property>
|
<property name="position">5</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="month_label">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="no_show_all">True</property>
|
|
||||||
<property name="halign">start</property>
|
|
||||||
<property name="label" translatable="yes">This Month</property>
|
|
||||||
<attributes>
|
|
||||||
<attribute name="weight" value="bold"/>
|
|
||||||
</attributes>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">6</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkFrame">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="label_xalign">0</property>
|
|
||||||
<property name="shadow_type">in</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkListBox" id="month_box">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="selection_mode">none</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child type="label_item">
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">7</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|||||||
@ -16,20 +16,32 @@ enum ListSplit {
|
|||||||
Yday,
|
Yday,
|
||||||
Week,
|
Week,
|
||||||
Month,
|
Month,
|
||||||
|
Year,
|
||||||
|
Rest,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct EpisodesView {
|
pub struct EpisodesView {
|
||||||
pub container: gtk::Box,
|
pub container: gtk::Box,
|
||||||
frame_parent: gtk::Box,
|
frame_parent: gtk::Box,
|
||||||
today_box: gtk::ListBox,
|
today_box: gtk::Box,
|
||||||
yday_box: gtk::ListBox,
|
yday_box: gtk::Box,
|
||||||
week_box: gtk::ListBox,
|
week_box: gtk::Box,
|
||||||
month_box: gtk::ListBox,
|
month_box: gtk::Box,
|
||||||
|
year_box: gtk::Box,
|
||||||
|
rest_box: gtk::Box,
|
||||||
|
today_list: gtk::ListBox,
|
||||||
|
yday_list: gtk::ListBox,
|
||||||
|
week_list: gtk::ListBox,
|
||||||
|
month_list: gtk::ListBox,
|
||||||
|
year_list: gtk::ListBox,
|
||||||
|
rest_list: gtk::ListBox,
|
||||||
today_label: gtk::Label,
|
today_label: gtk::Label,
|
||||||
yday_label: gtk::Label,
|
yday_label: gtk::Label,
|
||||||
week_label: gtk::Label,
|
week_label: gtk::Label,
|
||||||
month_label: gtk::Label,
|
month_label: gtk::Label,
|
||||||
|
year_label: gtk::Label,
|
||||||
|
rest_label: gtk::Label,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for EpisodesView {
|
impl Default for EpisodesView {
|
||||||
@ -37,14 +49,24 @@ impl Default for EpisodesView {
|
|||||||
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/episodes_view.ui");
|
let builder = gtk::Builder::new_from_resource("/org/gnome/hammond/gtk/episodes_view.ui");
|
||||||
let container: gtk::Box = builder.get_object("container").unwrap();
|
let container: gtk::Box = builder.get_object("container").unwrap();
|
||||||
let frame_parent: gtk::Box = builder.get_object("frame_parent").unwrap();
|
let frame_parent: gtk::Box = builder.get_object("frame_parent").unwrap();
|
||||||
let today_box: gtk::ListBox = builder.get_object("today_box").unwrap();
|
let today_box: gtk::Box = builder.get_object("today_box").unwrap();
|
||||||
let yday_box: gtk::ListBox = builder.get_object("yday_box").unwrap();
|
let yday_box: gtk::Box = builder.get_object("yday_box").unwrap();
|
||||||
let week_box: gtk::ListBox = builder.get_object("week_box").unwrap();
|
let week_box: gtk::Box = builder.get_object("week_box").unwrap();
|
||||||
let month_box: gtk::ListBox = builder.get_object("month_box").unwrap();
|
let month_box: gtk::Box = builder.get_object("month_box").unwrap();
|
||||||
|
let year_box: gtk::Box = builder.get_object("year_box").unwrap();
|
||||||
|
let rest_box: gtk::Box = builder.get_object("rest_box").unwrap();
|
||||||
|
let today_list: gtk::ListBox = builder.get_object("today_list").unwrap();
|
||||||
|
let yday_list: gtk::ListBox = builder.get_object("yday_list").unwrap();
|
||||||
|
let week_list: gtk::ListBox = builder.get_object("week_list").unwrap();
|
||||||
|
let month_list: gtk::ListBox = builder.get_object("month_list").unwrap();
|
||||||
|
let year_list: gtk::ListBox = builder.get_object("year_list").unwrap();
|
||||||
|
let rest_list: gtk::ListBox = builder.get_object("rest_list").unwrap();
|
||||||
let today_label: gtk::Label = builder.get_object("today_label").unwrap();
|
let today_label: gtk::Label = builder.get_object("today_label").unwrap();
|
||||||
let yday_label: gtk::Label = builder.get_object("yday_label").unwrap();
|
let yday_label: gtk::Label = builder.get_object("yday_label").unwrap();
|
||||||
let week_label: gtk::Label = builder.get_object("week_label").unwrap();
|
let week_label: gtk::Label = builder.get_object("week_label").unwrap();
|
||||||
let month_label: gtk::Label = builder.get_object("month_label").unwrap();
|
let month_label: gtk::Label = builder.get_object("month_label").unwrap();
|
||||||
|
let year_label: gtk::Label = builder.get_object("year_label").unwrap();
|
||||||
|
let rest_label: gtk::Label = builder.get_object("rest_label").unwrap();
|
||||||
|
|
||||||
EpisodesView {
|
EpisodesView {
|
||||||
container,
|
container,
|
||||||
@ -53,10 +75,20 @@ impl Default for EpisodesView {
|
|||||||
yday_box,
|
yday_box,
|
||||||
week_box,
|
week_box,
|
||||||
month_box,
|
month_box,
|
||||||
|
year_box,
|
||||||
|
rest_box,
|
||||||
|
today_list,
|
||||||
|
yday_list,
|
||||||
|
week_list,
|
||||||
|
month_list,
|
||||||
|
year_list,
|
||||||
|
rest_list,
|
||||||
today_label,
|
today_label,
|
||||||
yday_label,
|
yday_label,
|
||||||
week_label,
|
week_label,
|
||||||
month_label,
|
month_label,
|
||||||
|
year_label,
|
||||||
|
rest_label,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,31 +108,64 @@ impl EpisodesView {
|
|||||||
let t = split(now_utc, ep.epoch());
|
let t = split(now_utc, ep.epoch());
|
||||||
match t {
|
match t {
|
||||||
ListSplit::Today => {
|
ListSplit::Today => {
|
||||||
view.today_box.add(&viewep.container);
|
view.today_list.add(&viewep.container);
|
||||||
view.today_box.add(&sep)
|
view.today_list.add(&sep)
|
||||||
}
|
}
|
||||||
ListSplit::Yday => {
|
ListSplit::Yday => {
|
||||||
view.yday_box.add(&viewep.container);
|
view.yday_list.add(&viewep.container);
|
||||||
view.yday_box.add(&sep)
|
view.yday_list.add(&sep)
|
||||||
}
|
}
|
||||||
ListSplit::Week => {
|
ListSplit::Week => {
|
||||||
view.week_box.add(&viewep.container);
|
view.week_list.add(&viewep.container);
|
||||||
view.week_box.add(&sep)
|
view.week_list.add(&sep)
|
||||||
}
|
}
|
||||||
_ => {
|
ListSplit::Month => {
|
||||||
view.month_box.add(&viewep.container);
|
view.month_list.add(&viewep.container);
|
||||||
view.month_box.add(&sep)
|
view.month_list.add(&sep)
|
||||||
|
}
|
||||||
|
ListSplit::Year => {
|
||||||
|
view.year_list.add(&viewep.container);
|
||||||
|
view.year_list.add(&sep)
|
||||||
|
}
|
||||||
|
ListSplit::Rest => {
|
||||||
|
view.rest_list.add(&viewep.container);
|
||||||
|
view.rest_list.add(&sep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sep.show()
|
sep.show()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if view.today_list.get_children().is_empty() {
|
||||||
|
view.today_box.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if view.yday_list.get_children().is_empty() {
|
||||||
|
view.yday_box.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if view.week_list.get_children().is_empty() {
|
||||||
|
view.week_box.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if view.month_list.get_children().is_empty() {
|
||||||
|
view.month_box.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if view.year_list.get_children().is_empty() {
|
||||||
|
view.year_box.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if view.rest_list.get_children().is_empty() {
|
||||||
|
view.rest_box.hide();
|
||||||
|
}
|
||||||
|
|
||||||
view.container.show_all();
|
view.container.show_all();
|
||||||
Rc::new(view)
|
Rc::new(view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Avoid epoch calculations, use chrono instead.
|
||||||
fn split(now_utc: i32, epoch: i32) -> ListSplit {
|
fn split(now_utc: i32, epoch: i32) -> ListSplit {
|
||||||
let t = now_utc - epoch;
|
let t = now_utc - epoch;
|
||||||
|
|
||||||
@ -110,8 +175,12 @@ fn split(now_utc: i32, epoch: i32) -> ListSplit {
|
|||||||
ListSplit::Yday
|
ListSplit::Yday
|
||||||
} else if t < 604_800 {
|
} else if t < 604_800 {
|
||||||
ListSplit::Week
|
ListSplit::Week
|
||||||
} else {
|
} else if t < 2_419_200 {
|
||||||
ListSplit::Month
|
ListSplit::Month
|
||||||
|
} else if t < 31_536_000 {
|
||||||
|
ListSplit::Year
|
||||||
|
} else {
|
||||||
|
ListSplit::Rest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user