#include "empathy-chatroom-manager.h"
#include <sys/stat.h>
+#include <tp-account-widgets/tpaw-utils.h>
#include "empathy-client-factory.h"
#include "empathy-utils.h"
return FALSE;
}
- if (!empathy_xml_validate_from_resource (doc, CHATROOMS_DTD_RESOURCENAME))
+ if (!tpaw_xml_validate_from_resource (doc, CHATROOMS_DTD_RESOURCENAME))
{
g_warning ("Failed to validate file:'%s'", filename);
xmlFreeDoc (doc);
#include "empathy-contact-groups.h"
#include <sys/stat.h>
+#include <tp-account-widgets/tpaw-utils.h>
#include "empathy-utils.h"
return;
}
- if (!empathy_xml_validate_from_resource (doc, CONTACT_GROUPS_DTD_RESOURCENAME)) {
+ if (!tpaw_xml_validate_from_resource (doc, CONTACT_GROUPS_DTD_RESOURCENAME)) {
g_warning ("Failed to validate file:'%s'", filename);
xmlFreeDoc (doc);
xmlFreeParserCtxt (ctxt);
#include "empathy-status-presets.h"
#include <sys/stat.h>
+#include <tp-account-widgets/tpaw-utils.h>
#include "empathy-utils.h"
return;
}
- if (!empathy_xml_validate_from_resource (doc, STATUS_PRESETS_DTD_RESOURCENAME)) {
+ if (!tpaw_xml_validate_from_resource (doc, STATUS_PRESETS_DTD_RESOURCENAME)) {
g_warning ("Failed to validate file:'%s'", filename);
xmlFreeDoc (doc);
xmlFreeParserCtxt (ctxt);
g_object_unref (am);
}
-gboolean
-empathy_xml_validate_from_resource (xmlDoc *doc,
- const gchar *dtd_resourcename)
-{
- GBytes *resourcecontents;
- gconstpointer resourcedata;
- gsize resourcesize;
- xmlParserInputBufferPtr buffer;
- xmlValidCtxt cvp;
- xmlDtd *dtd;
- GError *error = NULL;
- gboolean ret;
-
- DEBUG ("Loading dtd resource %s", dtd_resourcename);
-
- resourcecontents = g_resources_lookup_data (dtd_resourcename, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
- if (error != NULL)
- {
- g_warning ("Unable to load dtd resource '%s': %s", dtd_resourcename, error->message);
- g_error_free (error);
- return FALSE;
- }
- resourcedata = g_bytes_get_data (resourcecontents, &resourcesize);
- buffer = xmlParserInputBufferCreateStatic (resourcedata, resourcesize, XML_CHAR_ENCODING_UTF8);
-
- memset (&cvp, 0, sizeof (cvp));
- dtd = xmlIOParseDTD (NULL, buffer, XML_CHAR_ENCODING_UTF8);
- ret = xmlValidateDtd (&cvp, doc, dtd);
-
- xmlFreeDtd (dtd);
- g_bytes_unref (resourcecontents);
-
- return ret;
-}
-
xmlNodePtr
empathy_xml_node_get_child (xmlNodePtr node,
const gchar *child_name)
void empathy_init (void);
/* XML */
-gboolean empathy_xml_validate_from_resource (xmlDoc *doc,
- const gchar *dtd_resourcename);
xmlNodePtr empathy_xml_node_get_child (xmlNodePtr node,
const gchar *child_name);
xmlChar * empathy_xml_node_get_child_content (xmlNodePtr node,
#include <sys/stat.h>
#include "empathy-utils.h"
+#include "tpaw-utils.h"
#define DEBUG_FLAG EMPATHY_DEBUG_IRC
#include "empathy-debug.h"
return FALSE;
}
- if (!empathy_xml_validate_from_resource (doc, IRC_NETWORKS_DTD_RESOURCENAME)) {
+ if (!tpaw_xml_validate_from_resource (doc, IRC_NETWORKS_DTD_RESOURCENAME)) {
g_warning ("Failed to validate file:'%s'", filename);
xmlFreeDoc (doc);
xmlFreeParserCtxt (ctxt);
* Richard Hult <richard@imendio.com>
* Martyn Russell <martyn@imendio.com>
* Steve Frécinaux <code@istique.net>
+ * Emanuele Aina <emanuele.aina@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
color->blue = (color->blue + white.blue) / 2;
}
+gboolean
+tpaw_xml_validate_from_resource (xmlDoc *doc,
+ const gchar *dtd_resourcename)
+{
+ GBytes *resourcecontents;
+ gconstpointer resourcedata;
+ gsize resourcesize;
+ xmlParserInputBufferPtr buffer;
+ xmlValidCtxt cvp;
+ xmlDtd *dtd;
+ GError *error = NULL;
+ gboolean ret;
+
+ DEBUG ("Loading dtd resource %s", dtd_resourcename);
+
+ resourcecontents = g_resources_lookup_data (dtd_resourcename, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
+ if (error != NULL)
+ {
+ g_warning ("Unable to load dtd resource '%s': %s", dtd_resourcename, error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+ resourcedata = g_bytes_get_data (resourcecontents, &resourcesize);
+ buffer = xmlParserInputBufferCreateStatic (resourcedata, resourcesize, XML_CHAR_ENCODING_UTF8);
+
+ memset (&cvp, 0, sizeof (cvp));
+ dtd = xmlIOParseDTD (NULL, buffer, XML_CHAR_ENCODING_UTF8);
+ ret = xmlValidateDtd (&cvp, doc, dtd);
+
+ xmlFreeDtd (dtd);
+ g_bytes_unref (resourcecontents);
+
+ return ret;
+}
+
/* Takes care of moving the window to the current workspace. */
void
tpaw_window_present_with_time (GtkWindow *window,
* Richard Hult <richard@imendio.com>
* Martyn Russell <martyn@imendio.com>
* Steve Frécinaux <code@istique.net>
+ * Emanuele Aina <emanuele.aina@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
#include <glib.h>
#include <gtk/gtk.h>
+#include <libxml/tree.h>
#include <telepathy-glib/telepathy-glib.h>
G_BEGIN_DECLS
const gchar *tpaw_protocol_name_to_display_name (const gchar *proto_name);
const gchar *tpaw_service_name_to_display_name (const gchar *proto_name);
+/* XML */
+gboolean tpaw_xml_validate_from_resource (xmlDoc *doc,
+ const gchar *dtd_resourcename);
+
void tpaw_make_color_whiter (GdkRGBA *color);
/* Windows */