Se ha quitado el formulario Users

This commit is contained in:
Alejandro T. Colombini Gómez 2013-12-17 17:03:37 +01:00
parent 1d68da05a2
commit 135d73fbc7
17 changed files with 126 additions and 1263 deletions

View File

@ -1,68 +0,0 @@
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])
])

View File

@ -20,10 +20,11 @@
<title>Previous stage</title>
<para>
Before you can add a module, you have to create it. To do so,
the Hedera Library ships with an Anjuta IDE project wizzard
that creates an empty module written in Vala, almost ready
to build . If you won't be using the Anjuta IDE, you'll
have to work your way to a built module. More on that will be
the Hedera Library ships with an
<ulink url="http://www.anjuta.org/">Anjuta IDE</ulink> project
wizzard that creates an empty module written in Vala, ready
to be configured and built. If you won't be using the Anjuta IDE,
you'll have to work your way to a built module. More on that will be
covered in the section about the module creation on the Tutorials.
</para>
</refsection>
@ -69,17 +70,19 @@
<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
description file must have the <filename>.glade</filename> 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
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"
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
file with the extension <filename>.ui</filename> containing a
#GtkUIManager definition
using the actions in the "actions" group.
</para>
</refsection>

View File

@ -19,7 +19,7 @@
<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
if you have received it packed in any other form, like a <filename>.deb</filename>
package, this section can be ignored, but you'll need to know how
to use the package you received.
</para>
@ -37,13 +37,16 @@
are GLib and GTK+. Also, depending of what type of database you will
be using, you will also need the public API of this database. The
goal of the library is to add more support for other free databases,
but right now, the only supported databases are PostgreSQL and
MySQL, so you will need to install the programming interface for at
but right now, the only supported databases are
<ulink url="http://www.postgresql.org/">PostgreSQL</ulink> and
<ulink url="http://dev.mysql.com/">MySQL</ulink>,
so you will need to install the programming interface for at
least of of these.
</para>
<para>
If you want to generate this documentation with your own compilation
of the library, you'll also need to install GTK-Doc to do so.
of the library, you'll also need to install
<ulink url="http://www.gtk.org/gtk-doc/">GTK-Doc</ulink> to do so.
</para>
</refsection>
<refsection id="compiling">
@ -51,10 +54,15 @@
<para>
Supposing you've satisfied all of the existing dependencies, now
you'll need to compile the Hedera library. To do it you just have
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 build the library.
to go to the <filename>build</filename> folder of the library and
run the autogen.sh script with the configure options of your choice
(listed in the <filename>README</filename> file of the distribution)
e.g. to build the library to be installed at
<filename>/install/dir</filename>:
<programlisting>
projectdir/build$ ./autogen.sh
projectdir/build$ ./configure --enable-vala --prefix=~/install/dir
projectdir/build$ make</programlisting>
</para>
<para>
As we do, we highly recommend developers using the Hedera
@ -78,9 +86,10 @@
<title>Installing</title>
<para>
When you have the library configured according to your needs,
you'll have to execute 'make install' with root privileges, and
the library directory tree will install in the folder specified
at configure time.
you'll have to execute <command>make install</command>
(you will need root privileges if the location is not accessible
by your user), and the library directory tree will be installed
in the folder specified at configure time.
</para>
</refsection>
</refentry>

View File

@ -19,35 +19,44 @@
<refsection id="defining-form">
<title>Defining a form</title>
<para>
<!-- FIXME: add description of the XML DEFINITION of a form in the module file -->
<!-- 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
The most basic form is made up of a class that inherits from
<link linkend="VnForm">VnForm</link>
and a <link linkend="GtkBuilder">GtkBuilder</link> file, which
defines the UI of the form. This UI file is expected to use the
<filename>.glade</filename> extension and named after the form that
will use it. This <filename>.glade</filename> file must contain a
toplevel <link linkend="GtkBox">GtkBox</link> with the name
<literal>main</literal>, that will be recognized by the library as
the content of the <link linkend="GtkNotebook">GtkNotebook</link>
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.
The <filename>.glade</filename> file for a form may also contain a
<link linkend="VnBatch">VnBatch</link> called
<literal>models</literal> 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.
by adding a <link linkend="GtkActionGroup">GtkActionGroup</link>
named <literal>actions</literal> in the <filename>.glade</filename>
file, and using another file named also after the form, with the
extension <filename>.ui</filename>. This file uses the
<link linkend="GtkUIManager">GtkUIManager</link> syntax,
and will be used to define the strcuture of the menus and will
link the options to the actions defined in the previously mentioned
<literal>actions</literal>
<link linkend="GtkActionGroup">GtkActionGroup</link>.
</para>
<para>
There is also the possibility to define SQL files, to set and edit

View File

@ -20,16 +20,22 @@
<title>The Hedera Library</title>
<para>
The Hedera library is a utility library that offers an easy
way to connect to a database and link the retrieved data to
GTK+ graphical interfaces.
way to connect to a database and show and manipulate the retrieved
data using
<ulink url="file:///usr/share/gtk-doc/html/gtk3/index.html">GTK+
</ulink> graphical interfaces.
</para>
<para>
It features a modular system to easily add new functionalities
to your applications with the minimum maintenance needed. This
system offers the developer the chance to use either GObject/C
or Vala to implement new modules and also comes with an easy
integration method to add them to the existing application in no
time.
system offers the developer the chance to use either
<ulink url="file:///usr/share/gtk-doc/html/glib/index.html">GLib
</ulink> and
<ulink url="file:///usr/share/gtk-doc/html/gobject/index.html">
GObject</ulink> from C or
<ulink url="http://www.valadoc.org/">Vala</ulink> to implement new
modules and also comes with an easy integration method to add them
to the existing application in no time.
</para>
<para>
Althought you can write your own applications, the library is
@ -40,7 +46,8 @@
shown in a tutorial.
</para>
<para>
The hedera library also comes with an Anjuta IDE project
The hedera library also comes with an
<ulink url="http://www.anjuta.org/">Anjuta IDE</ulink> project
wizzard to help on the creation of the Hedera Module project
and integrate it with the GNU Build System. As the motivation
of the Hedera Library Project was to use the library from Vala,

View File

@ -46,8 +46,10 @@
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
<filename>hedera-mod.wiz.tgz</filename> file to the corresponding
data directory named
<filename>anjuta/project</filename>, placed under
<filename>~/.local</filename> on most distributions. With
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 newer than the 2.31.
@ -57,7 +59,8 @@
you can now verify you have everything you need to work by
building the module. As you try to build the project, Anjuta will
prompt you for the configuration options of the project, configure
the project without options (you can add options like --enable-debug
the project without options (you can add options like
<option>enable-debug</option>
or others, that will be discussed later). If you can build you are
good to go with the next tutorials. Else you'll need to check the
errors prompted by the build system and fix them, probably

View File

@ -20,22 +20,25 @@
<title>Custom modules</title>
<para>
To run your own modules you need to install them in the
search directories of Hedera. You can use pkg-config to know where
search directories of Hedera. You can use
<command>pkg-config</command> 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>
<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
Hedera where to look for them. To do so, set the following
environment variables before executing Hedera: VN_MODULE_LIB_PATH,
environment variables before executing Hedera:
<envar>VN_MODULE_LIB_PATH</envar>,
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
for the binary files of the module;
<envar>VN_MODULE_DATA_PATH</envar>, this list
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
<envar>VN_MODULE_QUERY_PATH</envar>, 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
@ -48,13 +51,13 @@
by yourself following the tutorials included in this manual).
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
variable, you'll just need to write 'hedera' in the command
line. The library will load the modules at runtime. The details
on how to tell the hedera execution environment where to look
for your modules are explained in <link linkend="adding-modules">
Adding Modules</link>.
<filename>bin</filename> directory of the installation tree. If you
installed the library in a folder that is included in the
<envar>PATH</envar> environment variable, you'll just need to write
<command>hedera</command> in the command line. The library will load
the modules at runtime. The details on how to tell the hedera
execution environment where to look for your modules are explained
in <link linkend="adding-modules">Adding Modules</link>.
</para>
</refsection>
</refentry>

View File

@ -16,19 +16,16 @@ hedera \- modular management system
.br
.SH DESCRIPTION
.B hedera
is an enterprise management and administration application. It features modular
conectivity to user-made modules.
.PP
Being so easily extensible,
.B hedera
can handle virtually any task related to a database if the right module is
available. The modules can be written in C or in Vala.
is a database access aplication. It features modular conectivity to user-made
modules. The modules can be written in C or in Vala.
.PP
By default
.B hedera
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
will look for the modules at /usr/lib/x86_64-linux-gnu/hedera/module and for
its corresponding data (GUI files, configuration...) at /usr/share/hedera/module
and at /usr/share/hedera/module/{name-of-the-module}/sql for module specific SQL
query files, but more directories can be added by setting the environment
variables
.B VN_MODULE_LIB_PATH
(for the binaries),
.B VN_MODULE_DATA_PATH
@ -45,19 +42,19 @@ for
.SH OPTIONS
.TP
.BI \-l\ path ,\ \-\-lib-dir\ path
.BI \-l\ 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
.BI \-d\ 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
.BI \-q\ 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
@ -67,9 +64,10 @@ path for the module query files.
Given a module project in the home directory,
.B hedera
should be called like this to load the module without installing it:
hedera --lib-dir ~/module/src/.libs --data-dir ~/module/data
hedera -l ~/module/src/.libs -d ~/module/data
.SH AUTHORS
Copyright (C) 2012 Juan Ferrer Toribio <juan@verdnauta.es>.
Copyright (C) 2013 Juan Ferrer Toribio <juan@verdnauta.es>.
Copyright (C) 2013 Alejandro T. Colombini <atcolombini@verdnauta.es>.
.PP
Manual page written by Alejandro T. Colombini.

View File

@ -6,8 +6,8 @@ example_DATA = \
example.xml \
example.ui \
consulter.glade \
consulter.ui \
users.glade \
customer.glade
consulter.ui
# customer.glade
# signer.glade
EXTRA_DIST = $(example_DATA)

View File

@ -3,8 +3,8 @@
<!-- interface-requires vn 0.0 -->
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-local-resource-path ../image -->
<object class="DbIterator" id="homes"/>
<object class="DbIterator" id="info"/>
<object class="VnIterator" id="homes"/>
<object class="VnIterator" id="info"/>
<object class="GtkBox" id="main">
<property name="visible">True</property>
<property name="can_focus">False</property>

View File

@ -3,8 +3,7 @@
<placeholder name="ModuleMenu">
<menu name="ExampleMenu" action="action-menu-example">
<menuitem name="Consulter" action="open-consulter"/>
<menuitem name="Users" action="open-users"/>
<menuitem name="Customer" action="open-customer"/>
<!--<menuitem name="Customer" action="open-customer"/>-->
</menu>
</placeholder>
</menubar>

View File

@ -4,9 +4,7 @@
<action-group>
<action
translatable="yes"
name="action-menu-example">
Example
</action>
name="action-menu-example">Example</action>
</action-group>
<form-group>
<form
@ -14,18 +12,8 @@
name="consulter"
icon="system-run"
action-name="open-consulter"
accel="F3">
Consulter
</form>
<form
translatable="yes"
name="users"
icon="contact-new"
action-name="open-users"
accel="F4">
Users
</form>
<form
accel="F1">Consulter</form>
<!-- <form
translatable="yes"
name="customer"
icon="x-office-address-book"
@ -33,5 +21,6 @@
accel="F5">
Customer
</form>
-->
</form-group>
</module>

View File

@ -1,906 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<!-- interface-requires vn 0.0 -->
<object class="VnBatch" id="iterators">
<child>
<object class="DbIterator" id="account">
<property name="model">account-model</property>
<property name="mode">on-iter</property>
</object>
</child>
<child>
<object class="DbIterator" id="alias">
<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>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="VnGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_clickable">False</property>
<property name="search_column">1</property>
<property name="iterator">users</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="grid-selection"/>
</child>
<child>
<object class="VnColumnEntry" id="column-id">
<property name="title" translatable="yes">Identifier</property>
<property name="column_name">id</property>
</object>
</child>
<child>
<object class="VnColumnEntry" id="column-name">
<property name="title" translatable="yes">User</property>
<property name="expand">True</property>
<property name="column_name">name</property>
</object>
</child>
<child>
<object class="VnColumnEntry" id="column-mysql-user">
<property name="title" translatable="yes">MySQL User</property>
<property name="column_name">user</property>
</object>
</child>
<child>
<object class="VnColumnCheck" id="column-check1">
<property name="title" translatable="yes">Enabled</property>
<property name="column_name">active</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="VnHandler" id="handler1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<property name="iterator">users</property>
<property name="show_flags">VN_HANDLER_SHOW_REFRESH | VN_HANDLER_SHOW_UNDO | VN_HANDLER_SHOW_SAVE | VN_HANDLER_SHOW_REMOVE | VN_HANDLER_SHOW_ADD</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="valign">start</property>
<property name="tab_pos">left</property>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">15</property>
<property name="orientation">vertical</property>
<property name="spacing">20</property>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="row_homogeneous">True</property>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Name:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Password:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">MySQL user:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnCheck" id="check1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">users</property>
<property name="column_name">active</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Enabled:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="width_request">130</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Identifier:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnSpin" id="spin1">
<property name="width_request">170</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">users</property>
<property name="column_name">id</property>
<property name="editable">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnEntry" id="entry1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">users</property>
<property name="column_name">name</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<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>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-edit</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_users_on_set_password_clicked" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label19">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">User</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">15</property>
<property name="orientation">vertical</property>
<property name="spacing">20</property>
<child>
<object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="row_homogeneous">True</property>
<child>
<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>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnSpin" id="spin2">
<property name="width_request">170</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">account</property>
<property name="column_name">uid</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label10">
<property name="width_request">130</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">UID:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label11">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Main group:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnDateChooser" id="date-chooser1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">account</property>
<property name="column_name">last_change</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnDateChooser" id="date-chooser2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">account</property>
<property name="column_name">expire</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label12">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Last change:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Expires:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="VnHandler" id="handler2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<property name="iterator">account</property>
<property name="simple_record">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label20">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Account</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">15</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="height_request">160</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="VnGrid" id="grid5">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_clickable">False</property>
<property name="iterator">alias</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="grid-selection2"/>
</child>
<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>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="VnHandler" id="handler4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<property name="iterator">alias</property>
<property name="show_flags">VN_HANDLER_SHOW_REMOVE | VN_HANDLER_SHOW_ADD</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label8">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Mail alias</property>
</object>
<packing>
<property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">15</property>
<property name="orientation">vertical</property>
<property name="spacing">20</property>
<child>
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="row_homogeneous">True</property>
<child>
<object class="GtkLabel" id="label15">
<property name="width_request">130</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Extension:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label16">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Secret:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label17">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Identifier:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Call group:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnEntry" id="entry4">
<property name="width_request">170</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">sip</property>
<property name="column_name">extension</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnEntry" id="entry5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">sip</property>
<property name="column_name">secret</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnEntry" id="entry6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">sip</property>
<property name="column_name">callerid</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="VnSpin" id="spin3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">sip</property>
<property name="column_name">callgroup</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="VnHandler" id="handler3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<property name="iterator">sip</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label21">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">SIP</property>
</object>
<packing>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</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>
<property name="title" translatable="yes">Change password</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="gtk_true" swapped="no"/>
<signal name="response" handler="vn_users_on_dialog_response" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox2">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkInfoBar" id="password-infobar">
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<child internal-child="content_area">
<object class="GtkBox" id="infobar-content_area1">
<property name="can_focus">False</property>
<property name="border_width">8</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="password-error">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="infobar-action_area1">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Password:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label22">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Repeat password:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="password-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="repeat-password">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area2">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<object class="DbParam" id="search-user"/>
</interface>

View File

@ -11,11 +11,9 @@ libexample_la_LDFLAGS = -avoid-version
libexample_la_LIBADD = $(top_builddir)/vn/libvn.la
libexample_la_SOURCES = \
vn-consulter.h \
vn-consulter.c \
vn-users.h \
vn-users.c \
vn-customer.h \
vn-customer.c
vn-consulter.c
# vn-customer.h
# vn-customer.c
example_querydir = $(module_querydir)/example
example_query_DATA = ../sql/example/consulter.sql

View File

@ -1,130 +0,0 @@
/*
* 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 "vn-users.h"
#include "stdlib.h"
G_DEFINE_TYPE (VnUsers, vn_users, VN_TYPE_FORM);
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
static void vn_users_reset_dialog (VnUsers * obj, const gchar * error)
{
GtkWidget * infobar = vn_form_get (VN_FORM (obj), "password-infobar");
if (error)
{
GtkLabel * password_error = vn_form_get (VN_FORM (obj), "password-error");
gtk_label_set_text (password_error, error);
gtk_widget_show (infobar);
}
else
gtk_widget_hide (infobar);
gtk_entry_set_text (obj->repeat_password, "");
gtk_entry_set_text (obj->password_entry, "");
gtk_widget_grab_focus (GTK_WIDGET (obj->password_entry));
}
void vn_users_on_set_password_clicked (GtkButton * button, VnUsers * obj)
{
gtk_window_set_transient_for (GTK_WINDOW (obj->password_dialog),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (obj))));
gtk_widget_show (GTK_WIDGET (obj->password_dialog));
vn_users_reset_dialog (obj, NULL);
}
static void vn_users_on_password_changed (DbRequest * request, VnUsers * obj)
{
GValue value = {0};
if (db_request_fetch_value (request, &value, NULL))
{
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 weak."));
g_value_unset (&value);
}
g_object_unref (request);
}
void vn_users_on_dialog_response (GtkDialog * dialog, gint response_id, VnUsers * obj)
{
if (response_id == GTK_RESPONSE_ACCEPT)
{
const gchar * password = gtk_entry_get_text (obj->password_entry);
if (!g_strcmp0 (password, ""))
vn_users_reset_dialog (obj, _("The password can't be empty."));
else if (g_strcmp0 (password, gtk_entry_get_text (obj->repeat_password)))
vn_users_reset_dialog (obj, _("Passwords do not match."));
else
{
SqlString * query;
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)
,(DbRequestDoneCallback) vn_users_on_password_changed
,g_object_ref (obj)
,g_object_unref
);
}
}
else
gtk_widget_hide (GTK_WIDGET (dialog));
}
static void vn_users_open (VnUsers * obj, gpointer user_data)
{
DbIterator * users;
VnForm * form = VN_FORM (obj);
obj->password_entry = vn_form_get (form, "password-entry");
obj->repeat_password = vn_form_get (form, "repeat-password");
obj->password_dialog = vn_form_get (form, "password-dialog");
gtk_dialog_add_button (obj->password_dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (obj->password_dialog, GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT);
users = vn_form_get (form, "users");
obj->user_id = db_iterator_get_param (users, "id");
obj->account = vn_form_get (form, "account");
db_iterator_link_with_param (obj->account, "user_id", obj->user_id);
obj->alias = vn_form_get (form, "alias");
db_iterator_link (obj->alias, "user_id", obj->account, "user_id");
obj->sip = vn_form_get (form, "sip");
db_iterator_link (obj->sip, "user_id", obj->account, "user_id");
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
static void vn_users_init (VnUsers * obj) {}
static void vn_users_class_init (VnUsersClass * k)
{
VN_FORM_CLASS (k)->open = (VnFormOpenFunc) vn_users_open;
}

View File

@ -1,49 +0,0 @@
/*
* 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/>.
*/
#ifndef VN_USERS_H
#define VN_USERS_H
#include <vn/vn.h>
#define VN_TYPE_USERS (vn_users_get_type ())
#define VN_USERS(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, VN_TYPE_USERS, VnUsers))
#define VN_IS_USERS(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, VN_TYPE_USERS))
typedef struct _VnUsers VnUsers;
typedef struct _VnUsersClass VnUsersClass;
struct _VnUsers
{
VnForm parent;
GvnParam * user_id;
DbIterator * account;
DbIterator * alias;
DbIterator * sip;
GtkDialog * password_dialog;
GtkEntry * password_entry;
GtkEntry * repeat_password;
};
struct _VnUsersClass
{
VnFormClass parent;
};
GType vn_users_get_type ();
#endif

View File

@ -50,7 +50,5 @@ 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