[Goodies-commits] r5554 - in xfbib/branches/gobject: src tests
Jesper Karlsson
zarper at xfce.org
Fri Oct 10 10:13:49 CEST 2008
Author: zarper
Date: 2008-10-10 08:13:49 +0000 (Fri, 10 Oct 2008)
New Revision: 5554
Added:
xfbib/branches/gobject/src/xfbib-bibtex-comment.c
xfbib/branches/gobject/src/xfbib-bibtex-comment.h
xfbib/branches/gobject/src/xfbib-bibtex-field.c
xfbib/branches/gobject/src/xfbib-bibtex-field.h
xfbib/branches/gobject/src/xfbib-bibtex-preamble.c
xfbib/branches/gobject/src/xfbib-bibtex-preamble.h
xfbib/branches/gobject/src/xfbib-bibtex-string.c
xfbib/branches/gobject/src/xfbib-bibtex-string.h
Removed:
xfbib/branches/gobject/src/xfbib-comment.c
xfbib/branches/gobject/src/xfbib-comment.h
xfbib/branches/gobject/src/xfbib-field.c
xfbib/branches/gobject/src/xfbib-field.h
xfbib/branches/gobject/src/xfbib-preamble.c
xfbib/branches/gobject/src/xfbib-preamble.h
xfbib/branches/gobject/src/xfbib-string.c
xfbib/branches/gobject/src/xfbib-string.h
Modified:
xfbib/branches/gobject/src/Makefile.am
xfbib/branches/gobject/src/xfbib-elements.c
xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c
xfbib/branches/gobject/src/xfbib-entry.c
xfbib/branches/gobject/src/xfbib-entry.h
xfbib/branches/gobject/src/xfbib-list-store.c
xfbib/branches/gobject/src/xfbib-menu-bar.c
xfbib/branches/gobject/src/xfbib-value.c
xfbib/branches/gobject/tests/Makefile.am
xfbib/branches/gobject/tests/test-xfbib-comment.c
xfbib/branches/gobject/tests/test-xfbib-elements.c
xfbib/branches/gobject/tests/test-xfbib-entry.c
xfbib/branches/gobject/tests/test-xfbib-field.c
xfbib/branches/gobject/tests/test-xfbib-preamble.c
xfbib/branches/gobject/tests/test-xfbib-string.c
Log:
Renaming objects related to the parser, to highlight that they are bibtex related.
Modified: xfbib/branches/gobject/src/Makefile.am
===================================================================
--- xfbib/branches/gobject/src/Makefile.am 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/src/Makefile.am 2008-10-10 08:13:49 UTC (rev 5554)
@@ -2,16 +2,16 @@
xfbib_SOURCES = \
main.c \
- xfbib-comment.c \
- xfbib-comment.h \
+ xfbib-bibtex-comment.c \
+ xfbib-bibtex-comment.h \
xfbib-elements.c \
xfbib-elements.h \
xfbib-entry.c \
xfbib-entry.h \
xfbib-entry-edit-dialog.c \
xfbib-entry-edit-dialog.h \
- xfbib-field.c \
- xfbib-field.h \
+ xfbib-bibtex-field.c \
+ xfbib-bibtex-field.h \
xfbib-file-io.c \
xfbib-file-io.h \
xfbib-input-dialog.c \
@@ -24,8 +24,8 @@
xfbib-menu-bar.h \
xfbib-multiple-input.c \
xfbib-multiple-input.h \
- xfbib-preamble.c \
- xfbib-preamble.h \
+ xfbib-bibtex-preamble.c \
+ xfbib-bibtex-preamble.h \
xfbib-single-input.c \
xfbib-single-input.h \
xfbib-state.c \
@@ -34,8 +34,8 @@
xfbib-statusbar.h \
xfbib-strbuf.c \
xfbib-strbuf.h \
- xfbib-string.c \
- xfbib-string.h \
+ xfbib-bibtex-string.c \
+ xfbib-bibtex-string.h \
xfbib-toolbar.c \
xfbib-toolbar.h \
xfbib-tree-view.c \
Copied: xfbib/branches/gobject/src/xfbib-bibtex-comment.c (from rev 5543, xfbib/branches/gobject/src/xfbib-comment.c)
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-comment.c (rev 0)
+++ xfbib/branches/gobject/src/xfbib-bibtex-comment.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2008 Jesper Karlsson & David Gustafsson
+ * All rights reserved.
+ *
+ * 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 2 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gtk/gtk.h>
+
+#include "xfbib-bibtex-comment.h"
+#include "xfbib-strbuf.h"
+
+struct _XfbibBibtexComment
+{
+ GObject parent;
+ XfbibStrbuf *strbuf;
+};
+
+typedef struct _XfbibBibtexCommentClass
+{
+ GObjectClass parent;
+} XfbibBibtexCommentClass;
+
+static void xfbib_bibtex_comment_class_init(XfbibBibtexCommentClass *klass);
+
+static void xfbib_bibtex_comment_init(XfbibBibtexComment *instance);
+static void xfbib_bibtex_comment_finalize(GObject *obj);
+
+G_DEFINE_TYPE(XfbibBibtexComment, xfbib_bibtex_comment, G_TYPE_OBJECT)
+
+static void
+xfbib_bibtex_comment_class_init(XfbibBibtexCommentClass *klass)
+{
+ GObjectClass *object_class = (GObjectClass *)klass;
+ object_class->finalize = xfbib_bibtex_comment_finalize;
+}
+
+static void
+xfbib_bibtex_comment_init(XfbibBibtexComment *instance)
+{
+ instance->strbuf = xfbib_strbuf_new();
+}
+
+static void
+xfbib_bibtex_comment_finalize(GObject *obj)
+{
+ G_OBJECT_CLASS(xfbib_bibtex_comment_parent_class)->finalize(obj);
+}
+
+XfbibBibtexComment *
+xfbib_bibtex_comment_new(const gchar *str)
+{
+ XfbibBibtexComment *comment;
+ comment = g_object_new(XFBIB_TYPE_BIBTEX_COMMENT, NULL);
+ xfbib_strbuf_append(comment->strbuf, str);
+ return comment;
+}
Property changes on: xfbib/branches/gobject/src/xfbib-bibtex-comment.c
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: xfbib/branches/gobject/src/xfbib-bibtex-comment.h (from rev 5543, xfbib/branches/gobject/src/xfbib-comment.h)
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-comment.h (rev 0)
+++ xfbib/branches/gobject/src/xfbib-bibtex-comment.h 2008-10-10 08:13:49 UTC (rev 5554)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2008 Jesper Karlsson & David Gustafsson
+ * All rights reserved.
+ *
+ * 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 2 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFBIB_BIBTEX_COMMENT_H
+#define __XFBIB_BIBTEX_COMMENT_H
+
+#include <glib-object.h>
+
+#define XFBIB_TYPE_BIBTEX_COMMENT (xfbib_bibtex_comment_get_type())
+#define XFBIB_BIBTEX_COMMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFBIB_TYPE_BIBTEX_COMMENT, XfbibBibtexComment))
+#define XFBIB_IS_BIBTEX_COMMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFBIB_TYPE_BIBTEX_COMMENT))
+#define XFBIB_BIBTEX_COMMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFBIB_TYPE_BIBTEX_COMMENT, XfbibBibtexCommentClass))
+#define XFBIB_IS_BIBTEX_COMMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFBIB_TYPE_BIBTEX_COMMENT))
+#define XFBIB_BIBTEX_COMMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFBIB_TYPE_BIBTEX_COMMENT, XfbibBibtexCommentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _XfbibBibtexComment XfbibBibtexComment;
+
+GType xfbib_bibtex_comment_get_type() G_GNUC_CONST;
+
+XfbibBibtexComment *xfbib_bibtex_comment_new(const gchar *);
+
+G_END_DECLS
+
+#endif //__XFBIB_BIBTEX_COMMENT_H
Property changes on: xfbib/branches/gobject/src/xfbib-bibtex-comment.h
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: xfbib/branches/gobject/src/xfbib-bibtex-field.c (from rev 5543, xfbib/branches/gobject/src/xfbib-field.c)
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-field.c (rev 0)
+++ xfbib/branches/gobject/src/xfbib-bibtex-field.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2008 Jesper Karlsson & David Gustafsson
+ * All rights reserved.
+ *
+ * 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 2 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gtk/gtk.h>
+
+#include "xfbib-bibtex-field.h"
+#include "xfbib-strbuf.h"
+#include "xfbib-value.h"
+
+static struct {
+ gchar *label;
+ gchar *tooltip;
+}xfbib_bibtex_field_constants[] = {
+ {"Address", "Address of publisher"},
+ {"Annote", "Annotation for annotated bibliography styles"},
+ {"Author", "Name(s) of the author(s), separated by 'and' if more than one"},
+ {"Booktitle", "Title of the book, if only part of it is being cited"},
+ {"Chapter", "Chapter number"},
+ {"Crossref", "Citation key of the cross-referenced entry"},
+ {"Edition", "Edition of the book (such as \"first\" or \"second\")"},
+ {"Editor", "Name(s) of the editor(s), separated by 'and' if more than one"},
+ {"E-print", "Specification of electronic publication"},
+ {"HowPublished", "Publishing method if the method is nonstandard"},
+ {"Institution", "Institution that was involved in the publishing"},
+ {"Journal", "Journal or magazine in which the work was published"},
+ {"Key", "Hidden field used for specifying or overriding the alphabetical order of entries"},
+ {"Month", "Month of publication or creation if unpublished"},
+ {"Note", "Miscellaneous extra information"},
+ {"Number", "Number of journal, magazine, or tech-report"},
+ {"Organization", "Sponsor of the conference"},
+ {"Pages", "Page numbers separated by commas or double-hyphens"},
+ {"Publisher", "Name of publisher"},
+ {"School", "School where thesis was written"},
+ {"Series", "Series of books in which the book was published"},
+ {"Title", "Title of the work"},
+ {"Type", "Type of technical report"},
+ {"URL", "Internet address"},
+ {"Volume", "Number of the volume"},
+ {"Year", "Year of publication or creation if unpublished"}
+};
+
+struct _XfbibBibtexField
+{
+ GObject parent;
+ XfbibStrbuf *variable;
+ XfbibValue *value;
+};
+
+typedef struct _XfbibBibtexFieldClass
+{
+ GObjectClass parent;
+} XfbibBibtexFieldClass;
+
+static void xfbib_bibtex_field_class_init(XfbibBibtexFieldClass *klass);
+
+static void xfbib_bibtex_field_init(XfbibBibtexField *instance);
+static void xfbib_bibtex_field_finalize(GObject *obj);
+
+G_DEFINE_TYPE(XfbibBibtexField, xfbib_bibtex_field, G_TYPE_OBJECT)
+
+static void
+xfbib_bibtex_field_class_init(XfbibBibtexFieldClass *klass)
+{
+ GObjectClass *object_class = (GObjectClass *)klass;
+ object_class->finalize = xfbib_bibtex_field_finalize;
+}
+
+static void
+xfbib_bibtex_field_init(XfbibBibtexField *instance)
+{
+ instance->variable = xfbib_strbuf_new();
+ instance->value = xfbib_value_new();
+}
+
+static void
+xfbib_bibtex_field_finalize(GObject *obj)
+{
+ G_OBJECT_CLASS(xfbib_bibtex_field_parent_class)->finalize(obj);
+}
+
+XfbibBibtexField *
+xfbib_bibtex_field_new()
+{
+ XfbibBibtexField *field;
+ field = g_object_new(XFBIB_TYPE_BIBTEX_FIELD, NULL);
+ return field;
+}
+
+gboolean
+xfbib_bibtex_field_parse(XfbibBibtexField *field, const gchar *str)
+{
+ gchar **split = NULL;
+
+ split = g_strsplit(str, "=", 2);
+
+ if (split[1] == NULL) {
+ /* Equal sign missing */
+ g_warning("No equal sign found in definition of Field\n");
+ g_strfreev(split);
+ return FALSE;
+ }
+
+ /* Variable */
+ xfbib_strbuf_wipe(field->variable);
+ g_strstrip(split[0]);
+ xfbib_strbuf_append(field->variable, split[0]);
+
+ /* Value */
+ if (!xfbib_value_parse(field->value, split[1])) {
+ g_strfreev(split);
+ return FALSE;
+ }
+
+ g_strfreev(split);
+ return TRUE;
+}
+
+gboolean
+xfbib_bibtex_field_is_column(XfbibBibtexField *field, gint column)
+{
+ if (strcasecmp(xfbib_strbuf_get_str(field->variable),
+ xfbib_bibtex_field_constants[column].label) == 0) {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+const gchar *
+xfbib_bibtex_field_get_value_str(XfbibBibtexField *field)
+{
+ return xfbib_value_get_str(field->value);
+}
+
+void
+xfbib_bibtex_field_set_variable(XfbibBibtexField *field, const gchar *str)
+{
+ xfbib_strbuf_append(field->variable,str);
+}
+
+void
+xfbib_bibtex_field_set_value(XfbibBibtexField *field, XfbibValue *value)
+{
+ if(field->value != NULL) {
+ free(field->value);
+ }
+ field->value = value;
+}
+
Property changes on: xfbib/branches/gobject/src/xfbib-bibtex-field.c
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: xfbib/branches/gobject/src/xfbib-bibtex-field.h (from rev 5543, xfbib/branches/gobject/src/xfbib-field.h)
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-field.h (rev 0)
+++ xfbib/branches/gobject/src/xfbib-bibtex-field.h 2008-10-10 08:13:49 UTC (rev 5554)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2008 Jesper Karlsson & David Gustafsson
+ * All rights reserved.
+ *
+ * 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 2 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFBIB_BIBTEX_FIELD_H
+#define __XFBIB_BIBTEX_FIELD_H
+
+#include <glib-object.h>
+#include "xfbib-value.h"
+
+#define XFBIB_TYPE_BIBTEX_FIELD (xfbib_bibtex_field_get_type())
+#define XFBIB_BIBTEX_FIELD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFBIB_TYPE_BIBTEX_FIELD, XfbibBibtexField))
+#define XFBIB_IS_BIBTEX_FIELD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFBIB_TYPE_BIBTEX_FIELD))
+#define XFBIB_BIBTEX_FIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFBIB_TYPE_BIBTEX_FIELD, XfbibBibtexFieldClass))
+#define XFBIB_IS_BIBTEX_FIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFBIB_TYPE_BIBTEX_FIELD))
+#define XFBIB_BIBTEX_FIELD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFBIB_TYPE_BIBTEX_FIELD, XfbibBibtexFieldClass))
+
+G_BEGIN_DECLS
+
+enum {
+ XFBIB_FIELD_ADDRESS,
+ XFBIB_FIELD_ANNOTE,
+ XFBIB_FIELD_AUTHOR,
+ XFBIB_FIELD_BOOKTITLE,
+ XFBIB_FIELD_CHAPTER,
+ XFBIB_FIELD_CROSSREF,
+ XFBIB_FIELD_EDITION,
+ XFBIB_FIELD_EDITOR,
+ XFBIB_FIELD_EPRINT,
+ XFBIB_FIELD_HOWPUBLISHED,
+ XFBIB_FIELD_INSTITUTION,
+ XFBIB_FIELD_JOURNAL,
+ XFBIB_FIELD_KEY,
+ XFBIB_FIELD_MONTH,
+ XFBIB_FIELD_NOTE,
+ XFBIB_FIELD_NUMBER,
+ XFBIB_FIELD_ORGANIZATION,
+ XFBIB_FIELD_PAGES,
+ XFBIB_FIELD_PUBLISHER,
+ XFBIB_FIELD_SCHOOL,
+ XFBIB_FIELD_SERIES,
+ XFBIB_FIELD_TITLE,
+ XFBIB_FIELD_TYPE,
+ XFBIB_FIELD_URL,
+ XFBIB_FIELD_VOLUME,
+ XFBIB_FIELD_YEAR,
+ XFBIB_FIELD_N_FIELDS,
+};
+
+typedef struct _XfbibBibtexField XfbibBibtexField;
+
+GType xfbib_field_get_type() G_GNUC_CONST;
+
+XfbibBibtexField *xfbib_bibtex_field_new();
+gboolean xfbib_bibtex_field_parse(XfbibBibtexField *, const gchar *);
+gboolean xfbib_bibtex_field_is_column(XfbibBibtexField *, gint);
+const gchar *xfbib_bibtex_field_get_value_str(XfbibBibtexField *);
+void xfbib_bibtex_field_set_variable(XfbibBibtexField *, const gchar *);
+void xfbib_bibtex_field_set_value(XfbibBibtexField *, XfbibValue *);
+G_END_DECLS
+
+#endif //__XFBIB_BIBTEX_FIELD_H
+
Property changes on: xfbib/branches/gobject/src/xfbib-bibtex-field.h
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: xfbib/branches/gobject/src/xfbib-bibtex-preamble.c (from rev 5543, xfbib/branches/gobject/src/xfbib-preamble.c)
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-preamble.c (rev 0)
+++ xfbib/branches/gobject/src/xfbib-bibtex-preamble.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2008 Jesper Karlsson & David Gustafsson
+ * All rights reserved.
+ *
+ * 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 2 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <string.h>
+#include <gtk/gtk.h>
+
+#include "xfbib-bibtex-preamble.h"
+#include "xfbib-value.h"
+
+struct _XfbibBibtexPreamble
+{
+ GObject parent;
+ gchar separator;
+ XfbibValue *value;
+};
+
+typedef struct _XfbibBibtexPreambleClass
+{
+ GObjectClass parent;
+} XfbibBibtexPreambleClass;
+
+static void xfbib_bibtex_preamble_class_init(XfbibBibtexPreambleClass *klass);
+
+static void xfbib_bibtex_preamble_init(XfbibBibtexPreamble *instance);
+static void xfbib_bibtex_preamble_finalize(GObject *obj);
+
+G_DEFINE_TYPE(XfbibBibtexPreamble, xfbib_bibtex_preamble, G_TYPE_OBJECT)
+
+static void
+xfbib_bibtex_preamble_class_init(XfbibBibtexPreambleClass *klass)
+{
+ GObjectClass *object_class = (GObjectClass *)klass;
+ object_class->finalize = xfbib_bibtex_preamble_finalize;
+}
+
+static void
+xfbib_bibtex_preamble_init(XfbibBibtexPreamble *instance)
+{
+ instance->value = xfbib_value_new();
+}
+
+static void
+xfbib_bibtex_preamble_finalize(GObject *obj)
+{
+ G_OBJECT_CLASS(xfbib_bibtex_preamble_parent_class)->finalize(obj);
+}
+
+XfbibBibtexPreamble *
+xfbib_bibtex_preamble_new()
+{
+ XfbibBibtexPreamble *preamble;
+ preamble = g_object_new(XFBIB_TYPE_BIBTEX_PREAMBLE, NULL);
+ return preamble;
+}
+
+gboolean
+xfbib_bibtex_preamble_parse(XfbibBibtexPreamble *preamble, const gchar *s)
+{
+ gchar *str, *tmp;
+
+ str = g_strdup(s + 9);
+ g_strstrip(str);
+ preamble->separator = str[0];
+
+ tmp = g_strndup(str + 1, strlen(str) - 2);
+
+ if (!xfbib_value_parse(preamble->value, tmp)) {
+ free(tmp);
+ free(str);
+ return FALSE;
+ }
+ free(tmp);
+ free(str);
+ return TRUE;
+}
+
Property changes on: xfbib/branches/gobject/src/xfbib-bibtex-preamble.c
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: xfbib/branches/gobject/src/xfbib-bibtex-preamble.h (from rev 5543, xfbib/branches/gobject/src/xfbib-preamble.h)
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-preamble.h (rev 0)
+++ xfbib/branches/gobject/src/xfbib-bibtex-preamble.h 2008-10-10 08:13:49 UTC (rev 5554)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2008 Jesper Karlsson & David Gustafsson
+ * All rights reserved.
+ *
+ * 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 2 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFBIB_BIBTEX_PREAMBLE_H
+#define __XFBIB_BIBTEX_PREAMBLE_H
+
+#include <glib-object.h>
+
+#define XFBIB_TYPE_BIBTEX_PREAMBLE (xfbib_bibtex_preamble_get_type())
+#define XFBIB_BIBTEX_PREAMBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFBIB_TYPE_BIBTEX_PREAMBLE, XfbibBibtexPreamble))
+#define XFBIB_IS_BIBTEX_PREAMBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFBIB_TYPE_BIBTEX_PREAMBLE))
+#define XFBIB_BIBTEX_PREAMBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFBIB_TYPE_BIBTEX_PREAMBLE, XfbibBibtexPreambleClass))
+#define XFBIB_IS_BIBTEX_PREAMBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFBIB_TYPE_BIBTEX_PREAMBLE))
+#define XFBIB_BIBTEX_PREAMBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFBIB_TYPE_BIBTEX_PREAMBLE, XfbibBibtexPreambleClass))
+
+G_BEGIN_DECLS
+
+typedef struct _XfbibBibtexPreamble XfbibBibtexPreamble;
+
+GType xfbib_bibtex_preamble_get_type() G_GNUC_CONST;
+
+XfbibBibtexPreamble *xfbib_bibtex_preamble_new();
+gboolean xfbib_bibtex_preamble_parse(XfbibBibtexPreamble *, const gchar *);
+
+G_END_DECLS
+
+#endif //__XFBIB_BIBTEX_PREAMBLE_H
+
Property changes on: xfbib/branches/gobject/src/xfbib-bibtex-preamble.h
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: xfbib/branches/gobject/src/xfbib-bibtex-string.c (from rev 5543, xfbib/branches/gobject/src/xfbib-string.c)
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-string.c (rev 0)
+++ xfbib/branches/gobject/src/xfbib-bibtex-string.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2008 Jesper Karlsson & David Gustafsson
+ * All rights reserved.
+ *
+ * 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 2 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <gtk/gtk.h>
+#include <string.h>
+
+#include "xfbib-bibtex-string.h"
+#include "xfbib-strbuf.h"
+#include "xfbib-value.h"
+
+struct _XfbibBibtexString
+{
+ GObject parent;
+ XfbibStrbuf *variable;
+ XfbibValue *value;
+};
+
+typedef struct _XfbibBibtexStringClass
+{
+ GObjectClass parent;
+} XfbibBibtexStringClass;
+
+static void xfbib_bibtex_string_class_init(XfbibBibtexStringClass *klass);
+
+static void xfbib_bibtex_string_init(XfbibBibtexString *instance);
+static void xfbib_bibtex_string_finalize(GObject *obj);
+
+G_DEFINE_TYPE(XfbibBibtexString, xfbib_bibtex_string, G_TYPE_OBJECT)
+
+static void
+xfbib_bibtex_string_class_init(XfbibBibtexStringClass *klass)
+{
+ GObjectClass *object_class = (GObjectClass *)klass;
+ object_class->finalize = xfbib_bibtex_string_finalize;
+}
+
+static void
+xfbib_bibtex_string_init(XfbibBibtexString *instance)
+{
+}
+
+static void
+xfbib_bibtex_string_finalize(GObject *obj)
+{
+ G_OBJECT_CLASS(xfbib_bibtex_string_parent_class)->finalize(obj);
+}
+
+XfbibBibtexString *
+xfbib_bibtex_string_new()
+{
+ XfbibBibtexString *string;
+ string = g_object_new(XFBIB_TYPE_BIBTEX_STRING, NULL);
+
+ string->variable = xfbib_strbuf_new();
+ string->value = xfbib_value_new();
+
+ return string;
+}
+
+const gchar *
+xfbib_bibtex_string_get_variable(XfbibBibtexString *string)
+{
+ return xfbib_strbuf_get_str(string->variable);
+}
+
+void
+xfbib_bibtex_string_set_variable(XfbibBibtexString *string, const gchar *variable)
+{
+ xfbib_strbuf_wipe(string->variable);
+ xfbib_strbuf_append(string->variable, variable);
+}
+
+gboolean
+xfbib_bibtex_string_parse(XfbibBibtexString *string, const gchar *str)
+{
+ gchar **split = NULL, *tmp;
+
+ split = g_strsplit(str, "=", 2);
+
+ if (split[1] == NULL) {
+ /* Equal sign missing */
+ g_warning("No equal sign found in definition of String\n");
+ g_strfreev(split);
+ return FALSE;
+ }
+
+ /* Variable */
+ xfbib_strbuf_wipe(string->variable);
+ g_strstrip(split[0] + 7);
+ xfbib_strbuf_append(string->variable, split[0] + 8);
+
+ /* Value */
+ tmp = g_strndup(split[1], strlen(split[1]) - 1);
+ if (!xfbib_value_parse(string->value, tmp)) {
+ free(tmp);
+ g_strfreev(split);
+ return FALSE;
+ }
+ free(tmp);
+
+ g_strfreev(split);
+ return TRUE;
+}
Property changes on: xfbib/branches/gobject/src/xfbib-bibtex-string.c
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: xfbib/branches/gobject/src/xfbib-bibtex-string.h (from rev 5543, xfbib/branches/gobject/src/xfbib-string.h)
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-string.h (rev 0)
+++ xfbib/branches/gobject/src/xfbib-bibtex-string.h 2008-10-10 08:13:49 UTC (rev 5554)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2008 Jesper Karlsson & David Gustafsson
+ * All rights reserved.
+ *
+ * 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 2 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFBIB_BIBTEX_STRING_H
+#define __XFBIB_BIBTEX_STRING_H
+
+#include <glib-object.h>
+
+#define XFBIB_TYPE_BIBTEX_STRING (xfbib_bibtex_string_get_type())
+#define XFBIB_BIBTEX_STRING(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFBIB_TYPE_BIBTEX_STRING, XfbibBibtexString))
+#define XFBIB_IS_BIBTEX_STRING(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFBIB_TYPE_BIBTEX_STRING))
+#define XFBIB_BIBTEX_STRING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFBIB_TYPE_BIBTEX_STRING, XfbibBibtexStringClass))
+#define XFBIB_IS_BIBTEX_STRING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFBIB_TYPE_BIBTEX_STRING))
+#define XFBIB_BIBTEX_STRING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFBIB_TYPE_BIBTEX_STRING, XfbibBibtexStringClass))
+
+G_BEGIN_DECLS
+
+typedef struct _XfbibBibtexString XfbibBibtexString;
+
+GType xfbib_bibtex_string_get_type() G_GNUC_CONST;
+
+XfbibBibtexString *xfbib_bibtex_string_new();
+const gchar *xfbib_bibtex_string_get_variable(XfbibBibtexString *);
+void xfbib_bibtex_string_set_variable(XfbibBibtexString *, const gchar *);
+gboolean xfbib_bibtex_string_parse(XfbibBibtexString *, const gchar *);
+
+G_END_DECLS
+
+#endif //__XFBIB_BIBTEX_STRING_H
+
Property changes on: xfbib/branches/gobject/src/xfbib-bibtex-string.h
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: xfbib/branches/gobject/src/xfbib-comment.c
Deleted: xfbib/branches/gobject/src/xfbib-comment.h
Modified: xfbib/branches/gobject/src/xfbib-elements.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-elements.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/src/xfbib-elements.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -7,9 +7,9 @@
#include "xfbib-elements.h"
#include "xfbib-entry.h"
#include "xfbib-strbuf.h"
-#include "xfbib-comment.h"
-#include "xfbib-preamble.h"
-#include "xfbib-string.h"
+#include "xfbib-bibtex-comment.h"
+#include "xfbib-bibtex-preamble.h"
+#include "xfbib-bibtex-string.h"
#define CURLY_BRACKET 0
@@ -69,7 +69,7 @@
{
gint brackets;
gchar bracket_type;
-
+
while (str[(*i)] != '{' && str[(*i)] != '(') {
xfbib_strbuf_append_char(buf, str[(*i)]);
(*i)++;
@@ -128,34 +128,34 @@
if (str[i] == '@') {
if (xfbib_strbuf_len(buf) > 0) {
/* The comment ended put it in the list */
- obj = G_OBJECT(xfbib_comment_new(xfbib_strbuf_get_str(buf)));
+ obj = G_OBJECT(xfbib_bibtex_comment_new(xfbib_strbuf_get_str(buf)));
elements->list = g_list_append(elements->list, obj);
xfbib_strbuf_wipe(buf);
}
if (g_ascii_strncasecmp(&str[i], "@comment", 8) == 0) {
/* Comment */
- for (; str[i] != '\n'; i++)
+ for (; str[i] != '\n'; i++)
xfbib_strbuf_append_char(buf, str[i]);
- /* Dont forget the newline character */
+ /* Dont forget the newline character */
xfbib_strbuf_append_char(buf, str[i]);
-
- obj = G_OBJECT(xfbib_comment_new(xfbib_strbuf_get_str(buf)));
+
+ obj = G_OBJECT(xfbib_bibtex_comment_new(xfbib_strbuf_get_str(buf)));
elements->list = g_list_append(elements->list, obj);
xfbib_strbuf_wipe(buf);
} else if (g_ascii_strncasecmp(&str[i], "@preamble", 9) == 0) {
/* Preamble */
if (parse_balanced_brackets(buf, str, &i)) {
- obj = G_OBJECT(xfbib_preamble_new());
- if (xfbib_preamble_parse(XFBIB_PREAMBLE(obj), xfbib_strbuf_get_str(buf)))
+ obj = G_OBJECT(xfbib_bibtex_preamble_new());
+ if (xfbib_bibtex_preamble_parse(XFBIB_BIBTEX_PREAMBLE(obj), xfbib_strbuf_get_str(buf)))
elements->list = g_list_append(elements->list, obj);
}
xfbib_strbuf_wipe(buf);
} else if (g_ascii_strncasecmp(&str[i], "@string", 7) == 0) {
/* String */
if (parse_balanced_brackets(buf, str, &i)) {
- obj = G_OBJECT(xfbib_string_new());
- if (xfbib_string_parse(XFBIB_STRING(obj), xfbib_strbuf_get_str(buf)))
+ obj = G_OBJECT(xfbib_bibtex_string_new());
+ if (xfbib_bibtex_string_parse(XFBIB_BIBTEX_STRING(obj), xfbib_strbuf_get_str(buf)))
elements->list = g_list_append(elements->list, obj);
}
xfbib_strbuf_wipe(buf);
@@ -214,7 +214,7 @@
gint i, len, found;
g_return_val_if_fail(XFBIB_IS_ELEMENTS(elements)
&& n < elements->n_entries, NULL);
-
+
len = g_list_length(elements->list);
for (i = 0, found = -1; i < len; i++) {
obj = g_list_nth_data(elements->list, i);
@@ -274,16 +274,16 @@
GObject *obj;
gint i, len;
g_return_if_fail(XFBIB_IS_ELEMENTS(elements));
-
+
len = g_list_length(elements->list);
for (i = 0; i < len; i++) {
if ((obj = g_list_nth_data(elements->list, i)) == data) {
elements->list = g_list_remove(elements->list, obj);
- if(XFBIB_IS_ENTRY(obj))
+ if(XFBIB_IS_ENTRY(obj))
elements->n_entries--;
g_object_unref(obj);
}
- }
+ }
}
void
Modified: xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -26,7 +26,7 @@
#include "xfbib-entry-edit-dialog.h"
#include "xfbib-multiple-input.h"
-#include "xfbib-field.h"
+#include "xfbib-bibtex-field.h"
#include "xfbib-strbuf.h"
#include "xfbib-entry.h"
@@ -35,30 +35,30 @@
gchar *tooltip;
}xfbib_input_constants[] = {
{"Address", "Address of publisher"},
- {"Annote", "Annotation for annotated bibliography styles"},
- {"Author", "Name(s) of the author(s), separated by 'and' if more than one"},
- {"Booktitle", "Title of the book, if only part of it is being cited"},
- {"Chapter", "Chapter number"},
- {"Crossref", "Citation key of the cross-referenced entry"},
- {"Edition", "Edition of the book (such as \"first\" or \"second\")"},
- {"Editor", "Name(s) of the editor(s), separated by 'and' if more than one"},
- {"E-print", "Specification of electronic publication"},
- {"HowPublished", "Publishing method if the method is nonstandard"},
- {"Institution", "Institution that was involved in the publishing"},
- {"Journal", "Journal or magazine in which the work was published"},
- {"Key", "Hidden field used for specifying or overriding the alphabetical order of entries"},
- {"Month", "Month of publication or creation if unpublished"},
- {"Note", "Miscellaneous extra information"},
- {"Number", "Number of journal, magazine, or tech-report"},
- {"Organization", "Sponsor of the conference"},
- {"Pages", "Page numbers separated by commas or double-hyphens"},
- {"Publisher", "Name of publisher"},
- {"School", "School where thesis was written"},
- {"Series", "Series of books in which the book was published"},
- {"Title", "Title of the work"},
- {"Type", "Type of technical report"},
- {"URL", "Internet address"},
- {"Volume", "Number of the volume"},
+ {"Annote", "Annotation for annotated bibliography styles"},
+ {"Author", "Name(s) of the author(s), separated by 'and' if more than one"},
+ {"Booktitle", "Title of the book, if only part of it is being cited"},
+ {"Chapter", "Chapter number"},
+ {"Crossref", "Citation key of the cross-referenced entry"},
+ {"Edition", "Edition of the book (such as \"first\" or \"second\")"},
+ {"Editor", "Name(s) of the editor(s), separated by 'and' if more than one"},
+ {"E-print", "Specification of electronic publication"},
+ {"HowPublished", "Publishing method if the method is nonstandard"},
+ {"Institution", "Institution that was involved in the publishing"},
+ {"Journal", "Journal or magazine in which the work was published"},
+ {"Key", "Hidden field used for specifying or overriding the alphabetical order of entries"},
+ {"Month", "Month of publication or creation if unpublished"},
+ {"Note", "Miscellaneous extra information"},
+ {"Number", "Number of journal, magazine, or tech-report"},
+ {"Organization", "Sponsor of the conference"},
+ {"Pages", "Page numbers separated by commas or double-hyphens"},
+ {"Publisher", "Name of publisher"},
+ {"School", "School where thesis was written"},
+ {"Series", "Series of books in which the book was published"},
+ {"Title", "Title of the work"},
+ {"Type", "Type of technical report"},
+ {"URL", "Internet address"},
+ {"Volume", "Number of the volume"},
{"Year", "Year of publication or creation if unpublished"}
};
@@ -154,7 +154,7 @@
xfbib_strbuf_append(path, DATADIR);
xfbib_strbuf_append(path, "/pixmaps/xfbib/");
xfbib_strbuf_append(path, filename);
-
+
/* TODO: Fix the error handling */
pixbuf = gdk_pixbuf_new_from_file(xfbib_strbuf_get_str(path),NULL);
@@ -189,14 +189,14 @@
return type;
}
-
+
static void
xfbib_entry_edit_dialog_class_init(XfbibEntryEditDialogClass *klass)
{
GObjectClass *object_class = (GObjectClass *)klass;
-
- xfbib_entry_edit_dialog_parent_class = g_type_class_peek_parent (klass);
+ xfbib_entry_edit_dialog_parent_class = g_type_class_peek_parent (klass);
+
object_class->finalize = xfbib_entry_edit_dialog_finalize;
}
@@ -205,7 +205,7 @@
{
gint i, row[5] = {0, 0, 0, 0, 0}, box;
GtkWidget *top_box;
-
+
instance->type_label = gtk_label_new("Type:");
instance->type_combo_box = gtk_combo_box_new_text();
for (i = 0; xfbib_type_constants[i].text != NULL; i++) {
@@ -229,9 +229,9 @@
gtk_box_pack_end(GTK_BOX(top_box), instance->key_button, FALSE, FALSE, 0);
gtk_box_pack_end(GTK_BOX(top_box), instance->key_entry, TRUE, TRUE, 0);
gtk_box_pack_end(GTK_BOX(top_box), instance->key_label, FALSE, FALSE, 0);
-
+
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (instance)->vbox), top_box, FALSE, FALSE, 0);
-
+
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(instance)->vbox), 0); // 0 due to top_box border width
for (i = 0; i < 5; i++) {
@@ -316,9 +316,9 @@
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (instance->notebook), GTK_POS_TOP);
gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[0], gtk_label_new("Title"));
gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[1], gtk_label_new("Author/Editor"));
- gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[2], gtk_label_new("Publication"));
- gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[3], gtk_label_new("Publisher"));
- gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[4], gtk_label_new("Misc"));
+ gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[2], gtk_label_new("Publication"));
+ gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[3], gtk_label_new("Publisher"));
+ gtk_notebook_append_page (GTK_NOTEBOOK (instance->notebook), instance->note_boxes[4], gtk_label_new("Misc"));
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (instance)->vbox), instance->notebook, TRUE, TRUE, 0);
@@ -340,7 +340,7 @@
GtkWidget *
xfbib_entry_edit_dialog_new(XfbibEntry *entry)
{
- XfbibField *field;
+ XfbibBibtexField *field;
const gchar *bibtype;
int n;
@@ -369,9 +369,9 @@
continue;
}
if (n == XFBIB_FIELD_AUTHOR || n == XFBIB_FIELD_EDITOR) {
- xfbib_multiple_input_set_text (XFBIB_MULTIPLE_INPUT (entry_edit_dialog->inputs[n]), xfbib_field_get_value_str(field));
+ xfbib_multiple_input_set_text (XFBIB_MULTIPLE_INPUT (entry_edit_dialog->inputs[n]), xfbib_bibtex_field_get_value_str(field));
} else {
- gtk_entry_set_text(GTK_ENTRY (entry_edit_dialog->inputs[n]), xfbib_field_get_value_str(field));
+ gtk_entry_set_text(GTK_ENTRY (entry_edit_dialog->inputs[n]), xfbib_bibtex_field_get_value_str(field));
}
}
}
@@ -383,7 +383,7 @@
xfbib_entry_edit_dialog_get_entry(XfbibEntryEditDialog *entry_edit_dialog)
{
XfbibEntry *entry;
- XfbibField *field;
+ XfbibBibtexField *field;
GList *field_list;
XfbibValue *value;
int n;
@@ -397,22 +397,22 @@
continue;
}
/* TODO: check if they are integers or strings(variables), don't assume text */
- field = xfbib_field_new();
- xfbib_field_set_variable(field, xfbib_input_constants[n].label);
+ field = xfbib_bibtex_field_new();
+ xfbib_bibtex_field_set_variable(field, xfbib_input_constants[n].label);
value = xfbib_value_new();
xfbib_value_set_str(value, xfbib_multiple_input_get_str(XFBIB_MULTIPLE_INPUT(entry_edit_dialog->inputs[n])));
- xfbib_field_set_value(field, value);
+ xfbib_bibtex_field_set_value(field, value);
field_list = g_list_append(field_list, field);
} else {
if(gtk_entry_get_text(GTK_ENTRY(entry_edit_dialog->inputs[n])) == "") {
continue;
}
/* TODO: check if they are integers or strings(variables), don't assume text */
- field = xfbib_field_new();
- xfbib_field_set_variable(field, xfbib_input_constants[n].label);
+ field = xfbib_bibtex_field_new();
+ xfbib_bibtex_field_set_variable(field, xfbib_input_constants[n].label);
value = xfbib_value_new();
xfbib_value_set_str(value, gtk_entry_get_text(GTK_ENTRY(entry_edit_dialog->inputs[n])));
- xfbib_field_set_value(field, value);
+ xfbib_bibtex_field_set_value(field, value);
field_list = g_list_append(field_list, field);
}
}
Modified: xfbib/branches/gobject/src/xfbib-entry.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-entry.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/src/xfbib-entry.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -25,7 +25,7 @@
#include <libxfce4util/libxfce4util.h>
#include "xfbib-entry.h"
-#include "xfbib-field.h"
+#include "xfbib-bibtex-field.h"
#include "xfbib-strbuf.h"
struct _XfbibEntry
@@ -87,9 +87,9 @@
{
gchar *tmp;
XfbibStrbuf *buf;
- XfbibField *field;
+ XfbibBibtexField *field;
gint i, brackets, quotes;
-
+
DBG("str = %s", str);
/* Dont copy the last bracket */
@@ -98,7 +98,7 @@
/* Parse entry type */
for (i = 0; i < strlen(tmp) && tmp[i] != '{' && tmp[i] != '('; i++)
xfbib_strbuf_append_char(entry->bibtype, tmp[i]);
-
+
if (i == strlen(tmp)) {
return FALSE;
}
@@ -111,8 +111,8 @@
for (i++, brackets = 0, quotes = 0; i < strlen(tmp); i++) {
if (tmp[i] == ',' && brackets == 0 && quotes%2 == 0) {
- field = xfbib_field_new();
- if (!xfbib_field_parse(field, xfbib_strbuf_get_str(buf)))
+ field = xfbib_bibtex_field_new();
+ if (!xfbib_bibtex_field_parse(field, xfbib_strbuf_get_str(buf)))
return FALSE;
entry->fields = g_list_append(entry->fields, field);
xfbib_strbuf_wipe(buf);
@@ -126,7 +126,7 @@
}
xfbib_strbuf_append_char(buf, tmp[i]);
}
-
+
/* When the last row has a comma their will be nothing here to parse */
for (i = 0; i < xfbib_strbuf_len(buf); i++) {
if(!g_ascii_isspace(xfbib_strbuf_get_nth_char(buf, i)))
@@ -134,8 +134,8 @@
}
if (i < xfbib_strbuf_len(buf)) {
- field = xfbib_field_new();
- if (!xfbib_field_parse(field, xfbib_strbuf_get_str(buf)))
+ field = xfbib_bibtex_field_new();
+ if (!xfbib_bibtex_field_parse(field, xfbib_strbuf_get_str(buf)))
return FALSE;
entry->fields = g_list_append(entry->fields, field);
}
@@ -146,16 +146,16 @@
return TRUE;
}
-XfbibField *
+XfbibBibtexField *
xfbib_entry_get_field_by_column(XfbibEntry *entry, gint column)
{
- XfbibField *field;
+ XfbibBibtexField *field;
gint i;
g_return_val_if_fail(XFBIB_IS_ENTRY(entry), NULL);
-
+
for (i = 0; i < g_list_length(entry->fields); i++) {
field = g_list_nth_data(entry->fields, i);
- if (xfbib_field_is_column(field, column)) {
+ if (xfbib_bibtex_field_is_column(field, column)) {
return field;
}
}
Modified: xfbib/branches/gobject/src/xfbib-entry.h
===================================================================
--- xfbib/branches/gobject/src/xfbib-entry.h 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/src/xfbib-entry.h 2008-10-10 08:13:49 UTC (rev 5554)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -21,7 +21,7 @@
#define __XFBIB_ENTRY_H
#include <glib-object.h>
-#include "xfbib-field.h"
+#include "xfbib-bibtex-field.h"
#include "xfbib-strbuf.h"
#define XFBIB_TYPE_ENTRY (xfbib_entry_get_type())
@@ -39,7 +39,7 @@
XfbibEntry *xfbib_entry_new();
gboolean xfbib_entry_parse(XfbibEntry *, const gchar *);
-XfbibField *xfbib_entry_get_field_by_column(XfbibEntry *, gint);
+XfbibBibtexField *xfbib_entry_get_field_by_column(XfbibEntry *, gint);
XfbibStrbuf *xfbib_entry_get_bibtype(XfbibEntry *);
XfbibStrbuf *xfbib_entry_get_key(XfbibEntry *);
void xfbib_entry_set_key(XfbibEntry *, const gchar *);
Deleted: xfbib/branches/gobject/src/xfbib-field.c
Deleted: xfbib/branches/gobject/src/xfbib-field.h
Modified: xfbib/branches/gobject/src/xfbib-list-store.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-list-store.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/src/xfbib-list-store.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -26,11 +26,11 @@
#include "xfbib-list-store.h"
#include "xfbib-state.h"
#include "xfbib-elements.h"
-#include "xfbib-comment.h"
+#include "xfbib-bibtex-comment.h"
#include "xfbib-entry.h"
-#include "xfbib-field.h"
-#include "xfbib-preamble.h"
-#include "xfbib-string.h"
+#include "xfbib-bibtex-field.h"
+#include "xfbib-bibtex-preamble.h"
+#include "xfbib-bibtex-string.h"
enum {
TYPE_ENTRY,
@@ -97,7 +97,7 @@
};
type = g_type_register_static (G_TYPE_OBJECT, "XfbibListStore", &info, 0);
-
+
/* Register the GtkListStore interface */
g_type_add_interface_static (type, GTK_TYPE_TREE_MODEL, &tree_model_info);
}
@@ -108,9 +108,9 @@
xfbib_list_store_class_init(XfbibListStoreClass *klass)
{
GObjectClass *object_class = (GObjectClass *)klass;
-
- xfbib_list_store_parent_class = g_type_class_peek_parent (klass);
+ xfbib_list_store_parent_class = g_type_class_peek_parent (klass);
+
object_class->finalize = xfbib_list_store_finalize;
}
@@ -174,7 +174,7 @@
{
XfbibListStore *list_store;
g_return_val_if_fail((XFBIB_IS_LIST_STORE(tree_model) || index >= 0), G_TYPE_INVALID);
-
+
list_store = XFBIB_LIST_STORE(tree_model);
switch (list_store->type) {
case TYPE_ENTRY:
@@ -184,7 +184,7 @@
return G_TYPE_STRING;
default:
return G_TYPE_INVALID;
- }
+ }
}
static gboolean
@@ -200,7 +200,7 @@
elements = xfbib_state_get_bibtex_elements(list_store->state);
n = gtk_tree_path_get_indices(path)[0];
-
+
switch (list_store->type) {
case TYPE_ENTRY:
if (n >= xfbib_elements_get_n_entries(elements))
@@ -248,37 +248,37 @@
return path;
}
-static void
+static void
xfbib_list_store_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value)
{
XfbibListStore *list_store;
- XfbibField *field;
+ XfbibBibtexField *field;
g_return_if_fail(XFBIB_IS_LIST_STORE(tree_model));
-
+
list_store = XFBIB_LIST_STORE(tree_model);
if (list_store->stamp != iter->stamp)
return;
-
+
g_value_init (value, G_TYPE_STRING);
switch (list_store->type) {
case TYPE_ENTRY:
g_return_if_fail(column < XFBIB_FIELD_N_FIELDS
&& XFBIB_IS_ENTRY(iter->user_data));
-
+
field = xfbib_entry_get_field_by_column(XFBIB_ENTRY(iter->user_data), column);
if (field == NULL)
return;
- g_value_set_string(value, xfbib_field_get_value_str(field));
+ g_value_set_string(value, xfbib_bibtex_field_get_value_str(field));
break;
default:
- return;
+ return;
}
}
-static gboolean
+static gboolean
xfbib_list_store_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter)
{
XfbibListStore *list_store;
@@ -291,7 +291,7 @@
elements = xfbib_state_get_bibtex_elements(list_store->state);
g_return_val_if_fail(list_store->stamp == iter->stamp, FALSE);
-
+
if (iter == NULL || iter->user_data == NULL)
return FALSE;
@@ -305,12 +305,12 @@
iter->user_data = next;
break;
default:
- return FALSE;
+ return FALSE;
}
return TRUE;
}
-static gboolean
+static gboolean
xfbib_list_store_iter_children (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent)
{
XfbibListStore *list_store;
@@ -329,29 +329,29 @@
case TYPE_ENTRY:
if (xfbib_elements_get_n_entries(elements) == 0)
return FALSE;
-
+
iter->stamp = list_store->stamp;
if ((iter->user_data = xfbib_elements_get_nth_entry(elements, 0)) == NULL)
return FALSE;
break;
default:
- return FALSE;
- }
+ return FALSE;
+ }
return TRUE;
}
-static gboolean
+static gboolean
xfbib_list_store_iter_has_child (GtkTreeModel *tree_model, GtkTreeIter *iter)
{
return FALSE;
}
-static gint
+static gint
xfbib_list_store_iter_n_children (GtkTreeModel *tree_model, GtkTreeIter *iter)
{
XfbibListStore *list_store;
XfbibElements *elements;
-
+
g_return_val_if_fail(XFBIB_IS_LIST_STORE(tree_model), -1);
list_store = XFBIB_LIST_STORE(tree_model);
@@ -363,12 +363,12 @@
return xfbib_elements_get_n_entries(elements);
break;
default:
- return -1;
+ return -1;
}
return 0;
}
-static gboolean
+static gboolean
xfbib_list_store_iter_nth_child (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n)
{
XfbibListStore *list_store;
@@ -387,18 +387,18 @@
case TYPE_ENTRY:
if (n >= xfbib_elements_get_n_entries(elements))
return FALSE;
-
+
iter->stamp = list_store->stamp;
if ((iter->user_data = xfbib_elements_get_nth_entry(elements, n)) == NULL)
return FALSE;
break;
default:
- return FALSE;
+ return FALSE;
}
return TRUE;
}
-static gboolean
+static gboolean
xfbib_list_store_iter_parent (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child)
{
return FALSE;
@@ -418,8 +418,8 @@
* @list_store: A #GtkListStore
* @iter: A valid #GtkTreeIter
*
- * Removes the given row from the list store. After being removed,
- * @iter is set to be the next valid row, or invalidated if it pointed
+ * Removes the given row from the list store. After being removed,
+ * @iter is set to be the next valid row, or invalidated if it pointed
* to the last row in @list_store.
*
* Return value: %TRUE if @iter is valid, %FALSE if not.
@@ -498,7 +498,7 @@
* gtk_list_store_clear:
* @list_store: a #GtkListStore.
*
- * Removes all rows from the list store.
+ * Removes all rows from the list store.
*
**/
void
@@ -526,7 +526,7 @@
elements = xfbib_state_get_bibtex_elements(list_store->state);
-
+
while (xfbib_elements_get_n_entries(elements) > 0) {
iter.stamp = list_store->stamp;
iter.user_data = xfbib_elements_get_nth_entry(elements, 0);
@@ -563,6 +563,6 @@
g_return_val_if_fail(XFBIB_IS_LIST_STORE (list_store), NULL);
g_return_val_if_fail(list_store->stamp == iter->stamp, NULL);
g_return_val_if_fail(iter->user_data != NULL, NULL);
-
+
return XFBIB_ENTRY(iter->user_data);
}
Modified: xfbib/branches/gobject/src/xfbib-menu-bar.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-menu-bar.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/src/xfbib-menu-bar.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -27,7 +27,7 @@
#include "xfbib-entry-edit-dialog.h"
#include "xfbib-menu-bar.h"
-#include "xfbib-field.h"
+#include "xfbib-bibtex-field.h"
#include "xfbib-elements.h"
#include "xfbib-file-io.h"
#include "xfbib-state.h"
@@ -105,7 +105,7 @@
GtkWidget *dialog;
g_printf("Entry/Add\n");
dialog = xfbib_entry_edit_dialog_new(NULL);
-
+
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
/* TODO: Save the entry */
}
@@ -121,7 +121,7 @@
GtkTreeModel *model;
GtkTreeIter iter;
g_printf("Entry/Remove\n");
-
+
state = xfbib_state_new();
tree_view = GTK_WIDGET(xfbib_window_get_tree_view(XFBIB_WINDOW(xfbib_state_get_window(state))));
@@ -145,15 +145,15 @@
GtkTreeIter iter;
GtkTreePath *path;
g_printf("Entry/Edit\n");
-
+
state = xfbib_state_new();
tree_view = GTK_WIDGET(xfbib_window_get_tree_view(XFBIB_WINDOW(xfbib_state_get_window(state))));
/* This will only work in single or browse selection mode! */
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
- /*
- * Get the XfbibEntry pointer and pass it to the
+ /*
+ * Get the XfbibEntry pointer and pass it to the
* entry edit dialog
*/
entry = xfbib_list_store_get_entry(model, &iter);
@@ -234,9 +234,9 @@
xfbib_menu_bar_class_init(XfbibMenuBarClass *klass)
{
GObjectClass *object_class = (GObjectClass *)klass;
-
- xfbib_menu_bar_parent_class = g_type_class_peek_parent (klass);
+ xfbib_menu_bar_parent_class = g_type_class_peek_parent (klass);
+
object_class->finalize = xfbib_menu_bar_finalize;
}
@@ -257,25 +257,25 @@
gtk_menu_shell_append(GTK_MENU_SHELL(instance->file), item);
g_signal_connect_swapped (G_OBJECT (item), "activate",
G_CALLBACK (cb_file_new_activate), "new");
-
+
/* Open */
item = gtk_image_menu_item_new_from_stock(GTK_STOCK_OPEN, accel);
gtk_menu_shell_append(GTK_MENU_SHELL(instance->file), item);
g_signal_connect (G_OBJECT (item), "activate",
G_CALLBACK (cb_file_open_activate), NULL);
-
+
/* Save */
item = gtk_image_menu_item_new_from_stock(GTK_STOCK_SAVE, accel);
gtk_menu_shell_append(GTK_MENU_SHELL(instance->file), item);
g_signal_connect_swapped (G_OBJECT (item), "activate",
G_CALLBACK (cb_file_save_activate), "save");
-
+
/* Save as */
item = gtk_image_menu_item_new_from_stock(GTK_STOCK_SAVE_AS, accel);
gtk_menu_shell_append(GTK_MENU_SHELL(instance->file), item);
g_signal_connect_swapped (G_OBJECT (item), "activate",
G_CALLBACK (cb_file_save_as_activate), "save_as");
-
+
/* Quit */
item = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, accel);
gtk_menu_shell_append(GTK_MENU_SHELL(instance->file), item);
@@ -305,8 +305,8 @@
gtk_menu_shell_append(GTK_MENU_SHELL(instance->entry), item);
g_signal_connect_swapped (G_OBJECT (item), "activate",
G_CALLBACK (cb_entry_edit_activate), instance);
-
+
item = gtk_menu_item_new_with_label("Entry");
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), instance->entry);
gtk_menu_shell_append(GTK_MENU_SHELL(instance), item);
@@ -351,10 +351,10 @@
item = gtk_check_menu_item_new_with_mnemonic("Show Toolbar");
gtk_menu_shell_append(GTK_MENU_SHELL (instance->view), item);
-
+
item = gtk_check_menu_item_new_with_mnemonic("Show Status Bar");
gtk_menu_shell_append(GTK_MENU_SHELL (instance->view), item);
-
+
item = gtk_menu_item_new_with_label("View");
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), instance->view);
gtk_menu_shell_append(GTK_MENU_SHELL(instance), item);
Deleted: xfbib/branches/gobject/src/xfbib-preamble.c
Deleted: xfbib/branches/gobject/src/xfbib-preamble.h
Deleted: xfbib/branches/gobject/src/xfbib-string.c
Deleted: xfbib/branches/gobject/src/xfbib-string.h
Modified: xfbib/branches/gobject/src/xfbib-value.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-value.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/src/xfbib-value.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -6,7 +6,7 @@
#include "xfbib-value.h"
#include "xfbib-strbuf.h"
-#include "xfbib-string.h"
+#include "xfbib-bibtex-string.h"
#include "xfbib-integer.h"
@@ -81,7 +81,7 @@
g_strstrip(split[i]);
if (split[i][0] == '"' || split[i][0] == '{') {
/* String */
-
+
len = strlen(split[i]);
if (split[i][0] == '"' && split[i][len - 1] != '"')
@@ -94,7 +94,7 @@
g_warning("Braced string contains @: %s\n", split[i]);
return FALSE;
}
-
+
braces = 0;
len = strlen(split[i]) - 1;
for (j = 1; j < len; j++) {
@@ -107,27 +107,27 @@
g_warning("Quote not inside braces in string: %s\n", split[i]);
return FALSE;
}
- }
-
+ }
+
if (braces != 0) {
/* Braces was not balanced */
g_warning("Braces not balanced in field string: %s\n", split[i]);
return FALSE;
}
-
+
obj = G_OBJECT(xfbib_strbuf_new());
xfbib_strbuf_append(XFBIB_STRBUF(obj), split[i]);
value->list = g_list_prepend(value->list, obj);
} else if(g_ascii_isalpha(split[i][0])) {
/* Variable */
-
+
if (strstr(split[i], "\"") != NULL) {
g_warning("Variable contains double quote\n");
return FALSE;
}
-
- obj = G_OBJECT(xfbib_string_new());
- xfbib_string_set_variable(XFBIB_STRING(obj), split[i]);
+
+ obj = G_OBJECT(xfbib_bibtex_string_new());
+ xfbib_bibtex_string_set_variable(XFBIB_BIBTEX_STRING(obj), split[i]);
value->list = g_list_prepend(value->list, obj);
} else {
len = strlen(split[i]);
@@ -144,7 +144,7 @@
value->list = g_list_prepend(value->list, obj);
}
}
-
+
g_strfreev(split);
@@ -158,15 +158,15 @@
GObject *obj;
if (g_list_length(value->list) == 1) {
obj = g_list_nth_data(value->list, 0);
- if (XFBIB_IS_STRING(obj)) {
+ if (XFBIB_IS_BIBTEX_STRING(obj)) {
/* Variable */
- return "TODO: Variable";
+ return "TODO: Variable";
} else if (XFBIB_IS_STRBUF(obj)) {
/* Regular string */
return xfbib_strbuf_get_str(XFBIB_STRBUF(obj));
} else if (XFBIB_IS_INTEGER(obj)) {
/* Integer value */
- return "TODO: Integer";
+ return "TODO: Integer";
}
} else {
return "Compund string";
Modified: xfbib/branches/gobject/tests/Makefile.am
===================================================================
--- xfbib/branches/gobject/tests/Makefile.am 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/tests/Makefile.am 2008-10-10 08:13:49 UTC (rev 5554)
@@ -36,7 +36,7 @@
$(top_builddir)/src/xfbib-xfbib-value.o \
$(top_builddir)/src/xfbib-xfbib-entry.o \
$(top_builddir)/src/xfbib-xfbib-field.o \
- $(top_builddir)/src/xfbib-xfbib-comment.o \
+ $(top_builddir)/src/xfbib-xfbib-bibtex-comment.o \
$(top_builddir)/src/xfbib-xfbib-preamble.o \
$(top_builddir)/src/xfbib-xfbib-state.o \
$(top_builddir)/src/xfbib-xfbib-strbuf.o
@@ -60,7 +60,7 @@
$(top_builddir)/src/xfbib-xfbib-value.o \
$(top_builddir)/src/xfbib-xfbib-entry.o \
$(top_builddir)/src/xfbib-xfbib-field.o \
- $(top_builddir)/src/xfbib-xfbib-comment.o \
+ $(top_builddir)/src/xfbib-xfbib-bibtex-comment.o \
$(top_builddir)/src/xfbib-xfbib-preamble.o \
$(top_builddir)/src/xfbib-xfbib-strbuf.o
@@ -75,7 +75,7 @@
test-xfbib-comment.c
test_xfbib_comment_DEPENDENCIES = \
- $(top_builddir)/src/xfbib-xfbib-comment.o \
+ $(top_builddir)/src/xfbib-xfbib-bibtex-comment.o \
$(top_builddir)/src/xfbib-xfbib-strbuf.o
test_xfbib_comment_LDADD = \
Modified: xfbib/branches/gobject/tests/test-xfbib-comment.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-comment.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/tests/test-xfbib-comment.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -27,7 +27,7 @@
XfbibComment *comment;
gtk_init(&argc, &argv);
- comment = xfbib_comment_new("Comment");
+ comment = xfbib_bibtex_comment_new("Comment");
g_object_unref(comment);
Modified: xfbib/branches/gobject/tests/test-xfbib-elements.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-elements.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/tests/test-xfbib-elements.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -90,7 +90,7 @@
g_assert(XFBIB_IS_PREAMBLE(g_list_nth_data(list, 0)));
g_assert(XFBIB_IS_PREAMBLE(g_list_nth_data(list, 1)));
- g_assert(XFBIB_IS_STRING(g_list_nth_data(list, 2)));
+ g_assert(XFBIB_IS_BIBTEX_STRING(g_list_nth_data(list, 2)));
g_assert(XFBIB_IS_PREAMBLE(g_list_nth_data(list, 3)));
g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 4)));
g_assert(XFBIB_IS_COMMENT(g_list_nth_data(list, 5)));
Modified: xfbib/branches/gobject/tests/test-xfbib-entry.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-entry.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/tests/test-xfbib-entry.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -27,7 +27,7 @@
{
/*
XfbibEntry *entry;
- XfbibField *field;
+ XfbibBibtexField *field;
GList *field_list;
gtk_init(&argc, &argv);
@@ -43,15 +43,15 @@
field_list = xfbib_entry_get_fields(entry);
- field = XFBIB_FIELD(g_list_nth_data(field_list, 0));
+ field = XFBIB_BIBTEX_FIELD(g_list_nth_data(field_list, 0));
g_assert(strcmp(xfbib_field_get_varname(field), "author") == 0);
g_assert(strcmp(xfbib_field_get_value(field), "Oren Patashnik") == 0);
- field = XFBIB_FIELD(g_list_nth_data(field_list, 1));
+ field = XFBIB_BIBTEX_FIELD(g_list_nth_data(field_list, 1));
g_assert(strcmp(xfbib_field_get_varname(field), "title") == 0);
g_assert(strcmp(xfbib_field_get_value(field), "BIBTEXing") == 0);
- field = XFBIB_FIELD(g_list_nth_data(field_list, 2));
+ field = XFBIB_BIBTEX_FIELD(g_list_nth_data(field_list, 2));
g_assert(strcmp(xfbib_field_get_varname(field), "year") == 0);
g_assert(strcmp(xfbib_field_get_value(field), "1988") == 0);
Modified: xfbib/branches/gobject/tests/test-xfbib-field.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-field.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/tests/test-xfbib-field.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -25,29 +25,29 @@
int main(int argc, char **argv)
{
/*
- XfbibField *field;
+ XfbibBibtexField *field;
gtk_init(&argc, &argv);
- field = xfbib_field_new();
+ field = xfbib_bibtex_field_new();
xfbib_field_set_varname(field, "Author");
g_assert(strcmp(xfbib_field_get_variable(field), "Author") == 0);
- xfbib_field_set_value(field, "Foo Bar");
+ xfbib_bibtex_field_set_value(field, "Foo Bar");
g_assert(strcmp(xfbib_field_get_value(field), "Foo Bar") == 0);
g_assert(strcmp(xfbib_field_get_str(field), "Author = \"Foo Bar\"") == 0);
- xfbib_field_parse(field, " author = { Martha Steward }\n");
+ xfbib_bibtex_field_parse(field, " author = { Martha Steward }\n");
g_assert(strcmp(xfbib_field_get_variable(field), "author") == 0);
g_assert(strcmp(xfbib_field_get_value(field), "Martha Steward") == 0);
g_assert(strcmp(xfbib_field_get_str(field), "author = {Martha Steward}") == 0);
- xfbib_field_parse(field, " title = \"Cooking behind bars\"\n");
+ xfbib_bibtex_field_parse(field, " title = \"Cooking behind bars\"\n");
g_assert(strcmp(xfbib_field_get_variable(field), "title") == 0);
g_assert(strcmp(xfbib_field_get_value(field), "Cooking behind bars") == 0);
g_assert(strcmp(xfbib_field_get_str(field), "title = \"Cooking behind bars\"") == 0);
- xfbib_field_parse(field, " year = 2003\n");
+ xfbib_bibtex_field_parse(field, " year = 2003\n");
g_assert(strcmp(xfbib_field_get_variable(field), "year") == 0);
g_assert(strcmp(xfbib_field_get_value(field), "2003") == 0);
g_assert(strcmp(xfbib_field_get_str(field), "year = 2003\n") == 0);
Modified: xfbib/branches/gobject/tests/test-xfbib-preamble.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-preamble.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/tests/test-xfbib-preamble.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -28,15 +28,15 @@
XfbibPreamble *preamble;
gtk_init(&argc, &argv);
- preamble = xfbib_preamble_new();
+ preamble = xfbib_bibtex_preamble_new();
- g_assert(xfbib_preamble_parse(preamble, "@preamble {\"This bibliography was generated on \\today\"}"));
+ g_assert(xfbib_bibtex_preamble_parse(preamble, "@preamble {\"This bibliography was generated on \\today\"}"));
g_assert(strcmp(xfbib_preamble_get_value(preamble), "\"This bibliography was generated on \\today\"") == 0);
- g_assert(xfbib_preamble_parse(preamble, "@preamble (\"This bibliography was generated on \\today\")"));
+ g_assert(xfbib_bibtex_preamble_parse(preamble, "@preamble (\"This bibliography was generated on \\today\")"));
g_assert(strcmp(xfbib_preamble_get_value(preamble), "\"This bibliography was generated on \\today\"") == 0);
- g_assert(xfbib_preamble_parse(preamble, "@preamble { \"Maintained by \" # maintainer }"));
+ g_assert(xfbib_bibtex_preamble_parse(preamble, "@preamble { \"Maintained by \" # maintainer }"));
g_assert(strcmp(xfbib_preamble_get_value(preamble), "\"Maintained by \" # maintainer") == 0);
Modified: xfbib/branches/gobject/tests/test-xfbib-string.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-string.c 2008-10-10 08:05:20 UTC (rev 5553)
+++ xfbib/branches/gobject/tests/test-xfbib-string.c 2008-10-10 08:13:49 UTC (rev 5554)
@@ -25,29 +25,29 @@
int main(int argc, char **argv)
{
/*
- XfbibString *string;
+ XfbibBibtexString *string;
gtk_init(&argc, &argv);
- string = xfbib_string_new();
+ string = xfbib_bibtex_string_new();
- g_assert(xfbib_string_parse(string, "@String(mar = \"march\")"));
- g_assert(strcmp(xfbib_string_get_variable(string), "mar") == 0);
+ g_assert(xfbib_bibtex_string_parse(string, "@String(mar = \"march\")"));
+ g_assert(strcmp(xfbib_bibtex_string_get_variable(string), "mar") == 0);
g_assert(strcmp(xfbib_string_get_value(string), "\"march\"") == 0);
- g_assert(xfbib_string_parse(string, "@String{mar = \"march\"}"));
- g_assert(strcmp(xfbib_string_get_variable(string), "mar") == 0);
+ g_assert(xfbib_bibtex_string_parse(string, "@String{mar = \"march\"}"));
+ g_assert(strcmp(xfbib_bibtex_string_get_variable(string), "mar") == 0);
g_assert(strcmp(xfbib_string_get_value(string), "\"march\"") == 0);
- g_assert(!xfbib_string_parse(string, "@String{mar \"march\"}"));
+ g_assert(!xfbib_bibtex_string_parse(string, "@String{mar \"march\"}"));
- g_assert(!xfbib_string_parse(string, "@String(mar = \"march\",\n"
+ g_assert(!xfbib_bibtex_string_parse(string, "@String(mar = \"march\",\n"
" apr = \"april\")"));
- g_assert(!xfbib_string_parse(string, "@String(mar = \"march)"));
+ g_assert(!xfbib_bibtex_string_parse(string, "@String(mar = \"march)"));
- g_assert(!xfbib_string_parse(string, "@String(mar = march\")"));
+ g_assert(!xfbib_bibtex_string_parse(string, "@String(mar = march\")"));
- g_assert(xfbib_string_parse(string, "@String {email = firstname # \".\" # lastname # \"@imag.fr\"}"));
- g_assert(strcmp(xfbib_string_get_variable(string), "email") == 0);
+ g_assert(xfbib_bibtex_string_parse(string, "@String {email = firstname # \".\" # lastname # \"@imag.fr\"}"));
+ g_assert(strcmp(xfbib_bibtex_string_get_variable(string), "email") == 0);
g_assert(strcmp(xfbib_string_get_value(string), "firstname # \".\" # lastname # \"@imag.fr\"") == 0);
g_object_unref(string);
More information about the Goodies-commits
mailing list