diff --git a/build/m4/vn-dev.m4 b/build/m4/vn-dev.m4 deleted file mode 100644 index abc1825..0000000 --- a/build/m4/vn-dev.m4 +++ /dev/null @@ -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 . -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]) -]) - diff --git a/docs/reference/hedera/adding-modules.xml b/docs/reference/hedera/adding-modules.xml index 0e01bb8..cf8be17 100644 --- a/docs/reference/hedera/adding-modules.xml +++ b/docs/reference/hedera/adding-modules.xml @@ -20,10 +20,11 @@ Previous stage 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 + Anjuta IDE 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. @@ -69,17 +70,19 @@ The main of these requirements is to list the form in the .xml 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 .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 + 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 .ui containing a + #GtkUIManager definition using the actions in the "actions" group. diff --git a/docs/reference/hedera/configuring.xml b/docs/reference/hedera/configuring.xml index 8d5b2ee..157502a 100644 --- a/docs/reference/hedera/configuring.xml +++ b/docs/reference/hedera/configuring.xml @@ -19,7 +19,7 @@ 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 .deb package, this section can be ignored, but you'll need to know how to use the package you received. @@ -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 + PostgreSQL and + MySQL, + so you will need to install the programming interface for at least of of these. 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 + GTK-Doc to do so. @@ -51,10 +54,15 @@ 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 build 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. to build the library to be installed at + /install/dir: + +projectdir/build$ ./autogen.sh +projectdir/build$ ./configure --enable-vala --prefix=~/install/dir +projectdir/build$ make As we do, we highly recommend developers using the Hedera @@ -78,9 +86,10 @@ Installing 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 make install + (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. diff --git a/docs/reference/hedera/first-tutorial.xml b/docs/reference/hedera/first-tutorial.xml index d778e5d..49526d6 100644 --- a/docs/reference/hedera/first-tutorial.xml +++ b/docs/reference/hedera/first-tutorial.xml @@ -19,35 +19,44 @@ Defining a form - + Files needed to create a form - 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 + VnForm + and a GtkBuilder file, which + defines the UI of the form. This UI file is expected to use the + .glade extension and named after the form that + will use it. This .glade file must contain a + toplevel GtkBox with the name + main, that will be recognized by the library as + the content of the GtkNotebook + 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. - 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 .glade file for a form may also contain a + VnBatch called + models which the library will recognize as a + group of models used by the form, and will set the application + connection to these automatically. 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 GtkActionGroup + named actions in the .glade + file, and using another file named also after the form, with the + extension .ui. This file uses the + GtkUIManager 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 + actions + GtkActionGroup. There is also the possibility to define SQL files, to set and edit diff --git a/docs/reference/hedera/introduction.xml b/docs/reference/hedera/introduction.xml index 6c70d8f..c3eea24 100644 --- a/docs/reference/hedera/introduction.xml +++ b/docs/reference/hedera/introduction.xml @@ -20,16 +20,22 @@ The Hedera Library 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 + GTK+ + graphical interfaces. 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 + GLib + and + + GObject from 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. Althought you can write your own applications, the library is @@ -40,7 +46,8 @@ shown in a tutorial. - The hedera library also comes with an Anjuta IDE project + The hedera library also comes with an + Anjuta IDE 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, diff --git a/docs/reference/hedera/module-tutorial.xml b/docs/reference/hedera/module-tutorial.xml index 29c349d..c0e3f07 100644 --- a/docs/reference/hedera/module-tutorial.xml +++ b/docs/reference/hedera/module-tutorial.xml @@ -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 + 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 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 + 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 diff --git a/docs/reference/hedera/running.xml b/docs/reference/hedera/running.xml index 74cd237..72c3be3 100644 --- a/docs/reference/hedera/running.xml +++ b/docs/reference/hedera/running.xml @@ -20,22 +20,25 @@ Custom modules 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 + pkg-config to know where these directories actually are in your installation: - - $ pkg-config --variable=modulelibdir hedera - $ pkg-config --variable=moduledatadir hedera - $ pkg-config --variable=modulequerydir hedera - + +$ pkg-config --variable=modulelibdir hedera +$ pkg-config --variable=moduledatadir hedera +$ pkg-config --variable=modulequerydir hedera 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: + 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 + 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; - VN_MODULE_QUERY_PATH, this variable is not always needed, but if the + 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 @@ -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 - Adding Modules. + 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 Adding Modules. diff --git a/main/hedera.1 b/main/hedera.1 index 085dbdb..0083e5e 100644 --- a/main/hedera.1 +++ b/main/hedera.1 @@ -16,25 +16,22 @@ 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 (for the additional data) and .B VN_MODULE_QUERY_PATH -(for SQL query files) that can also be set automatically passing the +(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 @@ -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 . +Copyright (C) 2013 Juan Ferrer Toribio . +Copyright (C) 2013 Alejandro T. Colombini . .PP Manual page written by Alejandro T. Colombini. diff --git a/module/data/Makefile.am b/module/data/Makefile.am index 374a026..69af00a 100644 --- a/module/data/Makefile.am +++ b/module/data/Makefile.am @@ -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) diff --git a/module/data/customer.glade b/module/data/customer.glade index 03aa2b4..f6a3409 100644 --- a/module/data/customer.glade +++ b/module/data/customer.glade @@ -3,8 +3,8 @@ - - + + True False diff --git a/module/data/example.ui b/module/data/example.ui index b290204..464f050 100644 --- a/module/data/example.ui +++ b/module/data/example.ui @@ -3,8 +3,7 @@ - - + diff --git a/module/data/example.xml b/module/data/example.xml index 9729d1e..3ee2081 100644 --- a/module/data/example.xml +++ b/module/data/example.xml @@ -4,9 +4,7 @@ - Example - + name="action-menu-example">Example
- Consulter -
-
- Users -
-
Consulter
+
diff --git a/module/data/users.glade b/module/data/users.glade deleted file mode 100644 index 8b7e8aa..0000000 --- a/module/data/users.glade +++ /dev/null @@ -1,906 +0,0 @@ - - - - - - - - account-model - on-iter - - - - - alias-model - - - - - sip-model - on-iter - - - - - users-model - - - - - True - False - 6 - vertical - 6 - - - True - True - in - - - True - True - False - 1 - users - - - - - - Identifier - id - - - - - User - True - name - - - - - MySQL User - user - - - - - Enabled - active - - - - - - - True - True - 1 - - - - - True - False - end - users - VN_HANDLER_SHOW_REFRESH | VN_HANDLER_SHOW_UNDO | VN_HANDLER_SHOW_SAVE | VN_HANDLER_SHOW_REMOVE | VN_HANDLER_SHOW_ADD - - - False - True - 2 - - - - - True - True - start - left - - - True - False - 15 - vertical - 20 - - - True - False - 6 - 6 - True - - - True - False - 1 - Name: - - - 0 - 1 - 1 - 1 - - - - - True - False - 1 - Password: - - - 0 - 2 - 1 - 1 - - - - - True - False - 1 - MySQL user: - - - 0 - 3 - 1 - 1 - - - - - True - False - users - active - - - 1 - 4 - 1 - 1 - - - - - True - False - 1 - Enabled: - - - 0 - 4 - 1 - 1 - - - - - 130 - True - False - 1 - Identifier: - - - 0 - 0 - 1 - 1 - - - - - 170 - True - False - users - id - False - - - 1 - 0 - 1 - 1 - - - - - True - False - users - name - - - 1 - 1 - 1 - 1 - - - - - True - False - user-combo-model - users - mysql_user_id - - - 1 - 3 - 1 - 1 - - - - - gtk-edit - False - True - True - True - False - True - - - - 1 - 2 - 1 - 1 - - - - - False - True - 0 - - - - - - - 100 - True - False - User - - - False - - - - - True - False - 15 - vertical - 20 - - - True - False - 6 - 6 - True - - - True - False - account-combo-model - account - group_id - - - 1 - 1 - 1 - 1 - - - - - 170 - True - False - account - uid - - - 1 - 0 - 1 - 1 - - - - - 130 - True - False - 1 - UID: - - - 0 - 0 - 1 - 1 - - - - - True - False - 1 - Main group: - - - 0 - 1 - 1 - 1 - - - - - True - False - account - last_change - - - 1 - 2 - 1 - 1 - - - - - True - False - account - expire - - - 1 - 3 - 1 - 1 - - - - - True - False - 1 - Last change: - - - 0 - 2 - 1 - 1 - - - - - True - False - 1 - Expires: - - - 0 - 3 - 1 - 1 - - - - - False - True - 0 - - - - - True - False - end - account - True - - - False - True - 1 - - - - - 1 - - - - - 100 - True - False - Account - - - 1 - False - - - - - True - False - 15 - vertical - 6 - - - 160 - True - True - in - - - True - True - False - alias - - - - - - Alias - alias-combo-model - mail_alias_id - True - - - - - - - False - True - 1 - - - - - True - False - 6 - end - alias - VN_HANDLER_SHOW_REMOVE | VN_HANDLER_SHOW_ADD - - - False - True - 2 - - - - - 2 - - - - - 100 - True - False - Mail alias - - - 2 - False - - - - - True - False - 15 - vertical - 20 - - - True - False - start - 6 - 6 - True - - - 130 - True - False - 1 - Extension: - - - 0 - 0 - 1 - 1 - - - - - True - False - 1 - Secret: - - - 0 - 1 - 1 - 1 - - - - - True - False - 1 - Identifier: - - - 0 - 2 - 1 - 1 - - - - - True - False - 1 - Call group: - - - 0 - 3 - 1 - 1 - - - - - 170 - True - False - sip - extension - - - 1 - 0 - 1 - 1 - - - - - True - False - sip - secret - - - 1 - 1 - 1 - 1 - - - - - True - False - sip - callerid - - - 1 - 2 - 1 - 1 - - - - - True - False - sip - callgroup - - - 1 - 3 - 1 - 1 - - - - - False - True - 0 - - - - - True - False - 6 - end - sip - - - False - True - 1 - - - - - 3 - - - - - 100 - True - False - SIP - - - 3 - False - - - - - False - False - 3 - - - - - - - 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 - - - - - SELECT user_id, extension, secret, callerid, callgroup -FROM account_sip -WHERE #p - - - - - SELECT id, alias FROM mail_alias - - - - - - SELECT id, user FROM mysql_user - - - - - - SELECT mail_alias_id, user_id -FROM mail_alias_account -WHERE #p - - - - - SELECT user_id, group_id, uid, last_change, expire -FROM account -WHERE #p - - - - - SELECT id, name FROM `group` - - - - - - False - 5 - Change password - False - True - True - dialog - - - - - False - vertical - 2 - - - True - False - - - False - 8 - 8 - - - True - False - - - False - True - 0 - - - - - True - True - 0 - - - - - False - 5 - vertical - end - - - - - - False - True - 1 - - - - - False - True - 0 - - - - - True - False - 6 - 6 - 6 - - - True - False - 1 - Password: - - - 0 - 0 - 1 - 1 - - - - - True - False - 1 - Repeat password: - - - 0 - 1 - 1 - 1 - - - - - True - True - False - - True - - - 1 - 0 - 1 - 1 - - - - - True - True - False - - True - - - 1 - 1 - 1 - 1 - - - - - False - True - 1 - - - - - False - end - - - - - - - - - False - True - end - 2 - - - - - - - diff --git a/module/src/Makefile.am b/module/src/Makefile.am index 7106c57..5542538 100644 --- a/module/src/Makefile.am +++ b/module/src/Makefile.am @@ -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 diff --git a/module/src/vn-users.c b/module/src/vn-users.c deleted file mode 100644 index 0f16dff..0000000 --- a/module/src/vn-users.c +++ /dev/null @@ -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 . - */ - -#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; -} diff --git a/module/src/vn-users.h b/module/src/vn-users.h deleted file mode 100644 index 2f692bb..0000000 --- a/module/src/vn-users.h +++ /dev/null @@ -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 . - */ - -#ifndef VN_USERS_H -#define VN_USERS_H - -#include - -#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 \ No newline at end of file diff --git a/po/POTFILES.in b/po/POTFILES.in index 6480a17..f784f74 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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