[Goodies-commits] r5625 - in xfbib/branches/gobject: src tests
Jesper Karlsson
zarper at xfce.org
Tue Oct 14 22:58:18 CEST 2008
Author: zarper
Date: 2008-10-14 20:58:18 +0000 (Tue, 14 Oct 2008)
New Revision: 5625
Modified:
xfbib/branches/gobject/src/Makefile.am
xfbib/branches/gobject/src/main.c
xfbib/branches/gobject/src/xfbib-bibtex-entry.c
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-string.c
xfbib/branches/gobject/src/xfbib-bibtex-value.c
xfbib/branches/gobject/src/xfbib-bibtex.c
xfbib/branches/gobject/src/xfbib-bibtex.h
xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c
xfbib/branches/gobject/src/xfbib-entry-edit-dialog.h
xfbib/branches/gobject/src/xfbib-file-io.c
xfbib/branches/gobject/src/xfbib-list-store.c
xfbib/branches/gobject/src/xfbib-list-store.h
xfbib/branches/gobject/src/xfbib-menu-bar.c
xfbib/branches/gobject/src/xfbib-state.c
xfbib/branches/gobject/src/xfbib-state.h
xfbib/branches/gobject/src/xfbib-tree-view.c
xfbib/branches/gobject/src/xfbib-window.h
xfbib/branches/gobject/tests/test-xfbib-elements.c
xfbib/branches/gobject/tests/test-xfbib-entry.c
xfbib/branches/gobject/tests/test-xfbib-value.c
Log:
Continued with the renaming of functions.
Modified: xfbib/branches/gobject/src/Makefile.am
===================================================================
--- xfbib/branches/gobject/src/Makefile.am 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/Makefile.am 2008-10-14 20:58:18 UTC (rev 5625)
@@ -4,10 +4,10 @@
main.c \
xfbib-bibtex-comment.c \
xfbib-bibtex-comment.h \
- xfbib-elements.c \
- xfbib-elements.h \
- xfbib-entry.c \
- xfbib-entry.h \
+ xfbib-bibtex.c \
+ xfbib-bibtex.h \
+ xfbib-bibtex-entry.c \
+ xfbib-bibtex-entry.h \
xfbib-entry-edit-dialog.c \
xfbib-entry-edit-dialog.h \
xfbib-bibtex-field.c \
@@ -40,8 +40,8 @@
xfbib-toolbar.h \
xfbib-tree-view.c \
xfbib-tree-view.h \
- xfbib-value.c \
- xfbib-value.h \
+ xfbib-bibtex-value.c \
+ xfbib-bibtex-value.h \
xfbib-window.c \
xfbib-window.h
Modified: xfbib/branches/gobject/src/main.c
===================================================================
--- xfbib/branches/gobject/src/main.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/main.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <gtk/gtk.h>
-#include "xfbib-elements.h"
+#include "xfbib-bibtex.h"
#include "xfbib-state.h"
#include "xfbib-window.h"
@@ -40,7 +40,7 @@
main (int argc, char **argv)
{
XfbibState *state;
- XfbibElements *elements;
+ XfbibBibtex *elements;
GtkWidget *window;
GError *error = NULL;
gtk_init(&argc, &argv);
@@ -50,20 +50,20 @@
/**/
state = xfbib_state_new();
-
- elements = xfbib_elements_new();
+
+ elements = xfbib_bibtex_new();
xfbib_state_set_bibtex_elements(state, elements);
window = xfbib_window_new();
xfbib_window_set_title(XFBIB_WINDOW(window), NULL);
-
+
g_signal_connect (G_OBJECT(window), "destroy",
G_CALLBACK(cb_window_destroy_event), NULL);
-
+
xfbib_state_set_window(state, window);
gtk_widget_show_all(window);
gtk_main();
-
+
return EXIT_SUCCESS;
}
Modified: xfbib/branches/gobject/src/xfbib-bibtex-entry.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-entry.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-bibtex-entry.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -24,7 +24,7 @@
#include <string.h>
#include <libxfce4util/libxfce4util.h>
-#include "xfbib-entry.h"
+#include "xfbib-bibtex-entry.h"
#include "xfbib-bibtex-field.h"
#include "xfbib-strbuf.h"
Modified: xfbib/branches/gobject/src/xfbib-bibtex-field.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-field.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-bibtex-field.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -24,7 +24,7 @@
#include "xfbib-bibtex-field.h"
#include "xfbib-strbuf.h"
-#include "xfbib-value.h"
+#include "xfbib-bibtex-value.h"
static struct {
gchar *label;
@@ -62,7 +62,7 @@
{
GObject parent;
XfbibStrbuf *variable;
- XfbibValue *value;
+ XfbibBibtexValue *value;
};
typedef struct _XfbibBibtexFieldClass
@@ -88,7 +88,7 @@
xfbib_bibtex_field_init(XfbibBibtexField *instance)
{
instance->variable = xfbib_strbuf_new();
- instance->value = xfbib_value_new();
+ instance->value = xfbib_bibtex_value_new();
}
static void
@@ -125,7 +125,7 @@
xfbib_strbuf_append(field->variable, split[0]);
/* Value */
- if (!xfbib_value_parse(field->value, split[1])) {
+ if (!xfbib_bibtex_value_parse(field->value, split[1])) {
g_strfreev(split);
return FALSE;
}
@@ -147,7 +147,7 @@
const gchar *
xfbib_bibtex_field_get_value_str(XfbibBibtexField *field)
{
- return xfbib_value_get_str(field->value);
+ return xfbib_bibtex_value_get_str(field->value);
}
void
@@ -157,7 +157,7 @@
}
void
-xfbib_bibtex_field_set_value(XfbibBibtexField *field, XfbibValue *value)
+xfbib_bibtex_field_set_value(XfbibBibtexField *field, XfbibBibtexValue *value)
{
if(field->value != NULL) {
free(field->value);
Modified: xfbib/branches/gobject/src/xfbib-bibtex-field.h
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-field.h 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-bibtex-field.h 2008-10-14 20:58:18 UTC (rev 5625)
@@ -21,7 +21,7 @@
#define __XFBIB_BIBTEX_FIELD_H
#include <glib-object.h>
-#include "xfbib-value.h"
+#include "xfbib-bibtex-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))
@@ -71,7 +71,7 @@
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 *);
+void xfbib_bibtex_field_set_value(XfbibBibtexField *, XfbibBibtexValue *);
G_END_DECLS
#endif //__XFBIB_BIBTEX_FIELD_H
Modified: xfbib/branches/gobject/src/xfbib-bibtex-preamble.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-preamble.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-bibtex-preamble.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -24,13 +24,13 @@
#include <gtk/gtk.h>
#include "xfbib-bibtex-preamble.h"
-#include "xfbib-value.h"
+#include "xfbib-bibtex-value.h"
struct _XfbibBibtexPreamble
{
GObject parent;
gchar separator;
- XfbibValue *value;
+ XfbibBibtexValue *value;
};
typedef struct _XfbibBibtexPreambleClass
@@ -55,7 +55,7 @@
static void
xfbib_bibtex_preamble_init(XfbibBibtexPreamble *instance)
{
- instance->value = xfbib_value_new();
+ instance->value = xfbib_bibtex_value_new();
}
static void
@@ -76,14 +76,14 @@
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)) {
+
+ if (!xfbib_bibtex_value_parse(preamble->value, tmp)) {
free(tmp);
free(str);
return FALSE;
Modified: xfbib/branches/gobject/src/xfbib-bibtex-string.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-string.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-bibtex-string.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -25,13 +25,13 @@
#include "xfbib-bibtex-string.h"
#include "xfbib-strbuf.h"
-#include "xfbib-value.h"
+#include "xfbib-bibtex-value.h"
struct _XfbibBibtexString
{
GObject parent;
XfbibStrbuf *variable;
- XfbibValue *value;
+ XfbibBibtexValue *value;
};
typedef struct _XfbibBibtexStringClass
@@ -71,7 +71,7 @@
string = g_object_new(XFBIB_TYPE_BIBTEX_STRING, NULL);
string->variable = xfbib_strbuf_new();
- string->value = xfbib_value_new();
+ string->value = xfbib_bibtex_value_new();
return string;
}
@@ -110,7 +110,7 @@
/* Value */
tmp = g_strndup(split[1], strlen(split[1]) - 1);
- if (!xfbib_value_parse(string->value, tmp)) {
+ if (!xfbib_bibtex_value_parse(string->value, tmp)) {
free(tmp);
g_strfreev(split);
return FALSE;
Modified: xfbib/branches/gobject/src/xfbib-bibtex-value.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex-value.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-bibtex-value.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -4,7 +4,7 @@
#include <gtk/gtk.h>
#include <string.h>
-#include "xfbib-value.h"
+#include "xfbib-bibtex-value.h"
#include "xfbib-strbuf.h"
#include "xfbib-bibtex-string.h"
#include "xfbib-integer.h"
Modified: xfbib/branches/gobject/src/xfbib-bibtex.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-bibtex.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -4,8 +4,8 @@
#include <string.h>
#include <gtk/gtk.h>
-#include "xfbib-elements.h"
-#include "xfbib-entry.h"
+#include "xfbib-bibtex.h"
+#include "xfbib-bibtex-entry.h"
#include "xfbib-strbuf.h"
#include "xfbib-bibtex-comment.h"
#include "xfbib-bibtex-preamble.h"
@@ -162,8 +162,8 @@
} else if (g_regex_match (regex, &str[i], 0, NULL)) {
/* Entry */
if (parse_balanced_brackets(buf, str, &i)) {
- obj = G_OBJECT(xfbib_entry_new());
- if (xfbib_entry_parse(XFBIB_ENTRY(obj), xfbib_strbuf_get_str(buf))) {
+ obj = G_OBJECT(xfbib_bibtex_entry_new());
+ if (xfbib_bibtex_entry_parse(XFBIB_BIBTEX_ENTRY(obj), xfbib_strbuf_get_str(buf))) {
elements->n_entries++;
elements->list = g_list_append(elements->list, obj);
}
@@ -207,7 +207,7 @@
}
-XfbibEntry *
+XfbibBibtexEntry *
xfbib_bibtex_get_nth_entry(XfbibBibtex *elements, gint n)
{
GObject *obj;
@@ -218,9 +218,9 @@
len = g_list_length(elements->list);
for (i = 0, found = -1; i < len; i++) {
obj = g_list_nth_data(elements->list, i);
- if (XFBIB_IS_ENTRY(obj)) {
+ if (XFBIB_IS_BIBTEX_ENTRY(obj)) {
if (++found == n)
- return XFBIB_ENTRY(obj);
+ return XFBIB_BIBTEX_ENTRY(obj);
}
}
return NULL;
@@ -228,7 +228,7 @@
gint
-xfbib_bibtex_get_entry_position(XfbibBibtex *elements, XfbibEntry *entry)
+xfbib_bibtex_get_entry_position(XfbibBibtex *elements, XfbibBibtexEntry *entry)
{
GObject *obj;
gint i, len, n;
@@ -237,17 +237,17 @@
len = g_list_length(elements->list);
for (i = 0, n = -1; i < len; i++) {
obj = g_list_nth_data(elements->list, i);
- if (XFBIB_IS_ENTRY(obj)) {
+ if (XFBIB_IS_BIBTEX_ENTRY(obj)) {
n++;
- if (XFBIB_ENTRY(obj) == entry)
+ if (XFBIB_BIBTEX_ENTRY(obj) == entry)
return n;
}
}
return -1;
}
-XfbibEntry *
-xfbib_bibtex_get_next_entry(XfbibBibtex *elements, XfbibEntry *entry)
+XfbibBibtexEntry *
+xfbib_bibtex_get_next_entry(XfbibBibtex *elements, XfbibBibtexEntry *entry)
{
GObject *obj;
gint i, len;
@@ -259,8 +259,8 @@
if (obj == G_OBJECT(entry)) {
for (i++; i < len; i++) {
obj = g_list_nth_data(elements->list, i);
- if (XFBIB_IS_ENTRY(obj))
- return XFBIB_ENTRY(obj);
+ if (XFBIB_IS_BIBTEX_ENTRY(obj))
+ return XFBIB_BIBTEX_ENTRY(obj);
}
}
}
@@ -279,7 +279,7 @@
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_BIBTEX_ENTRY(obj))
elements->n_entries--;
g_object_unref(obj);
}
@@ -296,11 +296,11 @@
elements->n_entries = 0;
}
-void
-xfbib_bibtex_add_entry(XfbibBibtex *elements, XfbibEntry *entry)
+void
+xfbib_bibtex_add_entry(XfbibBibtex *elements, XfbibBibtexEntry *entry)
{
g_return_if_fail(XFBIB_IS_BIBTEX(elements));
- g_return_if_fail(XFBIB_IS_ENTRY(entry));
+ g_return_if_fail(XFBIB_IS_BIBTEX_ENTRY(entry));
elements->list = g_list_append(elements->list, G_OBJECT(entry));
elements->n_entries++;
Modified: xfbib/branches/gobject/src/xfbib-bibtex.h
===================================================================
--- xfbib/branches/gobject/src/xfbib-bibtex.h 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-bibtex.h 2008-10-14 20:58:18 UTC (rev 5625)
@@ -2,7 +2,7 @@
#define __XFBIB_BIBTEX_H
#include <glib-object.h>
-#include <xfbib-entry.h>
+#include <xfbib-bibtex-entry.h>
#define XFBIB_TYPE_BIBTEX (xfbib_bibtex_get_type())
#define XFBIB_BIBTEX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFBIB_TYPE_BIBTEX, XfbibBibtex))
@@ -22,12 +22,12 @@
GList *xfbib_bibtex_get_list(XfbibBibtex *);
gint xfbib_bibtex_get_size(XfbibBibtex *);
gint xfbib_bibtex_get_n_entries(XfbibBibtex *);
-XfbibEntry *xfbib_bibtex_get_nth_entry(XfbibBibtex *, gint);
-gint xfbib_bibtex_get_entry_position(XfbibBibtex *, XfbibEntry *);
-XfbibEntry *xfbib_bibtex_get_next_entry(XfbibBibtex *, XfbibEntry *);
+XfbibBibtexEntry *xfbib_bibtex_get_nth_entry(XfbibBibtex *, gint);
+gint xfbib_bibtex_get_entry_position(XfbibBibtex *, XfbibBibtexEntry *);
+XfbibBibtexEntry *xfbib_bibtex_get_next_entry(XfbibBibtex *, XfbibBibtexEntry *);
void xfbib_bibtex_remove(XfbibBibtex *, GObject *);
void xfbib_bibtex_remove_all(XfbibBibtex *);
-void xfbib_bibtex_add_entry(XfbibBibtex *, XfbibEntry *);
+void xfbib_bibtex_add_entry(XfbibBibtex *, XfbibBibtexEntry *);
G_END_DECLS
Modified: xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-entry-edit-dialog.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -28,7 +28,7 @@
#include "xfbib-multiple-input.h"
#include "xfbib-bibtex-field.h"
#include "xfbib-strbuf.h"
-#include "xfbib-entry.h"
+#include "xfbib-bibtex-entry.h"
static struct {
gchar *label;
@@ -338,7 +338,7 @@
}
GtkWidget *
-xfbib_entry_edit_dialog_new(XfbibEntry *entry)
+xfbib_entry_edit_dialog_new(XfbibBibtexEntry *entry)
{
XfbibBibtexField *field;
const gchar *bibtype;
@@ -353,7 +353,7 @@
NULL);
if (entry != NULL) {
- bibtype = xfbib_strbuf_get_str(xfbib_entry_get_bibtype(entry));
+ bibtype = xfbib_strbuf_get_str(xfbib_bibtex_entry_get_bibtype(entry));
for (n = 0; xfbib_type_constants[n].text != NULL; n++) {
if (xfbib_type_constants[n].text == bibtype) {
gtk_combo_box_set_active(GTK_COMBO_BOX (entry_edit_dialog->type_combo_box), n);
@@ -361,10 +361,10 @@
}
}
- gtk_entry_set_text(GTK_ENTRY (entry_edit_dialog->key_entry), xfbib_strbuf_get_str(xfbib_entry_get_key(entry)));
+ gtk_entry_set_text(GTK_ENTRY (entry_edit_dialog->key_entry), xfbib_strbuf_get_str(xfbib_bibtex_entry_get_key(entry)));
for (n = 0; n < XFBIB_FIELD_N_FIELDS; n++) {
- field = xfbib_entry_get_field_by_column(entry, n);
+ field = xfbib_bibtex_entry_get_field_by_column(entry, n);
if (field == NULL) {
continue;
}
@@ -379,18 +379,18 @@
return GTK_WIDGET(entry_edit_dialog);
}
-XfbibEntry *
+XfbibBibtexEntry *
xfbib_entry_edit_dialog_get_entry(XfbibEntryEditDialog *entry_edit_dialog)
{
- XfbibEntry *entry;
+ XfbibBibtexEntry *entry;
XfbibBibtexField *field;
GList *field_list = NULL;
- XfbibValue *value;
+ XfbibBibtexValue *value;
int n;
- entry = xfbib_entry_new();
- xfbib_entry_set_key(entry, gtk_entry_get_text(GTK_ENTRY(entry_edit_dialog->key_entry)));
- xfbib_entry_set_bibtype(entry, gtk_combo_box_get_active_text(GTK_COMBO_BOX(entry_edit_dialog->type_combo_box)));
+ entry = xfbib_bibtex_entry_new();
+ xfbib_bibtex_entry_set_key(entry, gtk_entry_get_text(GTK_ENTRY(entry_edit_dialog->key_entry)));
+ xfbib_bibtex_entry_set_bibtype(entry, gtk_combo_box_get_active_text(GTK_COMBO_BOX(entry_edit_dialog->type_combo_box)));
for (n = 0; n < XFBIB_FIELD_N_FIELDS; n++) {
if (n == XFBIB_FIELD_AUTHOR || n == XFBIB_FIELD_EDITOR) {
if(xfbib_multiple_input_get_str(XFBIB_MULTIPLE_INPUT(entry_edit_dialog->inputs[n])) == "") {
@@ -399,8 +399,8 @@
/* TODO: check if they are integers or strings(variables), don't assume text */
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])));
+ value = xfbib_bibtex_value_new();
+ xfbib_bibtex_value_set_str(value, xfbib_multiple_input_get_str(XFBIB_MULTIPLE_INPUT(entry_edit_dialog->inputs[n])));
xfbib_bibtex_field_set_value(field, value);
field_list = g_list_append(field_list, field);
} else {
@@ -410,13 +410,13 @@
/* TODO: check if they are integers or strings(variables), don't assume text */
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])));
+ value = xfbib_bibtex_value_new();
+ xfbib_bibtex_value_set_str(value, gtk_entry_get_text(GTK_ENTRY(entry_edit_dialog->inputs[n])));
xfbib_bibtex_field_set_value(field, value);
field_list = g_list_append(field_list, field);
}
}
- xfbib_entry_set_fields(entry, field_list);
+ xfbib_bibtex_entry_set_fields(entry, field_list);
return entry;
}
Modified: xfbib/branches/gobject/src/xfbib-entry-edit-dialog.h
===================================================================
--- xfbib/branches/gobject/src/xfbib-entry-edit-dialog.h 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-entry-edit-dialog.h 2008-10-14 20:58:18 UTC (rev 5625)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -21,7 +21,7 @@
#define __XFBIB_ENTRY_EDIT_DIALOG_H
#include <gtk/gtk.h>
-#include "xfbib-entry.h"
+#include "xfbib-bibtex-entry.h"
#define XFBIB_TYPE_ENTRY_EDIT_DIALOG (xfbib_entry_edit_dialog_get_type())
#define XFBIB_ENTRY_EDIT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFBIB_TYPE_ENTRY_EDIT_DIALOG, XfbibEntryEditDialog))
@@ -36,8 +36,8 @@
GType xfbib_entry_edit_dialog_get_type() G_GNUC_CONST;
-GtkWidget *xfbib_entry_edit_dialog_new(XfbibEntry *);
-XfbibEntry *xfbib_entry_edit_dialog_get_entry(XfbibEntryEditDialog *);
+GtkWidget *xfbib_entry_edit_dialog_new(XfbibBibtexEntry *);
+XfbibBibtexEntry *xfbib_entry_edit_dialog_get_entry(XfbibEntryEditDialog *);
G_END_DECLS
Modified: xfbib/branches/gobject/src/xfbib-file-io.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-file-io.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-file-io.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -26,7 +26,7 @@
#include "xfbib-file-io.h"
#include "xfbib-strbuf.h"
#include "xfbib-state.h"
-#include "xfbib-elements.h"
+#include "xfbib-bibtex.h"
#include "xfbib-window.h"
#include "xfbib-list-store.h"
@@ -34,19 +34,19 @@
xfbib_file_io_open(void)
{
XfbibState *state;
- XfbibElements *elements;
+ XfbibBibtex *elements;
GtkTreeModel *list_store;
gchar *contents, *name;
gsize length;
gint i;
GError *err = NULL;
GtkWidget *dialog, *window;
-
+
state = xfbib_state_new();
window = xfbib_state_get_window(state);
-
- dialog = gtk_file_chooser_dialog_new("Open BibTeX file",
+
+ dialog = gtk_file_chooser_dialog_new("Open BibTeX file",
GTK_WINDOW(xfbib_state_get_window(state)),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -72,19 +72,19 @@
elements = xfbib_state_get_bibtex_elements(state);
list_store = gtk_tree_view_get_model(GTK_TREE_VIEW(xfbib_window_get_tree_view(XFBIB_WINDOW(window))));
-
-
+
+
xfbib_list_store_clear(XFBIB_LIST_STORE(list_store));
-
+
/* Parse the file and update the tree view */
- if (xfbib_elements_parse(elements, contents)) {
- for (i = 0; i < xfbib_elements_get_n_entries(elements); i++)
+ if (xfbib_bibtex_parse(elements, contents)) {
+ for (i = 0; i < xfbib_bibtex_get_n_entries(elements); i++)
xfbib_list_store_row_inserted(XFBIB_LIST_STORE(list_store), i);
}
}
}
gtk_widget_destroy(dialog);
-
+
return TRUE;
}
Modified: xfbib/branches/gobject/src/xfbib-list-store.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-list-store.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-list-store.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -25,9 +25,9 @@
#include "xfbib-list-store.h"
#include "xfbib-state.h"
-#include "xfbib-elements.h"
+#include "xfbib-bibtex.h"
#include "xfbib-bibtex-comment.h"
-#include "xfbib-entry.h"
+#include "xfbib-bibtex-entry.h"
#include "xfbib-bibtex-field.h"
#include "xfbib-bibtex-preamble.h"
#include "xfbib-bibtex-string.h"
@@ -191,7 +191,7 @@
xfbib_list_store_get_iter (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreePath *path)
{
XfbibListStore *list_store;
- XfbibElements *elements;
+ XfbibBibtex *elements;
gint n;
g_return_val_if_fail(XFBIB_IS_LIST_STORE(tree_model), FALSE);
@@ -203,11 +203,11 @@
switch (list_store->type) {
case TYPE_ENTRY:
- if (n >= xfbib_elements_get_n_entries(elements))
+ if (n >= xfbib_bibtex_get_n_entries(elements))
return FALSE;
iter->stamp = list_store->stamp;
- iter->user_data = xfbib_elements_get_nth_entry(elements, n);
+ iter->user_data = xfbib_bibtex_get_nth_entry(elements, n);
break;
default:
return FALSE;
@@ -219,7 +219,7 @@
xfbib_list_store_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter)
{
XfbibListStore *list_store;
- XfbibElements *elements;
+ XfbibBibtex *elements;
GtkTreePath *path;
gint n;
@@ -233,7 +233,7 @@
switch (list_store->type) {
case TYPE_ENTRY:
- if ((n = xfbib_elements_get_entry_position(elements,
+ if ((n = xfbib_bibtex_get_entry_position(elements,
iter->user_data)) == -1) {
return NULL;
}
@@ -266,9 +266,9 @@
switch (list_store->type) {
case TYPE_ENTRY:
g_return_if_fail(column < XFBIB_FIELD_N_FIELDS
- && XFBIB_IS_ENTRY(iter->user_data));
+ && XFBIB_IS_BIBTEX_ENTRY(iter->user_data));
- field = xfbib_entry_get_field_by_column(XFBIB_ENTRY(iter->user_data), column);
+ field = xfbib_bibtex_entry_get_field_by_column(XFBIB_BIBTEX_ENTRY(iter->user_data), column);
if (field == NULL)
return;
g_value_set_string(value, xfbib_bibtex_field_get_value_str(field));
@@ -282,8 +282,8 @@
xfbib_list_store_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter)
{
XfbibListStore *list_store;
- XfbibElements *elements;
- XfbibEntry *next;
+ XfbibBibtex *elements;
+ XfbibBibtexEntry *next;
g_return_val_if_fail(XFBIB_IS_LIST_STORE(tree_model), FALSE);
@@ -297,7 +297,7 @@
switch (list_store->type) {
case TYPE_ENTRY:
- if ((next = xfbib_elements_get_next_entry(elements, iter->user_data)) == NULL) {
+ if ((next = xfbib_bibtex_get_next_entry(elements, iter->user_data)) == NULL) {
iter->stamp = 0;
return FALSE;
}
@@ -314,7 +314,7 @@
xfbib_list_store_iter_children (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent)
{
XfbibListStore *list_store;
- XfbibElements *elements;
+ XfbibBibtex *elements;
g_return_val_if_fail(XFBIB_IS_LIST_STORE(tree_model), FALSE);
@@ -327,11 +327,11 @@
switch (list_store->type) {
case TYPE_ENTRY:
- if (xfbib_elements_get_n_entries(elements) == 0)
+ if (xfbib_bibtex_get_n_entries(elements) == 0)
return FALSE;
iter->stamp = list_store->stamp;
- if ((iter->user_data = xfbib_elements_get_nth_entry(elements, 0)) == NULL)
+ if ((iter->user_data = xfbib_bibtex_get_nth_entry(elements, 0)) == NULL)
return FALSE;
break;
default:
@@ -350,7 +350,7 @@
xfbib_list_store_iter_n_children (GtkTreeModel *tree_model, GtkTreeIter *iter)
{
XfbibListStore *list_store;
- XfbibElements *elements;
+ XfbibBibtex *elements;
g_return_val_if_fail(XFBIB_IS_LIST_STORE(tree_model), -1);
@@ -360,7 +360,7 @@
switch (list_store->type) {
case TYPE_ENTRY:
if (iter == NULL)
- return xfbib_elements_get_n_entries(elements);
+ return xfbib_bibtex_get_n_entries(elements);
break;
default:
return -1;
@@ -372,7 +372,7 @@
xfbib_list_store_iter_nth_child (GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n)
{
XfbibListStore *list_store;
- XfbibElements *elements;
+ XfbibBibtex *elements;
g_return_val_if_fail(XFBIB_IS_LIST_STORE(tree_model), FALSE);
@@ -385,11 +385,11 @@
switch (list_store->type) {
case TYPE_ENTRY:
- if (n >= xfbib_elements_get_n_entries(elements))
+ if (n >= xfbib_bibtex_get_n_entries(elements))
return FALSE;
iter->stamp = list_store->stamp;
- if ((iter->user_data = xfbib_elements_get_nth_entry(elements, n)) == NULL)
+ if ((iter->user_data = xfbib_bibtex_get_nth_entry(elements, n)) == NULL)
return FALSE;
break;
default:
@@ -461,7 +461,7 @@
gboolean
xfbib_list_store_remove(XfbibListStore *list_store, GtkTreeIter *iter)
{
- XfbibElements *elements;
+ XfbibBibtex *elements;
GtkTreePath *path;
GtkTreeIter next;
gboolean more;
@@ -477,7 +477,7 @@
more = xfbib_list_store_iter_next(GTK_TREE_MODEL(list_store), &next);
elements = xfbib_state_get_bibtex_elements(list_store->state);
- xfbib_elements_remove(elements, iter->user_data);
+ xfbib_bibtex_remove(elements, iter->user_data);
gtk_tree_model_row_deleted (GTK_TREE_MODEL (list_store), path);
gtk_tree_path_free (path);
@@ -520,19 +520,19 @@
void
xfbib_list_store_clear(XfbibListStore *list_store)
{
- XfbibElements *elements;
+ XfbibBibtex *elements;
GtkTreeIter iter;
g_return_if_fail(XFBIB_IS_LIST_STORE(list_store));
elements = xfbib_state_get_bibtex_elements(list_store->state);
- while (xfbib_elements_get_n_entries(elements) > 0) {
+ while (xfbib_bibtex_get_n_entries(elements) > 0) {
iter.stamp = list_store->stamp;
- iter.user_data = xfbib_elements_get_nth_entry(elements, 0);
+ iter.user_data = xfbib_bibtex_get_nth_entry(elements, 0);
xfbib_list_store_remove(list_store, &iter);
}
- xfbib_elements_remove_all(elements);
+ xfbib_bibtex_remove_all(elements);
/* Old iters are not valid any more so change the stamp */
list_store->stamp = g_random_int();
@@ -556,28 +556,28 @@
gtk_tree_path_free(path);
}
-XfbibEntry *
+XfbibBibtexEntry *
xfbib_list_store_get_entry(XfbibListStore *list_store, GtkTreeIter *iter)
{
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);
+ return XFBIB_BIBTEX_ENTRY(iter->user_data);
}
void
-xfbib_list_store_add_entry(XfbibListStore *list_store, XfbibEntry *entry)
+xfbib_list_store_add_entry(XfbibListStore *list_store, XfbibBibtexEntry *entry)
{
- XfbibElements *elements;
+ XfbibBibtex *elements;
gint n;
g_return_if_fail(XFBIB_IS_LIST_STORE(list_store));
- g_return_if_fail(XFBIB_ENTRY(entry));
-
+ g_return_if_fail(XFBIB_BIBTEX_ENTRY(entry));
+
elements = xfbib_state_get_bibtex_elements(list_store->state);
-
- xfbib_elements_add_entry(elements, entry);
- n = xfbib_elements_get_n_entries(elements);
+ xfbib_bibtex_add_entry(elements, entry);
+
+ n = xfbib_bibtex_get_n_entries(elements);
xfbib_list_store_row_inserted(list_store, n-1);
}
Modified: xfbib/branches/gobject/src/xfbib-list-store.h
===================================================================
--- xfbib/branches/gobject/src/xfbib-list-store.h 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-list-store.h 2008-10-14 20:58:18 UTC (rev 5625)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -21,7 +21,7 @@
#define __XFBIB_LIST_STORE_H
#include <gtk/gtk.h>
-#include "xfbib-entry.h"
+#include "xfbib-bibtex-entry.h"
#define XFBIB_TYPE_LIST_STORE (xfbib_list_store_get_type())
#define XFBIB_LIST_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFBIB_TYPE_LIST_STORE, XfbibListStore))
@@ -40,8 +40,8 @@
gboolean xfbib_list_store_remove(XfbibListStore *, GtkTreeIter *);
void xfbib_list_store_clear(XfbibListStore *);
void xfbib_list_store_row_inserted(XfbibListStore *, gint);
-XfbibEntry *xfbib_list_store_get_entry(XfbibListStore *, GtkTreeIter *);
-void xfbib_list_store_add_entry(XfbibListStore *, XfbibEntry *);
+XfbibBibtexEntry *xfbib_list_store_get_entry(XfbibListStore *, GtkTreeIter *);
+void xfbib_list_store_add_entry(XfbibListStore *, XfbibBibtexEntry *);
G_END_DECLS
Modified: xfbib/branches/gobject/src/xfbib-menu-bar.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-menu-bar.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-menu-bar.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -28,7 +28,7 @@
#include "xfbib-entry-edit-dialog.h"
#include "xfbib-menu-bar.h"
#include "xfbib-bibtex-field.h"
-#include "xfbib-elements.h"
+#include "xfbib-bibtex.h"
#include "xfbib-file-io.h"
#include "xfbib-state.h"
#include "xfbib-list-store.h"
@@ -103,15 +103,15 @@
cb_entry_add_activate (GtkMenuItem *menuitem, gpointer user_data)
{
XfbibState *state;
- XfbibEntry *new_entry;
+ XfbibBibtexEntry *new_entry;
GtkTreeModel *model;
GtkWidget *dialog;
g_printf("Entry/Add\n");
-
+
state = xfbib_state_new();
model = gtk_tree_view_get_model(GTK_TREE_VIEW(xfbib_window_get_tree_view(
XFBIB_WINDOW(xfbib_state_get_window(state)))));
-
+
dialog = xfbib_entry_edit_dialog_new(NULL);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
@@ -147,7 +147,7 @@
cb_entry_edit_activate (GtkMenuItem *menuitem, gpointer user_data)
{
XfbibState *state;
- XfbibEntry *entry, *new_entry;
+ XfbibBibtexEntry *entry, *new_entry;
GtkWidget *tree_view, *dialog;
GtkTreeSelection *selection;
GtkTreeModel *model;
@@ -161,12 +161,12 @@
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view));
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
entry = xfbib_list_store_get_entry(XFBIB_LIST_STORE(model), &iter);
-
+
dialog = xfbib_entry_edit_dialog_new(entry);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
/* TODO: Save the entry */
new_entry = xfbib_entry_edit_dialog_get_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog));
- g_printf("TODO: Edit an existing entry\n");
+ g_printf("TODO: Edit an existing entry\n");
}
gtk_widget_destroy(dialog);
} else {
Modified: xfbib/branches/gobject/src/xfbib-state.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-state.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-state.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -8,7 +8,7 @@
struct _XfbibState
{
GObject parent;
- XfbibElements *elements;
+ XfbibBibtex *elements;
gchar *filename;
GtkWidget *window;
};
@@ -76,13 +76,13 @@
return state->filename;
}
-void xfbib_state_set_bibtex_elements(XfbibState *state, XfbibElements *elements)
+void xfbib_state_set_bibtex_elements(XfbibState *state, XfbibBibtex *elements)
{
g_return_if_fail(XFBIB_IS_STATE(state));
state->elements = elements;
}
-XfbibElements *xfbib_state_get_bibtex_elements(XfbibState *state)
+XfbibBibtex *xfbib_state_get_bibtex_elements(XfbibState *state)
{
g_return_val_if_fail(XFBIB_IS_STATE(state), NULL);
return state->elements;
Modified: xfbib/branches/gobject/src/xfbib-state.h
===================================================================
--- xfbib/branches/gobject/src/xfbib-state.h 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-state.h 2008-10-14 20:58:18 UTC (rev 5625)
@@ -2,7 +2,7 @@
#define __XFBIB_STATE_H
#include <glib-object.h>
-#include "xfbib-elements.h"
+#include "xfbib-bibtex.h"
#define XFBIB_TYPE_STATE (xfbib_state_get_type())
#define XFBIB_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFBIB_TYPE_STATE, XfbibState))
@@ -18,8 +18,8 @@
GType xfbib_state_get_type() G_GNUC_CONST;
XfbibState *xfbib_state_new();
-void xfbib_state_set_bibtex_elements(XfbibState *, XfbibElements *);
-XfbibElements *xfbib_state_get_bibtex_elements(XfbibState *);
+void xfbib_state_set_bibtex_elements(XfbibState *, XfbibBibtex *);
+XfbibBibtex *xfbib_state_get_bibtex_elements(XfbibState *);
void xfbib_state_set_filename(XfbibState *, gchar *);
gchar *xfbib_state_get_filename(XfbibState *);
void xfbib_state_set_window(XfbibState *, GtkWidget *);
Modified: xfbib/branches/gobject/src/xfbib-tree-view.c
===================================================================
--- xfbib/branches/gobject/src/xfbib-tree-view.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-tree-view.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -24,9 +24,9 @@
#include "xfbib-list-store.h"
#include "xfbib-tree-view.h"
-#include "xfbib-elements.h"
+#include "xfbib-bibtex.h"
#include "xfbib-state.h"
-#include "xfbib-entry.h"
+#include "xfbib-bibtex-entry.h"
#include "xfbib-entry-edit-dialog.h"
static struct {
@@ -34,30 +34,30 @@
gchar *tooltip;
}xfbib_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"},
+ {"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"}
};
@@ -78,11 +78,11 @@
static GObjectClass *xfbib_tree_view_parent_class = NULL;
-void
+void
cb_row_activated (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
{
XfbibState *state;
- XfbibEntry *entry, *new_entry;
+ XfbibBibtexEntry *entry, *new_entry;
GtkWidget *dialog;
GtkTreeModel *model;
GtkTreeIter iter;
@@ -96,7 +96,7 @@
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
/* TODO: Save the entry to an existing entry */
new_entry = xfbib_entry_edit_dialog_get_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog));
- g_printf("TODO: Edit an existing entry\n");
+ g_printf("TODO: Edit an existing entry\n");
}
gtk_widget_destroy(dialog);
}
@@ -105,10 +105,10 @@
gboolean
cb_button_press (GtkWidget *tree_view, GdkEventButton *event, gpointer data)
{
- XfbibEntry *new_entry;
+ XfbibBibtexEntry *new_entry;
GtkTreeModel *model;
GtkWidget *dialog;
-
+
if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
/* single click with the right mouse button */
/* TODO: Add a context menu here */
@@ -131,7 +131,7 @@
return TRUE;
}
-
+
GType
xfbib_tree_view_get_type (void)
{
@@ -153,14 +153,14 @@
return type;
}
-
+
static void
xfbib_tree_view_class_init(XfbibTreeViewClass *klass)
{
GObjectClass *object_class = (GObjectClass *)klass;
-
- xfbib_tree_view_parent_class = g_type_class_peek_parent (klass);
+ xfbib_tree_view_parent_class = g_type_class_peek_parent (klass);
+
object_class->finalize = xfbib_tree_view_finalize;
}
@@ -177,7 +177,7 @@
/* Connect the double-click NOT on a row to a callback function */
g_signal_connect(GTK_WIDGET(instance), "button-press-event", (GCallback) cb_button_press, NULL);
-
+
for (i = 0; i < XFBIB_FIELD_N_FIELDS; i++) {
switch (i) {
case XFBIB_FIELD_ANNOTE:
@@ -217,7 +217,7 @@
/* pack cell renderer into tree view column */
gtk_tree_view_column_pack_start(column, renderer, TRUE);
- /*
+ /*
* connect 'text' property of the cell renderer to
* model column that contains the first name
*/
Modified: xfbib/branches/gobject/src/xfbib-window.h
===================================================================
--- xfbib/branches/gobject/src/xfbib-window.h 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/src/xfbib-window.h 2008-10-14 20:58:18 UTC (rev 5625)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2008 Jesper Karlsson & David Gustafsson
* All rights reserved.
*
@@ -22,7 +22,7 @@
#include <gtk/gtk.h>
#include "xfbib-strbuf.h"
-#include "xfbib-elements.h"
+#include "xfbib-bibtex.h"
#define XFBIB_TYPE_WINDOW (xfbib_window_get_type())
#define XFBIB_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFBIB_TYPE_WINDOW, XfbibWindow))
@@ -39,7 +39,7 @@
GtkWidget *xfbib_window_new();
void xfbib_window_set_title(XfbibWindow *, gchar *);
-XfbibElements *xfbib_window_get_elements(XfbibWindow *);
+XfbibBibtex *xfbib_window_get_elements(XfbibWindow *);
GtkWidget *xfbib_window_get_tree_view(XfbibWindow *);
G_END_DECLS
Modified: xfbib/branches/gobject/tests/test-xfbib-elements.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-elements.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/tests/test-xfbib-elements.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -10,16 +10,16 @@
int main(int argc, char **argv)
{
- XfbibElements *elements;
+ XfbibBibtex *elements;
GList *list, *ref_list = NULL;
GObject *obj;
gint i;
gtk_init(&argc, &argv);
- elements = xfbib_elements_new();
+ elements = xfbib_bibtex_new();
- g_assert(xfbib_elements_parse(elements, "@preamble {\"This bibliography was generated on \today\"}\n"
+ g_assert(xfbib_bibtex_parse(elements, "@preamble {\"This bibliography was generated on \today\"}\n"
"@preamble (\"This bibliography was generated on \\today\")\n"
"@String {maintainer = \"Xavier D\\'ecoret\"}\n"
"@preamble { \"Maintained by \" # maintainer }\n"
@@ -92,41 +92,41 @@
g_assert(XFBIB_IS_PREAMBLE(g_list_nth_data(list, 1)));
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_BIBTEX_ENTRY(g_list_nth_data(list, 4)));
g_assert(XFBIB_IS_COMMENT(g_list_nth_data(list, 5)));
- g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 6)));
- g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 7)));
- g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 8)));
- g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 9)));
+ g_assert(XFBIB_IS_BIBTEX_ENTRY(g_list_nth_data(list, 6)));
+ g_assert(XFBIB_IS_BIBTEX_ENTRY(g_list_nth_data(list, 7)));
+ g_assert(XFBIB_IS_BIBTEX_ENTRY(g_list_nth_data(list, 8)));
+ g_assert(XFBIB_IS_BIBTEX_ENTRY(g_list_nth_data(list, 9)));
g_assert(XFBIB_IS_COMMENT(g_list_nth_data(list, 10)));
- g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 11)));
- g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 12)));
+ g_assert(XFBIB_IS_BIBTEX_ENTRY(g_list_nth_data(list, 11)));
+ g_assert(XFBIB_IS_BIBTEX_ENTRY(g_list_nth_data(list, 12)));
g_assert(XFBIB_IS_COMMENT(g_list_nth_data(list, 13)));
- g_assert(XFBIB_IS_ENTRY(g_list_nth_data(list, 14)));
+ g_assert(XFBIB_IS_BIBTEX_ENTRY(g_list_nth_data(list, 14)));
for (i = 0; i < g_list_length(list); i++) {
obj = g_list_nth_data(list, i);
- if (XFBIB_IS_ENTRY(obj)) {
+ if (XFBIB_IS_BIBTEX_ENTRY(obj)) {
ref_list = g_list_append(ref_list, obj);
}
}
- g_assert(g_list_length(ref_list) == xfbib_elements_get_n_entries(elements));
+ g_assert(g_list_length(ref_list) == xfbib_bibtex_get_n_entries(elements));
- for (i = 0; i < xfbib_elements_get_n_entries(elements); i++) {
- g_assert(XFBIB_ENTRY(g_list_nth_data(ref_list, i)) == xfbib_elements_get_nth_entry(elements, i));
+ for (i = 0; i < xfbib_bibtex_get_n_entries(elements); i++) {
+ g_assert(XFBIB_BIBTEX_ENTRY(g_list_nth_data(ref_list, i)) == xfbib_bibtex_get_nth_entry(elements, i));
}
- /* xfbib_elements_get_entry_position */
- for (i = 0; i < xfbib_elements_get_n_entries(elements); i++) {
- g_assert(i == xfbib_elements_get_entry_position(elements,
- XFBIB_ENTRY(g_list_nth_data(ref_list, i))));
+ /* xfbib_bibtex_get_entry_position */
+ for (i = 0; i < xfbib_bibtex_get_n_entries(elements); i++) {
+ g_assert(i == xfbib_bibtex_get_entry_position(elements,
+ XFBIB_BIBTEX_ENTRY(g_list_nth_data(ref_list, i))));
}
- /* xfbib_elements_get_next_entry */
- for (i = 0; i < (xfbib_elements_get_n_entries(elements) - 1); i++) {
- g_assert(XFBIB_ENTRY(g_list_nth_data(ref_list, i + 1)) ==
- xfbib_elements_get_next_entry(elements, XFBIB_ENTRY(g_list_nth_data(ref_list, i))));
+ /* xfbib_bibtex_get_next_entry */
+ for (i = 0; i < (xfbib_bibtex_get_n_entries(elements) - 1); i++) {
+ g_assert(XFBIB_BIBTEX_ENTRY(g_list_nth_data(ref_list, i + 1)) ==
+ xfbib_bibtex_get_next_entry(elements, XFBIB_BIBTEX_ENTRY(g_list_nth_data(ref_list, i))));
}
g_object_unref(elements);
Modified: xfbib/branches/gobject/tests/test-xfbib-entry.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-entry.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/tests/test-xfbib-entry.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -26,17 +26,17 @@
int main(int argc, char **argv)
{
/*
- XfbibEntry *entry;
+ XfbibBibtexEntry *entry;
XfbibBibtexField *field;
GList *field_list;
gtk_init(&argc, &argv);
- entry = xfbib_entry_new();
+ entry = xfbib_bibtex_entry_new();
- xfbib_entry_set_bibtype(entry, "@misc");
- g_assert(strcmp(xfbib_entry_get_bibtype(entry), "@misc") == 0);
- xfbib_entry_set_key(entry, "patashnik-bibtexing");
- g_assert(strcmp(xfbib_entry_get_key(entry), "patashnik-bibtexing") == 0);
+ xfbib_bibtex_entry_set_bibtype(entry, "@misc");
+ g_assert(strcmp(xfbib_bibtex_entry_get_bibtype(entry), "@misc") == 0);
+ xfbib_bibtex_entry_set_key(entry, "patashnik-bibtexing");
+ g_assert(strcmp(xfbib_bibtex_entry_get_key(entry), "patashnik-bibtexing") == 0);
xfbib_entry_add_field(entry, "author", "Oren Patashnik");
xfbib_entry_add_field(entry, "title", "BIBTEXing");
xfbib_entry_add_field(entry, "year", "1988");
Modified: xfbib/branches/gobject/tests/test-xfbib-value.c
===================================================================
--- xfbib/branches/gobject/tests/test-xfbib-value.c 2008-10-14 20:36:27 UTC (rev 5624)
+++ xfbib/branches/gobject/tests/test-xfbib-value.c 2008-10-14 20:58:18 UTC (rev 5625)
@@ -35,34 +35,34 @@
XfbibValue *value;
gtk_init(&argc, &argv);
- value = xfbib_value_new();
+ value = xfbib_bibtex_value_new();
- g_assert(xfbib_value_parse(value, "\"Maintained by \" # maintainer"));
- g_assert(strcmp(xfbib_value_get_str(value), "\"Maintained by \" # maintainer") == 0);
+ g_assert(xfbib_bibtex_value_parse(value, "\"Maintained by \" # maintainer"));
+ g_assert(strcmp(xfbib_bibtex_value_get_str(value), "\"Maintained by \" # maintainer") == 0);
- g_assert(xfbib_value_parse(value, "1921"));
- g_assert(strcmp(xfbib_value_get_str(value), "1921") == 0);
+ g_assert(xfbib_bibtex_value_parse(value, "1921"));
+ g_assert(strcmp(xfbib_bibtex_value_get_str(value), "1921") == 0);
- g_assert(xfbib_value_parse(value, "\"april\""));
- g_assert(strcmp(xfbib_value_get_str(value), "\"april\"") == 0);
+ g_assert(xfbib_bibtex_value_parse(value, "\"april\""));
+ g_assert(strcmp(xfbib_bibtex_value_get_str(value), "\"april\"") == 0);
- g_assert(xfbib_value_parse(value, "firstname # \".\" # lastname # \"@imag.fr\""));
- g_assert(strcmp(xfbib_value_get_str(value), "firstname # \".\" # lastname # \"@imag.fr\"") == 0);
+ g_assert(xfbib_bibtex_value_parse(value, "firstname # \".\" # lastname # \"@imag.fr\""));
+ g_assert(strcmp(xfbib_bibtex_value_get_str(value), "firstname # \".\" # lastname # \"@imag.fr\"") == 0);
- g_assert(xfbib_value_parse(value, "\"The history of @ sign\""));
- g_assert(strcmp(xfbib_value_get_str(value), "\"The history of @ sign\"") == 0);
+ g_assert(xfbib_bibtex_value_parse(value, "\"The history of @ sign\""));
+ g_assert(strcmp(xfbib_bibtex_value_get_str(value), "\"The history of @ sign\"") == 0);
- g_assert(xfbib_value_parse(value, "\"Simon {\"}the {saint\"} Templar\""));
- g_assert(strcmp(xfbib_value_get_str(value), "\"Simon {\"}the {saint\"} Templar\"") == 0);
+ g_assert(xfbib_bibtex_value_parse(value, "\"Simon {\"}the {saint\"} Templar\""));
+ g_assert(strcmp(xfbib_bibtex_value_get_str(value), "\"Simon {\"}the {saint\"} Templar\"") == 0);
- g_assert(xfbib_value_parse(value, "\"A {bunch {of} braces {in}} title\""));
- g_assert(strcmp(xfbib_value_get_str(value), "\"A {bunch {of} braces {in}} title\"") == 0);
+ g_assert(xfbib_bibtex_value_parse(value, "\"A {bunch {of} braces {in}} title\""));
+ g_assert(strcmp(xfbib_bibtex_value_get_str(value), "\"A {bunch {of} braces {in}} title\"") == 0);
- g_assert(!xfbib_value_parse(value, "{ The history of @ sign }"));
+ g_assert(!xfbib_bibtex_value_parse(value, "{ The history of @ sign }"));
- g_assert(!xfbib_value_parse(value, "\"Simon \\\"the saint\\\" Templar\""));
+ g_assert(!xfbib_bibtex_value_parse(value, "\"Simon \\\"the saint\\\" Templar\""));
- g_assert(!xfbib_value_parse(value, "\"The lonely { brace\""));
+ g_assert(!xfbib_bibtex_value_parse(value, "\"The lonely { brace\""));
g_object_unref(value);
*/
More information about the Goodies-commits
mailing list