gtk_form_field_boolean_clear
gtk_form_field_boolean_is_empty
gtk_form_filed_boolean_is_changed
+gtk_form_field_boolean_set_as_origin
gtk_form_field_boolean_set_from_datamodel
gtk_form_field_boolean_str_to_boolean
</SECTION>
gtk_form_widget_set_from_gtkbuilder
gtk_form_widget_get_widget
gtk_form_widget_get_widget_name
+gtk_form_widget_get_label
+gtk_form_widget_set_label
gtk_form_widget_get_value_stringify
gtk_form_widget_set_value_stringify
gtk_form_widget_set_editable
gtk_form_field_text_clear
gtk_form_field_text_is_empty
gtk_form_field_text_is_changed
+gtk_form_field_text_set_as_origin
gtk_form_field_text_set_from_datamodel
</SECTION>
gtk_form_field_datetime_clear
gtk_form_field_datetime_is_empty
gtk_form_field_datetime_is_changed
+gtk_form_field_datetime_set_as_origin
gtk_form_field_datetime_set_from_datamodel
gtk_form_field_datetime_get_tm_from_str
+gtk_form_field_datetime_get_str_from_tm
</SECTION>
<SECTION>
gtk_form_field_float_clear
gtk_form_field_float_is_empty
gtk_form_field_float_is_changed
+gtk_form_field_float_set_as_origin
gtk_form_field_float_set_from_datamodel
</SECTION>
gtk_form_field_new
gtk_form_field_new_from_gtk_form_widget
gtk_form_field_get_field_name
-gtk_form_field_get_gtk_form_widget
+gtk_form_field_get_form_widget
gtk_form_field_get_value_stringify
gtk_form_field_get_value
gtk_form_field_get_value_sql
gtk_form_field_clear
gtk_form_field_is_empty
gtk_form_field_is_changed
+gtk_form_field_set_as_origin
gtk_form_field_set_from_datamodel
</SECTION>
gtk_form_clear
gtk_form_check
gtk_form_is_changed
+gtk_form_set_as_origin
gtk_form_set_sensitive
+gtk_form_set_sensitive_by_name
gtk_form_set_editable
GtkFormSqlType
gtk_form_get_sql
gtk_form_field_integer_clear
gtk_form_field_integer_is_empty
gtk_form_field_integer_is_changed
+gtk_form_field_integer_set_as_origin
gtk_form_field_integer_set_from_datamodel
</SECTION>
GtkFormField *field
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_field_boolean_set_as_origin</NAME>
+<RETURNS>void </RETURNS>
+GtkFormField *field
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_field_boolean_set_from_datamodel</NAME>
<RETURNS>gboolean </RETURNS>
GtkFormField *field, GdaDataModel *dm, gint row
GtkFormWidget *fwidget
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_widget_get_label</NAME>
+<RETURNS>GtkWidget *</RETURNS>
+GtkFormWidget *fwidget
+</FUNCTION>
+<FUNCTION>
+<NAME>gtk_form_widget_set_label</NAME>
+<RETURNS>void </RETURNS>
+GtkFormWidget *fwidget, GtkLabel *label
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_widget_get_value_stringify</NAME>
<RETURNS>const gchar *</RETURNS>
GtkFormWidget *fwidget
GtkFormField *field
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_field_text_set_as_origin</NAME>
+<RETURNS>void </RETURNS>
+GtkFormField *field
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_field_text_set_from_datamodel</NAME>
<RETURNS>gboolean </RETURNS>
GtkFormField *field, GdaDataModel *dm, gint row
GtkFormField *field
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_field_datetime_set_as_origin</NAME>
+<RETURNS>void </RETURNS>
+GtkFormField *field
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_field_datetime_set_from_datamodel</NAME>
<RETURNS>gboolean </RETURNS>
GtkFormField *field, GdaDataModel *dm, gint row
<RETURNS>struct tm *</RETURNS>
const gchar *str
</FUNCTION>
+<FUNCTION>
+<NAME>gtk_form_field_datetime_get_str_from_tm</NAME>
+<RETURNS>gchar *</RETURNS>
+struct tm *datetime, const gchar *format
+</FUNCTION>
<MACRO>
<NAME>TYPE_GTK_FORM_WIDGET_LABEL</NAME>
#define TYPE_GTK_FORM_WIDGET_LABEL (gtk_form_widget_label_get_type ())
GtkFormField *field
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_field_float_set_as_origin</NAME>
+<RETURNS>void </RETURNS>
+GtkFormField *field
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_field_float_set_from_datamodel</NAME>
<RETURNS>gboolean </RETURNS>
GtkFormField *field, GdaDataModel *dm, gint row
<FUNCTION>
<NAME>gtk_form_key_check</NAME>
<RETURNS>gboolean </RETURNS>
-GtkFormKey *gtk_form_key
+GtkFormKey *gtk_form_key, GtkFormWidget **form_widget
</FUNCTION>
<FUNCTION>
<NAME>gtk_form_key_get_sql</NAME>
gboolean (*clear) (GtkFormField *field);
gboolean (*is_empty) (GtkFormField *field);
gboolean (*is_changed) (GtkFormField *field);
+ void (*set_as_origin) (GtkFormField *field);
gboolean (*set_from_datamodel) (GtkFormField *field, GdaDataModel *dm, gint row);
};
</STRUCT>
GtkFormField *field
</FUNCTION>
<FUNCTION>
-<NAME>gtk_form_field_get_gtk_form_widget</NAME>
+<NAME>gtk_form_field_get_form_widget</NAME>
<RETURNS>GtkFormWidget *</RETURNS>
GtkFormField *field
</FUNCTION>
GtkFormField *field
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_field_set_as_origin</NAME>
+<RETURNS>void </RETURNS>
+GtkFormField *field
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_field_set_from_datamodel</NAME>
<RETURNS>gboolean </RETURNS>
GtkFormField *field, GdaDataModel *dm, gint row
<FUNCTION>
<NAME>gtk_form_check</NAME>
<RETURNS>gboolean </RETURNS>
-GtkForm *form
+GtkForm *form, gboolean with_key,GtkFormWidget **form_widget,gboolean show_error_dialog, GtkWidget *parent_window,gboolean set_focus
</FUNCTION>
<FUNCTION>
<NAME>gtk_form_is_changed</NAME>
GtkForm *form
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_set_as_origin</NAME>
+<RETURNS>void </RETURNS>
+GtkForm *form
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_set_sensitive</NAME>
<RETURNS>void </RETURNS>
GtkForm *form, gboolean sensitive
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_set_sensitive_by_name</NAME>
+<RETURNS>void </RETURNS>
+GtkForm *form, gboolean sensitive, ...
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_set_editable</NAME>
<RETURNS>void </RETURNS>
GtkForm *form, gboolean editable
GtkFormField *field
</FUNCTION>
<FUNCTION>
+<NAME>gtk_form_field_integer_set_as_origin</NAME>
+<RETURNS>void </RETURNS>
+GtkFormField *field
+</FUNCTION>
+<FUNCTION>
<NAME>gtk_form_field_integer_set_from_datamodel</NAME>
<RETURNS>gboolean </RETURNS>
GtkFormField *field, GdaDataModel *dm, gint row
+gtk_form_field_get_gtk_form_widget
gtk_form_get_field_from_name
gtk_form_get_widget_from_name
-6% symbol docs coverage.
-17 symbols documented.
-2 symbols incomplete.
-261 not documented.
+7% symbol docs coverage.
+19 symbols documented.
+1 symbols incomplete.
+271 not documented.
GTK_FORM
gtk_form_field_boolean_get_value_stringify
gtk_form_field_boolean_is_empty
gtk_form_field_boolean_new
+gtk_form_field_boolean_set_as_origin
gtk_form_field_boolean_set_from_datamodel
gtk_form_field_boolean_str_to_boolean (value)
gtk_form_field_clear
gtk_form_field_datetime_clear
+gtk_form_field_datetime_get_str_from_tm
gtk_form_field_datetime_get_tm_from_str
gtk_form_field_datetime_get_type
gtk_form_field_datetime_get_value
gtk_form_field_datetime_is_changed
gtk_form_field_datetime_is_empty
gtk_form_field_datetime_new
+gtk_form_field_datetime_replace_str
+gtk_form_field_datetime_set_as_origin
gtk_form_field_datetime_set_from_datamodel
gtk_form_field_float_clear
gtk_form_field_float_get_type
gtk_form_field_float_is_changed
gtk_form_field_float_is_empty
gtk_form_field_float_new
+gtk_form_field_float_set_as_origin
gtk_form_field_float_set_from_datamodel
gtk_form_field_get_field_name
-gtk_form_field_get_gtk_form_widget (Returns)
gtk_form_field_get_str_format
gtk_form_field_get_type
gtk_form_field_get_value
gtk_form_field_integer_is_changed
gtk_form_field_integer_is_empty
gtk_form_field_integer_new
+gtk_form_field_integer_set_as_origin
gtk_form_field_integer_set_from_datamodel
gtk_form_field_is_changed
gtk_form_field_is_empty
gtk_form_field_text_is_changed
gtk_form_field_text_is_empty
gtk_form_field_text_new
+gtk_form_field_text_set_as_origin
gtk_form_field_text_set_from_datamodel
gtk_form_filed_boolean_is_changed
gtk_form_fill_from_datamodel
gtk_form_set_editable
gtk_form_set_key
gtk_form_set_sensitive
+gtk_form_set_sensitive_by_name
gtk_form_set_table
gtk_form_widget_check_get_type
gtk_form_widget_check_get_value_stringify
gtk_form_widget_entry_new
gtk_form_widget_entry_set_editable
gtk_form_widget_entry_set_value_stringify
+gtk_form_widget_get_label
gtk_form_widget_get_type
gtk_form_widget_get_value_stringify
gtk_form_widget_get_widget
gtk_form_widget_new
gtk_form_widget_set_editable
gtk_form_widget_set_from_gtkbuilder
+gtk_form_widget_set_label
gtk_form_widget_set_value_stringify
gtk_form_widget_spin_get_type
gtk_form_widget_spin_get_value_stringify
GtkFormWidgetLabelClass
GtkFormWidgetSpinClass
GtkFormWidgetTextviewClass
+gtk_form_field_boolean_set_as_origin
gtk_form_field_boolean_str_to_boolean
+gtk_form_field_datetime_get_str_from_tm
gtk_form_field_datetime_get_tm_from_str
gtk_form_field_datetime_is_changed
+gtk_form_field_datetime_set_as_origin
gtk_form_field_float_is_changed
+gtk_form_field_float_set_as_origin
+gtk_form_field_get_form_widget
gtk_form_field_integer_is_changed
+gtk_form_field_integer_set_as_origin
gtk_form_field_is_changed
+gtk_form_field_set_as_origin
gtk_form_field_text_is_changed
+gtk_form_field_text_set_as_origin
gtk_form_filed_boolean_is_changed
gtk_form_get_form_field_from_name
gtk_form_get_form_widget_from_name
gtk_form_is_changed
gtk_form_new_from_file
gtk_form_new_from_xml
+gtk_form_set_as_origin
gtk_form_set_key
+gtk_form_set_sensitive_by_name
gtk_form_set_table
+gtk_form_widget_get_label
+gtk_form_widget_set_label
@Returns:
-<!-- ##### FUNCTION gtk_form_field_get_gtk_form_widget ##### -->
-<para>
-
-</para>
-
-@field:
-@Returns:
-
-
<!-- ##### FUNCTION gtk_form_field_get_value_stringify ##### -->
<para>
</para>
@form:
+@with_key:
+@form_widget:
+@show_error_dialog:
+@parent_window:
+@set_focus:
@Returns:
</para>
@gtk_form_key:
+@form_widget:
@Returns:
@value:
@Returns:
+<!-- ##### FUNCTION gtk_form_field_get_gtk_form_widget ##### -->
+<para>
+
+</para>
+
+@field:
+@Returns:
+
<!-- ##### FUNCTION gtk_form_get_field_from_name ##### -->
<para>
static gchar *gtk_form_field_get_str_format (GtkFormField *field);
+static gchar *gtk_form_field_datetime_str_replace (const gchar *string,
+ const gchar *origin,
+ const gchar *replace);
+
#define GTK_FORM_FIELD_DATETIME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_FIELD_DATETIME, GtkFormFieldDateTimePrivate))
typedef struct _GtkFormFieldDateTimePrivate GtkFormFieldDateTimePrivate;
{
struct tm *default_value;
struct tm *original_value;
+
gint type;
};
{
struct tm *datetime;
GValue *ret;
- const gchar *format;
const gchar *value;
g_return_val_if_fail (IS_GTK_FORM_FIELD_DATETIME (field), NULL);
ret = NULL;
- format = gtk_form_field_get_str_format (field);
-
value = gtk_form_field_datetime_get_value_stringify (field);
datetime = gtk_form_field_datetime_get_tm_from_str (value);
datetime = gtk_form_field_datetime_get_tm_from_str (value);
if (datetime != NULL)
{
- char *buf;
-
- buf = g_malloc (20);
+ gchar *value;
- if (strftime (buf, 20, format, datetime) != 0)
+ value = gtk_form_field_datetime_get_str_from_tm (datetime, format);
+ if (value != NULL)
{
- ret = g_strconcat ("'", buf, "'", NULL);
+ ret = g_strconcat ("'", value, "'", NULL);
}
- g_free (buf);
}
}
if (priv->default_value != NULL)
{
- char *buf;
+ gchar *value;
- buf = malloc (30);
-
- if (strftime (buf, 30, format, priv->default_value) != '\0')
+ value = gtk_form_field_datetime_get_str_from_tm (priv->default_value, format);
+ if (value != NULL)
{
- ret = gtk_form_field_datetime_set_value_stringify (field, buf);
+ ret = gtk_form_field_datetime_set_value_stringify (field, value);
}
}
else
struct tm
*gtk_form_field_datetime_get_tm_from_str (const gchar *str)
{
-
/* TO DO
* check if it is a valid date/time
*/
return tm;
}
+/**
+ * gtk_form_field_datetime_get_str_from_tm:
+ * @datetime: a tm struct.
+ * @format:
+ *
+ * Returns: a string representation of @datetime based on the format in @format.
+ * It interprets a very little subset of format identifier from strftime.
+ * %Y: the year with 4 digits.
+ * %m: the month with 2 digits.
+ * %d: the day with 2 digits.
+ * %H: the hours with 2 digits 00-24.
+ * %M: the minutes with 2 digits 00-59.
+ * %S: the seconds with 2 digits 00-59.
+ */
+gchar
+*gtk_form_field_datetime_get_str_from_tm (struct tm *datetime,
+ const gchar *format)
+{
+ gchar *ret;
+
+ g_return_val_if_fail (datetime != NULL, "");
+
+ ret = gtk_form_field_datetime_str_replace (format, "%Y",
+ g_strdup_printf ("%04u", datetime->tm_year + 1900));
+ ret = gtk_form_field_datetime_str_replace (ret, "%m",
+ g_strdup_printf ("%02u", datetime->tm_mon + 1));
+ ret = gtk_form_field_datetime_str_replace (ret, "%d",
+ g_strdup_printf ("%02u", datetime->tm_mday));
+ ret = gtk_form_field_datetime_str_replace (ret, "%H",
+ g_strdup_printf ("%02u", datetime->tm_hour));
+ ret = gtk_form_field_datetime_str_replace (ret, "%M",
+ g_strdup_printf ("%02u", datetime->tm_min));
+ ret = gtk_form_field_datetime_str_replace (ret, "%S",
+ g_strdup_printf ("%02u", datetime->tm_sec));
+
+ return ret;
+}
+
/* PRIVATE */
static void
gtk_form_field_datetime_set_property (GObject *object,
switch (priv->type)
{
case GTK_FORM_FIELD_DATETIME_TYPE_DATETIME:
- format = g_strdup ("%F %T");
+ format = g_strdup ("%Y-%m-%d %H-%M-%S");
break;
case GTK_FORM_FIELD_DATETIME_TYPE_DATE:
- format = g_strdup ("%F");
+ format = g_strdup ("%Y-%m-%d");
break;
case GTK_FORM_FIELD_DATETIME_TYPE_TIME:
- format = g_strdup ("%T");
+ format = g_strdup ("%H-%M-%S");
break;
}
return format;
}
+
+/**
+ * gtk_form_field_datetime_replace_str:
+ * @string: the string where make the replace.
+ * @origin: the string to replace.
+ * @replace: the string to insert.
+ *
+ * Returns: a string with replaced string.
+ */
+static gchar
+*gtk_form_field_datetime_str_replace (const gchar *string,
+ const gchar *origin,
+ const gchar *replace)
+{
+ gchar *ret;
+ gchar *p;
+
+ p = g_strstr_len (string, -1, origin);
+
+ if (p == NULL)
+ {
+ return (gchar *)string;
+ }
+
+ ret = g_strndup (string, p - string);
+
+ ret = g_strdup_printf ("%s%s%s", ret, replace, p + strlen (origin));
+
+ return ret;
+}
gboolean gtk_form_field_datetime_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row);
struct tm *gtk_form_field_datetime_get_tm_from_str (const gchar *str);
+gchar *gtk_form_field_datetime_get_str_from_tm (struct tm *datetime, const gchar *format);
G_END_DECLS