Adaptacion al nuevo sistema de SqlLib. Versión Alpha.
This commit is contained in:
parent
7a61f30bad
commit
030ccc8335
4
INSTALL
4
INSTALL
|
@ -12,8 +12,8 @@ without warranty of any kind.
|
|||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell commands `./configure; make; make install' should
|
||||
configure, build, and install this package. The following
|
||||
Briefly, the shell command `./configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the `README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
`INSTALL' file but do not implement all of the features documented
|
||||
|
|
|
@ -60,7 +60,7 @@ AM_XGETTEXT_OPTION([-k_ -kQ_:1g -kN_ -kC_:1c,2 -kNC_:1c,2])
|
|||
# GSettings configuration
|
||||
GLIB_GSETTINGS
|
||||
|
||||
CFLAGS=" -Wall"
|
||||
CFLAGS=" -Wno-deprecated -Wall"
|
||||
|
||||
# Check for debug mode
|
||||
AC_MSG_CHECKING([whether to build with debug information...])
|
||||
|
|
35
db/db-conn.c
35
db/db-conn.c
|
@ -574,13 +574,16 @@ DbResultSet * db_conn_exec (DbConn * obj, const gchar * sql, GError ** err)
|
|||
*
|
||||
* Return value: (transfer full): the new #DbRequest
|
||||
**/
|
||||
DbRequest * db_conn_query (DbConn * obj, const gchar * sql)
|
||||
DbRequest * db_conn_query (DbConn * obj, const gchar * sql, SqlBatch * batch)
|
||||
{
|
||||
SqlObject * string;
|
||||
DbRequest * request;
|
||||
|
||||
g_return_val_if_fail (DB_IS_CONN (obj), NULL);
|
||||
|
||||
request = db_request_new (obj, sql);
|
||||
string = sql_string_new (sql);
|
||||
|
||||
request = db_request_new_with_stmt (obj, SQL_STMT (string), batch);
|
||||
db_request_exec (request, NULL);
|
||||
return request;
|
||||
}
|
||||
|
@ -594,13 +597,13 @@ DbRequest * db_conn_query (DbConn * obj, const gchar * sql)
|
|||
*
|
||||
* Return value: (transfer full): the new #DbRequest
|
||||
**/
|
||||
DbRequest * db_conn_query_with_stmt (DbConn * obj, SqlStmt * stmt)
|
||||
DbRequest * db_conn_query_with_stmt (DbConn * obj, SqlStmt * stmt, SqlBatch * batch)
|
||||
{
|
||||
DbRequest * request;
|
||||
|
||||
g_return_val_if_fail (DB_IS_CONN (obj), NULL);
|
||||
|
||||
request = db_request_new_with_stmt (obj, stmt);
|
||||
request = db_request_new_with_stmt (obj, stmt, batch);
|
||||
db_request_exec (request, NULL);
|
||||
return request;
|
||||
}
|
||||
|
@ -615,14 +618,17 @@ DbRequest * db_conn_query_with_stmt (DbConn * obj, SqlStmt * stmt)
|
|||
*
|
||||
* Return value: (transfer full): the new #DbRequest
|
||||
**/
|
||||
DbRequest * db_conn_query_async (DbConn * obj, const gchar * sql,
|
||||
DbRequest * db_conn_query_async (DbConn * obj, const gchar * sql, SqlBatch * batch,
|
||||
DbRequestDoneCallback callback, gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
SqlObject * string;
|
||||
DbRequest * request;
|
||||
|
||||
g_return_val_if_fail (DB_IS_CONN (obj), NULL);
|
||||
|
||||
request = db_request_new (obj, sql);
|
||||
string = sql_string_new (sql);
|
||||
|
||||
request = db_request_new_with_stmt (obj, SQL_STMT (string), batch);
|
||||
db_request_set_callback (request, callback, user_data, notify);
|
||||
db_conn_add_request (obj, request);
|
||||
return request;
|
||||
|
@ -638,14 +644,14 @@ DbRequest * db_conn_query_async (DbConn * obj, const gchar * sql,
|
|||
*
|
||||
* Return value: (transfer full): the new #DbRequest
|
||||
**/
|
||||
DbRequest * db_conn_query_with_stmt_async (DbConn * obj, SqlStmt * stmt,
|
||||
DbRequest * db_conn_query_with_stmt_async (DbConn * obj, SqlStmt * stmt, SqlBatch * batch,
|
||||
DbRequestDoneCallback callback, gpointer user_data, GDestroyNotify notify)
|
||||
{
|
||||
DbRequest * request;
|
||||
|
||||
g_return_val_if_fail (DB_IS_CONN (obj), NULL);
|
||||
|
||||
request = db_request_new_with_stmt (obj, stmt);
|
||||
request = db_request_new_with_stmt (obj, stmt, batch);
|
||||
db_request_set_callback (request, callback, user_data, notify);
|
||||
db_conn_add_request (obj, request);
|
||||
return request;
|
||||
|
@ -662,14 +668,14 @@ DbRequest * db_conn_query_with_stmt_async (DbConn * obj, SqlStmt * stmt,
|
|||
*
|
||||
* Return value: %TRUE on success, %FALSE on failure
|
||||
**/
|
||||
gboolean db_conn_query_value (DbConn * obj, const gchar * sql, GValue * value, GError ** err)
|
||||
gboolean db_conn_query_value (DbConn * obj, const gchar * sql, SqlBatch * batch, GValue * value, GError ** err)
|
||||
{
|
||||
gboolean success;
|
||||
DbRequest * request;
|
||||
|
||||
g_return_val_if_fail (DB_IS_CONN (obj), FALSE);
|
||||
|
||||
request = db_conn_query (obj, sql);
|
||||
request = db_conn_query (obj, sql, batch);
|
||||
success = db_request_fetch_value (request, value, err);
|
||||
g_object_unref (request);
|
||||
|
||||
|
@ -728,12 +734,13 @@ SqlStmt * db_conn_parse (DbConn * obj, gchar * sql)
|
|||
*
|
||||
* Return value: (transfer full): the rendered string, or %NULL if error.
|
||||
**/
|
||||
gchar * db_conn_render (DbConn * obj, gpointer object, GError ** err)
|
||||
gchar * db_conn_render (DbConn * obj, gpointer object, SqlBatch * batch, GError ** err)
|
||||
{
|
||||
g_return_val_if_fail (DB_IS_CONN (obj), NULL);
|
||||
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
|
||||
g_return_val_if_fail (SQL_IS_BATCH (batch) || !batch, NULL);
|
||||
|
||||
return db_plugin_render (obj->plugin, object, err);
|
||||
return db_plugin_render (obj->plugin, object, batch, err);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -884,11 +891,11 @@ gchar * db_conn_get_schema (DbConn * obj)
|
|||
*
|
||||
* Return value: (transfer full): an #SqlString
|
||||
**/
|
||||
SqlString * db_conn_create_stmt_from_file (DbConn * obj, const gchar * query_file)
|
||||
SqlObject * db_conn_create_stmt_from_file (DbConn * obj, const gchar * query_file)
|
||||
{
|
||||
gint i;
|
||||
gchar * file;
|
||||
SqlString * stmt = NULL;
|
||||
SqlObject * stmt = NULL;
|
||||
|
||||
g_return_val_if_fail (DB_IS_CONN (obj), NULL);
|
||||
g_return_val_if_fail (query_file, NULL);
|
||||
|
|
12
db/db-conn.h
12
db/db-conn.h
|
@ -119,27 +119,29 @@ gboolean db_conn_reconnect (DbConn * obj, GError ** err);
|
|||
|
||||
DbResultSet * db_conn_exec (DbConn * obj, const gchar * sql, GError ** err);
|
||||
|
||||
DbRequest * db_conn_query (DbConn * obj, const gchar * sql);
|
||||
DbRequest * db_conn_query (DbConn * obj, const gchar * sql, SqlBatch * batch);
|
||||
DbRequest * db_conn_query_async (DbConn * obj
|
||||
,const gchar * sql
|
||||
,SqlBatch * batch
|
||||
,DbRequestDoneCallback callback
|
||||
,gpointer user_data
|
||||
,GDestroyNotify notify);
|
||||
|
||||
DbRequest * db_conn_query_with_stmt (DbConn * obj, SqlStmt * stmt);
|
||||
DbRequest * db_conn_query_with_stmt (DbConn * obj, SqlStmt * stmt, SqlBatch * batch);
|
||||
DbRequest * db_conn_query_with_stmt_async (DbConn * obj
|
||||
,SqlStmt * stmt
|
||||
,SqlBatch * batch
|
||||
,DbRequestDoneCallback callback
|
||||
,gpointer user_data
|
||||
,GDestroyNotify notify);
|
||||
|
||||
gboolean db_conn_query_value (DbConn * obj, const gchar * sql, GValue * value, GError ** err);
|
||||
gboolean db_conn_query_value (DbConn * obj, const gchar * sql, SqlBatch * batch, GValue * value, GError ** err);
|
||||
|
||||
void db_conn_retry (DbConn * obj);
|
||||
void db_conn_kill_query (DbConn * obj);
|
||||
|
||||
SqlStmt * db_conn_parse (DbConn * obj, gchar * sql);
|
||||
gchar * db_conn_render (DbConn * obj, gpointer object, GError ** err);
|
||||
gchar * db_conn_render (DbConn * obj, gpointer object, SqlBatch * batch, GError ** err);
|
||||
guchar * db_conn_escape_binary (DbConn * obj, const guchar * from, gsize from_size, gsize * to_size);
|
||||
|
||||
void db_conn_start_transaction (DbConn * obj);
|
||||
|
@ -150,6 +152,6 @@ gchar * db_conn_get_user (DbConn * obj);
|
|||
gchar * db_conn_get_host (DbConn * obj);
|
||||
gchar * db_conn_get_schema (DbConn * obj);
|
||||
|
||||
SqlString * db_conn_create_stmt_from_file (DbConn * obj, const gchar * query_file);
|
||||
SqlObject * db_conn_create_stmt_from_file (DbConn * obj, const gchar * query_file);
|
||||
|
||||
#endif
|
|
@ -838,7 +838,7 @@ void db_iterator_link_with_param (DbIterator * obj, const gchar * field, GvnPara
|
|||
g_return_if_fail (obj->model);
|
||||
g_return_if_fail (field);
|
||||
|
||||
db_model_set_default_value_from_param (obj->model, field, param);
|
||||
db_model_set_default_value_from_param (obj->model, field, param, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
1064
db/db-model.c
1064
db/db-model.c
File diff suppressed because it is too large
Load Diff
|
@ -245,16 +245,11 @@ gboolean db_model_iter_is_valid (DbIter * iter
|
|||
void db_model_add_join_columns (DbModel * obj
|
||||
,const gchar * left
|
||||
,const gchar * right);
|
||||
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);
|
||||
void db_model_add_param (DbModel * obj
|
||||
,const gchar * id
|
||||
,GvnParam * param);
|
||||
SqlBatch * db_model_get_batch (DbModel * obj);
|
||||
void db_model_set_batch (DbModel * obj, SqlBatch * batch);
|
||||
|
||||
void db_model_set_default_value_from_column (DbModel * obj, const gchar * field, const gchar * column);
|
||||
void db_model_set_default_value_from_param (DbModel * obj, const gchar * field, GvnParam * param, gboolean link);
|
||||
|
||||
//GtkTreeModel-like methods
|
||||
|
||||
|
|
|
@ -183,12 +183,13 @@ SqlStmt * db_plugin_parse (DbPlugin * obj, gchar * sql)
|
|||
*
|
||||
* Return value: (transfer full): the rendered string, or %NULL if error.
|
||||
**/
|
||||
gchar * db_plugin_render (DbPlugin * obj, gpointer object, GError ** err)
|
||||
gchar * db_plugin_render (DbPlugin * obj, gpointer object, SqlBatch * batch, GError ** err)
|
||||
{
|
||||
g_return_val_if_fail (DB_IS_PLUGIN (obj), NULL);
|
||||
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
|
||||
g_return_val_if_fail (SQL_IS_BATCH (batch) || !batch, NULL);
|
||||
|
||||
return sql_render_get_string (obj->render, object, obj, err);
|
||||
return sql_render_get_string (obj->render, object, batch, obj, err);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
|
||||
|
|
|
@ -78,6 +78,6 @@ void db_plugin_set_ssl (DbPlugin * obj, const gchar * ca);
|
|||
DbResultSet * db_plugin_query (DbPlugin * obj, const gchar * sql, GError ** err);
|
||||
void db_plugin_kill_query (DbPlugin * obj);
|
||||
SqlStmt * db_plugin_parse (DbPlugin * obj, gchar * sql);
|
||||
gchar * db_plugin_render (DbPlugin * obj, gpointer object, GError ** err);
|
||||
gchar * db_plugin_render (DbPlugin * obj, gpointer object, SqlBatch * batch, GError ** err);
|
||||
|
||||
#endif
|
|
@ -73,12 +73,13 @@ DbRequest * db_request_new (DbConn * conn, const gchar * sql)
|
|||
*
|
||||
* Return value: a new #DbRequest
|
||||
**/
|
||||
DbRequest * db_request_new_with_stmt (DbConn * conn, SqlStmt * stmt)
|
||||
DbRequest * db_request_new_with_stmt (DbConn * conn, SqlStmt * stmt, SqlBatch * batch)
|
||||
{
|
||||
g_return_val_if_fail (DB_IS_CONN (conn), NULL);
|
||||
g_return_val_if_fail (SQL_IS_STMT (stmt), NULL);
|
||||
g_return_val_if_fail (SQL_IS_BATCH (batch) || !batch, NULL);
|
||||
|
||||
return g_object_new (DB_TYPE_REQUEST, "conn", conn, "stmt", stmt, NULL);
|
||||
return g_object_new (DB_TYPE_REQUEST, "conn", conn, "batch", batch, "stmt", stmt, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -352,6 +353,7 @@ typedef enum
|
|||
PROP_CONN = 1
|
||||
,PROP_SQL
|
||||
,PROP_STMT
|
||||
,PROP_BATCH
|
||||
,PROP_RESULT_SET
|
||||
,PROP_ERROR
|
||||
}
|
||||
|
@ -381,12 +383,15 @@ static void db_request_set_property (DbRequest * obj, guint property_id,
|
|||
SqlStmt * stmt = g_value_get_object (value);
|
||||
|
||||
if (obj->conn && stmt)
|
||||
obj->sql = db_conn_render (obj->conn, stmt, NULL);
|
||||
obj->sql = db_conn_render (obj->conn, stmt, obj->batch, NULL);
|
||||
else if (!obj->conn)
|
||||
g_warning ("DbRequest: Can't render stmt, conn property not set");
|
||||
|
||||
break;
|
||||
}
|
||||
case PROP_BATCH:
|
||||
obj->batch = g_value_dup_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, property_id, pspec);
|
||||
}
|
||||
|
@ -470,6 +475,13 @@ static void db_request_class_init (DbRequestClass * k)
|
|||
,SQL_TYPE_STMT
|
||||
,G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE
|
||||
));
|
||||
g_object_class_install_property (klass, PROP_BATCH,
|
||||
g_param_spec_object ("batch"
|
||||
,_("Batch")
|
||||
,_("The batch for render the statement")
|
||||
,SQL_TYPE_BATCH
|
||||
,G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE
|
||||
));
|
||||
g_object_class_install_property (klass, PROP_RESULT_SET,
|
||||
g_param_spec_boxed ("result-set"
|
||||
,_("Result")
|
||||
|
|
|
@ -60,6 +60,7 @@ struct _DbRequest
|
|||
|
||||
/* <private> */
|
||||
DbConn * conn;
|
||||
SqlBatch * batch;
|
||||
gchar * sql;
|
||||
DbResultSet * result_set;
|
||||
GError * error;
|
||||
|
@ -78,7 +79,7 @@ struct _DbRequestClass
|
|||
|
||||
GType db_request_get_type ();
|
||||
DbRequest * db_request_new (DbConn * conn, const gchar * sql);
|
||||
DbRequest * db_request_new_with_stmt (DbConn * conn, SqlStmt * stmt);
|
||||
DbRequest * db_request_new_with_stmt (DbConn * conn, SqlStmt * stmt, SqlBatch * batch);
|
||||
DbResult * db_request_fetch_result (DbRequest * obj, GError ** err);
|
||||
gint db_request_fetch_non_select (DbRequest * obj, GError ** err);
|
||||
gboolean db_request_fetch_value (DbRequest * obj, GValue * value, GError ** err);
|
||||
|
|
|
@ -9,6 +9,7 @@ AM_CPPFLAGS = \
|
|||
hedera_bin_LDFLAGS = -Wl,--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
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
SUBDIRS = \
|
||||
src \
|
||||
data \
|
||||
sql
|
||||
data
|
||||
|
|
|
@ -83,8 +83,8 @@ void vn_users_on_dialog_response (GtkDialog * dialog, gint response_id, VnUsers
|
|||
query = sql_string_new ("SELECT user_set_password (#user, #password)");
|
||||
|
||||
batch = sql_batch_new ();
|
||||
sql_batch_add_from_param ("user", obj->user_id);
|
||||
sql_batch_add_from_value ("password", G_TYPE_STRING, password);
|
||||
sql_batch_add_from_param (batch, "user", obj->user_id);
|
||||
sql_batch_add_from_value (batch, "password", G_TYPE_STRING, password);
|
||||
|
||||
db_conn_query_with_stmt_async (VN_FORM (obj)->conn
|
||||
,SQL_STMT (query)
|
||||
|
@ -108,8 +108,11 @@ static void vn_users_open (VnUsers * obj, gpointer user_data)
|
|||
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);
|
||||
gtk_dialog_add_buttons (obj->password_dialog
|
||||
,_("Cancel"), GTK_RESPONSE_CANCEL
|
||||
,_("Apply"), GTK_RESPONSE_ACCEPT
|
||||
,NULL
|
||||
);
|
||||
|
||||
users = vn_form_get (form, "users");
|
||||
obj->user_id = db_iterator_get_param (users, "id");
|
||||
|
|
|
@ -271,7 +271,7 @@ static DbResultSet * db_mysql_query (DbMysql * obj, const gchar * sql, GError **
|
|||
|
||||
if (field[i].flags & AUTO_INCREMENT_FLAG)
|
||||
{
|
||||
SqlFunction * func = sql_function_new ("LAST_INSERT_ID", NULL);
|
||||
SqlObject * func = sql_function_new ("LAST_INSERT_ID", NULL);
|
||||
|
||||
g_value_init (&def, SQL_TYPE_FUNCTION);
|
||||
g_value_take_object (&def, g_object_ref_sink (func));
|
||||
|
@ -374,7 +374,7 @@ static void db_mysql_kill_query (DbMysql * obj)
|
|||
}
|
||||
}
|
||||
|
||||
static void db_mysql_value_render (SqlValue * obj, SqlRender * render)
|
||||
static void db_mysql_value_render (SqlValue * obj, SqlRender * render, SqlBatch * batch)
|
||||
{
|
||||
if (G_VALUE_TYPE (obj->value) == G_TYPE_BYTES)
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ static void db_mysql_value_render (SqlValue * obj, SqlRender * render)
|
|||
sql_render_append (render, "'");
|
||||
}
|
||||
else
|
||||
sql_object_render (SQL_OBJECT (obj), render);
|
||||
sql_object_render (SQL_OBJECT (obj), render, batch);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
|
||||
|
|
|
@ -16,8 +16,43 @@
|
|||
*/
|
||||
|
||||
#include <libpq-fe.h>
|
||||
#include <postgres_fe.h>
|
||||
#include <catalog/pg_type.h>
|
||||
|
||||
//#include <internal/postgres_fe.h>
|
||||
// Replaces postgres_fe.h until it gets fixed
|
||||
#ifndef FRONTEND
|
||||
#define FRONTEND 1
|
||||
#endif
|
||||
|
||||
#include <internal/c.h>
|
||||
// end of the "fix"
|
||||
|
||||
//#include <catalog/pg_type.h>
|
||||
// catalog/pg_type.h has been removed from Debian, this fixes its lack
|
||||
#define BOOLOID 16
|
||||
#define INT8OID 20
|
||||
#define INT2OID 21
|
||||
#define INT4OID 23
|
||||
#define TIDOID 27
|
||||
#define OIDOID 26
|
||||
#define FLOAT4OID 700
|
||||
#define FLOAT8OID 701
|
||||
#define NUMERICOID 1700
|
||||
#define DATEOID 1082
|
||||
#define TIMESTAMPOID 1114
|
||||
#define TIMESTAMPTZOID 1184
|
||||
#define TIMEOID 1083
|
||||
#define TIMETZOID 1266
|
||||
#define BYTEAOID 17
|
||||
#define ABSTIMEOID 702
|
||||
#define RELTIMEOID 703
|
||||
#define TINTERVALOID 704
|
||||
#define CHAROID 18
|
||||
#define TEXTOID 25
|
||||
#define NAMEOID 19
|
||||
#define BPCHAROID 1042
|
||||
#define VARCHAROID 1043
|
||||
// end of the "fix"
|
||||
|
||||
// Macros to avoid redefinition warnings for constants
|
||||
#undef PACKAGE_BUGREPORT
|
||||
#undef PACKAGE_NAME
|
||||
|
@ -136,8 +171,6 @@ static GType db_pg_get_g_type (Oid type)
|
|||
case CHAROID:
|
||||
case TEXTOID:
|
||||
case NAMEOID:
|
||||
case XMLOID:
|
||||
case CSTRINGOID:
|
||||
case BPCHAROID:
|
||||
case VARCHAROID:
|
||||
default:
|
||||
|
@ -332,6 +365,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;
|
||||
|
@ -836,7 +870,7 @@ static void db_pg_kill_query (DbPg * obj)
|
|||
}
|
||||
}
|
||||
|
||||
static void db_pg_value_render (SqlValue * obj, SqlRender * render)
|
||||
static void db_pg_value_render (SqlValue * obj, SqlRender * render, SqlBatch * batch)
|
||||
{
|
||||
if (G_VALUE_TYPE (obj->value) == G_TYPE_BYTES)
|
||||
{
|
||||
|
@ -853,7 +887,7 @@ static void db_pg_value_render (SqlValue * obj, SqlRender * render)
|
|||
PQfreemem (buffer);
|
||||
}
|
||||
else
|
||||
sql_object_render (SQL_OBJECT (obj), render);
|
||||
sql_object_render (SQL_OBJECT (obj), render, batch);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
|
||||
|
|
107
sql/sql-batch.c
107
sql/sql-batch.c
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
* The #SqlBatch is the base class for all objects in SqlLib.
|
||||
**/
|
||||
G_DEFINE_ABSTRACT_TYPE (SqlBatch, sql_batch, G_TYPE_INITIALLY_UNOWNED);
|
||||
G_DEFINE_TYPE (SqlBatch, sql_batch, G_TYPE_INITIALLY_UNOWNED);
|
||||
|
||||
enum {
|
||||
CHANGED
|
||||
|
@ -34,6 +34,11 @@ enum {
|
|||
|
||||
static guint signals[LAST_SIGNAL] = {0};
|
||||
|
||||
SqlBatch * sql_batch_new ()
|
||||
{
|
||||
return g_object_new (SQL_TYPE_BATCH, NULL);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
|
||||
|
||||
static void sql_batch_child_changed (SqlBatch * child, SqlBatch * obj)
|
||||
|
@ -53,7 +58,7 @@ static void sql_batch_child_changed (SqlBatch * child, SqlBatch * obj)
|
|||
**/
|
||||
gboolean sql_batch_is_ready (SqlBatch * obj)
|
||||
{
|
||||
SqlBatchClass * klass = SQL_BATCH_GET_CLASS (obj);
|
||||
gboolean is_ready = TRUE;
|
||||
|
||||
g_return_val_if_fail (SQL_IS_BATCH (obj), FALSE);
|
||||
|
||||
|
@ -61,50 +66,14 @@ gboolean sql_batch_is_ready (SqlBatch * obj)
|
|||
{
|
||||
GList * i;
|
||||
GList * items = g_hash_table_get_values (obj->items);
|
||||
gboolean is_ready = TRUE;
|
||||
|
||||
for (i = items; i; i = i->next)
|
||||
if (!sql_object_is_ready (i->data))
|
||||
{
|
||||
is_ready = FALSE;
|
||||
break;
|
||||
}
|
||||
for (i = items; i && is_ready; i = i->next)
|
||||
is_ready = sql_object_is_ready (i->data);
|
||||
|
||||
g_list_free (items);
|
||||
|
||||
if (!is_ready)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* sql_batch_add:
|
||||
* @obj: a #SqlBatch
|
||||
* @id: the id of the #SqlHolder
|
||||
* @held_object: the held object
|
||||
*
|
||||
* Adds a held object.
|
||||
**/
|
||||
void sql_batch_add (SqlBatch * obj, const gchar * id, SqlObject * held_object)
|
||||
{
|
||||
g_return_if_fail (SQL_IS_BATCH (obj));
|
||||
g_return_if_fail (id);
|
||||
|
||||
if (!obj->held_objects)
|
||||
obj->held_objects = g_hash_table_new_full (
|
||||
g_str_hash
|
||||
,g_str_equal
|
||||
,g_free
|
||||
,g_object_unref
|
||||
);
|
||||
|
||||
g_signal_connect (held_object, "changed",
|
||||
G_CALLBACK (sql_batch_child_changed), obj
|
||||
);
|
||||
g_hash_table_replace (obj->held_objects,
|
||||
g_strdup (id), g_object_ref_sink (held_object));
|
||||
return is_ready;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,12 +90,42 @@ SqlObject * sql_batch_get (SqlBatch * obj, const gchar * id)
|
|||
g_return_val_if_fail (SQL_IS_BATCH (obj), NULL);
|
||||
g_return_val_if_fail (id, NULL);
|
||||
|
||||
if (obj->held_objects)
|
||||
return g_hash_table_lookup (obj->held_objects, id);
|
||||
if (obj->items)
|
||||
return g_hash_table_lookup (obj->items, id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* sql_batch_add:
|
||||
* @obj: a #SqlBatch
|
||||
* @id: the id of the #SqlHolder
|
||||
* @held_object: the held object
|
||||
*
|
||||
* Adds a held object.
|
||||
**/
|
||||
void sql_batch_add (SqlBatch * obj, const gchar * id, SqlObject * object)
|
||||
{
|
||||
g_return_if_fail (SQL_IS_BATCH (obj));
|
||||
g_return_if_fail (id);
|
||||
|
||||
sql_batch_remove (obj, id);
|
||||
|
||||
if (!obj->items)
|
||||
obj->items = g_hash_table_new_full (
|
||||
g_str_hash
|
||||
,g_str_equal
|
||||
,g_free
|
||||
,NULL
|
||||
);
|
||||
|
||||
g_signal_connect (object, "changed",
|
||||
G_CALLBACK (sql_batch_child_changed), obj
|
||||
);
|
||||
g_hash_table_replace (obj->items,
|
||||
g_strdup (id), g_object_ref_sink (object));
|
||||
}
|
||||
|
||||
/**
|
||||
* sql_batch_add_from_param:
|
||||
* @obj: the #SqlString
|
||||
|
@ -165,6 +164,28 @@ void sql_batch_add_from_value (SqlBatch * obj, const gchar * id, GType type, gpo
|
|||
g_value_unset (&gvalue);
|
||||
}
|
||||
|
||||
/**
|
||||
* sql_batch_remove:
|
||||
* @id: the id of the #SqlHolder
|
||||
*
|
||||
* Removes a held object from the batch.
|
||||
**/
|
||||
void sql_batch_remove (SqlBatch * obj, const gchar * id)
|
||||
{
|
||||
g_return_val_if_fail (SQL_IS_BATCH (obj), NULL);
|
||||
g_return_val_if_fail (id, NULL);
|
||||
|
||||
SqlObject * object = sql_batch_get (obj, id);
|
||||
|
||||
if (object)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (object,
|
||||
sql_batch_child_changed, obj);
|
||||
g_object_unref (object);
|
||||
g_hash_table_remove (obj->items, id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sql_batch_changed:
|
||||
* @obj: a #SqlBatch
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#ifndef SQL_BATCH_H
|
||||
#define SQL_BATCH_H
|
||||
|
||||
#include "sql-object.h"
|
||||
#include <glib-object.h>
|
||||
|
||||
#define SQL_TYPE_BATCH (sql_batch_get_type ())
|
||||
#define SQL_BATCH(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, SQL_TYPE_BATCH, SqlBatch))
|
||||
|
@ -41,11 +41,16 @@ struct _SqlBatchClass
|
|||
GInitiallyUnownedClass parent;
|
||||
};
|
||||
|
||||
#include "sql-object.h"
|
||||
|
||||
GType sql_batch_get_type ();
|
||||
SqlBatch * sql_batch_new ();
|
||||
gboolean sql_batch_is_ready (SqlBatch * obj);
|
||||
void sql_batch_add (SqlBatch * obj, const gchar * id, SqlObject * held_object);
|
||||
SqlObject * sql_batch_get (SqlBatch * obj, const gchar * id);
|
||||
void sql_batch_add (SqlBatch * obj, const gchar * id, SqlObject * object);
|
||||
void sql_batch_add_from_param (SqlBatch * obj, const gchar * id, GvnParam * param);
|
||||
void sql_batch_add_from_value (SqlBatch * obj, const gchar * id, GType type, gpointer content);
|
||||
void sql_batch_remove (SqlBatch * obj, const gchar * id);
|
||||
void sql_batch_changed (SqlBatch * obj);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -102,8 +102,8 @@ static void sql_delete_class_init (SqlDeleteClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_TABLES,
|
||||
sql_param_list ("tables"
|
||||
,"Tables"
|
||||
,"A list of tables"
|
||||
,_("Tables")
|
||||
,_("A list of tables")
|
||||
,SQL_TYPE_TABLE
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "sql-dml.h"
|
||||
#include "sql-holder.h"
|
||||
|
||||
/**
|
||||
* SECTION: sql-dml
|
||||
|
@ -102,15 +103,15 @@ static void sql_dml_class_init (SqlDmlClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_TARGETS,
|
||||
sql_param_list ("targets"
|
||||
,"Targets"
|
||||
,"A list of targets"
|
||||
,_("Targets")
|
||||
,_("A list of targets")
|
||||
,SQL_TYPE_TARGET
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
g_object_class_install_property (k, PROP_WHERE,
|
||||
sql_param_object ("where"
|
||||
,"Where"
|
||||
,"The WHERE section of an statement"
|
||||
,_("Where")
|
||||
,_("The WHERE section of an statement")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
|
|
|
@ -158,22 +158,22 @@ static void sql_field_class_init (SqlFieldClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_NAME,
|
||||
g_param_spec_string ("name"
|
||||
,"Name"
|
||||
,"The column name"
|
||||
,_("Name")
|
||||
,_("The column name")
|
||||
,NULL
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_TARGET,
|
||||
g_param_spec_string ("target"
|
||||
,"Target"
|
||||
,"The target name"
|
||||
,_("Target")
|
||||
,_("The target name")
|
||||
,NULL
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_SCHEMA,
|
||||
g_param_spec_string ("schema"
|
||||
,"Schema"
|
||||
,"The schema name"
|
||||
,_("Schema")
|
||||
,_("The schema name")
|
||||
,NULL
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
|
|
|
@ -124,22 +124,22 @@ static void sql_function_class_init (SqlFunctionClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_NAME,
|
||||
g_param_spec_string ("name"
|
||||
,"Name"
|
||||
,"The function name"
|
||||
,_("Name")
|
||||
,_("The function name")
|
||||
,NULL
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_SCHEMA,
|
||||
g_param_spec_string ("schema"
|
||||
,"Schema"
|
||||
,"The schema to which the function belongs"
|
||||
,_("Schema")
|
||||
,_("The schema to which the function belongs")
|
||||
,NULL
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_PARAMS,
|
||||
sql_param_list ("params"
|
||||
,"Parameters"
|
||||
,"The function parameters"
|
||||
,_("Parameters")
|
||||
,_("The function parameters")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
|
|
|
@ -31,16 +31,12 @@ SqlObject * sql_holder_new (const gchar * id)
|
|||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
|
||||
|
||||
static void sql_holder_render (SqlHolder * obj, SqlRender * render)
|
||||
static void sql_holder_render (SqlHolder * obj, SqlRender * render, SqlBatch * batch)
|
||||
{
|
||||
SqlObject * held_object = NULL;
|
||||
GSList * i = sql_render_get_ancestors (render);
|
||||
|
||||
for (; i && !held_object; i = i->next)
|
||||
held_object = sql_object_get_held (held_object, obj->id);
|
||||
SqlObject * object = batch ? sql_batch_get (batch, obj->id) : NULL;
|
||||
|
||||
if (held_object)
|
||||
sql_render_add_object (render, held_object);
|
||||
if (object)
|
||||
sql_render_add_object (render, object);
|
||||
else
|
||||
sql_render_printf (render, "#%s", obj->id);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
#ifndef SQL_HOLDER_H
|
||||
#define SQL_HOLDER_H
|
||||
|
||||
#include "sql-object.h"
|
||||
|
||||
#define SQL_TYPE_HOLDER (sql_holder_get_type ())
|
||||
#define SQL_HOLDER(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, SQL_TYPE_HOLDER, SqlHolder))
|
||||
#define SQL_IS_HOLDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, SQL_TYPE_HOLDER))
|
||||
|
@ -27,6 +25,8 @@
|
|||
typedef struct _SqlHolder SqlHolder;
|
||||
typedef struct _SqlHolderClass SqlHolderClass;
|
||||
|
||||
#include "sql-object.h"
|
||||
|
||||
struct _SqlHolder
|
||||
{
|
||||
SqlObject parent;
|
||||
|
|
|
@ -147,22 +147,22 @@ static void sql_insert_class_init (SqlInsertClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_TABLE,
|
||||
sql_param_object ("table"
|
||||
,"Table"
|
||||
,"The table where the row is inserted"
|
||||
,_("Table")
|
||||
,_("The table where the row is inserted")
|
||||
,SQL_TYPE_TABLE
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_FIELDS,
|
||||
sql_param_list ("fields"
|
||||
,"Fields"
|
||||
,"The list of fields"
|
||||
,_("Fields")
|
||||
,_("The list of fields")
|
||||
,SQL_TYPE_FIELD
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
g_object_class_install_property (k, PROP_VALUES,
|
||||
sql_param_list ("values"
|
||||
,"Values"
|
||||
,"The list of values"
|
||||
,_("Values")
|
||||
,_("The list of values")
|
||||
,SQL_TYPE_SET
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "sql-join.h"
|
||||
#include "sql-field.h"
|
||||
#include "sql-holder.h"
|
||||
|
||||
/**
|
||||
* SECTION: sql-join
|
||||
|
@ -191,44 +192,44 @@ static void sql_join_class_init (SqlJoinClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_TARGET_LEFT,
|
||||
sql_param_list ("target-left"
|
||||
,"Left target"
|
||||
,"The left target in the join"
|
||||
,("Left target")
|
||||
,("The left target in the join")
|
||||
,SQL_TYPE_TARGET
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_TARGET_RIGHT,
|
||||
sql_param_list ("target-right"
|
||||
,"Right target"
|
||||
,"The right target in the join"
|
||||
,("Right target")
|
||||
,("The right target in the join")
|
||||
,SQL_TYPE_TARGET
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_TYPE,
|
||||
g_param_spec_enum ("join-type"
|
||||
,"Type"
|
||||
,"The type of join"
|
||||
,("Type")
|
||||
,("The type of join")
|
||||
,SQL_TYPE_JOIN_TYPE
|
||||
,SQL_JOIN_TYPE_INNER
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_CONDITION,
|
||||
sql_param_list ("condition"
|
||||
,"Condition"
|
||||
,"The condition used for the join"
|
||||
,("Condition")
|
||||
,("The condition used for the join")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_HAS_USING,
|
||||
g_param_spec_boolean ("has-using"
|
||||
,"Has using"
|
||||
,"Wether the condition is a USING"
|
||||
,("Has using")
|
||||
,("Wether the condition is a USING")
|
||||
,FALSE
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
g_object_class_install_property (k, PROP_CONDITION,
|
||||
sql_param_list ("using-fields"
|
||||
,"Using fields"
|
||||
,"The list of fields of the USING"
|
||||
,("Using fields")
|
||||
,("The list of fields of the USING")
|
||||
,SQL_TYPE_FIELD
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "sql-list.h"
|
||||
#include "sql-holder.h"
|
||||
|
||||
/**
|
||||
* SECTION: sql-list
|
||||
|
@ -68,6 +69,13 @@ static void sql_list_item_changed (SqlObject * item, SqlObject * obj)
|
|||
sql_object_changed (obj);
|
||||
}
|
||||
|
||||
static void sql_list_item_unref (SqlList * obj, SqlObject * item)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (item,
|
||||
sql_list_item_changed, obj);
|
||||
g_object_unref (item);
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
|
||||
|
||||
/**
|
||||
|
@ -88,60 +96,75 @@ void sql_list_add (SqlList * obj, gpointer item)
|
|||
* sql_list_insert:
|
||||
* @obj: the #SqlList
|
||||
* @item: (allow-none): the #SqlObject
|
||||
* @n: the position in which to place the item
|
||||
* @index: the position in which to place the item
|
||||
*
|
||||
* Adds an item to the list. If position is a negative number the element will
|
||||
* be added to the end of the list.
|
||||
**/
|
||||
void sql_list_insert (SqlList * obj, gpointer item, guint n)
|
||||
void sql_list_insert (SqlList * obj, gpointer item, guint index)
|
||||
{
|
||||
g_return_if_fail (SQL_IS_LIST (obj));
|
||||
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (item, obj->gtype) || SQL_IS_HOLDER (item) || !item);
|
||||
|
||||
if (!g_queue_find (&obj->items, item))
|
||||
g_signal_connect (item, "changed",
|
||||
G_CALLBACK (sql_list_item_changed), obj);
|
||||
|
||||
if (n > 0)
|
||||
g_queue_push_nth (&obj->items, g_object_ref_sink (item), n);
|
||||
if (index > 0)
|
||||
g_queue_push_nth (&obj->items, g_object_ref_sink (item), index);
|
||||
else
|
||||
g_queue_push_tail (&obj->items, g_object_ref_sink (item));
|
||||
|
||||
g_signal_connect (item, "changed",
|
||||
G_CALLBACK (sql_list_item_changed), obj
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* sql_list_get:
|
||||
* @obj: the #SqlList
|
||||
* @index: the index of the item
|
||||
*
|
||||
* Gets an item from the list.
|
||||
*
|
||||
* Return value: (transfer none) (allow-none): the selected #SqlObject
|
||||
**/
|
||||
gpointer sql_list_get (SqlList * obj, guint n)
|
||||
gpointer sql_list_get (SqlList * obj, guint index)
|
||||
{
|
||||
g_return_val_if_fail (SQL_IS_LIST (obj), NULL);
|
||||
|
||||
return g_queue_peek_nth (&obj->items, n);
|
||||
return g_queue_peek_nth (&obj->items, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* sql_list_remove:
|
||||
* @obj: the #SqlList
|
||||
* @index: the index of the item to remove
|
||||
*
|
||||
* Removes an item from the list.
|
||||
*
|
||||
* Return value: (transfer none) (allow-none): the removed #SqlObject
|
||||
**/
|
||||
gpointer sql_list_remove (SqlList * obj, guint n)
|
||||
void sql_list_remove (SqlList * obj, guint index)
|
||||
{
|
||||
SqlObject * item;
|
||||
|
||||
g_return_val_if_fail (SQL_IS_LIST (obj), NULL);
|
||||
|
||||
item = g_queue_pop_nth (&obj->items, n);
|
||||
g_signal_handlers_disconnect_by_func (item,
|
||||
sql_list_item_changed, obj);
|
||||
|
||||
return item;
|
||||
item = g_queue_pop_nth (&obj->items, index);
|
||||
|
||||
if (!g_queue_find (&obj->items, item))
|
||||
sql_list_item_unref (obj, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* sql_list_remove_item:
|
||||
* @obj: the #SqlList
|
||||
* @item: the item to remove
|
||||
*
|
||||
* Removes an item from the list.
|
||||
**/
|
||||
void sql_list_remove_item (SqlList * obj, SqlObject * item)
|
||||
{
|
||||
g_return_if_fail (SQL_IS_LIST (obj));
|
||||
g_return_if_fail (SQL_IS_OBJECT (item));
|
||||
|
||||
g_queue_remove_all (&obj->items, item);
|
||||
sql_list_item_unref (obj, item);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,9 +43,10 @@ struct _SqlListClass
|
|||
GType sql_list_get_type ();
|
||||
SqlList * sql_list_new (GType gtype);
|
||||
void sql_list_add (SqlList * obj, gpointer item);
|
||||
void sql_list_insert (SqlList * obj, gpointer item, guint n);
|
||||
gpointer sql_list_get (SqlList * obj, guint n);
|
||||
gpointer sql_list_remove (SqlList * obj, guint n);
|
||||
void sql_list_insert (SqlList * obj, gpointer item, guint index);
|
||||
gpointer sql_list_get (SqlList * obj, guint index);
|
||||
void sql_list_remove (SqlList * obj, guint index);
|
||||
void sql_list_remove_item (SqlList * obj, SqlObject * item);
|
||||
GList * sql_list_get_items (SqlList * obj);
|
||||
GType sql_list_get_items_type (SqlList * obj);
|
||||
guint sql_list_length (SqlList * obj);
|
||||
|
|
|
@ -95,8 +95,8 @@ static void sql_multi_stmt_class_init (SqlMultiStmtClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_STMTS,
|
||||
sql_param_list ("stmts"
|
||||
,"Statements"
|
||||
,"The list of statements"
|
||||
,("Statements")
|
||||
,("The list of statements")
|
||||
,SQL_TYPE_STMT
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
|
|
|
@ -108,12 +108,13 @@ void sql_object_remove (gpointer obj, gpointer child)
|
|||
*
|
||||
* Renders the object into a SQL string and stores it into the renderer.
|
||||
**/
|
||||
void sql_object_render (SqlObject * obj, SqlRender * render)
|
||||
void sql_object_render (SqlObject * obj, SqlRender * render, SqlBatch * batch)
|
||||
{
|
||||
g_return_if_fail (SQL_IS_OBJECT (obj));
|
||||
g_return_if_fail (SQL_IS_RENDER (render));
|
||||
g_return_if_fail (SQL_IS_BATCH (batch) || !batch);
|
||||
|
||||
// SQL_OBJECT_GET_CLASS (obj)->render (obj, render);
|
||||
SQL_OBJECT_GET_CLASS (obj)->render (obj, render, batch);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,33 +127,29 @@ void sql_object_render (SqlObject * obj, SqlRender * render)
|
|||
**/
|
||||
gboolean sql_object_is_ready (SqlObject * obj)
|
||||
{
|
||||
guint i;
|
||||
guint nparams;
|
||||
GParamSpec ** params;
|
||||
gboolean is_ready = TRUE;
|
||||
SqlObjectClass * klass = SQL_OBJECT_GET_CLASS (obj);
|
||||
|
||||
g_return_val_if_fail (SQL_IS_OBJECT (obj), FALSE);
|
||||
|
||||
if (obj->held_objects)
|
||||
|
||||
params = g_object_class_list_properties (G_OBJECT_GET_CLASS (obj), &nparams);
|
||||
|
||||
for (i = 0; i < nparams && is_ready; i++)
|
||||
if (SQL_IS_PARAM_OBJECT (params[i]) || SQL_IS_PARAM_LIST (params[i]))
|
||||
{
|
||||
GList * i;
|
||||
GList * held_objects = g_hash_table_get_values (obj->held_objects);
|
||||
gboolean is_ready = TRUE;
|
||||
|
||||
for (i = held_objects; i; i = i->next)
|
||||
if (!sql_object_is_ready (i->data))
|
||||
{
|
||||
is_ready = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
g_list_free (held_objects);
|
||||
|
||||
if (!is_ready)
|
||||
return FALSE;
|
||||
SqlObject * child = sql_object_get (obj, params[i]->name);
|
||||
is_ready = sql_object_is_ready (child);
|
||||
}
|
||||
|
||||
g_free (params);
|
||||
|
||||
if (klass->is_ready)
|
||||
return klass->is_ready (obj);
|
||||
else
|
||||
return TRUE;
|
||||
return is_ready;
|
||||
}
|
||||
|
||||
void sql_object_set (SqlObject * obj, const gchar * property, SqlObject * value)
|
||||
|
@ -204,12 +201,10 @@ void sql_object_remove_child (SqlObject * obj, const gchar * property, guint n)
|
|||
**/
|
||||
void sql_object_get_holders (SqlObject * obj, GQueue * holders)
|
||||
{
|
||||
if (!obj)
|
||||
return;
|
||||
|
||||
g_return_if_fail (SQL_IS_OBJECT (obj));
|
||||
g_return_if_fail (SQL_IS_OBJECT (obj) || !obj);
|
||||
|
||||
SQL_OBJECT_GET_CLASS (obj)->find_holders (obj, holders);
|
||||
if (obj)
|
||||
SQL_OBJECT_GET_CLASS (obj)->find_holders (obj, holders);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,6 +33,7 @@ typedef struct _SqlObjectClass SqlObjectClass;
|
|||
|
||||
typedef gboolean (* SqlObjectIsReadyFunc) (SqlObject * obj);
|
||||
typedef void (* SqlObjectFindHoldersFunc) (SqlObject * obj, GQueue * holders);
|
||||
typedef void (* SqlRenderFunc) (); // (SqlObject * obj, SqlRender * render, SqlBatch * batch);
|
||||
|
||||
struct _SqlObject
|
||||
{
|
||||
|
@ -43,17 +44,16 @@ struct _SqlObjectClass
|
|||
{
|
||||
/* <private> */
|
||||
GInitiallyUnownedClass parent;
|
||||
gpointer /* SqlRenderFunc */ render;
|
||||
SqlRenderFunc render;
|
||||
SqlObjectIsReadyFunc is_ready;
|
||||
SqlObjectFindHoldersFunc find_holders;
|
||||
};
|
||||
|
||||
#include "sql-holder.h"
|
||||
#include "sql-list.h"
|
||||
#include "sql-render.h"
|
||||
#include "sql-batch.h"
|
||||
|
||||
GType sql_object_get_type ();
|
||||
void sql_object_render (SqlObject * obj, SqlRender * render);
|
||||
void sql_object_render (SqlObject * obj, SqlRender * render, SqlBatch * batch);
|
||||
gboolean sql_object_is_ready (SqlObject * obj);
|
||||
void sql_object_get_holders (SqlObject * obj, GQueue * holders);
|
||||
|
||||
|
|
|
@ -134,16 +134,16 @@ static void sql_operation_class_init (SqlOperationClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_TYPE,
|
||||
g_param_spec_enum ("type"
|
||||
,"Type"
|
||||
,"The type of the operation"
|
||||
,("Type")
|
||||
,("The type of the operation")
|
||||
,SQL_TYPE_OPERATION_TYPE
|
||||
,SQL_OPERATION_TYPE_AND
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_OPERATORS,
|
||||
sql_param_list ("operators"
|
||||
,"Operators"
|
||||
,"The list of operators"
|
||||
,("Operators")
|
||||
,("The list of operators")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
|
|
|
@ -79,6 +79,6 @@ struct _SqlOperationClass
|
|||
GType sql_operation_get_type ();
|
||||
GType sql_operation_type_get_type ();
|
||||
|
||||
SqlObject * sql_operation_new (SqlOperationType type);
|
||||
SqlObject * sql_operation_new (SqlOperationType type);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,7 @@ sql_param_list_validate (GParamSpec * pspec, GValue * value)
|
|||
GType type;
|
||||
gboolean change;
|
||||
gpointer object = g_value_get_object (value);
|
||||
|
||||
|
||||
if (!object)
|
||||
return TRUE;
|
||||
|
||||
|
|
|
@ -56,15 +56,17 @@ SqlRender * sql_render_new (gchar delimiter)
|
|||
*
|
||||
* Return value: a string with the rendered statement of %NULL if error.
|
||||
**/
|
||||
gchar * sql_render_get_string (SqlRender * obj, gpointer object, gpointer data, GError ** err)
|
||||
gchar * sql_render_get_string (SqlRender * obj, gpointer object, SqlBatch * batch, gpointer data, GError ** err)
|
||||
{
|
||||
gchar * sql;
|
||||
|
||||
g_return_val_if_fail (SQL_IS_RENDER (obj), NULL);
|
||||
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
|
||||
g_return_val_if_fail (SQL_IS_BATCH (batch) || !batch, NULL);
|
||||
|
||||
obj->data = data;
|
||||
obj->object = g_object_ref (object);
|
||||
obj->batch = batch ? g_object_ref (batch) : NULL;
|
||||
obj->buffer = g_string_sized_new (SQL_BUFFER_SIZE);
|
||||
obj->ancestors = NULL;
|
||||
|
||||
|
@ -84,6 +86,7 @@ gchar * sql_render_get_string (SqlRender * obj, gpointer object, gpointer data,
|
|||
sql = g_string_free (obj->buffer, FALSE);
|
||||
|
||||
g_clear_object (&obj->object);
|
||||
g_clear_object (&obj->batch);
|
||||
g_slist_free (obj->ancestors);
|
||||
obj->ancestors = NULL;
|
||||
obj->buffer = NULL;
|
||||
|
@ -144,9 +147,9 @@ void sql_render_add_object (SqlRender * obj, gpointer object)
|
|||
obj->ancestors = g_slist_prepend (obj->ancestors, object);
|
||||
|
||||
if (function)
|
||||
function (object, obj);
|
||||
function (object, obj, obj->batch);
|
||||
else
|
||||
sql_object_render (object, obj);
|
||||
sql_object_render (object, obj, obj->batch);
|
||||
|
||||
obj->ancestors = g_slist_delete_link (obj->ancestors, obj->ancestors);
|
||||
}
|
||||
|
@ -324,23 +327,23 @@ void sql_render_add_list (SqlRender * obj, gboolean required, const gchar * toke
|
|||
void sql_render_add_list_with_func (SqlRender * obj, gboolean required, const gchar * token,
|
||||
SqlList * list, const gchar * separator, SqlRenderFunc function)
|
||||
{
|
||||
GList * n;
|
||||
GList * i;
|
||||
|
||||
g_return_if_fail (SQL_IS_RENDER (obj));
|
||||
g_return_if_fail (SQL_IS_LIST (list));
|
||||
|
||||
if (list && (n = sql_list_get_items (list)))
|
||||
if (list && (i = sql_list_get_items (list)))
|
||||
{
|
||||
sql_render_add_token (obj, token);
|
||||
|
||||
for (; n; n = n->next)
|
||||
for (; i; i = i->next)
|
||||
{
|
||||
if (function)
|
||||
function (n->data, obj);
|
||||
function (i->data, obj, obj->batch);
|
||||
else
|
||||
sql_render_add_object (obj, n->data);
|
||||
sql_render_add_object (obj, i->data);
|
||||
|
||||
if (n->next)
|
||||
if (i->next)
|
||||
g_string_append_printf (obj->buffer, " %s", separator);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
typedef struct _SqlRender SqlRender;
|
||||
typedef struct _SqlRenderClass SqlRenderClass;
|
||||
|
||||
typedef void (* SqlRenderFunc) (gpointer obj, SqlRender * render);
|
||||
|
||||
#include "sql-object.h"
|
||||
#include "sql-batch.h"
|
||||
|
||||
/**
|
||||
* SqlRender:
|
||||
|
@ -45,6 +43,7 @@ struct _SqlRender
|
|||
GError * error;
|
||||
GString * buffer;
|
||||
gpointer object;
|
||||
SqlBatch * batch;
|
||||
GSList * ancestors;
|
||||
gpointer data;
|
||||
GHashTable * custom_renderers;
|
||||
|
@ -69,9 +68,12 @@ typedef enum
|
|||
}
|
||||
SqlRenderError;
|
||||
|
||||
#include "sql-object.h"
|
||||
#include "sql-list.h"
|
||||
|
||||
GType sql_render_get_type ();
|
||||
SqlRender * sql_render_new (gchar delimiter);
|
||||
gchar * sql_render_get_string (SqlRender * obj, gpointer object, gpointer data, GError ** err);
|
||||
gchar * sql_render_get_string (SqlRender * obj, gpointer object, SqlBatch * batch, gpointer data, GError ** err);
|
||||
void sql_render_register_function (SqlRender * obj, GType type, SqlRenderFunc function);
|
||||
GSList * sql_render_get_ancestors (SqlRender * obj);
|
||||
void sql_render_add_espace (SqlRender * obj);
|
||||
|
|
|
@ -109,15 +109,15 @@ static void sql_select_field_class_init (SqlSelectFieldClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_EXPR,
|
||||
sql_param_object ("expr"
|
||||
,"Expression"
|
||||
,"The expression"
|
||||
,("Expression")
|
||||
,("The expression")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_ALIAS,
|
||||
g_param_spec_string ("alias"
|
||||
,"Alias"
|
||||
,"The alias for the expression"
|
||||
,("Alias")
|
||||
,("The alias for the expression")
|
||||
,NULL
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
|
|
|
@ -103,15 +103,15 @@ static void sql_select_order_class_init (SqlSelectOrderClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_EXPR,
|
||||
sql_param_object ("expr"
|
||||
,"Expression"
|
||||
,"The expression"
|
||||
,("Expression")
|
||||
,("The expression")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_WAY,
|
||||
g_param_spec_enum ("way"
|
||||
,"Way"
|
||||
,"The order way"
|
||||
,("Way")
|
||||
,("The order way")
|
||||
,SQL_TYPE_SELECT_ORDER_WAY
|
||||
,SQL_SELECT_ORDER_ASC
|
||||
,G_PARAM_READWRITE
|
||||
|
|
|
@ -244,65 +244,64 @@ static void sql_select_class_init (SqlSelectClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_LIMIT_COUNT,
|
||||
g_param_spec_boolean ("distinct"
|
||||
,"Distinct"
|
||||
,"Determines if the #SqlSelect uses the DISTINCT clause"
|
||||
,_("Distinct")
|
||||
,_("Determines if the #SqlSelect uses the DISTINCT clause")
|
||||
,FALSE
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_FIELDS,
|
||||
sql_param_list ("fields"
|
||||
,"Fields"
|
||||
,"The list of fields"
|
||||
,_("Fields")
|
||||
,_("The list of fields")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
g_object_class_install_property (k, PROP_GROUP,
|
||||
sql_param_list ("group"
|
||||
,"Group"
|
||||
,"The GROUP BY section"
|
||||
,_("Group")
|
||||
,_("The GROUP BY section")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
g_object_class_install_property (k, PROP_HAVING,
|
||||
sql_param_object ("having"
|
||||
,"Having"
|
||||
,"The HAVING clause"
|
||||
,_("Having")
|
||||
,_("The HAVING clause")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_ORDER,
|
||||
sql_param_list ("order"
|
||||
,"Order"
|
||||
,"The ORDER BY section"
|
||||
,_("Order")
|
||||
,_("The ORDER BY section")
|
||||
,SQL_TYPE_SELECT_ORDER
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
g_object_class_install_property (k, PROP_LIMIT_COUNT,
|
||||
g_param_spec_uint ("limit-count"
|
||||
,"Limit count"
|
||||
|
||||
,"The COUNT field of the LIMIT clause"
|
||||
,_("Limit count")
|
||||
,_("The COUNT field of the LIMIT clause")
|
||||
,0, G_MAXUINT, 0
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_LIMIT_OFFSET,
|
||||
g_param_spec_uint ("limit-offset"
|
||||
,"Limit offset"
|
||||
,"The OFFSET field of the LIMIT clause"
|
||||
,_("Limit offset")
|
||||
,_("The OFFSET field of the LIMIT clause")
|
||||
,0, G_MAXUINT, 0
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_NEXT,
|
||||
sql_param_object ("next"
|
||||
,"Next"
|
||||
,"The next #SqlSelect in case of a statement with more than one"
|
||||
,_("Next")
|
||||
,_("The next #SqlSelect in case of a statement with more than one")
|
||||
,SQL_TYPE_SELECT
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_TYPE,
|
||||
g_param_spec_int ("type"
|
||||
,"Type"
|
||||
,"One of the possible options of #SqlSelectType"
|
||||
,_("Type")
|
||||
,_("One of the possible options of #SqlSelectType")
|
||||
,0, SQL_SELECT_COUNT - 1, 0
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
|
|
|
@ -100,8 +100,8 @@ static void sql_set_class_init (SqlSetClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_EXPRS,
|
||||
sql_param_list ("exprs"
|
||||
,"Expressions"
|
||||
,"The list of expressions"
|
||||
,("Expressions")
|
||||
,("The list of expressions")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
|
|
|
@ -64,7 +64,7 @@ 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);
|
||||
sql_object_get_holders (((HolderData *) i->data)->holder, holders);
|
||||
}
|
||||
|
||||
static void sql_string_free_holder_data (HolderData * holder_data)
|
||||
|
|
|
@ -111,8 +111,8 @@ static void sql_subquery_class_init (SqlSubqueryClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_SELECT,
|
||||
sql_param_object ("select"
|
||||
,"Select"
|
||||
,"The SELECT statement"
|
||||
,("Select")
|
||||
,("The SELECT statement")
|
||||
,SQL_TYPE_SELECT
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
|
|
|
@ -114,15 +114,15 @@ static void sql_table_class_init (SqlTableClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_NAME,
|
||||
g_param_spec_string ("name"
|
||||
, "Name"
|
||||
, "The table name"
|
||||
, NULL, G_PARAM_READWRITE
|
||||
,("Name")
|
||||
,("The table name")
|
||||
,NULL, G_PARAM_READWRITE
|
||||
));
|
||||
|
||||
g_object_class_install_property (k, PROP_SCHEMA,
|
||||
g_param_spec_string ("schema"
|
||||
,"Schema"
|
||||
,"The schema where the table is"
|
||||
,("Schema")
|
||||
,("The schema where the table is")
|
||||
,NULL, G_PARAM_READWRITE
|
||||
));
|
||||
}
|
||||
|
|
|
@ -92,8 +92,8 @@ static void sql_target_class_init (SqlTargetClass * k)
|
|||
|
||||
g_object_class_install_property (klass, PROP_ALIAS,
|
||||
g_param_spec_string ("alias"
|
||||
,"Alias"
|
||||
,"The alias for the target"
|
||||
,("Alias")
|
||||
,("The alias for the target")
|
||||
,NULL
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
|
|
|
@ -105,15 +105,15 @@ static void sql_update_set_class_init (SqlUpdateSetClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_FIELD,
|
||||
g_param_spec_object ("field"
|
||||
,"Field"
|
||||
,"The field"
|
||||
,("Field")
|
||||
,("The field")
|
||||
,SQL_TYPE_FIELD
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
g_object_class_install_property (k, PROP_EXPR,
|
||||
g_param_spec_object ("expr"
|
||||
,"Expression"
|
||||
,"The expression"
|
||||
,("Expression")
|
||||
,("The expression")
|
||||
,SQL_TYPE_EXPR
|
||||
,G_PARAM_READWRITE
|
||||
));
|
||||
|
|
|
@ -109,8 +109,8 @@ static void sql_update_class_init (SqlUpdateClass * klass)
|
|||
|
||||
g_object_class_install_property (k, PROP_SETS,
|
||||
sql_param_list ("sets"
|
||||
,"Sets"
|
||||
,"A list of sets"
|
||||
,("Sets")
|
||||
,("A list of sets")
|
||||
,SQL_TYPE_UPDATE_SET
|
||||
,G_PARAM_READWRITE | G_PARAM_CONSTRUCT
|
||||
));
|
||||
|
|
|
@ -185,24 +185,32 @@ static gboolean vn_completion_match_selected (GtkEntryCompletion * completion,
|
|||
|
||||
static void vn_completion_create_model (VnCompletion * obj)
|
||||
{
|
||||
SqlExpr * field;
|
||||
SqlString * stmt;
|
||||
SqlOperation * op;
|
||||
SqlObject * field;
|
||||
SqlObject * stmt;
|
||||
SqlObject * op;
|
||||
SqlBatch * batch;
|
||||
SqlList * ops;
|
||||
|
||||
if (!(obj->sql && obj->field))
|
||||
return;
|
||||
|
||||
op = sql_operation_new (SQL_OPERATION_TYPE_LIKE);
|
||||
|
||||
ops = sql_list_new (SQL_TYPE_EXPR);
|
||||
g_object_set (op, "operators", ops, NULL);
|
||||
|
||||
field = sql_field_new (obj->field, NULL, NULL);
|
||||
sql_operation_add_expr (op, field);
|
||||
sql_list_add (ops, field);
|
||||
|
||||
obj->value = sql_value_new ();
|
||||
sql_operation_add_expr (op, obj->value);
|
||||
sql_list_add (ops, obj->value);
|
||||
|
||||
batch = sql_batch_new ();
|
||||
sql_batch_add (batch, "field", field);
|
||||
sql_batch_add (batch, "filter", op);
|
||||
db_model_set_batch (obj->model, batch);
|
||||
|
||||
stmt = sql_string_new (obj->sql);
|
||||
sql_string_add_expr (stmt, field);
|
||||
sql_string_add_expr (stmt, SQL_EXPR (op));
|
||||
db_model_set_stmt (obj->model, SQL_STMT (stmt));
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ struct _VnCompletion
|
|||
guint column;
|
||||
gchar * last_match;
|
||||
DbModel * model;
|
||||
SqlExpr * value;
|
||||
SqlObject * value;
|
||||
gchar * field;
|
||||
gchar * sql;
|
||||
};
|
||||
|
|
|
@ -283,7 +283,7 @@ static void vn_date_chooser_init (VnDateChooser * obj)
|
|||
gtk_box_pack_start (GTK_BOX (obj->box),
|
||||
GTK_WIDGET (obj->button), FALSE, FALSE, 0);
|
||||
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_BUTTON);
|
||||
image = gtk_image_new_from_icon_name ("gtk-edit", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_button_set_image (GTK_BUTTON (obj->button), image);
|
||||
|
||||
obj->label = GTK_LABEL (gtk_label_new (NULL));
|
||||
|
|
|
@ -79,9 +79,10 @@ static void vn_login_show (VnLogin * obj)
|
|||
{
|
||||
gchar * user;
|
||||
gchar * pass;
|
||||
GError * err = NULL;
|
||||
VnBuilder * builder = vn_builder_new ();
|
||||
|
||||
if (gtk_builder_add_from_file (GTK_BUILDER (builder), LOGIN_UI, NULL))
|
||||
if (gtk_builder_add_from_file (GTK_BUILDER (builder), LOGIN_UI, &err))
|
||||
{
|
||||
obj->window = vn_builder_get (builder, "window");
|
||||
obj->user = vn_builder_get (builder, "user");
|
||||
|
@ -116,16 +117,24 @@ static void vn_login_show (VnLogin * obj)
|
|||
g_free (user);
|
||||
g_free (pass);
|
||||
}
|
||||
else if (err)
|
||||
{
|
||||
g_warning ("VnLogin: %s", err->message);
|
||||
g_clear_error (&err);
|
||||
}
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET (obj->window));
|
||||
gtk_widget_grab_focus (GTK_WIDGET (obj->user));
|
||||
gtk_widget_hide (obj->spinner);
|
||||
if (obj->window)
|
||||
{
|
||||
gtk_widget_show_all (GTK_WIDGET (obj->window));
|
||||
gtk_widget_grab_focus (GTK_WIDGET (obj->user));
|
||||
gtk_widget_hide (obj->spinner);
|
||||
|
||||
if (autologin)
|
||||
gtk_button_clicked (obj->connect);
|
||||
if (autologin)
|
||||
gtk_button_clicked (obj->connect);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Reference in New Issue