grim/gplate

Parents d841559018a2
Children 86d19c3a86f8
Changed the render function for tags to have a second argument of GPlateTemplate instead of GPlateCollection since the template is required for manipulating the tag stack, and it's a collection anyways ;)
--- a/gplate/gplate-code-tag.c Mon Feb 11 03:59:52 2008 -0600
+++ b/gplate/gplate-code-tag.c Mon Feb 11 04:20:16 2008 -0600
@@ -36,9 +36,7 @@
}
static gchar *
-gplate_code_tag_render(const GPlateTag *tag,
- const GPlateCollection *variables)
-{
+gplate_code_tag_render(const GPlateTag *tag, GPlateTemplate *tplate) {
return NULL;
}
--- a/gplate/gplate-comment-tag.c Mon Feb 11 03:59:52 2008 -0600
+++ b/gplate/gplate-comment-tag.c Mon Feb 11 04:20:16 2008 -0600
@@ -36,9 +36,7 @@
}
static gchar *
-gplate_comment_tag_render(const GPlateTag *tag,
- const GPlateCollection *variables)
-{
+gplate_comment_tag_render(const GPlateTag *tag, GPlateTemplate *tplate) {
return g_strdup("");
}
--- a/gplate/gplate-tag.c Mon Feb 11 03:59:52 2008 -0600
+++ b/gplate/gplate-tag.c Mon Feb 11 04:20:16 2008 -0600
@@ -191,9 +191,7 @@
* Return Value: The rendered output of @tag.
*/
gchar *
-gplate_tag_render(const GPlateTag *tag,
- const GPlateCollection *variables)
-{
+gplate_tag_render(const GPlateTag *tag, GPlateTemplate *tplate) {
GPlateTagClass *klass = NULL;
g_return_val_if_fail(GPLATE_IS_TAG(tag), NULL);
@@ -201,7 +199,7 @@
klass = GPLATE_TAG_GET_CLASS(tag);
if(klass && klass->render)
- return klass->render(tag, variables);
+ return klass->render(tag, tplate);
return NULL;
}
--- a/gplate/gplate-tag.h Mon Feb 11 03:59:52 2008 -0600
+++ b/gplate/gplate-tag.h Mon Feb 11 04:20:16 2008 -0600
@@ -22,8 +22,6 @@
#include <glib.h>
#include <glib-object.h>
-#include <gplate/gplate-collection.h>
-
#define GPLATE_TYPE_TAG (gplate_tag_get_gtype())
#define GPLATE_TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPLATE_TYPE_TAG, GPlateTag))
#define GPLATE_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GPLATE_TYPE_TAG, GPlateTagClass))
@@ -34,6 +32,8 @@
typedef struct _GPlateTag GPlateTag;
typedef struct _GPlateTagClass GPlateTagClass;
+#include <gplate/gplate-template.h>
+
struct _GPlateTag {
GObject gparent;
@@ -48,7 +48,7 @@
const gchar *(*get_contents)(const GPlateTag *tag);
- gchar *(*render)(const GPlateTag *tag, const GPlateCollection *variables);
+ gchar *(*render)(const GPlateTag *tag, GPlateTemplate *tplate);
const gchar *(*get_prefix)(const GPlateTagClass *tag_class);
const gchar *(*get_suffix)(const GPlateTagClass *tag_class);
@@ -65,7 +65,7 @@
const gchar *gplate_tag_get_contents(const GPlateTag *tag);
-gchar *gplate_tag_render(const GPlateTag *tag, const GPlateCollection *variables);
+gchar *gplate_tag_render(const GPlateTag *tag, GPlateTemplate *tplate);
const gchar *gplate_tag_class_get_prefix(const GPlateTagClass *tag_class);
const gchar *gplate_tag_class_get_suffix(const GPlateTagClass *tag_class);
--- a/gplate/gplate-template.c Mon Feb 11 03:59:52 2008 -0600
+++ b/gplate/gplate-template.c Mon Feb 11 04:20:16 2008 -0600
@@ -509,7 +509,7 @@
for(l = tokens; l; l = l->next) {
GPlateTag *tag = GPLATE_TAG(l->data);
- gchar *contents = gplate_tag_render(tag, GPLATE_COLLECTION(tplate));
+ gchar *contents = gplate_tag_render(tag, tplate);
if(contents)
g_string_append_printf(str, "%s", contents);
--- a/gplate/gplate-template.h Mon Feb 11 03:59:52 2008 -0600
+++ b/gplate/gplate-template.h Mon Feb 11 04:20:16 2008 -0600
@@ -22,8 +22,6 @@
#include <glib.h>
#include <glib-object.h>
-#include <gplate/gplate-tag.h>
-
#define GPLATE_TYPE_TEMPLATE (gplate_template_get_gtype())
#define GPLATE_TEMPLATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GPLATE_TYPE_TEMPLATE, GPlateTemplate))
#define GPLATE_TEMPLATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GPLATE_TYPE_TEMPLATE, GPlateTemplateClass))
@@ -34,6 +32,8 @@
typedef struct _GPlateTemplate GPlateTemplate;
typedef struct _GPlateTemplateClass GPlateTemplateClass;
+#include <gplate/gplate-tag.h>
+
struct _GPlateTemplate {
GObject gparent;
--- a/gplate/gplate-text-tag.c Mon Feb 11 03:59:52 2008 -0600
+++ b/gplate/gplate-text-tag.c Mon Feb 11 04:20:16 2008 -0600
@@ -26,9 +26,7 @@
* Tag stuff
*****************************************************************************/
static gchar *
-gplate_text_tag_render(const GPlateTag *tag,
- const GPlateCollection *variables)
-{
+gplate_text_tag_render(const GPlateTag *tag, GPlateTemplate *tplate) {
const gchar *contents = gplate_tag_get_contents(tag);
return (contents) ? g_strdup(contents) : NULL;
--- a/gplate/gplate-variable-tag.c Mon Feb 11 03:59:52 2008 -0600
+++ b/gplate/gplate-variable-tag.c Mon Feb 11 04:20:16 2008 -0600
@@ -22,6 +22,9 @@
#include <gplate/gplate-variable-tag.h>
+#include <gplate/gplate-collection.h>
+#include <gplate/gplate-variable.h>
+
/******************************************************************************
* Tag stuff
*****************************************************************************/
@@ -36,9 +39,7 @@
}
static gchar *
-gplate_variable_tag_render(const GPlateTag *tag,
- const GPlateCollection *variables)
-{
+gplate_variable_tag_render(const GPlateTag *tag, GPlateTemplate *tplate) {
GPlateVariable *variable = NULL;
GRegex *regex = NULL;
GMatchInfo *info = NULL;
@@ -81,7 +82,8 @@
}
/* find the variable from the name */
- variable = gplate_collection_find_variable(variables, name);
+ variable = gplate_collection_find_variable(GPLATE_COLLECTION(tplate),
+ name);
g_free(name);
/* clean up the match info */