Proper popup opening
This commit is contained in:
parent
24635a0334
commit
4a3293bd31
|
@ -6,16 +6,15 @@ use crate::help_functions::{PopoverTypes, NOTEBOOKS_INFOS};
|
|||
use crate::notebook_enums::*;
|
||||
|
||||
pub fn connect_button_select(gui_data: &GuiData) {
|
||||
// TODO GTK 4
|
||||
// let popovers = gui_data.popovers.clone();
|
||||
// let notebook_main = gui_data.main_notebook.notebook_main.clone();
|
||||
// let popover_select = gui_data.popovers.popover_select.clone();
|
||||
// let buttons_select = gui_data.bottom_buttons.buttons_select.clone();
|
||||
//
|
||||
// buttons_select.connect_clicked(move |_| {
|
||||
// show_required_popovers(&popovers, &to_notebook_main_enum(notebook_main.current_page().unwrap()));
|
||||
// popover_select.popup();
|
||||
// });
|
||||
let popovers = gui_data.popovers.clone();
|
||||
let notebook_main = gui_data.main_notebook.notebook_main.clone();
|
||||
let popover_select = gui_data.popovers.popover_select.clone();
|
||||
let gc_buttons_select = gui_data.bottom_buttons.gc_buttons_select.clone();
|
||||
|
||||
gc_buttons_select.connect_pressed(move |_, _, _, _| {
|
||||
show_required_popovers(&popovers, &to_notebook_main_enum(notebook_main.current_page().unwrap()));
|
||||
popover_select.popup();
|
||||
});
|
||||
}
|
||||
|
||||
fn show_required_popovers(popovers: &GuiPopovers, current_mode: &NotebookMainEnum) {
|
||||
|
|
|
@ -20,12 +20,10 @@ pub fn connect_button_stop(gui_data: &GuiData) {
|
|||
}
|
||||
});
|
||||
|
||||
// TODO GTK 4
|
||||
// let gc_button_stop_in_dialog = gui_data.progress_window.gc_button_stop_in_dialog.clone();
|
||||
// let stop_sender = gui_data.stop_sender.clone();
|
||||
// // gc_button_stop_in_dialog.connect_released(move |_, _e| {
|
||||
// gc_button_stop_in_dialog.connect_button_release_event(move |_, _e| {
|
||||
// send_stop_message(&stop_sender);
|
||||
// gtk4::Inhibit(false)
|
||||
// });
|
||||
let gc_button_stop_in_dialog = gui_data.progress_window.gc_button_stop_in_dialog.clone();
|
||||
let stop_sender = gui_data.stop_sender.clone();
|
||||
// TODO change this to connect released, not sure why not works here
|
||||
gc_button_stop_in_dialog.connect_pressed(move |a, b, c, d| {
|
||||
send_stop_message(&stop_sender);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use gtk4::prelude::*;
|
||||
use gtk4::Widget;
|
||||
use gtk4::{GestureClick, Widget};
|
||||
|
||||
use crate::help_functions::{get_custom_label_from_widget, set_icon_of_button, BottomButtonsEnum};
|
||||
use crate::{
|
||||
|
@ -19,8 +19,20 @@ pub struct GuiBottomButtons {
|
|||
pub buttons_compare: gtk4::Button,
|
||||
pub buttons_show_errors: gtk4::Button,
|
||||
pub buttons_show_upper_notebook: gtk4::Button,
|
||||
|
||||
pub buttons_names: [BottomButtonsEnum; 8],
|
||||
pub buttons_array: [Widget; 8],
|
||||
|
||||
pub gc_buttons_search: gtk4::GestureClick,
|
||||
pub gc_buttons_select: gtk4::GestureClick,
|
||||
pub gc_buttons_delete: gtk4::GestureClick,
|
||||
pub gc_buttons_save: gtk4::GestureClick,
|
||||
pub gc_buttons_symlink: gtk4::GestureClick,
|
||||
pub gc_buttons_hardlink: gtk4::GestureClick,
|
||||
pub gc_buttons_move: gtk4::GestureClick,
|
||||
pub gc_buttons_compare: gtk4::GestureClick,
|
||||
pub gc_buttons_show_errors: gtk4::GestureClick,
|
||||
pub gc_buttons_show_upper_notebook: gtk4::GestureClick,
|
||||
}
|
||||
|
||||
impl GuiBottomButtons {
|
||||
|
@ -37,6 +49,19 @@ impl GuiBottomButtons {
|
|||
let buttons_show_errors: gtk4::Button = builder.object("buttons_show_errors").unwrap();
|
||||
let buttons_show_upper_notebook: gtk4::Button = builder.object("buttons_show_upper_notebook").unwrap();
|
||||
|
||||
let gc_buttons_search: GestureClick = GestureClick::new();
|
||||
let gc_buttons_select: GestureClick = GestureClick::new();
|
||||
let gc_buttons_delete: GestureClick = GestureClick::new();
|
||||
let gc_buttons_save: GestureClick = GestureClick::new();
|
||||
let gc_buttons_symlink: GestureClick = GestureClick::new();
|
||||
let gc_buttons_hardlink: GestureClick = GestureClick::new();
|
||||
let gc_buttons_move: GestureClick = GestureClick::new();
|
||||
let gc_buttons_compare: GestureClick = GestureClick::new();
|
||||
let gc_buttons_show_errors: GestureClick = GestureClick::new();
|
||||
let gc_buttons_show_upper_notebook: GestureClick = GestureClick::new();
|
||||
|
||||
buttons_select.add_controller(&gc_buttons_select);
|
||||
|
||||
set_icon_of_button(&buttons_search, CZK_ICON_SEARCH);
|
||||
set_icon_of_button(&buttons_select, CZK_ICON_SELECT);
|
||||
set_icon_of_button(&buttons_delete, CZK_ICON_TRASH);
|
||||
|
@ -84,6 +109,16 @@ impl GuiBottomButtons {
|
|||
buttons_show_upper_notebook,
|
||||
buttons_names,
|
||||
buttons_array,
|
||||
gc_buttons_search,
|
||||
gc_buttons_select,
|
||||
gc_buttons_delete,
|
||||
gc_buttons_save,
|
||||
gc_buttons_symlink,
|
||||
gc_buttons_hardlink,
|
||||
gc_buttons_move,
|
||||
gc_buttons_compare,
|
||||
gc_buttons_show_errors,
|
||||
gc_buttons_show_upper_notebook,
|
||||
}
|
||||
}
|
||||
pub fn update_language(&self) {
|
||||
|
|
|
@ -83,7 +83,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsDuplicates::Path as i32,
|
||||
column_name: ColumnsDuplicates::Name as i32,
|
||||
column_selection: ColumnsDuplicates::SelectionButton as i32,
|
||||
column_header: Some(ColumnsDuplicates::Color 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
|
||||
|
@ -148,7 +148,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsSimilarImages::Path as i32,
|
||||
column_name: ColumnsSimilarImages::Name as i32,
|
||||
column_selection: ColumnsSimilarImages::SelectionButton as i32,
|
||||
column_header: Some(ColumnsSimilarImages::Color 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),
|
||||
|
@ -161,7 +161,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsSimilarVideos::Path as i32,
|
||||
column_name: ColumnsSimilarVideos::Name as i32,
|
||||
column_selection: ColumnsSimilarVideos::SelectionButton as i32,
|
||||
column_header: Some(ColumnsSimilarVideos::Color 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),
|
||||
|
@ -174,7 +174,7 @@ pub static NOTEBOOKS_INFOS: [NotebookObject; NUMBER_OF_NOTEBOOK_MAIN_TABS] = [
|
|||
column_path: ColumnsSameMusic::Path as i32,
|
||||
column_name: ColumnsSameMusic::Name as i32,
|
||||
column_selection: ColumnsSameMusic::SelectionButton as i32,
|
||||
column_header: Some(ColumnsSameMusic::Color as i32),
|
||||
column_header: Some(ColumnsSameMusic::IsHeader as i32),
|
||||
column_dimensions: None,
|
||||
column_size: None,
|
||||
column_size_as_bytes: Some(ColumnsSameMusic::SizeAsBytes as i32),
|
||||
|
|
Loading…
Reference in a new issue