Skip to content

Commit

Permalink
Merge pull request #36 from BuddiesOfBudgie/notification-dbus-refactor
Browse files Browse the repository at this point in the history
Notification dbus refactor
  • Loading branch information
JoshStrobl authored Jan 14, 2022
2 parents f9cfa8e + d0db004 commit f4c29e7
Show file tree
Hide file tree
Showing 13 changed files with 1,224 additions and 826 deletions.
20 changes: 10 additions & 10 deletions src/abomination/abomination.vala
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
* (at your option) any later version.
*/

private const string RAVEN_DBUS_NAME = "org.budgie_desktop.Raven";
private const string RAVEN_DBUS_OBJECT_PATH = "/org/budgie_desktop/Raven";
private const string NOTIFICATIONS_DBUS_NAME = "org.budgie_desktop.Notifications";
private const string NOTIFICATIONS_DBUS_OBJECT_PATH = "/org/budgie_desktop/Notifications";

[DBus (name="org.budgie_desktop.Raven")]
public interface AbominationRavenRemote : GLib.Object {
public async abstract void SetPauseNotifications(bool paused) throws DBusError, IOError;
[DBus (name="org.buddiesofbudgie.budgie.Dispatcher")]
public interface NotificationsRemote : GLib.Object {
public abstract bool notifications_paused { get; set; default = false; }
}

namespace Budgie.Abomination {
Expand All @@ -34,7 +34,7 @@ namespace Budgie.Abomination {
private HashTable<string?, unowned AppGroup?> running_app_groups; // running_app_groups is a list of app groups based on the group name

private Wnck.Screen screen = null;
private AbominationRavenRemote? raven_proxy = null;
private NotificationsRemote? notifications_proxy = null;

private ulong color_id = 0;

Expand All @@ -56,7 +56,7 @@ namespace Budgie.Abomination {

this.screen = Wnck.Screen.get_default();

Bus.get_proxy.begin<AbominationRavenRemote>(BusType.SESSION, RAVEN_DBUS_NAME, RAVEN_DBUS_OBJECT_PATH, 0, null, this.on_raven_get);
Bus.get_proxy.begin<NotificationsRemote>(BusType.SESSION, NOTIFICATIONS_DBUS_NAME, NOTIFICATIONS_DBUS_OBJECT_PATH, 0, null, this.on_dbus_get);

if (this.color_settings != null) { // gsd colors plugin schema defined
this.update_night_light_value();
Expand Down Expand Up @@ -89,9 +89,9 @@ namespace Budgie.Abomination {
}

/* Hold onto our Raven proxy ref */
public void on_raven_get(Object? o, AsyncResult? res) {
public void on_dbus_get(Object? o, AsyncResult? res) {
try {
this.raven_proxy = Bus.get_proxy.end(res);
this.notifications_proxy = Bus.get_proxy.end(res);
} catch (Error e) {
warning("Failed to gain Raven proxy: %s", e.message);
}
Expand Down Expand Up @@ -320,7 +320,7 @@ namespace Budgie.Abomination {

private void set_notifications_paused() {
if (this.should_pause_notifications_on_fullscreen) {
raven_proxy.SetPauseNotifications.begin(this.fullscreen_windows.size() >= 1);
notifications_proxy.notifications_paused = (this.fullscreen_windows.size() >= 1);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/daemon/manager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Budgie {

/* On Screen Display */
Budgie.OSDManager? osd;
Budgie.Notifications.Server? notifications;
Budgie.MenuManager? menus;
Budgie.TabSwitcher? switcher;

Expand All @@ -36,6 +37,7 @@ namespace Budgie {
});
osd = new Budgie.OSDManager();
osd.setup_dbus(replace);
notifications = new Budgie.Notifications.Server();
menus = new Budgie.MenuManager();
menus.setup_dbus(replace);
switcher = new Budgie.TabSwitcher();
Expand Down
4 changes: 4 additions & 0 deletions src/daemon/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ daemon_resources = gnome.compile_resources(

daemon_sources = [
'endsession.vala',
'notifications/dbus.vala',
'notifications/popup.vala',
'main.vala',
'manager.vala',
'menus.vala',
Expand All @@ -31,6 +33,8 @@ daemon_deps = [
dep_gdkx11,
dep_notify,
dep_wnck,
link_libbudgieprivate,
libplugin_vapi,
link_libappsys,
link_libconfig,
link_libtheme,
Expand Down
Loading

0 comments on commit f4c29e7

Please sign in to comment.