Use libcomsic-applet in status-area, network, graphics

This commit is contained in:
Ian Douglas Scott 2022-07-05 16:21:23 -07:00
parent aac43de65d
commit 765e3af815
13 changed files with 154 additions and 330 deletions

View file

@ -19,7 +19,7 @@ struct Menu {
#[derive(Default)]
pub struct StatusMenuInner {
menu_button: DerefCell<gtk4::MenuButton>,
menu_button: DerefCell<libcosmic_applet::AppletButton>,
vbox: DerefCell<gtk4::Box>,
item: DerefCell<StatusNotifierItemProxy<'static>>,
dbus_menu: DerefCell<DBusMenuProxy<'static>>,
@ -43,17 +43,10 @@ impl ObjectImpl for StatusMenuInner {
gtk4::Box::new(gtk4::Orientation::Vertical, 0);
};
let popover = cascade! {
gtk4::Popover::new();
..set_child(Some(&vbox));
};
let menu_button = cascade! {
gtk4::MenuButton::new();
..add_css_class("panel_icon");
..set_has_frame(false);
libcosmic_applet::AppletButton::new();
..set_parent(obj);
..set_popover(Some(&popover));
..set_popover_child(Some(&vbox));
};
self.menu_button.set(menu_button);
@ -88,7 +81,7 @@ impl StatusMenu {
.await?;
let obj = glib::Object::new::<Self>(&[]).unwrap();
let icon_name = item.icon_name().await?;
obj.inner().menu_button.set_icon_name(&icon_name);
obj.inner().menu_button.set_button_icon_name(&icon_name);
let menu = item.menu().await?;
let menu = DBusMenuProxy::builder(&connection)