grim/guifications3

removed some ENABLE_NLS wrappers

2011-05-17, Gary Kramlich
f31281edef1c
removed some ENABLE_NLS wrappers
/*
* 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_feeds(SoupServer *server, SoupMessage *msg, const gchar *path,
GHashTable *query, SoupClientContext *client,
gpointer data)
{
GfConnection *connection = GF_CONNECTION(data);
GfFeedManager *feed_manager = NULL;
GPlateTemplate *tplate = NULL;
GPlateVariable *dict = NULL;
GError *error = NULL;
gchar *file = NULL, *page = NULL;
tplate = gplate_template_new();
dict = gplate_dictionary_variable_new("feeds");
gplate_collection_add_variable(GPLATE_COLLECTION(tplate), dict);
/* grab the feed manager and add them to the dictionary */
feed_manager = gf_connection_get_feed_manager(connection);
if(GF_IS_FEED_MANAGER(feed_manager)) {
GfFeed **feeds = NULL;
gint i = 0;
feeds = gf_feed_manager_list_feeds(feed_manager, NULL);
for(i = 0; GF_IS_FEED(feeds[i]); i++) {
GPlateVariable *var = NULL;
const gchar *name = NULL;
name = gf_feed_get_name(feeds[i]);
var = gplate_object_variable_new_from_object(name,
G_OBJECT(feeds[i]));
gplate_collection_add_variable(GPLATE_COLLECTION(dict), var);
}
}
/* find our template */
file = gfd_web_theme_get_template_path("feeds.gplate");
page = gplate_template_render_file(tplate, file, &error);
g_free(file);
if(error)
printf("error: %s\n", error->message);
soup_message_set_status(msg, SOUP_STATUS_OK);
soup_message_set_response(msg, "text/html", SOUP_MEMORY_TAKE,
page, g_utf8_strlen(page, -1));
}