[Goodies-commits] r7224 - xfbib/trunk/src
Jesper Karlsson
zarper at xfce.org
Fri Apr 17 17:42:54 CEST 2009
Author: zarper
Date: 2009-04-17 15:42:54 +0000 (Fri, 17 Apr 2009)
New Revision: 7224
Modified:
xfbib/trunk/src/xfbib-bibtex-entry.h
xfbib/trunk/src/xfbib-bibtex-field.h
xfbib/trunk/src/xfbib-bibtex-value.c
xfbib/trunk/src/xfbib-entry-edit-dialog.c
xfbib/trunk/src/xfbib-entry-edit-dialog.h
xfbib/trunk/src/xfbib-entry-tree-view.c
xfbib/trunk/src/xfbib-file-io.c
xfbib/trunk/src/xfbib-input-dialog.c
xfbib/trunk/src/xfbib-list-store.c
xfbib/trunk/src/xfbib-menu-bar.c
xfbib/trunk/src/xfbib-multiple-input.c
xfbib/trunk/src/xfbib-string-tree-view.c
Log:
Fixed a bunch of warnings and added support for some more special bibtex characters.
Modified: xfbib/trunk/src/xfbib-bibtex-entry.h
===================================================================
--- xfbib/trunk/src/xfbib-bibtex-entry.h 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-bibtex-entry.h 2009-04-17 15:42:54 UTC (rev 7224)
@@ -46,6 +46,7 @@
gchar *xfbib_bibtex_entry_get_bibtype(XfbibBibtexEntry *);
void xfbib_bibtex_entry_set_bibtype(XfbibBibtexEntry *, const gchar *);
gchar xfbib_bibtex_entry_get_separator(XfbibBibtexEntry *);
+void xfbib_bibtex_entry_set_separator(XfbibBibtexEntry *, gchar);
#if 0
XfbibBibtexField *xfbib_bibtex_entry_get_field_by_column(XfbibBibtexEntry *, gint);
Modified: xfbib/trunk/src/xfbib-bibtex-field.h
===================================================================
--- xfbib/trunk/src/xfbib-bibtex-field.h 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-bibtex-field.h 2009-04-17 15:42:54 UTC (rev 7224)
@@ -63,42 +63,14 @@
XFBIB_BIBTEX_FIELD_N_FIELDS,
};
-static struct {
+struct field_properties {
gchar *label;
gchar *tooltip;
- /* TODO: Make translateable, but need to be inside a function */
-}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")}
};
typedef struct _XfbibBibtexField XfbibBibtexField;
-GType xfbib_field_get_type() G_GNUC_CONST;
+GType xfbib_bibtex_field_get_type() G_GNUC_CONST;
XfbibBibtexField *xfbib_bibtex_field_new(GObject *);
GObject *xfbib_bibtex_field_get_owner(XfbibBibtexField *);
Modified: xfbib/trunk/src/xfbib-bibtex-value.c
===================================================================
--- xfbib/trunk/src/xfbib-bibtex-value.c 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-bibtex-value.c 2009-04-17 15:42:54 UTC (rev 7224)
@@ -89,6 +89,8 @@
XFBIB_BIBTEX_ENTRY(xfbib_bibtex_field_get_owner(XFBIB_BIBTEX_FIELD(value->owner)))));
} else if (XFBIB_IS_BIBTEX_PREAMBLE(value->owner)) {
elements = XFBIB_BIBTEX(xfbib_bibtex_preamble_get_owner(XFBIB_BIBTEX_PREAMBLE(value->owner)));
+ } else {
+ return FALSE;
}
/* TODO: Free all elements of the list */
Modified: xfbib/trunk/src/xfbib-entry-edit-dialog.c
===================================================================
--- xfbib/trunk/src/xfbib-entry-edit-dialog.c 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-entry-edit-dialog.c 2009-04-17 15:42:54 UTC (rev 7224)
@@ -86,7 +86,7 @@
static void
cb_generate_clicked (GtkButton *button, gpointer user_data)
{
- g_printf("cb_generate_clicked\n");
+ g_print("cb_generate_clicked\n");
/* Generate BibTeX key */
/* Suggested format: Last name of first author, year of publication, first word in title appended together */
GString *str;
@@ -115,7 +115,7 @@
static void
cb_edit_compound_string_clicked (GtkButton *button, struct input *inputs)
{
- g_printf("cb_compound_string_clicked\n");
+ g_print("cb_compound_string_clicked\n");
GtkWidget *multiple_input;
const gchar *str;
@@ -184,6 +184,35 @@
return image;
}
+struct field_properties 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")}
+};
+
GType
xfbib_entry_edit_dialog_get_type (void)
{
@@ -218,7 +247,7 @@
static void
xfbib_entry_edit_dialog_init(XfbibEntryEditDialog *instance)
{
- gint i, row[5] = {0, 0, 0, 0, 0}, box;
+ gint i, row[5] = {0, 0, 0, 0, 0}, box = -1;
GtkWidget *top_box;
instance->type_label = gtk_label_new(_("Type:"));
Modified: xfbib/trunk/src/xfbib-entry-edit-dialog.h
===================================================================
--- xfbib/trunk/src/xfbib-entry-edit-dialog.h 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-entry-edit-dialog.h 2009-04-17 15:42:54 UTC (rev 7224)
@@ -38,6 +38,7 @@
GtkWidget *xfbib_entry_edit_dialog_new(XfbibBibtexEntry *);
XfbibBibtexEntry *xfbib_entry_edit_dialog_get_entry(XfbibEntryEditDialog *);
+gboolean xfbib_entry_edit_dialog_valid_entry(XfbibEntryEditDialog *);
G_END_DECLS
Modified: xfbib/trunk/src/xfbib-entry-tree-view.c
===================================================================
--- xfbib/trunk/src/xfbib-entry-tree-view.c 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-entry-tree-view.c 2009-04-17 15:42:54 UTC (rev 7224)
@@ -64,7 +64,7 @@
dialog = xfbib_entry_edit_dialog_new(entry);
for(;;) {
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
- if(xfbib_entry_edit_dialog_valid_entry(dialog)) {
+ if(xfbib_entry_edit_dialog_valid_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog))) {
new_entry = xfbib_entry_edit_dialog_get_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog));
xfbib_list_store_replace(XFBIB_LIST_STORE(model), G_OBJECT(entry), G_OBJECT(new_entry));
break;
@@ -108,7 +108,7 @@
for(;;) {
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
- if(xfbib_entry_edit_dialog_valid_entry(dialog)) {
+ if(xfbib_entry_edit_dialog_valid_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog))) {
new_entry = xfbib_entry_edit_dialog_get_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog));
xfbib_list_store_add(XFBIB_LIST_STORE(model), G_OBJECT(new_entry));
break;
Modified: xfbib/trunk/src/xfbib-file-io.c
===================================================================
--- xfbib/trunk/src/xfbib-file-io.c 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-file-io.c 2009-04-17 15:42:54 UTC (rev 7224)
@@ -104,12 +104,13 @@
n_strings = xfbib_bibtex_get_n(elements, TYPE_STRING);
/* Parse the file and update the tree view */
if (xfbib_bibtex_parse(elements, contents)) {
- for (i = n_entries; i < xfbib_bibtex_get_n(elements, TYPE_ENTRY); i++)
+ for (i = n_entries; i < xfbib_bibtex_get_n(elements, TYPE_ENTRY); i++) {
xfbib_list_store_row_inserted(XFBIB_LIST_STORE(list_store_entries), i);
+ }
/* TODO: Update the string tree_view */
- for (i = n_strings; i < xfbib_bibtex_get_n(elements, TYPE_STRING); i++)
+ for (i = n_strings; i < xfbib_bibtex_get_n(elements, TYPE_STRING); i++) {
xfbib_list_store_row_inserted(XFBIB_LIST_STORE(list_store_strings), i);
-
+ }
}
}
@@ -276,7 +277,7 @@
n = i = 0;
while(n < len) {
- switch(str[n]) {
+ switch(str[n] & 0xff) {
case '&':
case '%':
new_len++;
@@ -287,6 +288,97 @@
i++;
n++;
break;
+ case 0xc3:
+ n++;
+ switch(str[n] & 0xff) {
+ case 0x96:
+ new_len += 3;
+ new_str = realloc(new_str, new_len);
+ new_str[i] = '\\';
+ i++;
+ new_str[i] = '\"';
+ i++;
+ new_str[i] = '{';
+ i++;
+ new_str[i] = 'O';
+ i++;
+ new_str[i] = '}';
+ i++;
+ n++;
+ break;
+ case 0xb6:
+ new_len += 3;
+ new_str = realloc(new_str, new_len);
+ new_str[i] = '\\';
+ i++;
+ new_str[i] = '\"';
+ i++;
+ new_str[i] = '{';
+ i++;
+ new_str[i] = 'o';
+ i++;
+ new_str[i] = '}';
+ i++;
+ n++;
+ break;
+ case 0xa5:
+ new_len += 2;
+ new_str = realloc(new_str, new_len);
+ new_str[i] = '\\';
+ i++;
+ new_str[i] = 'a';
+ i++;
+ new_str[i] = 'a';
+ i++;
+ new_str[i] = ' ';
+ i++;
+ n++;
+ break;
+ case 0x85:
+ new_len += 2;
+ new_str = realloc(new_str, new_len);
+ new_str[i] = '\\';
+ i++;
+ new_str[i] = 'A';
+ i++;
+ new_str[i] = 'A';
+ i++;
+ new_str[i] = ' ';
+ i++;
+ n++;
+ break;
+ case 0xa4:
+ new_len += 3;
+ new_str = realloc(new_str, new_len);
+ new_str[i] = '\\';
+ i++;
+ new_str[i] = '\"';
+ i++;
+ new_str[i] = '{';
+ i++;
+ new_str[i] = 'a';
+ i++;
+ new_str[i] = '}';
+ i++;
+ n++;
+ break;
+ case 0x84:
+ new_len += 3;
+ new_str = realloc(new_str, new_len);
+ new_str[i] = '\\';
+ i++;
+ new_str[i] = '\"';
+ i++;
+ new_str[i] = '{';
+ i++;
+ new_str[i] = 'A';
+ i++;
+ new_str[i] = '}';
+ i++;
+ n++;
+ break;
+ }
+ break;
default:
new_str[i] = str[n];
i++;
Modified: xfbib/trunk/src/xfbib-input-dialog.c
===================================================================
--- xfbib/trunk/src/xfbib-input-dialog.c 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-input-dialog.c 2009-04-17 15:42:54 UTC (rev 7224)
@@ -122,7 +122,7 @@
xfbib_input_dialog_new(gchar *title, const gchar *label)
{
XfbibInputDialog *input_dialog;
- gchar *lbl;
+ //gchar *lbl;
input_dialog = g_object_new(XFBIB_TYPE_INPUT_DIALOG,
"destroy-with-parent", ((GTK_DIALOG_MODAL & GTK_DIALOG_DESTROY_WITH_PARENT) != 0),
"has-separator", ((GTK_DIALOG_MODAL & GTK_DIALOG_NO_SEPARATOR) == 0),
Modified: xfbib/trunk/src/xfbib-list-store.c
===================================================================
--- xfbib/trunk/src/xfbib-list-store.c 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-list-store.c 2009-04-17 15:42:54 UTC (rev 7224)
@@ -251,6 +251,35 @@
return path;
}
+struct field_properties xfbib_bibtex_field_constants_list[] = {
+ {"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")}
+};
+
static void
xfbib_list_store_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, gint column, GValue *value)
{
@@ -283,7 +312,7 @@
for (i = 0; i < g_list_length(list); i++) {
field = g_list_nth_data(list, i);
if (strcasecmp(xfbib_bibtex_field_get_variable(field),
- xfbib_bibtex_field_constants[column].label) == 0) {
+ xfbib_bibtex_field_constants_list[column].label) == 0) {
break;
}
}
Modified: xfbib/trunk/src/xfbib-menu-bar.c
===================================================================
--- xfbib/trunk/src/xfbib-menu-bar.c 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-menu-bar.c 2009-04-17 15:42:54 UTC (rev 7224)
@@ -117,7 +117,7 @@
for(;;) {
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
- if(xfbib_entry_edit_dialog_valid_entry(dialog)) {
+ if(xfbib_entry_edit_dialog_valid_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog))) {
new_entry = xfbib_entry_edit_dialog_get_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog));
xfbib_list_store_add(XFBIB_LIST_STORE(model), G_OBJECT(new_entry));
}
@@ -170,7 +170,7 @@
dialog = xfbib_entry_edit_dialog_new(entry);
for(;;) {
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
- if(xfbib_entry_edit_dialog_valid_entry(dialog)) {
+ if(xfbib_entry_edit_dialog_valid_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog))) {
new_entry = xfbib_entry_edit_dialog_get_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog));
xfbib_list_store_replace(XFBIB_LIST_STORE(model), G_OBJECT(entry), G_OBJECT(new_entry));
}
@@ -187,15 +187,16 @@
static void
cb_variable_add_activate (GtkMenuItem *menuitem, gpointer user_data)
{
+ g_print("TODO: Implement 'cb_variable_add_activate'");
+#if 0
XfbibState *state;
+ GtkTreeModel *model;
XfbibBibtexString *new_string;
- GtkTreeModel *model;
GtkWidget *dialog;
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)), TYPE_STRING)));
-#if 0
dialog = xfbib_entry_edit_dialog_new(NULL);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
@@ -230,6 +231,8 @@
static void
cb_variable_edit_activate (GtkMenuItem *menuitem, gpointer user_data)
{
+ g_print("TODO: Implement 'cb_variable_edit_activate'");
+#if 0
XfbibState *state;
XfbibBibtexString *string, *new_string;
GtkWidget *tree_view, *dialog;
@@ -245,18 +248,16 @@
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
string = XFBIB_BIBTEX_STRING(xfbib_list_store_get(XFBIB_LIST_STORE(model), &iter));
-#if 0
dialog = xfbib_entry_edit_dialog_new(string);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
new_string = xfbib_entry_edit_dialog_get_entry(XFBIB_ENTRY_EDIT_DIALOG(dialog));
xfbib_list_store_replace(XFBIB_LIST_STORE(model), G_OBJECT(string), G_OBJECT(new_string));
}
gtk_widget_destroy(dialog);
-#endif
} else {
xfce_err(_("No row has been selected for edit"));
}
-
+#endif
}
static void
Modified: xfbib/trunk/src/xfbib-multiple-input.c
===================================================================
--- xfbib/trunk/src/xfbib-multiple-input.c 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-multiple-input.c 2009-04-17 15:42:54 UTC (rev 7224)
@@ -69,7 +69,7 @@
static void cb_add_button_clicked_event(GtkWidget *tree_view)
{
- g_printf("cb_add_button_clicked_event\n");
+ g_print("cb_add_button_clicked_event\n");
GtkWidget *dialog;
GtkListStore *list;
GtkTreeIter iter;
@@ -101,7 +101,7 @@
static void cb_remove_button_clicked_event(GtkWidget *tree_view)
{
- g_printf("cb_remove_button_clicked_event\n");
+ g_print("cb_remove_button_clicked_event\n");
GtkTreeModel *model;
GtkTreeIter iter;
GtkTreeSelection *selection;
Modified: xfbib/trunk/src/xfbib-string-tree-view.c
===================================================================
--- xfbib/trunk/src/xfbib-string-tree-view.c 2009-04-17 13:31:55 UTC (rev 7223)
+++ xfbib/trunk/src/xfbib-string-tree-view.c 2009-04-17 15:42:54 UTC (rev 7224)
@@ -50,6 +50,7 @@
cb_row_activated (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
{
g_print("cb_row_activated\n");
+#if 0
XfbibState *state;
XfbibBibtexString *string, *new_string;
GtkWidget *dialog;
@@ -61,24 +62,27 @@
if (gtk_tree_model_get_iter(model, &iter, path)) {
string = XFBIB_BIBTEX_STRING(xfbib_list_store_get(XFBIB_LIST_STORE(model), &iter));
-#if 0
dialog = xfbib_string_edit_dialog_new(string);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
new_string = xfbib_string_edit_dialog_get(XFBIB_STRING_EDIT_DIALOG(dialog));
xfbib_list_store_replace(XFBIB_LIST_STORE(model), string, new_string);
}
gtk_widget_destroy(dialog);
+ }
#endif
- }
}
static gboolean
cb_button_press (GtkWidget *tree_view, GdkEventButton *event, gpointer data)
{
g_print("cb_button_press\n");
+#if 0
XfbibBibtexString *new_string;
+#endif
GtkTreeModel *model;
+#if 0
GtkWidget *dialog;
+#endif
if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
/* single click with the right mouse button */
More information about the Goodies-commits
mailing list