1
0
Fork 0
mirror of synced 2024-06-02 02:24:44 +12:00

Builder using

This commit is contained in:
Rafał Mikrut 2023-02-18 09:51:49 +01:00
parent b1a41585e4
commit cf7cbbcff6
6 changed files with 71 additions and 71 deletions

View file

@ -157,9 +157,13 @@ fn create_dialog_ask_for_deletion(window_main: &gtk4::Window, number_of_selected
generate_translation_hashmap(vec![("items", number_of_selected_items.to_string()), ("groups", number_of_selected_groups.to_string())])
))),
};
let check_button: CheckButton = CheckButton::with_label(&flg!("dialogs_ask_next_time"));
check_button.set_active(true);
check_button.set_halign(Align::Center);
let check_button: CheckButton = CheckButton::builder()
.label(flg!("dialogs_ask_next_time"))
.active(true)
.halign(Align::Center)
.margin_top(5)
.build();
button_ok.grab_focus();
@ -169,9 +173,6 @@ fn create_dialog_ask_for_deletion(window_main: &gtk4::Window, number_of_selected
parent.insert_child_after(&label2, Some(&label));
parent.insert_child_after(&check_button, Some(&label2));
// parent.set_margin(5); // TODO
check_button.set_margin_top(5);
dialog.show();
(dialog, check_button)
}
@ -187,9 +188,7 @@ fn create_dialog_group_deletion(window_main: &gtk4::Window) -> (Dialog, CheckBut
let label: gtk4::Label = gtk4::Label::new(Some(&flg!("delete_all_files_in_group_label1")));
let label2: gtk4::Label = gtk4::Label::new(Some(&flg!("delete_all_files_in_group_label2")));
let check_button: CheckButton = CheckButton::with_label(&flg!("dialogs_ask_next_time"));
check_button.set_active(true);
check_button.set_halign(Align::Center);
let check_button: CheckButton = CheckButton::builder().label(&flg!("dialogs_ask_next_time")).active(true).halign(Align::Center).build();
button_ok.grab_focus();

View file

@ -375,9 +375,7 @@ fn create_dialog_ask_for_linking(window_main: &gtk4::Window) -> (Dialog, CheckBu
dialog.add_button(&flg!("general_close_button"), ResponseType::Cancel);
let label: gtk4::Label = gtk4::Label::new(Some(&flg!("hard_sym_link_label")));
let check_button: CheckButton = CheckButton::with_label(&flg!("dialogs_ask_next_time"));
check_button.set_active(true);
check_button.set_halign(Align::Center);
let check_button: CheckButton = CheckButton::builder().label(&flg!("dialogs_ask_next_time")).active(true).halign(Align::Center).build();
button_ok.grab_focus();

View file

@ -249,37 +249,40 @@ fn popover_custom_select_unselect(
dialog.add_button(&flg!("general_ok_button"), ResponseType::Ok);
dialog.add_button(&flg!("general_close_button"), ResponseType::Cancel);
let check_button_path = gtk4::CheckButton::builder().label(flg!("popover_custom_regex_path_label")).build();
let check_button_name = gtk4::CheckButton::builder().label(flg!("popover_custom_regex_name_label")).build();
let check_button_rust_regex = gtk4::CheckButton::builder().label(flg!("popover_custom_regex_regex_label")).build();
let check_button_path = gtk4::CheckButton::builder()
.label(flg!("popover_custom_regex_path_label"))
.tooltip_text(flg!("popover_custom_path_check_button_entry_tooltip"))
.build();
let check_button_name = gtk4::CheckButton::builder()
.label(flg!("popover_custom_regex_name_label"))
.tooltip_text(flg!("popover_custom_name_check_button_entry_tooltip"))
.build();
let check_button_rust_regex = gtk4::CheckButton::builder()
.label(flg!("popover_custom_regex_regex_label"))
.tooltip_text(flg!("popover_custom_regex_check_button_entry_tooltip"))
.build();
let check_button_case_sensitive = gtk4::CheckButton::builder().label(flg!("popover_custom_case_sensitive_check_button")).build();
check_button_case_sensitive.set_active(false);
let check_button_case_sensitive = gtk4::CheckButton::builder()
.label(flg!("popover_custom_case_sensitive_check_button"))
.tooltip_text(flg!("popover_custom_case_sensitive_check_button_tooltip"))
.active(false)
.build();
let check_button_select_not_all_results = gtk4::CheckButton::builder().label(flg!("popover_custom_all_in_group_label")).build();
check_button_select_not_all_results.set_active(true);
let check_button_select_not_all_results = gtk4::CheckButton::builder()
.label(flg!("popover_custom_all_in_group_label"))
.tooltip_text(flg!("popover_custom_not_all_check_button_tooltip"))
.active(true)
.build();
let entry_path = gtk4::Entry::new();
let entry_name = gtk4::Entry::new();
let entry_rust_regex = gtk4::Entry::new();
entry_rust_regex.set_sensitive(false); // By default check button regex is disabled
let entry_path = gtk4::Entry::builder().tooltip_text(flg!("popover_custom_path_check_button_entry_tooltip")).build();
let entry_name = gtk4::Entry::builder().tooltip_text(flg!("popover_custom_name_check_button_entry_tooltip")).build();
let entry_rust_regex = gtk4::Entry::builder()
.tooltip_text(flg!("popover_custom_regex_check_button_entry_tooltip"))
.sensitive(false)
.build(); // By default check button regex is disabled
let label_regex_valid = gtk4::Label::new(None);
// Tooltips
{
check_button_path.set_tooltip_text(Some(&flg!("popover_custom_path_check_button_entry_tooltip")));
entry_path.set_tooltip_text(Some(&flg!("popover_custom_path_check_button_entry_tooltip")));
check_button_name.set_tooltip_text(Some(&flg!("popover_custom_name_check_button_entry_tooltip")));
entry_name.set_tooltip_text(Some(&flg!("popover_custom_name_check_button_entry_tooltip")));
check_button_rust_regex.set_tooltip_text(Some(&flg!("popover_custom_regex_check_button_entry_tooltip")));
entry_rust_regex.set_tooltip_text(Some(&flg!("popover_custom_regex_check_button_entry_tooltip")));
check_button_case_sensitive.set_tooltip_text(Some(&flg!("popover_custom_case_sensitive_check_button_tooltip")));
check_button_select_not_all_results.set_tooltip_text(Some(&flg!("popover_custom_not_all_check_button_tooltip")));
}
{
let label_regex_valid = label_regex_valid.clone();
entry_rust_regex.connect_changed(move |entry_rust_regex| {
@ -332,9 +335,7 @@ fn popover_custom_select_unselect(
// Configure look of things
{
// TODO Label should have const width, and rest should fill entry, but for now is 50%-50%
let grid = gtk4::Grid::new();
grid.set_row_homogeneous(true);
grid.set_column_homogeneous(true);
let grid = gtk4::Grid::builder().row_homogeneous(true).column_homogeneous(true).build();
grid.attach(&check_button_name, 0, 1, 1, 1);
grid.attach(&check_button_path, 0, 2, 1, 1);

View file

@ -158,7 +158,7 @@ impl GuiData {
shared_buttons.borrow_mut().insert(*i, temp_hashmap);
}
// State of search results
// File Dialogs - Native file dialogs must exists all the time in opposite to normal dialog
let file_dialog_include_exclude_folder_selection = FileChooserNative::builder()
.action(gtk4::FileChooserAction::SelectFolder)
@ -174,6 +174,8 @@ impl GuiData {
.modal(true)
.build();
// State of search results
let shared_duplication_state: Rc<RefCell<_>> = Rc::new(RefCell::new(DuplicateFinder::new()));
let shared_empty_folders_state: Rc<RefCell<_>> = Rc::new(RefCell::new(EmptyFolder::new()));
let shared_empty_files_state: Rc<RefCell<_>> = Rc::new(RefCell::new(EmptyFiles::new()));

View file

@ -195,27 +195,27 @@
(5,190,"GtkBox",None,189,None,None,None,None),
(5,191,"GtkImage",None,190,None,None,None,None),
(5,192,"GtkLabel","label_buttons_select",190,None,None,None,1),
(5,193,"GtkButton","buttons_compare",188,None,None,None,1),
(5,193,"GtkButton","buttons_compare",188,None,None,None,2),
(5,194,"GtkBox",None,193,None,None,None,None),
(5,195,"GtkImage",None,194,None,None,None,None),
(5,196,"GtkLabel",None,194,None,None,None,1),
(5,197,"GtkButton","buttons_delete",188,None,None,None,2),
(5,197,"GtkButton","buttons_delete",188,None,None,None,3),
(5,198,"GtkBox",None,197,None,None,None,None),
(5,199,"GtkImage",None,198,None,None,None,None),
(5,200,"GtkLabel",None,198,None,None,None,1),
(5,201,"GtkButton","buttons_move",188,None,None,None,3),
(5,201,"GtkButton","buttons_move",188,None,None,None,4),
(5,202,"GtkBox",None,201,None,None,None,None),
(5,203,"GtkImage",None,202,None,None,None,None),
(5,204,"GtkLabel",None,202,None,None,None,1),
(5,205,"GtkButton","buttons_save",188,None,None,None,4),
(5,205,"GtkButton","buttons_save",188,None,None,None,5),
(5,206,"GtkBox",None,205,None,None,None,None),
(5,207,"GtkImage",None,206,None,None,None,None),
(5,208,"GtkLabel",None,206,None,None,None,1),
(5,209,"GtkButton","buttons_symlink",188,None,None,None,5),
(5,209,"GtkButton","buttons_symlink",188,None,None,None,6),
(5,210,"GtkBox",None,209,None,None,None,None),
(5,211,"GtkImage",None,210,None,None,None,None),
(5,212,"GtkLabel",None,210,None,None,None,1),
(5,213,"GtkButton","buttons_hardlink",188,None,None,None,6),
(5,213,"GtkButton","buttons_hardlink",188,None,None,None,7),
(5,214,"GtkBox",None,213,None,None,None,None),
(5,215,"GtkImage",None,214,None,None,None,None),
(5,216,"GtkLabel",None,214,None,None,None,1),
@ -231,7 +231,7 @@
(5,226,"GtkCheckButton","check_button_broken_files_pdf",224,None,None,None,1),
(5,227,"GtkCheckButton","check_button_broken_files_archive",224,None,None,None,2),
(5,228,"GtkCheckButton","check_button_broken_files_image",224,None,None,None,3),
(5,229,"GtkMenuButton","buttons_sort",188,None,None,None,7),
(5,229,"GtkMenuButton","buttons_sort",188,None,None,None,1),
(5,230,"GtkBox",None,229,None,None,None,None),
(5,231,"GtkImage",None,230,None,None,None,None),
(5,232,"GtkLabel","label_buttons_sort",230,None,None,None,1),

View file

@ -900,6 +900,29 @@
</child>
</object>
</child>
<child>
<object class="GtkMenuButton" id="buttons_sort">
<property name="focus-on-click">0</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<child>
<object class="GtkBox">
<property name="halign">center</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage">
<property name="icon-name">image-missing</property>
</object>
</child>
<child>
<object class="GtkLabel" id="label_buttons_sort">
<property name="label">SortMenu</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="buttons_compare">
<property name="focusable">1</property>
@ -1032,29 +1055,6 @@
</child>
</object>
</child>
<child>
<object class="GtkMenuButton" id="buttons_sort">
<property name="focus-on-click">0</property>
<property name="focusable">1</property>
<property name="receives-default">1</property>
<child>
<object class="GtkBox">
<property name="halign">center</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage">
<property name="icon-name">image-missing</property>
</object>
</child>
<child>
<object class="GtkLabel" id="label_buttons_sort">
<property name="label">SortMenu</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>