🚧 unwrap group if double clicked
This commit is contained in:
parent
21647a6014
commit
b9504e881e
|
@ -102,9 +102,9 @@ checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"
|
|||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0b3de4a0c5e67e16066a0715723abd91edc2f9001d09c46e1dca929351e130e"
|
||||
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db"
|
||||
|
||||
[[package]]
|
||||
name = "cachyos-hello"
|
||||
|
|
|
@ -210,6 +210,7 @@ impl ApplicationBrowser {
|
|||
self.tree_view.set_activate_on_single_click(true);
|
||||
self.tree_view.set_has_tooltip(true);
|
||||
self.tree_view.connect_query_tooltip(on_query_tooltip_tree_view);
|
||||
self.tree_view.connect_button_press_event(on_button_press_event_tree_view);
|
||||
|
||||
// column model: icon
|
||||
let icon = gtk::CellRendererPixbuf::new();
|
||||
|
@ -364,6 +365,37 @@ fn on_query_tooltip_tree_view(
|
|||
false
|
||||
}
|
||||
|
||||
fn on_button_press_event_tree_view(
|
||||
treeview: >k::TreeView,
|
||||
event_btn: &gdk::EventButton,
|
||||
) -> gtk::glib::signal::Inhibit {
|
||||
if event_btn.button() == 1 && event_btn.event_type() == gdk::EventType::DoubleButtonPress {
|
||||
if let Some(coords) = event_btn.coords() {
|
||||
let (x, y) = coords;
|
||||
let path_info = treeview.path_at_pos(x as i32, y as i32);
|
||||
if path_info == None {
|
||||
return gtk::glib::signal::Inhibit(true);
|
||||
}
|
||||
|
||||
let (path, ..) = path_info.unwrap();
|
||||
let app_browser = unsafe { &mut G_APP_BROWSER.lock().unwrap() };
|
||||
let app_store = app_browser.app_store.clone();
|
||||
let iter_a = app_store.iter(&path.clone().unwrap()).unwrap();
|
||||
let value_gobj = app_store.value(&iter_a, PACKAGE as i32);
|
||||
|
||||
if value_gobj.get::<&str>().is_err() {
|
||||
if treeview.row_expanded(&path.clone().unwrap()) {
|
||||
treeview.collapse_row(&path.unwrap());
|
||||
} else {
|
||||
treeview.expand_to_path(&path.unwrap());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gtk::glib::signal::Inhibit(false)
|
||||
}
|
||||
|
||||
fn on_app_toggle(_cell: >k::CellRendererToggle, path: gtk::TreePath) {
|
||||
let app_browser = unsafe { &mut G_APP_BROWSER.lock().unwrap() };
|
||||
let app_store = app_browser.app_store.clone();
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![feature(const_slice_from_raw_parts)]
|
||||
#![feature(const_str_from_utf8)]
|
||||
#![feature(string_remove_matches)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
|
Loading…
Reference in New Issue