gfdonotificationbackend: support themed icons

The spec allows setting the "image-path" hint to an icon name as well.

https://bugzilla.gnome.org/show_bug.cgi?id=745634
This commit is contained in:
ria.freelander@gmail.com 2015-03-05 13:07:00 +00:00 committed by Lars Uebernickel
parent b9c8cecc9d
commit ec1edef3ab

View File

@ -27,6 +27,7 @@
#include "gdbusconnection.h"
#include "gactiongroup.h"
#include "gaction.h"
#include "gthemedicon.h"
#include "gfileicon.h"
#include "gfile.h"
#include "gdbusutils.h"
@ -262,13 +263,23 @@ call_notify (GDBusConnection *con,
urgency = urgency_from_priority (g_notification_get_priority (notification));
g_variant_builder_add (&hints_builder, "{sv}", "urgency", g_variant_new_byte (urgency));
icon = g_notification_get_icon (notification);
if (icon != NULL && G_IS_FILE_ICON (icon))
if (icon != NULL)
{
GFile *file;
if (G_IS_FILE_ICON (icon))
{
GFile *file;
file = g_file_icon_get_file (G_FILE_ICON (icon));
g_variant_builder_add (&hints_builder, "{sv}", "image-path",
g_variant_new_take_string (g_file_get_path (file)));
file = g_file_icon_get_file (G_FILE_ICON (icon));
g_variant_builder_add (&hints_builder, "{sv}", "image-path",
g_variant_new_take_string (g_file_get_path (file)));
}
else if (G_IS_THEMED_ICON (icon))
{
const gchar* const* icon_names = g_themed_icon_get_names(G_THEMED_ICON (icon));
/* Take first name from GThemedIcon */
g_variant_builder_add (&hints_builder, "{sv}", "image-path",
g_variant_new_string (icon_names[0]));
}
}
body = g_notification_get_body (notification);