e mixer and battery modules: reuse notifications.
SVN revision: 82931
This commit is contained in:
parent
2494e166eb
commit
f0eb778f50
|
@ -1,3 +1,6 @@
|
|||
2013-01-17 Chidambar Zinnoury (ilLogict)
|
||||
* Mixer and battery modules: reuse notifications.
|
||||
|
||||
2013-01-16 Brian Miculcy
|
||||
* Shelf option 'overlapping' made clearer and disabled when window automatic movement on shelf hide isn't set.
|
||||
|
||||
|
|
1
NEWS
1
NEWS
|
@ -106,3 +106,4 @@ Fixes:
|
|||
* 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 bug where backlight settings would try to update dummy backlight devices
|
||||
* Reuse notifications for mixer and battery modules.
|
||||
|
|
|
@ -33,6 +33,9 @@ struct _Instance
|
|||
Evas_Object *o_battery;
|
||||
Evas_Object *popup_battery;
|
||||
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);
|
||||
|
@ -425,6 +428,16 @@ _battery_warning_popup_destroy(Instance *inst)
|
|||
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
|
||||
_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.body = _("AC power is recommended.");
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -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_register(E_Mixer_Module_Context *ctxt);
|
||||
|
||||
#ifdef HAVE_ENOTIFY
|
||||
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
|
||||
E_Notification_Notify n;
|
||||
|
@ -65,12 +75,12 @@ _mixer_notify(const float val, E_Mixer_Instance *inst __UNUSED__)
|
|||
icon = "audio-volume-high";
|
||||
|
||||
n.app_name = _("Mixer");
|
||||
n.replaces_id = 0;
|
||||
n.replaces_id = inst->notification_id;
|
||||
n.icon.icon = icon;
|
||||
n.sumary = _("Volume changed");
|
||||
n.body = buf;
|
||||
n.timeout = 2000;
|
||||
e_notification_client_send(&n, NULL, NULL);
|
||||
e_notification_client_send(&n, _mixer_notify_cb, inst);
|
||||
#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.left = inst->conf->state.left;
|
||||
inst->mixer_state.mute = inst->conf->state.mute;
|
||||
#ifdef HAVE_ENOTIFY
|
||||
inst->notification_id = 0;
|
||||
#endif
|
||||
conf->instance = inst;
|
||||
if ((!_mixer_sys_setup(inst)) && (!_mixer_sys_setup_defaults(inst)))
|
||||
{
|
||||
|
|
|
@ -59,6 +59,10 @@ typedef struct E_Mixer_Instance
|
|||
E_Mixer_Channel *channel;
|
||||
E_Mixer_Channel_State mixer_state;
|
||||
E_Mixer_Gadget_Config *conf;
|
||||
|
||||
#ifdef HAVE_ENOTIFY
|
||||
unsigned int notification_id;
|
||||
#endif
|
||||
} E_Mixer_Instance;
|
||||
|
||||
typedef struct E_Mixer_Module_Context
|
||||
|
|
Loading…
Reference in New Issue