mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
replace column expand with configurable size value
This commit is contained in:
parent
339c33a14f
commit
df9e039dd2
@ -2,7 +2,7 @@ mod column;
|
||||
|
||||
use gtk::{gio::File, ScrolledWindow};
|
||||
|
||||
pub struct Directory;
|
||||
pub struct Directory; // @TODO save settings
|
||||
|
||||
impl Directory {
|
||||
// Constructors
|
||||
@ -32,12 +32,17 @@ impl Directory {
|
||||
)
|
||||
.build();
|
||||
|
||||
column_view.append_column(&Column::icon());
|
||||
let name = Column::name();
|
||||
let icon = Column::icon();
|
||||
let name = Column::name(360);
|
||||
let size = Column::size(120);
|
||||
let content_type = Column::content_type(180);
|
||||
//let modification_date_time = Column::modification_date_time();
|
||||
|
||||
column_view.append_column(&icon);
|
||||
column_view.append_column(&name);
|
||||
column_view.append_column(&Column::size());
|
||||
column_view.append_column(&Column::content_type());
|
||||
//column_view.append_column(&Column::modification_date_time());
|
||||
column_view.append_column(&size);
|
||||
column_view.append_column(&content_type);
|
||||
//column_view.append_column(&modification_date_time);
|
||||
|
||||
column_view.sort_by_column(Some(&name), gtk::SortType::Ascending);
|
||||
column_view
|
||||
|
@ -1,11 +1,12 @@
|
||||
const DEFAULT: &str = "-";
|
||||
const WIDTH: i32 = 360;
|
||||
|
||||
pub trait Column {
|
||||
fn icon() -> Self;
|
||||
fn name() -> Self;
|
||||
fn size() -> Self;
|
||||
fn content_type() -> Self;
|
||||
fn modification_date_time() -> Self;
|
||||
fn name(width: i32) -> Self;
|
||||
fn size(width: i32) -> Self;
|
||||
fn content_type(width: i32) -> Self;
|
||||
fn modification_date_time(width: i32) -> Self;
|
||||
}
|
||||
|
||||
impl Column for gtk::ColumnViewColumn {
|
||||
@ -18,7 +19,6 @@ impl Column for gtk::ColumnViewColumn {
|
||||
|
||||
ColumnViewColumn::builder()
|
||||
.title("Type")
|
||||
.resizable(false)
|
||||
.factory(&{
|
||||
let factory = SignalListItemFactory::new();
|
||||
factory.connect_bind(|_, this| {
|
||||
@ -59,9 +59,9 @@ impl Column for gtk::ColumnViewColumn {
|
||||
.build()
|
||||
}
|
||||
|
||||
fn name() -> Self {
|
||||
fn name(width: i32) -> Self {
|
||||
gtk::ColumnViewColumn::builder()
|
||||
.expand(true)
|
||||
.fixed_width(width)
|
||||
.resizable(true)
|
||||
.title("Name")
|
||||
.factory(&{
|
||||
@ -95,9 +95,9 @@ impl Column for gtk::ColumnViewColumn {
|
||||
.build()
|
||||
}
|
||||
|
||||
fn size() -> Self {
|
||||
fn size(width: i32) -> Self {
|
||||
gtk::ColumnViewColumn::builder()
|
||||
.expand(true)
|
||||
.fixed_width(width)
|
||||
.resizable(true)
|
||||
.title("Size")
|
||||
.factory(&{
|
||||
@ -121,9 +121,9 @@ impl Column for gtk::ColumnViewColumn {
|
||||
.build()
|
||||
}
|
||||
|
||||
fn content_type() -> Self {
|
||||
fn content_type(width: i32) -> Self {
|
||||
gtk::ColumnViewColumn::builder()
|
||||
.expand(true)
|
||||
.fixed_width(width)
|
||||
.resizable(true)
|
||||
.title("Content Type")
|
||||
.factory(&{
|
||||
@ -164,9 +164,9 @@ impl Column for gtk::ColumnViewColumn {
|
||||
.build()
|
||||
}
|
||||
|
||||
fn modification_date_time() -> Self {
|
||||
fn modification_date_time(width: i32) -> Self {
|
||||
gtk::ColumnViewColumn::builder()
|
||||
.expand(true)
|
||||
.fixed_width(width)
|
||||
.resizable(true)
|
||||
.title("Modified")
|
||||
.factory(&{
|
||||
|
Loading…
x
Reference in New Issue
Block a user