Blame gdata/services/picasaweb/gdata-picasaweb-feed.c

Packit 4b6dd7
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
Packit 4b6dd7
/*
Packit 4b6dd7
 * GData Client
Packit 4b6dd7
 * Copyright (C) Philip Withnall 2009 <philip@tecnocode.co.uk>
Packit 4b6dd7
 * Copyright (C) Richard Schwarting 2009–2010 <aquarichy@gmail.com>
Packit 4b6dd7
 *
Packit 4b6dd7
 * GData Client is free software; you can redistribute it and/or
Packit 4b6dd7
 * modify it under the terms of the GNU Lesser General Public
Packit 4b6dd7
 * License as published by the Free Software Foundation; either
Packit 4b6dd7
 * version 2.1 of the License, or (at your option) any later version.
Packit 4b6dd7
 *
Packit 4b6dd7
 * GData Client is distributed in the hope that it will be useful,
Packit 4b6dd7
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4b6dd7
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 4b6dd7
 * Lesser General Public License for more details.
Packit 4b6dd7
 *
Packit 4b6dd7
 * You should have received a copy of the GNU Lesser General Public
Packit 4b6dd7
 * License along with GData Client.  If not, see <http://www.gnu.org/licenses/>.
Packit 4b6dd7
 */
Packit 4b6dd7
Packit 4b6dd7
/**
Packit 4b6dd7
 * SECTION:gdata-picasaweb-feed
Packit 4b6dd7
 * @short_description: GData PicasaWeb Feed object
Packit 4b6dd7
 * @stability: Stable
Packit 4b6dd7
 * @include: gdata/services/picasaweb/gdata-picasaweb-feed.h
Packit 4b6dd7
 *
Packit 4b6dd7
 * #GDataPicasaWebFeed is a subclass of #GDataFeed to represent properties for a PicasaWeb feed. It adds a couple of
Packit 4b6dd7
 * properties which are specific to the Google PicasaWeb API.
Packit 4b6dd7
 *
Packit 4b6dd7
 * Since: 0.6.0
Packit 4b6dd7
 */
Packit 4b6dd7
Packit 4b6dd7
#include <glib.h>
Packit 4b6dd7
#include <libxml/parser.h>
Packit 4b6dd7
Packit 4b6dd7
#include "gdata-picasaweb-feed.h"
Packit 4b6dd7
#include "gdata-feed.h"
Packit 4b6dd7
#include "gdata-private.h"
Packit 4b6dd7
Packit 4b6dd7
static gboolean parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error);
Packit 4b6dd7
Packit 4b6dd7
G_DEFINE_TYPE (GDataPicasaWebFeed, gdata_picasaweb_feed, GDATA_TYPE_FEED)
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_picasaweb_feed_class_init (GDataPicasaWebFeedClass *klass)
Packit 4b6dd7
{
Packit 4b6dd7
	GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass);
Packit 4b6dd7
	parsable_class->parse_xml = parse_xml;
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static void
Packit 4b6dd7
gdata_picasaweb_feed_init (GDataPicasaWebFeed *self)
Packit 4b6dd7
{
Packit 4b6dd7
	/* Nothing to see here */
Packit 4b6dd7
}
Packit 4b6dd7
Packit 4b6dd7
static gboolean
Packit 4b6dd7
parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_data, GError **error)
Packit 4b6dd7
{
Packit 4b6dd7
	if (gdata_parser_is_namespace (node, "http://schemas.google.com/photos/2007") == TRUE) {
Packit 4b6dd7
		if (xmlStrcmp (node->name, (xmlChar*) "user") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "nickname") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "quotacurrent") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "quotalimit") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "maxPhotosPerAlbum") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "thumbnail") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "allowDownloads") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "allowPrints") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "id") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "rights") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "location") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "access") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "timestamp") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "numphotos") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "numphotosremaining") == 0 ||
Packit 4b6dd7
		    xmlStrcmp (node->name, (xmlChar*) "bytesUsed") == 0) {
Packit 4b6dd7
			/* From user's feed of album entries. Redundant with user entry represented by #GDataPicasaWebUser.
Packit 4b6dd7
			 * Capturing and ignoring. See bgo #589858. */
Packit 4b6dd7
		} else {
Packit 4b6dd7
			return GDATA_PARSABLE_CLASS (gdata_picasaweb_feed_parent_class)->parse_xml (parsable, doc, node, user_data, error);
Packit 4b6dd7
		}
Packit 4b6dd7
	} else if (gdata_parser_is_namespace (node, "http://www.georss.org/georss") == TRUE && xmlStrcmp (node->name, (xmlChar*) "where") == 0) {
Packit 4b6dd7
		/* From user's feed of album entries. Redundant with user entry represented by #GDataPicasaWebUser.
Packit 4b6dd7
		 * Capturing and ignoring. See bgo #589858. */
Packit 4b6dd7
	} else {
Packit 4b6dd7
		return GDATA_PARSABLE_CLASS (gdata_picasaweb_feed_parent_class)->parse_xml (parsable, doc, node, user_data, error);
Packit 4b6dd7
	}
Packit 4b6dd7
Packit 4b6dd7
	return TRUE;
Packit 4b6dd7
}
Packit 4b6dd7