mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
refactor: lint
This commit is contained in:
@ -4,7 +4,9 @@
|
||||
#include <giomm.h>
|
||||
#include <glibmm/refptr.h>
|
||||
#include <json/json.h>
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#include "bar.hpp"
|
||||
#include "modules/sni/item.hpp"
|
||||
|
||||
@ -18,27 +20,27 @@ class Host {
|
||||
~Host();
|
||||
|
||||
private:
|
||||
void busAcquired(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring);
|
||||
void nameAppeared(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring,
|
||||
const Glib::ustring&);
|
||||
void nameVanished(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring);
|
||||
void busAcquired(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring);
|
||||
void nameAppeared(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring,
|
||||
const Glib::ustring&);
|
||||
void nameVanished(const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring);
|
||||
static void proxyReady(GObject*, GAsyncResult*, gpointer);
|
||||
static void registerHost(GObject*, GAsyncResult*, gpointer);
|
||||
static void itemRegistered(SnWatcher*, const gchar*, gpointer);
|
||||
static void itemUnregistered(SnWatcher*, const gchar*, gpointer);
|
||||
|
||||
std::tuple<std::string, std::string> getBusNameAndObjectPath(const std::string);
|
||||
void addRegisteredItem(std::string service);
|
||||
void addRegisteredItem(std::string service);
|
||||
|
||||
std::vector<std::unique_ptr<Item>> items_;
|
||||
const std::string bus_name_;
|
||||
const std::string object_path_;
|
||||
std::size_t bus_name_id_;
|
||||
std::size_t watcher_id_;
|
||||
GCancellable* cancellable_ = nullptr;
|
||||
SnWatcher* watcher_ = nullptr;
|
||||
const Json::Value& config_;
|
||||
const Bar& bar_;
|
||||
std::vector<std::unique_ptr<Item>> items_;
|
||||
const std::string bus_name_;
|
||||
const std::string object_path_;
|
||||
std::size_t bus_name_id_;
|
||||
std::size_t watcher_id_;
|
||||
GCancellable* cancellable_ = nullptr;
|
||||
SnWatcher* watcher_ = nullptr;
|
||||
const Json::Value& config_;
|
||||
const Bar& bar_;
|
||||
const std::function<void(std::unique_ptr<Item>&)> on_add_;
|
||||
const std::function<void(std::unique_ptr<Item>&)> on_remove_;
|
||||
};
|
||||
|
@ -31,25 +31,25 @@ class Item : public sigc::trackable {
|
||||
std::string bus_name;
|
||||
std::string object_path;
|
||||
|
||||
int icon_size;
|
||||
int effective_icon_size;
|
||||
Gtk::Image image;
|
||||
int icon_size;
|
||||
int effective_icon_size;
|
||||
Gtk::Image image;
|
||||
Gtk::EventBox event_box;
|
||||
std::string category;
|
||||
std::string id;
|
||||
std::string category;
|
||||
std::string id;
|
||||
|
||||
std::string title;
|
||||
std::string icon_name;
|
||||
Glib::RefPtr<Gdk::Pixbuf> icon_pixmap;
|
||||
std::string title;
|
||||
std::string icon_name;
|
||||
Glib::RefPtr<Gdk::Pixbuf> icon_pixmap;
|
||||
Glib::RefPtr<Gtk::IconTheme> icon_theme;
|
||||
std::string overlay_icon_name;
|
||||
std::string attention_icon_name;
|
||||
std::string attention_movie_name;
|
||||
std::string icon_theme_path;
|
||||
std::string menu;
|
||||
ToolTip tooltip;
|
||||
DbusmenuGtkMenu* dbus_menu = nullptr;
|
||||
Gtk::Menu* gtk_menu = nullptr;
|
||||
std::string overlay_icon_name;
|
||||
std::string attention_icon_name;
|
||||
std::string attention_movie_name;
|
||||
std::string icon_theme_path;
|
||||
std::string menu;
|
||||
ToolTip tooltip;
|
||||
DbusmenuGtkMenu* dbus_menu = nullptr;
|
||||
Gtk::Menu* gtk_menu = nullptr;
|
||||
/**
|
||||
* ItemIsMenu flag means that the item only supports the context menu.
|
||||
* Default value is true because libappindicator supports neither ItemIsMenu nor Activate method
|
||||
@ -67,15 +67,15 @@ class Item : public sigc::trackable {
|
||||
void onSignal(const Glib::ustring& sender_name, const Glib::ustring& signal_name,
|
||||
const Glib::VariantContainerBase& arguments);
|
||||
|
||||
void updateImage();
|
||||
void updateImage();
|
||||
Glib::RefPtr<Gdk::Pixbuf> extractPixBuf(GVariant* variant);
|
||||
Glib::RefPtr<Gdk::Pixbuf> getIconPixbuf();
|
||||
Glib::RefPtr<Gdk::Pixbuf> getIconByName(const std::string& name, int size);
|
||||
double getScaledIconSize();
|
||||
static void onMenuDestroyed(Item* self, GObject* old_menu_pointer);
|
||||
void makeMenu();
|
||||
bool handleClick(GdkEventButton* const& /*ev*/);
|
||||
bool handleScroll(GdkEventScroll* const&);
|
||||
double getScaledIconSize();
|
||||
static void onMenuDestroyed(Item* self, GObject* old_menu_pointer);
|
||||
void makeMenu();
|
||||
bool handleClick(GdkEventButton* const& /*ev*/);
|
||||
bool handleScroll(GdkEventScroll* const&);
|
||||
|
||||
// smooth scrolling threshold
|
||||
gdouble scroll_threshold_ = 0;
|
||||
@ -86,7 +86,7 @@ class Item : public sigc::trackable {
|
||||
|
||||
Glib::RefPtr<Gio::DBus::Proxy> proxy_;
|
||||
Glib::RefPtr<Gio::Cancellable> cancellable_;
|
||||
std::set<std::string_view> update_pending_;
|
||||
std::set<std::string_view> update_pending_;
|
||||
};
|
||||
|
||||
} // namespace waybar::modules::SNI
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "AModule.hpp"
|
||||
#include "bar.hpp"
|
||||
#include "modules/sni/host.hpp"
|
||||
@ -20,9 +21,9 @@ class Tray : public AModule {
|
||||
void onRemove(std::unique_ptr<Item>& item);
|
||||
|
||||
static inline std::size_t nb_hosts_ = 0;
|
||||
Gtk::Box box_;
|
||||
SNI::Watcher::singleton watcher_;
|
||||
SNI::Host host_;
|
||||
Gtk::Box box_;
|
||||
SNI::Watcher::singleton watcher_;
|
||||
SNI::Host host_;
|
||||
};
|
||||
|
||||
} // namespace waybar::modules::SNI
|
||||
|
@ -30,26 +30,26 @@ class Watcher {
|
||||
|
||||
typedef struct {
|
||||
GfWatchType type;
|
||||
Watcher * watcher;
|
||||
gchar * service;
|
||||
gchar * bus_name;
|
||||
gchar * object_path;
|
||||
guint watch_id;
|
||||
Watcher *watcher;
|
||||
gchar *service;
|
||||
gchar *bus_name;
|
||||
gchar *object_path;
|
||||
guint watch_id;
|
||||
} GfWatch;
|
||||
|
||||
void busAcquired(const Glib::RefPtr<Gio::DBus::Connection> &, Glib::ustring);
|
||||
void busAcquired(const Glib::RefPtr<Gio::DBus::Connection> &, Glib::ustring);
|
||||
static gboolean handleRegisterHost(Watcher *, GDBusMethodInvocation *, const gchar *);
|
||||
static gboolean handleRegisterItem(Watcher *, GDBusMethodInvocation *, const gchar *);
|
||||
static GfWatch *gfWatchFind(GSList *list, const gchar *bus_name, const gchar *object_path);
|
||||
static GfWatch *gfWatchNew(GfWatchType, const gchar *, const gchar *, const gchar *, Watcher *);
|
||||
static void nameVanished(GDBusConnection *connection, const char *name, gpointer data);
|
||||
static void gfWatchFree(gpointer data);
|
||||
static void nameVanished(GDBusConnection *connection, const char *name, gpointer data);
|
||||
static void gfWatchFree(gpointer data);
|
||||
|
||||
void updateRegisteredItems(SnWatcher *obj);
|
||||
|
||||
uint32_t bus_name_id_;
|
||||
GSList * hosts_ = nullptr;
|
||||
GSList * items_ = nullptr;
|
||||
uint32_t bus_name_id_;
|
||||
GSList *hosts_ = nullptr;
|
||||
GSList *items_ = nullptr;
|
||||
SnWatcher *watcher_ = nullptr;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user