Add info about column type to global variable
This commit is contained in:
parent
d42e17c15f
commit
58461c9718
11 changed files with 334 additions and 321 deletions
|
@ -11,11 +11,9 @@ use image::DynamicImage;
|
|||
|
||||
use crate::flg;
|
||||
use crate::gui_structs::gui_data::GuiData;
|
||||
use crate::help_functions::{
|
||||
count_number_of_groups, get_all_children, get_full_name_from_path_name, get_max_file_name, get_pixbuf_from_dynamic_image, resize_pixbuf_dimension, NotebookObject,
|
||||
NOTEBOOKS_INFOS,
|
||||
};
|
||||
use crate::help_functions::{count_number_of_groups, get_all_children, get_full_name_from_path_name, get_max_file_name, get_pixbuf_from_dynamic_image, resize_pixbuf_dimension};
|
||||
use crate::localizer_core::generate_translation_hashmap;
|
||||
use crate::notebook_info::{NotebookObject, NOTEBOOKS_INFO};
|
||||
|
||||
const BIG_PREVIEW_SIZE: i32 = 600;
|
||||
const SMALL_PREVIEW_SIZE: i32 = 130;
|
||||
|
@ -49,7 +47,7 @@ pub fn connect_button_compare(gui_data: &GuiData) {
|
|||
button_compare.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
let model = tree_view.model().unwrap();
|
||||
|
||||
let group_number = count_number_of_groups(tree_view, nb_object.column_header.unwrap());
|
||||
|
@ -128,7 +126,7 @@ pub fn connect_button_compare(gui_data: &GuiData) {
|
|||
button_go_previous_compare_group.connect_clicked(move |button_go_previous_compare_group| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
let model = tree_view.model().unwrap();
|
||||
|
||||
*shared_current_of_groups.borrow_mut() -= 1;
|
||||
|
@ -180,7 +178,7 @@ pub fn connect_button_compare(gui_data: &GuiData) {
|
|||
button_go_next_compare_group.connect_clicked(move |button_go_next_compare_group| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
let model = tree_view.model().unwrap();
|
||||
|
||||
*shared_current_of_groups.borrow_mut() += 1;
|
||||
|
@ -218,7 +216,7 @@ pub fn connect_button_compare(gui_data: &GuiData) {
|
|||
check_button_left_preview_text.connect_toggled(move |check_button_left_preview_text| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
let model = tree_view.model().unwrap().downcast::<ListStore>().unwrap();
|
||||
|
||||
let main_tree_path = shared_current_path.borrow().as_ref().unwrap().clone();
|
||||
|
@ -241,7 +239,7 @@ pub fn connect_button_compare(gui_data: &GuiData) {
|
|||
check_button_right_preview_text.connect_toggled(move |check_button_right_preview_text| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
let model = tree_view.model().unwrap().downcast::<ListStore>().unwrap();
|
||||
|
||||
let main_tree_path = shared_current_path.borrow().as_ref().unwrap().clone();
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::gui_structs::gui_data::GuiData;
|
|||
use crate::help_functions::*;
|
||||
use crate::localizer_core::generate_translation_hashmap;
|
||||
use crate::notebook_enums::*;
|
||||
use crate::notebook_info::NOTEBOOKS_INFO;
|
||||
|
||||
// TODO add support for checking if really symlink doesn't point to correct directory/file
|
||||
|
||||
|
@ -43,7 +44,7 @@ pub async fn delete_things(gui_data: GuiData) {
|
|||
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
let (number_of_selected_items, number_of_selected_groups) = check_how_much_elements_is_selected(tree_view, nb_object.column_header, nb_object.column_selection);
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::gui_structs::gui_data::GuiData;
|
|||
use crate::help_functions::*;
|
||||
use crate::localizer_core::generate_translation_hashmap;
|
||||
use crate::notebook_enums::*;
|
||||
use crate::notebook_info::NOTEBOOKS_INFO;
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
enum TypeOfTool {
|
||||
|
@ -55,7 +56,7 @@ async fn sym_hard_link_things(gui_data: GuiData, hardlinking: TypeOfTool) {
|
|||
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
let column_header = nb_object.column_header.expect("Linking can be only used for tree views with grouped results");
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use crate::gui_structs::gui_data::GuiData;
|
|||
use crate::help_functions::*;
|
||||
use crate::localizer_core::generate_translation_hashmap;
|
||||
use crate::notebook_enums::*;
|
||||
use crate::notebook_info::NOTEBOOKS_INFO;
|
||||
|
||||
pub fn connect_button_move(gui_data: &GuiData) {
|
||||
let buttons_move = gui_data.bottom_buttons.buttons_move.clone();
|
||||
|
@ -28,7 +29,7 @@ pub fn connect_button_move(gui_data: &GuiData) {
|
|||
buttons_move.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
let (number_of_selected_items, _number_of_selected_groups) = check_how_much_elements_is_selected(tree_view, nb_object.column_header, nb_object.column_selection);
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@ use gtk4::prelude::*;
|
|||
|
||||
use crate::gui_structs::gui_data::GuiData;
|
||||
use crate::gui_structs::gui_popovers::GuiPopovers;
|
||||
use crate::help_functions::{PopoverTypes, NOTEBOOKS_INFOS};
|
||||
use crate::help_functions::PopoverTypes;
|
||||
use crate::notebook_enums::*;
|
||||
use crate::notebook_info::NOTEBOOKS_INFO;
|
||||
|
||||
pub fn connect_button_select(gui_data: &GuiData) {
|
||||
let popovers = gui_data.popovers.clone();
|
||||
|
@ -33,7 +34,7 @@ fn show_required_popovers(popovers: &GuiPopovers, current_mode: &NotebookMainEnu
|
|||
let separator_select_image_size = popovers.separator_select_image_size.clone();
|
||||
let separator_select_reverse = popovers.separator_select_reverse.clone();
|
||||
|
||||
let arr = &NOTEBOOKS_INFOS[current_mode.clone() as usize].available_modes;
|
||||
let arr = &NOTEBOOKS_INFO[current_mode.clone() as usize].available_modes;
|
||||
|
||||
if arr.contains(&PopoverTypes::All) {
|
||||
buttons_popover_select_all.show();
|
||||
|
|
|
@ -7,6 +7,7 @@ use czkawka_core::common::Common;
|
|||
use crate::flg;
|
||||
use crate::gui_structs::gui_data::GuiData;
|
||||
use crate::help_functions::*;
|
||||
use crate::notebook_info::NOTEBOOKS_INFO;
|
||||
|
||||
// File length variable allows users to choose duplicates which have shorter file name
|
||||
// e.g. 'tar.gz' will be selected instead 'tar.gz (copy)' etc.
|
||||
|
@ -612,7 +613,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_select_all.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_select_all(&popover_select, tree_view, nb_object.column_selection as u32, nb_object.column_header);
|
||||
});
|
||||
|
@ -624,7 +625,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_unselect_all.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_unselect_all(&popover_select, tree_view, nb_object.column_selection as u32);
|
||||
});
|
||||
|
@ -636,7 +637,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_reverse.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_reverse(&popover_select, tree_view, nb_object.column_selection as u32, nb_object.column_header);
|
||||
});
|
||||
|
@ -648,7 +649,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_select_all_except_oldest.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_all_except_oldest_newest(
|
||||
&popover_select,
|
||||
|
@ -668,7 +669,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_select_all_except_newest.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_all_except_oldest_newest(
|
||||
&popover_select,
|
||||
|
@ -688,7 +689,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_select_one_oldest.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_one_oldest_newest(
|
||||
&popover_select,
|
||||
|
@ -708,7 +709,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_select_one_newest.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_one_oldest_newest(
|
||||
&popover_select,
|
||||
|
@ -729,7 +730,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_select_custom.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_custom_select_unselect(
|
||||
&popover_select,
|
||||
|
@ -751,7 +752,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_unselect_custom.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_custom_select_unselect(
|
||||
&popover_select,
|
||||
|
@ -772,7 +773,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_select_all_images_except_biggest.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_all_except_biggest_smallest(
|
||||
&popover_select,
|
||||
|
@ -792,7 +793,7 @@ pub fn connect_popovers(gui_data: &GuiData) {
|
|||
buttons_popover_select_all_images_except_smallest.connect_clicked(move |_| {
|
||||
let nb_number = notebook_main.current_page().unwrap();
|
||||
let tree_view = &main_tree_views[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[nb_number as usize];
|
||||
|
||||
popover_all_except_biggest_smallest(
|
||||
&popover_select,
|
||||
|
|
|
@ -25,7 +25,8 @@ use czkawka_core::similar_videos::SimilarVideos;
|
|||
use czkawka_core::temporary::Temporary;
|
||||
|
||||
use crate::flg;
|
||||
use crate::notebook_enums::{NotebookMainEnum, NotebookUpperEnum, NUMBER_OF_NOTEBOOK_MAIN_TABS};
|
||||
use crate::notebook_enums::{NotebookMainEnum, NotebookUpperEnum};
|
||||
use crate::notebook_info::{NotebookObject, NOTEBOOKS_INFO};
|
||||
|
||||
#[cfg(not(target_family = "windows"))]
|
||||
pub const CHARACTER: char = '/';
|
||||
|
@ -50,7 +51,6 @@ pub enum PopoverTypes {
|
|||
Reverse,
|
||||
Custom,
|
||||
Date,
|
||||
None,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Copy, Clone, Hash)]
|
||||
|
@ -65,166 +65,6 @@ pub enum BottomButtonsEnum {
|
|||
Compare,
|
||||
}
|
||||
|
||||
pub struct NotebookObject {
|
||||
pub notebook_type: NotebookMainEnum,
|
||||
pub available_modes: [PopoverTypes; 5],
|
||||
pub column_activatable_button: Option<i32>,
|
||||
pub column_path: i32,
|
||||
pub column_name: i32,
|
||||
pub column_selection: i32,
|
||||
pub column_header: Option<i32>,
|
||||
pub column_dimensions: Option<i32>,
|
||||
pub column_size: Option<i32>,
|
||||
pub column_size_as_bytes: Option<i32>,
|
||||
pub column_modification_as_secs: Option<i32>,
|
||||
}
|
||||
|
||||
pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::Duplicate,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::Date, PopoverTypes::None],
|
||||
column_activatable_button: Some(ColumnsDuplicates::ActivatableSelectButton as i32),
|
||||
column_path: ColumnsDuplicates::Path as i32,
|
||||
column_name: ColumnsDuplicates::Name as i32,
|
||||
column_selection: ColumnsDuplicates::SelectionButton as i32,
|
||||
column_header: Some(ColumnsDuplicates::IsHeader as i32),
|
||||
column_dimensions: None,
|
||||
column_size: None, // Do not add, useless in hash and size mode
|
||||
column_size_as_bytes: None, // Do not add, useless in hash and size mode
|
||||
column_modification_as_secs: Some(ColumnsDuplicates::ModificationAsSecs as i32),
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::EmptyDirectories,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::None, PopoverTypes::None],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsEmptyFolders::Path as i32,
|
||||
column_name: ColumnsEmptyFolders::Name as i32,
|
||||
column_selection: ColumnsEmptyFolders::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::BigFiles,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::None, PopoverTypes::None],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsBigFiles::Path as i32,
|
||||
column_name: ColumnsBigFiles::Name as i32,
|
||||
column_selection: ColumnsBigFiles::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::EmptyFiles,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::None, PopoverTypes::None],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsEmptyFiles::Path as i32,
|
||||
column_name: ColumnsEmptyFiles::Name as i32,
|
||||
column_selection: ColumnsEmptyFiles::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::Temporary,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::None, PopoverTypes::None],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsTemporaryFiles::Path as i32,
|
||||
column_name: ColumnsTemporaryFiles::Name as i32,
|
||||
column_selection: ColumnsTemporaryFiles::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::SimilarImages,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::Date, PopoverTypes::Size],
|
||||
column_activatable_button: Some(ColumnsSimilarImages::ActivatableSelectButton as i32),
|
||||
column_path: ColumnsSimilarImages::Path as i32,
|
||||
column_name: ColumnsSimilarImages::Name as i32,
|
||||
column_selection: ColumnsSimilarImages::SelectionButton as i32,
|
||||
column_header: Some(ColumnsSimilarImages::IsHeader as i32),
|
||||
column_dimensions: Some(ColumnsSimilarImages::Dimensions as i32),
|
||||
column_size: Some(ColumnsSimilarImages::Size as i32),
|
||||
column_size_as_bytes: Some(ColumnsSimilarImages::SizeAsBytes as i32),
|
||||
column_modification_as_secs: Some(ColumnsSimilarImages::ModificationAsSecs as i32),
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::SimilarVideos,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::Date, PopoverTypes::Size],
|
||||
column_activatable_button: Some(ColumnsSimilarVideos::ActivatableSelectButton as i32),
|
||||
column_path: ColumnsSimilarVideos::Path as i32,
|
||||
column_name: ColumnsSimilarVideos::Name as i32,
|
||||
column_selection: ColumnsSimilarVideos::SelectionButton as i32,
|
||||
column_header: Some(ColumnsSimilarVideos::IsHeader as i32),
|
||||
column_dimensions: None,
|
||||
column_size: Some(ColumnsSimilarVideos::Size as i32),
|
||||
column_size_as_bytes: Some(ColumnsSimilarVideos::SizeAsBytes as i32),
|
||||
column_modification_as_secs: Some(ColumnsSimilarVideos::ModificationAsSecs as i32),
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::SameMusic,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::Date, PopoverTypes::Size],
|
||||
column_activatable_button: Some(ColumnsSameMusic::ActivatableSelectButton as i32),
|
||||
column_path: ColumnsSameMusic::Path as i32,
|
||||
column_name: ColumnsSameMusic::Name as i32,
|
||||
column_selection: ColumnsSameMusic::SelectionButton as i32,
|
||||
column_header: Some(ColumnsSameMusic::IsHeader as i32),
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: Some(ColumnsSameMusic::SizeAsBytes as i32),
|
||||
column_modification_as_secs: Some(ColumnsSameMusic::ModificationAsSecs as i32),
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::Symlinks,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::None, PopoverTypes::None],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsInvalidSymlinks::Path as i32,
|
||||
column_name: ColumnsInvalidSymlinks::Name as i32,
|
||||
column_selection: ColumnsInvalidSymlinks::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::BrokenFiles,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::None, PopoverTypes::None],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsBrokenFiles::Path as i32,
|
||||
column_name: ColumnsBrokenFiles::Name as i32,
|
||||
column_selection: ColumnsBrokenFiles::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::BadExtensions,
|
||||
available_modes: [PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::None, PopoverTypes::None],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsBadExtensions::Path as i32,
|
||||
column_name: ColumnsBadExtensions::Name as i32,
|
||||
column_selection: ColumnsBadExtensions::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
},
|
||||
];
|
||||
|
||||
pub enum Message {
|
||||
Duplicates(DuplicateFinder),
|
||||
EmptyFolders(EmptyFolder),
|
||||
|
@ -537,7 +377,7 @@ pub fn get_notebook_upper_enum_from_tree_view(tree_view: &TreeView) -> NotebookU
|
|||
|
||||
pub fn get_notebook_object_from_tree_view(tree_view: &TreeView) -> &NotebookObject {
|
||||
let nb_enum = get_notebook_enum_from_tree_view(tree_view);
|
||||
&NOTEBOOKS_INFOS[nb_enum as usize]
|
||||
&NOTEBOOKS_INFO[nb_enum as usize]
|
||||
}
|
||||
|
||||
pub fn get_full_name_from_path_name(path: &str, name: &str) -> String {
|
||||
|
|
|
@ -25,6 +25,7 @@ use crate::help_functions::*;
|
|||
use crate::language_functions::LANGUAGES_ALL;
|
||||
use crate::localizer_core::generate_translation_hashmap;
|
||||
use crate::notebook_enums::NotebookMainEnum;
|
||||
use crate::notebook_info::NOTEBOOKS_INFO;
|
||||
use crate::opening_selecting_records::*;
|
||||
|
||||
pub fn initialize_gui(gui_data: &mut GuiData) {
|
||||
|
@ -126,19 +127,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let image_preview = gui_data.main_notebook.image_preview_duplicates.clone();
|
||||
image_preview.hide();
|
||||
|
||||
let col_types: [glib::types::Type; 10] = [
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::Duplicate as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -155,14 +144,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_empty_folder_finder.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_empty_folder_finder.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 5] = [
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::EmptyDirectories as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -178,14 +160,8 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
{
|
||||
let scrolled_window = gui_data.main_notebook.scrolled_window_empty_files_finder.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_empty_files_finder.clone();
|
||||
let col_types: [glib::types::Type; 5] = [
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::EmptyFiles as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -201,14 +177,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_temporary_files_finder.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_temporary_files_finder.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 5] = [
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::Temporary as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -224,16 +193,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_big_files_finder.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_big_files_finder.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 7] = [
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // SizeAsBytes
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::BigFiles as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -252,22 +212,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let image_preview = gui_data.main_notebook.image_preview_similar_images.clone();
|
||||
image_preview.hide();
|
||||
|
||||
let col_types: [glib::types::Type; 13] = [
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Similarity
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::U64, // SizeAsBytes
|
||||
glib::types::Type::STRING, // Dimensions
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::SimilarImages as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -284,20 +229,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_similar_videos_finder.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_similar_videos_finder.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 11] = [
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::U64, // SizeAsBytes
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::SimilarVideos as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -314,27 +246,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_same_music_finder.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_same_music_finder.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 18] = [
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::U64, // SizeAsBytes
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Title
|
||||
glib::types::Type::STRING, // Artist
|
||||
glib::types::Type::STRING, // Year
|
||||
glib::types::Type::STRING, // Bitrate
|
||||
glib::types::Type::U64, // BitrateAsNumber
|
||||
glib::types::Type::STRING, // Length
|
||||
glib::types::Type::STRING, // Genre
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::SameMusic as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -351,16 +263,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_invalid_symlinks.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_invalid_symlinks.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 7] = [
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // DestinationPath
|
||||
glib::types::Type::STRING, // TypeOfError
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::Symlinks as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -376,15 +279,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_broken_files.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_broken_files.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 6] = [
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // ErrorType
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::BrokenFiles as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -400,16 +295,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
|
|||
let scrolled_window = gui_data.main_notebook.scrolled_window_bad_extensions.clone();
|
||||
let tree_view = gui_data.main_notebook.tree_view_bad_extensions.clone();
|
||||
|
||||
let col_types: [glib::types::Type; 7] = [
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // CurrentExtension
|
||||
glib::types::Type::STRING, // ProperExtensions
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
];
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(&col_types);
|
||||
let list_store: gtk4::ListStore = gtk4::ListStore::new(NOTEBOOKS_INFO[NotebookMainEnum::BadExtensions as usize].columns_types);
|
||||
|
||||
tree_view.set_model(Some(&list_store));
|
||||
tree_view.selection().set_mode(SelectionMode::Multiple);
|
||||
|
@ -547,7 +433,7 @@ fn connect_event_mouse(gui_data: &GuiData) {
|
|||
// TODO GTK 4, currently not works, connect_pressed shows previous thing - https://gitlab.gnome.org/GNOME/gtk/-/issues/4939
|
||||
// Use connect_released when it will be fixed, currently using connect_row_activated workaround
|
||||
tree_view.connect_row_activated(move |tree_view, _b, _c| {
|
||||
let nb_object = &NOTEBOOKS_INFOS[NotebookMainEnum::Duplicate as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[NotebookMainEnum::Duplicate as usize];
|
||||
let preview_path = preview_path.clone();
|
||||
show_preview(
|
||||
tree_view,
|
||||
|
@ -572,7 +458,7 @@ fn connect_event_mouse(gui_data: &GuiData) {
|
|||
|
||||
// TODO GTK 4, currently not works, connect_pressed shows previous thing
|
||||
tree_view.connect_row_activated(move |tree_view, _b, _c| {
|
||||
let nb_object = &NOTEBOOKS_INFOS[NotebookMainEnum::SimilarImages as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[NotebookMainEnum::SimilarImages as usize];
|
||||
let preview_path = preview_path.clone();
|
||||
show_preview(
|
||||
tree_view,
|
||||
|
@ -626,7 +512,7 @@ fn connect_event_buttons(gui_data: &GuiData) {
|
|||
glib::MainContext::default().spawn_local(delete_things(gui_data_clone.clone()));
|
||||
}
|
||||
let preview_path = preview_path.clone();
|
||||
let nb_object = &NOTEBOOKS_INFOS[NotebookMainEnum::Duplicate as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[NotebookMainEnum::Duplicate as usize];
|
||||
show_preview(
|
||||
&event_controller_key.widget().downcast::<TreeView>().unwrap(),
|
||||
&text_view_errors,
|
||||
|
@ -654,7 +540,7 @@ fn connect_event_buttons(gui_data: &GuiData) {
|
|||
glib::MainContext::default().spawn_local(delete_things(gui_data_clone.clone()));
|
||||
}
|
||||
let preview_path = preview_path.clone();
|
||||
let nb_object = &NOTEBOOKS_INFOS[NotebookMainEnum::SimilarImages as usize];
|
||||
let nb_object = &NOTEBOOKS_INFO[NotebookMainEnum::SimilarImages as usize];
|
||||
show_preview(
|
||||
&event_controller_key.widget().downcast::<TreeView>().unwrap(),
|
||||
&text_view_errors,
|
||||
|
|
|
@ -51,6 +51,7 @@ mod initialize_gui;
|
|||
mod language_functions;
|
||||
mod localizer_gui;
|
||||
mod notebook_enums;
|
||||
mod notebook_info;
|
||||
mod opening_selecting_records;
|
||||
mod saving_loading;
|
||||
mod taskbar_progress;
|
||||
|
|
282
czkawka_gui/src/notebook_info.rs
Normal file
282
czkawka_gui/src/notebook_info.rs
Normal file
|
@ -0,0 +1,282 @@
|
|||
use crate::help_functions::{
|
||||
ColumnsBadExtensions, ColumnsBigFiles, ColumnsBrokenFiles, ColumnsDuplicates, ColumnsEmptyFiles, ColumnsEmptyFolders, ColumnsInvalidSymlinks, ColumnsSameMusic,
|
||||
ColumnsSimilarImages, ColumnsSimilarVideos, ColumnsTemporaryFiles, PopoverTypes,
|
||||
};
|
||||
use crate::notebook_enums::{NotebookMainEnum, NUMBER_OF_NOTEBOOK_MAIN_TABS};
|
||||
|
||||
pub struct NotebookObject {
|
||||
pub notebook_type: NotebookMainEnum,
|
||||
pub available_modes: &'static [PopoverTypes],
|
||||
pub column_activatable_button: Option<i32>,
|
||||
pub column_path: i32,
|
||||
pub column_name: i32,
|
||||
pub column_selection: i32,
|
||||
pub column_header: Option<i32>,
|
||||
pub column_dimensions: Option<i32>,
|
||||
pub column_size: Option<i32>,
|
||||
pub column_size_as_bytes: Option<i32>,
|
||||
pub column_modification_as_secs: Option<i32>,
|
||||
pub columns_types: &'static [glib::types::Type],
|
||||
}
|
||||
|
||||
pub static NOTEBOOKS_INFO: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::Duplicate,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::Date],
|
||||
column_activatable_button: Some(ColumnsDuplicates::ActivatableSelectButton as i32),
|
||||
column_path: ColumnsDuplicates::Path as i32,
|
||||
column_name: ColumnsDuplicates::Name as i32,
|
||||
column_selection: ColumnsDuplicates::SelectionButton as i32,
|
||||
column_header: Some(ColumnsDuplicates::IsHeader as i32),
|
||||
column_dimensions: None,
|
||||
column_size: None, // Do not add, useless in hash and size mode
|
||||
column_size_as_bytes: None, // Do not add, useless in hash and size mode
|
||||
column_modification_as_secs: Some(ColumnsDuplicates::ModificationAsSecs as i32),
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::EmptyDirectories,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsEmptyFolders::Path as i32,
|
||||
column_name: ColumnsEmptyFolders::Name as i32,
|
||||
column_selection: ColumnsEmptyFolders::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::BigFiles,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsBigFiles::Path as i32,
|
||||
column_name: ColumnsBigFiles::Name as i32,
|
||||
column_selection: ColumnsBigFiles::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // SizeAsBytes
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::EmptyFiles,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsEmptyFiles::Path as i32,
|
||||
column_name: ColumnsEmptyFiles::Name as i32,
|
||||
column_selection: ColumnsEmptyFiles::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::Temporary,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsTemporaryFiles::Path as i32,
|
||||
column_name: ColumnsTemporaryFiles::Name as i32,
|
||||
column_selection: ColumnsTemporaryFiles::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::SimilarImages,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::Date, PopoverTypes::Size],
|
||||
column_activatable_button: Some(ColumnsSimilarImages::ActivatableSelectButton as i32),
|
||||
column_path: ColumnsSimilarImages::Path as i32,
|
||||
column_name: ColumnsSimilarImages::Name as i32,
|
||||
column_selection: ColumnsSimilarImages::SelectionButton as i32,
|
||||
column_header: Some(ColumnsSimilarImages::IsHeader as i32),
|
||||
column_dimensions: Some(ColumnsSimilarImages::Dimensions as i32),
|
||||
column_size: Some(ColumnsSimilarImages::Size as i32),
|
||||
column_size_as_bytes: Some(ColumnsSimilarImages::SizeAsBytes as i32),
|
||||
column_modification_as_secs: Some(ColumnsSimilarImages::ModificationAsSecs as i32),
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Similarity
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::U64, // SizeAsBytes
|
||||
glib::types::Type::STRING, // Dimensions
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::SimilarVideos,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::Date, PopoverTypes::Size],
|
||||
column_activatable_button: Some(ColumnsSimilarVideos::ActivatableSelectButton as i32),
|
||||
column_path: ColumnsSimilarVideos::Path as i32,
|
||||
column_name: ColumnsSimilarVideos::Name as i32,
|
||||
column_selection: ColumnsSimilarVideos::SelectionButton as i32,
|
||||
column_header: Some(ColumnsSimilarVideos::IsHeader as i32),
|
||||
column_dimensions: None,
|
||||
column_size: Some(ColumnsSimilarVideos::Size as i32),
|
||||
column_size_as_bytes: Some(ColumnsSimilarVideos::SizeAsBytes as i32),
|
||||
column_modification_as_secs: Some(ColumnsSimilarVideos::ModificationAsSecs as i32),
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::U64, // SizeAsBytes
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::SameMusic,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom, PopoverTypes::Date, PopoverTypes::Size],
|
||||
column_activatable_button: Some(ColumnsSameMusic::ActivatableSelectButton as i32),
|
||||
column_path: ColumnsSameMusic::Path as i32,
|
||||
column_name: ColumnsSameMusic::Name as i32,
|
||||
column_selection: ColumnsSameMusic::SelectionButton as i32,
|
||||
column_header: Some(ColumnsSameMusic::IsHeader as i32),
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: Some(ColumnsSameMusic::SizeAsBytes as i32),
|
||||
column_modification_as_secs: Some(ColumnsSameMusic::ModificationAsSecs as i32),
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // ActivatableSelectButton
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Size
|
||||
glib::types::Type::U64, // SizeAsBytes
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // Title
|
||||
glib::types::Type::STRING, // Artist
|
||||
glib::types::Type::STRING, // Year
|
||||
glib::types::Type::STRING, // Bitrate
|
||||
glib::types::Type::U64, // BitrateAsNumber
|
||||
glib::types::Type::STRING, // Length
|
||||
glib::types::Type::STRING, // Genre
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
glib::types::Type::STRING, // Color
|
||||
glib::types::Type::BOOL, // IsHeader
|
||||
glib::types::Type::STRING, // TextColor
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::Symlinks,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsInvalidSymlinks::Path as i32,
|
||||
column_name: ColumnsInvalidSymlinks::Name as i32,
|
||||
column_selection: ColumnsInvalidSymlinks::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // DestinationPath
|
||||
glib::types::Type::STRING, // TypeOfError
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::BrokenFiles,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsBrokenFiles::Path as i32,
|
||||
column_name: ColumnsBrokenFiles::Name as i32,
|
||||
column_selection: ColumnsBrokenFiles::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // ErrorType
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
],
|
||||
},
|
||||
NotebookObject {
|
||||
notebook_type: NotebookMainEnum::BadExtensions,
|
||||
available_modes: &[PopoverTypes::All, PopoverTypes::Reverse, PopoverTypes::Custom],
|
||||
column_activatable_button: None,
|
||||
column_path: ColumnsBadExtensions::Path as i32,
|
||||
column_name: ColumnsBadExtensions::Name as i32,
|
||||
column_selection: ColumnsBadExtensions::SelectionButton as i32,
|
||||
column_header: None,
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: None,
|
||||
column_modification_as_secs: None,
|
||||
columns_types: &[
|
||||
glib::types::Type::BOOL, // SelectionButton
|
||||
glib::types::Type::STRING, // Name
|
||||
glib::types::Type::STRING, // Path
|
||||
glib::types::Type::STRING, // CurrentExtension
|
||||
glib::types::Type::STRING, // ProperExtensions
|
||||
glib::types::Type::STRING, // Modification
|
||||
glib::types::Type::U64, // ModificationAsSecs
|
||||
],
|
||||
},
|
||||
];
|
|
@ -1,5 +1,6 @@
|
|||
use crate::help_functions::{get_notebook_enum_from_tree_view, NOTEBOOKS_INFOS};
|
||||
use crate::help_functions::get_notebook_enum_from_tree_view;
|
||||
use crate::notebook_enums::to_notebook_main_enum;
|
||||
use crate::notebook_info::NOTEBOOKS_INFO;
|
||||
use crate::GuiData;
|
||||
|
||||
pub fn validate_notebook_data(gui_data: &GuiData) {
|
||||
|
@ -13,7 +14,7 @@ pub fn validate_notebook_data(gui_data: &GuiData) {
|
|||
|
||||
// This test main info about notebooks
|
||||
// Should have same order as notebook enum types
|
||||
for (i, item) in NOTEBOOKS_INFOS.iter().enumerate() {
|
||||
for (i, item) in NOTEBOOKS_INFO.iter().enumerate() {
|
||||
let en = to_notebook_main_enum(i as u32);
|
||||
assert_eq!(item.notebook_type, en);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue