void setNotificationHints() {
     if (notification) {
         notify_notification_clear_hints(NOTIFY_NOTIFICATION(notification));
         
         if (!hints.isEmpty()) {
             QMapIterator<QString, QVariant> iterator(hints);
         
             while (iterator.hasNext()) {
                 iterator.next();
                 
                 switch (iterator.value().type()) {
                 case QVariant::Int:
                 case QVariant::Double:
                     notify_notification_set_hint_int32(NOTIFY_NOTIFICATION(notification), QGSTRING(iterator.key()),
                                                        iterator.value().toInt());
                     break;
                 default:
                     notify_notification_set_hint_string(NOTIFY_NOTIFICATION(notification), QGSTRING(iterator.key()),
                                                         QGSTRING(iterator.value().toString()));
                     break;
                 }
             }
         }
     }
 }
static void
do_notify (RBNotificationPlugin *plugin,
	   guint timeout,
	   const char *primary,
	   const char *secondary,
	   const char *image_uri,
	   gboolean playback)
{
	GError *error = NULL;
	NotifyNotification *notification;

	if (notify_is_initted () == FALSE) {
		GList *caps;

		if (notify_init ("Rhythmbox") == FALSE) {
			g_warning ("libnotify initialization failed");
			return;
		}

		/* ask the notification server if it supports actions */
		caps = notify_get_server_caps ();
		if (g_list_find_custom (caps, "actions", (GCompareFunc)g_strcmp0) != NULL) {
			rb_debug ("notification server supports actions");
			plugin->notify_supports_actions = TRUE;

			if (g_list_find_custom (caps, "action-icons", (GCompareFunc)g_strcmp0) != NULL) {
				rb_debug ("notifiction server supports icon buttons");
				plugin->notify_supports_icon_buttons = TRUE;
			}
		} else {
			rb_debug ("notification server does not support actions");
		}
		if (g_list_find_custom (caps, "persistence", (GCompareFunc)g_strcmp0) != NULL) {
			rb_debug ("notification server supports persistence");
			plugin->notify_supports_persistence = TRUE;
		} else {
			rb_debug ("notification server does not support persistence");
		}

		rb_list_deep_free (caps);
	}

	if (primary == NULL)
		primary = "";

	if (secondary == NULL)
		secondary = "";

	if (playback) {
		notification = plugin->notification;
	} else {
		notification = plugin->misc_notification;
	}

	if (notification == NULL) {
		notification = notify_notification_new (primary, secondary, RB_APP_ICON);

		g_signal_connect_object (notification,
					 "closed",
					 G_CALLBACK (notification_closed_cb),
					 plugin, 0);
		if (playback) {
			plugin->notification = notification;
		} else {
			plugin->misc_notification = notification;
		}
	} else {
		notify_notification_clear_hints (notification);
		notify_notification_update (notification, primary, secondary, RB_APP_ICON);
	}

	notify_notification_set_timeout (notification, timeout);

	if (image_uri != NULL) {
		notify_notification_clear_hints (notification);
		notify_notification_set_hint (notification,
					      "image_path",
					      g_variant_new_string (image_uri));
	}

        if (playback)
        	notify_notification_set_category (notification, "x-gnome.music");
        notify_notification_set_hint (notification, "desktop-entry",
                                      g_variant_new_string ("rhythmbox"));

	notify_notification_clear_actions (notification);
	if (playback && plugin->notify_supports_actions) {
		gboolean rtl;
		const char *play_icon;

		rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL);
		play_icon = rtl ? "media-playback-start-rtl" : "media-playback-start";

		if (plugin->notify_supports_icon_buttons) {
			gboolean playing = FALSE;
			rb_shell_player_get_playing (plugin->shell_player, &playing, NULL);

			notify_notification_add_action (notification,
							rtl ? "media-skip-backward-rtl" : "media-skip-backward",
							_("Previous"),
							(NotifyActionCallback) notification_previous_cb,
							plugin,
							NULL);
			notify_notification_add_action (notification,
							playing ? "media-playback-pause" : play_icon,
							playing ? _("Pause") : _("Play"),
							(NotifyActionCallback) notification_playpause_cb,
							plugin,
							NULL);
			notify_notification_set_hint (notification, "action-icons", g_variant_new_boolean (TRUE));
		}

		notify_notification_add_action (notification,
						rtl ? "media-skip-forward-rtl" : "media-skip-forward",
						_("Next"),
						(NotifyActionCallback) notification_next_cb,
						plugin,
						NULL);
	}

	if (plugin->notify_supports_persistence) {
		const char *hint;

		if (playback) {
			hint = "resident";
		} else {
			hint = "transient";
		}
		notify_notification_set_hint (notification, hint, g_variant_new_boolean (TRUE));
	}

	if (notify_notification_show (notification, &error) == FALSE) {
		g_warning ("Failed to send notification (%s): %s", primary, error->message);
		g_error_free (error);
	}
}