Merge de rama estable con master
This commit is contained in:
commit
1d68da05a2
|
@ -14,7 +14,8 @@ SUBDIRS = \
|
|||
po \
|
||||
vapi \
|
||||
glade \
|
||||
docs
|
||||
docs \
|
||||
anjuta
|
||||
|
||||
EXTRA_DIST = \
|
||||
autogen.sh \
|
||||
|
|
|
@ -39,17 +39,17 @@ vn_includedir = $(hedera_includedir)/vn
|
|||
field_includedir = $(vn_includedir)/field
|
||||
column_includedir = $(vn_includedir)/column
|
||||
|
||||
pkgconfigdir = $(datadir)/pkgconfig
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
|
||||
if ENABLE_VALA
|
||||
girdir = $(datadir)/gir-1.0
|
||||
typelibdir = $(libdir)/girepository-1.0
|
||||
typelibdir = $(prefix)/lib/girepository-1.0
|
||||
vapidata = $(top_srcdir)/vapi
|
||||
vapis = $(top_builddir)/vapi
|
||||
vapidir = $(datadir)/vala-$(VALA_VERSION)/vapi
|
||||
endif
|
||||
|
||||
gladevn_libdir = $(libdir)/glade/modules
|
||||
gladevn_libdir = $(prefix)/lib/glade/modules
|
||||
gladevn_datadir = $(datadir)/glade/catalogs
|
||||
|
||||
# Data
|
||||
|
@ -57,13 +57,13 @@ vn_datadir = $(hedera_datadir)/vn
|
|||
vn_imagedir = $(vn_datadir)/image
|
||||
vn_guidir = $(vn_datadir)/gui
|
||||
|
||||
module_querydir = $(hedera_datadir)/module/sql
|
||||
|
||||
if ENABLE_INSTALL
|
||||
vn_xmldir = $(datadir)/xml/$(PACKAGE)
|
||||
module_querydir = $(hedera_datadir)/module/sql
|
||||
module_datadir = $(hedera_datadir)/module
|
||||
else
|
||||
vn_xmldir = $(vn_datadir)/schema
|
||||
module_querydir = $(hedera_datadir)/module/sql
|
||||
module_datadir = $(hedera_datadir)/module/data
|
||||
endif
|
||||
|
||||
|
|
|
@ -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
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -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 " cd [+Destination+]/po
|
||||
&& intltool-update -p
|
||||
&& msginit --no-translator -i *.pot -o es.po -l es_ES.utf8
|
||||
&& echo es >> LINGUAS
|
||||
""/>
|
||||
[+ENDIF+]
|
||||
<open file="[+Destination+]/[+NameHLower+].anjuta"/>
|
||||
</action>
|
||||
</project-template>
|
|
@ -0,0 +1,2 @@
|
|||
[+ autogen5 template +]
|
||||
[+Author+] <[+Email+]>
|
|
@ -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
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -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+]])
|
|
@ -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)
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[+ autogen5 template +]
|
||||
[+Name+] ([+Version+]) UNRELEASED; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
-- [+Author+] <[+Email+]> [+(shell "date -R")+]
|
|
@ -0,0 +1 @@
|
|||
8
|
|
@ -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.
|
|
@ -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".
|
|
@ -0,0 +1,2 @@
|
|||
NEWS
|
||||
README
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
3.0 (native)
|
|
@ -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
|
|
@ -0,0 +1,5 @@
|
|||
[+ autogen5 template +]
|
||||
# List of source files to skip from translation.
|
||||
|
||||
src/[+Name+].c
|
||||
src/[+FormName+].c
|
|
@ -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
|
||||
|
|
@ -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;
|
||||
}
|
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -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 ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -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
|
11
autogen.sh
11
autogen.sh
|
@ -7,7 +7,10 @@ builddir=`pwd`
|
|||
mkdir -p $builddir/m4
|
||||
|
||||
cd $srcdir
|
||||
gtkdocize --copy || exit $?
|
||||
autoreconf -fi || exit $?
|
||||
glib-gettextize --copy --force || exit $?
|
||||
intltoolize --copy --force --automake || exit $?
|
||||
|
||||
gtkdocize --copy &&
|
||||
autoreconf -fi &&
|
||||
glib-gettextize --copy --force &&
|
||||
intltoolize --copy --force --automake
|
||||
|
||||
exit $?
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
dnl
|
||||
dnl Copyright (C) 2012 - Juan Ferrer Toribio
|
||||
dnl
|
||||
dnl This program is free software: you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU General Public License as published by
|
||||
dnl the Free Software Foundation, either version 3 of the License, or
|
||||
dnl (at your option) any later version.
|
||||
dnl
|
||||
dnl This program is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
dnl GNU General Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License
|
||||
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
dnl
|
||||
|
||||
# serial 2 vn-dev
|
||||
|
||||
AC_DEFUN([VN_BUILD_OPTIONS],
|
||||
[
|
||||
case $CFLAGS in
|
||||
*-W*) ;;
|
||||
*)CFLAGS+=" -Wall ";;
|
||||
esac
|
||||
|
||||
# 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 [default = no]])],
|
||||
[ENABLE_DEBUG="$enableval"],
|
||||
[ENABLE_DEBUG=no])
|
||||
AC_MSG_RESULT([$ENABLE_DEBUG])
|
||||
|
||||
case $CFLAGS in
|
||||
*-g*) ;;
|
||||
*)
|
||||
if test x"$ENABLE_DEBUG" = x"yes"; then
|
||||
CFLAGS+=" -ggdb "
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check if the package must be configured to be installed
|
||||
AC_MSG_CHECKING([whether to configure to install...])
|
||||
AC_ARG_ENABLE([install],
|
||||
[AS_HELP_STRING([--enable-install],
|
||||
[Enable install configuration [default = yes]])],
|
||||
[ENABLE_INSTALL="$enableval"],
|
||||
[ENABLE_INSTALL=yes])
|
||||
AC_MSG_RESULT([$installit])
|
||||
AM_CONDITIONAL(ENABLE_INSTALL, [test x"$ENABLE_INSTALL" = x"yes"])
|
||||
|
||||
case $CFLAGS in
|
||||
*-O*) ;;
|
||||
*)
|
||||
if test x"$ENABLE_INSTALL" = x"yes"; then
|
||||
CFLAGS+=" -O3"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST([ENABLE_DEBUG])
|
||||
AC_SUBST([ENABLE_INSTALL])
|
||||
AC_SUBST([CFLAGS])
|
||||
])
|
||||
|
67
configure.ac
67
configure.ac
|
@ -1,5 +1,7 @@
|
|||
|
||||
AC_INIT([hedera], [1.0])
|
||||
dnl Set compiler flags empty by default
|
||||
: ${CFLAGS=''}
|
||||
|
||||
AC_CONFIG_AUX_DIR([build])
|
||||
AC_CONFIG_MACRO_DIR([build/m4])
|
||||
|
@ -8,17 +10,32 @@ LT_INIT([dlopen])
|
|||
AC_PREREQ([2.69])
|
||||
AM_SILENT_RULES([yes])
|
||||
|
||||
# Checks for programs
|
||||
# Checks for the C compiler
|
||||
AC_PROG_CC
|
||||
|
||||
# Check for additional packages
|
||||
PKG_CHECK_MODULES([glib], [glib-2.0])
|
||||
PKG_CHECK_MODULES([gdome], [gdome2])
|
||||
PKG_CHECK_MODULES([gtk], [gtk+-3.0])
|
||||
PKG_CHECK_MODULES([gladeui], gladeui-2.0)
|
||||
PKG_CHECK_MODULES([gladeui], [gladeui-2.0])
|
||||
PKG_CHECK_MODULES([gtksourceview], [gtksourceview-3.0]
|
||||
,[SOURCEVIEW=yes]
|
||||
,[echo $gtksourceview_PKG_ERRORS])
|
||||
|
||||
AM_CONDITIONAL(HAVE_SOURCEVIEW, [test -n $SOURCEVIEW])
|
||||
|
||||
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
|
||||
|
||||
# Internationalization
|
||||
IT_PROG_INTLTOOL([0.40.1], [no-xml])
|
||||
|
||||
GETTEXT_PACKAGE=hedera
|
||||
AC_SUBST([GETTEXT_PACKAGE])
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [GETTEXT package name])
|
||||
ALL_LINGUAS="es ca nl"
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
AM_XGETTEXT_OPTION([-k_ -kQ_:1g -kN_ -kC_:1c,2 -kNC_:1c,2])
|
||||
|
||||
# Checks for Ragel State Machine Compiler
|
||||
AC_PATH_PROG(RAGEL, [ragel], [no])
|
||||
if test x"$RAGEL" = x"no" ; then
|
||||
|
@ -49,51 +66,11 @@ fi
|
|||
|
||||
AM_CONDITIONAL(ENABLE_VALA, [test x"$ENABLE_VALA" = x"yes" -a x"$VAPIGEN" != x"no"])
|
||||
|
||||
# Internationalization
|
||||
GETTEXT_PACKAGE=hedera
|
||||
AC_SUBST([GETTEXT_PACKAGE])
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [GETTEXT package name])
|
||||
ALL_LINGUAS="es ca nl"
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
AM_XGETTEXT_OPTION([-k_ -kQ_:1g -kN_ -kC_:1c,2 -kNC_:1c,2])
|
||||
|
||||
# GSettings configuration
|
||||
GLIB_GSETTINGS
|
||||
|
||||
CFLAGS=" -Wall"
|
||||
|
||||
# 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 [default = no]])],
|
||||
[ENABLE_DEBUG="$enableval"],
|
||||
[ENABLE_DEBUG=no])
|
||||
AC_MSG_RESULT([$ENABLE_DEBUG])
|
||||
|
||||
if test x"$ENABLE_DEBUG" = x"yes"; then
|
||||
CFLAGS+=" -ggdb"
|
||||
fi
|
||||
|
||||
# Check if it will be installed
|
||||
AC_MSG_CHECKING([whether to configure to install...])
|
||||
AC_ARG_ENABLE([install],
|
||||
[AS_HELP_STRING([--enable-install],
|
||||
[Enable install configuration [default = yes]])],
|
||||
[ENABLE_INSTALL="$enableval"],
|
||||
[ENABLE_INSTALL=yes])
|
||||
AC_MSG_RESULT([$installit])
|
||||
AM_CONDITIONAL(ENABLE_INSTALL, [test x"$ENABLE_INSTALL" = x"yes"])
|
||||
|
||||
if test x"$ENABLE_INSTALL" = x"yes"; then
|
||||
CFLAGS+=" -O3"
|
||||
else
|
||||
CFLAGS+=" -O0"
|
||||
fi
|
||||
|
||||
AC_SUBST([CPPFLAGS])
|
||||
AC_SUBST([CFLAGS])
|
||||
AC_SUBST([LDFLAGS])
|
||||
# Sets the default build options for Vn projects
|
||||
VN_BUILD_OPTIONS
|
||||
|
||||
# Portability check disabled for GTK-DOC (can be changed if needed)
|
||||
AM_INIT_AUTOMAKE([-Wno-portability])
|
||||
|
@ -125,8 +102,10 @@ AC_CONFIG_FILES([
|
|||
docs/reference/Makefile
|
||||
docs/reference/hedera/Makefile
|
||||
po/Makefile.in
|
||||
anjuta/Makefile
|
||||
])
|
||||
|
||||
AC_SUBST([uVERSION], [${VERSION//./_}])
|
||||
AC_SUBST([VERSION_INFO], [${VERSION//./:}])
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -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 \
|
||||
|
|
11
db/db-conn.c
11
db/db-conn.c
|
@ -239,7 +239,7 @@ static void db_conn_add_request (DbConn * obj, DbRequest * request)
|
|||
* @plugin: the plugin name
|
||||
* @err: return address of a #GError or #NULL
|
||||
*
|
||||
* Tryes to load a plugin.
|
||||
* Tries to load a plugin.
|
||||
*
|
||||
* Return vale: %TRUE if plugin was loaded successfully, %FALSE ortherwise
|
||||
**/
|
||||
|
@ -893,9 +893,13 @@ SqlString * db_conn_create_stmt_from_file (DbConn * obj, const gchar * query_fil
|
|||
g_return_val_if_fail (DB_IS_CONN (obj), NULL);
|
||||
g_return_val_if_fail (query_file, NULL);
|
||||
|
||||
if (g_str_has_suffix (query_file, ".sql"))
|
||||
file = g_strdup (query_file);
|
||||
else
|
||||
file = g_strconcat (query_file, ".sql", NULL);
|
||||
|
||||
for (i = 0; obj->query_dirs &&obj->query_dirs[i] && !stmt; i++)
|
||||
if (obj->query_dirs)
|
||||
for (i = 0; obj->query_dirs[i] != NULL/* && !stmt*/; i++)
|
||||
{
|
||||
gchar * buffer;
|
||||
gchar * path = g_build_filename (obj->query_dirs[i], file, NULL);
|
||||
|
@ -910,9 +914,10 @@ SqlString * db_conn_create_stmt_from_file (DbConn * obj, const gchar * query_fil
|
|||
}
|
||||
|
||||
if (!stmt)
|
||||
g_warning ("DbConn: Can't create statement from file: %s", query_file);
|
||||
g_warning ("DbConn: Can't create statement from file: %s", file);
|
||||
|
||||
g_free (file);
|
||||
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,8 @@ static gboolean db_file_loader_callback (File * file)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean db_file_loader_resolve_host (DbFileLoader * obj, GCancellable * cancel, GError ** error)
|
||||
static gboolean db_file_loader_resolve_host (DbFileLoader * obj,
|
||||
GCancellable * cancel, GError ** error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GResolver * r = g_resolver_get_default ();
|
||||
|
@ -245,7 +246,6 @@ static GIOStream * db_file_loader_connect (DbFileLoader * obj, GCancellable * ca
|
|||
GSocketClient * client = g_socket_client_new ();
|
||||
GIOStream * connection = G_IO_STREAM (g_socket_client_connect
|
||||
(client, G_SOCKET_CONNECTABLE (obj->priv->addr), cancel, error));
|
||||
|
||||
g_object_unref (client);
|
||||
return connection;
|
||||
}
|
||||
|
@ -303,11 +303,8 @@ static gchar * db_file_loader_create_request (DbFileLoader * obj, const gchar *
|
|||
return request;
|
||||
}
|
||||
|
||||
static gboolean db_file_loader_store (DbFileLoader * obj
|
||||
,const gchar * subpath
|
||||
,const gchar * data
|
||||
,gsize len
|
||||
,GError ** error)
|
||||
static gboolean db_file_loader_store (DbFileLoader * obj,
|
||||
const gchar * subpath, const gchar * data, gsize len, GError ** error)
|
||||
{
|
||||
gsize dir_len;
|
||||
gboolean ret = FALSE;
|
||||
|
@ -340,10 +337,8 @@ static gboolean db_file_loader_store (DbFileLoader * obj
|
|||
return ret;
|
||||
}
|
||||
|
||||
static gchar * db_file_loader_load_from_cache (DbFileLoader * obj
|
||||
,const gchar * subpath
|
||||
,gsize * len
|
||||
,GError ** error)
|
||||
static gchar * db_file_loader_load_from_cache (DbFileLoader * obj,
|
||||
const gchar * subpath, gsize * len, GError ** error)
|
||||
{
|
||||
gchar * data;
|
||||
GFile * file = db_file_loader_get_cache_file (obj, subpath);
|
||||
|
@ -354,7 +349,7 @@ static gchar * db_file_loader_load_from_cache (DbFileLoader * obj
|
|||
return data;
|
||||
}
|
||||
|
||||
static void db_file_loader_job_download (File * file, DbFileLoader * obj)
|
||||
static void db_file_loader_thread_download (File * file, DbFileLoader * obj)
|
||||
{
|
||||
gsize len;
|
||||
gchar ** split;
|
||||
|
@ -362,10 +357,10 @@ static void db_file_loader_job_download (File * file, DbFileLoader * obj)
|
|||
gchar * request = NULL;
|
||||
gchar * data = NULL;
|
||||
GError * error = NULL;
|
||||
GCancellable * cancel = file->cancel;
|
||||
GIOStream * connection = NULL;
|
||||
GOutputStream * send_stream;
|
||||
GDataInputStream * receive_stream = NULL;
|
||||
GOutputStream * send_stream;
|
||||
GCancellable * cancel = file->cancel;
|
||||
|
||||
g_mutex_lock (obj->priv->mutex);
|
||||
|
||||
|
@ -494,10 +489,8 @@ final:
|
|||
* Downloads a file from @file, which is a relative path to the file from the
|
||||
* base URL of the #DbFileLoader. The result will be availble in @func.
|
||||
**/
|
||||
void db_file_loader_download (DbFileLoader * obj
|
||||
,const gchar * path
|
||||
,DbFileLoaderCallbackFunc func
|
||||
,gpointer user_data)
|
||||
void db_file_loader_download (DbFileLoader * obj,
|
||||
const gchar * path, DbFileLoaderCallbackFunc func, gpointer user_data)
|
||||
{
|
||||
File * file;
|
||||
|
||||
|
@ -505,8 +498,8 @@ void db_file_loader_download (DbFileLoader * obj
|
|||
g_return_if_fail (path);
|
||||
|
||||
if (!obj->priv->pool)
|
||||
obj->priv->pool = g_thread_pool_new ((GFunc) db_file_loader_job_download,
|
||||
obj, -1, FALSE, NULL);
|
||||
obj->priv->pool = g_thread_pool_new ((GFunc) db_file_loader_thread_download,
|
||||
obj, 2, FALSE, NULL);
|
||||
|
||||
file = file_new (obj, path, NULL, func, user_data, TRUE);
|
||||
g_hash_table_add (obj->priv->downloading, file);
|
||||
|
@ -514,7 +507,7 @@ void db_file_loader_download (DbFileLoader * obj
|
|||
g_thread_pool_push (obj->priv->pool, file, NULL);
|
||||
}
|
||||
|
||||
static void db_file_loader_job_upload (DbFileLoader * obj, File * file)
|
||||
static void db_file_loader_thread_upload (DbFileLoader * obj, File * file)
|
||||
{
|
||||
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||
(GSourceFunc) db_file_loader_callback, file,
|
||||
|
@ -534,11 +527,9 @@ static void db_file_loader_job_upload (DbFileLoader * obj, File * file)
|
|||
* URL of the #DbFileLoader. To retrieve the result, connect to the
|
||||
* "downloaded" signal and to the "error" signal to manage errors.
|
||||
**/
|
||||
void db_file_loader_upload (DbFileLoader * obj
|
||||
,GBytes * data
|
||||
,const gchar * path
|
||||
,DbFileLoaderCallbackFunc func
|
||||
,gpointer user_data)
|
||||
void db_file_loader_upload (DbFileLoader * obj,
|
||||
GBytes * data, const gchar * path,
|
||||
DbFileLoaderCallbackFunc func, gpointer user_data)
|
||||
{
|
||||
File * file;
|
||||
|
||||
|
@ -547,8 +538,8 @@ void db_file_loader_upload (DbFileLoader * obj
|
|||
g_return_if_fail (path);
|
||||
//TODO? create a pool only for uploads
|
||||
if (!obj->priv->pool)
|
||||
obj->priv->pool = g_thread_pool_new ((GFunc) db_file_loader_job_upload,
|
||||
obj, -1, TRUE, NULL);
|
||||
obj->priv->pool = g_thread_pool_new ((GFunc) db_file_loader_thread_upload,
|
||||
obj, 2, TRUE, NULL);
|
||||
|
||||
file = file_new (obj, path, data, func, user_data, TRUE);
|
||||
|
||||
|
@ -565,7 +556,7 @@ static void db_file_loader_cancel (DbFileLoader * obj, const gchar * name)
|
|||
|
||||
g_hash_table_iter_init (&iter, obj->priv->downloading);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, (gpointer*) &file, NULL))
|
||||
while (g_hash_table_iter_next (&iter, (gpointer *) &file, NULL))
|
||||
if (!name || !g_strcmp0 (file->name, name))
|
||||
{
|
||||
g_cancellable_cancel (file->cancel);
|
||||
|
|
246
db/db-iterator.c
246
db/db-iterator.c
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "db-iterator.h"
|
||||
#include "db-model-holder.h"
|
||||
|
||||
#define IS_READY(obj) (obj->model && db_model_get_status (obj->model) == DB_MODEL_STATUS_READY)
|
||||
|
||||
|
@ -24,29 +25,16 @@
|
|||
* @short_description: manages a iterator with its events
|
||||
* @title: DbIterator
|
||||
*
|
||||
* The DbIterator manages a connection with a data base.
|
||||
* There are different ways to create an DbIterator:
|
||||
* <itemizedlist>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* db_iterator_new(): This constructor just needs a #DbModel object
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* db_iterator_new_with_stmt(): This one needs a #DbConn with the connection and
|
||||
* a #SqlStmt object
|
||||
* </para>
|
||||
* </listitem>
|
||||
* <listitem>
|
||||
* <para>
|
||||
* db_iterator_new_with_sql(): This one needs a #DbConn with the connection and
|
||||
* the sql string
|
||||
* </para>
|
||||
* </listitem>
|
||||
*</itemizedlist>
|
||||
* The #DbIterator manages a connection with a data base. The function
|
||||
* db_iterator_new() creates a new #DbIterator.
|
||||
*/
|
||||
G_DEFINE_TYPE (DbIterator, db_iterator, G_TYPE_OBJECT);
|
||||
|
||||
static void db_iterator_model_holder_interface_init (DbModelHolderInterface * iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (DbIterator, db_iterator, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (DB_TYPE_MODEL_HOLDER,
|
||||
db_iterator_model_holder_interface_init)
|
||||
);
|
||||
|
||||
enum {
|
||||
ITER_CHANGED
|
||||
|
@ -72,48 +60,6 @@ DbIterator * db_iterator_new (DbModel * model)
|
|||
return g_object_new (DB_TYPE_ITERATOR, "model", model, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* db_iterator_new_with_stmt:
|
||||
* @conn: the connection used to create the model.
|
||||
* @stmt: the #SqlStmt statement used to create the model.
|
||||
*
|
||||
* Creates a new #DbIterator. #SqlStmt must be a #SqlSelect or a #SqlString
|
||||
* object with a valid SELECT statement.
|
||||
*
|
||||
* Return value: a #DbIterator.
|
||||
**/
|
||||
DbIterator * db_iterator_new_with_stmt (DbConn * conn, SqlStmt * stmt)
|
||||
{
|
||||
DbIterator * obj;
|
||||
DbModel * model;
|
||||
|
||||
g_return_val_if_fail (DB_IS_CONN (conn) || !conn, NULL);
|
||||
g_return_val_if_fail (SQL_IS_STMT (stmt) || !stmt, NULL);
|
||||
|
||||
model = db_model_new (conn, stmt);
|
||||
obj = g_object_new (DB_TYPE_ITERATOR, "model", model, NULL);
|
||||
g_object_unref (model);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* db_iterator_new_with_sql:
|
||||
* @conn: the connection used to create the model.
|
||||
* @sql: the sql string used to create the model.
|
||||
*
|
||||
* Creates a new #DbIterator. sql must be a valid SELECT statement.
|
||||
*
|
||||
* Return value: a #DbIterator.
|
||||
**/
|
||||
DbIterator * db_iterator_new_with_sql (DbConn * conn, const gchar * sql)
|
||||
{
|
||||
g_return_val_if_fail (sql, NULL);
|
||||
g_return_val_if_fail (DB_IS_CONN (conn) || !conn, NULL);
|
||||
|
||||
return g_object_new (DB_TYPE_ITERATOR, "sql", sql, "conn", conn, NULL);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
|
||||
|
||||
static void db_iterator_unref_param (DbIterator * obj, DbParam * param)
|
||||
|
@ -296,31 +242,6 @@ static gboolean db_iterator_check_row_selected (DbIterator * obj)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempts to create a model, if have enough information, and assigns it to
|
||||
* the iterator.
|
||||
*/
|
||||
static void db_iterator_try_create_model (DbIterator * obj)
|
||||
{
|
||||
DbModel * new_model = NULL;
|
||||
|
||||
if (obj->conn)
|
||||
{
|
||||
if (obj->sql)
|
||||
{
|
||||
if (obj->use_file)
|
||||
new_model = db_model_new_with_file (obj->conn, obj->sql);
|
||||
else
|
||||
new_model = db_model_new_with_sql (obj->conn, obj->sql);
|
||||
}
|
||||
if (obj->stmt)
|
||||
new_model = db_model_new (obj->conn, obj->stmt);
|
||||
}
|
||||
|
||||
if (new_model)
|
||||
db_iterator_set_model (obj, new_model);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
|
||||
|
||||
/**
|
||||
|
@ -356,40 +277,6 @@ DbModel * db_iterator_get_model (DbIterator * obj)
|
|||
return obj->model;
|
||||
}
|
||||
|
||||
/**
|
||||
* db_iterator_get_conn:
|
||||
* @obj: a #DbIterator
|
||||
*
|
||||
* Gets connection used by the @obj model.
|
||||
*
|
||||
* Return value: (transfer none): the #DbConn
|
||||
**/
|
||||
DbConn * db_iterator_get_conn (DbIterator * obj)
|
||||
{
|
||||
g_return_val_if_fail (DB_IS_ITERATOR (obj), NULL);
|
||||
|
||||
if (obj->model)
|
||||
db_model_get_conn (obj->model);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* db_iterator_set_conn:
|
||||
* @obj: a #DbIterator
|
||||
* @conn: the #DbConn
|
||||
*
|
||||
* Sets the connection used by the @obj model.
|
||||
**/
|
||||
void db_iterator_set_conn (DbIterator * obj, DbConn * conn)
|
||||
{
|
||||
g_return_if_fail (DB_IS_ITERATOR (obj));
|
||||
g_return_if_fail (DB_IS_CONN (conn));
|
||||
g_return_if_fail (obj->model);
|
||||
|
||||
db_model_set_conn (obj->model, conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* db_iterator_is_ready:
|
||||
* @obj: a #DbIterator
|
||||
|
@ -782,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);
|
||||
}
|
||||
|
||||
|
@ -948,10 +837,6 @@ enum
|
|||
PROP_MODEL = 1
|
||||
,PROP_MODE
|
||||
,PROP_REMEMBER_SELECTION
|
||||
,PROP_CONN
|
||||
,PROP_STMT
|
||||
,PROP_SQL
|
||||
,PROP_USE_FILE
|
||||
};
|
||||
|
||||
static void db_iterator_set_property (DbIterator * obj, guint id,
|
||||
|
@ -968,25 +853,6 @@ static void db_iterator_set_property (DbIterator * obj, guint id,
|
|||
case PROP_REMEMBER_SELECTION:
|
||||
obj->remember_selection = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_CONN:
|
||||
g_clear_object (&obj->conn);
|
||||
obj->conn = g_value_dup_object (value);
|
||||
db_iterator_try_create_model (obj);
|
||||
break;
|
||||
case PROP_STMT:
|
||||
g_clear_object (&obj->stmt);
|
||||
obj->stmt = g_value_dup_object (value);
|
||||
db_iterator_try_create_model (obj);
|
||||
break;
|
||||
case PROP_SQL:
|
||||
g_free (obj->sql);
|
||||
obj->sql = g_value_dup_string (value);
|
||||
db_iterator_try_create_model (obj);
|
||||
break;
|
||||
case PROP_USE_FILE:
|
||||
obj->use_file = g_value_get_boolean (value);
|
||||
db_iterator_try_create_model (obj);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
|
||||
}
|
||||
|
@ -1019,10 +885,6 @@ static void db_iterator_init (DbIterator * obj)
|
|||
obj->params = NULL;
|
||||
obj->row = 0;
|
||||
obj->row_selected = FALSE;
|
||||
obj->conn = NULL;
|
||||
obj->stmt = NULL;
|
||||
obj->sql = NULL;
|
||||
obj->use_file = FALSE;
|
||||
}
|
||||
|
||||
static void db_iterator_finalize (DbIterator * obj)
|
||||
|
@ -1050,10 +912,6 @@ static void db_iterator_finalize (DbIterator * obj)
|
|||
g_object_unref (obj->model);
|
||||
}
|
||||
|
||||
g_clear_object (&obj->conn);
|
||||
g_clear_object (&obj->stmt);
|
||||
g_free (obj->sql);
|
||||
|
||||
G_OBJECT_CLASS (db_iterator_parent_class)->finalize (G_OBJECT (obj));
|
||||
}
|
||||
|
||||
|
@ -1064,34 +922,66 @@ static void db_iterator_class_init (DbIteratorClass * klass)
|
|||
k->get_property = (GObjectGetPropertyFunc) db_iterator_get_property;
|
||||
k->finalize = (GObjectFinalizeFunc) db_iterator_finalize;
|
||||
|
||||
/**
|
||||
* DbIterator::iter-changed:
|
||||
* @iterator: the object on which the signal is emitted
|
||||
* @iter: a #DbIter
|
||||
*
|
||||
* This signal is emitted when @iter moves over the @iterator model
|
||||
*/
|
||||
signals[ITER_CHANGED] = g_signal_new ("iter-changed",
|
||||
DB_TYPE_ITERATOR, G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0
|
||||
);
|
||||
|
||||
/**
|
||||
* DbIterator::data-changed:
|
||||
* @iterator: the object on which the signal is emitted
|
||||
*
|
||||
* This signal is emitted when the model changes its data
|
||||
*/
|
||||
signals[DATA_CHANGED] = g_signal_new ("data-changed",
|
||||
DB_TYPE_ITERATOR, G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0
|
||||
);
|
||||
|
||||
/**
|
||||
* DbIterator::row-num-changed:
|
||||
* @iterator: the object on which the signal is emitted
|
||||
*
|
||||
* This signal is emitted when the selected row changes
|
||||
*/
|
||||
signals[ROW_NUM_CHANGED] = g_signal_new ("row-num-changed",
|
||||
DB_TYPE_ITERATOR, G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0
|
||||
);
|
||||
|
||||
/**
|
||||
* DbIterator::status-changed:
|
||||
* @iterator: the object on which the signal is emitted
|
||||
* @ready: #TRUE if @iterator is ready, #FALSE otherwise
|
||||
*
|
||||
* This signal is emitted when the status of the iterator changes
|
||||
*/
|
||||
signals[STATUS_CHANGED] = g_signal_new ("status-changed",
|
||||
DB_TYPE_ITERATOR, G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN
|
||||
);
|
||||
|
||||
/**
|
||||
* DbIterator::operations-done:
|
||||
* @iterator: the object on which the signal is emitted
|
||||
*
|
||||
* This signal is emitted when all pending operations are performed over the
|
||||
* model of @iterator
|
||||
*/
|
||||
signals[OPERATIONS_DONE] = g_signal_new ("operations-done",
|
||||
DB_TYPE_ITERATOR, G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0
|
||||
);
|
||||
|
||||
g_object_class_install_property (k, PROP_MODEL,
|
||||
g_param_spec_object ("model"
|
||||
,_("Model")
|
||||
,_("The DbModel handled by the iterator")
|
||||
,DB_TYPE_MODEL
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_override_property (k, PROP_MODEL, "model");
|
||||
|
||||
g_object_class_install_property (k, PROP_MODE,
|
||||
g_param_spec_enum ("mode"
|
||||
,_("Mode")
|
||||
|
@ -1107,34 +997,12 @@ static void db_iterator_class_init (DbIteratorClass * klass)
|
|||
,TRUE
|
||||
,G_PARAM_CONSTRUCT | G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_CONN,
|
||||
g_param_spec_object ("conn"
|
||||
,_("Connection")
|
||||
,_("The connection used by the model")
|
||||
,DB_TYPE_CONN
|
||||
,G_PARAM_WRITABLE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_STMT,
|
||||
g_param_spec_object ("stmt"
|
||||
,_("Statement")
|
||||
,_("The statement used to create the model")
|
||||
,SQL_TYPE_STMT
|
||||
,G_PARAM_WRITABLE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_SQL,
|
||||
g_param_spec_string ("sql"
|
||||
,_("SQL")
|
||||
,_("The SQL query used to create the model")
|
||||
, NULL
|
||||
,G_PARAM_WRITABLE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_USE_FILE,
|
||||
g_param_spec_boolean ("use-file"
|
||||
,_("Use file")
|
||||
,_("Wether to interpret the sql property as query file")
|
||||
,FALSE
|
||||
,G_PARAM_CONSTRUCT | G_PARAM_WRITABLE
|
||||
));
|
||||
}
|
||||
|
||||
static void db_iterator_model_holder_interface_init (DbModelHolderInterface * iface)
|
||||
{
|
||||
iface->get_model = (DbModelHolderGetModelFunc) db_iterator_get_model;
|
||||
iface->set_model = (DbModelHolderSetModelFunc) db_iterator_set_model;
|
||||
}
|
||||
|
||||
GType db_iterator_mode_get_type ()
|
||||
|
|
|
@ -81,11 +81,6 @@ struct _DbIterator
|
|||
gint row;
|
||||
gboolean row_selected;
|
||||
gboolean remember_selection;
|
||||
|
||||
DbConn * conn;
|
||||
SqlStmt * stmt;
|
||||
gchar * sql;
|
||||
gboolean use_file;
|
||||
};
|
||||
|
||||
struct _DbIteratorClass
|
||||
|
@ -98,11 +93,6 @@ GType db_iterator_get_type ();
|
|||
GType db_iterator_mode_get_type () G_GNUC_CONST;
|
||||
|
||||
DbIterator * db_iterator_new (DbModel * model);
|
||||
DbIterator * db_iterator_new_with_stmt (DbConn * conn, SqlStmt * stmt);
|
||||
DbIterator * db_iterator_new_with_sql (DbConn * conn, const gchar * sql);
|
||||
DbModel * db_iterator_get_model (DbIterator * obj);
|
||||
DbConn * db_iterator_get_conn (DbIterator * obj);
|
||||
void db_iterator_set_conn (DbIterator * obj, DbConn * conn);
|
||||
gboolean db_iterator_is_ready (DbIterator * obj);
|
||||
DbIteratorMode db_iterator_get_mode (DbIterator * obj);
|
||||
void db_iterator_set_mode (DbIterator * obj, DbIteratorMode mode);
|
||||
|
|
|
@ -19,15 +19,17 @@
|
|||
|
||||
/**
|
||||
* SECTION: db-model-holder
|
||||
* @Short_description:
|
||||
* @Short_description: interface for objects that use a model
|
||||
* @Title: DbModelHolder
|
||||
* @See_also: #DbModel
|
||||
*
|
||||
* This interface should be implemented from any class that uses a #DbModel as
|
||||
* datasource.
|
||||
* data source. This interface offers a #DbModel as a virtual property that has
|
||||
* to be overwritten by the classes implementing it, as well as the
|
||||
* db_model_holder_get_model() and db_model_holder_set_model() methods.
|
||||
**/
|
||||
|
||||
G_DEFINE_INTERFACE (DbModelHolder, db_model_holder, G_TYPE_INTERFACE);
|
||||
G_DEFINE_INTERFACE (DbModelHolder, db_model_holder, G_TYPE_INVALID);
|
||||
|
||||
/**
|
||||
* db_model_holder_get_model:
|
||||
|
@ -35,7 +37,7 @@ G_DEFINE_INTERFACE (DbModelHolder, db_model_holder, G_TYPE_INTERFACE);
|
|||
*
|
||||
* Gets the model used by holder.
|
||||
*
|
||||
* Return value: the #DbModel
|
||||
* Return value:(transfer none): the #DbModel
|
||||
**/
|
||||
DbModel * db_model_holder_get_model (DbModelHolder * obj)
|
||||
{
|
||||
|
@ -45,27 +47,29 @@ DbModel * db_model_holder_get_model (DbModelHolder * obj)
|
|||
}
|
||||
|
||||
/**
|
||||
* db_model_holder_get_model:
|
||||
* db_model_holder_set_model:
|
||||
* @obj: a #DbModelHolder
|
||||
* @model: the #DbModel
|
||||
* @model:(allow-none): the #DbModel
|
||||
*
|
||||
* Sets the model used by holder.
|
||||
* Sets the model used by holder. If @model is NULL, then it will unset the
|
||||
* model.
|
||||
**/
|
||||
void db_model_holder_set_model (DbModelHolder * obj, DbModel * model)
|
||||
{
|
||||
g_return_if_fail (DB_IS_MODEL_HOLDER (obj));
|
||||
g_return_if_fail (DB_IS_MODEL (obj));
|
||||
|
||||
DB_MODEL_HOLDER_GET_INTERFACE (obj)->set_model (obj, model);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
|
||||
|
||||
static void db_model_holder_default_init (DbModelHolderInterface * klass)
|
||||
static void db_model_holder_default_init (DbModelHolderInterface * iface)
|
||||
{
|
||||
g_object_interface_install_property (klass,
|
||||
g_object_interface_install_property (iface,
|
||||
g_param_spec_object ("model"
|
||||
,"Model"
|
||||
,"The model used by the holder"
|
||||
,_("Model")
|
||||
,_("The model used by the holder")
|
||||
,DB_TYPE_MODEL
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef struct _DbModelHolderInterface DbModelHolderInterface;
|
|||
typedef DbModel * (* DbModelHolderGetModelFunc) (DbModelHolder * obj);
|
||||
typedef void (* DbModelHolderSetModelFunc) (DbModelHolder * obj, DbModel * sql);
|
||||
|
||||
struct _DbModelHolder {};
|
||||
struct _DbModelHolder;
|
||||
|
||||
struct _DbModelHolderInterface
|
||||
{
|
||||
|
|
729
db/db-model.c
729
db/db-model.c
File diff suppressed because it is too large
Load Diff
|
@ -152,21 +152,6 @@ typedef enum
|
|||
}
|
||||
DbSortType;
|
||||
|
||||
/**
|
||||
* DbIterCompareFunc:
|
||||
* @model: a #DbModel
|
||||
* @a: a #DbIter
|
||||
* @b: a #DbIter
|
||||
* @user_data: (closure): user-provided data to use while comparing two #DbIter
|
||||
*
|
||||
* Prototype of a function used to search some in a model using
|
||||
* #DbIter to iterate through it.
|
||||
**/
|
||||
typedef gint (*DbIterCompareFunc) (DbModel * model
|
||||
,DbIter * a
|
||||
,DbIter * b
|
||||
,gpointer user_data);
|
||||
|
||||
struct _DbModel
|
||||
{
|
||||
GObject parent;
|
||||
|
@ -206,6 +191,7 @@ void db_model_unset_update_flags (DbModel * obj
|
|||
void db_model_set_mode (DbModel * obj, DbModelMode mode);
|
||||
DbModelMode db_model_get_mode (DbModel * obj);
|
||||
void db_model_toggle_mode (DbModel * obj);
|
||||
void db_model_use_null_row (DbModel * obj, gboolean use);
|
||||
gboolean db_model_get_last (DbModel * obj, DbIter * iter);
|
||||
void db_model_get (DbModel * obj
|
||||
,DbIter * iter
|
||||
|
@ -248,12 +234,11 @@ void db_model_add_join_columns (DbModel * obj
|
|||
void db_model_set_default_value_from_column (DbModel * obj
|
||||
,const gchar * dst_field
|
||||
,gint src_column);
|
||||
|
||||
void db_model_set_default_value_from_param (DbModel * obj
|
||||
,const gchar * dst_field
|
||||
,GvnParam * param
|
||||
,const gchar * id);
|
||||
,GvnParam * param);
|
||||
void db_model_add_param (DbModel * obj
|
||||
,const gchar * id
|
||||
,GvnParam * param);
|
||||
|
||||
//GtkTreeModel-like methods
|
||||
|
@ -278,15 +263,5 @@ gboolean db_model_get_sort_column_id (DbModel * obj,
|
|||
void db_model_set_sort_column_id (DbModel * obj,
|
||||
gint sort_column_id,
|
||||
DbSortType order);
|
||||
void db_model_set_sort_func (DbModel * obj,
|
||||
gint sort_column_id,
|
||||
DbIterCompareFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy);
|
||||
void db_model_set_default_sort_func (DbModel * obj,
|
||||
DbIterCompareFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy);
|
||||
gboolean db_model_has_default_sort_func (DbModel * obj);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,14 @@
|
|||
|
||||
#include "db-param.h"
|
||||
|
||||
/**
|
||||
* SECTION: db-param
|
||||
* @Short_description: representation of the value of a field
|
||||
* @Title: DbParam
|
||||
*
|
||||
* This class represents the value of a field in a #DbIterator.
|
||||
**/
|
||||
|
||||
G_DEFINE_TYPE (DbParam, db_param, GVN_TYPE_PARAM);
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef struct _DbColumn DbColumn;
|
|||
* DbResult:
|
||||
* @nrows: Number of rows.
|
||||
* @ncols: Number of columns.
|
||||
* @data: Has a #GList.
|
||||
* @data: (element-type DbRow): Has a #GList.
|
||||
* @column: Has a #DbColumn.
|
||||
*
|
||||
* Has the information of a row.
|
||||
|
|
1
db/db.h
1
db/db.h
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <sql/sql.h>
|
||||
#include "db-iter.h"
|
||||
#include "db-model-holder.h"
|
||||
#include "db-model.h"
|
||||
#include "db-request.h"
|
||||
#include "db-conn.h"
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@/hedera
|
||||
includedir=@includedir@/hedera
|
||||
libdir=@libdir@/@PACKAGE@
|
||||
includedir=@includedir@/@PACKAGE@
|
||||
|
||||
Name: Db
|
||||
Description: Database Access Module for Hedera Library
|
||||
Version: @VERSION@
|
||||
Requires: sql gvn glib-2.0 gobject-2.0
|
||||
Libs: -L${libdir} -ldb
|
||||
Cflags: -I${includedir}/db
|
||||
Requires: sql
|
||||
Libs: -ldb
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
libhedera (1.0-1) stable; urgency=low
|
||||
libhedera (1.0-7) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
8
|
||||
9
|
|
@ -9,6 +9,22 @@ Section: libs
|
|||
Homepage: http://www.verdnatura.es
|
||||
Vcs-Svn: svn://www.verdnatura.es/hedera/trunk
|
||||
|
||||
Package: libhedera1
|
||||
Section: libs
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libgtk-3-0
|
||||
Description: Database access and widget provider library (core)
|
||||
The hedera library provides and lets you create widgets bound to SQL queries
|
||||
and manages the different operations made over the data retrieved from these
|
||||
queries.
|
||||
.
|
||||
The library also has a modular system to add and remove the different widgets
|
||||
in run time. And includes Glade integration, to design the programs in an
|
||||
easiest, graphical way.
|
||||
.
|
||||
This package contains the core of the library. It also provides the plugins to
|
||||
connect a PostgreSQL or MySQL database.
|
||||
|
||||
Package: hedera
|
||||
Section: gnome
|
||||
Architecture: amd64
|
||||
|
@ -20,44 +36,31 @@ Description: Database access and widget provider library (runtime)
|
|||
queries.
|
||||
.
|
||||
The library also has a modular system to add and remove the different widgets
|
||||
in run time.
|
||||
in run time. And includes Glade integration, to design the programs in an
|
||||
easiest, graphical way.
|
||||
.
|
||||
This package contains the executable and data files.
|
||||
|
||||
Package: libhedera-dev
|
||||
Section: libdevel
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libhedera1 (= ${binary:Version})
|
||||
Suggests: libgtk-3-doc, libgtk-3-dbg, devhelp, valac (>= 0.16)
|
||||
Recommends: glade (>= 3.4), anjuta (>= 3.4)
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libhedera1 (= ${binary:Version}),
|
||||
libgtk-3-dev
|
||||
Suggests: libgtk-3-doc, libgtk-3-0-dbg, devhelp, valac (>= 0.16)
|
||||
Recommends: glade (>= 3.4), anjuta (>= 3.4), libgtksourceview-3.0-1
|
||||
Description: Database access and widget provider library (development)
|
||||
The hedera library provides and lets you create widgets bound to SQL queries
|
||||
and manages the different operations made over the data retrieved from these
|
||||
queries.
|
||||
.
|
||||
The library also has a modular system to add and remove the different widgets
|
||||
in run time. And it includes Glade integration, to design the programs in an
|
||||
in run time. And includes Glade integration, to design the programs in an
|
||||
easiest, graphical way.
|
||||
.
|
||||
This package contains development files to compile C and Vala programs that
|
||||
use the hedera library. It also contains the documentation and introspection
|
||||
files.
|
||||
|
||||
Package: libhedera1
|
||||
Section: libs
|
||||
Architecture: amd64
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, libgtk-3-0, libgtk-3-dev
|
||||
Description: Database access and widget provider library (core)
|
||||
The hedera library provides and lets you create widgets bound to SQL queries
|
||||
and manages the different operations made over the data retrieved from these
|
||||
queries.
|
||||
.
|
||||
The library also has a modular system to add and remove the different widgets
|
||||
in run time.
|
||||
.
|
||||
This package contains the core of the library. It also provides the plugins to
|
||||
connect a PostgreSQL or MySQL database.
|
||||
|
||||
Package: libhedera-dbg
|
||||
Section: debug
|
||||
Architecture: amd64
|
||||
|
@ -68,6 +71,7 @@ Description: Database access and widget provider library (debug)
|
|||
queries.
|
||||
.
|
||||
The library also has a modular system to add and remove the different widgets
|
||||
in run time.
|
||||
in run time. And includes Glade integration, to design the programs in an
|
||||
easiest, graphical way.
|
||||
.
|
||||
This package contains the debugging symbols for hedera.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
usr/bin
|
||||
usr/lib/hedera/module
|
||||
usr/share/hedera/vn/image
|
||||
usr/lib/x86_64-linux-gnu/hedera/module
|
||||
usr/share/hedera/vn
|
||||
usr/share/hedera/vn/image
|
||||
usr/share/hedera/module
|
||||
usr/share/hedera/module/sql
|
||||
usr/share/hedera/module/sql/example
|
||||
usr/share/applications
|
||||
usr/share/ca-certificates/verdnatura.es
|
|
@ -1,7 +1,8 @@
|
|||
usr/bin/*
|
||||
usr/lib/hedera/module/*.so
|
||||
usr/share/hedera/vn/image/*
|
||||
usr/lib/x86_64-linux-gnu/hedera/module/*.so
|
||||
usr/share/hedera/vn/*
|
||||
usr/share/hedera/vn/image/*
|
||||
usr/share/hedera/module/*
|
||||
usr/share/hedera/module/sql/*
|
||||
usr/share/hedera/module/sql/example/*
|
||||
usr/share/applications/*
|
||||
usr/share/ca-certificates/verdnatura.es/*
|
|
@ -1 +1 @@
|
|||
usr/share/ca-certificates/verdnatura.es/cacert.pem etc/ssl/certs/verdnatura.es.pem
|
||||
usr/share/man/man1/hedera.1.gz usr/share/man/man1/hedera-bin.1.gz
|
|
@ -5,11 +5,24 @@ usr/include/hedera/db
|
|||
usr/include/hedera/vn
|
||||
usr/include/hedera/vn/field
|
||||
usr/include/hedera/vn/column
|
||||
usr/lib/hedera
|
||||
usr/lib/x86_64-linux-gnu
|
||||
usr/lib/x86_64-linux-gnu/hedera
|
||||
usr/lib/x86_64-linux-gnu/pkgconfig
|
||||
usr/lib/glade/modules
|
||||
usr/lib/girepository-1.0
|
||||
#usr/lib/girepository-1.0
|
||||
usr/share/gir-1.0
|
||||
usr/share/glade/catalogs
|
||||
usr/share/pkgconfig
|
||||
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
|
||||
|
|
|
@ -1,25 +1,38 @@
|
|||
usr/include/hedera/hedera.h
|
||||
usr/include/hedera/gvn/*
|
||||
usr/include/hedera/sql/*
|
||||
usr/include/hedera/db/*
|
||||
usr/include/hedera/vn/*
|
||||
usr/include/hedera/vn/field/*
|
||||
usr/include/hedera/vn/column/*
|
||||
usr/lib/hedera/libgvn.a
|
||||
usr/lib/hedera/libgvn.so
|
||||
usr/lib/hedera/libsql.a
|
||||
usr/lib/hedera/libsql.so
|
||||
usr/lib/hedera/libdb.a
|
||||
usr/lib/hedera/libdb.so
|
||||
usr/lib/hedera/libvn.a
|
||||
usr/lib/hedera/libvn.so
|
||||
usr/lib/hedera/libvnfield.a
|
||||
usr/lib/hedera/libvnfield.so
|
||||
usr/lib/hedera/libvncolumn.a
|
||||
usr/lib/hedera/libvncolumn.so
|
||||
usr/lib/x86_64-linux-gnu/libhedera.a
|
||||
usr/lib/x86_64-linux-gnu/libhedera.so
|
||||
usr/lib/x86_64-linux-gnu/hedera/libgvn.a
|
||||
usr/lib/x86_64-linux-gnu/hedera/libgvn.so
|
||||
usr/lib/x86_64-linux-gnu/hedera/libsql.a
|
||||
usr/lib/x86_64-linux-gnu/hedera/libsql.so
|
||||
usr/lib/x86_64-linux-gnu/hedera/libdb.a
|
||||
usr/lib/x86_64-linux-gnu/hedera/libdb.so
|
||||
usr/lib/x86_64-linux-gnu/hedera/libvn.a
|
||||
usr/lib/x86_64-linux-gnu/hedera/libvn.so
|
||||
usr/lib/x86_64-linux-gnu/hedera/libvnfield.a
|
||||
usr/lib/x86_64-linux-gnu/hedera/libvnfield.so
|
||||
usr/lib/x86_64-linux-gnu/hedera/libvncolumn.a
|
||||
usr/lib/x86_64-linux-gnu/hedera/libvncolumn.so
|
||||
usr/lib/x86_64-linux-gnu/pkgconfig/*
|
||||
usr/lib/glade/modules/libgladevn.so
|
||||
usr/lib/girepository-1.0/*
|
||||
#usr/lib/girepository-1.0/*
|
||||
usr/share/gir-1.0/*
|
||||
usr/share/glade/catalogs/*
|
||||
usr/share/pkgconfig/*
|
||||
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/*
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
usr/lib/hedera
|
||||
usr/lib/x86_64-linux-gnu/
|
||||
usr/lib/x86_64-linux-gnu/hedera
|
||||
usr/share/glib-2.0/schemas
|
||||
usr/share/locale/es/LC_MESSAGES
|
||||
usr/share/locale/ca/LC_MESSAGES
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
usr/lib/hedera/libgvn.so.*
|
||||
usr/lib/hedera/libsql.so.*
|
||||
usr/lib/hedera/libdb.so.*
|
||||
usr/lib/hedera/plugin/pg/libdbpg.so
|
||||
usr/lib/hedera/plugin/mysql/libdbmysql.so
|
||||
usr/lib/hedera/libvn.so.*
|
||||
usr/lib/hedera/libvnfield.so.*
|
||||
usr/lib/hedera/libvncolumn.so.*
|
||||
usr/lib/x86_64-linux-gnu/libhedera.so.*
|
||||
usr/lib/x86_64-linux-gnu/hedera/libgvn.so.*
|
||||
usr/lib/x86_64-linux-gnu/hedera/libsql.so.*
|
||||
usr/lib/x86_64-linux-gnu/hedera/libdb.so.*
|
||||
usr/lib/x86_64-linux-gnu/hedera/plugin/pg/libdbpg.so
|
||||
usr/lib/x86_64-linux-gnu/hedera/plugin/mysql/libdbmysql.so
|
||||
usr/lib/x86_64-linux-gnu/hedera/libvn.so.*
|
||||
usr/lib/x86_64-linux-gnu/hedera/libvnfield.so.*
|
||||
usr/lib/x86_64-linux-gnu/hedera/libvncolumn.so.*
|
||||
usr/share/glib-2.0/schemas/*
|
||||
usr/share/locale/es/LC_MESSAGES/hedera.mo
|
||||
usr/share/locale/ca/LC_MESSAGES/hedera.mo
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
set -e
|
||||
|
||||
if [ "$1" = "configure" ]; then
|
||||
ldconfig
|
||||
fi
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
set -e
|
||||
|
||||
if [ "$1" = "remove" ]; then
|
||||
ldconfig
|
||||
fi
|
|
@ -1,5 +0,0 @@
|
|||
?package(hedera):needs="X11" \
|
||||
section="Applications/Office" \
|
||||
title="Hedera" command="hedera" \
|
||||
icon16x16="/usr/share/hedera/vn/image/hedera16x16.xpm" \
|
||||
icon32x32="/usr/share/hedera/vn/image/hedera32x32.xpm"
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
#export DH_VERBOSE=1
|
||||
#export CFLAGS=" -O3 "
|
||||
|
||||
%:
|
||||
dh $@ --with autotools-dev --parallel --builddirectory=debian/build
|
||||
|
@ -15,7 +14,7 @@ override_dh_auto_configure:
|
|||
override_dh_strip:
|
||||
dh_strip --dbg-package=libhedera-dbg
|
||||
|
||||
# Overriden to avoid lintian warnings about postinst/postrm
|
||||
# Overridden to avoid lintian warnings about postinst/postrm
|
||||
.PHONY: override_dh_makeshlibs
|
||||
override_dh_makeshlibs:
|
||||
dh_makeshlibs --noscripts
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
AUTOMAKE_OPTIONS = 1.6
|
||||
|
||||
DOC_MODULE = hedera
|
||||
DOC_MODULE = $(PACKAGE)
|
||||
|
||||
# The top-level SGML file. You can change this if you want to.
|
||||
DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.sgml
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
<para>
|
||||
At this point, you should have a compiled module, this consisting
|
||||
in a folder with the data (images, UI definitions, etc.) of the
|
||||
module along with the dynamic library (a .so file) that the
|
||||
Hedera execution environment (or Hedera application) will link
|
||||
in runtime to load the module. It can also be the single <filename>
|
||||
.so</filename>, due to that may be the module developer has coded
|
||||
the UI creation or may be beacuse both the module and its data were
|
||||
compiled in a single file.
|
||||
module along with the dynamic library (a <filename>.so</filename>
|
||||
file) that Hedera will link in runtime to load the module.
|
||||
There can also be an optional query directory. It can also be the
|
||||
single <filename>.so</filename>, due to that may be the module
|
||||
developer has coded the UI creation or may be beacuse both the
|
||||
module and its data were compiled in a single file.
|
||||
</para>
|
||||
<para>
|
||||
To run the module in the hedera runtime you must set the environment
|
||||
|
@ -50,20 +50,37 @@
|
|||
VN_MODULE_QUERY_PATH that points to <filename>.sql</filename>
|
||||
files. Once these variables are set you'll have to run
|
||||
the Hedera application normally, and it will look for the
|
||||
values on the variables and load the module. In the future there
|
||||
will be another variable that when set to "yes" the module will
|
||||
install and when set to "no" (or not set) the module will just be
|
||||
used as now in the hedera runtime. Note that if you use the Anjuta
|
||||
IDE with the project created by the wizzard, as you run in Anjuta
|
||||
the variables will be automatically set pointing to your project
|
||||
files.
|
||||
</para>
|
||||
<para>
|
||||
If you want to install the module you have to install the <filename>
|
||||
.so</filename> in <filename>/usr/lib/hedera/module</filename> and
|
||||
the <filename>.xml</filename> and any other data to <filename>
|
||||
/usr/share/hedera/module</filename>.
|
||||
values on the variables and load the module. Note that if you use
|
||||
the Anjuta IDE with the project created by the wizzard, as you run
|
||||
in Anjuta the variables will be automatically set pointing to your
|
||||
project files (if the project folder is changed, you'll need to
|
||||
manually reset the variables in Anjuta).
|
||||
</para>
|
||||
</refsection>
|
||||
|
||||
<refsection id="forms">
|
||||
<title>Expected form definition</title>
|
||||
<para>
|
||||
Each module can have any number of forms, that will be compiled
|
||||
inside the same file. Independently from the form functionality,
|
||||
each form needs to offer some things necesary for Hedera to
|
||||
recognize and load it as expected.
|
||||
</para>
|
||||
<para>
|
||||
The main of these requirements is to list the form in the
|
||||
<filename>.xml</filename> file of the module. Also, the interface
|
||||
description file must have the ".glade" extension and contain a
|
||||
GtkContainer with the identifier "main" as the base widget, this
|
||||
widget will be loaded inside a GtkNotebook and will be the first
|
||||
thing the user will see when the form gets loaded. This glade file
|
||||
may also contain a VnBatch with all the models needed by the form
|
||||
and with the identifier "models", every model inside this batch will
|
||||
get its connection set and a GtkActionGroup idenfitied by "actions"
|
||||
containing the actions that will be used in the toolbar and the menu
|
||||
of the main application. To actually get these actions in the
|
||||
toolbar and menu of the application the programmer must provide a
|
||||
file with the extension ".ui" containing a GtkUIManager definition
|
||||
using the actions in the "actions" group.
|
||||
</para>
|
||||
</refsection>
|
||||
</refentry>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsection id="section-who">
|
||||
<refsection id="section-how">
|
||||
<para>
|
||||
This chapter covers how to configure the library from the tarball,
|
||||
if you have received it packed in any other form, like a .deb
|
||||
|
@ -54,14 +54,13 @@
|
|||
to go to the root folder of the library and run the autogen.sh
|
||||
script with the configure options of your choice (listed in the
|
||||
README file of the distribution) e.g. './autogen.sh --enable-vala
|
||||
--prefix=~/installdir' and then run 'make' to compile the library.
|
||||
--prefix=~/installdir' and then run 'make' to build the library.
|
||||
</para>
|
||||
<para>
|
||||
As we do, we highly recommend developers using the Hedera
|
||||
library and also GTK+ or GLib, to use the Anjuta IDE, a very
|
||||
useful and complete free developing environment with a great
|
||||
support and integration for the GObject system and the GNU
|
||||
build system.
|
||||
support and integration for GObject and the GNU build system.
|
||||
</para>
|
||||
</refsection>
|
||||
<refsection id="vala">
|
||||
|
@ -70,7 +69,7 @@
|
|||
The Hedera library supports Vala as programming language. If
|
||||
you will be programming in Vala, you must install the Vala
|
||||
compiler, valac. The only version of Vala supported right now is
|
||||
the 0.16, plans are to be also compatible with newer versions
|
||||
the 0.20, plans are to be also compatible with newer versions
|
||||
too. Note that to build the Vala bindings you'll also need the
|
||||
vapigen tool, which normally installs with the Vala compiler.
|
||||
</para>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -95,6 +95,7 @@
|
|||
<title>DbLib</title>
|
||||
<xi:include href="xml/db-conn.xml"/>
|
||||
<xi:include href="xml/db-model.xml"/>
|
||||
<xi:include href="xml/db-model-holder.xml"/>
|
||||
<xi:include href="xml/db-iterator.xml"/>
|
||||
<xi:include href="xml/db-iter.xml"/>
|
||||
<xi:include href="xml/db-row.xml"/>
|
||||
|
@ -112,7 +113,7 @@
|
|||
<xi:include href="xml/vn-model.xml"/>
|
||||
<xi:include href="xml/vn-grid.xml"/>
|
||||
<xi:include href="xml/vn-handler.xml"/>
|
||||
<xi:include href="xml/vn-builder.xml"/>
|
||||
<xi:include href="xml/vn-batch.xml"/>
|
||||
<xi:include href="xml/vn-field.xml"/>
|
||||
<xi:include href="xml/vn-column.xml"/>
|
||||
</chapter>
|
||||
|
|
|
@ -41,18 +41,16 @@
|
|||
<para>
|
||||
As said before, the Hedera Library comes with an Anjuta project
|
||||
wizzard to help the easy creation of a new Hedera Module on Vala.
|
||||
To include this wizzard to Anjuta 2.31 or grater you can run
|
||||
Anjuta passing the path to the module file as an argument.
|
||||
For previous versions of Anjuta you'll need to unzip the
|
||||
To include this wizzard to Anjuta 2.31 or later you can run
|
||||
Anjuta passing the path to the module file as an argument or drag it
|
||||
over the window when the program is open. This will not only include
|
||||
the module wizzard to Anjuta but will also start the creation of a
|
||||
new module. For previous versions of Anjuta you'll need to unzip the
|
||||
hedera-mod.wiz.tgz file to the corresponding data directory named
|
||||
anjuta/project, placed under ~/.local on most distributions. With
|
||||
the former method Anjuta will do the same by itself. As the
|
||||
the former method, Anjuta will do the same by itself. As the
|
||||
dependancies of the hedera library go beyond these versions, it's
|
||||
most likely that you have a version greater than the 2.31.
|
||||
</para>
|
||||
<para>
|
||||
When Anjuta starts, it will show the wizzard dialog that will
|
||||
guide you in the creation of the module.
|
||||
most likely that you have a version newer than the 2.31.
|
||||
</para>
|
||||
<para>
|
||||
After following the wizzard, you'll have a clean Hedera Module,
|
||||
|
@ -73,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>
|
||||
|
|
|
@ -20,11 +20,13 @@
|
|||
<title>Custom modules</title>
|
||||
<para>
|
||||
To run your own modules you need to install them in the
|
||||
search directories of Hedera, these are ${libdir}/hedera/module
|
||||
for the binary objects (.so files) and ${datadir}/hedera/module
|
||||
for additional data, thus the GUI files and the configuration file
|
||||
and also, optionally any additional data you want to add to your
|
||||
module should be here.
|
||||
search directories of Hedera. You can use pkg-config to know where
|
||||
these directories actually are in your installation:
|
||||
<programlisting>
|
||||
$ pkg-config --variable=modulelibdir hedera
|
||||
$ pkg-config --variable=moduledatadir hedera
|
||||
$ pkg-config --variable=modulequerydir hedera
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
It is also possible to put your files in any other path and tell
|
||||
|
@ -32,14 +34,19 @@
|
|||
environment variables before executing Hedera: VN_MODULE_LIB_PATH,
|
||||
the list of directories put in this variable will be used to look
|
||||
for the binary files of the module; VN_MODULE_DATA_PATH, this list
|
||||
of directories must hold the path to the data of the module.
|
||||
of directories must hold the path to the data of the module;
|
||||
VN_MODULE_QUERY_PATH, this variable is not always needed, but if the
|
||||
module has any form that uses a file to pass the SQL queries to the
|
||||
database, this file has to be under a directory named after the
|
||||
module, this directoy has to be inside one of the paths listed in
|
||||
this variable.
|
||||
</para>
|
||||
<title>Example modules</title>
|
||||
<para>
|
||||
Once you've succesfully compiled the library you can try and
|
||||
run some of the provided modules (some of wich you can write
|
||||
run some of the provided modules (some of which you can write
|
||||
by yourself following the tutorials included in this manual).
|
||||
If the installation went as expected you'll just need to
|
||||
If the installation went as expected, you'll just need to
|
||||
run the Hedera executable. The executable will be in the
|
||||
"bin" directory of the installation tree. If you installed the
|
||||
library in a folder that is included in the PATH environment
|
||||
|
|
|
@ -4,18 +4,30 @@ gladevn_lib_LTLIBRARIES = libgladevn.la
|
|||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(gladeui_CFLAGS)
|
||||
$(gladeui_CFLAGS) \
|
||||
$(DEFINES) \
|
||||
$(gtksourceview_CFLAGS)
|
||||
libgladevn_la_LIBADD = \
|
||||
$(top_builddir)/vn/libvn.la \
|
||||
$(gladeui_LIBS)
|
||||
$(gladeui_LIBS) \
|
||||
$(gtksourceview_LIBS)
|
||||
libgladevn_la_LDFLAGS = -avoid-version
|
||||
libgladevn_la_SOURCES = \
|
||||
glade-vn.h \
|
||||
glade-vn.c \
|
||||
glade-vn-batch.c
|
||||
glade-vn-batch.c \
|
||||
glade-db-sql.c \
|
||||
glade-db-model.c \
|
||||
glade-db-iterator.c
|
||||
|
||||
gladevn_data_DATA = vn.xml
|
||||
|
||||
if HAVE_SOURCEVIEW
|
||||
DEFINES = -D_HAVE_GTKSOURCEVIEW
|
||||
else
|
||||
DEFINES =
|
||||
endif
|
||||
|
||||
EXTRA_DIST = $(gladevn_data_DATA)
|
||||
|
||||
install-data-hook:
|
||||
|
|
|
@ -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));
|
||||
}
|
|
@ -0,0 +1,366 @@
|
|||
/*
|
||||
* 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"
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++ DbModel GladeEditorProperty
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GladeEditorProperty parent;
|
||||
|
||||
GtkWidget * button;
|
||||
GtkWidget * entry;
|
||||
gboolean connected;
|
||||
GladeWidget * widget;
|
||||
}
|
||||
GladeEPropModel;
|
||||
|
||||
GLADE_MAKE_EPROP (GladeEPropModel, glade_eprop_model)
|
||||
#define GLADE_TYPE_EPROP_MODEL (glade_eprop_model_get_type())
|
||||
#define GLADE_EPROP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_MODEL, GladeEPropModel))
|
||||
#define GLADE_EPROP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_MODEL, GladeEPropModelClass))
|
||||
#define GLADE_IS_EPROP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_MODEL))
|
||||
#define GLADE_IS_EPROP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_EPROP_MODEL))
|
||||
#define GLADE_EPROP_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_EPROP_MODEL, GladeEPropModelClass))
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
static GladeWidget * glade_model_create (GladeProperty * prop)
|
||||
{
|
||||
gboolean use = FALSE;
|
||||
VnBatch * batch;
|
||||
GladeWidget * batch_w;
|
||||
GladeProject * project = glade_widget_get_project (glade_property_get_widget (prop));
|
||||
const GList * l, * n, * objects = glade_project_get_objects (project);
|
||||
|
||||
for (n = objects; n; n = n->next)
|
||||
if (VN_IS_BATCH (n->data))
|
||||
{
|
||||
batch = n->data;
|
||||
use = TRUE;
|
||||
|
||||
for (l = vn_batch_get_objects (batch); l; l = l->next)
|
||||
if (!DB_IS_MODEL (l->data))
|
||||
{
|
||||
use = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (use)
|
||||
break;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return glade_command_create
|
||||
(glade_widget_adaptor_get_by_type (DB_TYPE_MODEL), batch_w, NULL, project);
|
||||
}
|
||||
|
||||
/*
|
||||
* glade_eprop_model_show_dialog:
|
||||
* @button:(allow-none): a #GtkButton or @NULL
|
||||
* @object: a #GladeEditorPropery or a #GladeWidget
|
||||
*
|
||||
* Opens a dialog to edit a #DbModel.
|
||||
* Can be called by a #GladeEditorProperty or by the "edit" action of a
|
||||
* #GladeWidgetAdaptor directly (in which case @button is %NULL and @obj is a
|
||||
* #GladeWidget).
|
||||
**/
|
||||
static void glade_eprop_model_show_dialog (GtkButton * button, GObject * object)
|
||||
{
|
||||
gboolean created = FALSE;
|
||||
GObject * o;
|
||||
GtkWidget * box;
|
||||
GtkDialog * dialog;
|
||||
GladeWidget * widget;
|
||||
GladeWidgetAdaptor * adaptor;
|
||||
GladeEditable * editor;
|
||||
GladeProperty * p = NULL;
|
||||
GladeEditorProperty * eprop = NULL;
|
||||
|
||||
if (GLADE_IS_EDITOR_PROPERTY (object))
|
||||
{
|
||||
eprop = GLADE_EDITOR_PROPERTY (object);
|
||||
p = glade_editor_property_get_property (eprop);
|
||||
o = g_value_get_object (glade_property_inline_value (p));
|
||||
|
||||
if (o && DB_IS_MODEL (o))
|
||||
widget = glade_widget_get_from_gobject (o);
|
||||
else
|
||||
{
|
||||
GValue val = G_VALUE_INIT;
|
||||
|
||||
glade_command_push_group
|
||||
(_("Create and set a model for a DbModelHolder"));
|
||||
|
||||
widget = glade_model_create (p);
|
||||
created = TRUE;
|
||||
g_value_init (&val, DB_TYPE_MODEL);
|
||||
g_value_set_object (&val, glade_widget_get_object (widget));
|
||||
glade_command_set_property_value (p, &val);
|
||||
g_value_unset (&val);
|
||||
|
||||
glade_command_pop_group ();
|
||||
|
||||
glade_project_selection_set (glade_widget_get_project (widget),
|
||||
glade_widget_get_object (glade_property_get_widget (p)),
|
||||
TRUE);
|
||||
|
||||
if (!GLADE_EPROP_MODEL (eprop)->connected)
|
||||
{
|
||||
g_signal_connect (glade_widget_get_project
|
||||
(glade_property_get_widget (p)), "widget-name-changed",
|
||||
G_CALLBACK (glade_eprop_model_name_changed), eprop);
|
||||
GLADE_EPROP_MODEL (eprop)->connected = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
widget = GLADE_WIDGET (object);
|
||||
|
||||
adaptor = glade_widget_get_adaptor (widget);
|
||||
editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
|
||||
glade_editable_load (editor, widget);
|
||||
|
||||
dialog = GTK_DIALOG (gtk_dialog_new_with_buttons
|
||||
(eprop ? _("Model configuration") : _("DbModel properties configuration")
|
||||
,GTK_WINDOW (glade_app_get_window ())
|
||||
,GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT
|
||||
,GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL
|
||||
,GTK_STOCK_CLEAR, GTK_RESPONSE_REJECT
|
||||
,GTK_STOCK_OK, GTK_RESPONSE_OK
|
||||
,NULL
|
||||
));
|
||||
gtk_dialog_set_alternative_button_order (dialog,
|
||||
GTK_RESPONSE_OK, GTK_RESPONSE_REJECT, GTK_RESPONSE_CANCEL, -1);
|
||||
gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
|
||||
|
||||
if (!eprop)
|
||||
gtk_widget_hide (gtk_dialog_get_widget_for_response
|
||||
(dialog, GTK_RESPONSE_REJECT));
|
||||
|
||||
box = gtk_alignment_new (0,0,1,1);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (box), 8, 8, 8, 8);
|
||||
gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (editor));
|
||||
gtk_widget_show_all (box);
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)),
|
||||
box, TRUE, TRUE, 0);
|
||||
|
||||
switch (gtk_dialog_run (dialog))
|
||||
{
|
||||
case GTK_RESPONSE_OK:
|
||||
{
|
||||
if (eprop)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (GLADE_EPROP_MODEL (eprop)->entry),
|
||||
glade_widget_get_name (widget));
|
||||
GLADE_EPROP_MODEL (eprop)->widget = widget;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case GTK_RESPONSE_REJECT:
|
||||
{
|
||||
if (eprop)
|
||||
{
|
||||
glade_command_set_property (p, NULL);
|
||||
GLADE_EPROP_MODEL (eprop)->widget = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
{
|
||||
if (created)
|
||||
{
|
||||
GList * list = g_list_append (NULL, widget);
|
||||
GladeWidget * batch = glade_widget_get_parent (widget);
|
||||
|
||||
if (vn_batch_get_length
|
||||
VN_BATCH (glade_widget_get_object (batch)) == 1)
|
||||
list = g_list_prepend (list, batch);
|
||||
|
||||
glade_command_delete (list);
|
||||
g_list_free (list);
|
||||
GLADE_EPROP_MODEL (eprop)->widget = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
}
|
||||
|
||||
static void glade_eprop_model_show_object_dialog (GtkButton * button,
|
||||
GladeEditorProperty * eprop)
|
||||
{
|
||||
GladeProperty * p = glade_editor_property_get_property (eprop);
|
||||
// Widget to which the property belongs (e.g. Model Holder)
|
||||
GladeWidget * widget = glade_property_get_widget (p);
|
||||
GladeProject * project = glade_widget_get_project (widget);
|
||||
GObject * object = g_value_get_object (glade_property_inline_value (p));
|
||||
// Widget representing the property itself (i.e. DbModel)
|
||||
widget = object ? glade_widget_get_from_gobject (object) : NULL;
|
||||
GLADE_EPROP_MODEL (eprop)->widget = widget;
|
||||
|
||||
if (glade_editor_property_show_object_dialog (project,
|
||||
_("Select a DbModel for the property"), NULL,
|
||||
DB_TYPE_MODEL, NULL, &widget))
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
GValue val = G_VALUE_INIT;
|
||||
g_value_init (&val, DB_TYPE_MODEL);
|
||||
g_value_set_object (&val, glade_widget_get_object (widget));
|
||||
glade_command_set_property_value (p, &val);
|
||||
g_value_unset (&val);
|
||||
}
|
||||
else
|
||||
glade_command_set_property (p, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget * glade_eprop_model_create_input (GladeEditorProperty * eprop)
|
||||
{
|
||||
GtkWidget * hbox, * box, * object_button;
|
||||
GladeEPropModel * obj = GLADE_EPROP_MODEL (eprop);
|
||||
|
||||
obj->button = gtk_button_new_with_label (_("New Model"));
|
||||
g_signal_connect (G_OBJECT (obj->button), "clicked",
|
||||
G_CALLBACK (glade_eprop_model_show_dialog), eprop);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
obj->entry = gtk_entry_new ();
|
||||
gtk_editable_set_editable (GTK_EDITABLE (obj->entry), FALSE);
|
||||
gtk_widget_set_hexpand (obj->entry, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), obj->entry);
|
||||
|
||||
object_button = gtk_button_new_with_label ("...");
|
||||
gtk_container_add (GTK_CONTAINER (hbox), object_button);
|
||||
g_signal_connect (G_OBJECT (object_button), "clicked",
|
||||
G_CALLBACK (glade_eprop_model_show_object_dialog), eprop);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (box), hbox);
|
||||
gtk_container_add (GTK_CONTAINER (box), obj->button);
|
||||
gtk_widget_show_all (box);
|
||||
|
||||
obj->widget = NULL;
|
||||
/* project = glade_widget_get_project (glade_property_get_widget
|
||||
(glade_editor_property_get_property (eprop)));
|
||||
*/
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
static void glade_eprop_model_load (GladeEditorProperty * eprop, GladeProperty * property)
|
||||
{
|
||||
gchar * label;
|
||||
const gchar * text;
|
||||
GObject * object;
|
||||
GladeEditorPropertyClass * parent_class =
|
||||
g_type_class_peek_parent (GLADE_EDITOR_PROPERTY_GET_CLASS (eprop));
|
||||
parent_class->load (eprop, property);
|
||||
|
||||
if (property == NULL)
|
||||
return;
|
||||
|
||||
if ((object = g_value_get_object (glade_property_inline_value (property))))
|
||||
{
|
||||
label = _("Edit Model");
|
||||
text = glade_widget_get_name (glade_widget_get_from_gobject (object));
|
||||
}
|
||||
else
|
||||
{
|
||||
label = _("New Model");
|
||||
text = "";
|
||||
}
|
||||
|
||||
gtk_button_set_label (GTK_BUTTON (GLADE_EPROP_MODEL (eprop)->button), label);
|
||||
gtk_entry_set_text (GTK_ENTRY (GLADE_EPROP_MODEL (eprop)->entry), text);
|
||||
}
|
||||
|
||||
static void glade_eprop_model_finalize (GObject * object)
|
||||
{
|
||||
GObjectClass * parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (object));
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ DbModel Action Callback
|
||||
|
||||
void glade_db_model_action_activate (GladeWidgetAdaptor * adaptor,
|
||||
DbModel * model, const gchar * path)
|
||||
{
|
||||
glade_eprop_model_show_dialog (NULL,
|
||||
(GObject *) glade_widget_get_from_gobject (model));
|
||||
}
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++ DbModelHolder GladeWidgetAdaptor
|
||||
|
||||
GladeEditorProperty * glade_db_model_holder_create_eprop (GladeWidgetAdaptor * adaptor,
|
||||
GladePropertyClass * klass, gboolean use_command)
|
||||
{
|
||||
GladeEditorProperty * eprop;
|
||||
GParamSpec * pspec = glade_property_class_get_pspec (klass);
|
||||
|
||||
if (pspec->value_type == DB_TYPE_MODEL)
|
||||
{
|
||||
eprop = g_object_new (GLADE_TYPE_EPROP_MODEL,
|
||||
"property-class", klass,
|
||||
"use-command", use_command, NULL);
|
||||
}
|
||||
else
|
||||
eprop = GWA_GET_CLASS (G_TYPE_OBJECT)->create_eprop (adaptor, klass, use_command);
|
||||
|
||||
return eprop;
|
||||
}
|
||||
|
||||
void glade_db_model_write_widget (GladeWidgetAdaptor * adaptor,
|
||||
GladeWidget * widget, GladeXmlContext * context, GladeXmlNode * node)
|
||||
{
|
||||
GladeProperty * prop;
|
||||
|
||||
if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
|
||||
return;
|
||||
|
||||
prop = glade_widget_get_property (widget, "use-file");
|
||||
glade_property_write (prop, context, node);
|
||||
|
||||
prop = glade_widget_get_property (widget, "sql");
|
||||
glade_property_write (prop, context, node);
|
||||
|
||||
GWA_GET_CLASS (G_TYPE_OBJECT)->write_widget (adaptor, widget, context, node);
|
||||
}
|
|
@ -0,0 +1,231 @@
|
|||
/*
|
||||
* 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"
|
||||
|
||||
#ifdef _HAVE_GTKSOURCEVIEW
|
||||
#include <gtksourceview/gtksourceview.h>
|
||||
#include <gtksourceview/gtksourcebuffer.h>
|
||||
#include <gtksourceview/gtksourcelanguage.h>
|
||||
#include <gtksourceview/gtksourcelanguagemanager.h>
|
||||
#endif
|
||||
|
||||
#define NEW_SQL _("New SQL statement")
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ GladeEPropSql
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GladeEditorProperty parent;
|
||||
|
||||
GtkWidget * button;
|
||||
GtkWidget * entry;
|
||||
gint width;
|
||||
gint height;
|
||||
}
|
||||
GladeEPropSql;
|
||||
|
||||
GLADE_MAKE_EPROP (GladeEPropSql, glade_eprop_sql)
|
||||
#define GLADE_TYPE_EPROP_SQL (glade_eprop_sql_get_type())
|
||||
#define GLADE_EPROP_SQL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_EPROP_SQL, GladeEPropSql))
|
||||
#define GLADE_EPROP_SQL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_EPROP_SQL, GladeEPropSqlClass))
|
||||
#define GLADE_IS_EPROP_SQL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_EPROP_SQL))
|
||||
#define GLADE_IS_EPROP_SQL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_EPROP_SQL))
|
||||
#define GLADE_EPROP_SQL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_EPROP_SQL, GladeEPropSqlClass))
|
||||
|
||||
static void glade_eprop_sql_show_dialog (GtkButton * button, GladeEditorProperty * eprop)
|
||||
{
|
||||
gpointer text, buffer;
|
||||
const gchar * sql;
|
||||
GladeEPropSql * obj = GLADE_EPROP_SQL (eprop);
|
||||
PangoFontDescription * font;
|
||||
GtkWidget * scroll;
|
||||
GladeProperty * p = glade_editor_property_get_property (eprop);
|
||||
GtkDialog * dialog = GTK_DIALOG (gtk_dialog_new_with_buttons
|
||||
(_("SQL Editor")
|
||||
,GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (eprop)))
|
||||
,GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT
|
||||
,GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL
|
||||
,GTK_STOCK_CLEAR, GTK_RESPONSE_REJECT
|
||||
,GTK_STOCK_OK, GTK_RESPONSE_OK
|
||||
,NULL
|
||||
));
|
||||
|
||||
gtk_dialog_set_alternative_button_order (dialog,
|
||||
GTK_RESPONSE_OK, GTK_RESPONSE_REJECT, GTK_RESPONSE_CANCEL, -1);
|
||||
gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), obj->width, obj->height);
|
||||
|
||||
scroll = gtk_scrolled_window_new (gtk_adjustment_new (0,0,0,0,0,0),
|
||||
gtk_adjustment_new (0,0,0,0,0,0));
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
|
||||
gtk_widget_set_margin_top (scroll, 6);
|
||||
gtk_widget_set_margin_right (scroll, 6);
|
||||
gtk_widget_set_margin_bottom (scroll, 6);
|
||||
gtk_widget_set_margin_left (scroll, 6);
|
||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)),
|
||||
scroll, TRUE, TRUE, 6);
|
||||
|
||||
#ifdef _HAVE_GTKSOURCEVIEW
|
||||
GtkSourceLanguageManager * lm = gtk_source_language_manager_new ();
|
||||
GtkSourceLanguage * lang = gtk_source_language_manager_get_language (lm, "sql");
|
||||
text = gtk_source_view_new ();
|
||||
gtk_source_view_set_tab_width (text, 4);
|
||||
gtk_source_view_set_show_line_numbers (text, TRUE);
|
||||
gtk_source_view_set_highlight_current_line (text, TRUE);
|
||||
buffer = gtk_text_view_get_buffer (text);
|
||||
gtk_source_buffer_set_language (buffer, lang);
|
||||
gtk_source_buffer_set_highlight_matching_brackets (buffer, TRUE);
|
||||
#else
|
||||
text = gtk_text_view_new ();
|
||||
buffer = gtk_text_view_get_buffer (text);
|
||||
#endif
|
||||
|
||||
font = pango_font_description_from_string ("Monospace");
|
||||
gtk_widget_override_font (text, font);
|
||||
pango_font_description_free (font);
|
||||
|
||||
sql = g_value_get_string (glade_property_inline_value (p));
|
||||
|
||||
if (sql)
|
||||
gtk_text_buffer_set_text (buffer, sql, -1);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (scroll), text);
|
||||
gtk_widget_show_all (scroll);
|
||||
|
||||
switch (gtk_dialog_run (dialog))
|
||||
{
|
||||
case GTK_RESPONSE_OK:
|
||||
{
|
||||
GValue val = G_VALUE_INIT;
|
||||
GtkTextIter * start = g_new (GtkTextIter, 1),
|
||||
* end = g_new (GtkTextIter, 1);
|
||||
g_value_init (&val, G_TYPE_STRING);
|
||||
gtk_text_buffer_get_bounds (buffer, start, end);
|
||||
|
||||
sql = gtk_text_buffer_get_text (buffer, start, end, TRUE);
|
||||
g_value_set_string (&val, sql);
|
||||
glade_command_set_property_value (p, &val);
|
||||
|
||||
g_value_unset (&val);
|
||||
g_free (start);
|
||||
g_free (end);
|
||||
break;
|
||||
}
|
||||
case GTK_RESPONSE_REJECT:
|
||||
{
|
||||
GValue val = G_VALUE_INIT;
|
||||
g_value_init (&val, G_TYPE_STRING);
|
||||
g_value_set_string (&val, "");
|
||||
glade_command_set_property_value (p, &val);
|
||||
g_value_unset (&val);
|
||||
break;
|
||||
}
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
obj->width = gtk_widget_get_allocated_width (GTK_WIDGET (dialog));
|
||||
obj->height = gtk_widget_get_allocated_height (GTK_WIDGET (dialog));
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
}
|
||||
|
||||
static void glade_eprop_sql_entry_text_changed (GtkEntry * entry,
|
||||
GladeEditorProperty * eprop)
|
||||
{
|
||||
const gchar * text = gtk_entry_get_text (entry);
|
||||
GladeProperty * p = glade_editor_property_get_property (eprop);
|
||||
|
||||
if (text)
|
||||
{
|
||||
GValue val = G_VALUE_INIT;
|
||||
g_value_init (&val, G_TYPE_STRING);
|
||||
g_value_set_string (&val, text);
|
||||
|
||||
glade_command_set_property_value (p, &val);
|
||||
|
||||
g_value_unset (&val);
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget * glade_eprop_sql_create_input (GladeEditorProperty * eprop)
|
||||
{
|
||||
GladeEPropSql * obj = GLADE_EPROP_SQL (eprop);
|
||||
GtkWidget * box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
obj->entry = gtk_entry_new ();
|
||||
gtk_widget_set_hexpand (obj->entry, TRUE);
|
||||
g_signal_connect (obj->entry, "changed",
|
||||
G_CALLBACK (glade_eprop_sql_entry_text_changed), obj);
|
||||
gtk_container_add (GTK_CONTAINER (box), obj->entry);
|
||||
|
||||
obj->button = gtk_button_new_with_label ("...");
|
||||
g_signal_connect (obj->button, "clicked",
|
||||
G_CALLBACK (glade_eprop_sql_show_dialog), obj);
|
||||
gtk_widget_set_tooltip_text (obj->button, _("Open the SQL Editor"));
|
||||
gtk_container_add (GTK_CONTAINER (box), obj->button);
|
||||
|
||||
gtk_widget_show_all (box);
|
||||
|
||||
obj->width = 750;
|
||||
obj->height = 550;
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
static void glade_eprop_sql_load (GladeEditorProperty * eprop, GladeProperty * property)
|
||||
{
|
||||
const gchar * sql;
|
||||
GladeEPropSql * obj = GLADE_EPROP_SQL (eprop);
|
||||
|
||||
GladeEditorPropertyClass * parent_class =
|
||||
g_type_class_peek_parent (GLADE_EDITOR_PROPERTY_GET_CLASS (eprop));
|
||||
parent_class->load (eprop, property);
|
||||
|
||||
if (!property)
|
||||
return;
|
||||
|
||||
if ((sql = g_value_get_string (glade_property_inline_value (property))))
|
||||
gtk_entry_set_text (GTK_ENTRY (obj->entry), sql);
|
||||
}
|
||||
|
||||
static void glade_eprop_sql_finalize (GObject * object)
|
||||
{
|
||||
GObjectClass * parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (object));
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++ DbModel GladeWidgetAdaptor
|
||||
|
||||
GladeEditorProperty * glade_db_sql_create_eprop (GladeWidgetAdaptor * adaptor,
|
||||
GladePropertyClass * klass, gboolean use_command)
|
||||
{
|
||||
GladeEditorProperty * eprop;
|
||||
GParamSpec * pspec = glade_property_class_get_pspec (klass);
|
||||
|
||||
if (!g_strcmp0 (pspec->name, "sql"))
|
||||
{
|
||||
eprop = g_object_new (GLADE_TYPE_EPROP_SQL,
|
||||
"property-class", klass,
|
||||
"use-command", use_command, NULL);
|
||||
}
|
||||
else
|
||||
eprop = GWA_GET_CLASS (G_TYPE_OBJECT)->create_eprop (adaptor, klass, use_command);
|
||||
|
||||
return eprop;
|
||||
}
|
|
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -65,5 +65,5 @@ void glade_vn_batch_replace_child (GladeWidgetAdaptor * adaptor,
|
|||
GList * glade_vn_batch_get_children (GladeWidgetAdaptor * adaptor,
|
||||
VnBatch * group)
|
||||
{
|
||||
return vn_batch_get_objects (group);
|
||||
return vn_batch_get_objects_list (group);
|
||||
}
|
||||
|
|
107
glade/vn.xml
107
glade/vn.xml
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<glade-catalog name="vn" library="gladevn" since="1.0" domain="glade3" depends="gtk+" book="hedera">
|
||||
<glade-catalog name="vn" version="1.0" library="gladevn" domain="glade3" depends="gtk+" book="hedera">
|
||||
|
||||
<init-function>glade_vn_init</init-function>
|
||||
|
||||
<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"/>
|
||||
|
@ -16,21 +16,46 @@
|
|||
<glade-widget-class name="DbModel" generic-name="model" title="Data Model" icon-name="widget-gtk-liststore">
|
||||
<properties>
|
||||
<property id="conn" ignore="True" disabled="True"/>
|
||||
<property id="sql" ignore="True"/>
|
||||
<property id="stmt" ignore="True" disabled="True"/>
|
||||
<property save="False" weight="1.2" id="use-file" ignore="True"/>
|
||||
<property save="False" weight="1.3" id="sql" ignore="True"/>
|
||||
</properties>
|
||||
<actions>
|
||||
<action important="True" id="launch_editor" name="Edit…" 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="conn" ignore="True" disabled="True"/>
|
||||
<property id="sql" ignore="True"/>
|
||||
<property id="model" ignore="True">
|
||||
<parameter-spec>
|
||||
<type>GParamObject</type>
|
||||
<value-type>DbModel</value-type>
|
||||
</parameter-spec>
|
||||
</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…" 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>
|
||||
|
||||
|
@ -47,27 +72,37 @@
|
|||
<glade-widget-class name="VnGrid" generic-name="grid" title="Grid" icon-name="widget-gtk-treeview">
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="VnColumnCheck" generic-name="column-check" title="Column Check" icon-name="widget-gtk-checkbutton"/>
|
||||
<glade-widget-class name="VnColumnEntry" generic-name="column-entry" title="Column Entry" icon-name="widget-gtk-entry"/>
|
||||
<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-spinbutton">
|
||||
<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>
|
||||
|
||||
<glade-widget-class name="VnColumnCombo" generic-name="column-combo" title="Column Combo" icon-name="widget-gtk-combobox">
|
||||
<glade-widget-class name="VnColumnCombo" generic-name="column-combo" title="Column Combo" icon-name="widget-gtk-cellrenderercombo">
|
||||
<properties>
|
||||
<property id="conn" ignore="True" disabled="True"/>
|
||||
<property id="sql" ignore="True"/>
|
||||
<property id="show-column" weight="1.2"/>
|
||||
<property id="sort-column" weight="1.3"/>
|
||||
<property id="model" ignore="True">
|
||||
<parameter-spec>
|
||||
<type>GParamObject</type>
|
||||
<value-type>DbModel</value-type>
|
||||
</parameter-spec>
|
||||
</property>
|
||||
</properties>
|
||||
<create-editor-property-function>glade_db_model_holder_create_eprop</create-editor-property-function>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="VnColumnImage" generic-name="column-image" title="Column Image" icon-name="widget-gtk-image">
|
||||
<glade-widget-class name="VnColumnImage" generic-name="column-image" title="Column Image" icon-name="widget-gtk-cellrendererpixbuf">
|
||||
<properties>
|
||||
<property id="host" ignore="True" weight="0"/>
|
||||
<property id="path" ignore="True" weight="1"/>
|
||||
<property id="host" ignore="True"/>
|
||||
<property id="path" ignore="True"/>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
|
@ -79,17 +114,31 @@
|
|||
|
||||
<glade-widget-class name="VnCombo" generic-name="combo" title="Combo Box Field" icon-name="widget-gtk-combobox">
|
||||
<properties>
|
||||
<property id="conn" ignore="True" disabled="True"/>
|
||||
<property id="sql" ignore="True"/>
|
||||
<property id="model" ignore="True">
|
||||
<parameter-spec>
|
||||
<type>GParamObject</type>
|
||||
<value-type>DbModel</value-type>
|
||||
</parameter-spec>
|
||||
</property>
|
||||
<!-- This is used to avoid weird error about this unexisting property -->
|
||||
<property id="accelerator" disabled="True"/>
|
||||
</properties>
|
||||
<create-editor-property-function>glade_db_model_holder_create_eprop</create-editor-property-function>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="VnCompletion" generic-name="completion" title="Completion Field" icon-name="widget-gtk-entry">
|
||||
<properties>
|
||||
<property id="conn" ignore="True" disabled="True"/>
|
||||
<property id="sql" ignore="True"/>
|
||||
<property id="model" ignore="True">
|
||||
<parameter-spec>
|
||||
<type>GParamObject</type>
|
||||
<value-type>DbModel</value-type>
|
||||
</parameter-spec>
|
||||
</property>
|
||||
<property id="field" ignore="True"/>
|
||||
<!-- This is used to avoid weird error about this unexisting property -->
|
||||
<property id="accelerator" disabled="True"/>
|
||||
</properties>
|
||||
<create-editor-property-function>glade_db_model_holder_create_eprop</create-editor-property-function>
|
||||
</glade-widget-class>
|
||||
|
||||
<glade-widget-class name="VnHttpImage" generic-name="http-image" title="Image retrieved by HTTP" icon-name="widget-gtk-image">
|
||||
|
@ -110,22 +159,21 @@
|
|||
<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>
|
||||
|
||||
<glade-widget-group name="db-toplevels" title="Data Handling">
|
||||
<glade-widget-class-ref name="VnBatch"/>
|
||||
<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>
|
||||
|
||||
<glade-widget-group name="vn-toplevels" title="Grid and Columns">
|
||||
<glade-widget-group name="vn-toplevels" title="Grid and Columns" weight="1000">
|
||||
<glade-widget-class-ref name="VnGrid"/>
|
||||
<glade-widget-class-ref name="VnColumnCheck"/>
|
||||
<glade-widget-class-ref name="VnColumnCombo"/>
|
||||
|
@ -134,7 +182,8 @@
|
|||
<glade-widget-class-ref name="VnColumnSpin"/>
|
||||
</glade-widget-group>
|
||||
|
||||
<glade-widget-group name="vn-toplevels" title="Data Widgets">
|
||||
<glade-widget-group name="vn-toplevels" title="Data Widgets" weight="0">
|
||||
<glade-widget-class-ref name="VnBatch"/>
|
||||
<glade-widget-class-ref name="VnHandler"/>
|
||||
<glade-widget-class-ref name="VnEntry"/>
|
||||
<glade-widget-class-ref name="VnCheck"/>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@/hedera
|
||||
includedir=@includedir@/hedera
|
||||
libdir=@libdir@/@PACKAGE@
|
||||
includedir=@includedir@/@PACKAGE@
|
||||
|
||||
Name: Gvn
|
||||
Description: Utility Module for Hedera Library
|
||||
Version: @VERSION@
|
||||
Requires: glib-2.0 gobject-2.0
|
||||
Libs: -L${libdir} -lgvn
|
||||
Cflags: -I${includedir}/gvn
|
||||
Cflags: -I${includedir}
|
||||
|
|
|
@ -6,13 +6,29 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir) \
|
||||
$(gtk_CFLAGS) \
|
||||
-D_HEDERA_LOCALE_DIR=\"$(datadir)/locale\"
|
||||
hedera_bin_LDFLAGS = -Wl,--export-dynamic
|
||||
hedera_bin_LDFLAGS = -export-dynamic
|
||||
hedera_bin_SOURCES = main.c
|
||||
hedera_bin_LDADD = \
|
||||
$(gtk_LIBS) \
|
||||
$(top_builddir)/gvn/libgvn.la \
|
||||
$(top_builddir)/db/libdb.la \
|
||||
$(top_builddir)/vn/libvn.la
|
||||
|
||||
libhedera_lib_LTLIBRARIES = libhedera.la
|
||||
|
||||
if ENABLE_INSTALL
|
||||
libhedera_libdir = $(libdir)
|
||||
else
|
||||
libhedera_libdir = $(abs_top_builddir)/main
|
||||
endif
|
||||
|
||||
libhedera_includedir = $(hedera_includedir)
|
||||
libhedera_include_HEADERS = hedera.h
|
||||
libhedera_la_SOURCES = $(libhedera_includedir_HEADERS)
|
||||
libhedera_la_LDFLAGS = -version-info $(VERSION_INFO)
|
||||
libhedera_la_LIBADD = $(top_builddir)/vn/libvn.la
|
||||
|
||||
|
||||
SCRIPT = $(top_srcdir)/main/hedera.sh.in
|
||||
hedera_bin_SCRIPTS = hedera
|
||||
$(hedera_bin_SCRIPTS): $(SCRIPT)
|
||||
|
@ -21,12 +37,8 @@ $(hedera_bin_SCRIPTS): $(SCRIPT)
|
|||
|
||||
pkgconfig_DATA = hedera.pc
|
||||
|
||||
desktop_DATA = vn-hedera.desktop
|
||||
|
||||
HOST=verdnatura.es
|
||||
certdir = $(datadir)/ca-certificates/$(HOST)
|
||||
cert_DATA = cacert.pem
|
||||
syscertdir = $(sysconfdir)/ssl/certs
|
||||
desktop_DATA = \
|
||||
vn-hedera.desktop
|
||||
|
||||
man_MANS = hedera.1
|
||||
|
||||
|
@ -37,9 +49,5 @@ EXTRA_DIST = \
|
|||
DISTCLEANFILES = \
|
||||
$(hedera_bin_SCRIPTS) \
|
||||
hedera.pc \
|
||||
vn-hedera.desktop
|
||||
|
||||
install-data-hook:
|
||||
mkdir -p $(DESTDIR)$(syscertdir)
|
||||
(cd $(DESTDIR)$(syscertdir) && \
|
||||
$(LN_S) -f $(DESTDIR)$(certdir)/$(cert_DATA) $(HOST).pem)
|
||||
vn-hedera.desktop \
|
||||
vn-hedera-debug.desktop
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIEQzCCAyugAwIBAgIJAJimL+J4jUaQMA0GCSqGSIb3DQEBBQUAMIG2MQswCQYD
|
||||
VQQGEwJFUzEdMBsGA1UECAwUQ29tdW5pZGFkIFZhbGVuY2lhbmExETAPBgNVBAcM
|
||||
CFZhbGVuY2lhMR4wHAYDVQQKDBVWZXJkbmF0dXJhIExldmFudGUgU0wxFDASBgNV
|
||||
BAsMC0luZm9ybWF0aWNhMRYwFAYDVQQDDA12ZXJkbmF0dXJhLmVzMScwJQYJKoZI
|
||||
hvcNAQkBFhhob3N0bWFzdGVyQHZlcmRuYXR1cmEuZXMwIBcNMTMwNjExMTE1MjQ1
|
||||
WhgPMjA2MzA1MzAxMTUyNDVaMIG2MQswCQYDVQQGEwJFUzEdMBsGA1UECAwUQ29t
|
||||
dW5pZGFkIFZhbGVuY2lhbmExETAPBgNVBAcMCFZhbGVuY2lhMR4wHAYDVQQKDBVW
|
||||
ZXJkbmF0dXJhIExldmFudGUgU0wxFDASBgNVBAsMC0luZm9ybWF0aWNhMRYwFAYD
|
||||
VQQDDA12ZXJkbmF0dXJhLmVzMScwJQYJKoZIhvcNAQkBFhhob3N0bWFzdGVyQHZl
|
||||
cmRuYXR1cmEuZXMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsqq+h
|
||||
1kUfZE19Inm3M2XF1ytIqXeIsXsiZ5T9aVdedQrF2xcVOr4dvJyE5zp9g7NNxy9T
|
||||
FyAHPXiPWKSoX3w0uoQfLW9Hm19QZYu40hBD5oRrJy5m6l4JU3Gj0tnkvYc4m8Fl
|
||||
2uEUT3ain0FE2I1XjKpL6eQi9TKjhgmWNRgDJUbllAB3lsQLkNfB6EFo2QJykiKl
|
||||
aRi4UaHdSkd3zkUJyYRdcG7IxCFvsViKpwr3JF+TLXSN/oronLFgG8cKedrn+sMW
|
||||
pBm2FZQKAh8hLT3QQQqQgGpQ2y4t2EVJkYVdcGBXCyWYDKegMXgJR10WunICFCaD
|
||||
kM0P3pYQdtbgr7e9AgMBAAGjUDBOMB0GA1UdDgQWBBQ9+iZdf7pLNQItxs4o43dN
|
||||
FZD0CTAfBgNVHSMEGDAWgBQ9+iZdf7pLNQItxs4o43dNFZD0CTAMBgNVHRMEBTAD
|
||||
AQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAcFzJhm3jjuexZf9tTgQfzwtsafLLsYkrm
|
||||
EZOTkhvZFJYbBd8UngL5UPF1M3buSEV1VqsWCALLrFkxzbmjk5uM8cswZR/3J6un
|
||||
7GFYWTEllVgkD8KmNA2b6j5uSuGCQmOccsR4069vwNjrvTbtQpEpEAAnDf6d5/N4
|
||||
MXuDozHq3iEYi7qyGf++5mp4D+82y2ONSUsiLgxqnMT5JX/yhDKI1IiX1ndyt+6r
|
||||
ie2i2fzdOgovlAILuTM4hoUjPYFOxwmUwpxU2EAjPqo9Bi7bQiH+fv0QBzbpQ9on
|
||||
DRHo7NuXaDG49nvatJjuf4DiDELBCTMeKBOk5hG7kyWCIwp5wr+w
|
||||
-----END CERTIFICATE-----
|
|
@ -7,9 +7,13 @@ hedera \- modular management system
|
|||
|
||||
.SH SYNOPSIS
|
||||
.B hedera
|
||||
.\"RI [ options ]
|
||||
.RB [\-\-lib-dir|\-l
|
||||
.IR path \|]
|
||||
.RB [\-\-data-dir|\-l
|
||||
.IR path \|]
|
||||
.RB [\-\-query-dir|\-l
|
||||
.IR path \|]
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
.B hedera
|
||||
is an enterprise management and administration application. It features modular
|
||||
|
@ -26,9 +30,12 @@ will look for the modules in /usr/lib/hedera/module and for its corresponding
|
|||
data (GUI files, configuration...) in /usr/share/hedera/module but more
|
||||
directories can be added by setting
|
||||
.B VN_MODULE_LIB_PATH
|
||||
(for the binaries) and
|
||||
(for the binaries),
|
||||
.B VN_MODULE_DATA_PATH
|
||||
(for the additional data). These environment variables are intended for testing
|
||||
(for the additional data) and
|
||||
.B VN_MODULE_QUERY_PATH
|
||||
(for SQL query files) that can also be set automatically passing the
|
||||
corresponding options. These environment variables are intended for testing
|
||||
during the developement and the expected is to use the modules installed.
|
||||
.PP
|
||||
The format for the configuration files for the modules and some information on
|
||||
|
@ -37,7 +44,25 @@ for
|
|||
.B hedera.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.TP
|
||||
.BI \-l\ path ,\ \-\-lib-dir\ path
|
||||
Sets the value of the
|
||||
.B VN_MODULE_LIB_PATH
|
||||
variable. This option can be used mutiple times to specify more than one search
|
||||
path for the module libraries.
|
||||
.TP
|
||||
.BI \-d\ path ,\ \-\-data-dir\ path
|
||||
Sets the value of the
|
||||
.B VN_MODULE_DATA_PATH
|
||||
variable. This option can be used mutiple times to specify more than one search
|
||||
path for the module data files.
|
||||
.TP
|
||||
.BI \-q\ path ,\ \-\-query-dir\ path
|
||||
Sets the value of the
|
||||
.B VN_MODULE_QUERY_PATH
|
||||
variable. This option can be used mutiple times to specify more than one search
|
||||
path for the module query files.
|
||||
.br
|
||||
.SH EXAMPLE
|
||||
Given a module project in the home directory,
|
||||
.B hedera
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@/hedera
|
||||
includedir=@includedir@/hedera
|
||||
libdir=@libdir@/@PACKAGE@
|
||||
includedir=@includedir@/@PACKAGE@
|
||||
datarootdir=@datarootdir@
|
||||
datadir=@datadir@/@PACKAGE@
|
||||
|
||||
plugindir=@libdir@/@PACKAGE@/plugin
|
||||
|
||||
modulelibdir=${libdir}/module
|
||||
moduledatadir=${datadir}/module
|
||||
modulequerydir=${moduledatadir}/sql
|
||||
|
||||
Name: Hedera
|
||||
Description: The Hedera Library
|
||||
Description: Hedera database access library
|
||||
Version: @VERSION@
|
||||
Requires: gtk+-3.0 gvn sql db vn
|
||||
Libs: -L${libdir}
|
||||
Requires: gtk+-3.0
|
||||
Libs: -l@PACKAGE@
|
||||
Cflags: -I${includedir}
|
||||
|
|
|
@ -1,10 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -x @bindir@/vn-updater-gui ]
|
||||
DISABLE_UPDATER=0
|
||||
CONFIG_FILE=$HOME/.config/hedera/config.sh
|
||||
|
||||
if [ -x $CONFIG_FILE ]
|
||||
then
|
||||
. $CONFIG_FILE
|
||||
fi
|
||||
|
||||
while getopts ":u" OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
u)
|
||||
DISABLE_UPDATER=1
|
||||
;;
|
||||
\?|:)
|
||||
echo "Usage: hedera [-u]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$DISABLE_UPDATER" -eq "0" -a -x @bindir@/vn-updater-gui ]
|
||||
then
|
||||
echo "Running updater..."
|
||||
@bindir@/vn-updater-gui
|
||||
fi
|
||||
|
||||
export LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN=1
|
||||
exec @bindir@/hedera-bin
|
||||
|
||||
exec hedera-bin
|
||||
|
|
|
@ -3,7 +3,7 @@ Name=Hedera
|
|||
GenericName=Office Tool
|
||||
Comment=Runtime for the Hedera system
|
||||
Exec=hedera
|
||||
Icon=@prefix@/share/hedera/vn/image/icon.svg
|
||||
Icon=@prefix@/share/@PACKAGE@/vn/image/icon.svg
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=GNOME;GTK;Office;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SUBDIRS = \
|
||||
src \
|
||||
|
|
|
@ -30,12 +30,6 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkListStore" id="model">
|
||||
<columns>
|
||||
<!-- column-name col -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkBox" id="main">
|
||||
<property name="height_request">300</property>
|
||||
<property name="visible">True</property>
|
||||
|
@ -89,7 +83,6 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="related_action">send</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -103,7 +96,6 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="related_action">clean</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -114,11 +106,9 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="stop">
|
||||
<property name="label">gtk-stop</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="vn_consulter_on_stop_clicked" swapped="no"/>
|
||||
</object>
|
||||
|
@ -208,12 +198,10 @@
|
|||
<child>
|
||||
<object class="GtkCheckButton" id="mode">
|
||||
<property name="label" translatable="yes">Immediate changes</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="active">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
|
@ -228,11 +216,9 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="start">
|
||||
<property name="label" translatable="yes">Start</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="vn_consulter_start_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -244,11 +230,9 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="commit">
|
||||
<property name="label" translatable="yes">Commit</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="vn_consulter_commit_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -260,11 +244,9 @@
|
|||
<child>
|
||||
<object class="GtkButton" id="rollback">
|
||||
<property name="label" translatable="yes">Rollback</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<signal name="clicked" handler="vn_consulter_rollback_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -273,6 +255,20 @@
|
|||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="multisend">
|
||||
<property name="label" translatable="yes">∞</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="vn_consulter_multisend_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -301,4 +297,10 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkListStore" id="model">
|
||||
<columns>
|
||||
<!-- column-name col -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<!-- 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>
|
||||
|
@ -19,7 +15,6 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
|
@ -57,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>
|
||||
|
@ -171,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>
|
||||
|
@ -308,7 +301,6 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires vn 0.0 -->
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<!-- interface-requires vn 0.0 -->
|
||||
<object class="VnBatch" id="iterators">
|
||||
<child>
|
||||
<object class="DbIterator" id="account">
|
||||
<property name="sql">SELECT user_id, group_id, uid, last_change, expire FROM account WHERE #p</property>
|
||||
<property name="model">account-model</property>
|
||||
<property name="mode">on-iter</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="DbIterator" id="alias">
|
||||
<property name="sql">SELECT mail_alias_id, user_id FROM mail_alias_account WHERE #p</property>
|
||||
<property name="model">alias-model</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="DbIterator" id="sip">
|
||||
<property name="model">sip-model</property>
|
||||
<property name="mode">on-iter</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="DbIterator" id="users">
|
||||
<property name="model">users-model</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkBox" id="main">
|
||||
<property name="visible">True</property>
|
||||
|
@ -15,66 +32,6 @@
|
|||
<property name="border_width">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">30</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">User name:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="VnEntry" id="entry-search">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="param">search-user</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>Search</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
|
@ -277,9 +234,9 @@
|
|||
<object class="VnCombo" id="combo1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">user-combo-model</property>
|
||||
<property name="iterator">users</property>
|
||||
<property name="column_name">mysql_user_id</property>
|
||||
<property name="sql">SELECT id, user FROM mysql_user</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -344,9 +301,9 @@
|
|||
<object class="VnCombo" id="combo2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">account-combo-model</property>
|
||||
<property name="iterator">account</property>
|
||||
<property name="column_name">group_id</property>
|
||||
<property name="sql">SELECT id, name FROM `group`</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -518,9 +475,9 @@
|
|||
<child>
|
||||
<object class="VnColumnCombo" id="column-combo1">
|
||||
<property name="title" translatable="yes">Alias</property>
|
||||
<property name="model">alias-combo-model</property>
|
||||
<property name="column_name">mail_alias_id</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="sql">SELECT id, alias FROM mail_alias</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -739,6 +696,54 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="VnBatch" id="models">
|
||||
<child>
|
||||
<object class="DbModel" id="users-model">
|
||||
<property name="sql">SELECT u.id, u.name, u.mysql_user_id, m.user, u.active
|
||||
FROM `user` u
|
||||
JOIN mysql_user m ON u.mysql_user_id = m.id</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="DbModel" id="sip-model">
|
||||
<property name="sql">SELECT user_id, extension, secret, callerid, callgroup
|
||||
FROM account_sip
|
||||
WHERE #p</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="DbModel" id="alias-combo-model">
|
||||
<property name="sql">SELECT id, alias FROM mail_alias</property>
|
||||
<property name="update_flags"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="DbModel" id="user-combo-model">
|
||||
<property name="sql">SELECT id, user FROM mysql_user</property>
|
||||
<property name="update_flags"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="DbModel" id="alias-model">
|
||||
<property name="sql">SELECT mail_alias_id, user_id
|
||||
FROM mail_alias_account
|
||||
WHERE #p</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="DbModel" id="account-model">
|
||||
<property name="sql">SELECT user_id, group_id, uid, last_change, expire
|
||||
FROM account
|
||||
WHERE #p</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="DbModel" id="account-combo-model">
|
||||
<property name="sql">SELECT id, name FROM `group`</property>
|
||||
<property name="update_flags"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkDialog" id="password-dialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
|
@ -898,11 +903,4 @@
|
|||
</child>
|
||||
</object>
|
||||
<object class="DbParam" id="search-user"/>
|
||||
<object class="DbIterator" id="sip">
|
||||
<property name="sql">SELECT user_id, extension, secret, callerid, callgroup FROM account_sip WHERE #p</property>
|
||||
<property name="mode">on-iter</property>
|
||||
</object>
|
||||
<object class="DbIterator" id="users">
|
||||
<property name="sql">SELECT u.id, u.name, u.mysql_user_id, m.user, u.active FROM `user` u JOIN mysql_user m ON u.mysql_user_id = m.id</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
10
|
||||
|
||||
dir
|
||||
309
|
||||
svn://www.verdnatura.es/hedera/trunk/module/sql
|
||||
svn://www.verdnatura.es/hedera
|
||||
|
||||
|
||||
|
||||
2013-07-05T08:50:39.387803Z
|
||||
307
|
||||
juan
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
d9127786-647a-4bcf-81f6-65b2d4e6f3ab
|
||||
|
|
@ -0,0 +1 @@
|
|||
SELECT name, color, id FROM item;
|
|
@ -5,7 +5,8 @@ example_lib_LTLIBRARIES = libexample.la
|
|||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(gtk_CFLAGS)
|
||||
$(gtk_CFLAGS) \
|
||||
$(DEFINES)
|
||||
libexample_la_LDFLAGS = -avoid-version
|
||||
libexample_la_LIBADD = $(top_builddir)/vn/libvn.la
|
||||
libexample_la_SOURCES = \
|
||||
|
@ -16,6 +17,11 @@ libexample_la_SOURCES = \
|
|||
vn-customer.h \
|
||||
vn-customer.c
|
||||
|
||||
example_querydir = $(module_querydir)/example
|
||||
example_query_DATA = ../sql/example/consulter.sql
|
||||
|
||||
DEFINES = -D_QUERY_PATH=\"$(module_querydir)\"
|
||||
|
||||
install-data-hook:
|
||||
rm -f $(DESTDIR)$(module_libdir)/libexample.la
|
||||
rm -f $(DESTDIR)$(module_libdir)/libexample.a
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
G_DEFINE_TYPE (VnConsulter, vn_consulter, VN_TYPE_FORM);
|
||||
|
||||
#define FILE_KW "sql://"
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
|
||||
|
||||
void vn_consulter_clean_clicked (GtkButton * button, VnConsulter * obj)
|
||||
|
@ -27,6 +29,33 @@ void vn_consulter_clean_clicked (GtkButton * button, VnConsulter * obj)
|
|||
gtk_list_store_clear (obj->model);
|
||||
}
|
||||
|
||||
static gboolean idle_sender (VnConsulter * obj)
|
||||
{
|
||||
static int a = 0;
|
||||
|
||||
if (a < 100)
|
||||
{
|
||||
db_model_refresh (vn_grid_get_model (obj->grid));
|
||||
a++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
a = 0;
|
||||
obj->source = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void vn_consulter_multisend_clicked (GtkButton * button, VnConsulter * obj)
|
||||
{
|
||||
if (vn_grid_get_model (obj->grid))
|
||||
{
|
||||
if (!obj->source)
|
||||
obj->source = g_timeout_add (50, (GSourceFunc) idle_sender, obj);
|
||||
else if (g_source_remove (obj->source))
|
||||
obj->source = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void vn_consulter_start_clicked (GtkButton * button, VnConsulter * obj)
|
||||
{
|
||||
db_conn_start_transaction (VN_FORM (obj)->conn);
|
||||
|
@ -63,11 +92,14 @@ static void vn_consulter_model_status_changed (DbModel * model,
|
|||
DbModelStatus status, VnConsulter * obj)
|
||||
{
|
||||
GList * n;
|
||||
GtkTreeView * tv = GTK_TREE_VIEW (obj->tree);
|
||||
GtkTreeView * tv = GTK_TREE_VIEW (obj->grid);
|
||||
GList * cols = gtk_tree_view_get_columns (tv);
|
||||
|
||||
for (n = cols; n; n = n->next)
|
||||
gtk_tree_view_remove_column (tv, n->data);
|
||||
{
|
||||
GtkTreeViewColumn * col = n->data;
|
||||
gtk_tree_view_remove_column (tv, col);
|
||||
}
|
||||
|
||||
g_list_free (cols);
|
||||
|
||||
|
@ -76,30 +108,59 @@ static void vn_consulter_model_status_changed (DbModel * model,
|
|||
case DB_MODEL_STATUS_READY:
|
||||
{
|
||||
gint i;
|
||||
gint cols = db_model_get_ncols (model);
|
||||
|
||||
for (i = 0; i < cols; i++)
|
||||
for (i = 0; i < db_model_get_ncols (model); i++)
|
||||
{
|
||||
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->tree, i
|
||||
column = vn_grid_append_column (obj->grid, i
|
||||
,db_model_get_column_name (model, i)
|
||||
,col_type
|
||||
,TRUE, FALSE
|
||||
);
|
||||
|
||||
if (type == G_TYPE_FLOAT || type == G_TYPE_DOUBLE)
|
||||
g_object_set (column, "digits", 3, NULL);
|
||||
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);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -135,14 +196,20 @@ void vn_consulter_send (GtkButton * button, VnConsulter * obj)
|
|||
|
||||
vn_consulter_set_message (obj, sql);
|
||||
|
||||
if (g_str_has_prefix (sql, FILE_KW))
|
||||
model = db_model_new_with_file (VN_FORM (obj)->conn,
|
||||
sql + g_utf8_strlen (FILE_KW, -1));
|
||||
else
|
||||
model = db_model_new_with_sql (VN_FORM (obj)->conn, sql);
|
||||
g_signal_connect (model, "status-changed",
|
||||
|
||||
// Get sure to connect after the columns do, to destroy them.
|
||||
g_signal_connect_after (model, "status-changed",
|
||||
G_CALLBACK (vn_consulter_model_status_changed), obj);
|
||||
|
||||
iterator = db_iterator_new (model);
|
||||
iterator->mode = DB_ITERATOR_MODE_ON_DEMAND;
|
||||
vn_handler_set_iterator (obj->handler, iterator);
|
||||
vn_grid_set_iterator (obj->tree, iterator);
|
||||
vn_grid_set_iterator (obj->grid, iterator);
|
||||
|
||||
vn_consulter_mode_toggled (GTK_TOGGLE_BUTTON (obj->mode), obj);
|
||||
|
||||
|
@ -156,6 +223,9 @@ static void vn_consulter_open (VnConsulter * obj)
|
|||
gint i;
|
||||
VnForm * form = VN_FORM (obj);
|
||||
|
||||
obj->file = g_strconcat
|
||||
(FILE_KW, vn_mod_get_name (form->mod), "/consulter", NULL);
|
||||
|
||||
gchar * queries[] =
|
||||
{
|
||||
//MySQL (kk schema)
|
||||
|
@ -170,9 +240,11 @@ static void vn_consulter_open (VnConsulter * obj)
|
|||
"FROM item i LEFT JOIN movement m ON i.id = m.item_id"
|
||||
,"/*pg*/SELECT m.id, amount, item_id, name, color "
|
||||
"FROM movement m JOIN item ON m.item_id = item.id"
|
||||
,"/*pg*/SELECT * FROM item"
|
||||
,obj->file
|
||||
,"/*pg*/ SELECT id1, id2, name, ok, date, number, floating, image "
|
||||
"FROM prueben"
|
||||
,"/*pg*/ SELECT id1, id2, floating "
|
||||
"FROM prueben"
|
||||
,NULL
|
||||
};
|
||||
|
||||
|
@ -180,23 +252,46 @@ static void vn_consulter_open (VnConsulter * obj)
|
|||
obj->combo = vn_form_get (form, "query");
|
||||
obj->tv = vn_form_get (form, "treeview");
|
||||
obj->mode = vn_form_get (form, "mode");
|
||||
obj->tree = vn_form_get (form, "consulter");
|
||||
obj->grid = vn_form_get (form, "consulter");
|
||||
obj->handler = vn_form_get (form, "handler");
|
||||
gtk_entry_set_placeholder_text (vn_form_get (form, "combo-entry"),
|
||||
_("Write your query here or select one from the list"));
|
||||
_("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
|
||||
|
||||
static void vn_consulter_init (VnConsulter * obj) {}
|
||||
static void vn_consulter_init (VnConsulter * obj)
|
||||
{
|
||||
obj->source = 0;
|
||||
}
|
||||
|
||||
static void vn_consulter_finalize (VnConsulter * obj)
|
||||
{
|
||||
g_free (obj->file);
|
||||
G_OBJECT_CLASS (vn_consulter_parent_class)->finalize (G_OBJECT (obj));
|
||||
}
|
||||
|
||||
static void vn_consulter_class_init (VnConsulterClass * k)
|
||||
{
|
||||
G_OBJECT_CLASS (k)->finalize = (GObjectFinalizeFunc) vn_consulter_finalize;
|
||||
VN_FORM_CLASS (k)->open = (VnFormOpenFunc) vn_consulter_open;
|
||||
}
|
||||
|
|
|
@ -30,14 +30,15 @@ typedef struct _VnConsulterClass VnConsulterClass;
|
|||
struct _VnConsulter
|
||||
{
|
||||
VnForm parent;
|
||||
GtkButton * connect;
|
||||
GtkListStore * model;
|
||||
GtkCheckButton * mode;
|
||||
GtkComboBoxText * combo;
|
||||
GtkTreeView * tv;
|
||||
GtkContainer * box;
|
||||
VnGrid * tree;
|
||||
VnGrid * grid;
|
||||
VnHandler * handler;
|
||||
|
||||
gchar * file;
|
||||
guint source;
|
||||
};
|
||||
|
||||
struct _VnConsulterClass
|
||||
|
|
|
@ -57,7 +57,7 @@ static void vn_users_on_password_changed (DbRequest * request, VnUsers * obj)
|
|||
if (g_value_get_int (&value) != -1)
|
||||
gtk_widget_hide (GTK_WIDGET (obj->password_dialog));
|
||||
else
|
||||
vn_users_reset_dialog (obj, _("The password is too week."));
|
||||
vn_users_reset_dialog (obj, _("The password is too weak."));
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
@ -79,11 +79,9 @@ void vn_users_on_dialog_response (GtkDialog * dialog, gint response_id, VnUsers
|
|||
{
|
||||
SqlString * query;
|
||||
|
||||
query = sql_string_new ("SELECT user_set_password (#user, #password)"
|
||||
,"user", GVN_TYPE_PARAM, obj->user_id
|
||||
,"password", G_TYPE_STRING, password
|
||||
,NULL
|
||||
);
|
||||
query = sql_string_new ("SELECT user_set_password (#p, #p)");
|
||||
sql_string_add_param (query, obj->user_id);
|
||||
sql_string_add_value (query, G_TYPE_STRING, password);
|
||||
|
||||
db_conn_query_with_stmt_async (VN_FORM (obj)->conn
|
||||
,SQL_STMT (query)
|
||||
|
|
|
@ -16,7 +16,16 @@
|
|||
*/
|
||||
|
||||
#include <libpq-fe.h>
|
||||
#include <postgres_fe.h>
|
||||
//#include <postgres_fe.h>
|
||||
|
||||
// Replaces postgres_fe.h until it gets fixed
|
||||
#ifndef FRONTEND
|
||||
#define FRONTEND 1
|
||||
#endif
|
||||
|
||||
#include "c.h"
|
||||
// end of the "fix"
|
||||
|
||||
#include <catalog/pg_type.h>
|
||||
// Macros to avoid redefinition warnings for constants
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
@ -332,6 +341,7 @@ static DbResultSet * __db_pg_query
|
|||
switch (PQresultStatus (res))
|
||||
{
|
||||
case PGRES_COMMAND_OK:
|
||||
case PGRES_SINGLE_TUPLE:
|
||||
case PGRES_TUPLES_OK:
|
||||
{
|
||||
gchar ** q_t = NULL;
|
||||
|
@ -571,9 +581,9 @@ static DbResultSet * __db_pg_query
|
|||
|
||||
if (!x)
|
||||
{
|
||||
GPtrArray * col_iter = g_ptr_array_index (col, ind)
|
||||
,* rel_iter = g_ptr_array_index (rel_oid, ind)
|
||||
,* name_array;
|
||||
GPtrArray * col_iter = g_ptr_array_index (col, ind),
|
||||
* rel_iter = g_ptr_array_index (rel_oid, ind),
|
||||
* name_array;
|
||||
|
||||
r = g_slist_nth_data
|
||||
(list, GPOINTER_TO_UINT (g_ptr_array_index (ind_select, ind)));
|
||||
|
@ -605,7 +615,7 @@ static DbResultSet * __db_pg_query
|
|||
// Set the metadata if it is a *CALCULATED FIELD*
|
||||
col_tup[j] = -1;
|
||||
|
||||
if (fname[0] == '?')
|
||||
if (fname && fname[0] == '?')
|
||||
{
|
||||
r->column[j].name = g_strdup ("");
|
||||
g_free (fname);
|
||||
|
@ -668,15 +678,15 @@ static DbResultSet * __db_pg_query
|
|||
|
||||
g_strfreev (split);
|
||||
}
|
||||
else
|
||||
else if (g_str_has_prefix (pg_val, "nextval"))
|
||||
{
|
||||
if (g_str_has_prefix (pg_val, "nextval"))
|
||||
{// Serial fields
|
||||
// Serial fields
|
||||
GValue * v = g_new0 (GValue, 1);
|
||||
gchar ** split = g_strsplit_set (pg_val, "(':)", G_MAXINT8);
|
||||
SqlObject * function = sql_function_new ("currval", NULL);
|
||||
SqlFunction * function = sql_function_new ("currval", NULL);
|
||||
|
||||
g_value_set_string (g_value_init (v, G_TYPE_STRING), split[2]);
|
||||
sql_object_add_child (function, "params", sql_value_new_with_value (v));
|
||||
sql_function_add_param (function, sql_value_new_with_value (v));
|
||||
g_value_unset (v);
|
||||
g_free (v);
|
||||
g_value_take_object (g_value_init (&def[j], SQL_TYPE_FUNCTION),
|
||||
|
@ -686,11 +696,9 @@ static DbResultSet * __db_pg_query
|
|||
else
|
||||
db_pg_set_g_value (&def[j], type, pg_val);
|
||||
}
|
||||
}
|
||||
else
|
||||
g_value_init (&def[j], GVN_TYPE_NULL);
|
||||
|
||||
|
||||
// Checking whether the column can be NULL
|
||||
nullable[j] = !g_strcmp0 (PQgetvalue (res_col, ctup, 2),"t")
|
||||
? FALSE : TRUE;
|
||||
|
@ -703,10 +711,9 @@ static DbResultSet * __db_pg_query
|
|||
}
|
||||
else
|
||||
{
|
||||
guint nkeys;
|
||||
guint l, nkeys, nedit = 0;
|
||||
gchar ** pkey = NULL;
|
||||
GSList * prev_tables = NULL;
|
||||
guint nedit = 0, l;
|
||||
struct
|
||||
{
|
||||
gchar * name;
|
||||
|
|
|
@ -13,6 +13,7 @@ plugin/pg/db-pg.c
|
|||
|
||||
db/db-iterator.c
|
||||
db/db-model.c
|
||||
db/db-model-holder.c
|
||||
db/db-calc.c
|
||||
db/db-param.c
|
||||
db/db-conn.c
|
||||
|
@ -44,4 +45,12 @@ vn/gui/main.glade
|
|||
vn/gui/child-window.glade
|
||||
vn/gui/actions.glade
|
||||
|
||||
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
|
||||
module/src/vn-users.c
|
||||
module/data/consulter.glade
|
||||
module/src/vn-consulter.c
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
module/data/example.xml
|
||||
module/data/consulter.glade
|
||||
module/data/customer.glade
|
||||
module/data/signer.glade
|
||||
module/src/vn-consulter.c
|
||||
module/src/vn-customer.c
|
||||
module/src/vn-signer.c
|
||||
module/src/vn-users.c
|
||||
module/data/signer.glade
|
||||
|
||||
template/lib-object.c
|
||||
|
||||
|
|
|
@ -5,23 +5,15 @@ SUBDIRS = parser
|
|||
sql_lib_LTLIBRARIES = libsql.la
|
||||
sql_include_HEADERS = \
|
||||
sql.h \
|
||||
sql-object.h \
|
||||
sql-param-object.h \
|
||||
sql-param-list.h \
|
||||
sql-holder.h \
|
||||
sql-list.h \
|
||||
sql-set.h \
|
||||
sql-multi-stmt.h \
|
||||
sql-string.h \
|
||||
sql-target.h \
|
||||
sql-expr.h \
|
||||
sql-insert.h \
|
||||
sql-object.h \
|
||||
sql-select.h \
|
||||
sql-select-field.h \
|
||||
sql-select-order.h \
|
||||
sql-subquery.h \
|
||||
sql-update.h \
|
||||
sql-update-set.h \
|
||||
sql-delete.h \
|
||||
sql-field.h \
|
||||
sql-join.h \
|
||||
|
@ -42,20 +34,12 @@ libsql_la_LIBADD = \
|
|||
$(top_builddir)/gvn/libgvn.la
|
||||
libsql_la_SOURCES = \
|
||||
$(sql_include_HEADERS) \
|
||||
sql-object.c \
|
||||
sql-param-object.c \
|
||||
sql-param-list.c \
|
||||
sql-holder.c \
|
||||
sql-list.c \
|
||||
sql-set.c \
|
||||
sql-expr.c \
|
||||
sql-insert.c \
|
||||
sql-object.c \
|
||||
sql-select.c \
|
||||
sql-select-field.c \
|
||||
sql-select-order.c \
|
||||
sql-subquery.c \
|
||||
sql-update.c \
|
||||
sql-update-set.c \
|
||||
sql-delete.c \
|
||||
sql-field.c \
|
||||
sql-join.c \
|
||||
|
@ -69,7 +53,7 @@ libsql_la_SOURCES = \
|
|||
sql-string.c \
|
||||
sql-target.c \
|
||||
sql-render.c \
|
||||
$(top_builddir)/sql/sql-parser.c
|
||||
$(top_srcdir)/sql/sql-parser.c
|
||||
|
||||
pkgconfig_DATA = sql.pc
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
PARSER = $(top_builddir)/sql/sql-parser.c
|
||||
PARSER = $(top_srcdir)/sql/sql-parser.c
|
||||
|
||||
DIR = $(top_srcdir)/sql/parser
|
||||
TMPL = $(DIR)/lempar-tmpl.c
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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,16 +251,17 @@ 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 (g_object_ref_sink (state->object));
|
||||
g_object_unref (state->object);
|
||||
object = NULL;
|
||||
}
|
||||
else
|
||||
object = g_object_ref_sink (state->object);
|
||||
|
||||
g_free (state);
|
||||
g_free (query);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
**/
|
||||
G_DEFINE_TYPE (SqlDelete, sql_delete, SQL_TYPE_DML);
|
||||
|
||||
SqlObject * sql_delete_new ()
|
||||
SqlDelete * sql_delete_new ()
|
||||
{
|
||||
return g_object_new (SQL_TYPE_DELETE, NULL);
|
||||
}
|
||||
|
@ -36,75 +36,40 @@ SqlObject * sql_delete_new ()
|
|||
static void sql_delete_render (SqlDelete * obj, SqlRender * render)
|
||||
{
|
||||
sql_render_add_token (render, "DELETE");
|
||||
sql_render_add_list (render, TRUE, NULL, obj->tables, ",");
|
||||
sql_render_add_object (render, obj->table);
|
||||
|
||||
if (SQL_DML (obj)->targets)
|
||||
if (SQL_DML (obj)->target)
|
||||
{
|
||||
sql_render_add_list (render, TRUE, "FROM", SQL_DML (obj)->targets, ",");
|
||||
sql_render_add_item (render, FALSE, "WHERE", SQL_DML (obj)->where);
|
||||
sql_render_add_list (render, T, "FROM", SQL_DML (obj)->target, ",");
|
||||
sql_render_add_item (render, F, "WHERE", SQL_DML (obj)->where);
|
||||
}
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Properties
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
|
||||
|
||||
enum
|
||||
void sql_delete_add_table (SqlDelete * obj, SqlTable * table)
|
||||
{
|
||||
PROP_TABLES = 1
|
||||
};
|
||||
g_return_if_fail (SQL_IS_DELETE (obj));
|
||||
g_return_if_fail (SQL_IS_TABLE (table));
|
||||
|
||||
static void sql_delete_set_property (SqlDelete * obj, guint id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case PROP_TABLES:
|
||||
sql_object_remove (obj, obj->tables);
|
||||
obj->tables = sql_object_add (obj, g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void sql_delete_get_property (SqlDelete * obj, guint id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case PROP_TABLES:
|
||||
g_value_set_object (value, obj->tables);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
|
||||
}
|
||||
obj->table = g_slist_append (obj->table, g_object_ref_sink (table));
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
|
||||
|
||||
static void sql_delete_init (SqlDelete * obj)
|
||||
{
|
||||
obj->tables = NULL;
|
||||
obj->table = NULL;
|
||||
}
|
||||
|
||||
static void sql_delete_finalize (SqlDelete * obj)
|
||||
{
|
||||
sql_object_remove (obj, obj->tables);
|
||||
g_slist_free_full (obj->table, g_object_unref);
|
||||
G_OBJECT_CLASS (sql_delete_parent_class)->finalize (G_OBJECT (obj));
|
||||
}
|
||||
|
||||
static void sql_delete_class_init (SqlDeleteClass * klass)
|
||||
{
|
||||
GObjectClass * k = G_OBJECT_CLASS (klass);
|
||||
k->finalize = (GObjectFinalizeFunc) sql_delete_finalize;
|
||||
k->set_property = (GObjectSetPropertyFunc) sql_delete_set_property;
|
||||
k->get_property = (GObjectGetPropertyFunc) sql_delete_get_property;
|
||||
G_OBJECT_CLASS (klass)->finalize = (GObjectFinalizeFunc) sql_delete_finalize;
|
||||
SQL_OBJECT_CLASS (klass)->render = (SqlRenderFunc) sql_delete_render;
|
||||
|
||||
g_object_class_install_property (k, PROP_TABLES,
|
||||
sql_param_list ("tables"
|
||||
,"Tables"
|
||||
,"A list of tables"
|
||||
,SQL_TYPE_TABLE
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue