From b1815fb63c429215f5b9a8fd62313faf17a7957a Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 8 May 2009 13:13:08 +0200 Subject: [PATCH] Implement /stock path in res_server --- midori/sokoke.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/midori/sokoke.c b/midori/sokoke.c index 49a99a44..8e9c84b2 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -1001,6 +1001,21 @@ res_server_handler_cb (SoupServer* res_server, soup_message_set_status (msg, 404); g_free (filename); } + else if (g_str_has_prefix (path, "/stock/")) + { + GtkIconTheme* icon_theme = gtk_icon_theme_get_default (); + const gchar* icon_name = &path[7]; + GdkPixbuf* icon = gtk_icon_theme_load_icon (icon_theme, icon_name, + strstr (icon_name, "dialog") ? 48 : 22, 0, NULL); + gchar* contents; + gsize length; + + gdk_pixbuf_save_to_buffer (icon, &contents, &length, "png", NULL, NULL); + g_object_unref (icon); + soup_message_set_response (msg, "image/png", SOUP_MEMORY_TAKE, + contents, length); + soup_message_set_status (msg, 200); + } else { soup_message_set_status (msg, 404); -- 2.39.5