"|", -1),
&error);
+ ret = GTK_WIDGET (gtk_builder_get_object (priv->gtkbuilder, "w_changes"));
+
sql_where = g_string_new ("");
for (strpart = 0; strpart < l; strpart++)
gtk_tree_view_column_pack_start (vcolumn, renderer, TRUE);
gtk_tree_view_column_set_title (vcolumn, "ID");
gtk_tree_view_column_add_attribute (vcolumn, renderer, "text", COL_CHANGES_ID);
+ gtk_tree_view_append_column (tview, vcolumn);
gtype[COL_CHANGES_DATE] = G_TYPE_STRING; /* date */
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (vcolumn, renderer, TRUE);
gtk_tree_view_column_set_title (vcolumn, "Date");
gtk_tree_view_column_add_attribute (vcolumn, renderer, "text", COL_CHANGES_DATE);
+ gtk_tree_view_append_column (tview, vcolumn);
gtype[COL_CHANGES_OPERATION] = G_TYPE_STRING; /* type */
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (vcolumn, renderer, TRUE);
gtk_tree_view_column_set_title (vcolumn, "Operation");
gtk_tree_view_column_add_attribute (vcolumn, renderer, "text", COL_CHANGES_OPERATION);
+ gtk_tree_view_append_column (tview, vcolumn);
gtype[COL_CHANGES_USER] = G_TYPE_STRING; /* username */
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (vcolumn, renderer, TRUE);
gtk_tree_view_column_set_title (vcolumn, "User");
gtk_tree_view_column_add_attribute (vcolumn, renderer, "text", COL_CHANGES_USER);
+ gtk_tree_view_append_column (tview, vcolumn);
for (row = 0; row < rows; row++)
{
* column->field_value =
*/
+ gtype[CHANGES_STATIC_COLUMNS + row] = G_TYPE_STRING;
+ renderer = gtk_cell_renderer_text_new ();
+ vcolumn = gtk_tree_view_column_new ();
+ gtk_tree_view_column_pack_start (vcolumn, renderer, TRUE);
+ gtk_tree_view_column_set_title (vcolumn, column->field_name);
+ gtk_tree_view_column_add_attribute (vcolumn, renderer, "text", CHANGES_STATIC_COLUMNS + row);
+ gtk_tree_view_append_column (tview, vcolumn);
+
g_hash_table_insert (ht_columns, (gpointer)column->field_name, (gpointer)column);
gtype[CHANGES_STATIC_COLUMNS + row] = G_TYPE_STRING;
g_object_unref (dm);
}
- lstore = GTK_LIST_STORE (gtk_list_store_newv (4 + rows, gtype));
+ lstore = GTK_LIST_STORE (gtk_list_store_newv (CHANGES_STATIC_COLUMNS + rows, gtype));
gtk_tree_view_set_model (tview, GTK_TREE_MODEL (lstore));
/* find the last action
/* TODO check if key field value is changed */
- /* TODO i could find field that there's not in columns (the dm passed)*/
+ /* TODO i could find field that there's not in columns (the dm passed) */
if (gdaex_data_model_get_field_value_integer_at (dm, 0, "type") == ZAK_AUDIT_ACTION_DELETE)
{
/* last values are stored in zakaudit tables */
sql = g_strdup_printf ("SELECT v.*, f.name"
" FROM values AS v"
- " INNSER JOIN fields AS f ON v.id_fields = f.id"
+ " INNER JOIN fields AS f ON v.id_fields = f.id"
" WHERE v.id_actions = %d",
gdaex_data_model_get_field_value_integer_at (dm, 0, "id"));
dm = gdaex_query (priv->gdaex, sql);
g_object_unref (dm);
}
- ret = NULL;
g_warning ("The function is still to be implemented");
return ret;
/*
* test1.c
*
- * Copyright (C) 2005-2013 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2005-2014 Andrea Zagli <azagli@libero.it>
*
* This file is part of libaudit.
*
{ NULL }
};
+gboolean
+on_w_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ return FALSE;
+}
+
int
main (int argc, char *argv[])
{
cnc_zakaudit = NULL;
cnc_db = NULL;
- g_type_init ();
+ GtkWidget *w;
+
+ gtk_init (&argc, &argv);
ctx = g_option_context_new ("");
g_option_context_add_main_entries (ctx, entries, "audit_test1");
g_warning ("User insertion: %s",
zak_audit_get_user_insertion (audit, "audit_test1", "test1", (const gchar **)g_strsplit ("id|2", "|", -1)));
+ w = zak_audit_get_changes_widget (audit, "audit_test1", "test1", (const gchar **)g_strsplit ("id|2", "|", -1));
+
+ g_signal_connect (w, "delete-event", G_CALLBACK (on_w_delete_event), NULL);
+ g_signal_connect (w, "destroy", gtk_main_quit, NULL);
+
+ gtk_widget_show_all (w);
+
+ gtk_main ();
+
zak_audit_destroy (audit);
return 0;