Well, in trunk we always have notification. You can remove those ifdef. I'm
not sure, but I guess we even have a way to output those to notify-OSD or
shortcut (no DBus) to the notification module.

On Thursday, January 17, 2013, Enlightenment SVN wrote:

> Log:
> e mixer and battery modules: reuse notifications.
>
>
> Author:       illogict
> Date:         2013-01-17 02:47:53 -0800 (Thu, 17 Jan 2013)
> New Revision: 82931
> Trac:         http://trac.enlightenment.org/e/changeset/82931
>
> Modified:
>   trunk/e/ChangeLog trunk/e/NEWS trunk/e/src/modules/battery/e_mod_main.c
> trunk/e/src/modules/mixer/e_mod_main.c
> trunk/e/src/modules/mixer/e_mod_main.h
>
> Modified: trunk/e/ChangeLog
> ===================================================================
> --- trunk/e/ChangeLog   2013-01-17 10:29:31 UTC (rev 82930)
> +++ trunk/e/ChangeLog   2013-01-17 10:47:53 UTC (rev 82931)
> @@ -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.
>
>
> Modified: trunk/e/NEWS
> ===================================================================
> --- trunk/e/NEWS        2013-01-17 10:29:31 UTC (rev 82930)
> +++ trunk/e/NEWS        2013-01-17 10:47:53 UTC (rev 82931)
> @@ -106,3 +106,4 @@
>      * 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.
>
> Modified: trunk/e/src/modules/battery/e_mod_main.c
> ===================================================================
> --- trunk/e/src/modules/battery/e_mod_main.c    2013-01-17 10:29:31 UTC
> (rev 82930)
> +++ trunk/e/src/modules/battery/e_mod_main.c    2013-01-17 10:47:53 UTC
> (rev 82931)
> @@ -33,6 +33,9 @@
>     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,7 +428,17 @@
>     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)
>  {
>     Evas *e = NULL;
> @@ -445,7 +458,7 @@
>          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
>
> Modified: trunk/e/src/modules/mixer/e_mod_main.c
> ===================================================================
> --- trunk/e/src/modules/mixer/e_mod_main.c      2013-01-17 10:29:31 UTC
> (rev 82930)
> +++ trunk/e/src/modules/mixer/e_mod_main.c      2013-01-17 10:47:53 UTC
> (rev 82931)
> @@ -35,9 +35,19 @@
>  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;
>     E_Mixer_Module_Context *ctxt;
> @@ -65,12 +75,12 @@
>       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 @@
>     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)))
>       {
>
> Modified: trunk/e/src/modules/mixer/e_mod_main.h
> ===================================================================
> --- trunk/e/src/modules/mixer/e_mod_main.h      2013-01-17 10:29:31 UTC
> (rev 82930)
> +++ trunk/e/src/modules/mixer/e_mod_main.h      2013-01-17 10:47:53 UTC
> (rev 82931)
> @@ -59,6 +59,10 @@
>     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
>
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net <javascript:;>
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>


-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to