refacor media widget, apply clang format rule
This commit is contained in:
@@ -5,20 +5,20 @@
|
||||
|
||||
class DbusConnection {
|
||||
public:
|
||||
virtual ~DbusConnection() = default;
|
||||
virtual ~DbusConnection() = default;
|
||||
|
||||
protected:
|
||||
Glib::RefPtr<Gio::DBus::Connection> connection;
|
||||
Glib::RefPtr<Gio::DBus::Connection> connection;
|
||||
|
||||
void connect_session_async(const sigc::slot<void(const Glib::RefPtr<Gio::AsyncResult> &)> &callback) {
|
||||
Gio::DBus::Connection::get(Gio::DBus::BusType::SESSION, callback);
|
||||
}
|
||||
void connect_session_async(const sigc::slot<void(const Glib::RefPtr<Gio::AsyncResult> &)> &callback) {
|
||||
Gio::DBus::Connection::get(Gio::DBus::BusType::SESSION, callback);
|
||||
}
|
||||
|
||||
static void ensure_gio_init() {
|
||||
try {
|
||||
Gio::init();
|
||||
} catch (const Glib::Error &) {
|
||||
// Already initialized.
|
||||
}
|
||||
}
|
||||
static void ensure_gio_init() {
|
||||
try {
|
||||
Gio::init();
|
||||
} catch (const Glib::Error &) {
|
||||
// Already initialized.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
#include <sys/types.h>
|
||||
#include <vector>
|
||||
|
||||
#include "gdkmm/pixbuf.h"
|
||||
#include "glibmm/variant.h"
|
||||
|
||||
@@ -23,8 +24,8 @@ struct MprisPlayer2Message {
|
||||
};
|
||||
|
||||
enum NotificationUrgency {
|
||||
LOW = 0,
|
||||
NORMAL = 1,
|
||||
LOW = 0,
|
||||
NORMAL = 1,
|
||||
CRITICAL = 2
|
||||
};
|
||||
|
||||
@@ -38,7 +39,7 @@ struct NotifyMessage {
|
||||
NotificationUrgency urgency = NORMAL;
|
||||
int32_t expire_timeout;
|
||||
// Callback to invoke when an action is triggered
|
||||
std::function<void(const std::string& action_id)> on_action;
|
||||
std::function<void(const std::string &action_id)> on_action;
|
||||
// Guard to prevent multiple action invocations across mirrors
|
||||
std::shared_ptr<bool> actionInvoked;
|
||||
// image data (if any) from dbus
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <giomm.h>
|
||||
#include <sigc++/sigc++.h>
|
||||
#include <set>
|
||||
#include <sigc++/sigc++.h>
|
||||
#include <vector>
|
||||
|
||||
#include "connection/dbus/dbus.hpp"
|
||||
#include "connection/dbus/messages.hpp"
|
||||
|
||||
@@ -56,7 +57,7 @@ class MprisController : public DbusConnection {
|
||||
Glib::RefPtr<Gio::DBus::Proxy> m_dbus_proxy;
|
||||
std::string m_player_bus_name = "org.mpris.MediaPlayer2.spotify";
|
||||
std::set<std::string> registeredPlayers;
|
||||
|
||||
|
||||
sigc::signal<void(const MprisPlayer2Message &)> mprisUpdatedSignal;
|
||||
sigc::signal<void(PlaybackStatus)> playbackStatusChangedSignal;
|
||||
sigc::signal<void(int64_t)> playbackPositionChangedSignal;
|
||||
@@ -70,8 +71,8 @@ class MprisController : public DbusConnection {
|
||||
void emit_cached_position();
|
||||
void emit_cached_can_seek();
|
||||
void on_dbus_signal(const Glib::ustring &sender_name,
|
||||
const Glib::ustring &signal_name,
|
||||
const Glib::VariantContainerBase ¶meters);
|
||||
const Glib::ustring &signal_name,
|
||||
const Glib::VariantContainerBase ¶meters);
|
||||
void handle_player_registered(const std::string &bus_name);
|
||||
void handle_player_deregistered(const std::string &bus_name);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <sigc++/sigc++.h>
|
||||
|
||||
#include "connection/dbus/dbus.hpp"
|
||||
|
||||
#include "giomm/dbusconnection.h"
|
||||
#include "giomm/dbusownname.h"
|
||||
#include "glib.h"
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
class TrayService : public DbusConnection {
|
||||
inline static TrayService *instance = nullptr;
|
||||
|
||||
public:
|
||||
struct Item {
|
||||
std::string id;
|
||||
@@ -66,7 +67,7 @@ class TrayService : public DbusConnection {
|
||||
if (TrayService::instance == nullptr) {
|
||||
TrayService::instance = new TrayService();
|
||||
}
|
||||
|
||||
|
||||
return TrayService::instance;
|
||||
}
|
||||
|
||||
@@ -137,7 +138,7 @@ class TrayService : public DbusConnection {
|
||||
void begin_refresh(const std::string &id);
|
||||
static gboolean refresh_timeout_cb(gpointer user_data);
|
||||
static void on_refresh_finished_static(GObject *source, GAsyncResult *res,
|
||||
gpointer user_data);
|
||||
gpointer user_data);
|
||||
void emit_registered_items_changed();
|
||||
|
||||
Glib::Variant<std::vector<Glib::ustring>>
|
||||
|
||||
Reference in New Issue
Block a user