From f5396702a7aabd381f975db07c614690407adb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20T=2E=20Colombini=20G=C3=B3mez?= Date: Fri, 21 Feb 2014 11:20:28 +0100 Subject: [PATCH] =?UTF-8?q?Entries=20y=20Spins=20modificados=20para=20usar?= =?UTF-8?q?=20una=20cadena=20de=20formato.=20Es=20posible=20realizar=20sel?= =?UTF-8?q?ecci=C3=B3n=20(y=20eliminaci=C3=B3n)=20multiple=20en=20el=20VnG?= =?UTF-8?q?rid.=20A=C3=B1adido=20VnLabel,=20campo=20de=20etiqueta=20no=20m?= =?UTF-8?q?odificable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- anjuta/hedera/configure.ac.tpl | 2 +- anjuta/hedera/src/Makefile.am.tpl | 5 +- configure.ac | 2 +- db/db-iter.c | 14 +- db/db-iterator.c | 72 ++++++- db/db-iterator.h | 2 + debian/libhedera-dev.dirs | 2 +- debian/libhedera-dev.install | 2 +- glade/Makefile.am | 6 +- glade/glade-db-model.c | 2 - glade/vn.xml | 25 ++- gvn/gvn-misc.c | 9 - gvn/gvn-misc.h | 3 - gvn/gvn-value.c | 147 ++++++++++---- gvn/gvn-value.h | 2 +- module/src/vn-consulter.c | 35 +++- plugin/pg/db-pg.c | 36 +++- po/POTFILES.in | 2 + po/ca.po | 235 ++++++++++------------- po/es.po | 309 ++++++++++++++++-------------- po/nl.po | 235 ++++++++++------------- sql/parser/scan.rl | 10 - sql/sql-parser.h | 8 +- sql/sql-string.c | 2 +- vn/column/vn-column-combo.c | 18 +- vn/column/vn-column-entry.c | 27 +-- vn/column/vn-column-entry.h | 1 + vn/column/vn-column-spin.c | 74 ++++--- vn/field/Makefile.am | 6 +- vn/field/vn-date-chooser.c | 100 ++++++++-- vn/field/vn-date-chooser.h | 3 + vn/field/vn-entry.c | 31 +-- vn/field/vn-entry.h | 3 +- vn/field/vn-label.c | 119 ++++++++++++ vn/field/vn-label.h | 49 +++++ vn/field/vn-spin.c | 7 +- vn/glade/vn-model.c | 2 +- vn/gui/login.glade | 6 + vn/vn-field.c | 2 +- vn/vn-grid-model.c | 129 +++++++++---- vn/vn-grid.c | 68 +++++-- vn/vn-handler.c | 6 +- vn/vn-login.c | 12 ++ 43 files changed, 1158 insertions(+), 672 deletions(-) create mode 100644 vn/field/vn-label.c create mode 100644 vn/field/vn-label.h diff --git a/anjuta/hedera/configure.ac.tpl b/anjuta/hedera/configure.ac.tpl index b2481cf..03b6379 100644 --- a/anjuta/hedera/configure.ac.tpl +++ b/anjuta/hedera/configure.ac.tpl @@ -16,7 +16,7 @@ AC_PROG_CC dnl Check for vala. dnl You should change the version manually to match with yours. -AM_PROG_VALAC([0.20.0]) +AM_PROG_VALAC([0.22.0]) [+IF (=(get "HaveI18n") "1")+] dnl Internationalization IT_PROG_INTLTOOL([0.35.0]) diff --git a/anjuta/hedera/src/Makefile.am.tpl b/anjuta/hedera/src/Makefile.am.tpl index 0efc804..3e0c5e2 100644 --- a/anjuta/hedera/src/Makefile.am.tpl +++ b/anjuta/hedera/src/Makefile.am.tpl @@ -34,10 +34,7 @@ -DGETTEXT_PACKAGE=\"hedera-[+Name+]\" [+ENDIF+] \ $([+NameCUpper+]_CFLAGS) [+(prefix_if_missing "NameCLower" "lib")+]_la_CFLAGS = $(CFLAGS) -[+(prefix_if_missing "NameCLower" "lib")+]_la_VALAFLAGS = [+IF (not (= (get "PackageModule2") ""))+]\ - --pkg [+(string-substitute (get "PackageModule2") " " " --pkg ")+] \ - [+ENDIF+]\ - $(VALAFLAGS) +[+(prefix_if_missing "NameCLower" "lib")+]_la_VALAFLAGS = $(VALAFLAGS) [+NameCLower+]_querydir = $(querydir)/[+NameHLower+] [+NameCLower+]_query_DATA = diff --git a/configure.ac b/configure.ac index 6d2acfd..7c78a4b 100644 --- a/configure.ac +++ b/configure.ac @@ -58,7 +58,7 @@ if test x"$ENABLE_VALA" = x"yes" ; then GOBJECT_INTROSPECTION_CHECK([1.30.0]) AC_SUBST([GIR_SCANNER_ARGS], [--warn-all]) if $HAVE_INTROSPECTION; then - AC_SUBST([VALA_VERSION], [0.20]) + AC_SUBST([VALA_VERSION], [0.22]) AM_PROG_VALAC([$VALA_VERSION]) AC_PATH_PROG(VAPIGEN, [vapigen], ["no"]) fi diff --git a/db/db-iter.c b/db/db-iter.c index 1db1fe8..1e4235c 100644 --- a/db/db-iter.c +++ b/db/db-iter.c @@ -41,7 +41,12 @@ G_DEFINE_BOXED_TYPE (DbIter, db_iter, db_iter_copy, db_iter_free); **/ gboolean db_iter_compare (DbIter * a, DbIter * b) { - return (a->stamp == b->stamp && a->data == b->data); + if (a && b) + return (a->stamp == b->stamp && a->data == b->data); + else if (!a && !b) + return TRUE; + else + return FALSE; } /** @@ -65,8 +70,13 @@ DbIter * db_iter_copy (DbIter * obj) return dst; } +/** + * db_iter_free: + * @obj: (allow-none): a #DbIter + * + * Frees a #DbIter. + **/ void db_iter_free (DbIter * obj) { - g_return_if_fail (obj); g_free (obj); } diff --git a/db/db-iterator.c b/db/db-iterator.c index beca393..d24e544 100644 --- a/db/db-iterator.c +++ b/db/db-iterator.c @@ -75,7 +75,7 @@ static void db_iterator_row_num_changed (DbIterator * obj) { if (obj->row_selected) obj->row = db_model_get_path (obj->model, &obj->iter); - else if (!obj->remember_selection) + else if (obj->selected || !obj->remember_selection) obj->row = -1; g_signal_emit (obj, signals[ROW_NUM_CHANGED], 0); @@ -91,6 +91,15 @@ static void db_iterator_iter_changed (DbIterator * obj) g_signal_emit (obj, signals[ITER_CHANGED], 0); } +static void db_iterator_unselect (DbIterator * obj) +{ + if (obj->selected) + { + g_hash_table_destroy (obj->selected); + obj->selected = NULL; + } +} + static void db_iterator_set_iter (DbIterator * obj, DbIter * iter) { if (iter) @@ -104,6 +113,8 @@ static void db_iterator_set_iter (DbIterator * obj, DbIter * iter) obj->row_selected = FALSE; db_iterator_iter_changed (obj); } + + db_iterator_unselect (obj); } /* @@ -144,7 +155,7 @@ static void db_iterator_on_model_line_deleted (DbModel * model, gint row, DbIter static void db_iterator_on_model_line_deleted_after (DbModel * model, gint row, DbIterator * obj) { - if (obj->row_selected) + if (obj->row_selected || obj->selected) db_iterator_row_num_changed (obj); g_signal_emit (obj, signals[DATA_CHANGED], 0); @@ -156,7 +167,7 @@ static void db_iterator_on_model_line_deleted_after (DbModel * model, gint row, static void db_iterator_on_model_lines_reordered (DbModel * model, gint column, gint * new_order, DbIterator * obj) { - if (obj->row_selected) + if (obj->row_selected || obj->selected) db_iterator_row_num_changed (obj); } @@ -344,6 +355,36 @@ gboolean db_iterator_get_iter (DbIterator * obj, DbIter * iter) return TRUE; } +/** + * db_iterator_select_iter: + * @obj: a #DbIterator + * @iter: a #DbIter + * + * Adds a new #DbIter to the current selection. + */ +void db_iterator_select_iter (DbIterator * obj, DbIter * iter) +{ + gint pos; + + g_return_if_fail (DB_IS_ITERATOR (obj)); + g_return_if_fail (IS_READY (obj)); + + if (!iter) + return; + + if (!obj->selected) + obj->selected = g_hash_table_new_full (g_int_hash, g_int_equal, + NULL, (GDestroyNotify) db_iter_free); + + obj->iter = *iter; + obj->row_selected = FALSE; + g_signal_emit (obj, signals[ROW_NUM_CHANGED], 0); + pos = db_model_get_path (obj->model, iter); + + if (!g_hash_table_contains (obj->selected, &pos)) + g_hash_table_insert (obj->selected, &pos, db_iter_copy (iter)); +} + /** * db_iterator_move_iter: * @obj: a #DbIterator @@ -521,13 +562,25 @@ void db_iterator_delete (DbIterator * obj) { g_return_if_fail (DB_IS_ITERATOR (obj)); - if (db_iterator_check_row_selected (obj)) + if (obj->row_selected) { db_model_delete (obj->model, &obj->iter); if (obj->mode != DB_ITERATOR_MODE_ON_DEMAND) db_model_perform_operations (obj->model, FALSE); } + else if (obj->selected) + { + GList * l, * list = g_hash_table_get_values (obj->selected); + + for (l = list; l; l = l->next) + db_model_delete (obj->model, l->data); + + if (obj->mode != DB_ITERATOR_MODE_ON_DEMAND) + db_model_perform_operations (obj->model, FALSE); + + db_iterator_unselect (obj); + } } /** @@ -541,8 +594,11 @@ void db_iterator_refresh (DbIterator * obj) g_return_if_fail (DB_IS_ITERATOR (obj)); if (obj->model) + { db_model_refresh (obj->model); -}; + db_iterator_unselect (obj); + } +} /** * db_iterator_get_spec: @@ -816,7 +872,7 @@ DbModelRowOp db_iterator_get_pending_operations (DbIterator * obj) { g_return_val_if_fail (DB_IS_ITERATOR (obj), 0); - if (obj->model && obj->row_selected) + if (obj->model && (obj->row_selected || obj->selected)) return db_model_get_row_operations (obj->model, &obj->iter); return 0; @@ -895,6 +951,7 @@ static void db_iterator_init (DbIterator * obj) obj->params = NULL; obj->row = 0; obj->row_selected = FALSE; + obj->selected = NULL; } static void db_iterator_finalize (DbIterator * obj) @@ -906,6 +963,8 @@ static void db_iterator_finalize (DbIterator * obj) (GWeakNotify) db_iterator_unref_param, obj); g_list_free (obj->params); + + db_iterator_unselect (obj); if (obj->model) { @@ -935,7 +994,6 @@ static void db_iterator_class_init (DbIteratorClass * klass) /** * DbIterator::iter-changed: * @iterator: the object on which the signal is emitted - * @iter: a #DbIter * * This signal is emitted when @iter moves over the @iterator model */ diff --git a/db/db-iterator.h b/db/db-iterator.h index f39e963..e2ce309 100644 --- a/db/db-iterator.h +++ b/db/db-iterator.h @@ -78,6 +78,7 @@ struct _DbIterator GList * params; DbIteratorMode mode; DbIter iter; + GHashTable * selected; gint row; gboolean row_selected; gboolean remember_selection; @@ -98,6 +99,7 @@ DbIteratorMode db_iterator_get_mode (DbIterator * obj); void db_iterator_set_mode (DbIterator * obj, DbIteratorMode mode); gint db_iterator_get_row (DbIterator * obj); gboolean db_iterator_get_iter (DbIterator * obj, DbIter * iter); +void db_iterator_select_iter (DbIterator * obj, DbIter * iter); void db_iterator_move_iter (DbIterator * obj, DbIter * iter); void db_iterator_move_first (DbIterator * obj); void db_iterator_move_last (DbIterator * obj); diff --git a/debian/libhedera-dev.dirs b/debian/libhedera-dev.dirs index 894d505..744c31e 100644 --- a/debian/libhedera-dev.dirs +++ b/debian/libhedera-dev.dirs @@ -12,7 +12,7 @@ usr/lib/glade/modules #usr/lib/girepository-1.0 usr/share/gir-1.0 usr/share/glade/catalogs -usr/share/vala-0.20/vapi +usr/share/vala-0.22/vapi usr/share/gtk-doc/html/hedera usr/share/anjuta/templates diff --git a/debian/libhedera-dev.install b/debian/libhedera-dev.install index a79dd29..f10c8be 100644 --- a/debian/libhedera-dev.install +++ b/debian/libhedera-dev.install @@ -24,7 +24,7 @@ usr/lib/glade/modules/libgladevn.so #usr/lib/girepository-1.0/* usr/share/gir-1.0/* usr/share/glade/catalogs/* -usr/share/vala-0.20/vapi/* +usr/share/vala-0.22/vapi/* usr/share/gtk-doc/html/hedera/* usr/share/anjuta/templates/* diff --git a/glade/Makefile.am b/glade/Makefile.am index 1a768a4..9a48bd9 100644 --- a/glade/Makefile.am +++ b/glade/Makefile.am @@ -15,12 +15,12 @@ libgladevn_la_LDFLAGS = -avoid-version libgladevn_la_SOURCES = \ glade-vn.h \ glade-vn.c \ - glade-db-iterator.c \ - glade-eprop-model.c \ glade-vn-batch.c \ glade-db-model.c \ glade-db-model-editor.h \ - glade-db-model-editor.c + glade-db-model-editor.c \ + glade-eprop-model.c \ + glade-db-iterator.c gladevn_data_DATA = vn.xml diff --git a/glade/glade-db-model.c b/glade/glade-db-model.c index 1d50e6a..14c4116 100644 --- a/glade/glade-db-model.c +++ b/glade/glade-db-model.c @@ -302,9 +302,7 @@ void param_col_cell_data (GtkTreeViewColumn * view, GtkCellRenderer * cell, if (param) g_object_set (cell, "text", glade_widget_get_name (param), NULL); else - { g_object_set (cell, "text", "", NULL); - } } static void glade_eporp_links_on_param_col_editing_started (GtkCellRendererText * cell, diff --git a/glade/vn.xml b/glade/vn.xml index c3900de..bd99d6b 100644 --- a/glade/vn.xml +++ b/glade/vn.xml @@ -5,7 +5,6 @@ glade_vn_init - @@ -21,18 +20,17 @@ - + - - - + + + GParamBoxed GladeDbList - List of parameters linked to the model glade_db_model_create_eprop @@ -56,12 +54,11 @@ glade_db_model_holder_create_eprop - glade_db_iterator_post_create - glade_db_iterator_add_verify glade_db_iterator_add_child glade_db_iterator_remove_child glade_db_iterator_replace_child glade_db_iterator_get_children + glade_db_iterator_add_verify glade_db_iterator_read_widget glade_db_iterator_action_activate @@ -99,7 +96,7 @@ - + @@ -132,6 +129,7 @@ + @@ -173,6 +171,7 @@ + @@ -180,13 +179,12 @@ - glade_vn_batch_add_verify glade_vn_batch_add_child glade_vn_batch_remove_child glade_vn_batch_replace_child glade_vn_batch_get_children + glade_vn_batch_add_verify - @@ -198,7 +196,7 @@ - + @@ -207,10 +205,11 @@ - + + diff --git a/gvn/gvn-misc.c b/gvn/gvn-misc.c index 4c65772..05bee38 100644 --- a/gvn/gvn-misc.c +++ b/gvn/gvn-misc.c @@ -23,15 +23,6 @@ * @Short_description: Miscelaneous utility functions * @Title: Miscelaneous utility functions **/ - -const gchar * GVN_ABR_WDAY[] = {N_("Err"), - N_("Mon"), N_("Tue"), N_("Wed"), N_("Thu"), N_("Fri"), N_("Sat"), N_("Sun") -}; - -const gchar * GVN_ABR_MONTH[] = {N_("Err"), - N_("Jan"), N_("Feb"), N_("Mar"), N_("Apr"), N_("May"), N_("Jun"), - N_("Jul"), N_("Aug"), N_("Sep"), N_("Oct"), N_("Nov"), N_("Dec"), -}; /** * GETTEXT_PACKAGE: (skip) diff --git a/gvn/gvn-misc.h b/gvn/gvn-misc.h index a3dae15..245a514 100644 --- a/gvn/gvn-misc.h +++ b/gvn/gvn-misc.h @@ -26,7 +26,4 @@ void gvn_key_file_save (GKeyFile * obj, const gchar * file); gchar * gvn_encode (const gchar * string); gchar * gvn_decode (const gchar * string); -extern const gchar * GVN_ABR_WDAY[]; -extern const gchar * GVN_ABR_MONTH[]; - #endif diff --git a/gvn/gvn-value.c b/gvn/gvn-value.c index 28afc1d..27f082d 100644 --- a/gvn/gvn-value.c +++ b/gvn/gvn-value.c @@ -33,11 +33,11 @@ //+++++++++++++++++++++++++++++++++++++++++++++++++++ Private static void gvn_value_new_from_string_real (GValue * value, GType type, const gchar * string, gsize len) -{ +{ switch (type) { case G_TYPE_BOOLEAN: - g_value_set_boolean (value, atoi (string)); + g_value_set_boolean (value, atoi (string)); break; case G_TYPE_CHAR: g_value_set_schar (value, atoi (string)); @@ -46,7 +46,7 @@ static void gvn_value_new_from_string_real (GValue * value, GType type, const gc g_value_set_int (value, atoi (string)); break; case G_TYPE_UINT: - g_value_set_int (value, (guint) atoi (string)); + g_value_set_uint (value, (guint) atoi (string)); break; case G_TYPE_LONG: g_value_set_long (value, g_ascii_strtoll (string, NULL, 0)); @@ -67,37 +67,34 @@ static void gvn_value_new_from_string_real (GValue * value, GType type, const gc { if (len == -1) len = strlen (string); - + if (type == G_TYPE_DATE) { - if (len >= 10) - { - GDate * date = g_date_new_dmy ( - atoi (string + 8) - ,atoi (string + 5) - ,atoi (string) - ); + GDate * date = g_date_new (); + g_date_set_parse (date, string); + + if (g_date_valid (date)) g_value_take_boxed (value, date); - } else + { g_warning ("Gvn: Can't transform string to GDate"); + g_date_free (date); + } } else if (type == G_TYPE_DATE_TIME) { - if (len >= 19) - { - GDateTime * date_time = g_date_time_new_local ( - atoi (string) - ,atoi (string + 5) - ,atoi (string + 8) - ,atoi (string + 11) - ,atoi (string + 14) - ,atoi (string + 17) - ); - g_value_take_boxed (value, date_time); - } + GDateTime * datetime; + gchar ** dt = g_strsplit_set (string, " -:", 0); + + if (g_strv_length (dt) >= 6) + datetime = g_date_time_new_local + (atoi (dt[0]), atoi (dt[1]), atoi (dt[2]), + atoi (dt[3]), atoi (dt[4]), atoi (dt[5])); else g_warning ("Gvn: Can't transform string to GDateTime"); + + g_value_take_boxed (value, datetime); + g_strfreev (dt); } else if (type == G_TYPE_BYTES) { @@ -289,7 +286,7 @@ void gvn_value_new_with_content (GValue * value, GType type, gpointer content) g_value_set_string (value, (gchar *) content); break; default: - if (type == G_TYPE_DATE + if (type == G_TYPE_DATE || type == G_TYPE_DATE_TIME || type == G_TYPE_BYTES) g_value_set_boxed (value, content); else if (G_TYPE_IS_OBJECT (type)) @@ -341,7 +338,7 @@ void gvn_value_get_valist (const GValue * value, va_list va) *va_arg (va, gchar**) = g_value_dup_string (value); break; default: - if (type == G_TYPE_DATE + if (type == G_TYPE_DATE || type == G_TYPE_DATE_TIME || type == G_TYPE_BYTES) *va_arg (va, gpointer*) = g_value_dup_boxed (value); else if (G_TYPE_IS_OBJECT (type)) @@ -484,45 +481,115 @@ gboolean gvn_value_ccopy (const GValue * src, GValue * dst) return TRUE; } +/* + * Checks the validity of @format attending to the valid specifier characters in + * @specifiers, the other flags in the format string won't be checked. + */ +gboolean format_valid (const gchar * format, const gchar * specifiers) +{ + gboolean started = FALSE; + gint i, j; + + if (format && specifiers) + for (i = 0; format[i] != '\0'; i++) + { + if (format[i] == '%') + { + started = TRUE; + continue; + } + else if (started && format[i] == ' ') + break; + + for (j = 0; specifiers[j] != '\0'; j++) + if (started && format[i] == specifiers[j] + && (format[i+1] == ' ' || format[i+1] == '\0')) + return TRUE; + } + + return FALSE; +} + /** * gvn_value_to_format_string: + * @src: source #GValue + * @format: a format string + * @dst: destination #GValue + * + * Sets the content of @dst to a string value depending on the type of @src and + * according to @format. @format must be a valid format string as the used by + * the printf() family of functions and, in the case of dates, the ones used by + * strftime(). See g_ascii_formatd() and g_date_time_format(). The output may + * vary depending on the locale. + * + * The accepted types are #gboolean, #guint, #gint, #gfloat, #gdouble, #guchar, + * #gchar, #gchararray, #GDate and #GDateTime, any other types may have an + * unexpected output. **/ -void gvn_value_to_format_string (const GValue * src, guint digits, GValue * dst) -//void gvn_value_to_format_string (const GValue * src, const gchar * format, GValue * dst) +void gvn_value_to_format_string (const GValue * src, const gchar * format, GValue * dst) { GType type = G_VALUE_TYPE (src); g_value_init (dst, G_TYPE_STRING); - + switch (type) { case G_TYPE_BOOLEAN: - break; - case G_TYPE_INT://y variantes - break; + { + gboolean b = g_value_get_boolean (src); + g_value_set_string (dst, b ? _("Yes") : _("No")); + break; + } + case G_TYPE_INT: + { + gchar * str; + gint i = g_value_get_int (src); + str = g_strdup_printf (format_valid (format, "duoXxp") ? format : "%d", i); + g_value_set_string (dst, str); + g_free (str); + break; + } + case G_TYPE_UINT: + { + gchar * str; + guint u = g_value_get_uint (src); + str = g_strdup_printf (format_valid (format, "udoXxp") ? format : "%u", u); + g_value_set_string (dst, str); + g_free (str); + break; + } case G_TYPE_FLOAT: case G_TYPE_DOUBLE: { gdouble dec; - gchar * format; gchar buffer [G_ASCII_DTOSTR_BUF_SIZE]; - + if (type == G_TYPE_FLOAT) dec = (gdouble) g_value_get_float (src); else dec = g_value_get_double (src); - - format = g_strdup_printf ("%%.%df", digits); - g_ascii_formatd (buffer, G_ASCII_DTOSTR_BUF_SIZE, format, dec); + + g_ascii_formatd (buffer, G_ASCII_DTOSTR_BUF_SIZE, + format_valid (format, "fFeEgGaA") ? format : "%.2f", dec); g_value_set_string (dst, buffer); - g_free (format); break; } default: if (type == G_TYPE_DATE) - {} + { + gchar buffer[120]; + GDate * date = g_value_get_boxed (src); + g_date_strftime (buffer, 120, format ? format : "%Y-%m-%d", date); + g_value_set_string (dst, buffer); + } else if (type == G_TYPE_DATE_TIME) - {} + { + gchar * str; + GDateTime * dt = g_value_get_boxed (src); + str = g_date_time_format (dt, format ? format : "%Y-%m-%d %T"); + g_value_set_string (dst, str); + g_free (str); + } else if (!gvn_value_is_null (src)) g_value_transform (src, dst); else diff --git a/gvn/gvn-value.h b/gvn/gvn-value.h index 63c9aaf..c685808 100644 --- a/gvn/gvn-value.h +++ b/gvn/gvn-value.h @@ -32,7 +32,7 @@ void gvn_value_get_valist (const GValue * value, va_list va); gint gvn_value_compare0 (const GValue * a, const GValue * b); void gvn_value_copy (const GValue * src, GValue * dst); gboolean gvn_value_ccopy (const GValue * src, GValue * dst); -void gvn_value_to_format_string (const GValue * src, guint digits, GValue * dst); +void gvn_value_to_format_string (const GValue * src, const gchar * format, GValue * dst); void gvn_type_init (); #endif diff --git a/module/src/vn-consulter.c b/module/src/vn-consulter.c index 670b77a..2903fc9 100644 --- a/module/src/vn-consulter.c +++ b/module/src/vn-consulter.c @@ -72,23 +72,38 @@ static void vn_consulter_model_status_changed (DbModel * model, VnColumn * column; GType col_type, type = db_model_get_column_type (model, i); gboolean image = FALSE; - - if (type == G_TYPE_INT || type == G_TYPE_UINT - || type == G_TYPE_FLOAT || type == G_TYPE_DOUBLE) + gchar * format = NULL; +/*col_type = VN_TYPE_COLUMN_ENTRY; + if (type == G_TYPE_INT) +format = "%d"; + else if (type == G_TYPE_UINT) +format = "%u"; + else*/ + if (type == G_TYPE_FLOAT || type == G_TYPE_DOUBLE + || type == G_TYPE_INT || type == G_TYPE_UINT) col_type = VN_TYPE_COLUMN_SPIN; +//format = "%.2f"; else if (type == G_TYPE_BYTES) col_type = VN_TYPE_COLUMN_IMAGE; else if (type == G_TYPE_BOOLEAN) col_type = VN_TYPE_COLUMN_CHECK; +//format = "%b"; else if (type == G_TYPE_STRING && !g_utf8_collate - (g_utf8_casefold (db_model_get_column_name (model, i), -1), - g_utf8_casefold ("image", -1))) + (g_utf8_casefold (db_model_get_column_name (model, i), -1) + ,g_utf8_casefold ("image", -1))) { image = TRUE; col_type = VN_TYPE_COLUMN_IMAGE; } - else +/*else if (type == G_TYPE_DATE) +format = "%Y-%m-%d"; +else if (type == G_TYPE_DATE_TIME) +format = "%Y-%m-%d %T"; +*/ else + { col_type = VN_TYPE_COLUMN_ENTRY; +//format = "%s"; + } column = vn_grid_append_column (obj->grid, i ,db_model_get_column_name (model, i) @@ -96,6 +111,9 @@ static void vn_consulter_model_status_changed (DbModel * model, ,TRUE, FALSE ); +if (format) + g_object_set (column, "format", format, NULL); + if (type == G_TYPE_INT) g_object_set (column, "lower", (gdouble)G_MININT, @@ -113,7 +131,8 @@ static void vn_consulter_model_status_changed (DbModel * model, "step-increment", 0.1, // "editable", FALSE, NULL); - else if (image) + else + if (image) g_object_set (column, "host", "www.verdnatura.es", "path", "image/cache/catalog/icon", @@ -201,7 +220,7 @@ static void vn_consulter_open (VnConsulter * obj) ,obj->file ,"/*pg*/ SELECT id1, id2, name, ok, date, number, floating, image " "FROM prueben" - ,"/*pg*/ SELECT id1, id2, floating FROM prueben LIMIT 1" + ,"/*pg*/ SELECT id1, number, floating FROM prueben LIMIT 1" ,NULL }; diff --git a/plugin/pg/db-pg.c b/plugin/pg/db-pg.c index 7c49372..bca3afc 100644 --- a/plugin/pg/db-pg.c +++ b/plugin/pg/db-pg.c @@ -16,17 +16,43 @@ */ #include -//#include +//#include // Replaces postgres_fe.h until it gets fixed #ifndef FRONTEND #define FRONTEND 1 #endif -#include "c.h" +#include +// end of the "fix" + +//#include +// catalog/pg_type.h has been removed from Debian, this fixes its lack +#define BOOLOID 16 +#define INT8OID 20 +#define INT2OID 21 +#define INT4OID 23 +#define TIDOID 27 +#define OIDOID 26 +#define FLOAT4OID 700 +#define FLOAT8OID 701 +#define NUMERICOID 1700 +#define DATEOID 1082 +#define TIMESTAMPOID 1114 +#define TIMESTAMPTZOID 1184 +#define TIMEOID 1083 +#define TIMETZOID 1266 +#define BYTEAOID 17 +#define ABSTIMEOID 702 +#define RELTIMEOID 703 +#define TINTERVALOID 704 +#define CHAROID 18 +#define TEXTOID 25 +#define NAMEOID 19 +#define BPCHAROID 1042 +#define VARCHAROID 1043 // end of the "fix" -#include // Macros to avoid redefinition warnings for constants #undef PACKAGE_BUGREPORT #undef PACKAGE_NAME @@ -145,8 +171,8 @@ static GType db_pg_get_g_type (Oid type) case CHAROID: case TEXTOID: case NAMEOID: - case XMLOID: - case CSTRINGOID: +// case XMLOID: +// case CSTRINGOID: case BPCHAROID: case VARCHAROID: default: diff --git a/po/POTFILES.in b/po/POTFILES.in index db2d285..5769b9e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -34,6 +34,7 @@ vn/field/vn-completion.c vn/field/vn-date-chooser.c vn/field/vn-image.c vn/field/vn-http-image.c +vn/field/vn-label.c vn/vn-column.c vn/column/vn-column-entry.c vn/column/vn-column-spin.c @@ -44,6 +45,7 @@ vn/gui/login.glade vn/gui/main.glade vn/gui/child-window.glade vn/gui/actions.glade +vn/gui/date-chooser.glade glade/glade-db-model.c glade/glade-db-model-editor.c diff --git a/po/ca.po b/po/ca.po index 74825b2..c2ca95e 100644 --- a/po/ca.po +++ b/po/ca.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: hedera 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-02-12 12:39+0100\n" +"POT-Creation-Date: 2014-03-27 13:39+0100\n" "PO-Revision-Date: 2013-06-04 13:38+0200\n" "Last-Translator: Alejandro T. Colombini Gómez \n" "Language-Team: Catalan\n" @@ -16,91 +16,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#. * -#. * SECTION: gvn-misc -#. * @Short_description: Miscelaneous utility functions -#. * @Title: Miscelaneous utility functions -#. * -#: ../gvn/gvn-misc.c:27 ../gvn/gvn-misc.c:31 -msgid "Err" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Mon" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Tue" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Wed" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Thu" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Fri" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Sat" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Sun" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Jan" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Feb" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Mar" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Apr" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "May" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Jun" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Jul" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Aug" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Sep" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Oct" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Nov" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Dec" -msgstr "" - #: ../gvn/gvn-param-spec.c:263 #, c-format msgid "Param not editable" @@ -132,7 +47,7 @@ msgstr "" msgid "The master GvnParam of this parameter" msgstr "" -#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:997 +#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:1055 msgid "Mode" msgstr "" @@ -188,11 +103,19 @@ msgstr "" msgid "The default value" msgstr "" -#: ../gvn/gvn-value.c:434 +#: ../gvn/gvn-value.c:431 #, c-format msgid "Attempting to compare invalid types: %s\n" msgstr "S'ha intentat comparar tipus invàlids: %s\n" +#: ../gvn/gvn-value.c:540 +msgid "Yes" +msgstr "" + +#: ../gvn/gvn-value.c:540 +msgid "No" +msgstr "" + #: ../sql/sql-render.c:413 msgid "Delimiter" msgstr "" @@ -201,7 +124,7 @@ msgstr "" msgid "The character used for delimite the name of fields, tables..." msgstr "" -#: ../sql/sql-value.c:228 ../glade/glade-db-model.c:497 +#: ../sql/sql-value.c:228 ../glade/glade-db-model.c:525 msgid "Param" msgstr "" @@ -221,21 +144,21 @@ msgstr "" msgid "An arbitrary SQL string" msgstr "" -#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:85 +#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:111 #, c-format msgid "Can't allocate the needed memory" msgstr "" -#: ../db/db-iterator.c:998 +#: ../db/db-iterator.c:1056 msgid "The mode in which the iterator is working" msgstr "" -#: ../db/db-iterator.c:1005 +#: ../db/db-iterator.c:1063 #, fuzzy msgid "Remember selection" msgstr "Recordar" -#: ../db/db-iterator.c:1006 +#: ../db/db-iterator.c:1064 msgid "Wether to rememeber the selection when model is refreshed" msgstr "" @@ -334,7 +257,7 @@ msgstr "" msgid "The user provided data for the function" msgstr "" -#: ../db/db-calc.c:360 ../glade/glade-db-model.c:488 +#: ../db/db-calc.c:360 ../glade/glade-db-model.c:516 msgid "Column" msgstr "" @@ -342,7 +265,7 @@ msgstr "" msgid "A column to apply the operations over it" msgstr "" -#: ../db/db-param.c:251 ../vn/vn-grid.c:491 ../vn/vn-field.c:532 +#: ../db/db-param.c:251 ../vn/vn-grid.c:519 ../vn/vn-field.c:532 msgid "Iterator" msgstr "" @@ -556,12 +479,12 @@ msgstr "" msgid "The application handler for the entire program" msgstr "" -#: ../vn/vn-grid.c:492 +#: ../vn/vn-grid.c:520 msgid "The iterator used by VnGrid" msgstr "" #: ../vn/vn-handler.c:65 -msgid "Are you sure you want to delete the selected record?" +msgid "Are you sure you want to delete the current selection?" msgstr "" #: ../vn/vn-handler.c:90 @@ -657,11 +580,11 @@ msgstr "" msgid "Bad connection settings, please check it." msgstr "" -#: ../vn/vn-login.c:481 +#: ../vn/vn-login.c:493 msgid "Application id" msgstr "" -#: ../vn/vn-login.c:482 +#: ../vn/vn-login.c:494 msgid "The application identifier" msgstr "" @@ -669,8 +592,8 @@ msgstr "" msgid "The current value of the field" msgstr "" -#: ../vn/vn-field.c:525 ../glade/glade-db-iterator.c:95 -#: ../glade/glade-db-iterator.c:117 +#: ../vn/vn-field.c:525 ../glade/glade-db-iterator.c:71 +#: ../glade/glade-db-iterator.c:116 msgid "Parameter" msgstr "" @@ -694,29 +617,37 @@ msgstr "" msgid "Whether the field value can be of type GVN_TYPE_NULL" msgstr "" -#: ../vn/field/vn-entry.c:153 ../vn/field/vn-spin.c:172 -#: ../vn/column/vn-column-entry.c:119 ../vn/column/vn-column-spin.c:226 +#: ../vn/field/vn-entry.c:156 ../vn/field/vn-date-chooser.c:363 +#: ../vn/field/vn-label.c:114 ../vn/column/vn-column-entry.c:122 +msgid "Format" +msgstr "" + +#: ../vn/field/vn-entry.c:157 ../vn/field/vn-label.c:115 +#: ../vn/column/vn-column-entry.c:123 +msgid "The format string describing the output of the entry." +msgstr "" + +#: ../vn/field/vn-spin.c:171 ../vn/column/vn-column-spin.c:246 msgid "Digits" msgstr "" -#: ../vn/field/vn-entry.c:154 ../vn/field/vn-spin.c:173 -#: ../vn/column/vn-column-entry.c:120 ../vn/column/vn-column-spin.c:227 +#: ../vn/field/vn-spin.c:172 ../vn/column/vn-column-spin.c:247 msgid "The number of decimal places to display." msgstr "" -#: ../vn/field/vn-combo.c:286 ../vn/column/vn-column-combo.c:329 +#: ../vn/field/vn-combo.c:286 ../vn/column/vn-column-combo.c:333 msgid "Index column" msgstr "" -#: ../vn/field/vn-combo.c:287 ../vn/column/vn-column-combo.c:330 +#: ../vn/field/vn-combo.c:287 ../vn/column/vn-column-combo.c:334 msgid "The column index of the model" msgstr "" -#: ../vn/field/vn-combo.c:293 ../vn/column/vn-column-combo.c:336 +#: ../vn/field/vn-combo.c:293 ../vn/column/vn-column-combo.c:340 msgid "Show column" msgstr "" -#: ../vn/field/vn-combo.c:294 ../vn/column/vn-column-combo.c:337 +#: ../vn/field/vn-combo.c:294 ../vn/column/vn-column-combo.c:341 msgid "The column of the model shown by combo" msgstr "" @@ -728,13 +659,35 @@ msgstr "" msgid "The name of the field used for the search" msgstr "" -#: ../vn/field/vn-date-chooser.c:71 -#, c-format -msgid "%s, %u %s %u" +#: ../vn/field/vn-date-chooser.c:319 +msgid "Change date" msgstr "" -#: ../vn/field/vn-date-chooser.c:280 -msgid "Change date" +#: ../vn/field/vn-date-chooser.c:364 +msgid "The date format string describing the order of the elements." +msgstr "" + +#: ../vn/field/vn-date-chooser.c:365 +msgctxt "Default date format string" +msgid "%a, %d %b %Y" +msgstr "" + +#: ../vn/field/vn-date-chooser.c:371 +msgid "Show time" +msgstr "" + +#: ../vn/field/vn-date-chooser.c:372 +msgid "" +"Whether to show the hour, minute and second fields to set the time of the " +"day in the popup." +msgstr "" + +#: ../vn/field/vn-date-chooser.c:380 +msgid "Show date" +msgstr "" + +#: ../vn/field/vn-date-chooser.c:381 +msgid "Whether to show the calendar to set the date in the popup." msgstr "" #: ../vn/field/vn-image.c:133 @@ -795,43 +748,43 @@ msgstr "" msgid "Order in which the tab selects the columns for edition" msgstr "" -#: ../vn/column/vn-column-spin.c:218 +#: ../vn/column/vn-column-spin.c:238 msgid "Climb rate" msgstr "" -#: ../vn/column/vn-column-spin.c:219 +#: ../vn/column/vn-column-spin.c:239 msgid "The acceleration rate when you hold down a button." msgstr "" -#: ../vn/column/vn-column-spin.c:234 +#: ../vn/column/vn-column-spin.c:254 msgid "Minimum value" msgstr "" -#: ../vn/column/vn-column-spin.c:235 -msgid "The minimum value of the adjustment." +#: ../vn/column/vn-column-spin.c:255 +msgid "The minimum value of the internal adjustment." msgstr "" -#: ../vn/column/vn-column-spin.c:242 +#: ../vn/column/vn-column-spin.c:262 msgid "Maximum value" msgstr "" -#: ../vn/column/vn-column-spin.c:243 -msgid "The maximum value of the adjustment." +#: ../vn/column/vn-column-spin.c:263 +msgid "The maximum value of the internal adjustment." msgstr "" -#: ../vn/column/vn-column-spin.c:250 +#: ../vn/column/vn-column-spin.c:270 msgid "Step Increment" msgstr "" -#: ../vn/column/vn-column-spin.c:251 -msgid "The step increment of the adjustment" +#: ../vn/column/vn-column-spin.c:271 +msgid "The step increment of the internal adjustment" msgstr "" -#: ../vn/column/vn-column-combo.c:343 +#: ../vn/column/vn-column-combo.c:347 msgid "Sort column" msgstr "" -#: ../vn/column/vn-column-combo.c:344 +#: ../vn/column/vn-column-combo.c:348 msgid "The field number of the Grid model used to sort the column" msgstr "" @@ -903,6 +856,10 @@ msgid "Password:" msgstr "Contrasenya:" #: ../vn/gui/login.glade.h:10 +msgid "Press here to see the password" +msgstr "" + +#: ../vn/gui/login.glade.h:11 msgid "Remember" msgstr "Recordar" @@ -1002,6 +959,14 @@ msgctxt "View menu option" msgid "Tool_bar" msgstr "" +#: ../vn/gui/date-chooser.glade.h:1 +msgid "Now" +msgstr "" + +#: ../vn/gui/date-chooser.glade.h:2 +msgid "Clear" +msgstr "" + #: ../glade/glade-db-model.c:37 msgid "New SQL statement" msgstr "" @@ -1026,7 +991,7 @@ msgstr "" msgid "You need to create at least one GvnParam or derived object" msgstr "" -#: ../glade/glade-db-model.c:452 +#: ../glade/glade-db-model.c:480 msgid "Add or remove links" msgstr "" @@ -1058,24 +1023,24 @@ msgstr "" msgid "Edit Model" msgstr "" -#: ../glade/glade-db-iterator.c:97 +#: ../glade/glade-db-iterator.c:73 msgid "Properties" msgstr "" -#: ../glade/glade-db-iterator.c:125 +#: ../glade/glade-db-iterator.c:124 msgid "Iterator Editor" msgstr "" -#: ../glade/glade-db-iterator.c:133 +#: ../glade/glade-db-iterator.c:132 msgid "The model must have \"SQL\" set and \"Use file\" set to 'No'." msgstr "" -#: ../glade/glade-db-iterator.c:144 +#: ../glade/glade-db-iterator.c:143 #, c-format msgid "%s can't have children before automatic generation." msgstr "" -#: ../glade/glade-db-iterator.c:155 +#: ../glade/glade-db-iterator.c:154 #, c-format msgid "%s must have \"Model\" set. %s" msgstr "" @@ -1127,11 +1092,11 @@ msgstr "" msgid "Immediate changes" msgstr "" -#: ../module/src/vn-consulter.c:215 +#: ../module/src/vn-consulter.c:234 msgid "Type or select a query" msgstr "" -#: ../module/src/vn-consulter.c:217 +#: ../module/src/vn-consulter.c:236 msgid "Message" msgstr "" diff --git a/po/es.po b/po/es.po index 5791a8b..d03e09c 100644 --- a/po/es.po +++ b/po/es.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: hedera 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-02-12 12:39+0100\n" +"POT-Creation-Date: 2014-03-27 13:39+0100\n" "PO-Revision-Date: 2013-06-04 13:36+0200\n" "Last-Translator: Alejandro T. Colombini Gómez \n" "Language-Team: Spanish\n" @@ -18,91 +18,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. * -#. * SECTION: gvn-misc -#. * @Short_description: Miscelaneous utility functions -#. * @Title: Miscelaneous utility functions -#. * -#: ../gvn/gvn-misc.c:27 ../gvn/gvn-misc.c:31 -msgid "Err" -msgstr "Err" - -#: ../gvn/gvn-misc.c:28 -msgid "Mon" -msgstr "Lun" - -#: ../gvn/gvn-misc.c:28 -msgid "Tue" -msgstr "Mar" - -#: ../gvn/gvn-misc.c:28 -msgid "Wed" -msgstr "Mie" - -#: ../gvn/gvn-misc.c:28 -msgid "Thu" -msgstr "Jue" - -#: ../gvn/gvn-misc.c:28 -msgid "Fri" -msgstr "Vie" - -#: ../gvn/gvn-misc.c:28 -msgid "Sat" -msgstr "Sa" - -#: ../gvn/gvn-misc.c:28 -msgid "Sun" -msgstr "Dom" - -#: ../gvn/gvn-misc.c:32 -msgid "Jan" -msgstr "Ene" - -#: ../gvn/gvn-misc.c:32 -msgid "Feb" -msgstr "Feb" - -#: ../gvn/gvn-misc.c:32 -msgid "Mar" -msgstr "Mar" - -#: ../gvn/gvn-misc.c:32 -msgid "Apr" -msgstr "Abr" - -#: ../gvn/gvn-misc.c:32 -msgid "May" -msgstr "May" - -#: ../gvn/gvn-misc.c:32 -msgid "Jun" -msgstr "Jun" - -#: ../gvn/gvn-misc.c:33 -msgid "Jul" -msgstr "Jul" - -#: ../gvn/gvn-misc.c:33 -msgid "Aug" -msgstr "Ago" - -#: ../gvn/gvn-misc.c:33 -msgid "Sep" -msgstr "Sep" - -#: ../gvn/gvn-misc.c:33 -msgid "Oct" -msgstr "Oct" - -#: ../gvn/gvn-misc.c:33 -msgid "Nov" -msgstr "Nov" - -#: ../gvn/gvn-misc.c:33 -msgid "Dec" -msgstr "Dic" - #: ../gvn/gvn-param-spec.c:263 #, c-format msgid "Param not editable" @@ -134,7 +49,7 @@ msgstr "Maestro" msgid "The master GvnParam of this parameter" msgstr "El GvnParam maestro de este parámetro" -#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:997 +#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:1055 msgid "Mode" msgstr "Modo" @@ -190,11 +105,19 @@ msgstr "Valor por defecto" msgid "The default value" msgstr "El valor por defecto" -#: ../gvn/gvn-value.c:434 +#: ../gvn/gvn-value.c:431 #, c-format msgid "Attempting to compare invalid types: %s\n" msgstr "Se ha intentado comparar tipos incompatibles: %s\n" +#: ../gvn/gvn-value.c:540 +msgid "Yes" +msgstr "Sí" + +#: ../gvn/gvn-value.c:540 +msgid "No" +msgstr "No" + #: ../sql/sql-render.c:413 msgid "Delimiter" msgstr "Delimitador" @@ -203,7 +126,7 @@ msgstr "Delimitador" msgid "The character used for delimite the name of fields, tables..." msgstr "El carácter usado para delimitar los nombres de campos, tablas..." -#: ../sql/sql-value.c:228 ../glade/glade-db-model.c:497 +#: ../sql/sql-value.c:228 ../glade/glade-db-model.c:525 msgid "Param" msgstr "Parámetro" @@ -223,20 +146,20 @@ msgstr "SQL" msgid "An arbitrary SQL string" msgstr "Una cadena SQL arbitraria" -#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:85 +#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:111 #, c-format msgid "Can't allocate the needed memory" msgstr "No es posible asignar la memoria necesaria" -#: ../db/db-iterator.c:998 +#: ../db/db-iterator.c:1056 msgid "The mode in which the iterator is working" msgstr "El modo en el que está trabajando el Iterator" -#: ../db/db-iterator.c:1005 +#: ../db/db-iterator.c:1063 msgid "Remember selection" msgstr "Recordar fila seleccionada" -#: ../db/db-iterator.c:1006 +#: ../db/db-iterator.c:1064 msgid "Wether to rememeber the selection when model is refreshed" msgstr "" "Si se recordará o no la fila seleccionado cuando se refresque el modelo" @@ -342,7 +265,7 @@ msgstr "Datos" msgid "The user provided data for the function" msgstr "Datos proporcionados por el usuario" -#: ../db/db-calc.c:360 ../glade/glade-db-model.c:488 +#: ../db/db-calc.c:360 ../glade/glade-db-model.c:516 msgid "Column" msgstr "Columna" @@ -350,7 +273,7 @@ msgstr "Columna" msgid "A column to apply the operations over it" msgstr "Una columna sobre la que se aplicarán las operaciones" -#: ../db/db-param.c:251 ../vn/vn-grid.c:491 ../vn/vn-field.c:532 +#: ../db/db-param.c:251 ../vn/vn-grid.c:519 ../vn/vn-field.c:532 msgid "Iterator" msgstr "Iterator" @@ -568,12 +491,12 @@ msgstr "Aplicación" msgid "The application handler for the entire program" msgstr "El manejador de la aplicación para todo el programa" -#: ../vn/vn-grid.c:492 +#: ../vn/vn-grid.c:520 msgid "The iterator used by VnGrid" msgstr "El Iterator empleado por VnGrid" #: ../vn/vn-handler.c:65 -msgid "Are you sure you want to delete the selected record?" +msgid "Are you sure you want to delete the current selection?" msgstr "¿Estás seguro de que quieres eliminar los registros seleccionados?" #: ../vn/vn-handler.c:90 @@ -669,11 +592,11 @@ msgstr "Error de acceso" msgid "Bad connection settings, please check it." msgstr "Los parámetros de la conexión son incorrectos, compruébelos por favor." -#: ../vn/vn-login.c:481 +#: ../vn/vn-login.c:493 msgid "Application id" msgstr "Id de la aplicación" -#: ../vn/vn-login.c:482 +#: ../vn/vn-login.c:494 msgid "The application identifier" msgstr "El identificador de la aplicación" @@ -681,8 +604,8 @@ msgstr "El identificador de la aplicación" msgid "The current value of the field" msgstr "El valor actual del campo" -#: ../vn/vn-field.c:525 ../glade/glade-db-iterator.c:95 -#: ../glade/glade-db-iterator.c:117 +#: ../vn/vn-field.c:525 ../glade/glade-db-iterator.c:71 +#: ../glade/glade-db-iterator.c:116 msgid "Parameter" msgstr "Parámetro" @@ -706,29 +629,37 @@ msgstr "Si el valor de campo puede ser editado por el usuario" msgid "Whether the field value can be of type GVN_TYPE_NULL" msgstr "Si el campo puede ser del tipo GVN_TYPE_NULL" -#: ../vn/field/vn-entry.c:153 ../vn/field/vn-spin.c:172 -#: ../vn/column/vn-column-entry.c:119 ../vn/column/vn-column-spin.c:226 +#: ../vn/field/vn-entry.c:156 ../vn/field/vn-date-chooser.c:363 +#: ../vn/field/vn-label.c:114 ../vn/column/vn-column-entry.c:122 +msgid "Format" +msgstr "Formato" + +#: ../vn/field/vn-entry.c:157 ../vn/field/vn-label.c:115 +#: ../vn/column/vn-column-entry.c:123 +msgid "The format string describing the output of the entry." +msgstr "La cadena de formato que describe la salida del campo de texto." + +#: ../vn/field/vn-spin.c:171 ../vn/column/vn-column-spin.c:246 msgid "Digits" msgstr "Dígitos" -#: ../vn/field/vn-entry.c:154 ../vn/field/vn-spin.c:173 -#: ../vn/column/vn-column-entry.c:120 ../vn/column/vn-column-spin.c:227 +#: ../vn/field/vn-spin.c:172 ../vn/column/vn-column-spin.c:247 msgid "The number of decimal places to display." msgstr "El número de posiciones decimales que se muestran" -#: ../vn/field/vn-combo.c:286 ../vn/column/vn-column-combo.c:329 +#: ../vn/field/vn-combo.c:286 ../vn/column/vn-column-combo.c:333 msgid "Index column" msgstr "Columna índice" -#: ../vn/field/vn-combo.c:287 ../vn/column/vn-column-combo.c:330 +#: ../vn/field/vn-combo.c:287 ../vn/column/vn-column-combo.c:334 msgid "The column index of the model" msgstr "La columna índice del modelo" -#: ../vn/field/vn-combo.c:293 ../vn/column/vn-column-combo.c:336 +#: ../vn/field/vn-combo.c:293 ../vn/column/vn-column-combo.c:340 msgid "Show column" msgstr "Columna visible" -#: ../vn/field/vn-combo.c:294 ../vn/column/vn-column-combo.c:337 +#: ../vn/field/vn-combo.c:294 ../vn/column/vn-column-combo.c:341 msgid "The column of the model shown by combo" msgstr "La columna del modelo que se mostrará en el combo" @@ -740,15 +671,40 @@ msgstr "Campo" msgid "The name of the field used for the search" msgstr "El nombre del campo usado para la búsqueda" -#: ../vn/field/vn-date-chooser.c:71 -#, c-format -msgid "%s, %u %s %u" -msgstr "%s, %u %s %u" - -#: ../vn/field/vn-date-chooser.c:280 +#: ../vn/field/vn-date-chooser.c:319 msgid "Change date" msgstr "Cambiar fecha" +#: ../vn/field/vn-date-chooser.c:364 +msgid "The date format string describing the order of the elements." +msgstr "" +"La cadena de formato de fechas que describe la salida del campo de texto." + +#: ../vn/field/vn-date-chooser.c:365 +msgctxt "Default date format string" +msgid "%a, %d %b %Y" +msgstr "%a, %d %b %Y" + +#: ../vn/field/vn-date-chooser.c:371 +msgid "Show time" +msgstr "Mostrar tiempo" + +#: ../vn/field/vn-date-chooser.c:372 +msgid "" +"Whether to show the hour, minute and second fields to set the time of the " +"day in the popup." +msgstr "" +"Si se muestran los campos para hora, minuto y segundo para indicar el " +"instante del día en el emergente" + +#: ../vn/field/vn-date-chooser.c:380 +msgid "Show date" +msgstr "Mostrar fecha" + +#: ../vn/field/vn-date-chooser.c:381 +msgid "Whether to show the calendar to set the date in the popup." +msgstr "Si se debe mostrar el calendario para poner la fecha en el emergente." + #: ../vn/field/vn-image.c:133 msgid "Select the image" msgstr "Selecciona la imagen" @@ -807,43 +763,43 @@ msgstr "Tab index" msgid "Order in which the tab selects the columns for edition" msgstr "Orden en el cual el tabulador selecciona las columnas para editar" -#: ../vn/column/vn-column-spin.c:218 +#: ../vn/column/vn-column-spin.c:238 msgid "Climb rate" msgstr "Tasa de subida" -#: ../vn/column/vn-column-spin.c:219 +#: ../vn/column/vn-column-spin.c:239 msgid "The acceleration rate when you hold down a button." msgstr "La tasa de aceleración cuando se mantiene apretado el botón." -#: ../vn/column/vn-column-spin.c:234 +#: ../vn/column/vn-column-spin.c:254 msgid "Minimum value" msgstr "Valor mínimo" -#: ../vn/column/vn-column-spin.c:235 -msgid "The minimum value of the adjustment." -msgstr "Valor mínimo del ajuste." +#: ../vn/column/vn-column-spin.c:255 +msgid "The minimum value of the internal adjustment." +msgstr "Valor mínimo del ajuste interno." -#: ../vn/column/vn-column-spin.c:242 +#: ../vn/column/vn-column-spin.c:262 msgid "Maximum value" msgstr "Valor máximo" -#: ../vn/column/vn-column-spin.c:243 -msgid "The maximum value of the adjustment." -msgstr "Valor máximo del ajuste" +#: ../vn/column/vn-column-spin.c:263 +msgid "The maximum value of the internal adjustment." +msgstr "Valor máximo del ajuste interno." -#: ../vn/column/vn-column-spin.c:250 +#: ../vn/column/vn-column-spin.c:270 msgid "Step Increment" msgstr "Incremento del paso" -#: ../vn/column/vn-column-spin.c:251 -msgid "The step increment of the adjustment" -msgstr "El incremento del paso del ajuste" +#: ../vn/column/vn-column-spin.c:271 +msgid "The step increment of the internal adjustment" +msgstr "El incremento del paso del ajuste interno" -#: ../vn/column/vn-column-combo.c:343 +#: ../vn/column/vn-column-combo.c:347 msgid "Sort column" msgstr "Columna de ordenación" -#: ../vn/column/vn-column-combo.c:344 +#: ../vn/column/vn-column-combo.c:348 msgid "The field number of the Grid model used to sort the column" msgstr "" "El número de campo del modelo del Grid que se usa para ordenar la columna" @@ -921,6 +877,10 @@ msgid "Password:" msgstr "Clave:" #: ../vn/gui/login.glade.h:10 +msgid "Press here to see the password" +msgstr "Presiona para ver la contraseña" + +#: ../vn/gui/login.glade.h:11 msgid "Remember" msgstr "Recordar" @@ -1034,6 +994,14 @@ msgctxt "View menu option" msgid "Tool_bar" msgstr "_Barra de herramientas" +#: ../vn/gui/date-chooser.glade.h:1 +msgid "Now" +msgstr "Ahora" + +#: ../vn/gui/date-chooser.glade.h:2 +msgid "Clear" +msgstr "Limpiar" + #: ../glade/glade-db-model.c:37 msgid "New SQL statement" msgstr "Nueva consulta SQL" @@ -1058,7 +1026,7 @@ msgstr "Eligir un parametro de una lista" msgid "You need to create at least one GvnParam or derived object" msgstr "Necesitas crear por lo menos un GvnParam o algun objeto derivado" -#: ../glade/glade-db-model.c:452 +#: ../glade/glade-db-model.c:480 msgid "Add or remove links" msgstr "Añadir o quitar enlaces" @@ -1090,24 +1058,24 @@ msgstr "Nuevo Modelo" msgid "Edit Model" msgstr "Editar Modelo" -#: ../glade/glade-db-iterator.c:97 +#: ../glade/glade-db-iterator.c:73 msgid "Properties" msgstr "Propiedades" -#: ../glade/glade-db-iterator.c:125 +#: ../glade/glade-db-iterator.c:124 msgid "Iterator Editor" msgstr "Editor del Iterator" -#: ../glade/glade-db-iterator.c:133 +#: ../glade/glade-db-iterator.c:132 msgid "The model must have \"SQL\" set and \"Use file\" set to 'No'." msgstr "El modelo debe tener \"SQL\" asignado y \"Usa fichero\" puesto a 'No'." -#: ../glade/glade-db-iterator.c:144 +#: ../glade/glade-db-iterator.c:143 #, c-format msgid "%s can't have children before automatic generation." msgstr "%s no puede tener hijos antes de la generación automatica." -#: ../glade/glade-db-iterator.c:155 +#: ../glade/glade-db-iterator.c:154 #, c-format msgid "%s must have \"Model\" set. %s" msgstr "%s debe tener \"Modelo\" asignado. %s" @@ -1162,10 +1130,73 @@ msgstr "Consulta:" msgid "Immediate changes" msgstr "Cambios inmediatos" -#: ../module/src/vn-consulter.c:215 +#: ../module/src/vn-consulter.c:234 msgid "Type or select a query" msgstr "Escribe o elige una consulta" -#: ../module/src/vn-consulter.c:217 +#: ../module/src/vn-consulter.c:236 msgid "Message" msgstr "Mensaje" + +#~ msgid "Err" +#~ msgstr "Err" + +#~ msgid "Mon" +#~ msgstr "Lun" + +#~ msgid "Tue" +#~ msgstr "Mar" + +#~ msgid "Wed" +#~ msgstr "Mie" + +#~ msgid "Thu" +#~ msgstr "Jue" + +#~ msgid "Fri" +#~ msgstr "Vie" + +#~ msgid "Sat" +#~ msgstr "Sa" + +#~ msgid "Sun" +#~ msgstr "Dom" + +#~ msgid "Jan" +#~ msgstr "Ene" + +#~ msgid "Feb" +#~ msgstr "Feb" + +#~ msgid "Mar" +#~ msgstr "Mar" + +#~ msgid "Apr" +#~ msgstr "Abr" + +#~ msgid "May" +#~ msgstr "May" + +#~ msgid "Jun" +#~ msgstr "Jun" + +#~ msgid "Jul" +#~ msgstr "Jul" + +#~ msgid "Aug" +#~ msgstr "Ago" + +#~ msgid "Sep" +#~ msgstr "Sep" + +#~ msgid "Oct" +#~ msgstr "Oct" + +#~ msgid "Nov" +#~ msgstr "Nov" + +#~ msgid "Dec" +#~ msgstr "Dic" + +#~ msgid "%s, %u %s %u" +#~ msgstr "%s, %u %s %u" diff --git a/po/nl.po b/po/nl.po index 3198f57..251068d 100644 --- a/po/nl.po +++ b/po/nl.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: hedera 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-02-12 12:39+0100\n" +"POT-Creation-Date: 2014-03-27 13:39+0100\n" "PO-Revision-Date: 2012-10-09 11:38+0200\n" "Last-Translator: Alejandro T. Colombini Gómez \n" "Language-Team: Dutch\n" @@ -18,91 +18,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#. * -#. * SECTION: gvn-misc -#. * @Short_description: Miscelaneous utility functions -#. * @Title: Miscelaneous utility functions -#. * -#: ../gvn/gvn-misc.c:27 ../gvn/gvn-misc.c:31 -msgid "Err" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Mon" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Tue" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Wed" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Thu" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Fri" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Sat" -msgstr "" - -#: ../gvn/gvn-misc.c:28 -msgid "Sun" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Jan" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Feb" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Mar" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Apr" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "May" -msgstr "" - -#: ../gvn/gvn-misc.c:32 -msgid "Jun" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Jul" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Aug" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Sep" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Oct" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Nov" -msgstr "" - -#: ../gvn/gvn-misc.c:33 -msgid "Dec" -msgstr "" - #: ../gvn/gvn-param-spec.c:263 #, c-format msgid "Param not editable" @@ -134,7 +49,7 @@ msgstr "" msgid "The master GvnParam of this parameter" msgstr "" -#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:997 +#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:1055 msgid "Mode" msgstr "" @@ -190,11 +105,19 @@ msgstr "" msgid "The default value" msgstr "" -#: ../gvn/gvn-value.c:434 +#: ../gvn/gvn-value.c:431 #, c-format msgid "Attempting to compare invalid types: %s\n" msgstr "" +#: ../gvn/gvn-value.c:540 +msgid "Yes" +msgstr "" + +#: ../gvn/gvn-value.c:540 +msgid "No" +msgstr "" + #: ../sql/sql-render.c:413 msgid "Delimiter" msgstr "" @@ -203,7 +126,7 @@ msgstr "" msgid "The character used for delimite the name of fields, tables..." msgstr "" -#: ../sql/sql-value.c:228 ../glade/glade-db-model.c:497 +#: ../sql/sql-value.c:228 ../glade/glade-db-model.c:525 msgid "Param" msgstr "" @@ -223,20 +146,20 @@ msgstr "" msgid "An arbitrary SQL string" msgstr "" -#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:85 +#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:111 #, c-format msgid "Can't allocate the needed memory" msgstr "" -#: ../db/db-iterator.c:998 +#: ../db/db-iterator.c:1056 msgid "The mode in which the iterator is working" msgstr "" -#: ../db/db-iterator.c:1005 +#: ../db/db-iterator.c:1063 msgid "Remember selection" msgstr "" -#: ../db/db-iterator.c:1006 +#: ../db/db-iterator.c:1064 msgid "Wether to rememeber the selection when model is refreshed" msgstr "" @@ -335,7 +258,7 @@ msgstr "" msgid "The user provided data for the function" msgstr "" -#: ../db/db-calc.c:360 ../glade/glade-db-model.c:488 +#: ../db/db-calc.c:360 ../glade/glade-db-model.c:516 msgid "Column" msgstr "" @@ -343,7 +266,7 @@ msgstr "" msgid "A column to apply the operations over it" msgstr "" -#: ../db/db-param.c:251 ../vn/vn-grid.c:491 ../vn/vn-field.c:532 +#: ../db/db-param.c:251 ../vn/vn-grid.c:519 ../vn/vn-field.c:532 msgid "Iterator" msgstr "" @@ -557,12 +480,12 @@ msgstr "" msgid "The application handler for the entire program" msgstr "" -#: ../vn/vn-grid.c:492 +#: ../vn/vn-grid.c:520 msgid "The iterator used by VnGrid" msgstr "" #: ../vn/vn-handler.c:65 -msgid "Are you sure you want to delete the selected record?" +msgid "Are you sure you want to delete the current selection?" msgstr "" #: ../vn/vn-handler.c:90 @@ -658,11 +581,11 @@ msgstr "" msgid "Bad connection settings, please check it." msgstr "" -#: ../vn/vn-login.c:481 +#: ../vn/vn-login.c:493 msgid "Application id" msgstr "" -#: ../vn/vn-login.c:482 +#: ../vn/vn-login.c:494 msgid "The application identifier" msgstr "" @@ -670,8 +593,8 @@ msgstr "" msgid "The current value of the field" msgstr "" -#: ../vn/vn-field.c:525 ../glade/glade-db-iterator.c:95 -#: ../glade/glade-db-iterator.c:117 +#: ../vn/vn-field.c:525 ../glade/glade-db-iterator.c:71 +#: ../glade/glade-db-iterator.c:116 msgid "Parameter" msgstr "" @@ -695,29 +618,37 @@ msgstr "" msgid "Whether the field value can be of type GVN_TYPE_NULL" msgstr "" -#: ../vn/field/vn-entry.c:153 ../vn/field/vn-spin.c:172 -#: ../vn/column/vn-column-entry.c:119 ../vn/column/vn-column-spin.c:226 +#: ../vn/field/vn-entry.c:156 ../vn/field/vn-date-chooser.c:363 +#: ../vn/field/vn-label.c:114 ../vn/column/vn-column-entry.c:122 +msgid "Format" +msgstr "" + +#: ../vn/field/vn-entry.c:157 ../vn/field/vn-label.c:115 +#: ../vn/column/vn-column-entry.c:123 +msgid "The format string describing the output of the entry." +msgstr "" + +#: ../vn/field/vn-spin.c:171 ../vn/column/vn-column-spin.c:246 msgid "Digits" msgstr "" -#: ../vn/field/vn-entry.c:154 ../vn/field/vn-spin.c:173 -#: ../vn/column/vn-column-entry.c:120 ../vn/column/vn-column-spin.c:227 +#: ../vn/field/vn-spin.c:172 ../vn/column/vn-column-spin.c:247 msgid "The number of decimal places to display." msgstr "" -#: ../vn/field/vn-combo.c:286 ../vn/column/vn-column-combo.c:329 +#: ../vn/field/vn-combo.c:286 ../vn/column/vn-column-combo.c:333 msgid "Index column" msgstr "" -#: ../vn/field/vn-combo.c:287 ../vn/column/vn-column-combo.c:330 +#: ../vn/field/vn-combo.c:287 ../vn/column/vn-column-combo.c:334 msgid "The column index of the model" msgstr "" -#: ../vn/field/vn-combo.c:293 ../vn/column/vn-column-combo.c:336 +#: ../vn/field/vn-combo.c:293 ../vn/column/vn-column-combo.c:340 msgid "Show column" msgstr "" -#: ../vn/field/vn-combo.c:294 ../vn/column/vn-column-combo.c:337 +#: ../vn/field/vn-combo.c:294 ../vn/column/vn-column-combo.c:341 msgid "The column of the model shown by combo" msgstr "" @@ -729,13 +660,35 @@ msgstr "" msgid "The name of the field used for the search" msgstr "" -#: ../vn/field/vn-date-chooser.c:71 -#, c-format -msgid "%s, %u %s %u" +#: ../vn/field/vn-date-chooser.c:319 +msgid "Change date" msgstr "" -#: ../vn/field/vn-date-chooser.c:280 -msgid "Change date" +#: ../vn/field/vn-date-chooser.c:364 +msgid "The date format string describing the order of the elements." +msgstr "" + +#: ../vn/field/vn-date-chooser.c:365 +msgctxt "Default date format string" +msgid "%a, %d %b %Y" +msgstr "" + +#: ../vn/field/vn-date-chooser.c:371 +msgid "Show time" +msgstr "" + +#: ../vn/field/vn-date-chooser.c:372 +msgid "" +"Whether to show the hour, minute and second fields to set the time of the " +"day in the popup." +msgstr "" + +#: ../vn/field/vn-date-chooser.c:380 +msgid "Show date" +msgstr "" + +#: ../vn/field/vn-date-chooser.c:381 +msgid "Whether to show the calendar to set the date in the popup." msgstr "" #: ../vn/field/vn-image.c:133 @@ -796,43 +749,43 @@ msgstr "" msgid "Order in which the tab selects the columns for edition" msgstr "" -#: ../vn/column/vn-column-spin.c:218 +#: ../vn/column/vn-column-spin.c:238 msgid "Climb rate" msgstr "" -#: ../vn/column/vn-column-spin.c:219 +#: ../vn/column/vn-column-spin.c:239 msgid "The acceleration rate when you hold down a button." msgstr "" -#: ../vn/column/vn-column-spin.c:234 +#: ../vn/column/vn-column-spin.c:254 msgid "Minimum value" msgstr "" -#: ../vn/column/vn-column-spin.c:235 -msgid "The minimum value of the adjustment." +#: ../vn/column/vn-column-spin.c:255 +msgid "The minimum value of the internal adjustment." msgstr "" -#: ../vn/column/vn-column-spin.c:242 +#: ../vn/column/vn-column-spin.c:262 msgid "Maximum value" msgstr "" -#: ../vn/column/vn-column-spin.c:243 -msgid "The maximum value of the adjustment." +#: ../vn/column/vn-column-spin.c:263 +msgid "The maximum value of the internal adjustment." msgstr "" -#: ../vn/column/vn-column-spin.c:250 +#: ../vn/column/vn-column-spin.c:270 msgid "Step Increment" msgstr "" -#: ../vn/column/vn-column-spin.c:251 -msgid "The step increment of the adjustment" +#: ../vn/column/vn-column-spin.c:271 +msgid "The step increment of the internal adjustment" msgstr "" -#: ../vn/column/vn-column-combo.c:343 +#: ../vn/column/vn-column-combo.c:347 msgid "Sort column" msgstr "" -#: ../vn/column/vn-column-combo.c:344 +#: ../vn/column/vn-column-combo.c:348 msgid "The field number of the Grid model used to sort the column" msgstr "" @@ -903,6 +856,10 @@ msgid "Password:" msgstr "" #: ../vn/gui/login.glade.h:10 +msgid "Press here to see the password" +msgstr "" + +#: ../vn/gui/login.glade.h:11 msgid "Remember" msgstr "" @@ -1002,6 +959,14 @@ msgctxt "View menu option" msgid "Tool_bar" msgstr "" +#: ../vn/gui/date-chooser.glade.h:1 +msgid "Now" +msgstr "" + +#: ../vn/gui/date-chooser.glade.h:2 +msgid "Clear" +msgstr "" + #: ../glade/glade-db-model.c:37 msgid "New SQL statement" msgstr "" @@ -1026,7 +991,7 @@ msgstr "" msgid "You need to create at least one GvnParam or derived object" msgstr "" -#: ../glade/glade-db-model.c:452 +#: ../glade/glade-db-model.c:480 msgid "Add or remove links" msgstr "" @@ -1058,24 +1023,24 @@ msgstr "" msgid "Edit Model" msgstr "" -#: ../glade/glade-db-iterator.c:97 +#: ../glade/glade-db-iterator.c:73 msgid "Properties" msgstr "" -#: ../glade/glade-db-iterator.c:125 +#: ../glade/glade-db-iterator.c:124 msgid "Iterator Editor" msgstr "" -#: ../glade/glade-db-iterator.c:133 +#: ../glade/glade-db-iterator.c:132 msgid "The model must have \"SQL\" set and \"Use file\" set to 'No'." msgstr "" -#: ../glade/glade-db-iterator.c:144 +#: ../glade/glade-db-iterator.c:143 #, c-format msgid "%s can't have children before automatic generation." msgstr "" -#: ../glade/glade-db-iterator.c:155 +#: ../glade/glade-db-iterator.c:154 #, c-format msgid "%s must have \"Model\" set. %s" msgstr "" @@ -1127,10 +1092,10 @@ msgstr "" msgid "Immediate changes" msgstr "" -#: ../module/src/vn-consulter.c:215 +#: ../module/src/vn-consulter.c:234 msgid "Type or select a query" msgstr "" -#: ../module/src/vn-consulter.c:217 +#: ../module/src/vn-consulter.c:236 msgid "Message" msgstr "" diff --git a/sql/parser/scan.rl b/sql/parser/scan.rl index a454d1b..8f5d6c4 100644 --- a/sql/parser/scan.rl +++ b/sql/parser/scan.rl @@ -266,16 +266,6 @@ SqlObject * sql_parser_parse (const gchar * sql, GError ** err) return object; } -/** - * sql_parser_parse_field: - * @field: a string containing a field name - * - * Parses a qualified or unqualified SQL field name to an #SqlField object. The - * field can be specified using both ` or " as quotes. This object must be - * unreferenced using g_object_unref(). - * - * Return value: an #SqlField - **/ SqlField * sql_parser_parse_field (const gchar * field) { gchar ** split; diff --git a/sql/sql-parser.h b/sql/sql-parser.h index 2f49683..336cca3 100644 --- a/sql/sql-parser.h +++ b/sql/sql-parser.h @@ -37,12 +37,14 @@ SqlObject * sql_parser_parse (const gchar * sql, GError ** err) G_GNUC_WARN_UNUS /** * sql_parser_parse_field: - * @field: a string containing a qualified (or not) SQL field + * @field: a string containing a field name * - * Parses a qualified SQL field and returns the corresponding @SqlField object. + * Parses a qualified or unqualified SQL field name to an #SqlField object. The + * field can be specified using both ` or " as quotes. This object must be + * unreferenced using g_object_unref(). * * Return value: (transfer full): an #SqlField - */ + **/ SqlField * sql_parser_parse_field (const gchar * field); #endif \ No newline at end of file diff --git a/sql/sql-string.c b/sql/sql-string.c index 329942d..1921f91 100644 --- a/sql/sql-string.c +++ b/sql/sql-string.c @@ -96,7 +96,7 @@ void sql_string_add_value (SqlString * obj, GType type, gconstpointer content) GValue value = G_VALUE_INIT; SqlExpr * expr; - gvn_value_new_with_content (&value, type, content); + gvn_value_new_with_content (&value, type, (gpointer) content); expr = sql_value_new (); sql_value_set_value (SQL_VALUE (expr), &value); sql_object_list_add (SQL_OBJECT (obj), &obj->params, SQL_OBJECT (expr)); diff --git a/vn/column/vn-column-combo.c b/vn/column/vn-column-combo.c index d56ed6d..1349764 100644 --- a/vn/column/vn-column-combo.c +++ b/vn/column/vn-column-combo.c @@ -45,7 +45,7 @@ static void vn_column_combo_set_value (VnColumnCombo * obj, GtkTreeModel * model */ static void vn_column_combo_restore_focus (VnColumnCombo * obj) { - gtk_widget_grab_focus + gtk_widget_grab_focus (gtk_tree_view_column_get_tree_view (GTK_TREE_VIEW_COLUMN (obj))); } @@ -77,6 +77,14 @@ static void vn_column_combo_on_editing_started (GtkCellRenderer * cell, entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (cell_editable))); + // Each edition uses a new cell_editable. + if (obj->cell_editable) + { + g_signal_handlers_disconnect_by_func (obj->cell_editable, + vn_column_combo_on_format_entry_text, obj); + g_object_unref (obj->cell_editable); + } + if (!obj->completion_ready) { gtk_entry_completion_set_model (obj->completion, obj->tree_model); @@ -86,18 +94,14 @@ static void vn_column_combo_on_editing_started (GtkCellRenderer * cell, g_signal_connect_swapped (cell_editable, "editing-done", G_CALLBACK (vn_column_combo_restore_focus), obj); - obj->cell_editable = cell_editable; + obj->cell_editable = g_object_ref (cell_editable); } gtk_entry_set_completion (entry, obj->completion); - // Each edition uses a new cell_editable. - if (obj->cell_editable) - g_signal_handlers_disconnect_by_func (obj->cell_editable, - vn_column_combo_on_format_entry_text, obj); - g_signal_connect (cell_editable, "format-entry-text", G_CALLBACK (vn_column_combo_on_format_entry_text), obj); + obj->cell_editable = g_object_ref (cell_editable); } /* diff --git a/vn/column/vn-column-entry.c b/vn/column/vn-column-entry.c index 2d60b38..5aa2cda 100644 --- a/vn/column/vn-column-entry.c +++ b/vn/column/vn-column-entry.c @@ -25,7 +25,7 @@ static void vn_column_entry_cb_edited (GtkCellRendererText * cell, const gchar * path, gchar * text, VnColumnEntry * obj) { GValue value = G_VALUE_INIT; - + if (g_strcmp0 (text, "")) { g_value_init (&value, G_TYPE_STRING); @@ -54,7 +54,7 @@ static void vn_column_entry_set_value (VnColumnEntry * obj, GtkTreeModel * model GtkTreeIter * iter, GObject * cell, const GValue * value) { GValue new_value = G_VALUE_INIT; - gvn_value_to_format_string (value, obj->digits, &new_value); + gvn_value_to_format_string (value, obj->format, &new_value); g_object_set_property (cell, "text", &new_value); g_value_unset (&new_value); } @@ -63,7 +63,7 @@ static void vn_column_entry_set_value (VnColumnEntry * obj, GtkTreeModel * model enum { - PROP_DIGITS = 1 + PROP_FORMAT = 1 }; static void vn_column_entry_set_property (VnColumnEntry * obj, guint id, @@ -71,8 +71,9 @@ static void vn_column_entry_set_property (VnColumnEntry * obj, guint id, { switch (id) { - case PROP_DIGITS: - obj->digits = g_value_get_uint (value); + case PROP_FORMAT: + g_free (obj->format); + obj->format = g_value_dup_string (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); @@ -84,8 +85,8 @@ static void vn_column_entry_get_property (VnColumnEntry * obj, guint id, { switch (id) { - case PROP_DIGITS: - g_value_set_uint (value, obj->digits); + case PROP_FORMAT: + g_value_set_string (value, obj->format); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); @@ -98,10 +99,12 @@ static void vn_column_entry_init (VnColumnEntry * obj) { GtkCellRenderer * cell = gtk_cell_renderer_text_new (); VN_COLUMN_GET_CLASS (obj)->set_renderer (VN_COLUMN (obj), cell); + obj->format = NULL; } static void vn_column_entry_finalize (VnColumnEntry * obj) { + g_free (obj->format); G_OBJECT_CLASS (vn_column_entry_parent_class)->finalize (G_OBJECT (obj)); } @@ -114,11 +117,11 @@ static void vn_column_entry_class_init (VnColumnEntryClass * klass) VN_COLUMN_CLASS (klass)->set_value = (VnColumnSetValueFunc) vn_column_entry_set_value; VN_COLUMN_CLASS (klass)->set_editable = (VnColumnSetEditableFunc) vn_column_entry_set_editable; - g_object_class_install_property (k, PROP_DIGITS, - g_param_spec_uint ("digits" - ,_("Digits") - ,_("The number of decimal places to display.") - ,0 ,20 ,0 + g_object_class_install_property (k, PROP_FORMAT, + g_param_spec_string ("format" + ,_("Format") + ,_("The format string describing the output of the entry.") + ,NULL ,G_PARAM_CONSTRUCT | G_PARAM_READWRITE )); } diff --git a/vn/column/vn-column-entry.h b/vn/column/vn-column-entry.h index d80b80a..2077fa9 100644 --- a/vn/column/vn-column-entry.h +++ b/vn/column/vn-column-entry.h @@ -34,6 +34,7 @@ struct _VnColumnEntry { VnColumn parent; guint digits; + gchar * format; }; struct _VnColumnEntryClass diff --git a/vn/column/vn-column-spin.c b/vn/column/vn-column-spin.c index 5f7039b..5d71ffb 100644 --- a/vn/column/vn-column-spin.c +++ b/vn/column/vn-column-spin.c @@ -32,18 +32,13 @@ static void vn_column_spin_on_edited (GtkCellRendererSpin * cell, if (g_strcmp0 (text, "")) { gchar * err; - gdouble min, max; - gdouble val = g_strtod (text, &err); if (!err || *err == '\0') { - g_object_get (obj->adjustment, "lower", &min, "upper", &max, NULL); + gdouble val, min, max; - if (val < min) - val = min; - else if (val > max) - val = max; - + g_object_get (obj->adjustment, "lower", &min, "upper", &max, NULL); + val = CLAMP (g_strtod (text, &err), min, max); g_value_init (&value, G_TYPE_DOUBLE); g_value_set_double (&value, val); g_object_set (obj->adjustment, "value", val, NULL); @@ -73,19 +68,10 @@ void vn_column_spin_on_editing_started (GtkCellRenderer * renderer, if (gtk_tree_model_get_iter_from_string (model, &iter, path)) { - gint i = 0; - GList * columns, * n; - GValue value; - VnColumn * column = VN_COLUMN (obj); + GValue value = G_VALUE_INIT; + gint col = vn_column_get_column_index (VN_COLUMN (obj)); - columns = gtk_tree_view_get_columns (tree); - - for (n = columns; n; n = n->next, i++) - if (n->data == column) - break; - - gtk_tree_model_get_value (model, &iter, i, &value); - g_list_free (columns); + gtk_tree_model_get_value (model, &iter, col, &value); if (gvn_value_is_null (&value)) gtk_entry_set_text (entry, ""); @@ -115,11 +101,38 @@ static void vn_column_spin_set_editable (VnColumn * obj, gboolean editable) static void vn_column_spin_set_value (VnColumnSpin * obj, GtkTreeModel * model, GtkTreeIter * iter, GObject * cell, const GValue * value) { - gint digits; + guint digits; + GType type = G_VALUE_TYPE (value); GValue new_value = G_VALUE_INIT; + g_value_init (&new_value, G_TYPE_STRING); g_object_get (cell, "digits", &digits, NULL); - gvn_value_to_format_string (value, digits, &new_value); + + switch (type) + { + case G_TYPE_FLOAT: + case G_TYPE_DOUBLE: + { + gdouble dec; + gchar buffer [G_ASCII_DTOSTR_BUF_SIZE]; + + if (type == G_TYPE_FLOAT) + dec = (gdouble) g_value_get_float (value); + else + dec = g_value_get_double (value); + + g_ascii_formatd (buffer, G_ASCII_DTOSTR_BUF_SIZE, obj->format, dec); + g_value_set_string (&new_value, buffer); + + break; + } + default: + if (!gvn_value_is_null (value)) + g_value_transform (value, &new_value); + else + g_value_set_string (&new_value, ""); + } + g_object_set_property (cell, "text", &new_value); g_value_unset (&new_value); } @@ -144,8 +157,13 @@ static void vn_column_spin_set_property (VnColumnSpin * obj, guint id, g_object_set (VN_COLUMN (obj)->cell, "climb-rate", g_value_get_double (value), NULL); break; case PROP_DIGITS: - g_object_set (VN_COLUMN (obj)->cell, "digits", g_value_get_uint (value), NULL); + { + guint digits = g_value_get_uint (value); + g_object_set (VN_COLUMN (obj)->cell, "digits", digits, NULL); + g_free (obj->format); + obj->format = g_strdup_printf ("%%.%df", digits); break; + } case PROP_LOWER: g_object_set (obj->adjustment, "lower", g_value_get_double (value), NULL); break; @@ -195,6 +213,8 @@ static void vn_column_spin_init (VnColumnSpin * obj) obj->adjustment = gtk_adjustment_new (0.0, G_MININT, G_MAXINT, 0.0, 1.0, 0.0); g_object_set (cell, "adjustment", obj->adjustment, NULL); + obj->format = NULL; + VN_COLUMN_GET_CLASS (obj)->set_renderer (VN_COLUMN (obj), cell); } @@ -232,7 +252,7 @@ static void vn_column_spin_class_init (VnColumnSpinClass * klass) g_object_class_install_property (k, PROP_LOWER, g_param_spec_double ("lower" ,_("Minimum value") - ,_("The minimum value of the adjustment.") + ,_("The minimum value of the internal adjustment.") ,-G_MAXDOUBLE ,G_MAXDOUBLE ,0.0 ,G_PARAM_CONSTRUCT | G_PARAM_READWRITE )); @@ -240,15 +260,15 @@ static void vn_column_spin_class_init (VnColumnSpinClass * klass) g_object_class_install_property (k, PROP_UPPER, g_param_spec_double ("upper" ,_("Maximum value") - ,_("The maximum value of the adjustment.") - ,-G_MAXDOUBLE ,G_MAXDOUBLE , 0.0 + ,_("The maximum value of the internal adjustment.") + ,-G_MAXDOUBLE ,G_MAXDOUBLE ,0.0 ,G_PARAM_CONSTRUCT | G_PARAM_READWRITE )); g_object_class_install_property (k, PROP_STEP, g_param_spec_double ("step-increment" ,_("Step Increment") - ,_("The step increment of the adjustment") + ,_("The step increment of the internal adjustment") ,0.00000000000000000001 ,10000000000.0 ,1.0 ,G_PARAM_CONSTRUCT | G_PARAM_READWRITE )); diff --git a/vn/field/Makefile.am b/vn/field/Makefile.am index 580796f..9103eba 100644 --- a/vn/field/Makefile.am +++ b/vn/field/Makefile.am @@ -11,7 +11,8 @@ field_include_HEADERS = \ vn-image.h \ vn-completion.h \ vn-date-chooser.h \ - vn-http-image.h + vn-http-image.h \ + vn-label.h AM_CPPFLAGS = \ -D_IMAGE_DIR=\"$(vn_imagedir)\" \ @@ -28,4 +29,5 @@ libvnfield_la_SOURCES = \ vn-image.c \ vn-completion.c \ vn-date-chooser.c \ - vn-http-image.c + vn-http-image.c \ + vn-label.c diff --git a/vn/field/vn-date-chooser.c b/vn/field/vn-date-chooser.c index b531b07..9dfc719 100644 --- a/vn/field/vn-date-chooser.c +++ b/vn/field/vn-date-chooser.c @@ -18,6 +18,8 @@ #include "vn-date-chooser.h" #include +#define DATE_SIZE 50 + /** * SECTION:vn-date-chooser * @Short_description: an embedded popup date selector @@ -61,21 +63,9 @@ static void vn_date_chooser_changed (VnDateChooser * obj) if (g_date_valid (date)) { - gchar * str; - GDateWeekday wday; - GDateMonth month; - - month = g_date_get_month (date); - wday = g_date_get_weekday (date); - - str = g_strdup_printf (_("%s, %u %s %u") - ,GVN_ABR_WDAY[wday] - ,g_date_get_day (date) - ,GVN_ABR_MONTH[month] - ,g_date_get_year (date) - ); + gchar str[DATE_SIZE]; + g_date_strftime (str, DATE_SIZE, obj->format, date); gtk_label_set_text (obj->label, str); - g_free (str); } else gtk_label_set_text (obj->label, ""); @@ -262,12 +252,61 @@ static void vn_date_chooser_on_toggled (GtkToggleButton * button, VnDateChooser vn_date_chooser_hide_popup (obj); } +//+++++++++++++++++++++++++++++++++++++++++++++++++++ Properties + +enum +{ + PROP_FORMAT = 1 + ,PROP_SHOW_TIME + ,PROP_SHOW_DATE +}; + +static void vn_date_chooser_set_property (VnDateChooser * obj, guint id, + const GValue * value, GParamSpec * pspec) +{ + switch (id) + { + case PROP_FORMAT: + g_free (obj->format); + obj->format = g_value_dup_string (value); + break; + case PROP_SHOW_TIME: + obj->show_time = g_value_get_boolean (value); + break; + case PROP_SHOW_DATE: + obj->show_date = g_value_get_boolean (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); + } +} + +static void vn_date_chooser_get_property (VnDateChooser * obj, guint id, + GValue * value, GParamSpec * pspec) +{ + switch (id) + { + case PROP_FORMAT: + g_value_set_string (value, obj->format); + break; + case PROP_SHOW_TIME: + g_value_set_boolean (value, obj->show_time); + break; + case PROP_SHOW_DATE: + g_value_set_boolean (value, obj->show_date); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); + } +} + //+++++++++++++++++++++++++++++++++++++++++++++++++++ Class static void vn_date_chooser_init (VnDateChooser * obj) { GtkWidget * image; - + + obj->format = NULL; obj->popup = NULL; obj->device = NULL; g_date_clear (&obj->date, 1); @@ -306,12 +345,41 @@ static void vn_date_chooser_init (VnDateChooser * obj) static void vn_date_chooser_finalize (VnDateChooser * obj) { + g_free (obj->format); gtk_widget_destroy (obj->popup); G_OBJECT_CLASS (vn_date_chooser_parent_class)->finalize (G_OBJECT (obj)); } static void vn_date_chooser_class_init (VnDateChooserClass * klass) { - G_OBJECT_CLASS (klass)->finalize = (GObjectFinalizeFunc) vn_date_chooser_finalize; + GObjectClass * k = G_OBJECT_CLASS (klass); + k->finalize = (GObjectFinalizeFunc) vn_date_chooser_finalize; + k->set_property = (GObjectSetPropertyFunc) vn_date_chooser_set_property; + k->get_property = (GObjectGetPropertyFunc) vn_date_chooser_get_property; VN_FIELD_CLASS (klass)->set_value = (VnFieldSetValueFunc) vn_date_chooser_set_value; + + g_object_class_install_property (k, PROP_FORMAT, + g_param_spec_string ("format" + ,_("Format") + ,_("The date format string describing the order of the elements.") + ,C_("Default date format string", "%a, %d %b %Y") + ,G_PARAM_CONSTRUCT | G_PARAM_READWRITE + )); + + g_object_class_install_property (k, PROP_SHOW_TIME, + g_param_spec_boolean ("show-time" + ,_("Show time") + ,_("Whether to show the hour, minute and second fields to set" + " the time of the day in the popup.") + ,FALSE + ,G_PARAM_READWRITE + )); + + g_object_class_install_property (k, PROP_SHOW_DATE, + g_param_spec_boolean ("show-date" + ,_("Show date") + ,_("Whether to show the calendar to set the date in the popup.") + ,TRUE + ,G_PARAM_READWRITE + )); } diff --git a/vn/field/vn-date-chooser.h b/vn/field/vn-date-chooser.h index 2d7135f..488c4b7 100644 --- a/vn/field/vn-date-chooser.h +++ b/vn/field/vn-date-chooser.h @@ -33,6 +33,9 @@ typedef struct _VnDateChooserClass VnDateChooserClass; struct _VnDateChooser { VnField parent; + gchar * format; + gboolean show_time; + gboolean show_date; GtkWidget * box; GtkLabel * label; GtkWidget * popup; diff --git a/vn/field/vn-entry.c b/vn/field/vn-entry.c index c7734f8..da5262c 100644 --- a/vn/field/vn-entry.c +++ b/vn/field/vn-entry.c @@ -69,7 +69,7 @@ static gboolean vn_entry_cb_focus_out (GtkEntry * entry, GdkEvent * event, VnFie static void vn_entry_set_value (VnEntry * obj, const GValue * value) { GValue new_value = G_VALUE_INIT; - gvn_value_to_format_string (value, obj->digits, &new_value); + gvn_value_to_format_string (value, obj->format, &new_value); g_signal_handlers_block_by_func (obj->entry, vn_entry_cb_editing_done, obj); @@ -91,7 +91,7 @@ static void vn_entry_set_value (VnEntry * obj, const GValue * value) enum { - PROP_DIGITS = 1 + PROP_FORMAT = 1 }; static void vn_entry_set_property (VnEntry * obj, guint id, @@ -99,8 +99,9 @@ static void vn_entry_set_property (VnEntry * obj, guint id, { switch (id) { - case PROP_DIGITS: - obj->digits = g_value_get_uint (value); + case PROP_FORMAT: + g_free (obj->format); + obj->format = g_value_dup_string (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); @@ -109,11 +110,11 @@ static void vn_entry_set_property (VnEntry * obj, guint id, static void vn_entry_get_property (VnEntry * obj, guint id, GValue * value, GParamSpec * pspec) -{ +{ switch (id) { - case PROP_DIGITS: - g_value_set_uint (value, obj->digits); + case PROP_FORMAT: + g_value_set_string (value, obj->format); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); @@ -124,6 +125,7 @@ static void vn_entry_get_property (VnEntry * obj, guint id, static void vn_entry_init (VnEntry * obj) { + obj->format = NULL; obj->entry = GTK_ENTRY (gtk_entry_new ()); g_object_connect (obj->entry ,"signal::activate", vn_entry_cb_editing_done, obj @@ -131,12 +133,13 @@ static void vn_entry_init (VnEntry * obj) ,NULL ); gtk_container_add (GTK_CONTAINER (obj), GTK_WIDGET (obj->entry)); - + VN_FIELD (obj)->field = GTK_WIDGET (obj->entry); } static void vn_entry_finalize (VnEntry * obj) { + g_free (obj->format); G_OBJECT_CLASS (vn_entry_parent_class)->finalize (G_OBJECT (obj)); } @@ -147,12 +150,12 @@ static void vn_entry_class_init (VnEntryClass * klass) k->get_property = (GObjectGetPropertyFunc) vn_entry_get_property; k->finalize = (GObjectFinalizeFunc) vn_entry_finalize; VN_FIELD_CLASS (klass)->set_value = (VnFieldSetValueFunc) vn_entry_set_value; - - g_object_class_install_property (k, PROP_DIGITS, - g_param_spec_uint ("digits" - ,_("Digits") - ,_("The number of decimal places to display.") - ,0 ,20 ,0 + + g_object_class_install_property (k, PROP_FORMAT, + g_param_spec_string ("format" + ,_("Format") + ,_("The format string describing the output of the entry.") + ,NULL ,G_PARAM_CONSTRUCT | G_PARAM_READWRITE )); } diff --git a/vn/field/vn-entry.h b/vn/field/vn-entry.h index 24cbe96..9029a99 100644 --- a/vn/field/vn-entry.h +++ b/vn/field/vn-entry.h @@ -34,8 +34,7 @@ struct _VnEntry { VnField parent; GtkEntry * entry; - guint digits; - + gchar * format; }; struct _VnEntryClass diff --git a/vn/field/vn-label.c b/vn/field/vn-label.c new file mode 100644 index 0000000..4377c30 --- /dev/null +++ b/vn/field/vn-label.c @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2012 - Juan Ferrer Toribio + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "vn-label.h" + +/** + * SECTION:vn-label + * @Short_description: a text label widget + * @Title: VnLabel + * @See_also: #VnField + * + * A label representing a generic value field. + */ + +G_DEFINE_TYPE (VnLabel, vn_label, VN_TYPE_FIELD); + +/** + * vn_label_new: + * + * Creates a new #VnLabel + * + * Return value:a #VnLabel + **/ +VnField * vn_label_new () +{ + return g_object_new (VN_TYPE_LABEL, NULL); +} + +//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private + +static void vn_label_set_value (VnLabel * obj, const GValue * value) +{ + GValue new_value = G_VALUE_INIT; + gvn_value_to_format_string (value, obj->format, &new_value); + gtk_label_set_text (obj->label, g_value_get_string (&new_value)); + g_value_unset (&new_value); +} + +//+++++++++++++++++++++++++++++++++++++++++++++++++++ Properties + +enum +{ + PROP_FORMAT = 1 +}; + +static void vn_label_set_property (VnLabel * obj, guint id, + const GValue * value, GParamSpec * pspec) +{ + switch (id) + { + case PROP_FORMAT: + g_free (obj->format); + obj->format = g_value_dup_string (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); + } +} + +static void vn_label_get_property (VnLabel * obj, guint id, + GValue * value, GParamSpec * pspec) +{ + switch (id) + { + case PROP_FORMAT: + g_value_set_string (value, obj->format); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); + } +} + +//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class + +static void vn_label_init (VnLabel * obj) +{ + obj->format = NULL; + obj->label = GTK_LABEL (gtk_label_new ("")); + gtk_container_add (GTK_CONTAINER (obj), GTK_WIDGET (obj->label)); + + VN_FIELD (obj)->field = GTK_WIDGET (obj->label); +} + +static void vn_label_finalize (VnLabel * obj) +{ + g_free (obj->format); + G_OBJECT_CLASS (vn_label_parent_class)->finalize (G_OBJECT (obj)); +} + +static void vn_label_class_init (VnLabelClass * klass) +{ + GObjectClass * k = G_OBJECT_CLASS (klass); + k->set_property = (GObjectSetPropertyFunc) vn_label_set_property; + k->get_property = (GObjectGetPropertyFunc) vn_label_get_property; + k->finalize = (GObjectFinalizeFunc) vn_label_finalize; + VN_FIELD_CLASS (klass)->set_value = (VnFieldSetValueFunc) vn_label_set_value; + + g_object_class_install_property (k, PROP_FORMAT, + g_param_spec_string ("format" + ,_("Format") + ,_("The format string describing the output of the entry.") + ,NULL + ,G_PARAM_CONSTRUCT | G_PARAM_READWRITE + )); +} diff --git a/vn/field/vn-label.h b/vn/field/vn-label.h new file mode 100644 index 0000000..6c5f485 --- /dev/null +++ b/vn/field/vn-label.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012 - Juan Ferrer Toribio + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef VN_LABEL_H +#define VN_LABEL_H + +#include + +#define VN_TYPE_LABEL (vn_label_get_type ()) +#define VN_LABEL(object) (G_TYPE_CHECK_INSTANCE_CAST (object, VN_TYPE_LABEL , VnLabel)) +#define VN_IS_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, VN_TYPE_LABEL)) +#define VN_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, VN_TYPE_LABEL, VnLabelClass)) +#define VN_IS_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass, VN_TYPE_LABEL)) +#define VN_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, VN_TYPE_LABEL, VnLabelClass)) + +typedef struct _VnLabel VnLabel; +typedef struct _VnLabelClass VnLabelClass; + +struct _VnLabel +{ + VnField parent; + GtkLabel * label; + gchar * format; +}; + +struct _VnLabelClass +{ + /* */ + VnFieldClass parent; +}; + +GType vn_label_get_type (); +VnField * vn_label_new (); + +#endif \ No newline at end of file diff --git a/vn/field/vn-spin.c b/vn/field/vn-spin.c index 1b5fa94..6ffe6b2 100644 --- a/vn/field/vn-spin.c +++ b/vn/field/vn-spin.c @@ -72,7 +72,7 @@ static gboolean vn_spin_on_output (GtkSpinButton * spin, VnField * obj) return vn_field_get_null (obj) && (!text || !g_strcmp0 (text, "")) && gtk_spin_button_get_value (spin) == 0.0; -} +} static void vn_spin_set_value (VnSpin * obj, const GValue * value) { @@ -81,11 +81,10 @@ static void vn_spin_set_value (VnSpin * obj, const GValue * value) if (!gvn_value_is_null (value)) { - GValue new_value = G_VALUE_INIT; + GValue new_value = {0}; g_value_init (&new_value, G_TYPE_DOUBLE); g_value_transform (value, &new_value); - gtk_spin_button_set_value (obj->spin, - g_value_get_double (&new_value)); + gtk_spin_button_set_value (obj->spin, g_value_get_double (&new_value)); g_value_unset (&new_value); } else diff --git a/vn/glade/vn-model.c b/vn/glade/vn-model.c index a0cdbf8..67fe66c 100644 --- a/vn/glade/vn-model.c +++ b/vn/glade/vn-model.c @@ -92,7 +92,7 @@ static const GMarkupParser vn_model_parser = vn_model_start_element ,vn_model_end_element }; - +//FIXME: se pone la propiedad "sql" dos veces en el modelo (entre custom_tag_end y custom_finished) static gboolean vn_model_buildable_custom_tag_start (GtkBuildable *buildable, GtkBuilder * builder, GObject * child, const gchar * tag, GMarkupParser * parser, gpointer * data) diff --git a/vn/gui/login.glade b/vn/gui/login.glade index d87d1fc..690fd1b 100644 --- a/vn/gui/login.glade +++ b/vn/gui/login.glade @@ -308,6 +308,12 @@ False True + gtk-find + True + True + Press here to see the password + + 1 diff --git a/vn/vn-field.c b/vn/vn-field.c index f71decf..e4a948a 100644 --- a/vn/vn-field.c +++ b/vn/vn-field.c @@ -493,7 +493,7 @@ static void vn_field_finalize (VnField * obj) gvn_param_spec_free (obj->spec); gvn_param_spec_free (obj->user_spec); g_clear_object (&obj->iterator); - g_clear_object (&obj->param); + vn_field_set_param (obj, NULL); g_value_unset (obj->value); g_free (obj->value); g_free (obj->column_name); diff --git a/vn/vn-grid-model.c b/vn/vn-grid-model.c index 4e85ffe..fc26bc5 100644 --- a/vn/vn-grid-model.c +++ b/vn/vn-grid-model.c @@ -17,9 +17,48 @@ #include "vn-grid-model.h" +typedef struct +{ + gchar * detail; + gpointer callback; +} +GvnSignalInfo; + +void _gvn_object_link (gpointer obj, gpointer * prop, gpointer prop_value, GvnSignalInfo * info) +{ + gint i; + + if (*prop) + { + for (i = 0; info[i].detail; i++) + g_signal_handlers_disconnect_by_func (*prop, info[i].callback, obj); + + g_object_unref (*prop); + } + + if (prop_value) + { + for (i = 0; info[i].detail; i++) + if (g_str_has_suffix (info[i].detail, ".after")) + { + gchar ** split = g_strsplit (info[i].detail, ".", 0); + g_signal_connect_after (prop_value, split[0], info[i].callback, obj); + g_strfreev (split); + } + else + g_signal_connect (prop_value, info[i].detail, info[i].callback, obj); + + *prop = g_object_ref_sink (prop_value); + } + else + *prop = NULL; +} + +#define gvn_object_link(obj, prop, prop_value, info) (_gvn_object_link (obj, (void**) prop, prop_value, info)) + static void vn_grid_model_tree_model_init (GtkTreeModelIface * iface); static void vn_grid_model_tree_sortable_init (GtkTreeSortableIface * iface); - + G_DEFINE_TYPE_WITH_CODE (VnGridModel, vn_grid_model, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, vn_grid_model_tree_model_init) @@ -91,12 +130,12 @@ void gtk_tree_iter_to_db_iter (const GtkTreeIter * src_iter, DbIter * dest_iter) **/ gboolean vn_grid_model_iter_is_valid (GtkTreeIter * iter, GtkTreeModel * model) { - DbIter db_iter; + DbIter dbiter; g_return_val_if_fail (GTK_IS_TREE_MODEL (model), FALSE); - gtk_tree_iter_to_db_iter (iter, &db_iter); - return db_model_iter_is_valid (&db_iter, VN_GRID_MODEL (model)->model); + gtk_tree_iter_to_db_iter (iter, &dbiter); + return db_model_iter_is_valid (&dbiter, VN_GRID_MODEL (model)->model); } static gint vn_grid_model_get_nrows (GtkTreeModel * obj) @@ -106,27 +145,27 @@ static gint vn_grid_model_get_nrows (GtkTreeModel * obj) //++++ Broadcast of GtkTreeModel and GtkTreeSortable signals: -static void vn_grid_model_on_line_updated (DbModel * model, DbIter * db_iter, GtkTreeModel * obj) +static void vn_grid_model_on_line_updated (DbModel * model, DbIter * dbiter, GtkTreeModel * obj) { GtkTreeIter iter; - gtk_tree_iter_from_db_iter (&iter, db_iter); + gtk_tree_iter_from_db_iter (&iter, dbiter); GtkTreePath * path = gtk_tree_path_new (); - gtk_tree_path_append_index (path, db_model_get_path (model, db_iter)); + gtk_tree_path_append_index (path, db_model_get_path (model, dbiter)); gtk_tree_model_row_changed (obj, path, &iter); gtk_tree_path_free (path); } -static void vn_grid_model_on_line_inserted (DbModel * model, DbIter * db_iter, GtkTreeModel * obj) +static void vn_grid_model_on_line_inserted (DbModel * model, DbIter * dbiter, GtkTreeModel * obj) { GtkTreeIter iter; - gtk_tree_iter_from_db_iter (&iter, db_iter); + gtk_tree_iter_from_db_iter (&iter, dbiter); GtkTreePath * path = gtk_tree_path_new (); gtk_tree_path_append_index (path, - db_model_get_path (model, db_iter)); + db_model_get_path (model, dbiter)); gtk_tree_model_row_inserted (obj, path, &iter); @@ -176,13 +215,13 @@ static GType vn_grid_model_get_column_type (GtkTreeModel * obj, gint index_) static gboolean vn_grid_model_get_iter (GtkTreeModel * obj, GtkTreeIter * iter, GtkTreePath * path) { - DbIter db_iter; + DbIter dbiter; gint p = gtk_tree_path_get_indices (path)[0]; - gboolean ret = db_model_get_iter (VN_GRID_MODEL (obj)->model, &db_iter, p); + gboolean ret = db_model_get_iter (VN_GRID_MODEL (obj)->model, &dbiter, p); if (ret) - gtk_tree_iter_from_db_iter (iter, &db_iter); + gtk_tree_iter_from_db_iter (iter, &dbiter); return ret; } @@ -190,13 +229,13 @@ static gboolean vn_grid_model_get_iter (GtkTreeModel * obj, GtkTreeIter * iter, static GtkTreePath * vn_grid_model_get_path (GtkTreeModel * obj, GtkTreeIter * iter) { GtkTreePath * path; - DbIter db_iter; + DbIter dbiter; - gtk_tree_iter_to_db_iter (iter, &db_iter); + gtk_tree_iter_to_db_iter (iter, &dbiter); path = gtk_tree_path_new (); gtk_tree_path_append_index (path, - db_model_get_path (VN_GRID_MODEL (obj)->model, &db_iter)); + db_model_get_path (VN_GRID_MODEL (obj)->model, &dbiter)); return path; } @@ -205,11 +244,11 @@ static void vn_grid_model_get_value (GtkTreeModel * obj, GtkTreeIter * iter, gint column, GValue * value) { const GValue * v; - DbIter db_iter; + DbIter dbiter; - gtk_tree_iter_to_db_iter (iter, &db_iter); + gtk_tree_iter_to_db_iter (iter, &dbiter); - v = db_model_get_value (VN_GRID_MODEL (obj)->model, &db_iter, column, NULL); + v = db_model_get_value (VN_GRID_MODEL (obj)->model, &dbiter, column, NULL); if (v) { @@ -222,24 +261,24 @@ static void vn_grid_model_get_value (GtkTreeModel * obj, GtkTreeIter * iter, static gboolean vn_grid_model_iter_next (GtkTreeModel * obj, GtkTreeIter * iter) { - DbIter db_iter; - gtk_tree_iter_to_db_iter (iter, &db_iter); + DbIter dbiter; + gtk_tree_iter_to_db_iter (iter, &dbiter); - gboolean ret_val = db_model_iter_next (VN_GRID_MODEL (obj)->model, &db_iter); + gboolean ret_val = db_model_iter_next (VN_GRID_MODEL (obj)->model, &dbiter); - iter->user_data = db_iter.data; + iter->user_data = dbiter.data; return ret_val; } static gboolean vn_grid_model_iter_previous (GtkTreeModel * obj, GtkTreeIter * iter) { - DbIter db_iter; - gtk_tree_iter_to_db_iter (iter, &db_iter); + DbIter dbiter; + gtk_tree_iter_to_db_iter (iter, &dbiter); - gboolean ret_val = db_model_iter_prev (VN_GRID_MODEL (obj)->model, &db_iter); + gboolean ret_val = db_model_iter_prev (VN_GRID_MODEL (obj)->model, &dbiter); - iter->user_data = db_iter.data; + iter->user_data = dbiter.data; return ret_val; } @@ -249,13 +288,13 @@ static gboolean vn_grid_model_iter_children (GtkTreeModel * obj, GtkTreeIter * i { if (parent == NULL) { - DbIter db_iter; + DbIter dbiter; gboolean ret_val = db_model_get_iter_first (VN_GRID_MODEL (obj)->model - ,&db_iter); + ,&dbiter); if (ret_val) - gtk_tree_iter_from_db_iter (iter, &db_iter); + gtk_tree_iter_from_db_iter (iter, &dbiter); return ret_val; } @@ -281,11 +320,11 @@ static gboolean vn_grid_model_iter_nth_child (GtkTreeModel * obj, GtkTreeIter * { if (parent == NULL) { - DbIter db_iter; - gboolean ret = db_model_get_iter (VN_GRID_MODEL (obj)->model, &db_iter, n); + DbIter dbiter; + gboolean ret = db_model_get_iter (VN_GRID_MODEL (obj)->model, &dbiter, n); if (ret) - gtk_tree_iter_from_db_iter (iter, &db_iter); + gtk_tree_iter_from_db_iter (iter, &dbiter); } return FALSE; @@ -347,20 +386,30 @@ typedef enum } VnGridModelProp; +GvnSignalInfo signal_info[] = +{ + {"line-updated.after", vn_grid_model_on_line_updated + },{"line-inserted", vn_grid_model_on_line_inserted + },{"line-deleted.after", vn_grid_model_on_line_deleted + },{"lines-reordered", vn_grid_model_on_lines_reordered + },{"sort-changed", vn_grid_model_on_sort_changed + },{NULL} +}; + static void vn_grid_model_set_property (VnGridModel * obj, guint property_id, const GValue * value, GParamSpec * pspec) { switch (property_id) { case PROP_MODEL: - obj->model = g_value_get_object (value); - g_object_ref_sink (obj->model); + gvn_object_link (obj, &obj->model, g_value_get_object (value), signal_info); + /*g_object_ref_sink (obj->model); g_object_connect (obj->model ,"signal-after::line-updated", vn_grid_model_on_line_updated, obj ,"signal::line-inserted", vn_grid_model_on_line_inserted, obj ,"signal-after::line-deleted", vn_grid_model_on_line_deleted, obj ,"signal::lines-reordered", vn_grid_model_on_lines_reordered, obj - ,"signal::sort-changed", vn_grid_model_on_sort_changed, obj, NULL); + ,"signal::sort-changed", vn_grid_model_on_sort_changed, obj, NULL);*/ break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec); @@ -384,6 +433,8 @@ static void vn_grid_model_get_property (VnGridModel * obj, guint property_id, static void vn_grid_model_finalize (VnGridModel * obj) { + gvn_object_link (obj, &obj->model, NULL, signal_info); +/* g_object_disconnect (obj->model ,"any_signal", vn_grid_model_on_line_updated, obj ,"any_signal", vn_grid_model_on_line_inserted, obj @@ -392,7 +443,7 @@ static void vn_grid_model_finalize (VnGridModel * obj) ,"any_signal", vn_grid_model_on_sort_changed, obj, NULL); g_object_unref (obj->model); - +*/ G_OBJECT_CLASS (vn_grid_model_parent_class)->finalize (G_OBJECT (obj)); } @@ -409,7 +460,7 @@ static void vn_grid_model_class_init (VnGridModelClass * k) ,"The #DbModel with the data used by the #VnGridModel" ,DB_TYPE_MODEL ,G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE - )); + )); } static void vn_grid_model_tree_model_init (GtkTreeModelIface * iface) @@ -442,4 +493,4 @@ static void vn_grid_model_tree_sortable_init (GtkTreeSortableIface * iface) static void vn_grid_model_init (VnGridModel * obj) { obj->model = NULL; -} +} diff --git a/vn/vn-grid.c b/vn/vn-grid.c index 562a94a..ded7dc4 100644 --- a/vn/vn-grid.c +++ b/vn/vn-grid.c @@ -50,12 +50,38 @@ VnGrid * vn_grid_new_with_iterator (DbIterator * iterator) static void vn_grid_on_iter_changed (DbIterator * iterator, GtkTreeView * obj); +static void vn_grid_on_selection_changed (GtkTreeSelection * selection, GtkTreeView * obj) +{ + GtkTreeIter iter; + GList * l, * list; + + if (gtk_tree_selection_count_selected_rows (selection) <= 1) + return; + + list = gtk_tree_selection_get_selected_rows (selection, NULL); + + for (l = list; l; l = l->next) + if (gtk_tree_model_get_iter (gtk_tree_view_get_model (obj), &iter, l->data)) + { + DbIter dbiter; + vn_gtk_tree_iter_to_db_iter (&iter, &dbiter); + db_iterator_select_iter (VN_GRID (obj)->iterator, &dbiter); + } + + g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free); +} + static void vn_grid_on_cursor_changed (GtkTreeView * obj, DbIterator * iterator) { GtkTreeIter iter; - GtkTreeSelection * selection = gtk_tree_view_get_selection (obj); + GtkTreePath * path; - if (selection && gtk_tree_selection_get_selected (selection, NULL, &iter)) + if (gtk_tree_selection_count_selected_rows (gtk_tree_view_get_selection (obj)) > 1) + return; + + gtk_tree_view_get_cursor (obj, &path, NULL); + + if (path && gtk_tree_model_get_iter (gtk_tree_view_get_model (obj), &iter, path)) { DbIter dbiter; vn_gtk_tree_iter_to_db_iter (&iter, &dbiter); @@ -64,6 +90,8 @@ static void vn_grid_on_cursor_changed (GtkTreeView * obj, DbIterator * iterator) db_iterator_move_iter (iterator, &dbiter); g_signal_handlers_unblock_by_func (iterator, vn_grid_on_iter_changed, obj); } + + gtk_tree_path_free (path); } static void vn_grid_on_iter_changed (DbIterator * iterator, GtkTreeView * obj) @@ -71,20 +99,19 @@ static void vn_grid_on_iter_changed (DbIterator * iterator, GtkTreeView * obj) DbIter dbiter; GtkTreeSelection * selection = gtk_tree_view_get_selection (obj); - if (db_iterator_get_iter (iterator, &dbiter) - && gtk_tree_view_get_model (obj)) + if (db_iterator_get_iter (iterator, &dbiter) && gtk_tree_view_get_model (obj)) { GtkTreeIter iter; GtkTreePath * path; vn_gtk_tree_iter_from_db_iter (&iter, &dbiter); + path = gtk_tree_model_get_path (gtk_tree_view_get_model (obj), &iter); + g_signal_handlers_block_by_func (obj, vn_grid_on_cursor_changed, iterator); - gtk_tree_selection_select_iter (selection, &iter); + gtk_tree_view_set_cursor (obj, path, NULL, FALSE); g_signal_handlers_unblock_by_func (obj, vn_grid_on_cursor_changed, iterator); - path = gtk_tree_model_get_path ( - gtk_tree_view_get_model (obj), &iter); - gtk_tree_view_scroll_to_cell (obj, path, NULL, FALSE, 0, 0); + gtk_widget_grab_focus (GTK_WIDGET (obj)); gtk_tree_path_free (path); } else if (selection) @@ -112,6 +139,7 @@ static void vn_grid_on_status_changed (DbIterator * iterator, gboolean ready, Vn GtkTreeModel * tree_model = GTK_TREE_MODEL (vn_grid_model_new (obj->model)); gtk_tree_view_set_model (GTK_TREE_VIEW (obj), tree_model); vn_grid_on_iter_changed (obj->iterator, GTK_TREE_VIEW (obj)); + g_object_unref (tree_model); } else @@ -121,8 +149,7 @@ static void vn_grid_on_status_changed (DbIterator * iterator, gboolean ready, Vn static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj, GdkEventKey * event, gpointer data) { - gboolean inverted; - gboolean passed = FALSE; + gboolean inverted, passed = FALSE; gint sel_tab_index; VnColumn * first = NULL; GList * n, * columns; @@ -193,6 +220,8 @@ static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj, } } + g_list_free (columns); + if (!next) { gboolean leave = FALSE; @@ -230,10 +259,8 @@ static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj, } } - g_list_free (columns); gtk_tree_view_set_cursor (obj, path, GTK_TREE_VIEW_COLUMN (next), TRUE); gtk_tree_path_free (path); - return TRUE; } @@ -276,7 +303,7 @@ void vn_grid_set_iterator (VnGrid * obj, DbIterator * iterator) { g_return_if_fail (VN_IS_GRID (obj)); g_return_if_fail (DB_IS_ITERATOR (iterator) || !iterator); - + if (obj->iterator) { g_signal_handlers_disconnect_by_func (obj, @@ -288,6 +315,7 @@ void vn_grid_set_iterator (VnGrid * obj, DbIterator * iterator) ,NULL ); g_clear_object (&obj->iterator); + obj->model = NULL; } if (iterator) @@ -301,7 +329,7 @@ void vn_grid_set_iterator (VnGrid * obj, DbIterator * iterator) vn_grid_on_status_changed (iterator, db_iterator_is_ready (iterator), obj); - + g_signal_connect_after (obj, "cursor-changed", G_CALLBACK (vn_grid_on_cursor_changed), iterator); } @@ -435,7 +463,7 @@ static void vn_grid_set_property (VnGrid * obj, guint id, case PROP_ITERATOR: vn_grid_set_iterator (obj, g_value_get_object (value)); break; - default: + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); } } @@ -448,7 +476,7 @@ static void vn_grid_get_property (VnGrid * obj, guint id, case PROP_ITERATOR: g_value_set_object (value, obj->iterator); break; - default: + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec); } } @@ -457,12 +485,12 @@ static void vn_grid_get_property (VnGrid * obj, guint id, static void vn_grid_init (VnGrid * obj) { + GtkTreeSelection * selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj)); obj->iterator = NULL; obj->model = NULL; - gtk_tree_selection_set_mode ( - gtk_tree_view_get_selection (GTK_TREE_VIEW (obj)), - GTK_SELECTION_SINGLE - ); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); + g_signal_connect (selection, "changed", + G_CALLBACK (vn_grid_on_selection_changed), obj); g_signal_connect (obj, "notify::model", G_CALLBACK (vn_grid_on_model_changed), NULL); diff --git a/vn/vn-handler.c b/vn/vn-handler.c index 4ff1464..0af563e 100644 --- a/vn/vn-handler.c +++ b/vn/vn-handler.c @@ -62,7 +62,7 @@ static void vn_handler_on_remove_activated (GtkAction * action, VnHandler * obj) ,GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT ,GTK_MESSAGE_QUESTION ,GTK_BUTTONS_OK_CANCEL - ,_("Are you sure you want to delete the selected record?") + ,_("Are you sure you want to delete the current selection?") ); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) @@ -167,11 +167,11 @@ static void vn_handler_on_row_num_changed (DbIterator * iterator, VnHandler * ob { gboolean sensitive = db_iterator_get_update_flags (iterator) & DB_MODEL_DELETE - && db_iterator_get_row (iterator) != -1; + && db_iterator_get_nrows (iterator) > 0; gtk_action_set_sensitive (obj->remove, sensitive); } - + vn_handler_refresh_scroll_status (obj); } diff --git a/vn/vn-login.c b/vn/vn-login.c index 2bee37c..57fe54f 100644 --- a/vn/vn-login.c +++ b/vn/vn-login.c @@ -395,6 +395,18 @@ void vn_login_cb_destroyed (GtkWidget * window, VnLogin * obj) gtk_main_quit (); } +void vn_login_cb_pass_show (GtkEntry * entry, GtkEntryIconPosition * pos, + GdkEvent * event, VnLogin * obj) +{ + gtk_entry_set_visibility (entry, TRUE); +} + +void vn_login_cb_pass_hide (GtkEntry * entry, GtkEntryIconPosition * pos, + GdkEvent * event, VnLogin * obj) +{ + gtk_entry_set_visibility (entry, FALSE); +} + //+++++++++++++++++++++++++++++++++++++++++++++++++++ Public /**