summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2015-04-16 18:39:30 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2015-04-16 18:39:30 +0300
commit3ca831bd33bfc86148a9a288775bee56d9cd607f (patch)
tree3f9932eb829159364ec8036d4d4b0f2aaf7cb886
parent331fadd87a9c3217a04282d4819670d6e1b4f8a5 (diff)
Attempt #2 of E17 notifications supportdevs/kuuko/compat
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac23
-rw-r--r--src/module/e_mod_main.c39
3 files changed, 52 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am
index 3222ad4..1eaa9a8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -72,6 +72,10 @@ src_module_module_la_LIBADD = \
72 72
73src_module_module_la_LDFLAGS = -module -avoid-version 73src_module_module_la_LDFLAGS = -module -avoid-version
74 74
75if HAVE_ENOTIFY
76src_module_module_la_LIBADD += @ENOTIFY_LIBS@
77endif
78
75SUBDIRS = po 79SUBDIRS = po
76 80
77include Makefile_Theme.am 81include Makefile_Theme.am
diff --git a/configure.ac b/configure.ac
index c0d5e43..8ca477b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,29 @@ PKG_CHECK_MODULES([EFL],
40 ecore-file 40 ecore-file
41 ]) 41 ])
42 42
43have_enotify=no
44AM_CONDITIONAL([HAVE_ENOTIFY], [false])
45AC_ARG_ENABLE([enotify],
46 AC_HELP_STRING([--disable-enotify], [disable Enotify support @<:@default=detect@:>@]),
47 [e_cv_want_enotify=$enableval],
48 AC_CACHE_VAL([e_cv_want_enotify], [e_cv_want_enotify=yes])
49)
50if test "x$e_cv_want_enotify" != "xno" ; then
51 PKG_CHECK_MODULES(ENOTIFY, [ edbus ],
52 [
53 AC_DEFINE_UNQUOTED([HAVE_ENOTIFY], [1], [enable enotify])
54 ],
55 [
56 AC_MSG_NOTICE([enotify disabled])
57 e_cv_want_enotify=no
58 ])
59else
60 AC_MSG_NOTICE([enotify disabled])
61 e_cv_want_enotify=no
62fi
63AC_SUBST([ENOTIFY_CFLAGS])
64AC_SUBST([ENOTIFY_LIBS])
65
43PKG_CHECK_MODULES(E, 66PKG_CHECK_MODULES(E,
44 [enlightenment >= 0.18 enlightenment < 0.19], 67 [enlightenment >= 0.18 enlightenment < 0.19],
45 [AC_DEFINE([E_VERSION_MAJOR], [18], [Have exactly E18])], 68 [AC_DEFINE([E_VERSION_MAJOR], [18], [Have exactly E18])],
diff --git a/src/module/e_mod_main.c b/src/module/e_mod_main.c
index 57f7230..c367a5f 100644
--- a/src/module/e_mod_main.c
+++ b/src/module/e_mod_main.c
@@ -99,23 +99,12 @@ _notify_cb(void *data EINA_UNUSED, unsigned int id)
99static void 99static void
100_notify(const int val) 100_notify(const int val)
101{ 101{
102#if (E_VERSION_MAJOR < 18 && defined HAVE_ENOTIFY) || E_VERSION_MAJOR >= 18
103#if E_VERSION_MAJOR > 18
104 E_Notification_Notify n;
105#else
106 E_Notification n;
107#endif
108 char *icon, buf[56];
109 int ret;
110
111#if E_VERSION_MAJOR > 18
112 memset(&n, 0, sizeof(E_Notification_Notify));
113#else
114 memset(&n, 0, sizeof(E_Notification));
115#endif
116 if (val > 100 || val < 0) 102 if (val > 100 || val < 0)
117 return; 103 return;
118 104
105 char *icon, buf[56];
106 int ret;
107
119 ret = snprintf(buf, (sizeof(buf) - 1), "%s: %d%%", _("New volume"), val); 108 ret = snprintf(buf, (sizeof(buf) - 1), "%s: %d%%", _("New volume"), val);
120 if ((ret < 0) || ((unsigned int)ret > sizeof(buf))) 109 if ((ret < 0) || ((unsigned int)ret > sizeof(buf)))
121 return; 110 return;
@@ -129,6 +118,28 @@ _notify(const int val)
129 else 118 else
130 icon = "audio-volume-high"; 119 icon = "audio-volume-high";
131 120
121#if E_VERSION_MAJOR < 18
122#ifdef HAVE_ENOTIFY
123 E_Notification *n;
124
125 n = e_notification_full_new
126 (
127 _("EPulse"),
128 0,
129 icon,
130 _("Volume changed"),
131 buf,
132 2000
133 );
134 e_notification_send(n, NULL, NULL);
135 e_notification_unref(n);
136 n = NULL;
137#endif
138#else
139 E_Notification_Notify n;
140
141 memset(&n, 0, sizeof(E_Notification_Notify));
142
132 n.app_name = _("EPulse"); 143 n.app_name = _("EPulse");
133 n.replaces_id = mixer_context->notification_id; 144 n.replaces_id = mixer_context->notification_id;
134 n.icon.icon = icon; 145 n.icon.icon = icon;