Pack FDN specific names into macro
This commit is contained in:
parent
e51ac67715
commit
09c1ca7127
22
src/dbus.c
22
src/dbus.c
@ -12,14 +12,18 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#define FDN_PATH "/org/freedesktop/Notifications"
|
||||||
|
#define FDN_IFAC "org.freedesktop.Notifications"
|
||||||
|
#define FDN_NAME "org.freedesktop.Notifications"
|
||||||
|
|
||||||
GDBusConnection *dbus_conn;
|
GDBusConnection *dbus_conn;
|
||||||
|
|
||||||
static GDBusNodeInfo *introspection_data = NULL;
|
static GDBusNodeInfo *introspection_data = NULL;
|
||||||
|
|
||||||
static const char *introspection_xml =
|
static const char *introspection_xml =
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||||
"<node name=\"/org/freedesktop/Notifications\">"
|
"<node name=\""FDN_PATH"\">"
|
||||||
" <interface name=\"org.freedesktop.Notifications\">"
|
" <interface name=\""FDN_IFAC"\">"
|
||||||
|
|
||||||
" <method name=\"GetCapabilities\">"
|
" <method name=\"GetCapabilities\">"
|
||||||
" <arg direction=\"out\" name=\"capabilities\" type=\"as\"/>"
|
" <arg direction=\"out\" name=\"capabilities\" type=\"as\"/>"
|
||||||
@ -349,8 +353,8 @@ void signal_notification_closed(notification *n, enum reason reason)
|
|||||||
|
|
||||||
g_dbus_connection_emit_signal(dbus_conn,
|
g_dbus_connection_emit_signal(dbus_conn,
|
||||||
n->dbus_client,
|
n->dbus_client,
|
||||||
"/org/freedesktop/Notifications",
|
FDN_PATH,
|
||||||
"org.freedesktop.Notifications",
|
FDN_IFAC,
|
||||||
"NotificationClosed",
|
"NotificationClosed",
|
||||||
body,
|
body,
|
||||||
&err);
|
&err);
|
||||||
@ -369,8 +373,8 @@ void signal_action_invoked(notification *n, const char *identifier)
|
|||||||
|
|
||||||
g_dbus_connection_emit_signal(dbus_conn,
|
g_dbus_connection_emit_signal(dbus_conn,
|
||||||
n->dbus_client,
|
n->dbus_client,
|
||||||
"/org/freedesktop/Notifications",
|
FDN_PATH,
|
||||||
"org.freedesktop.Notifications",
|
FDN_IFAC,
|
||||||
"ActionInvoked",
|
"ActionInvoked",
|
||||||
body,
|
body,
|
||||||
&err);
|
&err);
|
||||||
@ -394,7 +398,7 @@ static void on_bus_acquired(GDBusConnection *connection,
|
|||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
|
|
||||||
registration_id = g_dbus_connection_register_object(connection,
|
registration_id = g_dbus_connection_register_object(connection,
|
||||||
"/org/freedesktop/Notifications",
|
FDN_PATH,
|
||||||
introspection_data->interfaces[0],
|
introspection_data->interfaces[0],
|
||||||
&interface_vtable,
|
&interface_vtable,
|
||||||
NULL,
|
NULL,
|
||||||
@ -419,7 +423,7 @@ static void on_name_lost(GDBusConnection *connection,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
if (connection)
|
if (connection)
|
||||||
fprintf(stderr, "Cannot acquire 'org.freedesktop.Notifications'."
|
fprintf(stderr, "Cannot acquire '"FDN_NAME"'."
|
||||||
"Is Another notification daemon running?\n");
|
"Is Another notification daemon running?\n");
|
||||||
else
|
else
|
||||||
fprintf(stderr, "Cannot connect to DBus.\n");
|
fprintf(stderr, "Cannot connect to DBus.\n");
|
||||||
@ -474,7 +478,7 @@ int initdbus(void)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
owner_id = g_bus_own_name(G_BUS_TYPE_SESSION,
|
owner_id = g_bus_own_name(G_BUS_TYPE_SESSION,
|
||||||
"org.freedesktop.Notifications",
|
FDN_NAME,
|
||||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||||
on_bus_acquired,
|
on_bus_acquired,
|
||||||
on_name_acquired,
|
on_name_acquired,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user