static void _online_notify_cb (gboolean online, gpointer userdata) { MexNotificationSource *source = MEX_NOTIFICATION_SOURCE (userdata); MexNetworkNotificationSourcePrivate *priv; MexNotification *n; priv = MEX_NETWORK_NOTIFICATION_SOURCE (source)->priv; if (online) { if (priv->offline_notification) { /* Remove old notification */ mex_notification_source_emit_notification_remove (source, priv->offline_notification); mex_notification_free (priv->offline_notification); priv->offline_notification = NULL; } n = mex_notification_source_new_notification (source, _("Network connection established"), "icon-notifications", 30); mex_notification_source_emit_notification_added (source, n); mex_notification_free (n); } else { if (!priv->offline_notification) { n = mex_notification_source_new_notification (source, _("Network connection lost"), "icon-notifications", -1); priv->offline_notification = n; mex_notification_source_emit_notification_added (source, n); } } }
static gboolean _notification_timeout_cb (gpointer userdata) { MexDummyNotificationSource *source = MEX_DUMMY_NOTIFICATION_SOURCE (userdata); MexNotification *notification; notification = mex_notification_source_new_notification (MEX_NOTIFICATION_SOURCE (source), _("Snow?"), "weather-snow", 8); mex_notification_source_emit_notification_added (MEX_NOTIFICATION_SOURCE (source), notification); mex_notification_free (notification); return TRUE; }
void mex_generic_notification_new_notification (MexGenericNotificationSource *sourcein, const gchar *message, gint timeout) { MexGenericNotificationSource *source = MEX_GENERIC_NOTIFICATION_SOURCE (sourcein); MexNotification *notification; notification = mex_notification_source_new_notification (MEX_NOTIFICATION_SOURCE (source), message, "icon-notifications", timeout); mex_notification_source_emit_notification_added (MEX_NOTIFICATION_SOURCE (source), notification); mex_notification_free (notification); }