28 #include "gnc-html-history.h"
37 gnc_html_history_destroy_cb destroy_cb;
38 gpointer destroy_cb_data;
46 gnc_html_history_new(
void)
50 hist->current_node = NULL;
51 hist->last_node = NULL;
66 for (n = hist->nodes; n ; n = n->next)
71 hist->destroy_cb_data);
75 g_list_free(hist->nodes);
78 hist->current_node = NULL;
79 hist->last_node = NULL;
89 gnc_html_history_destroy_cb cb,
92 hist->destroy_cb = cb;
93 hist->destroy_cb_data = cb_data;
97 g_strcmp(
char * a,
char * b)
129 if (hist->current_node)
131 hn = hist->current_node->data;
132 if ((hn->type == node->type) &&
133 !g_strcmp(hn->location, node->location) &&
134 !g_strcmp(hn->label, node->label))
136 if (hist->destroy_cb)
138 (hist->destroy_cb)(hn, hist->destroy_cb_data);
140 gnc_html_history_node_destroy(node);
145 for (n = hist->current_node->next; n; n = n->next)
147 if (hist->destroy_cb)
150 hist->destroy_cb_data);
154 g_list_free(hist->current_node->next);
155 hist->current_node->next = NULL;
156 hist->last_node = hist->current_node;
160 n->data = (gpointer) node;
164 if (hist->nodes && hist->last_node)
166 n->prev = hist->last_node;
167 hist->last_node->next = n;
169 hist->current_node = n;
176 g_print (
"???? hist->nodes non-NULL, but no last_node \n");
180 hist->current_node = n;
192 if (!hist || !(hist->current_node))
return NULL;
194 return hist->current_node->data;
205 if (!hist || !(hist->current_node))
210 if (hist->current_node->next)
212 hist->current_node = hist->current_node->next;
215 return hist->current_node->data;
227 if (!hist || !(hist->current_node))
232 if (hist->current_node->prev)
234 hist->current_node = hist->current_node->prev;
237 return hist->current_node->data;
249 if (hist && hist->current_node && hist->current_node->prev)
268 if (hist && hist->current_node && hist->current_node->next)
284 gnc_html_history_node_new(URLType type,
const gchar * location,
289 rv->type = g_strdup(type);
290 rv->location = g_strdup(location);
291 rv->label = g_strdup(label);
306 g_free(node->location);
309 node->location = NULL;