1
0
Fork 0
mirror of synced 2024-05-16 02:13:23 +12:00

Disable selection of header

This commit is contained in:
Rafał Mikrut 2020-09-29 13:50:31 +02:00
parent fe78ca4428
commit 801b9083da

View file

@ -15,13 +15,15 @@ use std::rc::Rc;
use std::time::UNIX_EPOCH; use std::time::UNIX_EPOCH;
use std::{env, process}; use std::{env, process};
enum ColumnsDefault { enum Columns3Default {
// Columns for duplicate and empty folder treeview
Name = 0, Name = 0,
Path, Path,
Modification, Modification,
Color, Color,
} }
enum ColumnsDirectory { enum ColumnsDirectory {
// Columns for Included and Excluded Directories in upper Notebook
Path = 0, Path = 0,
Color, Color,
} }
@ -488,8 +490,8 @@ pub fn create_tree_view_duplicates(tree_view_duplicate_finder: &mut gtk::TreeVie
name_column.set_title("File Name"); name_column.set_title("File Name");
name_column.set_resizable(true); name_column.set_resizable(true);
name_column.set_min_width(50); name_column.set_min_width(50);
name_column.add_attribute(&renderer, "text", ColumnsDefault::Name as i32); name_column.add_attribute(&renderer, "text", Columns3Default::Name as i32);
name_column.add_attribute(&renderer, "background", ColumnsDefault::Color as i32); name_column.add_attribute(&renderer, "background", Columns3Default::Color as i32);
tree_view_duplicate_finder.append_column(&name_column); tree_view_duplicate_finder.append_column(&name_column);
let renderer = gtk::CellRendererText::new(); let renderer = gtk::CellRendererText::new();
@ -498,8 +500,8 @@ pub fn create_tree_view_duplicates(tree_view_duplicate_finder: &mut gtk::TreeVie
path_column.set_title("Path"); path_column.set_title("Path");
path_column.set_resizable(true); path_column.set_resizable(true);
path_column.set_min_width(100); path_column.set_min_width(100);
path_column.add_attribute(&renderer, "text", ColumnsDefault::Path as i32); path_column.add_attribute(&renderer, "text", Columns3Default::Path as i32);
path_column.add_attribute(&renderer, "background", ColumnsDefault::Color as i32); path_column.add_attribute(&renderer, "background", Columns3Default::Color as i32);
tree_view_duplicate_finder.append_column(&path_column); tree_view_duplicate_finder.append_column(&path_column);
let renderer = gtk::CellRendererText::new(); let renderer = gtk::CellRendererText::new();
@ -508,8 +510,8 @@ pub fn create_tree_view_duplicates(tree_view_duplicate_finder: &mut gtk::TreeVie
modification_date_column.set_title("Modification Date"); modification_date_column.set_title("Modification Date");
modification_date_column.set_resizable(true); modification_date_column.set_resizable(true);
modification_date_column.set_min_width(100); modification_date_column.set_min_width(100);
modification_date_column.add_attribute(&renderer, "text", ColumnsDefault::Modification as i32); modification_date_column.add_attribute(&renderer, "text", Columns3Default::Modification as i32);
modification_date_column.add_attribute(&renderer, "background", ColumnsDefault::Color as i32); modification_date_column.add_attribute(&renderer, "background", Columns3Default::Color as i32);
tree_view_duplicate_finder.append_column(&modification_date_column); tree_view_duplicate_finder.append_column(&modification_date_column);
tree_view_duplicate_finder.set_vexpand(true); tree_view_duplicate_finder.set_vexpand(true);
@ -522,8 +524,8 @@ pub fn create_tree_view_empty_folders(tree_view_empty_folder_finder: &mut gtk::T
name_column.set_title("Folder Name"); name_column.set_title("Folder Name");
name_column.set_resizable(true); name_column.set_resizable(true);
name_column.set_min_width(50); name_column.set_min_width(50);
name_column.add_attribute(&renderer, "text", ColumnsDefault::Name as i32); name_column.add_attribute(&renderer, "text", Columns3Default::Name as i32);
name_column.add_attribute(&renderer, "background", ColumnsDefault::Color as i32); name_column.add_attribute(&renderer, "background", Columns3Default::Color as i32);
tree_view_empty_folder_finder.append_column(&name_column); tree_view_empty_folder_finder.append_column(&name_column);
let renderer = gtk::CellRendererText::new(); let renderer = gtk::CellRendererText::new();
@ -532,8 +534,8 @@ pub fn create_tree_view_empty_folders(tree_view_empty_folder_finder: &mut gtk::T
path_column.set_title("Path"); path_column.set_title("Path");
path_column.set_resizable(true); path_column.set_resizable(true);
path_column.set_min_width(100); path_column.set_min_width(100);
path_column.add_attribute(&renderer, "text", ColumnsDefault::Path as i32); path_column.add_attribute(&renderer, "text", Columns3Default::Path as i32);
path_column.add_attribute(&renderer, "background", ColumnsDefault::Color as i32); path_column.add_attribute(&renderer, "background", Columns3Default::Color as i32);
tree_view_empty_folder_finder.append_column(&path_column); tree_view_empty_folder_finder.append_column(&path_column);
let renderer = gtk::CellRendererText::new(); let renderer = gtk::CellRendererText::new();
@ -542,8 +544,8 @@ pub fn create_tree_view_empty_folders(tree_view_empty_folder_finder: &mut gtk::T
modification_date_column.set_title("Modification Date"); modification_date_column.set_title("Modification Date");
modification_date_column.set_resizable(true); modification_date_column.set_resizable(true);
modification_date_column.set_min_width(100); modification_date_column.set_min_width(100);
modification_date_column.add_attribute(&renderer, "text", ColumnsDefault::Modification as i32); modification_date_column.add_attribute(&renderer, "text", Columns3Default::Modification as i32);
modification_date_column.add_attribute(&renderer, "background", ColumnsDefault::Color as i32); modification_date_column.add_attribute(&renderer, "background", Columns3Default::Color as i32);
tree_view_empty_folder_finder.append_column(&modification_date_column); tree_view_empty_folder_finder.append_column(&modification_date_column);
tree_view_empty_folder_finder.set_vexpand(true); tree_view_empty_folder_finder.set_vexpand(true);
@ -607,7 +609,15 @@ pub fn print_text_messages_to_text_view(text_messages: &Messages, text_view: &gt
text_view.get_buffer().unwrap().set_text(messages.as_str()); text_view.get_buffer().unwrap().set_text(messages.as_str());
} }
fn select_function(_ts: &gtk::TreeSelection, _tm: &gtk::TreeModel, _tp: &gtk::TreePath, _b: bool) -> bool { fn select_function(_tree_selection: &gtk::TreeSelection, tree_model: &gtk::TreeModel, tree_path: &gtk::TreePath, _is_path_currently_selected: bool) -> bool {
// TODO Create proper function to disable selecting header rows // let name = tree_model.get_value(&tree_model.get_iter(tree_path).unwrap(),Columns3Default::Name as i32).get::<String>().unwrap().unwrap();
false // let path = tree_model.get_value(&tree_model.get_iter(tree_path).unwrap(), Columns3Default::Path as i32).get::<String>().unwrap().unwrap();
// let modification = tree_model.get_value(&tree_model.get_iter(tree_path).unwrap(),Columns3Default::Modification as i32).get::<String>().unwrap().unwrap();
let color = tree_model.get_value(&tree_model.get_iter(tree_path).unwrap(), Columns3Default::Color as i32).get::<String>().unwrap().unwrap();
if color == HEADER_ROW_COLOR {
return false;
}
true
} }