Se ha mejorado el plugin de glade y se ha añadido al proyecto la plantilla de los módulos para anjuta

This commit is contained in:
Alejandro T. Colombini Gómez 2013-12-13 10:07:52 +01:00
parent 65d9412b43
commit f6a57e87b6
63 changed files with 1806 additions and 359 deletions

View File

@ -14,7 +14,8 @@ SUBDIRS = \
po \
vapi \
glade \
docs
docs \
anjuta
EXTRA_DIST = \
autogen.sh \

50
anjuta/Makefile.am Normal file
View File

@ -0,0 +1,50 @@
anjutadir = $(datadir)/anjuta/templates
anjuta_DATA = \
hedera.wiz \
hedera-logo.png
templatedir = $(anjutadir)/hedera
template_DATA = \
hedera/anjuta.session.tpl \
hedera/AUTHORS.tpl \
hedera/configure.ac.tpl \
hedera/Makefile.am.tpl \
hedera/translation
anjuta_srcdir = $(templatedir)/src
anjuta_src_DATA = \
hedera/src/config.vapi \
hedera/src/form.vala \
hedera/src/Makefile.am.tpl \
hedera/src/mod.vala
anjuta_datadir = $(templatedir)/data
anjuta_data_DATA = \
hedera/data/Makefile.am.tpl \
hedera/data/mod.glade \
hedera/data/mod.ui.tpl \
hedera/data/mod.xml.tpl
anjuta_sqldir = $(templatedir)/sql/mod
anjuta_sql_DATA = hedera/sql/mod/query.sql.tpl
anjuta_m4dir = $(templatedir)/build/m4
anjuta_m4_DATA = hedera/build/m4/pkg.m4
anjuta_podir = $(templatedir)/po
anjuta_po_DATA = \
hedera/po/POTFILES.in.tpl \
hedera/po/POTFILES.skip.tpl
anjuta_debiandir = $(templatedir)/debian
anjuta_debian_DATA = \
hedera/debian/changelog.tpl \
hedera/debian/compat \
hedera/debian/control.tpl \
hedera/debian/copyright.tpl \
hedera/debian/docs \
hedera/debian/rules
anjuta_debian_sourcedir = $(anjuta_debiandir)/source
anjuta_debian_source_DATA = hedera/debian/source/format

BIN
anjuta/hedera-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

134
anjuta/hedera.wiz Normal file
View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-template>
<project-wizard>
<name>Hedera Module</name>
<description>Basic project for an Hedera Module.</description>
<icon>hedera-logo.png</icon>
<category>Vala</category>
<required-program>automake</required-program>
<required-program>autoconf</required-program>
<required-program>make</required-program>
<required-program>valac</required-program>
<required-program>hedera</required-program>
<required-package>hedera</required-package>
</project-wizard>
<page name="basic" label="Basic information" description="General Project Information">
<property type="string" summary="yes" restriction="filename" name="Name" mandatory="yes" default="module" label="Module Name:" description="Module name"></property>
<property type="string" summary="yes" restriction="filename" name="FormName" mandatory="yes" default="example" label="Form Name:" description="Form name"></property>
<property type="string" name="Author" mandatory="yes" default="[+UserName+]" label="Author:" description="The author or team full name"></property>
<property type="string" name="Email" mandatory="no" default="[+EmailAddress+]" label="Email address:" description="Author or team e-mail address"></property>
<property type="string" name="Version" mandatory="yes" default="0.1" label="Version:" description= "The actual version of the module"></property>
</page>
<page name="options" label="Project options" description="Options for project build system">
<property type="directory" summary="yes" name="Destination" mandatory="yes" exist="no" default='[+AnjutaProjectDirectory+]/[+(string-downcase (get "Name"))+]' label="Destination:" description="The directory where the project will be stored once created"></property>
<property type="directory" summary="yes" name="Destination" mandatory="yes" exist="no" default='[+AnjutaProjectDirectory+]/[+(string-downcase (get "Name"))+]' label="Destino:" description="El directorio donde se guadará el proyecto una vez creado" xml:lang="es"></property>
[+INCLUDE "licenses.tpl"+]
<property type="boolean" name="DebianPackage" default="1" label="Make a Debian package:" description="Generate the files needed to build a .deb package"></property>
<property type="boolean" name="DebianPackage" default="1" label="Crear paquete Debian:" description="Generar los ficheros necesarios para construir un paquete .deb" xml:lang="es"></property>
<property type="hidden" name="NameUpper" default='[+(string-upcase (get "Name"))+]'/>
<property type="hidden" name="NameLower" default='[+(string-downcase (get "Name"))+]'/>
<property type="hidden" name="NameCUpper" default='[+(string->c-name! (string-substitute (string-upcase (get "Name")) " " "_"))+]'/>
<property type="hidden" name="NameCLower" default='[+(string->c-name! (string-substitute (string-downcase (get "Name")) " " "_"))+]'/>
<property type="hidden" name="NameHLower" default='[+(string-substitute (string->c-name! (string-downcase (get "Name"))) " " "-")+]'/>
<property type="hidden" name="ClassName" default='[+(string->camelcase (get "Name"))+]'/>
<property type="hidden" name="FormClassName" default='[+(string->camelcase (get "FormName"))+]'/>
<property type="hidden" name="HavePackage" default="1"/>
<property type="hidden" name="PackageModule1" default="hedera"/>
<property type="boolean" name="HaveI18n" default="0" label="Add internationalization:" description="Adds support for internationalization so that your project can have translations in different languages" default="1"></property>
<property type="boolean" name="HavePackageExtra" default="0" label="Configure external packages:" description="Add library support from other packages (GLib, Gtk+ and Hedera are already added)"></property>
<property type="boolean" name="HavePackageExtra" default="0" label="Configurar paquetes externos:" description="Añade soporte para otros paquetes (GLib, Gtk+ y Hedera ya están añadidos)"xml:lang="es"></property>
<!-- <property type="boolean" name="HaveGtkDoc" default="0" label="Use Gtk-Doc for documentation:" description="Use Gtk-Doc to help you generate the documentation"></property>
<property type="boolean" name="HaveGtkDoc" default="0" label="Usar Gtk-Doc para documentación:" description="Emplear Gtk-Doc para facilitar la generación de documentación" xml:lang="es"></property>
-->
</page>
[+IF (=(get "HavePackageExtra") "1")+]
<page name="packages" label="Configure external packages" description="Configure external packages">
<property type="package" name="PackageModule2" mandatory="yes" label="Require Package:" description="Select the name of the requiered external packages."></property>
</page>
[+ENDIF+]
<content>
<directory source="minimal" destination="[+Destination+]">
<file source="autogen.sh" executable="yes"/>
</directory>
<directory source="terminal" destination="[+Destination+]">
<file source="ChangeLog"/>
<file source="NEWS"/>
<file source="README"/>
<file source="project.anjuta" destination="[+NameHLower+].anjuta"/>
<directory source="po">
<file source="ChangeLog"/>
<file source="LINGUAS"/>
</directory>
</directory>
<directory source="licenses" destination="[+Destination+]">
<file source="[+License+].txt" destination="COPYING"/>
</directory>
<directory source="hedera" destination="[+Destination+]">
<file source="AUTHORS.tpl" destination="AUTHORS"/>
<file source="Makefile.am.tpl" destination="Makefile.am"/>
<file source="configure.ac.tpl" destination="configure.ac"/>
<directory source="src">
<file source="mod.vala" destination="[+Name+].vala"/>
<file source="form.vala" destination="[+FormName+].vala"/>
<file source="config.vapi" destination="config.vapi"/>
<file source="Makefile.am.tpl" destination="Makefile.am"/>
</directory>
<directory source="data">
<file source="mod.glade" destination="[+FormName+].glade"/>
<file source="mod.xml.tpl" destination="[+Name+].xml"/>
<file source="mod.ui.tpl" destination="[+Name+].ui"/>
<file source="Makefile.am.tpl" destination="Makefile.am"/>
</directory>
<directory source="sql">
<directory source="mod" destination="[+Name+]">
<file source="query.sql.tpl" destination="[+FormName+].sql"/>
</directory>
</directory>
[+IF (=(get "DebianPackage") "1")+]
<directory source="debian">
<file source="changelog.tpl" destination="changelog"/>
<file source="compat"/>
<file source="control.tpl" destination="control"/>
<file source="copyright.tpl" destination="copyright"/>
<file source="docs"/>
<file source="rules" executable="yes"/>
<directory source="source">
<file source="format"/>
</directory>
</directory>
<directory source="build">
<directory source="m4">
<file source="pkg.m4"/>
</directory>
</directory>
[+ENDIF+]
[+IF (=(get "HaveI18n") "1") +]
<file source="translation" executable="yes"/>
<directory source="po">
<file source="POTFILES.in.tpl" destination="POTFILES.in"/>
<file source="POTFILES.skip.tpl" destination="POTFILES.skip"/>
</directory>
[+ENDIF+]
<directory source="." destination=".anjuta">
<directory source="." destination="session">
<file source="anjuta.session.tpl" destination="anjuta.session"/>
</directory>
</directory>
</directory>
</content>
<action>
[+IF (=(get "HaveI18n") "1") +]
<run command="bash -c &quot; cd [+Destination+]/po
&amp;&amp; intltool-update -p
&amp;&amp; msginit --no-translator -i *.pot -o es.po -l es_ES.utf8
&amp;&amp; echo es &gt;&gt; LINGUAS
&quot;"/>
[+ENDIF+]
<open file="[+Destination+]/[+NameHLower+].anjuta"/>
</action>
</project-template>

View File

@ -0,0 +1,2 @@
[+ autogen5 template +]
[+Author+] <[+Email+]>

View File

@ -0,0 +1,42 @@
[+ autogen5 template +]
[+
(define prefix_if_missing
(lambda
(name prefix)
(string-append
(if
(==* (get name) prefix)
""
prefix
)
(get name)
)
)
)
+]## Process this file with automake to produce Makefile.in
## Created by Anjuta
ACLOCAL_AMFLAGS = -I build/m4
SUBDIRS = \
src \
data[+IF (=(get "HaveI18n") "1")+] \
po
translationsdir =
translations_DATA = \
po/es.po
[+ENDIF+]
EXTRA_DIST = \
README \
COPYING \
AUTHORS \
ChangeLog \
INSTALL \
NEWS \
Makefile.decl
install-exec-hook:
rm -f $(DESTDIR)$(libdir)/hedera/module/[+(prefix_if_missing "Name" "lib")+].la
rm -f $(DESTDIR)$(libdir)/hedera/module/[+(prefix_if_missing "Name" "lib")+].a

View File

@ -0,0 +1,32 @@
[+ autogen5 template +]
[Anjuta]
Maximized=1
Geometry=1920x1021+0+27
[Project Manager]
Expand=[+Name+]%%%[+Name+]//data%%%[+Name+]//src
[File Loader]
Files=../../src/[+FormName+].vala#30
[Document Manager]
bookmarks=<?xml version="1.0" encoding="UTF-8"?>\n<bookmarks/>\n
[Execution]
Program arguments=-u
Program uri=file:///usr/bin/hedera-bin
Run in terminal=2
Working directories=../../../[+Name+]%%%../../build
Environment variables=VN_MODULE_LIB_PATH=./build/src/.libs%%%VN_MODULE_DATA_PATH=./data%%%VN_MODULE_QUERY_PATH=./sql
[Build]
Configuration list=1:Default:build%%%1:Debug:build%%%1:Install:build%%%1:Optimized:build%%%1:Profiling:build
Selected Configuration=Debug
BuildArgs/Default=
BuildArgs/Debug=--enable-debug
BuildArgs/Install=--prefix=
BuildArgs/Optimized=
BuildArgs/Profiling=
[Debugger]
Stop at beginning=2

View File

@ -0,0 +1,15 @@
# Retrieves the value of the pkg-config variable for the given module.
# Will be removed when pkg-config gets to version 0.28, where this belongs.
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])# PKG_CHECK_VAR

View File

@ -0,0 +1,80 @@
[+ autogen5 template +]
dnl Process this file with autoconf to produce a configure script.
dnl Created by Anjuta application wizard.
AC_INIT([+Name+], [+Version+])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([build/m4])
AC_CONFIG_HEADERS([build/config.h])
AM_INIT_AUTOMAKE([-Wno-portability])
AM_SILENT_RULES([yes])
AC_PROG_CC
dnl Check for vala.
dnl You should change the version shown here manually to match with yours.
AM_PROG_VALAC([0.20.0])
[+IF (=(get "HaveI18n") "1")+]
dnl Internationalization
IT_PROG_INTLTOOL([0.35.0])
GETTEXT_PACKAGE=hedera-[+Name+]
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
AM_GLIB_GNU_GETTEXT
AM_XGETTEXT_OPTION([-k_ -kQ_:1g -kN_ -kC_:1c,2 -kNC_:1c,2])
[+ENDIF+]
dnl Check for debug mode.
AC_MSG_CHECKING([whether to build with debug information...])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Enable debug data generation (def=no)])],
[ENABLE_DEBUG="$enableval"],
[ENABLE_DEBUG=no])
AC_MSG_RESULT([$ENABLE_DEBUG])
if test x"$ENABLE_DEBUG" = x"yes"; then
CFLAGS=" -ggdb -O0 "
VALAFLAGS=" -g --save-temps "
else
CFLAGS=" -O2 "
VALAFLAGS=
fi
dnl Check if the C warnings must be shown
AC_MSG_CHECKING([whether C warnings will be shown...])
AC_ARG_ENABLE([c-warnings],
[AS_HELP_STRING([--enable-c-warnings],
[Enable C warnings to be shown (def=no)])],
[C_WARNINGS="$enableval"],
[C_WARNINGS=no])
AC_MSG_RESULT([$C_WARNINGS])
if test x"$C_WARNINGS" = x"yes"; then
CFLAGS+=" -Wall "
else
CFLAGS+=" -w "
fi
AC_SUBST([CFLAGS])
AC_SUBST([VALAFLAGS])
AC_SUBST([[+NameCLower+]_datadir], ['$(datadir)/hedera/module'])
LT_INIT
[+IF (=(get "HavePackage") "1")+]
PKG_CHECK_VAR([[+NameCLower+]_libdir], [[+PackageModule1+]], [modulelibdir])
PKG_CHECK_VAR([[+NameCLower+]_datadir], [[+PackageModule1+]], [moduledatadir])
PKG_CHECK_VAR([querydir], [[+PackageModule1+]], [modulequerydir])
PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+]])
# Check if vala bindigns are installed and usable
VALA_CHECK_PACKAGES([[+PackageModule1+] [+PackageModule2+]])[+ENDIF+]
[+IF (=(get "HaveGtkDoc") "1")+]GTK_DOC_CHECK([1.0])[+ENDIF+]
AC_OUTPUT([
Makefile
src/Makefile
data/Makefile
[+IF (=(get "HaveI18n") "1")+] po/Makefile.in[+ENDIF+]])

View File

@ -0,0 +1,11 @@
[+ autogen5 template +]
## Process this file with automake to produce Makefile.in
## Created by Anjuta
[+NameCLower+]_data_DATA = \
[+Name+].xml \
[+Name+].ui \
[+FormName+].glade
EXTRA_DIST = $([+NameCLower+]_data_DATA)

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkBox" id="main">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
</interface>

View File

@ -0,0 +1,10 @@
[+ autogen5 template +]
<ui>
<menubar name="MenuBar">
<placeholder name="ModuleMenu">
<menu name="[+ClassName+]Menu" action="action-menu-[+Name+]">
<menuitem name="[+FormClassName+]" action="open-[+FormName+]"/>
</menu>
</placeholder>
</menubar>
</ui>

View File

@ -0,0 +1,20 @@
[+ autogen5 template +]
<module>
<library translatable="yes" name="[+Name+]">[+ClassName+]</library>
<action-group>
<action translatable="yes" name="action-menu-[+Name+]">
[+ClassName+]
</action>
</action-group>
<form-group>
<form
translatable="yes"
name="[+FormName+]"
icon="gtk-find-and-replace"
action-name="open-[+FormName+]"
accel="">
[+FormClassName+]
</form>
</form-group>
</module>

View File

@ -0,0 +1,6 @@
[+ autogen5 template +]
[+Name+] ([+Version+]) UNRELEASED; urgency=low
* Initial Release.
-- [+Author+] <[+Email+]> [+(shell "date -R")+]

View File

@ -0,0 +1 @@
8

View File

@ -0,0 +1,14 @@
[+ autogen5 template +]
Source: [+Name+]
Section: gnome
Priority: optional
Maintainer: [+Author+] <[+Email+]>
Build-Depends: debhelper (>= 8.0.0), autotools-dev, libhedera-dev
Standards-Version: 3.9.3
Package: hedera-[+Name+]
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, hedera
Description: Modules for Hedera
Description of the included modules will
be put here.

View File

@ -0,0 +1,29 @@
[+ autogen5 template +]
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: [+Name+]
Source: http://www.verdnatura.es/
Files: *
Copyright: [+(shell "date +%Y")+] [+Author+] <[+Email+]>
License: GPL-3.0+
Files: debian/*
Copyright: [+(shell "date +%Y")+] [+Author+] <[+Email+]>
License: GPL-3.0+
License: GPL-3.0+
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 package 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 <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

View File

@ -0,0 +1,2 @@
NEWS
README

View File

@ -0,0 +1,20 @@
[+ autogen5 template +]
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@ --with autotools-dev --builddirectory=debian/build
override_dh_auto_configure:
dh_auto_configure -- $(shell dpkg-buildflags --export=configure)
.PHONY: override_dh_shlibdeps
override_dh_shlibdeps:
dh_shlibdeps -O--builddirectory=debian/build \
-l/usr/lib/x86_64-linux-gnu/hedera
.PHONY: override_dh_makeshlibs
override_dh_makeshlibs:
dh_makeshlibs --noscripts

View File

@ -0,0 +1 @@
3.0 (native)

View File

@ -0,0 +1,7 @@
[+ autogen5 template +]
# List of source files containing translatable strings.
src/[+Name+].vala
src/[+FormName+].vala
data/[+FormName+].glade
[type: gettext/glade]data/[+Name+].xml

View File

@ -0,0 +1,5 @@
[+ autogen5 template +]
# List of source files to skip from translation.
src/[+Name+].c
src/[+FormName+].c

View File

View File

@ -0,0 +1,48 @@
[+ autogen5 template +]
[+
(define prefix_if_missing
(lambda
(name prefix)
(string-append
(if
(==* (get name) prefix)
""
prefix
)
(get name)
)
)
)
+]## Process this file with automake to produce Makefile.in
## Created by Anjuta
[+NameCLower+]_lib_LTLIBRARIES = [+(prefix_if_missing "Name" "lib")+].la
[+(prefix_if_missing "NameCLower" "lib")+]_la_SOURCES = \
config.vapi \
[+Name+].vala \
[+FormName+].vala
[+(prefix_if_missing "NameCLower" "lib")+]_la_LIBADD = $([+NameCUpper+]_LIBS)
[+(prefix_if_missing "NameCLower" "lib")+]_la_LDFLAGS = \
-avoid-version \
-Wl,--export-dynamic
[+(prefix_if_missing "NameCLower" "lib")+]_la_CPPFLAGS = \
-DPACKAGE_DATA_DIR=\"$([+NameCLower+]_datadir)\"[+IF (=(get "HaveI18n") "1")+] \
-DPACKAGE_LOCALE_DIR=\"$(datadir)/locale\"[+ELSE+] \
-DGETTEXT_PACKAGE=\"hedera-[+Name+]\"[+ENDIF+][+IF (=(get "HavePackage") "1")+] \
$([+NameCUpper+]_CFLAGS)[+ENDIF+]
[+(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+]--pkg [+PackageModule1+] \
$(VALAFLAGS)
[+NameCLower+]_querydir = $(querydir)/[+NameHLower+]
[+NameCLower+]_query_DATA =
uninstall-local:
rm -f $(DESTDIR)$(libdir)/hedera/module/[+(prefix_if_missing "Name" "lib")+].so

View File

@ -0,0 +1,12 @@
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Config
{
public const string GETTEXT_PACKAGE;
public const string SPRITE_DIR;
public const string BACKGROUND_DIR;
public const string PACKAGE_DATA_DIR;
public const string PACKAGE_LOCALE_DIR;
public const string PACKAGE_NAME;
public const string PACKAGE_VERSION;
public const string VERSION;
}

View File

@ -0,0 +1,22 @@
[+ autogen5 template +]
[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
/* -*- Mode: vala; tab-width: 4; intend-tabs-mode: t -*- */
/*
* Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
*
[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "Name") OWNER=(get "Author") \+]
*/
public class Vn.[+FormClassName+] : Vn.Form
{
public [+FormClassName+] ()
{
}
// Main routine of the [+FormClassName+] Form.
public override void open (Gtk.Builder builder)
{
}
}

View File

@ -0,0 +1,22 @@
[+ autogen5 template +]
[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
/* -*- Mode: vala; tab-width: 4; intend-tabs-mode: t -*- */
/*
* Copyright (C) [+(shell "date +%Y")+] [+Author+] <[+Email+]>
*
[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "Name") OWNER=(get "Author") \+]
*/
public class Vn.[+ClassName+] : Vn.Mod
{
public [+ClassName+] ()
{
}
// Main routine of the [+ClassName+] Module.
public override void activate ()
{
}
}

49
anjuta/hedera/translation Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
getopt -Q \
-o "hua:" \
-l "help,update,add:" \
-n "./translation" \
-- $@
case "$1" in
-u|--update|'')
cd ./po
intltool-update -r
cd ..
;;
-a|--add)
arg=$2
if [ -z $arg ]; then
exit 1;
elif [ ${#arg} -lt 2 ]; then
echo "./translation: language codes are at least two characters long." > /dev/stderr
exit 1;
fi
msginit -i po/*.pot -o po/$arg.po -l $arg.utf8
echo $arg >> po/LINGUAS
#sort po/LINGUAS -o po/LINGUAS
;;
-h|--help)
echo -e \
"Translation helper script.
Note that only the first option is used. If no option is
passed the '\033[1m-u\033[0m' option is used by default.
Options:
\033[1m-u, --update\033[0m
Update the currently existing translations and
the translations template. Also reports the current
status of the translations.
\033[1m-a, --add\033[0m \033[4mlang\033[0m
Add a new translation for the \033[4mlang\033[0m language
(using the gettext language and country codes), the
charset will automatically be set to UTF-8. You will
be asked to select your e-mail from a list.
\033[1m-h, --help\033[0m
Print this help text and exit."
;;
esac

View File

@ -102,6 +102,7 @@ AC_CONFIG_FILES([
docs/reference/Makefile
docs/reference/hedera/Makefile
po/Makefile.in
anjuta/Makefile
])
AC_SUBST([uVERSION], [${VERSION//./_}])

View File

@ -9,9 +9,9 @@ db_include_HEADERS = \
db-param.h \
db-request.h \
db-conn.h \
db-row.h \
db-result.h \
db-result-set.h \
db-row.h \
db-model.h \
db-model-holder.h \
db-file-loader.h \

View File

@ -637,7 +637,7 @@ void db_iterator_add_param (DbIterator * obj, DbParam * param)
* Return value: (transfer none): a #GvnParam
**/
GvnParam * db_iterator_get_param (DbIterator * obj, const gchar * column)
{
{
GList * n;
GvnParam * param;
@ -669,6 +669,8 @@ GvnParam * db_iterator_get_param (DbIterator * obj, const gchar * column)
**/
GList * db_iterator_get_params (DbIterator * obj)
{
g_return_val_if_fail (DB_IS_ITERATOR (obj), NULL);
return g_list_copy (obj->params);
}

View File

@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <gvn/gvn.h>
#include "db-model.h"
#include "db-row.h"
@ -928,7 +927,8 @@ static void db_model_post_process_query (DbModel * obj)
// TODO When parser gets fully functional, these 3 lines won't be needed,
// because obj>priv->stmt will be a parsed stmt:
gchar * rend = db_conn_render (obj->priv->conn, obj->priv->stmt, NULL);
SqlObject * stmt = sql_parser_parse (rend);
SqlObject * stmt = sql_parser_parse (rend, NULL);
//Uncomment to print de resulting stmt rendered:
/*gchar * rend2 = NULL;
if (stmt && (rend2 = db_conn_render (obj->priv->conn, stmt, NULL)))
g_message ("SQL + Parser + Render =\n %s", rend2);
@ -1999,7 +1999,8 @@ const GValue * db_model_get_value (DbModel * obj, DbIter * iter, gint col, GErro
* @iter: a #DbIter pointing to the row to be set
* @col: the column of the field to be set
* @value: new value for the field pointed to by @iter and @col
* @err: (out) (allow-none): a #GError or %NULL to ignore errors
* @err: (out) (allow-none): a return location for a #GError or %NULL to ignore
* errors
*
* Sets the value of a single field to @value on @obj as well as on the database.
* If the database update fails, the model is not updated and err is set

View File

@ -14,3 +14,15 @@ usr/share/gir-1.0
usr/share/glade/catalogs
usr/share/vala-0.20/vapi
usr/share/gtk-doc/html/hedera
usr/share/anjuta/templates
usr/share/anjuta/templates/hedera
usr/share/anjuta/templates/hedera/build/
usr/share/anjuta/templates/hedera/build/m4
usr/share/anjuta/templates/hedera/data
usr/share/anjuta/templates/hedera/debian
usr/share/anjuta/templates/hedera/debian/source
usr/share/anjuta/templates/hedera/po
usr/share/anjuta/templates/hedera/sql
usr/share/anjuta/templates/hedera/sql/mod
usr/share/anjuta/templates/hedera/src

View File

@ -26,3 +26,13 @@ usr/share/gir-1.0/*
usr/share/glade/catalogs/*
usr/share/vala-0.20/vapi/*
usr/share/gtk-doc/html/hedera/*
usr/share/anjuta/templates/*
usr/share/anjuta/templates/hedera/*
usr/share/anjuta/templates/hedera/build/m4/*
usr/share/anjuta/templates/hedera/data/*
usr/share/anjuta/templates/hedera/debian/*
usr/share/anjuta/templates/hedera/debian/source/*
usr/share/anjuta/templates/hedera/po/*
usr/share/anjuta/templates/hedera/sql/mod/*
usr/share/anjuta/templates/hedera/src/*

View File

@ -4,24 +4,55 @@
]>
<refentry id="first-tutorial">
<refmeta>
<refentrytitle>First Tutorial</refentrytitle>
<refentrytitle>First form</refentrytitle>
<manvolnum>0</manvolnum>
<refmiscinfo>Hedera Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>First simple tutorial</refname>
<refname>First form</refname>
<refpurpose>
A simple tutorial to get started
In this first tutorial you will learn how to create a simple
form
</refpurpose>
</refnamediv>
<refsection id="first-tutorial-intro">
<title>The first tutorial</title>
<refsection id="defining-form">
<title>Defining a form</title>
<para>
In this first tutorial you will learn how to create a simple
module with just one form using the Hedera library.
<!-- FIXME: add description of the XML DEFINITION of a form in the module file -->
</para>
</refsection>
<refsection id="form-files">
<title>Files needed to create a form</title>
<para>
The most basic form is made up of a class that inherits from Vn.Form
and a Gtk.Builder file, which defines the UI of the form. This UI
file is expected to use the ".galde" extension and named after the
form that will use it. This .glade file must
contain a toplevel Gtk.Box with the name "main", that will be
recognized by the library as the content of the Gtk.Notebook used by
the runtime and will be autamtically inserted in a page of that
notebook while opening the form, integrating as a part of the
application.
</para>
<para>
The .glade file for a form may also contain a Vn.Batch named
"models" which the library will recognize as a group of models used
by the form, and will set the application connection to these
automatically.
</para>
<para>
Additionally, the form can add menus to the main application
by adding a Gtk.ActionGroup named "actions" in the .glade file, and
using another file named also after the form, with the extension
".ui". This file will be used to define the strcuture of the menus
and will link the options to the actions defined in the previously
mentioned "actions" Gtk.ActionGroup.
</para>
<para>
There is also the possibility to define SQL files, to set and edit
the SQL queries apart from the other parts of the module.
</para>
<!-- FIXME: add sections to explain how these things are done -->
</refsection>
</refentry>

View File

@ -71,4 +71,7 @@
do some things that will be described here but are not written yet.
</para>
</refsection>
<refsection>
<!--FIXME add sections to explain the definition XML file and the .ui file -->
</refsection>
</refentry>

View File

@ -17,7 +17,8 @@ libgladevn_la_SOURCES = \
glade-vn.c \
glade-vn-batch.c \
glade-db-sql.c \
glade-db-model.c
glade-db-model.c \
glade-db-iterator.c
gladevn_data_DATA = vn.xml

279
glade/glade-db-iterator.c Normal file
View File

@ -0,0 +1,279 @@
/*
* Copyright (C) 2013 - 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 <http://www.gnu.org/licenses/>.
*/
#include "glade-vn.h"
#include <vn/glade/vn-iterator.h>
static void glade_db_iterator_on_name_changed (GladeProject * project,
GladeWidget * widget)
{
const gchar * new_name;
gchar * prefix, * old_name;
GList * n, * list;
if (G_OBJECT_TYPE (glade_widget_get_object (widget)) != VN_TYPE_ITERATOR)
return;
old_name = g_object_get_data (G_OBJECT (widget), "old-name");
prefix = g_strconcat (old_name, "-", NULL);
new_name = glade_widget_get_name (widget);
g_object_set_data_full (G_OBJECT (widget), "old-name",
g_strdup (new_name), (GDestroyNotify) g_free);
list = db_iterator_get_params (DB_ITERATOR (glade_widget_get_object (widget)));
for (n = list; n; n = n->next)
{
GladeWidget * param = glade_widget_get_from_gobject (G_OBJECT (n->data));
const gchar * child_name = glade_widget_get_name (param);
if (g_str_has_prefix (child_name, prefix))
{
glong offset = g_utf8_strlen (prefix, -1);
gchar * new_child_name = g_strconcat (new_name, "-", child_name + offset, NULL);
glade_project_set_widget_name (project, param, new_child_name);
g_free (new_child_name);
}
}
g_list_free (list);
g_free (prefix);
}
void glade_db_iterator_post_create (GladeWidgetAdaptor * adaptor,
DbIterator * iterator, GladeCreateReason * reason)
{
static gboolean connected = FALSE;
GladeWidget * widget = glade_widget_get_from_gobject (G_OBJECT (iterator));
GladeProject * project = glade_widget_get_project (widget);
g_object_set_data_full (G_OBJECT (widget), "old-name",
g_strdup (glade_widget_get_name (widget)), (GDestroyNotify) g_free);
if (!connected)
{
g_signal_connect (project, "widget-name-changed",
G_CALLBACK (glade_db_iterator_on_name_changed), NULL);
connected = TRUE;
}
}
static void glade_db_iterator_on_column_name_changed (GladeProperty * property,
GValue * old, GValue * new, GladeWidget * param)
{
const gchar * parent_name;
gchar * prefix;
GladeWidget * parent = glade_widget_get_parent (param);
if (!parent
|| G_OBJECT_TYPE (glade_widget_get_object (parent)) != VN_TYPE_ITERATOR)
return;
parent_name = glade_widget_get_name (parent);
prefix = g_strconcat (parent_name, "-", NULL);
if (g_str_has_prefix (glade_widget_get_name (param), prefix))
{
GladeProject * project = glade_widget_get_project (param);
gchar * new_name = g_strconcat (prefix, g_value_get_string (new), NULL);
glade_project_set_widget_name (project, param, new_name);
}
g_free (prefix);
}
void glade_db_iterator_add_child (GladeWidgetAdaptor * adaptor,
DbIterator * parent, DbParam * child)
{
gchar * new_name;
const gchar * param_name, * parent_name;
GladeWidget * param = glade_widget_get_from_gobject (G_OBJECT (child));
GladeProperty * name_prop = glade_widget_get_property (param, "column-name");
param_name = glade_widget_get_name (param);
parent_name = glade_widget_get_name (glade_widget_get_from_gobject (G_OBJECT (parent)));
new_name = g_strconcat (parent_name, "-",param_name, NULL);
glade_project_set_widget_name (glade_widget_get_project (param), param, new_name);
g_free (new_name);
g_signal_connect (name_prop, "value-changed",
G_CALLBACK (glade_db_iterator_on_column_name_changed), param);
db_iterator_add_param (parent, child);
}
void glade_db_iterator_remove_child (GladeWidgetAdaptor * adaptor,
DbIterator * parent, DbParam * child)
{
// db_iterator_remove_param (parent, child);
}
void glade_db_iterator_replace_child (GladeWidgetAdaptor * adaptor,
DbIterator * container, DbParam * current, DbParam * new)
{
glade_db_iterator_remove_child (adaptor, container, current);
glade_db_iterator_add_child (adaptor, container, new);
}
gboolean glade_db_iterator_add_verify (GladeWidgetAdaptor * adaptor,
DbIterator * container, DbParam * child, gboolean user_feedback)
{
if (DB_IS_PARAM (child))
return TRUE;
if (user_feedback)
{
GladeWidgetAdaptor * object_adaptor =
glade_widget_adaptor_get_by_type (DB_TYPE_PARAM);
glade_util_ui_message (glade_app_get_window ()
,GLADE_UI_INFO
,NULL
,"Only objects of type %s can be added to objects of type %s."
,glade_widget_adaptor_get_title (object_adaptor)
,glade_widget_adaptor_get_title (adaptor)
);
}
return FALSE;
}
GList * glade_db_iterator_get_children (GladeWidgetAdaptor * adaptor,
DbIterator * parent)
{
return db_iterator_get_params (parent);
}
static void glade_db_iterator_child_selected (GladeBaseEditor * editor,
GladeWidget * child, gpointer data)
{
glade_base_editor_add_label (editor, _("Parameter"));
glade_base_editor_add_default_properties (editor, child);
glade_base_editor_add_label (editor, _("Properties"));
glade_base_editor_add_editable (editor, child, GLADE_PAGE_GENERAL);
}
static gboolean glade_db_iterator_move_child (GladeBaseEditor * editor,
GladeWidget * parent, GladeWidget * child, gpointer data)
{
return FALSE;
}
static void glade_db_iterator_launch_editor (GObject * iterator)
{
GladeBaseEditor * editor;
GladeEditable * param_editor;
GtkWidget * window;
GladeWidget * widget = glade_widget_get_from_gobject (iterator);
GladeWidgetAdaptor * adaptor = glade_widget_get_adaptor (widget);
widget = glade_widget_get_toplevel (widget);
param_editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
editor = glade_base_editor_new (glade_widget_get_object (widget),
param_editor, _("Parameter"), DB_TYPE_PARAM, NULL);
g_signal_connect (editor, "child-selected", G_CALLBACK (glade_db_iterator_child_selected), NULL);
g_signal_connect (editor, "move-child", G_CALLBACK (glade_db_iterator_move_child), NULL);
gtk_widget_show (GTK_WIDGET (editor));
window = glade_base_editor_pack_new_window (editor, _("Iterator Editor"), NULL);
gtk_widget_show (window);
}
static void glade_db_iterator_generate_params (GladeWidget * iterator)
{
gboolean use_file = TRUE;
gchar * sql = NULL;
gchar * message = _("The model must have \"SQL\" set and \"Use file\" set to 'No'.");
const gchar * name = glade_widget_get_name (iterator);
SqlSelect * select;
GladeWidget * model_w;
DbModel * model = NULL;
GList * params = db_iterator_get_params (DB_ITERATOR (glade_widget_get_object (iterator)));
if (params)
{
glade_util_ui_message (glade_app_get_window (), GLADE_UI_INFO, NULL,
_("%s can't have children before automatic generation."), name);
g_list_free (params);
return;
}
g_list_free (params);
glade_widget_property_get (iterator, "model", &model, NULL);
if (!model)
{
glade_util_ui_message (glade_app_get_window (), GLADE_UI_INFO, NULL,
_("%s must have \"Model\" set. %s"), name, message);
return;
}
model_w = glade_widget_get_from_gobject (model);
glade_widget_property_get (model_w, "use-file", &use_file);
glade_widget_property_get (model_w, "sql", &sql);
if (use_file || !sql)
{
glade_util_ui_message (glade_app_get_window (), GLADE_UI_INFO, NULL, message);
return;
}
select = SQL_SELECT (sql_parser_parse (sql, NULL));
if (select && SQL_IS_SELECT (select))
{
//TODO Cambios cuando se use g_object_get (select, "fields", &fields, NULL)
GSList * l, * fields = select->expr;
GladeProject * project = glade_widget_get_project (iterator);
for (l = fields; l; l = l->next)
{
gchar * column_name;
gchar * param_name, * param_new_name = NULL;
GladeWidget * param;
param = glade_command_create (glade_widget_adaptor_get_by_type (DB_TYPE_PARAM),
iterator, NULL, project);
column_name = sql_select_get_column_name (select, SQL_EXPR (l->data));
param_name = g_strconcat (name, "-"
,column_name ? column_name : "param"
,NULL);
if (!glade_project_available_widget_name (project, param, param_name))
param_new_name = glade_project_new_widget_name (project, param, param_name);
glade_project_set_widget_name (project, param, param_new_name ? param_new_name : param_name);
glade_widget_property_set (param, "column-name", column_name);
g_free (column_name);
g_free (param_new_name);
g_free (param_name);
}
}
}
void glade_db_iterator_action_activate (GladeWidgetAdaptor * adaptor,
GObject * object, const gchar * action_path)
{
if (!g_strcmp0 (action_path, "launch-editor"))
glade_db_iterator_launch_editor (object);
else if (!g_strcmp0 (action_path, "generate-params"))
glade_db_iterator_generate_params (glade_widget_get_from_gobject (object));
}

View File

@ -41,11 +41,8 @@ GLADE_MAKE_EPROP (GladeEPropModel, glade_eprop_model)
static void glade_eprop_model_name_changed (GladeProject * project,
GladeWidget * widget, GladeEPropModel * obj)
{
if (widget && obj->widget)
{
gtk_entry_set_text (GTK_ENTRY (obj->entry),
glade_widget_get_name (widget));
}
if (widget == obj->widget)
gtk_entry_set_text (GTK_ENTRY (obj->entry), glade_widget_get_name (widget));
}
static GladeWidget * glade_model_create (GladeProperty * prop)
@ -74,8 +71,13 @@ static GladeWidget * glade_model_create (GladeProperty * prop)
}
if (!use)
{
batch_w = glade_command_create
(glade_widget_adaptor_get_by_type (VN_TYPE_BATCH), NULL, NULL, project);
glade_widget_set_name (batch_w,
glade_project_new_widget_name (project, batch_w, "models"));
}
else
batch_w = glade_widget_get_from_gobject (batch);

View File

@ -32,8 +32,8 @@ gboolean glade_vn_batch_add_verify (GladeWidgetAdaptor * adaptor,
,GLADE_UI_INFO
,NULL
,"Only objects of type %s can be added to objects of type %s."
,glade_widget_adaptor_get_title (object_adaptor)
,glade_widget_adaptor_get_title (adaptor)
,glade_widget_adaptor_get_name (object_adaptor)
,glade_widget_adaptor_get_name (adaptor)
);
}

View File

@ -6,7 +6,7 @@
<glade-widget-classes>
<glade-widget-class name="GvnParam" generic-name="param" toplevel="True" title="Parameter" icon-name="widget-gtk-action">
<glade-widget-class name="GvnParam" generic-name="param" title="Parameter" icon-name="widget-gtk-action">
<properties>
<property id="null" ignore="True"/>
<property id="editable" ignore="True"/>
@ -21,14 +21,14 @@
<property save="False" weight="1.3" id="sql" ignore="True"/>
</properties>
<actions>
<action stock="gtk-edit" important="True" id="launch_editor" name="Edit&#8230;"/>
<action important="True" id="launch_editor" name="Edit&#8230;" stock="gtk-edit"/>
</actions>
<action-activate-function>glade_db_model_action_activate</action-activate-function>
<create-editor-property-function>glade_db_sql_create_eprop</create-editor-property-function>
<write-widget-function>glade_db_model_write_widget</write-widget-function>
</glade-widget-class>
<glade-widget-class name="DbIterator" generic-name="iterator" title="Iterator" icon-name="widget-gtk-texttagtable">
<glade-widget-class name="VnIterator" generic-name="iterator" title="Iterator" icon-name="widget-gtk-texttagtable">
<properties>
<property id="model" ignore="True">
<parameter-spec>
@ -38,12 +38,24 @@
</property>
</properties>
<create-editor-property-function>glade_db_model_holder_create_eprop</create-editor-property-function>
<actions>
<action important="True" id="launch-editor" name="Edit&#8230;" stock="gtk-edit"/>
<action important="True" id="generate-params" name="Generate params" icon-name="system-run"/>
</actions>
<action-activate-function>glade_db_iterator_action_activate</action-activate-function>
<post-create-function>glade_db_iterator_post_create</post-create-function>
<add-child-verify-function>glade_db_iterator_add_verify</add-child-verify-function>
<add-child-function>glade_db_iterator_add_child</add-child-function>
<remove-child-function>glade_db_iterator_remove_child</remove-child-function>
<replace-child-function>glade_db_iterator_replace_child</replace-child-function>
<get-children-function>glade_db_iterator_get_children</get-children-function>
</glade-widget-class>
<glade-widget-class name="DbParam" generic-name="param" toplevel="True" title="Iterator Parameter" icon-name="widget-gtk-texttag">
<glade-widget-class name="DbParam" generic-name="param" title="Iterator Parameter" icon-name="widget-gtk-texttag">
<properties>
<property id="iterator" ignore="True"/>
<property id="column" ignore="True"/>
<property id="iterator" disabled="True"/>
<property id="column-name" ignore="True"/>
<property id="column-index" ignore="True"/>
</properties>
</glade-widget-class>
@ -63,10 +75,13 @@
<glade-widget-class name="VnColumnCheck" generic-name="column-check" title="Column Check" icon-name="widget-gtk-cellrenderertoggle"/>
<glade-widget-class name="VnColumnEntry" generic-name="column-entry" title="Column Entry" icon-name="widget-gtk-cellrenderertext"/>
<glade-widget-class name="VnColumnSpin" generic-name="column-Spin" title="Column Spin" icon-name="widget-gtk-cellrendererspin">
<glade-widget-class name="VnColumnSpin" generic-name="column-spin" title="Column Spin" icon-name="widget-gtk-cellrendererspin">
<properties>
<property id="digits" ignore="True" disabled="True"/>
<property id="climb-rate" ignore="True" disabled="True"/>
<property id="digits" ignore="True"/>
<property id="climb-rate" ignore="True"/>
<property id="lower" ignore="True"/>
<property id="uppder" ignore="True"/>
<property id="step-increment" ignore="True"/>
</properties>
</glade-widget-class>
@ -144,8 +159,8 @@
<add-child-verify-function>glade_vn_batch_add_verify</add-child-verify-function>
<add-child-function>glade_vn_batch_add_child</add-child-function>
<remove-child-function>glade_vn_batch_remove_child</remove-child-function>
<get-children-function>glade_vn_batch_get_children</get-children-function>
<replace-child-function>glade_vn_batch_replace_child</replace-child-function>
<get-children-function>glade_vn_batch_get_children</get-children-function>
</glade-widget-class>
</glade-widget-classes>
@ -153,7 +168,7 @@
<glade-widget-group name="db-toplevels" title="Data Handling">
<glade-widget-class-ref name="GvnParam"/>
<glade-widget-class-ref name="DbModel"/>
<glade-widget-class-ref name="DbIterator"/>
<glade-widget-class-ref name="VnIterator"/>
<glade-widget-class-ref name="DbParam"/>
<glade-widget-class-ref name="DbFileLoader"/>
</glade-widget-group>

View File

@ -3,12 +3,8 @@
<!-- interface-requires vn 0.0 -->
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-local-resource-path ../image -->
<object class="DbIterator" id="homes">
<property name="sql">SELECT id, street, pc, city, province, ok FROM user_address WHERE #p ORDER BY id</property>
</object>
<object class="DbIterator" id="info">
<property name="sql">SELECT id, name, credit, active, born, photo, object_id FROM "user" ORDER BY id</property>
</object>
<object class="DbIterator" id="homes"/>
<object class="DbIterator" id="info"/>
<object class="GtkBox" id="main">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -56,7 +52,6 @@
<object class="VnCompletion" id="searcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="sql">SELECT id, #p FROM article WHERE #p</property>
<property name="field">name</property>
</object>
<packing>
@ -170,7 +165,6 @@
<property name="can_focus">False</property>
<property name="iterator">info</property>
<property name="column_name">object_id</property>
<property name="sql">SELECT id, object FROM object</property>
</object>
<packing>
<property name="left_attach">1</property>

View File

@ -113,32 +113,54 @@ 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_BYTES)
if (type == G_TYPE_INT || type == G_TYPE_UINT
|| type == G_TYPE_FLOAT || type == G_TYPE_DOUBLE)
col_type = VN_TYPE_COLUMN_SPIN;
else if (type == G_TYPE_BYTES)
col_type = VN_TYPE_COLUMN_IMAGE;
else if (type == G_TYPE_BOOLEAN)
col_type = VN_TYPE_COLUMN_CHECK;
else
if (type == G_TYPE_STRING
&& !g_strcmp0 (db_model_get_column_name (model, i), "image"))
{
image = TRUE;
col_type = VN_TYPE_COLUMN_IMAGE;
}
else
col_type = VN_TYPE_COLUMN_ENTRY;
if (i == 7)
col_type = VN_TYPE_COLUMN_IMAGE;
column = vn_grid_append_column (obj->grid, i
,db_model_get_column_name (model, i)
,col_type
,TRUE, FALSE
);
if (i == 7)
g_object_set (column,
if (type == G_TYPE_INT)
g_object_set (column,
"lower", (gdouble)G_MININT,
"upper", (gdouble)G_MAXINT,
NULL);
else if (type == G_TYPE_UINT)
g_object_set (column,
"upper", (gdouble)G_MAXUINT,
NULL);
else if (type == G_TYPE_FLOAT || type == G_TYPE_DOUBLE)
g_object_set (column,
"digits", 2,
"lower", 0.0,
"upper", 1000.0,
"step-increment", 0.1,
// "editable", FALSE,
NULL);
else if (image)
g_object_set (column,
"host", "www.verdnatura.es",
"path", "image/cache/catalog/icon",
"tooltip-path", "../full",
NULL);
if (type == G_TYPE_FLOAT || type == G_TYPE_DOUBLE)
g_object_set (column, "digits", 3, NULL);
}
break;
@ -167,7 +189,7 @@ void vn_consulter_mode_toggled (GtkToggleButton * mode, VnConsulter * obj)
void vn_consulter_send (GtkButton * button, VnConsulter * obj)
{
DbIterator * iterator;
DbModel * model;
DbModel * model;
gchar * sql;
sql = gtk_combo_box_text_get_active_text (obj->combo);
@ -221,6 +243,8 @@ 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"
,NULL
};
@ -233,11 +257,24 @@ static void vn_consulter_open (VnConsulter * obj)
gtk_entry_set_placeholder_text (vn_form_get (form, "combo-entry"),
_("Type or select a query"));
gtk_tree_view_insert_column_with_attributes (obj->tv, -1, "Mensaje",
gtk_tree_view_insert_column_with_attributes (obj->tv, -1, _("Message"),
gtk_cell_renderer_text_new (), "text", 0, NULL);
for (i = 0; i < g_strv_length (queries); i++)
gtk_combo_box_text_prepend_text (obj->combo, queries[i]);
// XXX+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TEST VnIterator
/*
DbIterator * test_iterator = vn_form_get (form, "test-iterator");
GList * n, * params = db_iterator_get_params (test_iterator);
g_message ("DbIterator at %p",test_iterator);
for (n = params; n; n = n->next)
{
gpointer ptr;
g_object_get (n->data, "iterator", &ptr, NULL);
g_message ("DbParam %s from DbIterator at %p.",db_param_get_column_name (DB_PARAM (n->data)), ptr);
}
*/
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class

View File

@ -45,8 +45,9 @@ vn/gui/main.glade
vn/gui/child-window.glade
vn/gui/actions.glade
glade/glade-db-model.c
glade/glade-db-sql.c
glade/glade-db-model.c
glade/glade-db-iterator.c
[type: gettext/glade]module/data/example.xml
module/data/users.glade

219
po/ca.po
View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: hedera 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-18 16:11+0100\n"
"POT-Creation-Date: 2013-12-13 10:07+0100\n"
"PO-Revision-Date: 2013-06-04 13:38+0200\n"
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
"Language-Team: Catalan\n"
@ -132,7 +132,7 @@ msgstr ""
msgid "The master GvnParam of this parameter"
msgstr ""
#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:985
#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:987
msgid "Mode"
msgstr ""
@ -213,7 +213,7 @@ msgstr ""
msgid "The value"
msgstr ""
#: ../sql/sql-string.c:198 ../db/db-model.c:3455 ../db/db-request.c:461
#: ../sql/sql-string.c:198 ../db/db-model.c:3456 ../db/db-request.c:461
msgid "SQL"
msgstr ""
@ -226,73 +226,73 @@ msgstr ""
msgid "Can't allocate the needed memory"
msgstr ""
#: ../db/db-iterator.c:986
#: ../db/db-iterator.c:988
msgid "The mode in which the iterator is working"
msgstr ""
#: ../db/db-iterator.c:993
#: ../db/db-iterator.c:995
#, fuzzy
msgid "Remember selection"
msgstr "Recordar"
#: ../db/db-iterator.c:994
#: ../db/db-iterator.c:996
msgid "Wether to rememeber the selection when model is refreshed"
msgstr ""
#: ../db/db-model.c:3429 ../db/db-request.c:454 ../vn/vn-gui.c:1554
#: ../db/db-model.c:3430 ../db/db-request.c:454 ../vn/vn-gui.c:1564
#: ../vn/vn-form.c:244
msgid "Connection"
msgstr ""
#: ../db/db-model.c:3430
#: ../db/db-model.c:3431
msgid "The DbConn that manages the connection to the database"
msgstr ""
#: ../db/db-model.c:3437 ../db/db-request.c:468
#: ../db/db-model.c:3438 ../db/db-request.c:468
msgid "Statement"
msgstr ""
#: ../db/db-model.c:3438
#: ../db/db-model.c:3439
msgid "The statement which retrieves the data"
msgstr ""
#: ../db/db-model.c:3445
#: ../db/db-model.c:3446
msgid "Use file"
msgstr ""
#: ../db/db-model.c:3446
#: ../db/db-model.c:3447
msgid ""
"If this is set to TRUE, the \"sql\" property will hold the name of a file "
"containing a query, if set to FALSE, \"sql\" is used as an SQL string"
msgstr ""
#: ../db/db-model.c:3456
#: ../db/db-model.c:3457
msgid ""
"Depending on the \"use-file\" property this will be the path to a file with "
"queries for the model or a SQL string"
msgstr ""
#: ../db/db-model.c:3465
#: ../db/db-model.c:3466
msgid "Main Table"
msgstr ""
#: ../db/db-model.c:3466
#: ../db/db-model.c:3467
msgid "The main table of the model"
msgstr ""
#: ../db/db-model.c:3473
#: ../db/db-model.c:3474
msgid "Update flags"
msgstr ""
#: ../db/db-model.c:3474
#: ../db/db-model.c:3475
msgid "The flags that indicate how a model can be modified"
msgstr ""
#: ../db/db-model.c:3482
#: ../db/db-model.c:3483
msgid "Result position"
msgstr ""
#: ../db/db-model.c:3483
#: ../db/db-model.c:3484
msgid ""
"The position where the query that will fill the model will be placed in a "
"multi-query"
@ -386,44 +386,44 @@ msgstr ""
msgid "The query is empty."
msgstr ""
#: ../db/db-conn.c:1037
#: ../db/db-conn.c:1041
msgid "Plugin"
msgstr ""
#: ../db/db-conn.c:1038
#: ../db/db-conn.c:1042
msgid "The name of the plugin"
msgstr ""
#: ../db/db-conn.c:1044
#: ../db/db-conn.c:1048
msgid "Query path"
msgstr ""
#: ../db/db-conn.c:1045
#: ../db/db-conn.c:1049
msgid "The path where query files are located"
msgstr ""
#: ../db/db-conn.c:1051 ../db/db-file-loader.c:715
#: ../db/db-conn.c:1055 ../db/db-file-loader.c:715
#: ../vn/column/vn-column-image.c:493
msgid "Host"
msgstr ""
#: ../db/db-conn.c:1052
#: ../db/db-conn.c:1056
msgid "The host name to connect to"
msgstr ""
#: ../db/db-conn.c:1058 ../module/data/users.glade.h:2
#: ../db/db-conn.c:1062 ../module/data/users.glade.h:2
msgid "User"
msgstr "Usuari"
#: ../db/db-conn.c:1059
#: ../db/db-conn.c:1063
msgid "The user name"
msgstr "Nom d'usuari"
#: ../db/db-conn.c:1065
#: ../db/db-conn.c:1069
msgid "DB name"
msgstr ""
#: ../db/db-conn.c:1066
#: ../db/db-conn.c:1070
msgid "The default schema"
msgstr ""
@ -500,59 +500,59 @@ msgstr ""
msgid "The maximal size for the contents of the cache directory"
msgstr ""
#: ../vn/vn-gui.c:643
#: ../vn/vn-gui.c:642
msgid "Connection has been lost. Do you want to reconnect?"
msgstr ""
#: ../vn/vn-gui.c:650
#: ../vn/vn-gui.c:649
msgid "An error occurred in the connection."
msgstr ""
#: ../vn/vn-gui.c:653
#: ../vn/vn-gui.c:652
msgid "Database error"
msgstr ""
#: ../vn/vn-gui.c:660
#: ../vn/vn-gui.c:659
msgid "Unknown error"
msgstr ""
#: ../vn/vn-gui.c:1000
#: ../vn/vn-gui.c:999
msgid "Closing connection"
msgstr ""
#: ../vn/vn-gui.c:1002
#: ../vn/vn-gui.c:1001
msgid "Transaction started"
msgstr ""
#: ../vn/vn-gui.c:1004
#: ../vn/vn-gui.c:1003
msgid "Connecting"
msgstr ""
#: ../vn/vn-gui.c:1006
#: ../vn/vn-gui.c:1005
msgid "Connection lost"
msgstr ""
#: ../vn/vn-gui.c:1008
#: ../vn/vn-gui.c:1007
msgid "Connection closed"
msgstr ""
#: ../vn/vn-gui.c:1010 ../vn/field/vn-http-image.c:116
#: ../vn/vn-gui.c:1009 ../vn/field/vn-http-image.c:116
msgid "Loading"
msgstr ""
#: ../vn/vn-gui.c:1012 ../vn/gui/main.glade.h:19
#: ../vn/vn-gui.c:1011 ../vn/gui/main.glade.h:19
msgid "Ready"
msgstr ""
#: ../vn/vn-gui.c:1555
#: ../vn/vn-gui.c:1565
msgid "The connection used by Gui"
msgstr ""
#: ../vn/vn-gui.c:1561
#: ../vn/vn-gui.c:1571
msgid "Application"
msgstr ""
#: ../vn/vn-gui.c:1562
#: ../vn/vn-gui.c:1572
msgid "The application handler for the entire program"
msgstr ""
@ -679,7 +679,8 @@ msgstr ""
msgid "The current value of the field"
msgstr ""
#: ../vn/vn-field.c:525
#: ../vn/vn-field.c:525 ../glade/glade-db-iterator.c:164
#: ../glade/glade-db-iterator.c:187
msgid "Parameter"
msgstr ""
@ -704,12 +705,12 @@ 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:138
#: ../vn/column/vn-column-entry.c:119 ../vn/column/vn-column-spin.c:179
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:139
#: ../vn/column/vn-column-entry.c:120 ../vn/column/vn-column-spin.c:180
msgid "The number of decimal places to display."
msgstr ""
@ -804,14 +805,38 @@ msgstr ""
msgid "Order in which the tab selects the columns for edition"
msgstr ""
#: ../vn/column/vn-column-spin.c:130
#: ../vn/column/vn-column-spin.c:171
msgid "Climb rate"
msgstr ""
#: ../vn/column/vn-column-spin.c:131
#: ../vn/column/vn-column-spin.c:172
msgid "The acceleration rate when you hold down a button."
msgstr ""
#: ../vn/column/vn-column-spin.c:187
msgid "Minimum value"
msgstr ""
#: ../vn/column/vn-column-spin.c:188
msgid "The minimum value of the adjustment."
msgstr ""
#: ../vn/column/vn-column-spin.c:195
msgid "Maximum value"
msgstr ""
#: ../vn/column/vn-column-spin.c:196
msgid "The maximum value of the adjustment."
msgstr ""
#: ../vn/column/vn-column-spin.c:203
msgid "Step Increment"
msgstr ""
#: ../vn/column/vn-column-spin.c:204
msgid "The step increment of the adjustment"
msgstr ""
#: ../vn/column/vn-column-combo.c:340
msgid "Sort column"
msgstr ""
@ -942,71 +967,51 @@ msgid "_Quit"
msgstr ""
#: ../vn/gui/actions.glade.h:4
msgid "_About"
msgid "Quit"
msgstr ""
#: ../vn/gui/actions.glade.h:5
msgid "_File"
msgid "_About"
msgstr ""
#: ../vn/gui/actions.glade.h:6
msgid "_Help"
msgid "_File"
msgstr ""
#: ../vn/gui/actions.glade.h:7
msgid "_Reconnect"
msgid "_Help"
msgstr ""
#: ../vn/gui/actions.glade.h:8
msgid "Reconnect"
msgid "_Reconnect"
msgstr ""
#: ../vn/gui/actions.glade.h:9
msgid "_Close"
msgid "Reconnect"
msgstr ""
#: ../vn/gui/actions.glade.h:10
msgid "_View"
msgid "_Close"
msgstr ""
#: ../vn/gui/actions.glade.h:11
msgid "_View"
msgstr ""
#: ../vn/gui/actions.glade.h:12
msgctxt "View menu option"
msgid "Dynamic _Tabs"
msgstr ""
#: ../vn/gui/actions.glade.h:12
#: ../vn/gui/actions.glade.h:13
msgid "Don't show tabs if there is only one tab open"
msgstr ""
#: ../vn/gui/actions.glade.h:13
#: ../vn/gui/actions.glade.h:14
msgctxt "View menu option"
msgid "Tool_bar"
msgstr ""
#: ../glade/glade-db-model.c:121
msgid "Create and set a model for a DbModelHolder"
msgstr ""
#: ../glade/glade-db-model.c:153
msgid "Model configuration"
msgstr ""
#: ../glade/glade-db-model.c:153
msgid "DbModel properties configuration"
msgstr ""
#: ../glade/glade-db-model.c:238
msgid "Select a DbModel for the property"
msgstr ""
#: ../glade/glade-db-model.c:259 ../glade/glade-db-model.c:306
msgid "New Model"
msgstr ""
#: ../glade/glade-db-model.c:301
msgid "Edit Model"
msgstr ""
#: ../glade/glade-db-sql.c:27
msgid "New SQL statement"
msgstr ""
@ -1019,6 +1024,52 @@ msgstr ""
msgid "Open the SQL Editor"
msgstr ""
#: ../glade/glade-db-model.c:123
msgid "Create and set a model for a DbModelHolder"
msgstr ""
#: ../glade/glade-db-model.c:155
msgid "Model configuration"
msgstr ""
#: ../glade/glade-db-model.c:155
msgid "DbModel properties configuration"
msgstr ""
#: ../glade/glade-db-model.c:240
msgid "Select a DbModel for the property"
msgstr ""
#: ../glade/glade-db-model.c:261 ../glade/glade-db-model.c:308
msgid "New Model"
msgstr ""
#: ../glade/glade-db-model.c:303
msgid "Edit Model"
msgstr ""
#: ../glade/glade-db-iterator.c:166
msgid "Properties"
msgstr ""
#: ../glade/glade-db-iterator.c:193
msgid "Iterator Editor"
msgstr ""
#: ../glade/glade-db-iterator.c:201
msgid "The model must have \"SQL\" set and \"Use file\" set to 'No'."
msgstr ""
#: ../glade/glade-db-iterator.c:212
#, c-format
msgid "%s can't have children before automatic generation."
msgstr ""
#: ../glade/glade-db-iterator.c:223
#, c-format
msgid "%s must have \"Model\" set. %s"
msgstr ""
#: ../module/data/example.xml.h:1
msgid "Example"
msgstr ""
@ -1188,10 +1239,14 @@ msgstr ""
msgid "∞"
msgstr ""
#: ../module/src/vn-consulter.c:234
#: ../module/src/vn-consulter.c:258
msgid "Type or select a query"
msgstr ""
#: ../module/src/vn-consulter.c:260
msgid "Message"
msgstr ""
#, fuzzy
#~ msgid "User name:"
#~ msgstr "Nom d'usuari"

222
po/es.po
View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: hedera 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-18 16:11+0100\n"
"POT-Creation-Date: 2013-12-13 10:07+0100\n"
"PO-Revision-Date: 2013-06-04 13:36+0200\n"
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
"Language-Team: Spanish\n"
@ -134,7 +134,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:985
#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:987
msgid "Mode"
msgstr "Modo"
@ -215,7 +215,7 @@ msgstr "El parametro al cual está vinculado"
msgid "The value"
msgstr "Valor"
#: ../sql/sql-string.c:198 ../db/db-model.c:3455 ../db/db-request.c:461
#: ../sql/sql-string.c:198 ../db/db-model.c:3456 ../db/db-request.c:461
msgid "SQL"
msgstr "SQL"
@ -228,41 +228,41 @@ msgstr "Una cadena SQL arbitraria"
msgid "Can't allocate the needed memory"
msgstr "No es posible asignar la memoria necesaria"
#: ../db/db-iterator.c:986
#: ../db/db-iterator.c:988
msgid "The mode in which the iterator is working"
msgstr "El modo en el que está trabajando el Iterator"
#: ../db/db-iterator.c:993
#: ../db/db-iterator.c:995
msgid "Remember selection"
msgstr "Recordar fila seleccionada"
#: ../db/db-iterator.c:994
#: ../db/db-iterator.c:996
msgid "Wether to rememeber the selection when model is refreshed"
msgstr ""
"Si se recordará o no la fila seleccionado cuando se refresque el modelo"
#: ../db/db-model.c:3429 ../db/db-request.c:454 ../vn/vn-gui.c:1554
#: ../db/db-model.c:3430 ../db/db-request.c:454 ../vn/vn-gui.c:1564
#: ../vn/vn-form.c:244
msgid "Connection"
msgstr "Conexión"
#: ../db/db-model.c:3430
#: ../db/db-model.c:3431
msgid "The DbConn that manages the connection to the database"
msgstr "La DbConn que controla la conexión a la base de datos"
#: ../db/db-model.c:3437 ../db/db-request.c:468
#: ../db/db-model.c:3438 ../db/db-request.c:468
msgid "Statement"
msgstr "Consulta"
#: ../db/db-model.c:3438
#: ../db/db-model.c:3439
msgid "The statement which retrieves the data"
msgstr "La consulta que recupera los datos"
#: ../db/db-model.c:3445
#: ../db/db-model.c:3446
msgid "Use file"
msgstr "Usa fichero"
#: ../db/db-model.c:3446
#: ../db/db-model.c:3447
msgid ""
"If this is set to TRUE, the \"sql\" property will hold the name of a file "
"containing a query, if set to FALSE, \"sql\" is used as an SQL string"
@ -270,7 +270,7 @@ msgstr ""
"Si es TRUE, la propiedad \"sql\" contiene el nombre de un archivo, si es "
"falso, \"sql\" se usa como una cadena SQL"
#: ../db/db-model.c:3456
#: ../db/db-model.c:3457
msgid ""
"Depending on the \"use-file\" property this will be the path to a file with "
"queries for the model or a SQL string"
@ -278,27 +278,27 @@ msgstr ""
"Dependiendo de la propiedad \"use-file\", esta propiedad será la ruta a un "
"fichero con consultas para el modelo o una cadena SQL"
#: ../db/db-model.c:3465
#: ../db/db-model.c:3466
msgid "Main Table"
msgstr "Tabla principal"
#: ../db/db-model.c:3466
#: ../db/db-model.c:3467
msgid "The main table of the model"
msgstr "La tabla principal del modelo"
#: ../db/db-model.c:3473
#: ../db/db-model.c:3474
msgid "Update flags"
msgstr "Flags de actualización"
#: ../db/db-model.c:3474
#: ../db/db-model.c:3475
msgid "The flags that indicate how a model can be modified"
msgstr "Indican como se puede modificar el modelo"
#: ../db/db-model.c:3482
#: ../db/db-model.c:3483
msgid "Result position"
msgstr "Posición del resultado"
#: ../db/db-model.c:3483
#: ../db/db-model.c:3484
msgid ""
"The position where the query that will fill the model will be placed in a "
"multi-query"
@ -396,44 +396,44 @@ msgstr "No se puede abrir una nueva conexión, ya está abierta"
msgid "The query is empty."
msgstr "La consulta está vacía."
#: ../db/db-conn.c:1037
#: ../db/db-conn.c:1041
msgid "Plugin"
msgstr "Plugin"
#: ../db/db-conn.c:1038
#: ../db/db-conn.c:1042
msgid "The name of the plugin"
msgstr "El nombre del plugin"
#: ../db/db-conn.c:1044
#: ../db/db-conn.c:1048
msgid "Query path"
msgstr "Ruta de consultas"
#: ../db/db-conn.c:1045
#: ../db/db-conn.c:1049
msgid "The path where query files are located"
msgstr "La ruta donde se encuentran los archivos de consultas"
#: ../db/db-conn.c:1051 ../db/db-file-loader.c:715
#: ../db/db-conn.c:1055 ../db/db-file-loader.c:715
#: ../vn/column/vn-column-image.c:493
msgid "Host"
msgstr "Host"
#: ../db/db-conn.c:1052
#: ../db/db-conn.c:1056
msgid "The host name to connect to"
msgstr "El nombre del host al que se conectará"
#: ../db/db-conn.c:1058 ../module/data/users.glade.h:2
#: ../db/db-conn.c:1062 ../module/data/users.glade.h:2
msgid "User"
msgstr "Usuario"
#: ../db/db-conn.c:1059
#: ../db/db-conn.c:1063
msgid "The user name"
msgstr "El nombre de usuario"
#: ../db/db-conn.c:1065
#: ../db/db-conn.c:1069
msgid "DB name"
msgstr "Nombre de la BD"
#: ../db/db-conn.c:1066
#: ../db/db-conn.c:1070
msgid "The default schema"
msgstr "El esquema por defecto"
@ -512,59 +512,59 @@ msgstr "Tamaño máximo de la caché"
msgid "The maximal size for the contents of the cache directory"
msgstr "El tamaño máximo para los contenidos del directorio de caché"
#: ../vn/vn-gui.c:643
#: ../vn/vn-gui.c:642
msgid "Connection has been lost. Do you want to reconnect?"
msgstr "Se ha perdido la conexión. ¿Quieres reconectar?"
#: ../vn/vn-gui.c:650
#: ../vn/vn-gui.c:649
msgid "An error occurred in the connection."
msgstr "Ha habido un error en la conexión."
#: ../vn/vn-gui.c:653
#: ../vn/vn-gui.c:652
msgid "Database error"
msgstr "Error en la base de datos"
#: ../vn/vn-gui.c:660
#: ../vn/vn-gui.c:659
msgid "Unknown error"
msgstr "Error desconocido"
#: ../vn/vn-gui.c:1000
#: ../vn/vn-gui.c:999
msgid "Closing connection"
msgstr "Cerrando conexión"
#: ../vn/vn-gui.c:1002
#: ../vn/vn-gui.c:1001
msgid "Transaction started"
msgstr "Transacción iniciada"
#: ../vn/vn-gui.c:1004
#: ../vn/vn-gui.c:1003
msgid "Connecting"
msgstr "Conectando"
#: ../vn/vn-gui.c:1006
#: ../vn/vn-gui.c:1005
msgid "Connection lost"
msgstr "Conexión perdida"
#: ../vn/vn-gui.c:1008
#: ../vn/vn-gui.c:1007
msgid "Connection closed"
msgstr "Conexión cerrada"
#: ../vn/vn-gui.c:1010 ../vn/field/vn-http-image.c:116
#: ../vn/vn-gui.c:1009 ../vn/field/vn-http-image.c:116
msgid "Loading"
msgstr "Cargando"
#: ../vn/vn-gui.c:1012 ../vn/gui/main.glade.h:19
#: ../vn/vn-gui.c:1011 ../vn/gui/main.glade.h:19
msgid "Ready"
msgstr "Listo"
#: ../vn/vn-gui.c:1555
#: ../vn/vn-gui.c:1565
msgid "The connection used by Gui"
msgstr "La conexión empleada por Gui"
#: ../vn/vn-gui.c:1561
#: ../vn/vn-gui.c:1571
msgid "Application"
msgstr "Aplicación"
#: ../vn/vn-gui.c:1562
#: ../vn/vn-gui.c:1572
msgid "The application handler for the entire program"
msgstr "El manejador de la aplicación para todo el programa"
@ -691,7 +691,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
#: ../vn/vn-field.c:525 ../glade/glade-db-iterator.c:164
#: ../glade/glade-db-iterator.c:187
msgid "Parameter"
msgstr "Parámetro"
@ -716,12 +717,12 @@ 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:138
#: ../vn/column/vn-column-entry.c:119 ../vn/column/vn-column-spin.c:179
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:139
#: ../vn/column/vn-column-entry.c:120 ../vn/column/vn-column-spin.c:180
msgid "The number of decimal places to display."
msgstr "El número de posiciones decimales que se muestran"
@ -816,14 +817,38 @@ 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:130
#: ../vn/column/vn-column-spin.c:171
msgid "Climb rate"
msgstr "Tasa de subida"
#: ../vn/column/vn-column-spin.c:131
#: ../vn/column/vn-column-spin.c:172
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:187
msgid "Minimum value"
msgstr "Valor mínimo"
#: ../vn/column/vn-column-spin.c:188
msgid "The minimum value of the adjustment."
msgstr "Valor mínimo del ajuste."
#: ../vn/column/vn-column-spin.c:195
msgid "Maximum value"
msgstr "Valor máximo"
#: ../vn/column/vn-column-spin.c:196
msgid "The maximum value of the adjustment."
msgstr "Valor máximo del ajuste"
#: ../vn/column/vn-column-spin.c:203
msgid "Step Increment"
msgstr "Incremento del paso"
#: ../vn/column/vn-column-spin.c:204
msgid "The step increment of the adjustment"
msgstr "El incremento del paso del ajuste"
#: ../vn/column/vn-column-combo.c:340
msgid "Sort column"
msgstr "Columna de ordenación"
@ -974,71 +999,51 @@ msgid "_Quit"
msgstr "_Salir"
#: ../vn/gui/actions.glade.h:4
msgid "Quit"
msgstr "Salir"
#: ../vn/gui/actions.glade.h:5
msgid "_About"
msgstr "_Acerca de"
#: ../vn/gui/actions.glade.h:5
#: ../vn/gui/actions.glade.h:6
msgid "_File"
msgstr "_Archivo"
#: ../vn/gui/actions.glade.h:6
#: ../vn/gui/actions.glade.h:7
msgid "_Help"
msgstr "Ay_uda"
#: ../vn/gui/actions.glade.h:7
#: ../vn/gui/actions.glade.h:8
msgid "_Reconnect"
msgstr "_Reconectar"
#: ../vn/gui/actions.glade.h:8
#: ../vn/gui/actions.glade.h:9
msgid "Reconnect"
msgstr "Reconectar"
#: ../vn/gui/actions.glade.h:9
#: ../vn/gui/actions.glade.h:10
msgid "_Close"
msgstr "_Cerrar"
#: ../vn/gui/actions.glade.h:10
#: ../vn/gui/actions.glade.h:11
msgid "_View"
msgstr "_Ver"
#: ../vn/gui/actions.glade.h:11
#: ../vn/gui/actions.glade.h:12
msgctxt "View menu option"
msgid "Dynamic _Tabs"
msgstr "_Pestañas dinámicas"
#: ../vn/gui/actions.glade.h:12
#: ../vn/gui/actions.glade.h:13
msgid "Don't show tabs if there is only one tab open"
msgstr "No mostrar las pestañas si solo hay una abierta"
#: ../vn/gui/actions.glade.h:13
#: ../vn/gui/actions.glade.h:14
msgctxt "View menu option"
msgid "Tool_bar"
msgstr "_Barra de herramientas"
#: ../glade/glade-db-model.c:121
msgid "Create and set a model for a DbModelHolder"
msgstr "Crear y configurar un modelo para un DbModelHolder"
#: ../glade/glade-db-model.c:153
msgid "Model configuration"
msgstr "Configuración del Model"
#: ../glade/glade-db-model.c:153
msgid "DbModel properties configuration"
msgstr "Configuración de propiedades de DbModelo"
#: ../glade/glade-db-model.c:238
msgid "Select a DbModel for the property"
msgstr "Selecciona un DbModel para la propiedad"
#: ../glade/glade-db-model.c:259 ../glade/glade-db-model.c:306
msgid "New Model"
msgstr "Nuevo Modelo"
#: ../glade/glade-db-model.c:301
msgid "Edit Model"
msgstr "Editar Modelo"
#: ../glade/glade-db-sql.c:27
msgid "New SQL statement"
msgstr "Nueva consulta SQL"
@ -1051,6 +1056,52 @@ msgstr "Editor SQL"
msgid "Open the SQL Editor"
msgstr "Abrir el Editor SQL"
#: ../glade/glade-db-model.c:123
msgid "Create and set a model for a DbModelHolder"
msgstr "Crear y configurar un modelo para un DbModelHolder"
#: ../glade/glade-db-model.c:155
msgid "Model configuration"
msgstr "Configuración del Model"
#: ../glade/glade-db-model.c:155
msgid "DbModel properties configuration"
msgstr "Configuración de propiedades de DbModelo"
#: ../glade/glade-db-model.c:240
msgid "Select a DbModel for the property"
msgstr "Selecciona un DbModel para la propiedad"
#: ../glade/glade-db-model.c:261 ../glade/glade-db-model.c:308
msgid "New Model"
msgstr "Nuevo Modelo"
#: ../glade/glade-db-model.c:303
msgid "Edit Model"
msgstr "Editar Modelo"
#: ../glade/glade-db-iterator.c:166
msgid "Properties"
msgstr "Propiedades"
#: ../glade/glade-db-iterator.c:193
msgid "Iterator Editor"
msgstr "Editor del Iterator"
#: ../glade/glade-db-iterator.c:201
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:212
#, 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:223
#, c-format
msgid "%s must have \"Model\" set. %s"
msgstr "%s debe tener \"Modelo\" asignado. %s"
#: ../module/data/example.xml.h:1
msgid "Example"
msgstr "Ejemplo"
@ -1231,6 +1282,13 @@ msgstr "Deshacer"
msgid "∞"
msgstr "∞"
#: ../module/src/vn-consulter.c:234
#: ../module/src/vn-consulter.c:258
msgid "Type or select a query"
msgstr "Escribe o selecciona la consulta"
#: ../module/src/vn-consulter.c:260
msgid "Message"
msgstr "Mensaje"
#~ msgid "Generate params for %s"
#~ msgstr "Generar params para %s"

219
po/nl.po
View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: hedera 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-11-18 16:11+0100\n"
"POT-Creation-Date: 2013-12-13 10:07+0100\n"
"PO-Revision-Date: 2012-10-09 11:38+0200\n"
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
"Language-Team: Dutch\n"
@ -134,7 +134,7 @@ msgstr ""
msgid "The master GvnParam of this parameter"
msgstr ""
#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:985
#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:987
msgid "Mode"
msgstr ""
@ -215,7 +215,7 @@ msgstr ""
msgid "The value"
msgstr ""
#: ../sql/sql-string.c:198 ../db/db-model.c:3455 ../db/db-request.c:461
#: ../sql/sql-string.c:198 ../db/db-model.c:3456 ../db/db-request.c:461
msgid "SQL"
msgstr ""
@ -228,72 +228,72 @@ msgstr ""
msgid "Can't allocate the needed memory"
msgstr ""
#: ../db/db-iterator.c:986
#: ../db/db-iterator.c:988
msgid "The mode in which the iterator is working"
msgstr ""
#: ../db/db-iterator.c:993
#: ../db/db-iterator.c:995
msgid "Remember selection"
msgstr ""
#: ../db/db-iterator.c:994
#: ../db/db-iterator.c:996
msgid "Wether to rememeber the selection when model is refreshed"
msgstr ""
#: ../db/db-model.c:3429 ../db/db-request.c:454 ../vn/vn-gui.c:1554
#: ../db/db-model.c:3430 ../db/db-request.c:454 ../vn/vn-gui.c:1564
#: ../vn/vn-form.c:244
msgid "Connection"
msgstr ""
#: ../db/db-model.c:3430
#: ../db/db-model.c:3431
msgid "The DbConn that manages the connection to the database"
msgstr ""
#: ../db/db-model.c:3437 ../db/db-request.c:468
#: ../db/db-model.c:3438 ../db/db-request.c:468
msgid "Statement"
msgstr ""
#: ../db/db-model.c:3438
#: ../db/db-model.c:3439
msgid "The statement which retrieves the data"
msgstr ""
#: ../db/db-model.c:3445
#: ../db/db-model.c:3446
msgid "Use file"
msgstr ""
#: ../db/db-model.c:3446
#: ../db/db-model.c:3447
msgid ""
"If this is set to TRUE, the \"sql\" property will hold the name of a file "
"containing a query, if set to FALSE, \"sql\" is used as an SQL string"
msgstr ""
#: ../db/db-model.c:3456
#: ../db/db-model.c:3457
msgid ""
"Depending on the \"use-file\" property this will be the path to a file with "
"queries for the model or a SQL string"
msgstr ""
#: ../db/db-model.c:3465
#: ../db/db-model.c:3466
msgid "Main Table"
msgstr ""
#: ../db/db-model.c:3466
#: ../db/db-model.c:3467
msgid "The main table of the model"
msgstr ""
#: ../db/db-model.c:3473
#: ../db/db-model.c:3474
msgid "Update flags"
msgstr ""
#: ../db/db-model.c:3474
#: ../db/db-model.c:3475
msgid "The flags that indicate how a model can be modified"
msgstr ""
#: ../db/db-model.c:3482
#: ../db/db-model.c:3483
msgid "Result position"
msgstr ""
#: ../db/db-model.c:3483
#: ../db/db-model.c:3484
msgid ""
"The position where the query that will fill the model will be placed in a "
"multi-query"
@ -387,44 +387,44 @@ msgstr ""
msgid "The query is empty."
msgstr ""
#: ../db/db-conn.c:1037
#: ../db/db-conn.c:1041
msgid "Plugin"
msgstr ""
#: ../db/db-conn.c:1038
#: ../db/db-conn.c:1042
msgid "The name of the plugin"
msgstr ""
#: ../db/db-conn.c:1044
#: ../db/db-conn.c:1048
msgid "Query path"
msgstr ""
#: ../db/db-conn.c:1045
#: ../db/db-conn.c:1049
msgid "The path where query files are located"
msgstr ""
#: ../db/db-conn.c:1051 ../db/db-file-loader.c:715
#: ../db/db-conn.c:1055 ../db/db-file-loader.c:715
#: ../vn/column/vn-column-image.c:493
msgid "Host"
msgstr ""
#: ../db/db-conn.c:1052
#: ../db/db-conn.c:1056
msgid "The host name to connect to"
msgstr ""
#: ../db/db-conn.c:1058 ../module/data/users.glade.h:2
#: ../db/db-conn.c:1062 ../module/data/users.glade.h:2
msgid "User"
msgstr ""
#: ../db/db-conn.c:1059
#: ../db/db-conn.c:1063
msgid "The user name"
msgstr ""
#: ../db/db-conn.c:1065
#: ../db/db-conn.c:1069
msgid "DB name"
msgstr ""
#: ../db/db-conn.c:1066
#: ../db/db-conn.c:1070
msgid "The default schema"
msgstr ""
@ -501,59 +501,59 @@ msgstr ""
msgid "The maximal size for the contents of the cache directory"
msgstr ""
#: ../vn/vn-gui.c:643
#: ../vn/vn-gui.c:642
msgid "Connection has been lost. Do you want to reconnect?"
msgstr ""
#: ../vn/vn-gui.c:650
#: ../vn/vn-gui.c:649
msgid "An error occurred in the connection."
msgstr ""
#: ../vn/vn-gui.c:653
#: ../vn/vn-gui.c:652
msgid "Database error"
msgstr ""
#: ../vn/vn-gui.c:660
#: ../vn/vn-gui.c:659
msgid "Unknown error"
msgstr ""
#: ../vn/vn-gui.c:1000
#: ../vn/vn-gui.c:999
msgid "Closing connection"
msgstr ""
#: ../vn/vn-gui.c:1002
#: ../vn/vn-gui.c:1001
msgid "Transaction started"
msgstr ""
#: ../vn/vn-gui.c:1004
#: ../vn/vn-gui.c:1003
msgid "Connecting"
msgstr ""
#: ../vn/vn-gui.c:1006
#: ../vn/vn-gui.c:1005
msgid "Connection lost"
msgstr ""
#: ../vn/vn-gui.c:1008
#: ../vn/vn-gui.c:1007
msgid "Connection closed"
msgstr ""
#: ../vn/vn-gui.c:1010 ../vn/field/vn-http-image.c:116
#: ../vn/vn-gui.c:1009 ../vn/field/vn-http-image.c:116
msgid "Loading"
msgstr ""
#: ../vn/vn-gui.c:1012 ../vn/gui/main.glade.h:19
#: ../vn/vn-gui.c:1011 ../vn/gui/main.glade.h:19
msgid "Ready"
msgstr ""
#: ../vn/vn-gui.c:1555
#: ../vn/vn-gui.c:1565
msgid "The connection used by Gui"
msgstr ""
#: ../vn/vn-gui.c:1561
#: ../vn/vn-gui.c:1571
msgid "Application"
msgstr ""
#: ../vn/vn-gui.c:1562
#: ../vn/vn-gui.c:1572
msgid "The application handler for the entire program"
msgstr ""
@ -680,7 +680,8 @@ msgstr ""
msgid "The current value of the field"
msgstr ""
#: ../vn/vn-field.c:525
#: ../vn/vn-field.c:525 ../glade/glade-db-iterator.c:164
#: ../glade/glade-db-iterator.c:187
msgid "Parameter"
msgstr ""
@ -705,12 +706,12 @@ 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:138
#: ../vn/column/vn-column-entry.c:119 ../vn/column/vn-column-spin.c:179
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:139
#: ../vn/column/vn-column-entry.c:120 ../vn/column/vn-column-spin.c:180
msgid "The number of decimal places to display."
msgstr ""
@ -805,14 +806,38 @@ msgstr ""
msgid "Order in which the tab selects the columns for edition"
msgstr ""
#: ../vn/column/vn-column-spin.c:130
#: ../vn/column/vn-column-spin.c:171
msgid "Climb rate"
msgstr ""
#: ../vn/column/vn-column-spin.c:131
#: ../vn/column/vn-column-spin.c:172
msgid "The acceleration rate when you hold down a button."
msgstr ""
#: ../vn/column/vn-column-spin.c:187
msgid "Minimum value"
msgstr ""
#: ../vn/column/vn-column-spin.c:188
msgid "The minimum value of the adjustment."
msgstr ""
#: ../vn/column/vn-column-spin.c:195
msgid "Maximum value"
msgstr ""
#: ../vn/column/vn-column-spin.c:196
msgid "The maximum value of the adjustment."
msgstr ""
#: ../vn/column/vn-column-spin.c:203
msgid "Step Increment"
msgstr ""
#: ../vn/column/vn-column-spin.c:204
msgid "The step increment of the adjustment"
msgstr ""
#: ../vn/column/vn-column-combo.c:340
msgid "Sort column"
msgstr ""
@ -942,71 +967,51 @@ msgid "_Quit"
msgstr ""
#: ../vn/gui/actions.glade.h:4
msgid "_About"
msgid "Quit"
msgstr ""
#: ../vn/gui/actions.glade.h:5
msgid "_File"
msgid "_About"
msgstr ""
#: ../vn/gui/actions.glade.h:6
msgid "_Help"
msgid "_File"
msgstr ""
#: ../vn/gui/actions.glade.h:7
msgid "_Reconnect"
msgid "_Help"
msgstr ""
#: ../vn/gui/actions.glade.h:8
msgid "Reconnect"
msgid "_Reconnect"
msgstr ""
#: ../vn/gui/actions.glade.h:9
msgid "_Close"
msgid "Reconnect"
msgstr ""
#: ../vn/gui/actions.glade.h:10
msgid "_View"
msgid "_Close"
msgstr ""
#: ../vn/gui/actions.glade.h:11
msgid "_View"
msgstr ""
#: ../vn/gui/actions.glade.h:12
msgctxt "View menu option"
msgid "Dynamic _Tabs"
msgstr ""
#: ../vn/gui/actions.glade.h:12
#: ../vn/gui/actions.glade.h:13
msgid "Don't show tabs if there is only one tab open"
msgstr ""
#: ../vn/gui/actions.glade.h:13
#: ../vn/gui/actions.glade.h:14
msgctxt "View menu option"
msgid "Tool_bar"
msgstr ""
#: ../glade/glade-db-model.c:121
msgid "Create and set a model for a DbModelHolder"
msgstr ""
#: ../glade/glade-db-model.c:153
msgid "Model configuration"
msgstr ""
#: ../glade/glade-db-model.c:153
msgid "DbModel properties configuration"
msgstr ""
#: ../glade/glade-db-model.c:238
msgid "Select a DbModel for the property"
msgstr ""
#: ../glade/glade-db-model.c:259 ../glade/glade-db-model.c:306
msgid "New Model"
msgstr ""
#: ../glade/glade-db-model.c:301
msgid "Edit Model"
msgstr ""
#: ../glade/glade-db-sql.c:27
msgid "New SQL statement"
msgstr ""
@ -1019,6 +1024,52 @@ msgstr ""
msgid "Open the SQL Editor"
msgstr ""
#: ../glade/glade-db-model.c:123
msgid "Create and set a model for a DbModelHolder"
msgstr ""
#: ../glade/glade-db-model.c:155
msgid "Model configuration"
msgstr ""
#: ../glade/glade-db-model.c:155
msgid "DbModel properties configuration"
msgstr ""
#: ../glade/glade-db-model.c:240
msgid "Select a DbModel for the property"
msgstr ""
#: ../glade/glade-db-model.c:261 ../glade/glade-db-model.c:308
msgid "New Model"
msgstr ""
#: ../glade/glade-db-model.c:303
msgid "Edit Model"
msgstr ""
#: ../glade/glade-db-iterator.c:166
msgid "Properties"
msgstr ""
#: ../glade/glade-db-iterator.c:193
msgid "Iterator Editor"
msgstr ""
#: ../glade/glade-db-iterator.c:201
msgid "The model must have \"SQL\" set and \"Use file\" set to 'No'."
msgstr ""
#: ../glade/glade-db-iterator.c:212
#, c-format
msgid "%s can't have children before automatic generation."
msgstr ""
#: ../glade/glade-db-iterator.c:223
#, c-format
msgid "%s must have \"Model\" set. %s"
msgstr ""
#: ../module/data/example.xml.h:1
msgid "Example"
msgstr ""
@ -1187,6 +1238,10 @@ msgstr ""
msgid "∞"
msgstr ""
#: ../module/src/vn-consulter.c:234
#: ../module/src/vn-consulter.c:258
msgid "Type or select a query"
msgstr ""
#: ../module/src/vn-consulter.c:260
msgid "Message"
msgstr ""

View File

@ -27,9 +27,18 @@ typedef struct
SqlObject * object;
gchar * string;
gchar * current;
gboolean error;
gboolean failed;
GError ** error;
}
ParseState;
typedef enum
{
SQL_PARSER_ERROR_EMPTY_QUERY = 1 << 0,
SQL_PARSER_ERROR_PARSING = 1 << 1,
SQL_PARSER_ERROR_STACK_OVERFLOW = 1 << 2,
}
SqlParserError;
}
%token_type { gchar * }
@ -51,17 +60,16 @@ ParseState;
pref = err_str == state->string ? " near: " : " near: [...]";
}
g_log (g_quark_to_string (SQL_PARSER_LOG_DOMAIN), G_LOG_LEVEL_WARNING,
g_set_error (state->error, SQL_PARSER_LOG_DOMAIN, SQL_PARSER_ERROR_PARSING,
"Parsing error%s%s", pref, err_str);
state->error = TRUE;
state->failed = TRUE;
}
%stack_overflow
{
g_log (g_quark_to_string (SQL_PARSER_LOG_DOMAIN)
,G_LOG_LEVEL_WARNING
,"Parser stack overflow. Parsing terminated.\n");
g_set_error (state->error, SQL_PARSER_LOG_DOMAIN, SQL_PARSER_ERROR_STACK_OVERFLOW,
"Parser stack overflow. Parsing terminated.\n");
state->failed = TRUE;
}
%parse_accept {}

View File

@ -218,25 +218,28 @@ static gchar * get_token (const gchar * ts, const gchar * te)
}%%
%% write data;
SqlObject * sql_parser_parse (gchar * sql)
SqlObject * sql_parser_parse (const gchar * sql, GError ** err)
{
gint cs, act;
gchar * p, * pe, * ts, * te;
gpointer eof, parser;
ParseState * state;
SqlObject * object;
gchar * query;
if (!sql)
{
g_log (g_quark_to_string (SQL_PARSER_LOG_DOMAIN)
,G_LOG_LEVEL_WARNING ,"Empty query!\n");
g_set_error (err, SQL_PARSER_LOG_DOMAIN,
SQL_PARSER_ERROR_EMPTY_QUERY, "Empty query!\n");
return NULL;
}
query = g_strdup (sql);
state = g_new (ParseState, 1);
state->object = NULL;
state->error = FALSE;
state->string = state->current = p = sql;
state->error = err;
state->string = state->current = p = query;
pe = p + strlen (p) + 1;
eof = pe;
@ -248,7 +251,7 @@ SqlObject * sql_parser_parse (gchar * sql)
Parse (parser, 0, 0, state);
ParseFree (parser, g_free);
if (state->error)
if (state->failed)
{
if (state->object && G_IS_OBJECT (state->object))
g_object_unref (state->object);
@ -258,6 +261,7 @@ SqlObject * sql_parser_parse (gchar * sql)
object = g_object_ref_sink (state->object);
g_free (state);
g_free (query);
return object;
}

View File

@ -24,12 +24,14 @@
/**
* sql_parser_parse:
* @sql: An string containing an SQL query.
* @sql: An string containing an SQL query
* @err: (out) (allow-none): a return location of a #GError or %NULL to ignore
* errors
*
* Parses @sql and makes an #SqlObject from the query on it.
*
* Return value: (transfer full): an #SqlObject.
* Return value: (transfer full): an #SqlObject
*/
SqlObject * sql_parser_parse (gchar * sql) G_GNUC_WARN_UNUSED_RESULT;
SqlObject * sql_parser_parse (const gchar * sql, GError ** err) G_GNUC_WARN_UNUSED_RESULT;
#endif

View File

@ -16,6 +16,7 @@
*/
#include "sql-select.h"
#include "sql-field.h"
/**
* SECTION: sql-select
@ -150,6 +151,44 @@ void sql_select_set_alias (SqlSelect * obj, SqlExpr * expr, const gchar * alias)
}
}
/*
* Return the alias of a field and if it's an unaliased SqlField, its name,
* otherwise returns NULL (uses include of sql-field.h)
*/
gchar * sql_select_get_column_name (SqlSelect * obj, SqlExpr * expr)
{
gboolean listed = FALSE;
GSList * n;
g_return_val_if_fail (SQL_IS_SELECT (obj), NULL);
g_return_val_if_fail (SQL_IS_EXPR (expr), NULL);
for (n = obj->expr; n; n = n->next)
if (expr == n->data)
{
listed = TRUE;
break;
}
if (listed)
for (n = obj->alias; n; n = n->next)
{
SqlSelectAlias * as = n->data;
if (expr == as->expr)
return g_strdup (as->alias);
}
if (SQL_IS_FIELD (expr))
{
gchar * name;
g_object_get (expr, "name", &name, NULL);
return name;
}
return NULL;
}
void sql_select_add_group (SqlSelect * obj, SqlExpr * expr)
{
g_return_if_fail (SQL_IS_SELECT (obj));

View File

@ -83,6 +83,7 @@ SqlSelect * sql_select_new ();
void sql_select_set_distinct (SqlSelect * obj, gboolean distinct);
void sql_select_add_expr (SqlSelect * obj, SqlExpr * expr);
void sql_select_set_alias (SqlSelect * obj, SqlExpr * expr, const gchar * alias);
gchar * sql_select_get_column_name (SqlSelect * obj, SqlExpr * expr);
void sql_select_add_group (SqlSelect * obj, SqlExpr * expr);
void sql_select_set_having (SqlSelect * obj, SqlExpr * expr);
void sql_select_add_order (SqlSelect * obj, SqlExpr * expr, SqlOrderWay way);

View File

@ -1,11 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@/hedera
includedir=@includedir@/hedera
libdir=@libdir@/@PACKAGE@
includedir=@includedir@/@PACKAGE@
Name: Sql
Description: Sql Classes Module for Hedera Library
Version: @VERSION@
Requires: gvn glib-2.0 gobject-2.0
Libs: -L${libdir} -lsql
Cflags: -I${includedir}/sql
Requires: gvn
Libs: -lsql

View File

@ -42,7 +42,9 @@ libvn_la_SOURCES = \
vn-model.c \
vn-grid.c \
vn-handler.c \
vn-batch.c
vn-batch.c \
$(top_srcdir)/vn/glade/vn-iterator.h \
$(top_srcdir)/vn/glade/vn-iterator.c
pkgconfig_DATA = vn.pc

View File

@ -19,15 +19,32 @@
G_DEFINE_TYPE (VnColumnSpin, vn_column_spin, VN_TYPE_COLUMN);
static void vn_column_entry_cb_edited (GtkCellRendererText * cell,
static void vn_column_spin_on_edited (GtkCellRendererSpin * cell,
const gchar * path, gchar * text, VnColumnSpin * obj)
{
GValue value = {0};
if (g_strcmp0 (text, ""))
{
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, 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);
if (val < min)
val = min;
else if (val > max)
val = max;
g_value_init (&value, G_TYPE_DOUBLE);
g_value_set_double (&value, val);
g_object_set (obj->adjustment, "value", val, NULL);
}
else
return;
}
else
g_value_init (&value, GVN_TYPE_NULL);
@ -42,15 +59,22 @@ static void vn_column_spin_set_editable (VnColumn * obj, gboolean editable)
if (editable)
g_signal_connect (obj->cell, "edited",
G_CALLBACK (vn_column_entry_cb_edited), obj);
G_CALLBACK (vn_column_spin_on_edited), obj);
else
g_signal_handlers_disconnect_by_func (obj->cell,
vn_column_entry_cb_edited, obj);
vn_column_spin_on_edited, obj);
}
static void vn_column_spin_set_value (VnColumnSpin * obj, GtkTreeModel * model,
GtkTreeIter * iter, GtkCellRenderer * cell, const GValue * value)
GtkTreeIter * iter, GObject * cell, const GValue * value)
{
gint digits;
GValue new_value = {0};
g_object_get (cell, "digits", &digits, NULL);
gvn_value_to_format_string (value, digits, &new_value);
g_object_set_property (cell, "text", &new_value);
g_value_unset (&new_value);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
@ -59,7 +83,9 @@ enum
{
PROP_CLIMB_RATE = 1
,PROP_DIGITS
,PROP_VALUE_TYPE
,PROP_LOWER
,PROP_UPPER
,PROP_STEP
};
static void vn_column_spin_set_property (VnColumnSpin * obj, guint id,
@ -68,37 +94,49 @@ static void vn_column_spin_set_property (VnColumnSpin * obj, guint id,
switch (id)
{
case PROP_CLIMB_RATE:
g_object_set (VN_COLUMN (obj)->cell,
"climb-rate", g_value_get_double (value), NULL);
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);
g_object_set (VN_COLUMN (obj)->cell, "digits", g_value_get_uint (value), NULL);
break;
case PROP_LOWER:
g_object_set (obj->adjustment, "lower", g_value_get_double (value), NULL);
break;
case PROP_UPPER:
g_object_set (obj->adjustment, "upper", g_value_get_double (value), NULL);
break;
case PROP_STEP:
g_object_set (obj->adjustment,
"step-increment", g_value_get_double (value),
"page-increment", g_value_get_double (value) * 10,
NULL);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
}
}
static void vn_column_spin_get_property (VnColumnSpin * obj, guint id,
GValue * value, GParamSpec * pspec)
{
switch (id)
{
case PROP_CLIMB_RATE:
{
gdouble climb_rate;
g_object_get (value, "climb-rate", &climb_rate, NULL);
g_value_set_double (value, climb_rate);
g_object_get_property (G_OBJECT (VN_COLUMN (obj)->cell), "climb-rate", value);
break;
}
case PROP_DIGITS:
{
guint digits;
g_object_get (VN_COLUMN (obj)->cell, "digits", &digits, NULL);
g_value_set_uint (value, digits);
g_object_get_property (G_OBJECT (VN_COLUMN (obj)->cell), "digits", value);
break;
}
default:
case PROP_LOWER:
g_object_get_property (G_OBJECT (obj->adjustment), "lower", value);
break;
case PROP_UPPER:
g_object_get_property (G_OBJECT (obj->adjustment), "upper", value);
break;
case PROP_STEP:
g_object_get_property (G_OBJECT (obj->adjustment), "step-increment", value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
}
}
@ -106,8 +144,11 @@ static void vn_column_spin_get_property (VnColumnSpin * obj, guint id,
static void vn_column_spin_init (VnColumnSpin * obj)
{
GtkCellRenderer * cell = gtk_cell_renderer_spin_new ();
VN_COLUMN_GET_CLASS (obj)->set_renderer (VN_COLUMN (obj), cell);
//??g_object_bind_property (obj, "digits", VN_COLUMN (obj)->cell, "digits");
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);
VN_COLUMN_GET_CLASS (obj)->set_renderer (VN_COLUMN (obj), cell);
}
static void vn_column_spin_finalize (VnColumnSpin * obj)
@ -129,7 +170,7 @@ static void vn_column_spin_class_init (VnColumnSpinClass * klass)
g_param_spec_double ("climb-rate"
,_("Climb rate")
,_("The acceleration rate when you hold down a button.")
,0 ,0 ,0
,0.0 ,G_MAXDOUBLE ,0.0
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
));
@ -140,4 +181,28 @@ static void vn_column_spin_class_init (VnColumnSpinClass * klass)
,0 ,20 ,0
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
));
g_object_class_install_property (k, PROP_LOWER,
g_param_spec_double ("lower"
,_("Minimum value")
,_("The minimum value of the adjustment.")
,-G_MAXDOUBLE ,G_MAXDOUBLE ,0.0
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
));
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 , G_MAXDOUBLE
,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")
,0.00000000000000000001 ,10000000000.0 ,1.0
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
));
}

View File

@ -33,6 +33,7 @@ typedef struct _VnColumnSpinClass VnColumnSpinClass;
struct _VnColumnSpin
{
VnColumn parent;
GtkAdjustment * adjustment;
};
struct _VnColumnSpinClass

53
vn/glade/vn-iterator.c Normal file
View File

@ -0,0 +1,53 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "vn-iterator.h"
//+++++++++++++++++++++++++++++++++++++++++++++++++++ GtkBuildable
static void vn_iterator_buildable_add_child (GtkBuildable * obj,
GtkBuilder * builder, GObject * child, const gchar * type)
{
db_iterator_add_param (DB_ITERATOR (obj), DB_PARAM (child));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
static void vn_iterator_finalize (VnIterator * obj)
{
GObjectClass * parent = g_type_class_peek_parent (VN_ITERATOR_GET_CLASS (obj));
parent->finalize (G_OBJECT (obj));
}
static void vn_iterator_class_init (VnIteratorClass * klass)
{
GObjectClass * k = G_OBJECT_CLASS (klass);
k->finalize = (GObjectFinalizeFunc) vn_iterator_finalize;
}
static void vn_iterator_buildable_interface_init (GtkBuildableIface * iface)
{
iface->add_child = vn_iterator_buildable_add_child;
}
static void vn_iterator_init (VnIterator * obj)
{}
G_DEFINE_TYPE_WITH_CODE (VnIterator, vn_iterator, DB_TYPE_ITERATOR,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
vn_iterator_buildable_interface_init)
);

46
vn/glade/vn-iterator.h Normal file
View File

@ -0,0 +1,46 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef VN_ITERATOR_H
#define VN_ITERATOR_H
#include <db/db.h>
#include <gtk/gtk.h>
#define VN_TYPE_ITERATOR (vn_iterator_get_type ())
#define VN_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, VN_TYPE_ITERATOR, VnIterator))
#define VN_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, VN_TYPE_ITERATOR))
#define VN_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, VN_TYPE_ITERATOR, VnIteratorClass))
#define VN_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass, VN_TYPE_ITERATOR))
#define VN_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, VN_TYPE_ITERATOR, VnIteratorClass))
typedef struct _VnIterator VnIterator;
typedef struct _VnIteratorClass VnIteratorClass;
struct _VnIterator
{
DbIterator iterator;
};
struct _VnIteratorClass
{
DbIteratorClass parent;
};
GType vn_iterator_get_type ();
#endif

View File

@ -15,7 +15,8 @@
<child>
<object class="GtkAction" id="exit">
<property name="label" translatable="yes">_Quit</property>
<property name="icon_name">application-exit</property>
<property name="tooltip" translatable="yes">Quit</property>
<property name="icon_name">window-close</property>
<signal name="activate" handler="vn_gui_on_exit_activated" swapped="no"/>
</object>
<accelerator key="q" modifiers="GDK_CONTROL_MASK"/>

View File

@ -24,5 +24,9 @@
<toolitem name="Logout" action="logout"/>
<separator/>
<placeholder name="ModuleTools"/>
<!--
<separator expand="true"/>
<toolitem name="Close" action="close-tab"/>
-->
</toolbar>
</ui>

View File

@ -62,7 +62,9 @@ void vn_batch_remove (VnBatch * obj, GObject * child)
* vn_batch_get_objects_list:
* @obj: a #VnBatch
*
* Returns all the #GObject<!-- -->s in @obj, copying the list.
* Returns all the #GObject<!-- -->s in @obj, copying the list. This method is
* mainly for internal use, use vn_batch_get_objects() instead if you don't need
* to do further use of the list of objects.
*
* Return value: (transfer container) (element-type GObject): a #GList with all
* the objects, that must be freed with #g_list_free
@ -121,8 +123,7 @@ static void vn_batch_init (VnBatch * obj)
static void vn_batch_finalize (VnBatch * obj)
{
GObjectClass * parent;
parent = g_type_class_peek_parent (VN_BATCH_GET_CLASS (obj));
GObjectClass * parent = g_type_class_peek_parent (VN_BATCH_GET_CLASS (obj));
g_list_free (obj->objects);

View File

@ -53,6 +53,7 @@ struct _VnWindow
GtkToggleAction * dynamic_tabs;
GtkToggleAction * view_toolbar;
guint merge_id;
gboolean maximized;
};
typedef struct
@ -234,6 +235,7 @@ static void vn_gui_load_module (VnGui * obj, const gchar * dir, const gchar * fi
{
gint n;
gchar * mod_title_strip, * mod_name;
const gchar * text_dom = NULL;
GModule * module = NULL;
VnMod * mod = NULL;
GdomeException e;
@ -340,7 +342,6 @@ static void vn_gui_load_module (VnGui * obj, const gchar * dir, const gchar * fi
GdomeDOMString * accel;
GdomeDOMString * title;
gchar * symbol_name;
const gchar * text_dom;
GtkTreeIter parent_iter;
GtkTreeIter * iter;
VnFormGetTypeFunc mod_get_type_func;
@ -460,7 +461,7 @@ static void vn_gui_load_module (VnGui * obj, const gchar * dir, const gchar * fi
node = gdome_el_firstChild (el, &e);
title = gdome_n_nodeValue (node, &e);
title_strip = g_strstrip (g_strdup (title->str));
title_strip = g_strstrip (g_strdup (g_dgettext (text_dom, title->str)));
gdome_el_unref (el, &e);
gdome_n_unref (node, &e);
@ -532,7 +533,6 @@ static VnWindow * vn_gui_add_window (VnGui * obj, GtkWindow * widget, GtkNoteboo
obj->windows = g_slist_prepend (obj->windows, window);
gtk_application_add_window (obj->app, widget);
gtk_notebook_set_group_name (notebook,
g_application_get_application_id (G_APPLICATION (obj->app)));
@ -572,7 +572,6 @@ static VnWindow * vn_gui_add_window (VnGui * obj, GtkWindow * widget, GtkNoteboo
GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
gtk_window_add_accel_group (widget,
gtk_ui_manager_get_accel_group (window->manager));
window->toolbar = toolbar;
}
else
@ -704,7 +703,7 @@ static gboolean vn_gui_reconnect_idle (GuiData * gui_data)
}
/*
* Thread function that tryes to reopen the connection asynchronously.
* Thread function that tries to reopen the connection asynchronously.
*/
static void vn_gui_reconnect_thread (GuiData * gui_data)
{
@ -1076,6 +1075,7 @@ void vn_gui_open (VnGui * obj)
gsize len;
gint x, y;
gint width, height;
gboolean maximized;
gchar ** windows;
gchar ** forms;
VnWindow * window;
@ -1088,6 +1088,7 @@ void vn_gui_open (VnGui * obj)
y = g_key_file_get_integer (config, windows[m], "y", NULL);
width = g_key_file_get_integer (config, windows[m], "width", NULL);
height = g_key_file_get_integer (config, windows[m], "height", NULL);
maximized = g_key_file_get_boolean (config, windows[m], "maximized", NULL);
if (g_key_file_get_boolean (config, windows[m], "main", NULL))
{
@ -1098,7 +1099,10 @@ void vn_gui_open (VnGui * obj)
window = vn_gui_create_window (obj, x, y);
gtk_window_resize (window->widget, width, height);
if (maximized)
gtk_window_maximize (window->widget);
forms = g_key_file_get_string_list (config,
windows[m], "forms", NULL, NULL);
@ -1145,6 +1149,8 @@ void vn_gui_save (VnGui * obj)
GList * nb_pages, * n;
VnWindow * window;
gint x, y, width, height;
GdkWindow * win;
gboolean maximized;
GKeyFile * config;
g_return_if_fail (VN_IS_GUI (obj));
@ -1169,6 +1175,11 @@ void vn_gui_save (VnGui * obj)
g_key_file_set_integer (config, group, "width", width);
g_key_file_set_integer (config, group, "height", height);
g_object_get (window->widget, "window", &win, NULL);
maximized = (gdk_window_get_state (win) & GDK_WINDOW_STATE_MAXIMIZED);
g_object_unref (win);
g_key_file_set_boolean (config, group, "maximized", maximized);
// Saving the forms opened at window
if (window == obj->main_window)

View File

@ -98,7 +98,13 @@ static void vn_mod_set_property (VnMod * obj, guint id,
{
case PROP_NAME:
obj->priv->name = g_value_dup_string (value);
obj->priv->text_domain = g_strdup_printf ("hedera-%s", obj->priv->name);
//XXX Remove when the "example" mod gets removed from the project
if (g_strcmp0 (obj->priv->name, "example"))
obj->priv->text_domain = g_strdup_printf ("%s-%s", GETTEXT_PACKAGE, obj->priv->name);
else
obj->priv->text_domain = g_strdup (GETTEXT_PACKAGE);
bindtextdomain (obj->priv->text_domain, _HEDERA_LOCALE_DIR);
break;
case PROP_DATA_DIR: