e mixer and battery modules: reuse notifications.

SVN revision: 82931
This commit is contained in:
Chidambar Zinnoury 2013-01-17 10:47:53 +00:00
parent 2494e166eb
commit f0eb778f50
5 changed files with 38 additions and 4 deletions

View File

@ -1,3 +1,6 @@
2013-01-17 Chidambar Zinnoury (ilLogict)
* Mixer and battery modules: reuse notifications.
2013-01-16 Brian Miculcy 2013-01-16 Brian Miculcy
* Shelf option 'overlapping' made clearer and disabled when window automatic movement on shelf hide isn't set. * Shelf option 'overlapping' made clearer and disabled when window automatic movement on shelf hide isn't set.

1
NEWS
View File

@ -106,3 +106,4 @@ Fixes:
* fixed bug where starting with a nonexistent config could cause a crash instead of simply restarting * fixed bug where starting with a nonexistent config could cause a crash instead of simply restarting
* fixed window border hide bug where after iconification hides leave ghosts * fixed window border hide bug where after iconification hides leave ghosts
* fixed bug where backlight settings would try to update dummy backlight devices * fixed bug where backlight settings would try to update dummy backlight devices
* Reuse notifications for mixer and battery modules.

View File

@ -33,6 +33,9 @@ struct _Instance
Evas_Object *o_battery; Evas_Object *o_battery;
Evas_Object *popup_battery; Evas_Object *popup_battery;
E_Gadcon_Popup *warning; E_Gadcon_Popup *warning;
#ifdef HAVE_ENOTIFY
unsigned int notification_id;
#endif
}; };
static void _battery_update(int full, int time_left, int time_full, Eina_Bool have_battery, Eina_Bool have_power); static void _battery_update(int full, int time_left, int time_full, Eina_Bool have_battery, Eina_Bool have_power);
@ -425,6 +428,16 @@ _battery_warning_popup_destroy(Instance *inst)
inst->popup_battery = NULL; inst->popup_battery = NULL;
} }
#ifdef HAVE_ENOTIFY
static void
_battery_warning_popup_cb(void *data, unsigned int id)
{
Instance *inst = data;
inst->notification_id = id;
}
#endif
static void static void
_battery_warning_popup(Instance *inst, int t, double percent) _battery_warning_popup(Instance *inst, int t, double percent)
{ {
@ -445,7 +458,7 @@ _battery_warning_popup(Instance *inst, int t, double percent)
n.sumary = _("Your battery is low!"); n.sumary = _("Your battery is low!");
n.body = _("AC power is recommended."); n.body = _("AC power is recommended.");
n.timeout = battery_config->alert_timeout * 1000; n.timeout = battery_config->alert_timeout * 1000;
e_notification_client_send(&n, NULL, NULL); e_notification_client_send(&n, _battery_warning_popup_cb, inst);
return; return;
} }
#endif #endif

View File

@ -35,8 +35,18 @@ E_Mixer_Cb e_mod_mixer_card_default_get;
static void _mixer_actions_unregister(E_Mixer_Module_Context *ctxt); static void _mixer_actions_unregister(E_Mixer_Module_Context *ctxt);
static void _mixer_actions_register(E_Mixer_Module_Context *ctxt); static void _mixer_actions_register(E_Mixer_Module_Context *ctxt);
#ifdef HAVE_ENOTIFY
static void static void
_mixer_notify(const float val, E_Mixer_Instance *inst __UNUSED__) _mixer_notify_cb(void *data, unsigned int id)
{
E_Mixer_Instance *inst = data;
inst->notification_id = id;
}
#endif
static void
_mixer_notify(const float val, E_Mixer_Instance *inst)
{ {
#ifdef HAVE_ENOTIFY #ifdef HAVE_ENOTIFY
E_Notification_Notify n; E_Notification_Notify n;
@ -65,12 +75,12 @@ _mixer_notify(const float val, E_Mixer_Instance *inst __UNUSED__)
icon = "audio-volume-high"; icon = "audio-volume-high";
n.app_name = _("Mixer"); n.app_name = _("Mixer");
n.replaces_id = 0; n.replaces_id = inst->notification_id;
n.icon.icon = icon; n.icon.icon = icon;
n.sumary = _("Volume changed"); n.sumary = _("Volume changed");
n.body = buf; n.body = buf;
n.timeout = 2000; n.timeout = 2000;
e_notification_client_send(&n, NULL, NULL); e_notification_client_send(&n, _mixer_notify_cb, inst);
#endif #endif
} }
@ -1050,6 +1060,9 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
inst->mixer_state.right = inst->conf->state.right; inst->mixer_state.right = inst->conf->state.right;
inst->mixer_state.left = inst->conf->state.left; inst->mixer_state.left = inst->conf->state.left;
inst->mixer_state.mute = inst->conf->state.mute; inst->mixer_state.mute = inst->conf->state.mute;
#ifdef HAVE_ENOTIFY
inst->notification_id = 0;
#endif
conf->instance = inst; conf->instance = inst;
if ((!_mixer_sys_setup(inst)) && (!_mixer_sys_setup_defaults(inst))) if ((!_mixer_sys_setup(inst)) && (!_mixer_sys_setup_defaults(inst)))
{ {

View File

@ -59,6 +59,10 @@ typedef struct E_Mixer_Instance
E_Mixer_Channel *channel; E_Mixer_Channel *channel;
E_Mixer_Channel_State mixer_state; E_Mixer_Channel_State mixer_state;
E_Mixer_Gadget_Config *conf; E_Mixer_Gadget_Config *conf;
#ifdef HAVE_ENOTIFY
unsigned int notification_id;
#endif
} E_Mixer_Instance; } E_Mixer_Instance;
typedef struct E_Mixer_Module_Context typedef struct E_Mixer_Module_Context