/*
- * Copyright (C) 2010-2017 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2018 Andrea Zagli <azagli@libero.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
return ret;
}
+gboolean
+solipa_gtk_tree_model_get_value_boolean (GtkTreeModel *model, GtkTreeIter *iter, gint column)
+{
+ gboolean ret;
+ GValue *gval;
+
+ ret = FALSE;
+
+ gval = g_new0 (GValue, 1);
+ gtk_tree_model_get_value (model, iter, column, gval);
+
+ if (G_VALUE_HOLDS_BOOLEAN (gval))
+ {
+ ret = g_value_get_boolean (gval);
+ }
+ else if (G_VALUE_HOLDS_INT (gval))
+ {
+ ret = (g_value_get_int (gval) == 0 ? FALSE : TRUE);
+ }
+ else if (G_VALUE_HOLDS_UINT (gval))
+ {
+ ret = ((gint)g_value_get_uint (gval) == 0 ? FALSE : TRUE);
+ }
+ else if (G_VALUE_HOLDS_STRING (gval))
+ {
+ ret = zak_utils_string_to_boolean (g_value_get_string (gval));
+ }
+ g_value_unset (gval);
+
+ return ret;
+}
+
struct tm
*solipa_gtk_tree_model_get_value_tm (GtkTreeModel *model, GtkTreeIter *iter, gint column, const gchar *format)
{
/*
- * Copyright (C) 2010-2015 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2018 Andrea Zagli <azagli@libero.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
gint solipa_gtk_tree_model_get_value_integer (GtkTreeModel *model, GtkTreeIter *iter, gint column);
gdouble solipa_gtk_tree_model_get_value_double (GtkTreeModel *model, GtkTreeIter *iter, gint column);
const gchar *solipa_gtk_tree_model_get_value_double_sql (GtkTreeModel *model, GtkTreeIter *iter, gint column);
+gboolean solipa_gtk_tree_model_get_value_boolean (GtkTreeModel *model, GtkTreeIter *iter, gint column);
struct tm *solipa_gtk_tree_model_get_value_tm (GtkTreeModel *model, GtkTreeIter *iter, gint column, const gchar *format);
GDateTime *solipa_gtk_tree_model_get_value_gdatetime (GtkTreeModel *model, GtkTreeIter *iter, gint column, const gchar *format);