summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-11-17 10:07:18 +0100
committerraveit65 <[email protected]>2020-11-26 11:50:18 +0100
commit921920e1dc19da3f7a6c50e7f6add9f4b42aa6ab (patch)
tree06400a1c76c6d24426f936f72edc92c8e043c0c8
parentc1dd04d294e329da95c515d7f5a9ac7a00d269cc (diff)
downloadmate-notification-daemon-921920e1dc19da3f7a6c50e7f6add9f4b42aa6ab.tar.bz2
mate-notification-daemon-921920e1dc19da3f7a6c50e7f6add9f4b42aa6ab.tar.xz
Group common constants in a single file
-rw-r--r--src/capplet/Makefile.am4
-rw-r--r--src/capplet/mate-notification-applet.c3
-rw-r--r--src/capplet/mate-notification-properties.c8
-rw-r--r--src/common/constants.h33
-rw-r--r--src/daemon/Makefile.am2
-rw-r--r--src/daemon/daemon.c4
-rw-r--r--src/daemon/daemon.h8
7 files changed, 43 insertions, 19 deletions
diff --git a/src/capplet/Makefile.am b/src/capplet/Makefile.am
index 2e27e00..bf2ad40 100644
--- a/src/capplet/Makefile.am
+++ b/src/capplet/Makefile.am
@@ -9,6 +9,7 @@ NULL =
mate_notification_properties_CFLAGS = \
-I$(top_srcdir) \
+ -I$(top_srcdir)/src/common \
-I$(top_srcdir)/src/daemon \
$(NOTIFICATION_CAPPLET_CFLAGS) \
-DENGINES_DIR=\"$(libdir)/mate-notification-daemon/engines\" \
@@ -28,12 +29,14 @@ $(mate_notification_properties_resources_files): $(mate_notification_properties_
--target $@ --sourcedir $(srcdir) --generate --c-name notification_properties
mate_notification_properties_SOURCES = \
$(mate_notification_properties_resources_files) \
+ ../common/constants.h \
mate-notification-properties.c \
$(NULL)
man_MANS = mate-notification-properties.1
mate_notification_applet_CFLAGS = \
+ -I$(top_srcdir)/src/common \
$(NOTIFICATION_APPLET_CFLAGS) \
-DMATELOCALEDIR=\"$(datadir)/locale\" \
-DRESOURCE_PATH=\""/org/mate/panel/applet/notifications/"\" \
@@ -52,6 +55,7 @@ $(mate_notification_applet_resources_files): $(mate_notification_applet_resource
--target $@ --sourcedir $(srcdir) --generate --c-name notification_applet
mate_notification_applet_SOURCES = \
$(mate_notification_applet_resources_files) \
+ ../common/constants.h \
mate-notification-applet.c \
$(NULL)
diff --git a/src/capplet/mate-notification-applet.c b/src/capplet/mate-notification-applet.c
index e8ef83f..1aeb120 100644
--- a/src/capplet/mate-notification-applet.c
+++ b/src/capplet/mate-notification-applet.c
@@ -28,8 +28,7 @@
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmate-desktop/mate-desktop-utils.h>
-#define GSETTINGS_SCHEMA "org.mate.NotificationDaemon"
-#define GSETTINGS_KEY_DO_NOT_DISTURB "do-not-disturb"
+#include "constants.h"
typedef struct
{
diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c
index e058359..154029d 100644
--- a/src/capplet/mate-notification-properties.c
+++ b/src/capplet/mate-notification-properties.c
@@ -31,13 +31,7 @@
#include <libnotify/notify.h>
#include "stack.h"
-
-#define GSETTINGS_SCHEMA "org.mate.NotificationDaemon"
-#define GSETTINGS_KEY_THEME "theme"
-#define GSETTINGS_KEY_POPUP_LOCATION "popup-location"
-#define GSETTINGS_KEY_MONITOR_NUMBER "monitor-number"
-#define GSETTINGS_KEY_USE_ACTIVE_MONITOR "use-active-monitor"
-#define GSETTINGS_KEY_DO_NOT_DISTURB "do-not-disturb"
+#include "constants.h"
typedef struct {
GSettings* gsettings;
diff --git a/src/common/constants.h b/src/common/constants.h
new file mode 100644
index 0000000..af824f7
--- /dev/null
+++ b/src/common/constants.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2020 Robert Buj <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef _CONSTANTS_H_
+#define _CONSTANTS_H_
+
+#define GSETTINGS_SCHEMA "org.mate.NotificationDaemon"
+#define GSETTINGS_KEY_THEME "theme"
+#define GSETTINGS_KEY_DO_NOT_DISTURB "do-not-disturb"
+#define GSETTINGS_KEY_MONITOR_NUMBER "monitor-number"
+#define GSETTINGS_KEY_POPUP_LOCATION "popup-location"
+#define GSETTINGS_KEY_SOUND_ENABLED "sound-enabled"
+#define GSETTINGS_KEY_USE_ACTIVE_MONITOR "use-active-monitor"
+#define NOTIFICATION_BUS_NAME "org.freedesktop.Notifications"
+#define NOTIFICATION_BUS_PATH "/org/freedesktop/Notifications"
+
+#endif /* _CONSTANTS_H_ */
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index 7dc0639..be3c407 100644
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
@@ -2,6 +2,7 @@ libexec_PROGRAMS = mate-notification-daemon
mate_notification_daemon_SOURCES = \
$(mate_notification_daemon_built_sources) \
+ ../common/constants.h \
daemon.c \
daemon.h \
engines.c \
@@ -36,6 +37,7 @@ $(mate_notification_daemon_built_sources) : Makefile.am $(srcdir)/notificationda
AM_CPPFLAGS = \
-I$(top_srcdir) \
+ -I$(top_srcdir)/src/common \
$(NOTIFICATION_DAEMON_CFLAGS) \
-DENGINES_DIR=\"$(libdir)/mate-notification-daemon/engines\"
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index b8254c6..c36e31e 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -54,8 +54,6 @@
#define MAX_NOTIFICATIONS 20
#define IMAGE_SIZE 48
#define IDLE_SECONDS 30
-#define NOTIFICATION_BUS_NAME "org.freedesktop.Notifications"
-#define NOTIFICATION_BUS_PATH "/org/freedesktop/Notifications"
#define NW_GET_NOTIFY_ID(nw) \
(GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(nw), "_notify_id")))
@@ -1534,7 +1532,7 @@ static gboolean notify_daemon_notify_handler(NotifyDaemonNotifications *object,
/* If the "use-active-monitor" gsettings key is set to TRUE, then
* get the monitor the pointer is at. Otherwise, get the monitor
* number the user has set in gsettings. */
- if (g_settings_get_boolean(daemon->gsettings, GSETTINGS_KEY_USE_ACTIVE))
+ if (g_settings_get_boolean(daemon->gsettings, GSETTINGS_KEY_USE_ACTIVE_MONITOR))
{
display = gdk_display_get_default ();
seat = gdk_display_get_default_seat (display);
diff --git a/src/daemon/daemon.h b/src/daemon/daemon.h
index 98f7f4d..06d56e4 100644
--- a/src/daemon/daemon.h
+++ b/src/daemon/daemon.h
@@ -28,13 +28,7 @@
#include <glib-object.h>
#include <gio/gio.h>
-#define GSETTINGS_SCHEMA "org.mate.NotificationDaemon"
-#define GSETTINGS_KEY_THEME "theme"
-#define GSETTINGS_KEY_POPUP_LOCATION "popup-location"
-#define GSETTINGS_KEY_SOUND_ENABLED "sound-enabled"
-#define GSETTINGS_KEY_DO_NOT_DISTURB "do-not-disturb"
-#define GSETTINGS_KEY_MONITOR_NUMBER "monitor-number"
-#define GSETTINGS_KEY_USE_ACTIVE "use-active-monitor"
+#include "constants.h"
#define NOTIFY_TYPE_DAEMON (notify_daemon_get_type())
G_DECLARE_FINAL_TYPE (NotifyDaemon, notify_daemon, NOTIFY, DAEMON, GObject)