Copia de las ultimas modificaciones

This commit is contained in:
Juan Ferrer Toribio 2013-12-16 12:11:47 +01:00
parent 67bd1ad79c
commit 7a61f30bad
13 changed files with 102 additions and 20 deletions

View File

@ -1,5 +1,15 @@
gtkdocize --copy
autoreconf -fi
glib-gettextize --force --copy
#!/bin/sh
test -n "$srcdir" || srcdir=`dirname "$0"`
test -n "$srcdir" || srcdir=.
builddir=`pwd`
mkdir -p $builddir/m4
cd $srcdir
gtkdocize --copy &&
autoreconf -fi &&
glib-gettextize --copy --force &&
intltoolize --copy --force --automake
automake --add-missing --copy
exit $?

View File

@ -87,8 +87,6 @@ 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])
@ -117,7 +115,6 @@ AC_CONFIG_FILES([
module/Makefile
module/src/Makefile
module/data/Makefile
module/sql/Makefile
main/Makefile
main/vn-hedera.desktop
vapi/Makefile

View File

@ -5,6 +5,7 @@
<menuitem name="Consulter" action="open-consulter"/>
<menuitem name="Users" action="open-users"/>
<menuitem name="Customer" action="open-customer"/>
<menuitem name="Allocator" action="open-allocator"/>
</menu>
</placeholder>
</menubar>

View File

@ -33,5 +33,13 @@
accel="F5">
Customer
</form>
<form
translatable="yes"
name="allocator"
icon="x-office-address-book"
action-name="open-allocator"
accel="F6">
Allocator
</form>
</form-group>
</module>

View File

@ -14,7 +14,9 @@ libexample_la_SOURCES = \
vn-users.h \
vn-users.c \
vn-customer.h \
vn-customer.c
vn-customer.c \
vn-allocator.h \
vn-allocator.c
install-data-hook:
rm -f $(DESTDIR)$(module_libdir)/libexample.la

View File

@ -47,7 +47,7 @@ static void sql_batch_child_changed (SqlBatch * child, SqlBatch * obj)
* sql_batch_is_ready:
* @obj: a #SqlBatch
*
* Checks if @obj and all of its elemens are ready to be rendered.
* Checks if @obj and all of its elements are ready to be rendered.
*
* Return value: %TRUE if ready, %FALSE otherwise.
**/

View File

@ -45,6 +45,11 @@ static void sql_holder_render (SqlHolder * obj, SqlRender * render)
sql_render_printf (render, "#%s", obj->id);
}
static void sql_holder_find_holders (SqlHolder * obj, GQueue * holders)
{
g_queue_push_tail (holders, obj->id);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
/**
@ -116,6 +121,7 @@ static void sql_holder_class_init (SqlHolderClass * k)
klass->set_property = (GObjectSetPropertyFunc) sql_holder_set_property;
klass->get_property = (GObjectGetPropertyFunc) sql_holder_get_property;
SQL_OBJECT_CLASS (klass)->render = (SqlRenderFunc) sql_holder_render;
SQL_OBJECT_CLASS (klass)->find_holders = (SqlObjectFindHoldersFunc) sql_holder_find_holders;
g_object_class_install_property (klass, PROP_ID,
g_param_spec_string ("id"

View File

@ -35,7 +35,7 @@ static void sql_list_render (SqlList * obj, SqlRender * render)
{
GList * i;
for (i = obj->items.tail; i; i = i->next)
for (i = obj->items.head; i; i = i->next)
{
sql_render_add_object (render, i->data);
@ -48,13 +48,21 @@ static gboolean sql_list_is_ready (SqlList * obj)
{
GList * i;
for (i = obj->items.tail; i; i = i->next)
for (i = obj->items.head; i; i = i->next)
if (!sql_object_is_ready (i->data))
return FALSE;
return TRUE;
}
static void sql_list_find_holders (SqlList * obj, GQueue * holders)
{
GList * i;
for (i = obj->items.head; i; i = i->next)
sql_object_get_holders (i->data, holders);
}
static void sql_list_item_changed (SqlObject * item, SqlObject * obj)
{
sql_object_changed (obj);
@ -93,7 +101,7 @@ void sql_list_insert (SqlList * obj, gpointer item, guint n)
if (n > 0)
g_queue_push_nth (&obj->items, g_object_ref_sink (item), n);
else
g_queue_push_head (&obj->items, g_object_ref_sink (item));
g_queue_push_tail (&obj->items, g_object_ref_sink (item));
g_signal_connect (item, "changed",
G_CALLBACK (sql_list_item_changed), obj
@ -148,7 +156,7 @@ GList * sql_list_get_items (SqlList * obj)
{
g_return_val_if_fail (SQL_IS_LIST (obj), NULL);
return obj->items.tail;
return obj->items.head;
}
/**
@ -229,7 +237,7 @@ static void sql_list_finalize (SqlList * obj)
{
GList * i;
for (i = obj->items.tail; i; i = i->next)
for (i = obj->items.head; i; i = i->next)
{
g_signal_handlers_disconnect_by_func (i->data,
sql_list_item_changed, obj);
@ -248,6 +256,7 @@ static void sql_list_class_init (SqlListClass * k)
klass->get_property = (GObjectGetPropertyFunc) sql_list_get_property;
SQL_OBJECT_CLASS (klass)->render = (SqlRenderFunc) sql_list_render;
SQL_OBJECT_CLASS (klass)->is_ready = (SqlObjectIsReadyFunc) sql_list_is_ready;
SQL_OBJECT_CLASS (klass)->find_holders = (SqlObjectFindHoldersFunc) sql_list_find_holders;
g_object_class_install_property (klass, PROP_LENGTH,
g_param_spec_uint ("length"

View File

@ -41,6 +41,24 @@ static void sql_object_child_changed (SqlObject * child, SqlObject * obj)
sql_object_changed (obj);
}
static void sql_object_find_holders (SqlObject * obj, GQueue * holders)
{
guint i;
guint nparams;
GParamSpec ** params;
params = g_object_class_list_properties (G_OBJECT_GET_CLASS (obj), &nparams);
for (i = 0; i < nparams; i++)
if (SQL_IS_PARAM_OBJECT (params[i]) || SQL_IS_PARAM_LIST (params[i]))
{
SqlObject * child = sql_object_get (obj, params[i]->name);
sql_object_get_holders (child, holders);
}
g_free (params);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Protected
/**
@ -177,6 +195,23 @@ void sql_object_remove_child (SqlObject * obj, const gchar * property, guint n)
sql_list_remove (list, n);
}
/**
* sql_object_get_holders:
* @obj: a #SqlObject
* @holders: a #GQueue
*
* Gets all identifiers of the contained holders.
**/
void sql_object_get_holders (SqlObject * obj, GQueue * holders)
{
if (!obj)
return;
g_return_if_fail (SQL_IS_OBJECT (obj));
SQL_OBJECT_GET_CLASS (obj)->find_holders (obj, holders);
}
/**
* sql_object_changed:
* @obj: a #SqlObject
@ -200,6 +235,7 @@ static void sql_object_finalize (SqlObject * obj)
static void sql_object_class_init (SqlObjectClass * klass)
{
G_OBJECT_CLASS (klass)->finalize = (GObjectFinalizeFunc) sql_object_finalize;
klass->find_holders = sql_object_find_holders;
klass->is_ready = NULL;
klass->render = NULL;

View File

@ -31,7 +31,8 @@
typedef struct _SqlObject SqlObject;
typedef struct _SqlObjectClass SqlObjectClass;
typedef gboolean (* SqlObjectIsReadyFunc) (SqlObject * obj);
typedef gboolean (* SqlObjectIsReadyFunc) (SqlObject * obj);
typedef void (* SqlObjectFindHoldersFunc) (SqlObject * obj, GQueue * holders);
struct _SqlObject
{
@ -44,6 +45,7 @@ struct _SqlObjectClass
GInitiallyUnownedClass parent;
gpointer /* SqlRenderFunc */ render;
SqlObjectIsReadyFunc is_ready;
SqlObjectFindHoldersFunc find_holders;
};
#include "sql-holder.h"
@ -53,6 +55,7 @@ struct _SqlObjectClass
GType sql_object_get_type ();
void sql_object_render (SqlObject * obj, SqlRender * render);
gboolean sql_object_is_ready (SqlObject * obj);
void sql_object_get_holders (SqlObject * obj, GQueue * holders);
void sql_object_set (SqlObject * obj, const gchar * property, SqlObject * set);
SqlObject * sql_object_get (SqlObject * obj, const gchar * property);
@ -63,4 +66,4 @@ void sql_object_changed (SqlObject * obj);
gpointer sql_object_add (gpointer obj, gpointer child);
void sql_object_remove (gpointer obj, gpointer child);
#endif
#endif

View File

@ -21,8 +21,8 @@
#include "sql-object.h"
#define SQL_TYPE_PARAM_LIST (sql_param_list_get_type ())
#define SQL_PARAM_LIST(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), SQL_TYPE_PARAM_LIST, SqlParamList))
#define SQL_PARAM_LIST(pspec) (G_TYPE_CHECK_INSTANCE_CAST (pspec, SQL_TYPE_PARAM_LIST, SqlParamList))
#define SQL_IS_PARAM_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, SQL_TYPE_PARAM_LIST))
typedef struct
{

View File

@ -20,8 +20,9 @@
#include "sql-object.h"
#define SQL_TYPE_PARAM_OBJECT (sql_param_object_get_type ())
#define SQL_PARAM_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), SQL_TYPE_PARAM_OBJECT, SqlParamObject))
#define SQL_TYPE_PARAM_OBJECT (sql_param_object_get_type ())
#define SQL_PARAM_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST (pspec, SQL_TYPE_PARAM_OBJECT, SqlParamObject))
#define SQL_IS_PARAM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, SQL_TYPE_PARAM_OBJECT))
typedef struct
{

View File

@ -59,6 +59,14 @@ static void sql_string_render (SqlString * obj, SqlRender * render)
sql_render_append (render, ptr);
}
static void sql_string_find_holders (SqlString * obj, GQueue * holders)
{
GSList * i;
for (i = obj->holders; i; i = i->next)
sql_object_get_holders (((HolderData *) i->data)->holder);
}
static void sql_string_free_holder_data (HolderData * holder_data)
{
g_object_unref (holder_data->holder);
@ -173,6 +181,7 @@ static void sql_string_class_init (SqlStringClass * k)
klass->set_property = (GObjectSetPropertyFunc) sql_string_set_property;
klass->get_property = (GObjectGetPropertyFunc) sql_string_get_property;
SQL_OBJECT_CLASS (klass)->render = (SqlRenderFunc) sql_string_render;
SQL_OBJECT_CLASS (klass)->find_holders = (SqlObjectFindHoldersFunc) sql_string_find_holders;
g_object_class_install_property (klass, PROP_SQL,
g_param_spec_string ("sql"