/*
* gridcolumn.c
*
- * Copyright (C) 2010-2011 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2013 Andrea Zagli <azagli@libero.it>
*
* This file is part of libgdaex_grid_column.
*
return gdaex_grid_column;
}
+GdaExGridColumn
+*gdaex_grid_column_new_defaults (const gchar *title,
+ const gchar *field_name,
+ GType type)
+{
+ return gdaex_grid_column_new (title,
+ field_name,
+ type,
+ TRUE,
+ TRUE,
+ TRUE,
+ TRUE,
+ type == G_TYPE_FLOAT || type == G_TYPE_DOUBLE ? 2 : 0);
+}
+
void
gdaex_grid_column_set_title (GdaExGridColumn *column, const gchar *title)
{
GValue *gval;
GDate *gdate;
+ GDateTime *gdatetime;
gtk_init (&argc, &argv);
g_value_set_boxed (gval, gdate);
g_hash_table_insert (ht_fields, "birthday", gval);
+ gval = g_new0 (GValue, 1);
+ g_value_init (gval, G_TYPE_DATE_TIME);
+ gdatetime = g_date_time_new_now_local ();
+ g_value_set_boxed (gval, gdatetime);
+ g_hash_table_insert (ht_fields, "oggi", gval);
+
gval = g_new0 (GValue, 1);
g_value_init (gval, G_TYPE_STRING);
g_value_set_string (gval, "5th avenue, 44");
/*
- * Copyright (C) 2011 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2011-2013 Andrea Zagli <azagli@libero.it>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (w), 550, 350);
+ g_signal_connect (w, "delete-event",
+ G_CALLBACK (gtk_false), NULL);
+ g_signal_connect (w, "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
scrolledw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (w), scrolledw);
gcol = gdaex_grid_column_new ("Name", "name", G_TYPE_STRING, TRUE, TRUE, TRUE, TRUE, -1);
gdaex_grid_add_column (grid, gcol);
- gcol = gdaex_grid_column_new ("Surname", "surname", G_TYPE_STRING, TRUE, TRUE, TRUE, TRUE, -1);
+ gcol = gdaex_grid_column_new_defaults ("Surname", "surname", G_TYPE_STRING);
gdaex_grid_add_column (grid, gcol);
- gcol = gdaex_grid_column_new ("Age", "age", G_TYPE_INT, TRUE, TRUE, TRUE, TRUE, -1);
+ gcol = gdaex_grid_column_new_defaults ("Age", "age", G_TYPE_INT);
gdaex_grid_add_column (grid, gcol);
gcol = gdaex_grid_column_new ("Birthday", "birthday", G_TYPE_DATE, TRUE, TRUE, TRUE, TRUE, -1);
gdaex_grid_add_column (grid, gcol);
- gcol = gdaex_grid_column_new ("Incoming", "incoming", G_TYPE_DOUBLE, TRUE, TRUE, TRUE, TRUE, 2);
+ gcol = gdaex_grid_column_new_defaults ("Incoming", "incoming", G_TYPE_DOUBLE);
gdaex_grid_add_column (grid, gcol);
gcol = gdaex_grid_column_new ("Married", "married", G_TYPE_BOOLEAN, TRUE, TRUE, TRUE, TRUE, -1);