mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-24 22:52:32 +02:00 
			
		
		
		
	refactor(tray): use Gio::DBus bindings in SNI Item class
This commit is contained in:
		| @@ -2,12 +2,14 @@ | ||||
|  | ||||
| #include <dbus-status-notifier-item.h> | ||||
| #include <glibmm/refptr.h> | ||||
| #include <giomm/dbusproxy.h> | ||||
| #include <gtkmm/eventbox.h> | ||||
| #include <gtkmm/image.h> | ||||
| #include <gtkmm/icontheme.h> | ||||
| #include <gtkmm/menu.h> | ||||
| #include <json/json.h> | ||||
| #include <libdbusmenu-gtk/dbusmenu-gtk.h> | ||||
| #include <sigc++/trackable.h> | ||||
| #ifdef FILESYSTEM_EXPERIMENTAL | ||||
| #include <experimental/filesystem> | ||||
| #else | ||||
| @@ -16,7 +18,7 @@ | ||||
|  | ||||
| namespace waybar::modules::SNI { | ||||
|  | ||||
| class Item { | ||||
| class Item : public sigc::trackable { | ||||
| public: | ||||
|   Item(std::string, std::string, const Json::Value&); | ||||
|   ~Item() = default; | ||||
| @@ -46,8 +48,8 @@ public: | ||||
|   bool item_is_menu; | ||||
|  | ||||
| private: | ||||
|   static void proxyReady(GObject *obj, GAsyncResult *res, gpointer data); | ||||
|   static void getAll(GObject *obj, GAsyncResult *res, gpointer data); | ||||
|   void proxyReady(Glib::RefPtr<Gio::AsyncResult>& result); | ||||
|   void setProperty(const Glib::ustring& name, Glib::VariantBase& value); | ||||
|  | ||||
|   void updateImage(); | ||||
|   Glib::RefPtr<Gdk::Pixbuf> extractPixBuf(GVariant *variant); | ||||
| @@ -56,8 +58,8 @@ private: | ||||
|   bool makeMenu(GdkEventButton *const &ev); | ||||
|   bool handleClick(GdkEventButton *const & /*ev*/); | ||||
|  | ||||
|   GCancellable *cancellable_ = nullptr; | ||||
|   SnItem *proxy_ = nullptr; | ||||
|   Glib::RefPtr<Gio::Cancellable> cancellable_; | ||||
|   Glib::RefPtr<Gio::DBus::Proxy> proxy_; | ||||
| }; | ||||
|  | ||||
| } // namespace waybar::modules::SNI | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Aleksei Bavshin
					Aleksei Bavshin