cleanup and styling

This commit is contained in:
Ashley Wulber 2022-01-07 11:54:20 -05:00
parent 45d8c75e02
commit 5c599889b4
3 changed files with 12 additions and 20 deletions

View file

@ -99,7 +99,7 @@ impl DockList {
return;
}
}
println!("Error loading saved apps!");
eprintln!("Error loading saved apps!");
let model = &self.model();
xdg::BaseDirectories::new()
.expect("could not access XDG Base directory")
@ -238,16 +238,16 @@ impl DockList {
if let Some(old_index) = old_index {
if let Some(old_item) = model.item(old_index) {
if let Ok(old_dock_object) = old_item.downcast::<DockObject>() {
println!("removing popup...");
old_dock_object.set_popover(false);
popover_menu_index.replace(None);
model.items_changed(old_index, 0, 0);
//TODO signal dock to check if it should hide
}
}
return;
}
if y > f64::from(max_y) || y < 0.0 || x > f64::from(max_x) || x < 0.0 {
println!("out of bounds click...");
// println!("out of bounds click...");
return;
}
@ -273,7 +273,7 @@ impl DockList {
}
(click, _, _, _) if click == 3 => {
println!("handling right click");
// println!("handling right click");
if let Some(old_index) = popover_menu_index.get().clone() {
if let Some(item) = model.item(old_index) {
if let Ok(dock_object) = item.downcast::<DockObject>() {
@ -287,7 +287,7 @@ impl DockList {
popover_menu_index.replace(Some(index));
model.items_changed(index, 0, 0);
}
_ => println!("Failed to process click.")
_ => eprintln!("Failed to process click.")
}
}
}

View file

@ -1,4 +1,5 @@
use cascade::cascade;
use gdk4::pango::EllipsizeMode;
use gio::DesktopAppInfo;
use gtk4::subclass::prelude::*;
use gtk4::{gio, glib};
@ -120,11 +121,13 @@ impl DockPopover {
..set_margin_end(4);
..set_margin_top(4);
..set_margin_bottom(4);
..set_wrap(true);
..set_max_width_chars(20);
..set_ellipsize(EllipsizeMode::End);
..add_css_class("title-4");
..add_css_class("window_title");
};
// TODO investigate Xembed
let window_image = cascade! {
//TODO fill with image of window
Image::from_pixbuf(None);
@ -213,11 +216,11 @@ impl DockPopover {
let favorite_item = imp.favorite_item.borrow();
let quit_all_item = imp.quit_all_item.borrow();
let window_listbox = imp.window_list.borrow();
let all_windows_header = imp.all_windows_item_header.borrow();
let revealer = &imp.all_windows_item_revealer;
// let all_windows_header = imp.all_windows_item_header.borrow();
// let revealer = &imp.all_windows_item_revealer;
if let Some(dock_object) = dock_object.as_ref() {
println!("setting up popover menu handlers");
// println!("setting up popover menu handlers");
let self_ = self.clone();
launch_new_item.connect_clicked(glib::clone!(@weak dock_object, => move |_| {
let app_info = dock_object.property("appinfo").expect("DockObject must have appinfo property").get::<Option<DesktopAppInfo>>().expect("Failed to convert value to DesktopAppInfo").unwrap();

View file

@ -137,17 +137,6 @@ fn main() {
.call_method(Some(DEST), PATH, Some(DEST), "WindowFocus", &((e,)))
.await
.expect("Failed to focus selected window");
// let m = zbus_conn
// .call_method(Some(DEST), PATH, Some(DEST), "WindowId", &((e,)))
// .await;
// if let Ok(m) = m {
// if let Ok(reply) = m.body::<(u32, u32)>() {
// dbg!(reply);
// } else {
// dbg!(m);
// }
// // glib::timeout_future(Duration::from_millis(100)).await;
// }
}
Event::Close(e) => {
let _activate_window = zbus_conn