forked from enlightenment/enlightenment
e: Use internal client notification API
Modules: - notification - battery - mixer Patch by: José Roberto de Souza <zehortigoza@profusion.mobi> SVN revision: 82122
This commit is contained in:
parent
23c7d0a98b
commit
d9955d5739
|
@ -1,8 +1,5 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
#ifdef HAVE_ENOTIFY
|
||||
#include "E_Notify.h"
|
||||
#endif
|
||||
|
||||
/* gadcon requirements */
|
||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
||||
|
@ -434,28 +431,21 @@ _battery_warning_popup(Instance *inst, int t, double percent)
|
|||
Evas *e = NULL;
|
||||
Evas_Object *rect = NULL, *popup_bg = NULL;
|
||||
int x, y, w, h;
|
||||
#ifdef HAVE_ENOTIFY
|
||||
static E_Notification *notification;
|
||||
#endif
|
||||
|
||||
if ((!inst) || (inst->warning)) return;
|
||||
|
||||
#ifdef HAVE_ENOTIFY
|
||||
if (battery_config && battery_config->desktop_notifications)
|
||||
{
|
||||
if (notification) return;
|
||||
notification = e_notification_full_new
|
||||
(
|
||||
_("Battery"),
|
||||
0,
|
||||
"battery-low",
|
||||
_("Your battery is low!"),
|
||||
_("AC power is recommended."),
|
||||
(battery_config->alert_timeout * 1000)
|
||||
);
|
||||
e_notification_send(notification, NULL, NULL);
|
||||
e_notification_unref(notification);
|
||||
notification = NULL;
|
||||
E_Notification_Notify n;
|
||||
memset(&n, 0, sizeof(E_Notification_Notify));
|
||||
n.app_name = _("Battery");
|
||||
n.replaces_id = 0;
|
||||
n.icon.icon = "battery-low";
|
||||
n.sumary = _("Your battery is low!");
|
||||
n.body = _("AC power is recommended.");
|
||||
n.timeout = battery_config->alert_timeout * 1000;
|
||||
e_notification_client_send(&n, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -740,10 +730,6 @@ e_modapi_init(E_Module *m)
|
|||
{
|
||||
char buf[4096];
|
||||
|
||||
#ifdef HAVE_ENOTIFY
|
||||
e_notification_init();
|
||||
#endif
|
||||
|
||||
conf_edd = E_CONFIG_DD_NEW("Battery_Config", Config);
|
||||
#undef T
|
||||
#undef D
|
||||
|
@ -855,10 +841,6 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
_battery_upower_stop();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ENOTIFY
|
||||
e_notification_shutdown();
|
||||
#endif
|
||||
|
||||
free(battery_config);
|
||||
battery_config = NULL;
|
||||
E_CONFIG_DD_FREE(conf_edd);
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
#include "e_mod_main.h"
|
||||
#ifdef HAVE_ENOTIFY
|
||||
#include <E_Notify.h>
|
||||
#endif
|
||||
|
||||
static void _mixer_popup_timer_new(E_Mixer_Instance *inst);
|
||||
static Eina_Bool _mixer_popup_timer_cb(void *data);
|
||||
|
@ -42,11 +39,12 @@ static void
|
|||
_mixer_notify(const float val, E_Mixer_Instance *inst __UNUSED__)
|
||||
{
|
||||
#ifdef HAVE_ENOTIFY
|
||||
E_Notification *n;
|
||||
E_Notification_Notify n;
|
||||
E_Mixer_Module_Context *ctxt;
|
||||
char *icon, buf[56];
|
||||
int ret;
|
||||
|
||||
memset(&n, 0, sizeof(E_Notification_Notify));
|
||||
if (val > 100.0 || val < 0.0)
|
||||
return;
|
||||
|
||||
|
@ -66,10 +64,13 @@ _mixer_notify(const float val, E_Mixer_Instance *inst __UNUSED__)
|
|||
else
|
||||
icon = "audio-volume-high";
|
||||
|
||||
n = e_notification_full_new(_("Mixer"), 0, icon, _("Volume changed"), buf, 2000);
|
||||
e_notification_replaces_id_set(n, EINA_TRUE);
|
||||
e_notification_send(n, NULL, NULL);
|
||||
e_notification_unref(n);
|
||||
n.app_name = _("Mixer");
|
||||
n.replaces_id = 0;
|
||||
n.icon.icon = icon;
|
||||
n.sumary = _("Volume changed");
|
||||
n.body = buf;
|
||||
n.timeout = 2000;
|
||||
e_notification_client_send(&n, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1526,10 +1527,6 @@ e_modapi_init(E_Module *m)
|
|||
if (!ctxt)
|
||||
return NULL;
|
||||
|
||||
#ifdef HAVE_ENOTIFY
|
||||
e_notification_init();
|
||||
#endif
|
||||
|
||||
_mixer_configure_registry_register();
|
||||
e_gadcon_provider_register(&_gc_class);
|
||||
if (!e_mixer_pulse_init()) e_mixer_default_setup();
|
||||
|
@ -1577,9 +1574,6 @@ e_modapi_shutdown(E_Module *m)
|
|||
_mixer_module_configuration_descriptor_free(ctxt->module_conf_edd);
|
||||
}
|
||||
|
||||
#ifdef HAVE_ENOTIFY
|
||||
e_notification_shutdown();
|
||||
#endif
|
||||
e_mixer_pulse_shutdown();
|
||||
|
||||
E_FREE(ctxt);
|
||||
|
|
|
@ -32,20 +32,19 @@ _notification_notify(E_Notification_Notify *n)
|
|||
return new_id;
|
||||
}
|
||||
|
||||
//TODO use this call
|
||||
static void
|
||||
_notification_show_common(const char *summary EINA_UNUSED,
|
||||
const char *body EINA_UNUSED,
|
||||
int replaces_id EINA_UNUSED)
|
||||
_notification_show_common(const char *summary,
|
||||
const char *body,
|
||||
int replaces_id)
|
||||
{
|
||||
/*E_Notification *n = e_notification_full_new
|
||||
("enlightenment", replaces_id, "enlightenment", summary, body, -1);
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
_notification_notify(n);
|
||||
e_notification_unref(n);*/
|
||||
E_Notification_Notify n;
|
||||
memset(&n, 0, sizeof(E_Notification_Notify));
|
||||
n.app_name = "enlightenment";
|
||||
n.replaces_id = replaces_id;
|
||||
n.icon.icon = "enlightenment";
|
||||
n.sumary = summary;
|
||||
n.body = body;
|
||||
e_notification_client_send(&n, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue