grim/guifications3

1f195d42369a
closing this since most of it will happen on default since libgds now exists ;)
/*
* Guifications - The end-all, be-all notification framework
* Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "guifications-daemon-web-handlers.h"
#include <stdio.h>
void
gfd_web_handler_debug(SoupServer *server, SoupMessage *msg, const gchar *path,
GHashTable *query, SoupClientContext *client,
gpointer data)
{
GPlateTemplate *tplate = NULL;
GPlateVariable *dict = NULL;
GError *error = NULL;
gchar *file = NULL, *page = NULL;
tplate = gplate_template_new();
dict = gplate_dictionary_variable_new("gflib");
gplate_collection_add_variable(GPLATE_COLLECTION(tplate), dict);
gplate_collection_add_string(dict, "version", gf_lib_get_version());
gplate_collection_add_string(dict, "lib_version", gf_lib_get_lib_version());
gplate_collection_add_string(dict, "website", gf_lib_get_website());
gplate_collection_add_string(dict, "configure_args", gf_lib_get_configure_args());
file = gfd_web_theme_get_template_path("debug.gplate");
page = gplate_template_render_file(tplate, file, &error);
g_free(file);
if(error)
printf("error: %s\n", error->message);
/* set the status */
soup_message_set_status(msg, SOUP_STATUS_OK);
soup_message_set_response(msg, "text/html", SOUP_MEMORY_TAKE,
page, g_utf8_strlen(page, -1));
}