diff --git a/sflphone-gtk/src/SFLnotify.c b/sflphone-gtk/src/SFLnotify.c index 8c68cdfc2..5a4308cd6 100644 --- a/sflphone-gtk/src/SFLnotify.c +++ b/sflphone-gtk/src/SFLnotify.c @@ -78,7 +78,36 @@ refuse_call_cb( NotifyNotification *notification, gchar *action, gpointer data ) void ignore_call_cb( NotifyNotification *notification, gchar *action, gpointer data ) { - call_t* c = (call_t*)g_object_get_data( G_OBJECT( notification ) , "call" ); g_object_unref( notification ); } +void +notify_voice_mails( guint count , account_t* acc ) +{ + // the account is different from NULL + GdkPixbuf *pixbuf; + gchar* title; + gchar* body; + notify_init("sflphone"); + + title = g_markup_printf_escaped(_("%s account: %s") , + g_hash_table_lookup(acc->properties , ACCOUNT_TYPE) , + g_hash_table_lookup(acc->properties , ACCOUNT_ALIAS) ) ; + body = g_markup_printf_escaped(_("%d voice mails"), count); + + pixbuf = gdk_pixbuf_new_from_file(ICON_DIR "/sflphone.png", NULL); + + notification = notify_notification_new( title, + body, + NULL, + NULL); + notify_notification_set_urgency( notification , NOTIFY_URGENCY_NORMAL ); + notify_notification_set_icon_from_pixbuf (notification, pixbuf); + notify_notification_attach_to_status_icon( notification , get_status_icon() ); + notify_notification_set_timeout( notification , NOTIFY_EXPIRES_DEFAULT ); + notify_notification_add_action( notification , "ignore" , _("Ignore") , (NotifyActionCallback) ignore_call_cb , NULL , NULL ); + + if (!notify_notification_show (notification, NULL)) { + g_print("notify(), failed to send notification\n"); + } +} diff --git a/sflphone-gtk/src/SFLnotify.h b/sflphone-gtk/src/SFLnotify.h index 40471de50..276a62079 100644 --- a/sflphone-gtk/src/SFLnotify.h +++ b/sflphone-gtk/src/SFLnotify.h @@ -41,6 +41,8 @@ */ void notify_incoming_call( call_t* c); +void notify_voice_mails( guint count , account_t* acc ); + /* * Callback when answer button is pressed. * Action: Pick up the incoming call