Paul, thanks for your untiring help...
I tried to insert your code in my cell_edited function, with
Code:
struct YourStruc {gint type, year; ghcar* author, index, title;};
enum {T_ART, T_BOK, T_IBK, T_ICL, T_IPR, T_MSC, T_TRP, T_UPB};
lines are in .h file that is included.
Code:
void cell_edited(GtkCellRendererText *renderer,
gchar *path,
gchar *new_text,
GtkTreeView *treeview)
YourStruc rowinfo;
gchar* fout=NULL,str,str2=NULL,type;
gchar s[1000];
{
guint column,row;
GtkTreeIter iter;
GtkTreeModel *model;
gpointer columnptr = g_object_get_data(G_OBJECT(renderer), "column");
column = GPOINTER_TO_UINT(columnptr);
if (g_ascii_strcasecmp (new_text, "") != 0)
{ g_signal_emit_by_name(NULL,"actfile",NULL);
model = gtk_tree_view_get_model (treeview);
if (gtk_tree_model_get_iter_from_string (model, &iter, path))
gtk_list_store_set (GTK_LIST_STORE (model), &iter, column, new_text, -1);
rowinfo=g_array_index(data, YourStruc, j);
switch (rowinfo.type)
{
case T_ART:
type=g_strdup("Article");
break;
case T_BOK:
type=g_strdup("Book");
break;
case T_IBK:
type=g_strdup("InBook");
break;
case T_ICL:
type=g_strdup("InCollection");
break;
case T_IPR:
type=g_strdup("InProceedings");
break;
case T_TRP:
type=g_strdup("TechReport");
break;
case T_UPB:
type=g_strdup("Unpublished");
break;
case T_MSC:
default:
type=g_strdup("Misc");
break;
}
g_snprintf(s, 1000, "@%s{%s,\nAuthor=\"%s\",\nTitle=\"%s\",\nYear=\"%d\",\n}", type, rowinfo.index, rowinfo.author, rowinfo.title, rowinfo.year);
g_free(type);
str2=g_strjoin("\n",str,s,NULL);
g_free(str);
str=g_strdup(str2);
g_free(str2)
}
g_file_set_contents(fout, cts, -1, &Err);
g_free(str);
g_free(fout);
}
}
it complains:
Quote:
error: unknown type name ‘YourStruc’
error: parameter ‘fout’ is initialized
error: parameter ‘str2’ is initialized
etc...
Can you kindly have a look? I am feelling like a dumb!