diff options
author | Emanuele Aina <emanuele.aina@collabora.com> | 2013-03-26 20:09:29 +0800 |
---|---|---|
committer | Emanuele Aina <emanuele.aina@collabora.com> | 2013-04-01 17:50:29 +0800 |
commit | 3992967e7a3015a48b5db9c7e652105abe38856e (patch) | |
tree | df9901dc03195bfbfd7fa3bab97fb9c0f7e5b557 /libempathy | |
parent | 4299f29ac941292054b4e004aac51e1b143a386a (diff) | |
download | gsoc2013-empathy-3992967e7a3015a48b5db9c7e652105abe38856e.tar gsoc2013-empathy-3992967e7a3015a48b5db9c7e652105abe38856e.tar.gz gsoc2013-empathy-3992967e7a3015a48b5db9c7e652105abe38856e.tar.bz2 gsoc2013-empathy-3992967e7a3015a48b5db9c7e652105abe38856e.tar.lz gsoc2013-empathy-3992967e7a3015a48b5db9c7e652105abe38856e.tar.xz gsoc2013-empathy-3992967e7a3015a48b5db9c7e652105abe38856e.tar.zst gsoc2013-empathy-3992967e7a3015a48b5db9c7e652105abe38856e.zip |
Embed DTDs for XML validation as GResources
https://bugzilla.gnome.org/show_bug.cgi?id=696974
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/.gitignore | 1 | ||||
-rw-r--r-- | libempathy/Makefile.am | 18 | ||||
-rw-r--r-- | libempathy/empathy-chatroom-manager.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-contact-groups.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-dtd.gresource.xml | 10 | ||||
-rw-r--r-- | libempathy/empathy-irc-network-manager.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-status-presets.c | 4 |
7 files changed, 33 insertions, 12 deletions
diff --git a/libempathy/.gitignore b/libempathy/.gitignore index 8617dcbd0..5cc6b3397 100644 --- a/libempathy/.gitignore +++ b/libempathy/.gitignore @@ -1,4 +1,5 @@ empathy-chandler-glue.h +empathy-dtd-resources.[ch] empathy-marshal.* empathy-filter-glue.h tp-stream-engine-gen.h diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index 36de4d6c2..77484d2f1 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -21,6 +21,8 @@ AM_CPPFLAGS = \ $(DISABLE_DEPRECATED) BUILT_SOURCES = \ + empathy-dtd-resources.c \ + empathy-dtd-resources.h \ empathy-enum-types.h \ empathy-enum-types.c @@ -134,8 +136,7 @@ libempathy_la_LIBADD = \ $(UOA_LIBS) \ $(LIBM) -dtddir = $(datadir)/empathy -dtd_DATA = \ +dtd_resources_files = \ empathy-status-presets.dtd \ empathy-contact-groups.dtd \ empathy-chatroom-manager.dtd \ @@ -145,8 +146,17 @@ ircnetworksdir = $(datadir)/empathy ircnetworks_DATA = \ irc-networks.xml -EXTRA_DIST = \ - $(dtd_DATA) \ +dtd_resource_files: $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/empathy-dtd.gresource.xml) + +empathy-dtd-resources.c: empathy-dtd.gresource.xml $(dtd_resource_files) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $< + +empathy-dtd-resources.h: empathy-dtd.gresource.xml $(dtd_resource_files) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-header $< + +EXTRA_DIST = \ + empathy-dtd.gresource.xml \ + $(dtd_resources_files) \ $(ircnetworks_DATA) CLEANFILES = \ diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c index ebdc50433..7a6532f3e 100644 --- a/libempathy/empathy-chatroom-manager.c +++ b/libempathy/empathy-chatroom-manager.c @@ -33,7 +33,7 @@ #include "empathy-debug.h" #define CHATROOMS_XML_FILENAME "chatrooms.xml" -#define CHATROOMS_DTD_FILENAME "empathy-chatroom-manager.dtd" +#define CHATROOMS_DTD_RESOURCENAME "/org/gnome/Empathy/empathy-chatroom-manager.dtd" #define SAVE_TIMER 4 static EmpathyChatroomManager *chatroom_manager_singleton = NULL; @@ -320,7 +320,7 @@ chatroom_manager_file_parse (EmpathyChatroomManager *manager, return FALSE; } - if (!empathy_xml_validate (doc, CHATROOMS_DTD_FILENAME)) + if (!empathy_xml_validate_from_resource (doc, CHATROOMS_DTD_RESOURCENAME)) { g_warning ("Failed to validate file:'%s'", filename); xmlFreeDoc (doc); diff --git a/libempathy/empathy-contact-groups.c b/libempathy/empathy-contact-groups.c index 8d49f0519..7fb02499f 100644 --- a/libempathy/empathy-contact-groups.c +++ b/libempathy/empathy-contact-groups.c @@ -31,7 +31,7 @@ #include "empathy-debug.h" #define CONTACT_GROUPS_XML_FILENAME "contact-groups.xml" -#define CONTACT_GROUPS_DTD_FILENAME "empathy-contact-groups.dtd" +#define CONTACT_GROUPS_DTD_RESOURCENAME "/org/gnome/Empathy/empathy-contact-groups.dtd" typedef struct { gchar *name; @@ -91,7 +91,7 @@ contact_groups_file_parse (const gchar *filename) return; } - if (!empathy_xml_validate (doc, CONTACT_GROUPS_DTD_FILENAME)) { + if (!empathy_xml_validate_from_resource (doc, CONTACT_GROUPS_DTD_RESOURCENAME)) { g_warning ("Failed to validate file:'%s'", filename); xmlFreeDoc (doc); xmlFreeParserCtxt (ctxt); diff --git a/libempathy/empathy-dtd.gresource.xml b/libempathy/empathy-dtd.gresource.xml new file mode 100644 index 000000000..76cc81702 --- /dev/null +++ b/libempathy/empathy-dtd.gresource.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<gresources> + <gresource prefix="/org/gnome/Empathy"> + <file>empathy-status-presets.dtd</file> + <file>empathy-contact-groups.dtd</file> + <file>empathy-chatroom-manager.dtd</file> + <file>empathy-irc-networks.dtd</file> + </gresource> +</gresources> + diff --git a/libempathy/empathy-irc-network-manager.c b/libempathy/empathy-irc-network-manager.c index 7f6ed9df8..3c2a31544 100644 --- a/libempathy/empathy-irc-network-manager.c +++ b/libempathy/empathy-irc-network-manager.c @@ -28,7 +28,7 @@ #define DEBUG_FLAG EMPATHY_DEBUG_IRC #include "empathy-debug.h" -#define IRC_NETWORKS_DTD_FILENAME "empathy-irc-networks.dtd" +#define IRC_NETWORKS_DTD_RESOURCENAME "/org/gnome/Empathy/empathy-irc-networks.dtd" #define IRC_NETWORKS_FILENAME "irc-networks.xml" #define SAVE_TIMER 4 @@ -632,7 +632,7 @@ irc_network_manager_file_parse (EmpathyIrcNetworkManager *self, return FALSE; } - if (!empathy_xml_validate (doc, IRC_NETWORKS_DTD_FILENAME)) { + if (!empathy_xml_validate_from_resource (doc, IRC_NETWORKS_DTD_RESOURCENAME)) { g_warning ("Failed to validate file:'%s'", filename); xmlFreeDoc (doc); xmlFreeParserCtxt (ctxt); diff --git a/libempathy/empathy-status-presets.c b/libempathy/empathy-status-presets.c index d8faa4fe9..1de36d81b 100644 --- a/libempathy/empathy-status-presets.c +++ b/libempathy/empathy-status-presets.c @@ -31,7 +31,7 @@ #include "empathy-debug.h" #define STATUS_PRESETS_XML_FILENAME "status-presets.xml" -#define STATUS_PRESETS_DTD_FILENAME "empathy-status-presets.dtd" +#define STATUS_PRESETS_DTD_RESOURCENAME "/org/gnome/Empathy/empathy-status-presets.dtd" #define STATUS_PRESETS_MAX_EACH 15 typedef struct { @@ -92,7 +92,7 @@ status_presets_file_parse (const gchar *filename) return; } - if (!empathy_xml_validate (doc, STATUS_PRESETS_DTD_FILENAME)) { + if (!empathy_xml_validate_from_resource (doc, STATUS_PRESETS_DTD_RESOURCENAME)) { g_warning ("Failed to validate file:'%s'", filename); xmlFreeDoc (doc); xmlFreeParserCtxt (ctxt); |