DbIterator, VnGrid, DbSimpleIterator

- DbIterator ahora es una interfaz implementada por DbSimpleIterator y VnGrid.
- Arregladas algunas fugas de memoria.
- Arreglados unos cuantos bugs.
- Cambios en la documentación.
- Los modulos ahora generan POTFILES.in y POTFILES.skip mediante una lista con comodines y un script.
- Se puede salir de la ventana de login con Esc y con Ctrl+Q.
This commit is contained in:
Alejandro T. Colombini Gómez 2014-09-18 13:06:06 +02:00
parent a04c4ea1e4
commit 851b6a890e
73 changed files with 3030 additions and 2412 deletions

View File

@ -9,7 +9,8 @@ template_DATA = \
hedera/anjuta.session.tpl \
hedera/AUTHORS.tpl \
hedera/configure.ac.tpl \
hedera/Makefile.am.tpl
hedera/Makefile.am.tpl \
hedera/potfiles
anjuta_srcdir = $(templatedir)/src
anjuta_src_DATA = \
@ -33,8 +34,7 @@ anjuta_m4_DATA = hedera/build/m4/pkg.m4
anjuta_podir = $(templatedir)/po
anjuta_po_DATA = \
hedera/po/POTFILES.in.tpl \
hedera/po/POTFILES.skip.tpl
hedera/po/potfiles
anjuta_debiandir = $(templatedir)/debian
anjuta_debian_DATA = \

View File

@ -103,10 +103,9 @@
</directory>
[+ENDIF+]
[+IF (=(get "HaveI18n") "1") +]
<file source="translation" executable="yes"/>
<file source="potfiles" executable="yes"/>
<directory source="po">
<file source="POTFILES.in.tpl" destination="POTFILES.in"/>
<file source="POTFILES.skip.tpl" destination="POTFILES.skip"/>
<file source="potfiles"/>
</directory>
[+ENDIF+]
<directory source="." destination=".anjuta">
@ -119,7 +118,9 @@
<action>
[+IF (=(get "HaveI18n") "1") +]
<run command="bash -c &quot; cd [+Destination+]/po
<run command="bash -c &quot; cd [+Destination+]
&amp;&amp; ./potfiles
&amp;&amp; cd po
&amp;&amp; intltool-update -p
&amp;&amp; msginit --no-translator -i *.pot -o es.po -l es_ES.utf8
&amp;&amp; echo es &gt;&gt; LINGUAS

View File

@ -21,13 +21,17 @@ ACLOCAL_AMFLAGS = -I build/m4
SUBDIRS = \
src \
data[+IF (=(get "HaveI18n") "1")+] \
. \
po
translationsdir =
translations_DATA = \
po/es.po \
po/POTFILES.in \
po/POTFILES.skip
po/potfiles
all-local:
@(cd $(top_srcdir); $(abs_top_srcdir)/potfiles)
[+ENDIF+]
EXTRA_DIST = \
README \

View File

@ -13,7 +13,7 @@ Files=../../src/[+FormName+].vala#30
bookmarks=<?xml version="1.0" encoding="UTF-8"?>\n<bookmarks/>\n
[Execution]
Program arguments=-u
Program arguments=
Program uri=file:///usr/bin/hedera-bin
Run in terminal=2
Working directories=../../../[+Name+]%%%../../build

View File

@ -1,9 +0,0 @@
[+ autogen5 template +]
# List of source files containing translatable strings.
src/[+Name+].vala
src/[+FormName+].vala
data/[+FormName+].glade
[type: gettext/glade]data/[+Name+]-menu.xml
[type: gettext/glade]data/[+Name+].xml

View File

@ -1,5 +0,0 @@
[+ autogen5 template +]
# List of source files to skip from translation.
src/[+Name+].c
src/[+FormName+].c

View File

@ -0,0 +1,9 @@
in:
src/*.vala
data/*.xml
data/*.glade
skip:
src/*.c

24
anjuta/hedera/potfiles Executable file
View File

@ -0,0 +1,24 @@
#! /bin/bash
if [ -e po/potfiles ]
then
echo Generating POTFILES.in and POTFILES.skip files
> po/POTFILES.in
> po/POTFILES.skip
for line in `cat po/potfiles`
do
if [ "$line" = "in:" -o "$line" = "skip:" ]
then
mode=${line/:/}
else
if [ "$mode" = "in" -a "${line: -4}" = ".xml" ]
then
echo "[type: gettext/glade]$line" >> po/POTFILES.in
else
echo $line >> po/POTFILES.$mode
fi
fi
done
fi

View File

@ -90,9 +90,9 @@ AC_CONFIG_FILES([
sql/parser/Makefile
db/Makefile
plugin/Makefile
plugin/sqlite/Makefile
plugin/pg/Makefile
plugin/mysql/Makefile
plugin/sqlite/Makefile
vn/Makefile
vn/field/Makefile
vn/column/Makefile

View File

@ -5,8 +5,9 @@ db_include_HEADERS = \
db.h \
db-iter.h \
db-calc.h \
db-iterator.h \
db-param.h \
db-iterator.h \
db-simple-iterator.h \
db-request.h \
db-conn.h \
db-result.h \
@ -28,8 +29,9 @@ libdb_la_SOURCES = \
$(db_include_HEADERS) \
db-iter.c \
db-calc.c \
db-iterator.c \
db-param.c \
db-iterator.c \
db-simple-iterator.c \
db-request.c \
db-conn.c \
db-row.c \

View File

@ -194,6 +194,9 @@ static void file_free (File * file)
if (file->data)
g_bytes_unref (file->data);
if (file->cancel)
g_object_unref (file->cancel);
g_object_unref (file->obj);
g_free (file);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012 - Juan Ferrer Toribio
* Copyright (C) 2014 - 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
@ -18,19 +18,18 @@
#ifndef DB_ITERATOR_H
#define DB_ITERATOR_H
#include <gvn/gvn-param.h>
#include "db-model.h"
#define DB_TYPE_ITERATOR (db_iterator_get_type ())
#define DB_ITERATOR(self) (G_TYPE_CHECK_INSTANCE_CAST (self, DB_TYPE_ITERATOR, DbIterator))
#define DB_IS_ITERATOR(self) (G_TYPE_CHECK_INSTANCE_TYPE (self, DB_TYPE_ITERATOR))
#define DB_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, DB_TYPE_ITERATOR, DbIteratorClass))
#define DB_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass, DB_TYPE_ITERATOR))
#define DB_ITERATOR_GET_CLASS(self) (G_TYPE_INSTANCE_GET_CLASS (self, DB_TYPE_ITERATOR, DbIteratorClass))
#define DB_ITERATOR_GET_INTERFACE(self) (G_TYPE_INSTANCE_GET_INTERFACE (self, DB_TYPE_ITERATOR, DbIteratorInterface))
#define DB_TYPE_ITERATOR_MODE (db_iterator_mode_get_type ())
typedef struct _DbIterator DbIterator;
typedef struct _DbIteratorClass DbIteratorClass;
typedef struct _DbIteratorInterface DbIteratorInterface;
#include "db-param.h"
@ -40,10 +39,10 @@ typedef struct _DbIteratorClass DbIteratorClass;
* database instantly.
* @DB_ITERATOR_MODE_ON_ITER: every change made in a row will be sent to the
* database when iter changes.
* @DB_ITERATOR_MODE_ON_DEMAND: nothing will be sent to the database since it's
* @DB_ITERATOR_MODE_ON_DEMAND: nothing will be sent to the database until it's
* demanded.
*
* The working mode of a Iterator.
* The working mode of an Iterator.
**/
typedef enum
{
@ -71,41 +70,48 @@ typedef enum
}
DbIteratorMove;
struct _DbIterator
{
GObject parent;
DbModel * model;
GList * params;
DbIteratorMode mode;
DbIter iter;
GHashTable * selected;
gint row;
gboolean row_selected;
gboolean remember_selection;
};
typedef DbIteratorMode (* DbIteratorGetMode) (DbIterator * self);
typedef void (* DbIteratorSetMode) (DbIterator * self, DbIteratorMode mode);
typedef gint (* DbIteratorGetRow) (DbIterator * self);
typedef gboolean (* DbIteratorGetIter) (DbIterator * self, DbIter ** iter);
typedef void (* DbIteratorSetIter) (DbIterator * self, DbIter * iter);
typedef gboolean (* DbIteratorMoveIter) (DbIterator * self, DbIter * iter);
typedef GList * (* DbIteratorGetParamList) (DbIterator * self);
typedef void (* DbIteratorDeleteSelection) (DbIterator * self);
struct _DbIteratorClass
struct _DbIteratorInterface
{
/* <private> */
GObjectClass parent;
GTypeInterface parent;
DbIteratorGetMode get_mode;
DbIteratorSetMode set_mode;
DbIteratorGetRow get_row;
DbIteratorGetIter get_iter;
DbIteratorSetIter set_iter;
DbIteratorMoveIter move_iter;
DbIteratorGetParamList get_param_list;
DbIteratorDeleteSelection delete_selection;
};
GType db_iterator_get_type ();
GType db_iterator_mode_get_type () G_GNUC_CONST;
DbIterator * db_iterator_new (DbModel * model);
gboolean db_iterator_is_ready (DbIterator * self);
DbIteratorMode db_iterator_get_mode (DbIterator * self);
void db_iterator_set_mode (DbIterator * self, DbIteratorMode mode);
gint db_iterator_get_row (DbIterator * self);
gboolean db_iterator_get_iter (DbIterator * self, DbIter * iter);
void db_iterator_select_iter (DbIterator * self, DbIter * iter);
void db_iterator_move_iter (DbIterator * self, DbIter * iter);
void db_iterator_move_first (DbIterator * self);
void db_iterator_move_last (DbIterator * self);
void db_iterator_move_previous (DbIterator * self);
void db_iterator_move_next (DbIterator * self);
void db_iterator_move_to (DbIterator * self, DbIteratorMove move);
gboolean db_iterator_get_iter (DbIterator * self, DbIter ** iter);
void db_iterator_add_param (DbIterator * self, DbParam * param);
GvnParam * db_iterator_get_param (DbIterator * self, const gchar * column);
GList * db_iterator_get_params (DbIterator * self);
void db_iterator_bind_param (DbIterator * self, const gchar * column, GvnParam * param);
void db_iterator_link (DbIterator * self, const gchar * field, DbIterator * src, const gchar * column);
void db_iterator_link_with_param (DbIterator * self, const gchar * field, GvnParam * param);
gboolean db_iterator_move_iter (DbIterator * self, DbIter * iter);
gboolean db_iterator_move_first (DbIterator * self);
gboolean db_iterator_move_last (DbIterator * self);
gboolean db_iterator_move_previous (DbIterator * self);
gboolean db_iterator_move_next (DbIterator * self);
gboolean db_iterator_move_to (DbIterator * self, DbIteratorMove move);
void db_iterator_refresh (DbIterator * self);
const GvnParamSpec * db_iterator_get_spec (DbIterator * self, gint column);
gint db_iterator_get_column_index (DbIterator * self, const gchar * name);
@ -115,12 +121,6 @@ const GValue * db_iterator_get_value_by_index (DbIterator * self, gint column
gboolean db_iterator_set_value_by_index (DbIterator * self, gint column, const GValue * value, GError ** err);
void db_iterator_delete (DbIterator * self);
void db_iterator_insert (DbIterator * self);
void db_iterator_add_param (DbIterator * self, DbParam * param);
GvnParam * db_iterator_get_param (DbIterator * self, const gchar * column);
GList * db_iterator_get_params (DbIterator * self);
void db_iterator_bind_param (DbIterator * self, const gchar * column, GvnParam * param);
void db_iterator_link (DbIterator * self, const gchar * field, DbIterator * src, const gchar * column);
void db_iterator_link_with_param (DbIterator * self, const gchar * field, GvnParam * param);
gint db_iterator_get_nrows (DbIterator * self);
DbModelUpdateFlags db_iterator_get_update_flags (DbIterator * self);
void db_iterator_reverse_operations (DbIterator * self);
@ -128,4 +128,10 @@ void db_iterator_perform_operations (DbIterator * self);
DbModelRowOp db_iterator_get_pending_operations (DbIterator * self);
gboolean db_iterator_has_pending_operations (DbIterator * self);
void db_iterator_data_changed (DbIterator * self);
void db_iterator_iter_changed (DbIterator * self);
void db_iterator_operations_done (DbIterator * self);
void db_iterator_row_num_changed (DbIterator * self);
void db_iterator_status_changed (DbIterator * self, gboolean ready);
#endif

View File

@ -57,7 +57,7 @@ DbModel * db_model_holder_get_model (DbModelHolder * self)
void db_model_holder_set_model (DbModelHolder * self, DbModel * model)
{
g_return_if_fail (DB_IS_MODEL_HOLDER (self));
g_return_if_fail (DB_IS_MODEL (self));
g_return_if_fail (DB_IS_MODEL (model));
DB_MODEL_HOLDER_GET_INTERFACE (self)->set_model (self, model);
}
@ -67,7 +67,7 @@ void db_model_holder_set_model (DbModelHolder * self, DbModel * model)
static void db_model_holder_default_init (DbModelHolderInterface * iface)
{
g_object_interface_install_property (iface,
g_param_spec_object ("model"
g_param_spec_object ("data-model"
,_("Model")
,_("The model used by the holder")
,DB_TYPE_MODEL

View File

@ -31,8 +31,6 @@ typedef struct _DbModelHolderInterface DbModelHolderInterface;
typedef DbModel * (* DbModelHolderGetModelFunc) (DbModelHolder * self);
typedef void (* DbModelHolderSetModelFunc) (DbModelHolder * self, DbModel * model);
struct _DbModelHolder;
struct _DbModelHolderInterface
{
/* <private> */

View File

@ -190,6 +190,7 @@ static void table_info_free (TableInfo * table_info)
g_free (table_info->alias);
g_slist_free (table_info->pkeys);
g_hash_table_unref (table_info->columns);
g_free (table_info);
}
//----------------------------------------------- ColumnDef

View File

@ -35,7 +35,7 @@
*
* The #DbModel class gets an SQL query statement to retrieve the data from the
* database connected by a #DbConn. It is normally used undirectly, using
* a #DbIterator or another #DbModelHolder instead.
* a #DbSimpleIterator or another #DbModelHolder instead.
**/
G_DEFINE_TYPE (DbModel, db_model, G_TYPE_OBJECT)
@ -250,6 +250,14 @@ static void db_model_on_line_deleted (DbModel * self, gint position)
// External signal handlers
static void array_free (gpointer array_ptr)
{
GArray * array = array_ptr;
if (array)
g_array_free (array, TRUE);
}
static void db_model_calculate_update_flags (DbModel * self)
{
gint i;
@ -304,8 +312,8 @@ static void db_model_calculate_update_flags (DbModel * self)
tinfo->columns = g_hash_table_new_full (
g_str_hash
,g_str_equal
,NULL
,(GDestroyNotify) g_array_free
,g_free
,array_free
);
tinfo->pkeys = NULL;
g_hash_table_insert (priv->tables, table_copy (&table), tinfo);
@ -2289,7 +2297,6 @@ gboolean db_model_search_value
DbModelRowOp db_model_get_row_operations (DbModel * self, DbIter * iter)
{
DbOperation * op = NULL;
g_return_val_if_fail (DB_IS_MODEL (self), 0);
g_return_val_if_fail (VALID_ITER (iter, self), 0);

431
db/db-simple-iterator.c Normal file
View File

@ -0,0 +1,431 @@
/*
* Copyright (C) 2012 - Juan Ferrer Toribio
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "db-simple-iterator.h"
#include "db-model-holder.h"
#include "db-param.h"
static void db_simple_iterator_set_iter (DbSimpleIterator * self, DbIter * iter);
static void db_simple_iterator_model_holder_init (DbModelHolderInterface * iface);
static void db_simple_iterator_iterator_init (DbIteratorInterface * iface);
/**
* SECTION:db-simple-iterator
* @short_description: manages a iterator with its events
* @title: DbSimpleIterator
*
* The #DbSimpleIterator manages a connection with a data base. The function
* db_simple_iterator_new() creates a new #DbSimpleIterator.
*/
G_DEFINE_TYPE_WITH_CODE (DbSimpleIterator, db_simple_iterator, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (DB_TYPE_MODEL_HOLDER,
db_simple_iterator_model_holder_init)
G_IMPLEMENT_INTERFACE (DB_TYPE_ITERATOR,
db_simple_iterator_iterator_init)
);
/**
* DbSimpleIterator:
* @params: (element-type Db.Param):
**/
/**
* db_simple_iterator_new:
* @model: the #DbModel used by iterator.
*
* Creates a new #DbSimpleIterator.
*
* Return value: (transfer full): a #DbSimpleIterator.
**/
DbIterator * db_simple_iterator_new (DbModel * model)
{
return g_object_new (DB_TYPE_SIMPLE_ITERATOR, "model", model, NULL);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
static void db_simple_iterator_unref_param (DbSimpleIterator * self, DbParam * param)
{
self->params = g_list_remove (self->params, param);
}
/*
* #DbSimpleIterator instances call this function every time line in
* the model is changed.
*/
static void db_simple_iterator_row_num_changed (DbSimpleIterator * self)
{
if (self->iter)
self->row = db_model_get_path (self->model, self->iter);
else if (!self->remember_selection)
self->row = 0;
db_iterator_row_num_changed (DB_ITERATOR (self));
}
/*
* #DbSimpleIterator instances call this function every time the data of the
* params must be updated.
*/
static void db_simple_iterator_iter_changed (DbSimpleIterator * self)
{
db_simple_iterator_row_num_changed (self);
db_iterator_iter_changed (DB_ITERATOR (self));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ DbModelHolder methods
static void db_simple_iterator_set_model_mode (DbSimpleIterator * self)
{
if (self->mode == DB_ITERATOR_MODE_ON_CHANGE)
db_model_set_mode (self->model, DB_MODEL_MODE_ON_CHANGE);
else
db_model_set_mode (self->model, DB_MODEL_MODE_ON_DEMAND);
}
/*
* Function called when row is inserted on the model.
*/
static void db_simple_iterator_on_model_line_inserted (DbModel * model, DbIter * iter, DbSimpleIterator * self)
{
db_iterator_data_changed (DB_ITERATOR (self));
}
/*
* Function called when row is updated on the model.
*/
static void db_simple_iterator_on_model_line_updated_after (DbModel * model, DbIter * iter, DbSimpleIterator * self)
{
if (self->iter && db_iter_compare (iter, self->iter))
db_simple_iterator_iter_changed (self);
db_iterator_data_changed (DB_ITERATOR (self));
}
/*
* Function called when row is deleted on the model.
*/
static void db_simple_iterator_on_model_line_deleted (DbModel * model, gint row, DbSimpleIterator * self)
{
if (self->iter && row == self->row)
{
DbIter iter;
if (db_model_get_iter (model, &iter, row + 1)
|| db_model_get_iter (model, &iter, row - 1))
db_simple_iterator_set_iter (self, &iter);
else
db_simple_iterator_set_iter (self, NULL);
}
}
static void db_simple_iterator_on_model_line_deleted_after (DbModel * model, gint row, DbSimpleIterator * self)
{
if (self->iter)
db_simple_iterator_row_num_changed (self);
db_iterator_data_changed (DB_ITERATOR (self));
}
/*
* Function called when model rows are reordered.
*/
static void db_simple_iterator_on_model_lines_reordered (DbModel * model,
gint column, gint * new_order, DbSimpleIterator * self)
{
if (self->iter)
db_simple_iterator_row_num_changed (self);
}
/*
* Function called when model status changes.
*/
static void db_simple_iterator_on_model_status_changed (DbModel * model, DbModelStatus status, DbSimpleIterator * self)
{
if (status == DB_MODEL_STATUS_READY)
{
DbIter iter;
db_iterator_status_changed (DB_ITERATOR (self), TRUE);
if (self->row >= 0 && self->row < db_model_get_nrows (model)
&& db_model_get_iter (model, &iter, self->row))
db_simple_iterator_set_iter (self, &iter);
else
db_simple_iterator_set_iter (self, NULL);
}
else
{
db_iterator_status_changed (DB_ITERATOR (self), FALSE);
db_simple_iterator_set_iter (self, NULL);
}
}
/*
* Function called when model operations are done.
*/
static void db_simple_iterator_on_model_operations_done (DbModel * model, DbSimpleIterator * self)
{
db_iterator_operations_done (DB_ITERATOR (self));
}
static DbModel * db_simple_iterator_get_model (DbSimpleIterator * self)
{
g_return_val_if_fail (DB_IS_SIMPLE_ITERATOR (self), NULL);
return self->model;
}
static void db_simple_iterator_set_model (DbSimpleIterator * self, DbModel * model)
{
if (!model)
return;
if (!self->model)
{
self->model = g_object_ref (model);
g_object_connect (self->model
,"signal::line-inserted", db_simple_iterator_on_model_line_inserted, self
,"signal-after::line-updated", db_simple_iterator_on_model_line_updated_after, self
,"signal::line-deleted", db_simple_iterator_on_model_line_deleted, self
,"signal-after::line-deleted", db_simple_iterator_on_model_line_deleted_after, self
,"signal::lines-reordered", db_simple_iterator_on_model_lines_reordered, self
,"signal::status-changed", db_simple_iterator_on_model_status_changed, self
,"signal::operations-done", db_simple_iterator_on_model_operations_done, self
,NULL
);
db_simple_iterator_set_model_mode (self);
db_simple_iterator_on_model_status_changed (model,
db_model_get_status (model), self);
}
else
g_warning ("DbSimpleIterator: Can't reassign the 'model' property");
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ DbIterator methods
static gint db_simple_iterator_get_row (DbSimpleIterator * self)
{
g_return_val_if_fail (DB_IS_SIMPLE_ITERATOR (self), -1);
if (self->iter)
return self->row;
else
return -1;
}
static DbIteratorMode db_simple_iterator_get_mode (DbSimpleIterator * self)
{
g_return_val_if_fail (DB_IS_SIMPLE_ITERATOR (self), 0);
return self->mode;
}
static void db_simple_iterator_set_mode (DbSimpleIterator * self, DbIteratorMode mode)
{
g_return_if_fail (DB_IS_SIMPLE_ITERATOR (self));
self->mode = mode;
if (self->model)
db_simple_iterator_set_model_mode (self);
}
static gboolean db_simple_iterator_get_iter (DbSimpleIterator * self, DbIter ** iter)
{
g_return_val_if_fail (DB_IS_SIMPLE_ITERATOR (self), FALSE);
if (!self->iter)
return FALSE;
*iter = self->iter;
return TRUE;
}
static void db_simple_iterator_set_iter (DbSimpleIterator * self, DbIter * iter)
{
if (iter)
{
db_iter_free (self->iter);
self->iter = db_iter_copy (iter);
db_simple_iterator_iter_changed (self);
}
else if (self->iter)
{
if (!self->remember_selection)
self->row = 0;
db_iter_free (self->iter);
self->iter = NULL;
db_simple_iterator_iter_changed (self);
}
}
static gboolean db_simple_iterator_move_iter (DbSimpleIterator * self, DbIter * iter)
{
g_return_val_if_fail (DB_IS_SIMPLE_ITERATOR (self), FALSE);
if (self->iter && db_iter_compare (self->iter, iter))
return FALSE;
if (self->iter && self->mode != DB_ITERATOR_MODE_ON_DEMAND)
{
if (db_model_get_row_operations (self->model, self->iter) == DB_MODEL_ROW_OP_INSERT)
db_model_reverse_operations (self->model);
db_model_perform_operations (self->model, FALSE);
}
db_simple_iterator_set_iter (self, iter);
return TRUE;
}
static GList * db_simple_iterator_get_param_list (DbSimpleIterator * self)
{
g_return_val_if_fail (DB_IS_SIMPLE_ITERATOR (self), NULL);
return self->params;
}
static void db_simple_iterator_delete_selection (DbSimpleIterator * self)
{
g_return_if_fail (DB_IS_SIMPLE_ITERATOR (self));
if (self->model && self->iter)
db_model_delete (self->model, self->iter);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Properties
enum
{
PROP_MODEL = 1
,PROP_MODE
,PROP_REMEMBER_SELECTION
};
static void db_simple_iterator_set_property (DbSimpleIterator * self, guint id,
const GValue * value, GParamSpec * pspec)
{
switch (id)
{
case PROP_MODEL:
db_simple_iterator_set_model (self, g_value_get_object (value));
break;
case PROP_MODE:
db_simple_iterator_set_mode (self, g_value_get_enum (value));
break;
case PROP_REMEMBER_SELECTION:
self->remember_selection = g_value_get_boolean (value);
db_simple_iterator_row_num_changed (self);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (self, id, pspec);
}
}
static void db_simple_iterator_get_property (DbSimpleIterator * self, guint id,
GValue * value, GParamSpec * pspec)
{
switch (id)
{
case PROP_MODEL:
g_value_set_object (value, self->model);
break;
case PROP_MODE:
g_value_set_enum (value, self->mode);
break;
case PROP_REMEMBER_SELECTION:
g_value_set_boolean (value, self->remember_selection);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (self, id, pspec);
}
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
static void db_simple_iterator_init (DbSimpleIterator * self)
{
self->params = NULL;
self->iter = NULL;
self->row = 0;
self->model = NULL;
}
static void db_simple_iterator_finalize (DbSimpleIterator * self)
{
GList * n;
for (n = self->params; n; n = n->next)
g_object_weak_unref (n->data,
(GWeakNotify) db_simple_iterator_unref_param, self);
g_list_free (self->params);
db_iter_free (self->iter);
self->iter = NULL;
if (self->model)
{
g_object_disconnect (self->model
,"any_signal", db_simple_iterator_on_model_line_inserted, self
,"any_signal", db_simple_iterator_on_model_line_updated_after, self
,"any_signal", db_simple_iterator_on_model_line_deleted, self
,"any_signal", db_simple_iterator_on_model_line_deleted_after, self
,"any_signal", db_simple_iterator_on_model_lines_reordered, self
,"any_signal", db_simple_iterator_on_model_status_changed, self
,"any_signal", db_simple_iterator_on_model_operations_done, self
,NULL
);
g_object_unref (self->model);
}
G_OBJECT_CLASS (db_simple_iterator_parent_class)->finalize (G_OBJECT (self));
}
static void db_simple_iterator_class_init (DbSimpleIteratorClass * klass)
{
GObjectClass * k = G_OBJECT_CLASS (klass);
k->set_property = (GObjectSetPropertyFunc) db_simple_iterator_set_property;
k->get_property = (GObjectGetPropertyFunc) db_simple_iterator_get_property;
k->finalize = (GObjectFinalizeFunc) db_simple_iterator_finalize;
g_object_class_override_property (k, PROP_MODEL, "data-model");
g_object_class_override_property (k, PROP_MODE, "mode");
g_object_class_override_property (k, PROP_REMEMBER_SELECTION, "remember-selection");
}
static void db_simple_iterator_model_holder_init (DbModelHolderInterface * iface)
{
iface->get_model = (DbModelHolderGetModelFunc) db_simple_iterator_get_model;
iface->set_model = (DbModelHolderSetModelFunc) db_simple_iterator_set_model;
}
static void db_simple_iterator_iterator_init (DbIteratorInterface * iface)
{
iface->get_mode = (DbIteratorGetMode) db_simple_iterator_get_mode;
iface->set_mode = (DbIteratorSetMode) db_simple_iterator_set_mode;
iface->get_row = (DbIteratorGetRow) db_simple_iterator_get_row;
iface->get_iter = (DbIteratorGetIter) db_simple_iterator_get_iter;
iface->set_iter = (DbIteratorSetIter) db_simple_iterator_set_iter;
iface->move_iter = (DbIteratorMoveIter) db_simple_iterator_move_iter;
iface->get_param_list = (DbIteratorGetParamList) db_simple_iterator_get_param_list;
iface->delete_selection = (DbIteratorDeleteSelection) db_simple_iterator_delete_selection;
}

54
db/db-simple-iterator.h Normal file
View File

@ -0,0 +1,54 @@
/*
* Copyright (C) 2012 - Juan Ferrer Toribio
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DB_SIMPLE_ITERATOR_H
#define DB_SIMPLE_ITERATOR_H
#include "db-model.h"
#include "db-iterator.h"
#define DB_TYPE_SIMPLE_ITERATOR (db_simple_iterator_get_type ())
#define DB_SIMPLE_ITERATOR(self) (G_TYPE_CHECK_INSTANCE_CAST (self, DB_TYPE_SIMPLE_ITERATOR, DbSimpleIterator))
#define DB_IS_SIMPLE_ITERATOR(self) (G_TYPE_CHECK_INSTANCE_TYPE (self, DB_TYPE_SIMPLE_ITERATOR))
#define DB_SIMPLE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, DB_TYPE_SIMPLE_ITERATOR, DbSimpleIteratorClass))
#define DB_IS_SIMPLE_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass, DB_TYPE_SIMPLE_ITERATOR))
#define DB_SIMPLE_ITERATOR_GET_CLASS(self) (G_TYPE_INSTANCE_GET_CLASS (self, DB_TYPE_SIMPLE_ITERATOR, DbSimpleIteratorClass))
typedef struct _DbSimpleIterator DbSimpleIterator;
typedef struct _DbSimpleIteratorClass DbSimpleIteratorClass;
struct _DbSimpleIterator
{
GObject parent;
DbModel * model;
GList * params;
DbIteratorMode mode;
DbIter * iter;
gint row;
gboolean remember_selection;
};
struct _DbSimpleIteratorClass
{
/* <private> */
GObjectClass parent;
};
GType db_simple_iterator_get_type ();
DbIterator * db_simple_iterator_new (DbModel * model);
#endif

View File

@ -25,6 +25,7 @@
#include "db-request.h"
#include "db-conn.h"
#include "db-row.h"
#include "db-simple-iterator.h"
#include "db-iterator.h"
#include "db-param.h"
#include "db-plugin.h"

View File

@ -19,8 +19,8 @@
<refsection id="first">
<title>Previous stage</title>
<para>
Before you can add a module, you have to create it. To do so,
the Hedera Library ships with an
First you have to create a module. To do so, the Hedera Library
ships with an
<ulink url="http://www.anjuta.org/">Anjuta IDE</ulink> project
wizzard that creates an empty module written in Vala, ready
to be configured and built. If you won't be using the Anjuta IDE,

View File

@ -20,8 +20,7 @@
<para>
This chapter covers how to configure the library from the tarball,
if you have received it packed in any other form, like a <filename>.deb</filename>
package, this section can be ignored, but you'll need to know how
to use the package you received.
package, this section can be ignored.
</para>
</refsection>
<refsection id="needed">

View File

@ -26,11 +26,6 @@
<xi:include href="configuring.xml"/>
<xi:include href="running.xml"/>
<xi:include href="adding-modules.xml"/>
<!--
Pending chapters:
Windows <xi:include href="windows.xml"/>
OSX <xi:include href="osx.xml"/>
-->
</part>
<part id="hedera-usage">
<title>Using Hedera library</title>
@ -74,23 +69,29 @@
<xi:include href="xml/sql-render.xml"/>
<xi:include href="xml/sql-batch.xml"/>
<xi:include href="xml/sql-object.xml"/>
<xi:include href="xml/sql-holder.xml"/>
<xi:include href="xml/sql-list.xml"/>
<xi:include href="xml/sql-select-field.xml"/>
<xi:include href="xml/sql-select-order.xml"/>
<xi:include href="xml/sql-update-set.xml"/>
<xi:include href="xml/sql-stmt.xml"/>
<xi:include href="xml/sql-expr.xml"/>
<xi:include href="xml/sql-target.xml"/>
<xi:include href="xml/sql-dml.xml"/>
<xi:include href="xml/sql-insert.xml"/>
<xi:include href="xml/sql-multi-stmt.xml"/>
<xi:include href="xml/sql-insert.xml"/>
<xi:include href="xml/sql-string.xml"/>
<xi:include href="xml/sql-dml.xml"/>
<xi:include href="xml/sql-delete.xml"/>
<xi:include href="xml/sql-select.xml"/>
<xi:include href="xml/sql-update.xml"/>
<xi:include href="xml/sql-expr.xml"/>
<xi:include href="xml/sql-field.xml"/>
<xi:include href="xml/sql-function.xml"/>
<xi:include href="xml/sql-operation.xml"/>
<xi:include href="xml/sql-value.xml"/>
<xi:include href="xml/sql-set.xml"/>
<xi:include href="xml/sql-target.xml"/>
<xi:include href="xml/sql-table.xml"/>
<xi:include href="xml/sql-join.xml"/>
<xi:include href="xml/sql-subquery.xml"/>
<xi:include href="xml/sql-table.xml"/>
</chapter>
<chapter id="dblib">
<title>DbLib</title>
@ -114,9 +115,12 @@
<xi:include href="xml/vn-grid-model.xml"/>
<xi:include href="xml/vn-grid.xml"/>
<xi:include href="xml/vn-handler.xml"/>
<xi:include href="xml/vn-batch.xml"/>
<xi:include href="xml/vn-set.xml"/>
<xi:include href="xml/vn-field.xml"/>
<xi:include href="xml/vn-column.xml"/>
<xi:include href="xml/vn-login.xml"/>
<xi:include href="xml/vn-iterator.xml"/>
<xi:include href="xml/vn-model.xml"/>
</chapter>
<chapter id="vnfield">
<title>Fields</title>

View File

@ -19,30 +19,29 @@
<refsection id="description">
<title>The Hedera Library</title>
<para>
The Hedera library is a utility library that offers an easy
way to connect to a database and show and manipulate the retrieved
data using
The Hedera library offers an easy way to connect to a database and
to show and manipulate its data using
<ulink url="file:///usr/share/gtk-doc/html/gtk3/index.html">GTK+
</ulink> graphical interfaces.
</para>
<para>
It features a modular system to easily add new functionalities
to your applications with the minimum maintenance needed. This
system offers the developer the chance to use either
to your applications with the minimum configuration needed. This
system offers the developer the chance to use
<ulink url="file:///usr/share/gtk-doc/html/glib/index.html">GLib
</ulink> and
<ulink url="file:///usr/share/gtk-doc/html/gobject/index.html">
GObject</ulink> from C or
GObject</ulink> either from C or from
<ulink url="http://www.valadoc.org/">Vala</ulink> to implement new
modules and also comes with an easy integration method to add them
to the existing application in no time.
modules.
</para>
<para>
Althought you can write your own applications, the library is
thought to use the shipped application and link the modules
to it, in order to ease the process. The linking of the
application and the modules will be described in the section
about adding new modules and an example of the process will be
to it, in order to ease the process. The way to use the modules
from the application will be described in the section about
<ulink url="file:///usr/share/gtk-doc/html/hedera/adding-modules.html">
adding new modules</ulink> and an example of the process will be
shown in a tutorial.
</para>
<para>

View File

@ -21,8 +21,8 @@
<para>
To run your own modules you need to install them in the
search directories of Hedera. You can use
<command>pkg-config</command> to know where
these directories actually are in your installation:
<command>pkg-config</command> to know where these directories
actually are in your installation:
<programlisting>
pkg-config --variable=modulelibdir hedera
pkg-config --variable=moduledatadir hedera

View File

@ -26,7 +26,7 @@ static void glade_db_iterator_on_param_col_name_changed (GladeProperty * propert
GladeWidget * parent = glade_widget_get_parent (param);
if (!name || name[0] == '\0' || !parent
|| G_OBJECT_TYPE (glade_widget_get_object (parent)) != VN_TYPE_ITERATOR)
|| !(G_OBJECT_TYPE (glade_widget_get_object (parent)) == VN_TYPE_ITERATOR))
return;
project = glade_widget_get_project (param);
@ -35,7 +35,7 @@ static void glade_db_iterator_on_param_col_name_changed (GladeProperty * propert
}
void glade_db_iterator_add_child (GladeWidgetAdaptor * adaptor,
DbIterator * parent, DbParam * child)
DbIterator * parent, GObject * child)
{
GladeWidget * param = glade_widget_get_from_gobject (G_OBJECT (child));
GladeProperty * name_prop = glade_widget_get_property (param, "column-name");
@ -43,17 +43,19 @@ void glade_db_iterator_add_child (GladeWidgetAdaptor * adaptor,
g_signal_connect (name_prop, "value-changed",
G_CALLBACK (glade_db_iterator_on_param_col_name_changed), param);
vn_iterator_add_param (parent, child);
if (VN_IS_ITERATOR (parent))
vn_iterator_add_param (DB_SIMPLE_ITERATOR (parent), DB_PARAM (child));
}
void glade_db_iterator_remove_child (GladeWidgetAdaptor * adaptor,
DbIterator * parent, DbParam * child)
DbIterator * parent, GObject * child)
{
vn_iterator_remove_param (parent, child);
if (VN_IS_ITERATOR (parent))
vn_iterator_remove_param (DB_SIMPLE_ITERATOR (parent), DB_PARAM (child));
}
void glade_db_iterator_replace_child (GladeWidgetAdaptor * adaptor,
DbIterator * container, DbParam * current, DbParam * new)
DbIterator * container, GObject * current, GObject * new)
{
glade_db_iterator_remove_child (adaptor, container, current);
glade_db_iterator_add_child (adaptor, container, new);
@ -62,69 +64,34 @@ void glade_db_iterator_replace_child (GladeWidgetAdaptor * adaptor,
GList * glade_db_iterator_get_children (GladeWidgetAdaptor * adaptor,
DbIterator * parent)
{
return vn_iterator_get_params (parent);
}
if (VN_IS_ITERATOR (parent))
return vn_iterator_get_params (DB_SIMPLE_ITERATOR (parent));
static void glade_db_iterator_child_selected (GladeBaseEditor * editor,
GladeWidget * child, gpointer data)
{
glade_base_editor_add_label (editor, _("Parameter"));
glade_base_editor_add_default_properties (editor, child);
glade_base_editor_add_label (editor, _("Properties"));
glade_base_editor_add_editable (editor, child, GLADE_PAGE_GENERAL);
return NULL;
}
gboolean glade_db_iterator_add_verify (GladeWidgetAdaptor * adaptor,
DbIterator * container, DbParam * child, gboolean user_feedback)
DbIterator * container, GObject * child, gboolean user_feedback)
{
if (DB_IS_PARAM (child))
return TRUE;
if (user_feedback)
{
GladeWidgetAdaptor * object_adaptor =
glade_widget_adaptor_get_by_type (DB_TYPE_PARAM);
GladeWidgetAdaptor * child_adaptor = glade_widget_adaptor_get_by_type (DB_TYPE_PARAM);
glade_util_ui_message (glade_app_get_window ()
,GLADE_UI_INFO
,NULL
,"Only objects of type %s can be added to objects of type %s."
,glade_widget_adaptor_get_title (object_adaptor)
,"Objects of type %s only accept objects of type %s as children."
,glade_widget_adaptor_get_title (adaptor)
,glade_widget_adaptor_get_title (child_adaptor)
);
}
return FALSE;
}
static gboolean glade_db_iterator_move_child (GladeBaseEditor * editor,
GladeWidget * parent, GladeWidget * child, gpointer data)
{
return FALSE;
}
static void glade_db_iterator_on_launch_editor (GObject * iterator)
{
GladeBaseEditor * editor;
GladeEditable * param_editor;
GtkWidget * window;
GladeWidget * widget = glade_widget_get_from_gobject (iterator);
GladeWidgetAdaptor * adaptor = glade_widget_get_adaptor (widget);
param_editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
editor = glade_base_editor_new (glade_widget_get_object (widget),
param_editor, _("Parameter"), DB_TYPE_PARAM, NULL);
g_signal_connect (editor, "child-selected",
G_CALLBACK (glade_db_iterator_child_selected), NULL);
g_signal_connect (editor, "move-child",
G_CALLBACK (glade_db_iterator_move_child), NULL);
gtk_widget_show (GTK_WIDGET (editor));
window = glade_base_editor_pack_new_window (editor, _("Iterator Editor"), NULL);
gtk_widget_show (window);
}
static void glade_db_iterator_on_generate_params (GladeWidget * iterator)
{
gboolean use_file = TRUE;
@ -134,9 +101,9 @@ static void glade_db_iterator_on_generate_params (GladeWidget * iterator)
SqlSelect * select;
GladeWidget * model_w;
DbModel * model = NULL;
GList * params = vn_iterator_get_params
(DB_ITERATOR (glade_widget_get_object (iterator)));
GError * err = NULL;
GList * params =
vn_iterator_get_params (DB_SIMPLE_ITERATOR (glade_widget_get_object (iterator)));
if (params)
{
@ -145,9 +112,8 @@ static void glade_db_iterator_on_generate_params (GladeWidget * iterator)
g_list_free (params);
return;
}
g_list_free (params);
glade_widget_property_get (iterator, "model", &model, NULL);
glade_widget_property_get (iterator, "data-model", &model, NULL);
if (!model)
{
@ -173,13 +139,14 @@ static void glade_db_iterator_on_generate_params (GladeWidget * iterator)
SqlList * list;
GList * l, * fields;
GladeProject * project = glade_widget_get_project (iterator);
gint field_pos = 0;
g_object_get (select, "fields", &list, NULL);
fields = sql_list_get_items (list);
glade_command_push_group (_("Automatic generation of params for %s"), name);
for (l = fields; l; l = l->next)
for (l = fields; l; l = l->next, field_pos++)
{
const gchar * param_name = NULL;
gchar * param_new_name = NULL;
@ -210,6 +177,8 @@ static void glade_db_iterator_on_generate_params (GladeWidget * iterator)
g_free (param_new_name);
}
else
glade_widget_property_set (param, "column-index", field_pos);
}
glade_command_pop_group ();
@ -223,13 +192,50 @@ static void glade_db_iterator_on_generate_params (GladeWidget * iterator)
}
}
static void glade_db_iterator_child_selected (GladeBaseEditor * editor,
GladeWidget * child, gpointer data)
{
glade_base_editor_add_label (editor, _("Parameter"));
glade_base_editor_add_default_properties (editor, child);
glade_base_editor_add_label (editor, _("Properties"));
glade_base_editor_add_editable (editor, child, GLADE_PAGE_GENERAL);
}
static gboolean glade_db_iterator_move_child (GladeBaseEditor * editor,
GladeWidget * parent, GladeWidget * child, gpointer data)
{
return FALSE;
}
static void glade_db_iterator_on_launch_editor (GObject * iterator)
{
GladeBaseEditor * editor;
GladeEditable * param_editor;
GtkWidget * window;
GladeWidget * widget = glade_widget_get_from_gobject (iterator);
GladeWidgetAdaptor * adaptor = glade_widget_get_adaptor (widget);
param_editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
editor = glade_base_editor_new (glade_widget_get_object (widget),
param_editor, _("Parameter"), DB_TYPE_PARAM, NULL);
g_signal_connect (editor, "child-selected",
G_CALLBACK (glade_db_iterator_child_selected), NULL);
g_signal_connect (editor, "move-child",
G_CALLBACK (glade_db_iterator_move_child), NULL);
gtk_widget_show (GTK_WIDGET (editor));
window = glade_base_editor_pack_new_window (editor, _("Iterator Editor"), NULL);
gtk_widget_show (window);
}
void glade_db_iterator_action_activate (GladeWidgetAdaptor * adaptor,
GObject * object, const gchar * action_path)
{
if (!g_strcmp0 (action_path, "launch-editor"))
glade_db_iterator_on_launch_editor (object);
else if (!g_strcmp0 (action_path, "generate-params"))
if (!g_strcmp0 (action_path, "generate-params"))
glade_db_iterator_on_generate_params (glade_widget_get_from_gobject (object));
else if (!g_strcmp0 (action_path, "launch-editor"))
glade_db_iterator_on_launch_editor (object);
}
// XXX Workaround for an error in Glade while loading child params
@ -275,7 +281,7 @@ void glade_db_iterator_read_widget (GladeWidgetAdaptor * adaptor,
const gchar * name = glade_widget_get_name (w);
for (l = correction_data; l; l = l->next)
if (g_str_has_suffix (name, (gchar *)l->data))
if (g_str_has_suffix (name, (gchar *) l->data))
glade_widget_set_name (w, (gchar *) l->data);
}

View File

@ -59,7 +59,7 @@ void glade_vn_init ()
g_idle_add (glade_vn_set_first_catalog, "vn");
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ GladeDbList
//+++++++++++++++++++++++++++++++++++++++++++++++++++ GladeVnList
G_DEFINE_BOXED_TYPE (GladeVnList, glade_vn_list, glade_vn_list_copy, glade_vn_list_free);
@ -90,6 +90,19 @@ GObject * glade_vn_field_get_internal_child (GladeWidgetAdaptor * adaptor,
return G_OBJECT (vn_field_get_widget (VN_FIELD (parent)));
}
void glade_vn_field_write_child (GladeWidgetAdaptor * adaptor, GladeWidget * widget,
GladeXmlContext * context, GladeXmlNode * node)
{
if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
return;
GWA_GET_CLASS (G_TYPE_OBJECT)->write_widget (adaptor, widget, context, node);
// Force can focus to True, leave others property as set or by default
// g_message ("glade_vn_field_write_child called for %s", glade_widget_get_name (widget));
}
GObject * glade_vn_column_get_internal_child (GladeWidgetAdaptor * adaptor,
GObject * parent, const gchar * name)
{

View File

@ -5,6 +5,20 @@
<init-function>glade_vn_init</init-function>
<glade-widget-classes>
<!-- TODO Ver como se puede poner una interfaz sin modificar las clases que la implementan
<glade-widget-class name="DbModelHolder" generic-name="model-holder" title="Model holder" icon-name="widget-gtk-liststore">
<properties>
<property id="data-model" ignore="True">
<parameter-spec>
<type>GParamObject</type>
<value-type>DbModel</value-type>
</parameter-spec>
<tooltip translatable="yes">The model held by the object</tooltip>
</property>
</properties>
<create-editor-property-function>glade_db_model_holder_create_eprop</create-editor-property-function>
</glade-widget-class>
-->
<glade-widget-class name="VnBatch" generic-name="batch" title="Batch" icon-name="widget-gtk-listbox">
<properties>
<property id="items" save="False" ignore="True" disabled="True" name="Items">
@ -49,7 +63,7 @@
<glade-widget-class name="VnIterator" generic-name="iterator" title="Iterator" icon-name="widget-gtk-texttagtable">
<properties>
<property id="model" ignore="True">
<property id="data-model" ignore="True">
<parameter-spec>
<type>GParamObject</type>
<value-type>DbModel</value-type>
@ -73,7 +87,7 @@
<glade-widget-class name="DbParam" generic-name="param" title="Iterator Parameter" icon-name="widget-gtk-texttag">
<properties>
<property id="iterator" disabled="True"/>
<property id="iterator" ignore="True"/>
<property id="column-name" ignore="True"/>
<property id="column-index" ignore="True"/>
</properties>
@ -90,7 +104,18 @@
</properties>
</glade-widget-class>
<glade-widget-class name="VnGrid" generic-name="grid" title="Grid" icon-name="widget-gtk-treeview"/>
<glade-widget-class name="VnGrid" generic-name="grid" title="Grid" icon-name="widget-gtk-treeview">
<properties>
<property id="data-model" ignore="True">
<parameter-spec>
<type>GParamObject</type>
<value-type>DbModel</value-type>
</parameter-spec>
<tooltip translatable="yes">The model held by the object</tooltip>
</property>
</properties>
<create-editor-property-function>glade_db_model_holder_create_eprop</create-editor-property-function>
</glade-widget-class>
<glade-widget-class name="VnColumn" title="Column">
<internal-children>
@ -116,7 +141,7 @@
<properties>
<property id="show-column" weight="1.2"/>
<property id="sort-column" weight="1.3"/>
<property id="model" ignore="True">
<property id="data-model" ignore="True">
<parameter-spec>
<type>GParamObject</type>
<value-type>DbModel</value-type>
@ -145,11 +170,12 @@
<object name="widget"/>
</internal-children>
<get-internal-child-function>glade_vn_field_get_internal_child</get-internal-child-function>
<!-- <write-child-function>glade_vn_field_write_child</write-child-function>-->
</glade-widget-class>
<glade-widget-class name="VnCombo" generic-name="combo" title="Combo Box Field" icon-name="widget-gtk-combobox">
<properties>
<property id="model" ignore="True">
<property id="data-model" ignore="True">
<parameter-spec>
<type>GParamObject</type>
<value-type>DbModel</value-type>
@ -165,7 +191,7 @@
<glade-widget-class name="VnCompletion" generic-name="completion" title="Completion Field" icon-name="widget-gtk-entry">
<properties>
<property id="model" ignore="True">
<property id="data-model" ignore="True">
<parameter-spec>
<type>GParamObject</type>
<value-type>DbModel</value-type>

View File

@ -582,7 +582,12 @@ void gvn_value_to_format_string (const GValue * src, const gchar * format, GValu
{
gchar buffer[120];
GDate * date = g_value_get_boxed (src);
if (date)
g_date_strftime (buffer, 120, format ? format : "%Y-%m-%d", date);
else
buffer[0] = '\0';
g_value_set_string (dst, buffer);
}
else if (type == G_TYPE_DATE_TIME)

View File

@ -4,12 +4,12 @@
<item>
<attribute name="label" translatable="yes">Send</attribute>
<attribute name="action">win.send</attribute>
<attribute name="accel">&lt;Shift&gt;s</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Clean</attribute>
<attribute name="action">win.clean</attribute>
<attribute name="accel">&lt;Shift&gt;c</attribute>
<attribute name="accel">&lt;Primary&gt;l</attribute>
</item>
</menu>
</interface>

View File

@ -159,15 +159,7 @@
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="VnGrid" id="consulter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="grid-selection">
<property name="mode">multiple</property>
</object>
</child>
</object>
<placeholder/>
</child>
</object>
<packing>

View File

@ -20,8 +20,8 @@
</object>
</child>
</object>
<object class="VnIterator" id="iter-items">
<property name="model">items</property>
<object class="VnIterator" id="items">
<property name="data-model">model-items</property>
<property name="remember_selection">False</property>
</object>
<object class="GtkBox" id="main">

View File

@ -76,14 +76,11 @@ static void vn_consulter_model_status_changed (DbModel * model,
{
gint i;
GList * n;
GtkTreeView * tv = GTK_TREE_VIEW (obj->grid);
GtkTreeView * tv = GTK_TREE_VIEW (vn_handler_get_iterator (obj->handler));
GList * cols = gtk_tree_view_get_columns (tv);
for (n = cols; n; n = n->next)
{
GtkTreeViewColumn * col = n->data;
gtk_tree_view_remove_column (tv, col);
}
gtk_tree_view_remove_column (tv, (GtkTreeViewColumn *) n->data);
g_list_free (cols);
@ -187,7 +184,7 @@ static void vn_consulter_model_status_changed (DbModel * model,
// Appends the column to the grid
gtk_tree_view_append_column (GTK_TREE_VIEW (obj->grid),
gtk_tree_view_append_column (tv,
GTK_TREE_VIEW_COLUMN (column));
}
else if (status == DB_MODEL_STATUS_ERROR)
@ -199,18 +196,17 @@ static void vn_consulter_model_status_changed (DbModel * model,
void vn_consulter_mode_toggled (GtkToggleButton * mode, VnConsulter * obj)
{
DbIterator * iterator = vn_handler_get_iterator (obj->handler);
db_iterator_set_mode (iterator
,(gtk_toggle_button_get_active (mode)) ?
DB_ITERATOR_MODE_ON_CHANGE:
DB_ITERATOR_MODE_ON_DEMAND
DB_ITERATOR_MODE_ON_CHANGE : DB_ITERATOR_MODE_ON_DEMAND
);
}
void vn_consulter_send (GtkButton * button, VnConsulter * obj)
{
DbIterator * iterator;
DbModel * model;
VnGrid * grid;
DbIterator * old_grid;
gchar * sql;
sql = gtk_combo_box_text_get_active_text (obj->combo);
@ -224,20 +220,27 @@ void vn_consulter_send (GtkButton * button, VnConsulter * obj)
model = db_model_new_with_sql (VN_FORM (obj)->conn, sql);
db_model_request_update_flags (model, DB_MODEL_ALL);
// Get sure to connect after the columns do, to destroy them.
g_signal_connect_after (model, "status-changed",
G_CALLBACK (vn_consulter_model_status_changed), obj);
iterator = db_iterator_new (model);
iterator->mode = DB_ITERATOR_MODE_ON_DEMAND;
vn_handler_set_iterator (obj->handler, iterator);
vn_grid_set_iterator (obj->grid, iterator);
if ((old_grid = vn_handler_get_iterator (obj->handler)))
gtk_container_remove (obj->grid_scroll, GTK_WIDGET (old_grid));
grid = vn_grid_new (model);
g_object_set (grid
,"mode", DB_ITERATOR_MODE_ON_DEMAND
,"remember-selection", TRUE
,NULL);
vn_handler_set_iterator (obj->handler, DB_ITERATOR (grid));
gtk_container_add (obj->grid_scroll, GTK_WIDGET (grid));
gtk_widget_show (GTK_WIDGET (grid));
vn_consulter_mode_toggled (GTK_TOGGLE_BUTTON (obj->mode), obj);
g_free (sql);
g_object_unref (model);
g_object_unref (iterator);
}
static void vn_consulter_open (VnConsulter * obj)
@ -251,7 +254,8 @@ static void vn_consulter_open (VnConsulter * obj)
obj->combo = vn_form_get (form, "query");
obj->tv = vn_form_get (form, "treeview");
obj->mode = vn_form_get (form, "mode");
obj->grid = vn_form_get (form, "consulter");
// obj->grid = vn_form_get (form, "consulter");
obj->grid_scroll = vn_form_get (form, "scrolledwindow-data");
obj->handler = vn_form_get (form, "handler");
column = vn_form_get (form, "column-log");

View File

@ -34,7 +34,7 @@ struct _VnConsulter
GtkCheckButton * mode;
GtkComboBoxText * combo;
GtkTreeView * tv;
VnGrid * grid;
GtkContainer * grid_scroll;
VnHandler * handler;
gchar * file;

View File

@ -84,7 +84,7 @@ static gboolean db_mysql_open (DbMysql * obj, const gchar * host,
}
g_set_error (err
,DB_CONN_ERROR_OPENING
,DB_CONN_LOG_DOMAIN
,error_code
,"%s", mysql_error (obj->mysql)
);

View File

@ -68,6 +68,8 @@
G_DEFINE_TYPE (DbPg, db_pg, DB_TYPE_PLUGIN);
static SqlMultiStmt * info_query_stmt;
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
static void db_pg_close (DbPlugin * obj)
@ -131,7 +133,7 @@ static gboolean db_pg_open (DbPlugin * obj, const gchar * host,
static void db_pg_set_ssl (DbPg * obj, const gchar * ca)
{
g_warning ("DbPg: SSL not supported by this plugin");
g_message ("DbPg: SSL not supported by this plugin");
}
//+++++++ Internal Methods for db_pg_query ()
@ -490,90 +492,62 @@ static DbResultSet * __db_pg_query
if (!failed && sel_count > 0 && columns)
{
gint k;
Oid t_oid;
GPtrArray * col_num = NULL;
GPtrArray * oid = NULL;
gchar * info_query = g_strdup ("");
gchar * pkey_query;
gchar * pkey_buff = NULL // buffers for memory leak avoidance
,* info_buff = NULL;
SqlBatch * batch = sql_batch_new ();
gchar * info_query = g_new0 (gchar, 1);
// Set info_query string using the previously stored table OIDs and column numbers
for (i = 0; i < (gint) sel_count; i++)
{
pkey_query = g_strdup ("");
oid = g_ptr_array_index (rel_oid, i);
col_num = g_ptr_array_index (col, i);
info_buff = info_query;
info_query = g_strconcat (info_query,
"SELECT attname, attrelid, attnotnull, adsrc, attnum "
"FROM pg_attribute "
"INNER JOIN pg_class c ON c.oid = attrelid "
"LEFT JOIN pg_attrdef a "
"ON a.adrelid = attrelid AND a.adnum = attnum "
"WHERE attisdropped = false AND (c.oid, attnum) IN ("
, NULL);
g_free (info_buff);
pkey_buff = pkey_query;
pkey_query = g_strconcat (pkey_query,
"SELECT c.oid, relname, indkey "
"FROM pg_class c "
"LEFT JOIN pg_index i ON indrelid = c.oid "
"AND indisprimary "
"WHERE c.oid IN ("
, NULL);
g_free (pkey_buff);
gchar * buff;
GHashTable * added_tables = g_hash_table_new (g_int_hash, g_int_equal);
SqlList * fields_list, * tables_list;
SqlObject * fields_set = sql_set_new (),
* tables_set = sql_set_new ();
GPtrArray * oid = g_ptr_array_index (rel_oid, i),
* col_num = g_ptr_array_index (col, i);
gint ncolumns = (gint) oid->len;
gchar * buff_j = NULL;
fields_list = sql_list_new (SQL_TYPE_EXPR);
sql_object_set (fields_set, "exprs", SQL_OBJECT (fields_list));
tables_list = sql_list_new (SQL_TYPE_EXPR);
sql_object_set (tables_set, "exprs", SQL_OBJECT (tables_list));
for (j = 0; j < ncolumns; j++)
{
t_oid = GPOINTER_TO_UINT (g_ptr_array_index (oid, j));
SqlList * list;
Oid table_oid = GPOINTER_TO_UINT (g_ptr_array_index (oid, j));
guint column = GPOINTER_TO_INT (g_ptr_array_index (col_num, j));
SqlObject * tab, * col, * set = sql_set_new ();
buff_j = g_strdup_printf ("%d", t_oid);
pkey_buff = pkey_query;
pkey_query = g_strconcat (pkey_query, buff_j, NULL);
g_free (pkey_buff);
g_free (buff_j);
GValue tab_val = G_VALUE_INIT;
g_value_set_uint (g_value_init (&tab_val, G_TYPE_UINT), table_oid);
tab = sql_value_new_with_value (&tab_val);
g_value_unset (&tab_val);
if (j < ncolumns-1 && ncolumns > 1)
{
pkey_buff = pkey_query;
pkey_query = g_strconcat (pkey_query, ",", NULL);
g_free (pkey_buff);
GValue col_val = G_VALUE_INIT;
g_value_set_uint (g_value_init (&col_val, G_TYPE_UINT), column);
col = sql_value_new_with_value (&col_val);
g_value_unset (&col_val);
list = sql_list_new_with_items (SQL_TYPE_EXPR, tab, col, NULL);
sql_object_set (set, "exprs", SQL_OBJECT (list));
sql_list_add (fields_list, set);
if (g_hash_table_insert (added_tables, &table_oid, NULL))
sql_list_add (tables_list, tab);
}
buff_j = g_strdup_printf ("(%d,%d)"
,t_oid
,GPOINTER_TO_INT (g_ptr_array_index (col_num, j)));
info_buff = info_query;
info_query = g_strconcat (info_query, buff_j, NULL);
g_free (buff_j);
g_free (info_buff);
sql_batch_add (batch, "fields", fields_set);
sql_batch_add (batch, "tables", tables_set);
buff = info_query;
info_query = g_strconcat (buff,
db_plugin_render (DB_PLUGIN (obj), info_query_stmt, batch, NULL),
";", NULL);
g_free (buff);
info_buff = info_query;
if (j < ncolumns-1 && ncolumns > 1)
info_query = g_strconcat (info_query, ",", NULL);
else
info_query = g_strconcat (info_query, ")", NULL);
g_free (info_buff);
}
pkey_buff = pkey_query;
pkey_query = g_strconcat (pkey_query, ");", NULL);
g_free (pkey_buff);
info_buff = info_query;
info_query = g_strconcat (info_query, ";", NULL);
g_free (info_buff);
info_buff = info_query;
info_query = g_strconcat (info_query, pkey_query, NULL);
g_free (info_buff);
g_free (pkey_query);
g_hash_table_destroy (added_tables);
}
PGresult * res_col;
@ -897,6 +871,195 @@ static void db_pg_value_render (SqlValue * obj, SqlRender * render, SqlBatch * b
sql_object_render (SQL_OBJECT (obj), render, batch);
}
/*
* Called from the class initializer to set the file global variable
* 'info_query_stmt' which will be used to obtain information about the
* requested tables and fields in the db_pg_query method.
*/
static void db_pg_init_info_stmt ()
{
SqlObject * select;
SqlList * list;
SqlSelectField * select_field;
SqlJoin * join;
SqlTarget * target;
SqlObject * and, * equal, * expr, * set,
* fields_holder, * tables_holder,
* oid_field = sql_field_new_with_target ("oid", "c", NULL),
* attrelid_field = sql_field_new ("attrelid"),
* attnum_field = sql_field_new ("attnum");
SqlList * stmts = sql_list_new (SQL_TYPE_STMT);
info_query_stmt = g_object_new (SQL_TYPE_MULTI_STMT, "stmts", stmts, NULL);
// Fields for the first SELECT
select = sql_select_new ();
sql_list_add (stmts, select);
list = sql_list_new (SQL_TYPE_SELECT_FIELD);
select_field = g_object_new (SQL_TYPE_SELECT_FIELD,
"expr", sql_field_new ("attname"), NULL);
sql_list_add (list, select_field);
select_field = g_object_new (SQL_TYPE_SELECT_FIELD,
"expr", attrelid_field, NULL);
sql_list_add (list, select_field);
select_field = g_object_new (SQL_TYPE_SELECT_FIELD,
"expr", sql_field_new ("attnotnull"), NULL);
sql_list_add (list, select_field);
select_field = g_object_new (SQL_TYPE_SELECT_FIELD,
"expr", sql_field_new ("adsrc"), NULL);
sql_list_add (list, select_field);
select_field = g_object_new (SQL_TYPE_SELECT_FIELD,
"expr", attnum_field, NULL);
sql_list_add (list, select_field);
sql_object_set (select, "fields", SQL_OBJECT (list));
// Target for the first SELECT
target = SQL_TARGET (sql_table_new ("pg_class", NULL));
sql_target_set_alias (target, "c");
join = SQL_JOIN (sql_join_new
(SQL_TARGET (sql_table_new ("pg_attribute", NULL)),
target,
SQL_JOIN_TYPE_INNER));
equal = sql_operation_new (SQL_OPERATION_TYPE_EQUAL);
list = sql_list_new_with_items (SQL_TYPE_EXPR,
oid_field,
attrelid_field,
NULL);
sql_operation_set_operands (SQL_OPERATION (equal), list);
sql_join_set_condition (join, SQL_EXPR (equal));
target = SQL_TARGET (sql_table_new ("pg_attrdef", NULL));
sql_target_set_alias (target, "a");
join = SQL_JOIN (sql_join_new
(SQL_TARGET (join),
target,
SQL_JOIN_TYPE_LEFT));
equal = sql_operation_new (SQL_OPERATION_TYPE_EQUAL);
list = sql_list_new_with_items (SQL_TYPE_EXPR,
sql_field_new_with_target ("adrelid", "a", NULL),
attrelid_field,
NULL);
sql_operation_set_operands (SQL_OPERATION (equal), list);
expr = sql_operation_new (SQL_OPERATION_TYPE_EQUAL);
list = sql_list_new_with_items (SQL_TYPE_EXPR,
sql_field_new_with_target ("adnum", "a", NULL),
attnum_field,
NULL);
sql_operation_set_operands (SQL_OPERATION (expr), list);
and = sql_operation_new (SQL_OPERATION_TYPE_AND);
list = sql_list_new_with_items (SQL_TYPE_EXPR, equal, expr, NULL);
sql_operation_set_operands (SQL_OPERATION (and), list);
sql_join_set_condition (join, SQL_EXPR (and));
list = sql_list_new_with_items (SQL_TYPE_TARGET, join, NULL);
sql_object_set (select, "targets", SQL_OBJECT (list));
// WHERE clause for the first SELECT
equal = sql_operation_new (SQL_OPERATION_TYPE_EQUAL);
GValue val = G_VALUE_INIT;
g_value_set_boolean (g_value_init (&val, G_TYPE_BOOLEAN), FALSE);
list = sql_list_new_with_items (SQL_TYPE_EXPR,
sql_field_new ("attisdropped"),
sql_value_new_with_value (&val),
NULL);
sql_operation_set_operands (SQL_OPERATION (equal), list);
g_value_unset (&val);
expr = sql_operation_new (SQL_OPERATION_TYPE_IN);
set = sql_set_new ();
list = sql_list_new_with_items (SQL_TYPE_EXPR,
oid_field,
attnum_field,
NULL);
sql_object_set (set, "exprs", SQL_OBJECT (list));
fields_holder = sql_holder_new ("fields");
list = sql_list_new_with_items (SQL_TYPE_EXPR,
set,
fields_holder,
NULL);
sql_operation_set_operands (SQL_OPERATION (expr), list);
and = sql_operation_new (SQL_OPERATION_TYPE_AND);
list = sql_list_new_with_items (SQL_TYPE_EXPR, equal, expr, NULL);
sql_operation_set_operands (SQL_OPERATION (and), list);
sql_dml_set_where (SQL_DML (select), and);
// Fields for the second SELECT
select = sql_select_new ();
sql_list_add (stmts, select);
list = sql_list_new (SQL_TYPE_SELECT_FIELD);
select_field = g_object_new (SQL_TYPE_SELECT_FIELD,
"expr", oid_field, NULL);
sql_list_add (list, select_field);
select_field = g_object_new (SQL_TYPE_SELECT_FIELD,
"expr", sql_field_new ("relname"), NULL);
sql_list_add (list, select_field);
select_field = g_object_new (SQL_TYPE_SELECT_FIELD,
"expr", sql_field_new ("indkey"), NULL);
sql_list_add (list, select_field);
sql_object_set (select, "fields", SQL_OBJECT (list));
// Target for the second SELECT
join = SQL_JOIN (sql_join_new (NULL, NULL, SQL_JOIN_TYPE_LEFT));
target = SQL_TARGET (sql_table_new ("pg_class", NULL));
sql_target_set_alias (target, "c");
sql_join_set_target_left (join, target);
target = SQL_TARGET (sql_table_new ("pg_index", NULL));
sql_target_set_alias (target, "i");
sql_join_set_target_right (join, target);
equal = sql_operation_new (SQL_OPERATION_TYPE_EQUAL);
list = sql_list_new_with_items (SQL_TYPE_EXPR,
sql_field_new ("indrelid"),
oid_field,
NULL);
sql_operation_set_operands (SQL_OPERATION (equal), list);
and = sql_operation_new (SQL_OPERATION_TYPE_AND);
list = sql_list_new_with_items (SQL_TYPE_EXPR,
equal,
sql_field_new ("indisprimary"),
NULL);
sql_operation_set_operands (SQL_OPERATION (and), list);
sql_join_set_condition (join, SQL_EXPR (and));
list = sql_list_new_with_items (SQL_TYPE_TARGET, join, NULL);
sql_object_set (select, "targets", SQL_OBJECT (list));
// WHERE clause for the first SELECT
expr = sql_operation_new (SQL_OPERATION_TYPE_IN);
tables_holder = sql_holder_new ("tables");
list = sql_list_new_with_items (SQL_TYPE_EXPR,
oid_field,
tables_holder,
NULL);
sql_operation_set_operands (SQL_OPERATION (expr), list);
sql_dml_set_where (SQL_DML (select), expr);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
static void db_pg_init (DbPg * obj)
@ -918,4 +1081,6 @@ static void db_pg_class_init (DbPgClass * k)
klass->set_ssl = (DbPluginSetSSL) db_pg_set_ssl;
klass->query = db_pg_query;
klass->kill_query = (DbPluginKillQueryFunc) db_pg_kill_query;
db_pg_init_info_stmt ();
}

View File

@ -218,7 +218,7 @@ static DbResultSet * db_sqlite_query (DbSqlite * self, const gchar * sql, GError
static void db_sqlite_kill_query (DbSqlite * self)
{
g_warning ("DbSqlite: Kill doesn't supported by this plugin");
g_warning ("DbSqlite: Kill not supported by this plugin");
}
static void db_sqlite_value_render (SqlValue * self, SqlRender * render, SqlBatch * batch)

462
po/ca.po
View File

@ -1,15 +1,15 @@
# Catalan translations for hedera package.
# Copyright (C) 2012 THE hedera'S COPYRIGHT HOLDER
# This file is distributed under the same license as the hedera package.
# Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>, 2012.
# Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: hedera 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-07-15 14:27+0200\n"
"POT-Creation-Date: 2014-09-22 15:30+0200\n"
"PO-Revision-Date: 2013-06-04 13:38+0200\n"
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
"Language-Team: Catalan\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
@ -31,88 +31,33 @@ msgstr "El parametre no pot ser nul"
msgid "Incompatible type for this param"
msgstr "Tipus incompatible per a aquest parametre"
#: ../gvn/gvn-param.c:443 ../sql/sql-value.c:255 ../vn/vn-field.c:576
#: ../gvn/gvn-param.c:285
msgid "Value"
msgstr ""
#: ../gvn/gvn-param.c:444
#: ../gvn/gvn-param.c:286
msgid "The value of the param"
msgstr ""
#: ../gvn/gvn-param.c:450
#: ../gvn/gvn-param.c:292
msgid "Master"
msgstr ""
#: ../gvn/gvn-param.c:451
msgid "The master GvnParam of this parameter"
msgstr ""
#: ../gvn/gvn-param.c:293
#, fuzzy
msgid "The master parameter"
msgstr "Nom d'usuari"
#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:1062
msgid "Mode"
msgstr ""
#: ../gvn/gvn-param.c:458
msgid "The mode of the parameter"
msgstr ""
#: ../gvn/gvn-param.c:464
msgid "Status"
msgstr "Estat"
#: ../gvn/gvn-param.c:465
msgid "The current status of the parameter"
msgstr ""
#: ../gvn/gvn-param.c:471
msgid "Spec"
msgstr ""
#: ../gvn/gvn-param.c:472
msgid "The spec of the parameter"
msgstr ""
#: ../gvn/gvn-param.c:478 ../vn/vn-field.c:604
msgid "Glib Type"
msgstr ""
#: ../gvn/gvn-param.c:479 ../vn/vn-field.c:605
msgid "The type of the value"
msgstr ""
#: ../gvn/gvn-param.c:485 ../vn/vn-field.c:611 ../vn/vn-column.c:507
msgid "Editable"
msgstr ""
#: ../gvn/gvn-param.c:486
msgid "Whether the param value can be modified"
msgstr ""
#: ../gvn/gvn-param.c:492 ../vn/vn-field.c:618 ../vn/vn-column.c:514
msgid "Null"
msgstr ""
#: ../gvn/gvn-param.c:493
msgid "Whether the param value can be of type GVN_TYPE_NULL"
msgstr ""
#: ../gvn/gvn-param.c:499 ../vn/vn-field.c:625
msgid "Default Value"
msgstr ""
#: ../gvn/gvn-param.c:500 ../vn/vn-field.c:626
msgid "The default value"
msgstr ""
#: ../gvn/gvn-value.c:431
#: ../gvn/gvn-value.c:434
#, c-format
msgid "Attempting to compare invalid types: %s\n"
msgstr "S'ha intentat comparar tipus invàlids: %s\n"
msgstr "S'ha intentat comparar tipus invà lids: %s\n"
#: ../gvn/gvn-value.c:540
#: ../gvn/gvn-value.c:543
msgid "Yes"
msgstr ""
#: ../gvn/gvn-value.c:540
#: ../gvn/gvn-value.c:543
msgid "No"
msgstr ""
@ -124,19 +69,7 @@ msgstr ""
msgid "The character used for delimite the name of fields, tables..."
msgstr ""
#: ../sql/sql-value.c:248 ../glade/glade-db-model.c:638
msgid "Param"
msgstr ""
#: ../sql/sql-value.c:249
msgid "The param which is linked"
msgstr ""
#: ../sql/sql-value.c:256
msgid "The value"
msgstr ""
#: ../sql/sql-string.c:188 ../db/db-model.c:3315 ../db/db-request.c:449
#: ../sql/sql-string.c:188 ../db/db-model.c:3337 ../db/db-request.c:449
msgid "SQL"
msgstr ""
@ -324,102 +257,89 @@ msgstr ""
msgid "One of the possible options of #SqlSelectType"
msgstr ""
#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:111
#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:113
#, c-format
msgid "Can't allocate the needed memory"
msgstr ""
#: ../db/db-iterator.c:1063
msgid "The mode in which the iterator is working"
msgstr ""
#: ../db/db-iterator.c:1070
#, fuzzy
msgid "Remember selection"
msgstr "Recordar"
#: ../db/db-iterator.c:1071
msgid "Wether to rememeber the selection when model is refreshed"
msgstr ""
#: ../db/db-model.c:3289 ../db/db-request.c:442 ../vn/vn-gui.c:1472
#: ../db/db-model.c:3311 ../db/db-request.c:442 ../vn/vn-gui.c:1408
#: ../vn/vn-form.c:245
msgid "Connection"
msgstr ""
#: ../db/db-model.c:3290
#: ../db/db-model.c:3312
msgid "The DbConn that manages the connection to the database"
msgstr ""
#: ../db/db-model.c:3297
#: ../db/db-model.c:3319
msgid "Statement"
msgstr ""
#: ../db/db-model.c:3298
#: ../db/db-model.c:3320
msgid "The statement which retrieves the data"
msgstr ""
#: ../db/db-model.c:3305
#: ../db/db-model.c:3327
msgid "Use file"
msgstr ""
#: ../db/db-model.c:3306
#: ../db/db-model.c:3328
msgid ""
"If this is set to TRUE, the \"sql\" property will hold the name of a file "
"containing a query, if set to FALSE, \"sql\" is used as an SQL string"
msgstr ""
#: ../db/db-model.c:3316
#: ../db/db-model.c:3338
msgid ""
"Depending on the \"use-file\" property this will be the path to a file with "
"queries for the model or a SQL string"
msgstr ""
#: ../db/db-model.c:3325
#: ../db/db-model.c:3347
msgid "Main Table"
msgstr ""
#: ../db/db-model.c:3326
#: ../db/db-model.c:3348
msgid "The main table of the model"
msgstr ""
#: ../db/db-model.c:3333
#: ../db/db-model.c:3355
msgid "Update flags"
msgstr ""
#: ../db/db-model.c:3334
#: ../db/db-model.c:3356
msgid "The flags that indicate how a model can be modified"
msgstr ""
#: ../db/db-model.c:3342
#: ../db/db-model.c:3364
msgid "Result position"
msgstr ""
#: ../db/db-model.c:3343
#: ../db/db-model.c:3365
msgid ""
"The position where the query that will fill the model will be placed in a "
"multi-query"
msgstr ""
#: ../db/db-model.c:3353
#: ../db/db-model.c:3375
msgid "Partial delete"
msgstr ""
#: ../db/db-model.c:3354
#: ../db/db-model.c:3376
msgid ""
"When a row is deleted set all the fields from the table to null rather than "
"delete it."
msgstr ""
#: ../db/db-model.c:3362
#: ../db/db-model.c:3384
msgid "Batch"
msgstr ""
#: ../db/db-model.c:3363
#: ../db/db-model.c:3385
msgid "The batch assigned to the model"
msgstr ""
#: ../db/db-model-holder.c:71 ../db/db-calc.c:405
#: ../db/db-model-holder.c:71 ../db/db-calc.c:480
msgid "Model"
msgstr ""
@ -427,64 +347,64 @@ msgstr ""
msgid "The model used by the holder"
msgstr ""
#: ../db/db-calc.c:406
#: ../db/db-calc.c:481
msgid "The model where the operations will be applied"
msgstr ""
#: ../db/db-calc.c:413
#: ../db/db-calc.c:487
msgid "Operation type"
msgstr ""
#: ../db/db-calc.c:414
#: ../db/db-calc.c:488
msgid "The type of the operation applied over the function"
msgstr ""
#: ../db/db-calc.c:422
#: ../db/db-calc.c:495
msgid "Function"
msgstr ""
#: ../db/db-calc.c:423
#: ../db/db-calc.c:496
msgid "The function to execute"
msgstr ""
#: ../db/db-calc.c:429
#: ../db/db-calc.c:501
msgid "Data"
msgstr ""
#: ../db/db-calc.c:430
#: ../db/db-calc.c:502
msgid "The user provided data for the function"
msgstr ""
#: ../db/db-calc.c:436 ../db/db-param.c:258 ../vn/vn-column.c:493
#: ../db/db-calc.c:507 ../db/db-param.c:335 ../vn/vn-column.c:493
msgid "Column index"
msgstr ""
#: ../db/db-calc.c:437
#: ../db/db-calc.c:508
msgid "A column to apply the operations over it"
msgstr ""
#: ../db/db-calc.c:446 ../db/db-param.c:265 ../vn/vn-field.c:597
#: ../db/db-calc.c:516 ../db/db-param.c:342 ../vn/vn-field.c:583
#: ../vn/vn-column.c:500
msgid "Column name"
msgstr "Nom de la columna"
#: ../db/db-calc.c:447
#: ../db/db-calc.c:517
msgid "A column name to apply the operations over it"
msgstr ""
#: ../db/db-param.c:251 ../vn/vn-grid.c:421 ../vn/vn-field.c:590
#: ../db/db-param.c:328 ../vn/vn-field.c:576
msgid "Iterator"
msgstr ""
#: ../db/db-param.c:252
#: ../db/db-param.c:329
msgid "The iterator owner of param"
msgstr ""
#: ../db/db-param.c:259
#: ../db/db-param.c:336
msgid "The referenced column index"
msgstr ""
#: ../db/db-param.c:266 ../vn/vn-column.c:501
#: ../db/db-param.c:343 ../vn/vn-column.c:501
msgid "The referenced column name"
msgstr "Nom de la columna referenciada"
@ -524,7 +444,7 @@ msgstr ""
msgid "The path where query files are located"
msgstr ""
#: ../db/db-conn.c:1062 ../db/db-file-loader.c:716
#: ../db/db-conn.c:1062 ../db/db-file-loader.c:719
#: ../vn/column/vn-column-image.c:498
msgid "Host"
msgstr ""
@ -533,7 +453,7 @@ msgstr ""
msgid "The host name to connect to"
msgstr ""
#: ../db/db-conn.c:1069
#: ../db/db-conn.c:1069 ../vn/gui/login.glade.h:2
msgid "User"
msgstr "Usuari"
@ -578,167 +498,163 @@ msgstr ""
msgid "The GError, if an error ocurred"
msgstr ""
#: ../db/db-file-loader.c:330
#: ../db/db-file-loader.c:333
#, c-format
msgid "%s not cached"
msgstr ""
#: ../db/db-file-loader.c:426
#: ../db/db-file-loader.c:429
#, c-format
msgid "Unknown content length of file %s"
msgstr ""
#: ../db/db-file-loader.c:717 ../vn/column/vn-column-image.c:499
#: ../db/db-file-loader.c:720 ../vn/column/vn-column-image.c:499
msgid "The host web server name to get the images"
msgstr ""
#: ../db/db-file-loader.c:724 ../vn/column/vn-column-image.c:506
#: ../db/db-file-loader.c:727 ../vn/column/vn-column-image.c:506
msgid "Path"
msgstr ""
#: ../db/db-file-loader.c:725
#: ../db/db-file-loader.c:728
msgid "The path of the directory to interact with"
msgstr ""
#: ../db/db-file-loader.c:732
#: ../db/db-file-loader.c:735
msgid "Cache directory"
msgstr ""
#: ../db/db-file-loader.c:733
#: ../db/db-file-loader.c:736
msgid ""
"The local directory where the downloaded files will be stored. The default "
"cache directory is 'hedera', under g_get_user_cache_dir()."
msgstr ""
#: ../db/db-file-loader.c:741
#: ../db/db-file-loader.c:744
msgid "Maximal cache size"
msgstr ""
#: ../db/db-file-loader.c:742
#: ../db/db-file-loader.c:745
msgid "The maximal size for the contents of the cache directory"
msgstr ""
#: ../vn/vn-gui.c:545
#: ../vn/vn-gui.c:530
msgid "Connection has been lost. Do you want to reconnect?"
msgstr ""
#: ../vn/vn-gui.c:552
#: ../vn/vn-gui.c:537
msgid "An error occurred in the connection."
msgstr ""
#: ../vn/vn-gui.c:555
#: ../vn/vn-gui.c:540
msgid "Database error"
msgstr ""
#: ../vn/vn-gui.c:562
#: ../vn/vn-gui.c:547
msgid "Unknown error"
msgstr ""
#: ../vn/vn-gui.c:910
#: ../vn/vn-gui.c:550
msgid "Colse all"
msgstr ""
#: ../vn/vn-gui.c:909
msgid "Closing connection"
msgstr ""
#: ../vn/vn-gui.c:912
#: ../vn/vn-gui.c:911
msgid "Transaction started"
msgstr ""
#: ../vn/vn-gui.c:914
#: ../vn/vn-gui.c:913
msgid "Connecting"
msgstr ""
#: ../vn/vn-gui.c:916
#: ../vn/vn-gui.c:915
msgid "Connection lost"
msgstr ""
#: ../vn/vn-gui.c:918
#: ../vn/vn-gui.c:917
msgid "Connection closed"
msgstr ""
#: ../vn/vn-gui.c:920 ../vn/field/vn-http-image.c:119
#: ../vn/vn-gui.c:919 ../vn/field/vn-http-image.c:119
msgid "Loading"
msgstr ""
#: ../vn/vn-gui.c:922
#: ../vn/vn-gui.c:921
msgid "Ready"
msgstr ""
#: ../vn/vn-gui.c:1473
#: ../vn/vn-gui.c:1409
msgid "The connection used by Gui"
msgstr ""
#: ../vn/vn-gui.c:1479
#: ../vn/vn-gui.c:1415 ../vn/vn-login.c:611
msgid "Application"
msgstr ""
#: ../vn/vn-gui.c:1480
#: ../vn/vn-gui.c:1416
msgid "The application handler for the entire program"
msgstr ""
#: ../vn/vn-grid.c:422
msgid "The iterator used by VnGrid"
msgstr ""
#: ../vn/vn-handler.c:74
msgid "Are you sure you want to delete the current selection?"
msgstr ""
#: ../vn/vn-handler.c:82
msgid "Are you sure you want to save the changes?"
msgstr ""
#: ../vn/vn-handler.c:88
#: ../vn/vn-handler.c:85
msgid "Are you sure you want to undo all changes?"
msgstr ""
#: ../vn/vn-handler.c:214
#: ../vn/vn-handler.c:213
msgid "Undo changes"
msgstr ""
#: ../vn/vn-handler.c:217
#: ../vn/vn-handler.c:216
msgid "Save changes"
msgstr ""
#: ../vn/vn-handler.c:220
#: ../vn/vn-handler.c:219
msgid "Refresh data"
msgstr ""
#: ../vn/vn-handler.c:223
#: ../vn/vn-handler.c:222
msgid "Remove record"
msgstr ""
#: ../vn/vn-handler.c:226
#: ../vn/vn-handler.c:225
msgid "Add record"
msgstr ""
#: ../vn/vn-handler.c:229
#: ../vn/vn-handler.c:228
msgid "Move to the first row"
msgstr ""
#: ../vn/vn-handler.c:232
#: ../vn/vn-handler.c:231
msgid "Move to the previous row"
msgstr ""
#: ../vn/vn-handler.c:235
#: ../vn/vn-handler.c:234
msgid "Move to the next row"
msgstr ""
#: ../vn/vn-handler.c:238
#: ../vn/vn-handler.c:237
msgid "Move to the last row"
msgstr ""
#: ../vn/vn-handler.c:531
#: ../vn/vn-handler.c:534
msgid "Show flags"
msgstr ""
#: ../vn/vn-handler.c:532
#: ../vn/vn-handler.c:535
msgid "Sets the buttons that will be shown on the interface"
msgstr ""
#: ../vn/vn-handler.c:539
#: ../vn/vn-handler.c:542
msgid "Simple record"
msgstr ""
#: ../vn/vn-handler.c:540
#: ../vn/vn-handler.c:543
msgid "Sets if it is used to handle a iterator with a single record"
msgstr ""
@ -766,100 +682,111 @@ msgstr ""
msgid "The module"
msgstr ""
#: ../vn/vn-login.c:292 ../vn/vn-login.c:294
#: ../vn/vn-login.c:396 ../vn/vn-login.c:398 ../vn/vn-login.c:490
msgid "Login error"
msgstr ""
#: ../vn/vn-login.c:350
#: ../vn/vn-login.c:456
#, c-format
msgid "Bad connection settings, please check it."
msgstr ""
#: ../vn/vn-login.c:489
msgid "Application id"
#: ../vn/vn-login.c:488
msgid "Please select a connection"
msgstr ""
#: ../vn/vn-login.c:490
msgid "The application identifier"
#: ../vn/vn-login.c:612
msgid "The application"
msgstr ""
#: ../vn/vn-field.c:577
msgid "The current value of the field"
msgstr ""
#: ../vn/vn-field.c:583 ../glade/glade-db-iterator.c:71
#: ../glade/glade-db-iterator.c:116 ../glade/glade-sql-batch.c:445
msgid "Parameter"
msgstr ""
#: ../vn/vn-field.c:584
msgid "The param where the field can read/write its value"
msgstr ""
#: ../vn/vn-field.c:591
msgid "The iterator used to get the field param"
msgstr ""
#: ../vn/vn-field.c:598
#: ../vn/vn-field.c:584
msgid "The column name on the iterator"
msgstr ""
#: ../vn/vn-field.c:612
#: ../vn/vn-field.c:590
msgid "Glib Type"
msgstr ""
#: ../vn/vn-field.c:591
msgid "The type of the value"
msgstr ""
#: ../vn/vn-field.c:597 ../vn/vn-column.c:507
msgid "Editable"
msgstr ""
#: ../vn/vn-field.c:598
msgid "Whether the field value is user editable"
msgstr ""
#: ../vn/vn-field.c:619 ../vn/vn-column.c:515
#: ../vn/vn-field.c:604 ../vn/vn-column.c:514
msgid "Null"
msgstr ""
#: ../vn/vn-field.c:605 ../vn/vn-column.c:515
msgid "Whether the field value can be of type GVN_TYPE_NULL"
msgstr ""
#: ../vn/vn-field.c:632 ../vn/vn-column.c:528
#: ../vn/vn-field.c:611
msgid "Default Value"
msgstr ""
#: ../vn/vn-field.c:612
msgid "The default value"
msgstr ""
#: ../vn/vn-field.c:618 ../vn/vn-column.c:528
msgid "Style function"
msgstr ""
#: ../vn/vn-field.c:633
#: ../vn/vn-field.c:619
msgid ""
"A VnFieldStyleFunc to set the properties of each field depending on its value"
msgstr ""
#: ../vn/field/vn-entry.c:156 ../vn/field/vn-date-chooser.c:477
#: ../vn/field/vn-label.c:115 ../vn/column/vn-column-entry.c:127
#: ../vn/field/vn-entry.c:157 ../vn/field/vn-date-chooser.c:479
#: ../vn/field/vn-label.c:116 ../vn/column/vn-column-entry.c:127
msgid "Format"
msgstr ""
#: ../vn/field/vn-entry.c:157 ../vn/field/vn-label.c:116
#: ../vn/field/vn-entry.c:158 ../vn/field/vn-label.c:117
#: ../vn/column/vn-column-entry.c:128
msgid "The format string describing the output of the entry."
msgstr ""
#: ../vn/field/vn-spin.c:171 ../vn/column/vn-column-spin.c:201
#: ../vn/field/vn-spin.c:174 ../vn/column/vn-column-spin.c:202
msgid "Digits"
msgstr ""
#: ../vn/field/vn-spin.c:172 ../vn/column/vn-column-spin.c:202
#: ../vn/field/vn-spin.c:175 ../vn/column/vn-column-spin.c:203
msgid "The number of decimal places to display."
msgstr ""
#: ../vn/field/vn-combo.c:286 ../vn/column/vn-column-combo.c:340
#: ../vn/field/vn-combo.c:298 ../vn/column/vn-column-combo.c:340
msgid "Index column"
msgstr ""
#: ../vn/field/vn-combo.c:287 ../vn/column/vn-column-combo.c:341
#: ../vn/field/vn-combo.c:299 ../vn/column/vn-column-combo.c:341
msgid "The column index of the model"
msgstr ""
#: ../vn/field/vn-combo.c:293 ../vn/column/vn-column-combo.c:347
#: ../vn/field/vn-combo.c:305 ../vn/column/vn-column-combo.c:347
msgid "Show column"
msgstr ""
#: ../vn/field/vn-combo.c:294 ../vn/column/vn-column-combo.c:348
#: ../vn/field/vn-combo.c:306 ../vn/column/vn-column-combo.c:348
msgid "The column of the model shown by combo"
msgstr ""
#: ../vn/field/vn-completion.c:332
#: ../vn/field/vn-completion.c:334
msgid "Field"
msgstr ""
#: ../vn/field/vn-completion.c:333
#: ../vn/field/vn-completion.c:335
msgid "The name of the field used for the search"
msgstr ""
@ -867,30 +794,30 @@ msgstr ""
msgid "Change date"
msgstr ""
#: ../vn/field/vn-date-chooser.c:478
#: ../vn/field/vn-date-chooser.c:480
msgid "The date format string describing the order of the elements."
msgstr ""
#: ../vn/field/vn-date-chooser.c:479
#: ../vn/field/vn-date-chooser.c:481
msgctxt "Default date format string"
msgid "%a, %d %b %Y"
msgstr ""
#: ../vn/field/vn-date-chooser.c:485
#: ../vn/field/vn-date-chooser.c:487
msgid "Show time"
msgstr ""
#: ../vn/field/vn-date-chooser.c:486
#: ../vn/field/vn-date-chooser.c:488
msgid ""
"Whether to show the hour, minute and second fields to set the time of the "
"day in the popup."
msgstr ""
#: ../vn/field/vn-date-chooser.c:494
#: ../vn/field/vn-date-chooser.c:496
msgid "Show date"
msgstr ""
#: ../vn/field/vn-date-chooser.c:495
#: ../vn/field/vn-date-chooser.c:497
msgid "Whether to show the calendar to set the date in the popup."
msgstr ""
@ -907,32 +834,32 @@ msgid "File loader already set"
msgstr ""
#. Se usará para subir imagenes y cambiar nombres, o abrir un menu contextual
#. g_signal_connect (obj, "event", G_CALLBACK (vn_http_image_cb_event), obj);
#. g_signal_connect (self, "event", G_CALLBACK (vn_http_image_on_event), self);
#: ../vn/field/vn-http-image.c:184
msgid "No image set"
msgstr ""
#: ../vn/field/vn-http-image.c:211 ../vn/column/vn-column-image.c:536
#: ../vn/field/vn-http-image.c:212 ../vn/column/vn-column-image.c:536
msgid "File loader"
msgstr ""
#: ../vn/field/vn-http-image.c:212
#: ../vn/field/vn-http-image.c:213
msgid "A DbFileLoader, used to download the files"
msgstr ""
#: ../vn/field/vn-http-image.c:219
#: ../vn/field/vn-http-image.c:220
msgid "File path"
msgstr ""
#: ../vn/field/vn-http-image.c:220
#: ../vn/field/vn-http-image.c:221
msgid "The relative path to the image from file loader path"
msgstr ""
#: ../vn/field/vn-http-image.c:227
#: ../vn/field/vn-http-image.c:228
msgid "Image bytes"
msgstr ""
#: ../vn/field/vn-http-image.c:228
#: ../vn/field/vn-http-image.c:229
msgid "A GBytes structure with the image data"
msgstr ""
@ -996,19 +923,17 @@ msgstr ""
#: ../vn/gui/login.glade.h:1
#, fuzzy
msgid "Access"
msgstr "Accés"
#: ../vn/gui/login.glade.h:2
msgid "User:"
msgstr "Usuari:"
msgstr "Accés"
#: ../vn/gui/login.glade.h:3
msgid "Password:"
#, fuzzy
msgid "Show password"
msgstr "Contrasenya:"
#: ../vn/gui/login.glade.h:4
msgid "Press here to see the password"
msgstr ""
#, fuzzy
msgid "Password"
msgstr "Contrasenya:"
#: ../vn/gui/login.glade.h:5
msgid "Remember"
@ -1019,11 +944,11 @@ msgid "Configuration"
msgstr ""
#: ../vn/gui/login.glade.h:7
msgid "Plugin:"
msgid "Connections"
msgstr ""
#: ../vn/gui/login.glade.h:8
msgid "Host:"
msgid "SSL CA:"
msgstr ""
#: ../vn/gui/login.glade.h:9
@ -1031,15 +956,27 @@ msgid "Schema:"
msgstr ""
#: ../vn/gui/login.glade.h:10
msgid "SSL CA:"
msgid "Host:"
msgstr ""
#: ../vn/gui/login.glade.h:11
msgid "Plugin:"
msgstr ""
#: ../vn/gui/login.glade.h:12
msgid ""
"Path to the file containing the CA certificate, if this is empty SSL won't "
"be used"
msgstr ""
#: ../vn/gui/login.glade.h:13
msgid "Name:"
msgstr ""
#: ../vn/gui/login.glade.h:14
msgid "User:"
msgstr "Usuari:"
#: ../vn/gui/main.glade.h:1
msgid "Copyright - Verdnatura Levante S. L."
msgstr "Copyright - Verdnatura Levante S. L."
@ -1152,6 +1089,10 @@ msgstr ""
msgid "Column"
msgstr ""
#: ../glade/glade-db-model.c:638
msgid "Param"
msgstr ""
#: ../glade/glade-db-model.c:646
msgctxt "Verb"
msgid "Link"
@ -1181,33 +1122,38 @@ msgstr ""
msgid "Edit Model"
msgstr ""
#: ../glade/glade-db-iterator.c:73
msgid "Properties"
msgstr ""
#: ../glade/glade-db-iterator.c:124
msgid "Iterator Editor"
msgstr ""
#: ../glade/glade-db-iterator.c:132
#: ../glade/glade-db-iterator.c:99
msgid "The model must have \"SQL\" set and \"Use file\" set to 'No'."
msgstr ""
#: ../glade/glade-db-iterator.c:144
#: ../glade/glade-db-iterator.c:111
#, c-format
msgid "%s can't have children before automatic generation."
msgstr ""
#: ../glade/glade-db-iterator.c:155
#: ../glade/glade-db-iterator.c:121
#, c-format
msgid "%s must have \"Model\" set. %s"
msgstr ""
#: ../glade/glade-db-iterator.c:180
#: ../glade/glade-db-iterator.c:147
#, c-format
msgid "Automatic generation of params for %s"
msgstr ""
#: ../glade/glade-db-iterator.c:198 ../glade/glade-db-iterator.c:220
#: ../glade/glade-sql-batch.c:445
msgid "Parameter"
msgstr ""
#: ../glade/glade-db-iterator.c:200
msgid "Properties"
msgstr ""
#: ../glade/glade-db-iterator.c:228
msgid "Iterator Editor"
msgstr ""
#: ../glade/glade-sql-batch.c:79
msgid "List of items"
msgstr ""
@ -1234,6 +1180,13 @@ msgstr ""
#: ../module/data/example.xml.h:5
msgid ""
"\n"
"\t\t\tShelfs\n"
"\t\t"
msgstr ""
#: ../module/data/example.xml.h:8
msgid ""
"\n"
"\t\t\tCustomer\n"
"\t\t"
msgstr ""
@ -1243,6 +1196,10 @@ msgid "Consulter"
msgstr ""
#: ../module/data/example-menu.xml.h:2
msgid "Shelfs"
msgstr ""
#: ../module/data/example-menu.xml.h:3
msgid "Customer"
msgstr ""
@ -1282,6 +1239,13 @@ msgstr ""
msgid "Immediate changes"
msgstr ""
#~ msgid "Status"
#~ msgstr "Estat"
#, fuzzy
#~ msgid "Remember selection"
#~ msgstr "Recordar"
#~ msgid "Hedera"
#~ msgstr "Hedera"
@ -1290,8 +1254,8 @@ msgstr ""
#, fuzzy
#~ msgid "Function vn_grid_model_set_sort_func not implemented"
#~ msgstr "Funció vn_model_set_sort_func no implementada"
#~ msgstr "Funció vn_model_set_sort_func no implementada"
#, fuzzy
#~ msgid "Function vn_grid_model_set_default_sort_func not implemented"
#~ msgstr "Funció vn_model_set_default_sort_func no implementada"
#~ msgstr "Funció vn_model_set_default_sort_func no implementada"

638
po/es.po

File diff suppressed because it is too large Load Diff

441
po/nl.po
View File

@ -1,16 +1,16 @@
# Dutch translations for hedera package
# Traducciones al español para el paquete hedera.
# Traducciones al español para el paquete hedera.
# Copyright (C) 2012 THE hedera'S COPYRIGHT HOLDER
# This file is distributed under the same license as the hedera package.
# Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>, 2012.
# Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: hedera 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-07-15 14:27+0200\n"
"POT-Creation-Date: 2014-09-22 15:30+0200\n"
"PO-Revision-Date: 2012-10-09 11:38+0200\n"
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
"Language-Team: Dutch\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
@ -33,88 +33,32 @@ msgstr ""
msgid "Incompatible type for this param"
msgstr ""
#: ../gvn/gvn-param.c:443 ../sql/sql-value.c:255 ../vn/vn-field.c:576
#: ../gvn/gvn-param.c:285
msgid "Value"
msgstr ""
#: ../gvn/gvn-param.c:444
#: ../gvn/gvn-param.c:286
msgid "The value of the param"
msgstr ""
#: ../gvn/gvn-param.c:450
#: ../gvn/gvn-param.c:292
msgid "Master"
msgstr ""
#: ../gvn/gvn-param.c:451
msgid "The master GvnParam of this parameter"
#: ../gvn/gvn-param.c:293
msgid "The master parameter"
msgstr ""
#: ../gvn/gvn-param.c:457 ../db/db-iterator.c:1062
msgid "Mode"
msgstr ""
#: ../gvn/gvn-param.c:458
msgid "The mode of the parameter"
msgstr ""
#: ../gvn/gvn-param.c:464
msgid "Status"
msgstr ""
#: ../gvn/gvn-param.c:465
msgid "The current status of the parameter"
msgstr ""
#: ../gvn/gvn-param.c:471
msgid "Spec"
msgstr ""
#: ../gvn/gvn-param.c:472
msgid "The spec of the parameter"
msgstr ""
#: ../gvn/gvn-param.c:478 ../vn/vn-field.c:604
msgid "Glib Type"
msgstr ""
#: ../gvn/gvn-param.c:479 ../vn/vn-field.c:605
msgid "The type of the value"
msgstr ""
#: ../gvn/gvn-param.c:485 ../vn/vn-field.c:611 ../vn/vn-column.c:507
msgid "Editable"
msgstr ""
#: ../gvn/gvn-param.c:486
msgid "Whether the param value can be modified"
msgstr ""
#: ../gvn/gvn-param.c:492 ../vn/vn-field.c:618 ../vn/vn-column.c:514
msgid "Null"
msgstr ""
#: ../gvn/gvn-param.c:493
msgid "Whether the param value can be of type GVN_TYPE_NULL"
msgstr ""
#: ../gvn/gvn-param.c:499 ../vn/vn-field.c:625
msgid "Default Value"
msgstr ""
#: ../gvn/gvn-param.c:500 ../vn/vn-field.c:626
msgid "The default value"
msgstr ""
#: ../gvn/gvn-value.c:431
#: ../gvn/gvn-value.c:434
#, c-format
msgid "Attempting to compare invalid types: %s\n"
msgstr ""
#: ../gvn/gvn-value.c:540
#: ../gvn/gvn-value.c:543
msgid "Yes"
msgstr ""
#: ../gvn/gvn-value.c:540
#: ../gvn/gvn-value.c:543
msgid "No"
msgstr ""
@ -126,19 +70,7 @@ msgstr ""
msgid "The character used for delimite the name of fields, tables..."
msgstr ""
#: ../sql/sql-value.c:248 ../glade/glade-db-model.c:638
msgid "Param"
msgstr ""
#: ../sql/sql-value.c:249
msgid "The param which is linked"
msgstr ""
#: ../sql/sql-value.c:256
msgid "The value"
msgstr ""
#: ../sql/sql-string.c:188 ../db/db-model.c:3315 ../db/db-request.c:449
#: ../sql/sql-string.c:188 ../db/db-model.c:3337 ../db/db-request.c:449
msgid "SQL"
msgstr ""
@ -322,101 +254,89 @@ msgstr ""
msgid "One of the possible options of #SqlSelectType"
msgstr ""
#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:111
#: ../plugin/mysql/db-mysql.c:68 ../plugin/pg/db-pg.c:113
#, c-format
msgid "Can't allocate the needed memory"
msgstr ""
#: ../db/db-iterator.c:1063
msgid "The mode in which the iterator is working"
msgstr ""
#: ../db/db-iterator.c:1070
msgid "Remember selection"
msgstr ""
#: ../db/db-iterator.c:1071
msgid "Wether to rememeber the selection when model is refreshed"
msgstr ""
#: ../db/db-model.c:3289 ../db/db-request.c:442 ../vn/vn-gui.c:1472
#: ../db/db-model.c:3311 ../db/db-request.c:442 ../vn/vn-gui.c:1408
#: ../vn/vn-form.c:245
msgid "Connection"
msgstr ""
#: ../db/db-model.c:3290
#: ../db/db-model.c:3312
msgid "The DbConn that manages the connection to the database"
msgstr ""
#: ../db/db-model.c:3297
#: ../db/db-model.c:3319
msgid "Statement"
msgstr ""
#: ../db/db-model.c:3298
#: ../db/db-model.c:3320
msgid "The statement which retrieves the data"
msgstr ""
#: ../db/db-model.c:3305
#: ../db/db-model.c:3327
msgid "Use file"
msgstr ""
#: ../db/db-model.c:3306
#: ../db/db-model.c:3328
msgid ""
"If this is set to TRUE, the \"sql\" property will hold the name of a file "
"containing a query, if set to FALSE, \"sql\" is used as an SQL string"
msgstr ""
#: ../db/db-model.c:3316
#: ../db/db-model.c:3338
msgid ""
"Depending on the \"use-file\" property this will be the path to a file with "
"queries for the model or a SQL string"
msgstr ""
#: ../db/db-model.c:3325
#: ../db/db-model.c:3347
msgid "Main Table"
msgstr ""
#: ../db/db-model.c:3326
#: ../db/db-model.c:3348
msgid "The main table of the model"
msgstr ""
#: ../db/db-model.c:3333
#: ../db/db-model.c:3355
msgid "Update flags"
msgstr ""
#: ../db/db-model.c:3334
#: ../db/db-model.c:3356
msgid "The flags that indicate how a model can be modified"
msgstr ""
#: ../db/db-model.c:3342
#: ../db/db-model.c:3364
msgid "Result position"
msgstr ""
#: ../db/db-model.c:3343
#: ../db/db-model.c:3365
msgid ""
"The position where the query that will fill the model will be placed in a "
"multi-query"
msgstr ""
#: ../db/db-model.c:3353
#: ../db/db-model.c:3375
msgid "Partial delete"
msgstr ""
#: ../db/db-model.c:3354
#: ../db/db-model.c:3376
msgid ""
"When a row is deleted set all the fields from the table to null rather than "
"delete it."
msgstr ""
#: ../db/db-model.c:3362
#: ../db/db-model.c:3384
msgid "Batch"
msgstr ""
#: ../db/db-model.c:3363
#: ../db/db-model.c:3385
msgid "The batch assigned to the model"
msgstr ""
#: ../db/db-model-holder.c:71 ../db/db-calc.c:405
#: ../db/db-model-holder.c:71 ../db/db-calc.c:480
msgid "Model"
msgstr ""
@ -424,64 +344,64 @@ msgstr ""
msgid "The model used by the holder"
msgstr ""
#: ../db/db-calc.c:406
#: ../db/db-calc.c:481
msgid "The model where the operations will be applied"
msgstr ""
#: ../db/db-calc.c:413
#: ../db/db-calc.c:487
msgid "Operation type"
msgstr ""
#: ../db/db-calc.c:414
#: ../db/db-calc.c:488
msgid "The type of the operation applied over the function"
msgstr ""
#: ../db/db-calc.c:422
#: ../db/db-calc.c:495
msgid "Function"
msgstr ""
#: ../db/db-calc.c:423
#: ../db/db-calc.c:496
msgid "The function to execute"
msgstr ""
#: ../db/db-calc.c:429
#: ../db/db-calc.c:501
msgid "Data"
msgstr ""
#: ../db/db-calc.c:430
#: ../db/db-calc.c:502
msgid "The user provided data for the function"
msgstr ""
#: ../db/db-calc.c:436 ../db/db-param.c:258 ../vn/vn-column.c:493
#: ../db/db-calc.c:507 ../db/db-param.c:335 ../vn/vn-column.c:493
msgid "Column index"
msgstr ""
#: ../db/db-calc.c:437
#: ../db/db-calc.c:508
msgid "A column to apply the operations over it"
msgstr ""
#: ../db/db-calc.c:446 ../db/db-param.c:265 ../vn/vn-field.c:597
#: ../db/db-calc.c:516 ../db/db-param.c:342 ../vn/vn-field.c:583
#: ../vn/vn-column.c:500
msgid "Column name"
msgstr ""
#: ../db/db-calc.c:447
#: ../db/db-calc.c:517
msgid "A column name to apply the operations over it"
msgstr ""
#: ../db/db-param.c:251 ../vn/vn-grid.c:421 ../vn/vn-field.c:590
#: ../db/db-param.c:328 ../vn/vn-field.c:576
msgid "Iterator"
msgstr ""
#: ../db/db-param.c:252
#: ../db/db-param.c:329
msgid "The iterator owner of param"
msgstr ""
#: ../db/db-param.c:259
#: ../db/db-param.c:336
msgid "The referenced column index"
msgstr ""
#: ../db/db-param.c:266 ../vn/vn-column.c:501
#: ../db/db-param.c:343 ../vn/vn-column.c:501
msgid "The referenced column name"
msgstr ""
@ -521,7 +441,7 @@ msgstr ""
msgid "The path where query files are located"
msgstr ""
#: ../db/db-conn.c:1062 ../db/db-file-loader.c:716
#: ../db/db-conn.c:1062 ../db/db-file-loader.c:719
#: ../vn/column/vn-column-image.c:498
msgid "Host"
msgstr ""
@ -530,7 +450,7 @@ msgstr ""
msgid "The host name to connect to"
msgstr ""
#: ../db/db-conn.c:1069
#: ../db/db-conn.c:1069 ../vn/gui/login.glade.h:2
msgid "User"
msgstr ""
@ -575,167 +495,163 @@ msgstr ""
msgid "The GError, if an error ocurred"
msgstr ""
#: ../db/db-file-loader.c:330
#: ../db/db-file-loader.c:333
#, c-format
msgid "%s not cached"
msgstr ""
#: ../db/db-file-loader.c:426
#: ../db/db-file-loader.c:429
#, c-format
msgid "Unknown content length of file %s"
msgstr ""
#: ../db/db-file-loader.c:717 ../vn/column/vn-column-image.c:499
#: ../db/db-file-loader.c:720 ../vn/column/vn-column-image.c:499
msgid "The host web server name to get the images"
msgstr ""
#: ../db/db-file-loader.c:724 ../vn/column/vn-column-image.c:506
#: ../db/db-file-loader.c:727 ../vn/column/vn-column-image.c:506
msgid "Path"
msgstr ""
#: ../db/db-file-loader.c:725
#: ../db/db-file-loader.c:728
msgid "The path of the directory to interact with"
msgstr ""
#: ../db/db-file-loader.c:732
#: ../db/db-file-loader.c:735
msgid "Cache directory"
msgstr ""
#: ../db/db-file-loader.c:733
#: ../db/db-file-loader.c:736
msgid ""
"The local directory where the downloaded files will be stored. The default "
"cache directory is 'hedera', under g_get_user_cache_dir()."
msgstr ""
#: ../db/db-file-loader.c:741
#: ../db/db-file-loader.c:744
msgid "Maximal cache size"
msgstr ""
#: ../db/db-file-loader.c:742
#: ../db/db-file-loader.c:745
msgid "The maximal size for the contents of the cache directory"
msgstr ""
#: ../vn/vn-gui.c:545
#: ../vn/vn-gui.c:530
msgid "Connection has been lost. Do you want to reconnect?"
msgstr ""
#: ../vn/vn-gui.c:552
#: ../vn/vn-gui.c:537
msgid "An error occurred in the connection."
msgstr ""
#: ../vn/vn-gui.c:555
#: ../vn/vn-gui.c:540
msgid "Database error"
msgstr ""
#: ../vn/vn-gui.c:562
#: ../vn/vn-gui.c:547
msgid "Unknown error"
msgstr ""
#: ../vn/vn-gui.c:910
#: ../vn/vn-gui.c:550
msgid "Colse all"
msgstr ""
#: ../vn/vn-gui.c:909
msgid "Closing connection"
msgstr ""
#: ../vn/vn-gui.c:912
#: ../vn/vn-gui.c:911
msgid "Transaction started"
msgstr ""
#: ../vn/vn-gui.c:914
#: ../vn/vn-gui.c:913
msgid "Connecting"
msgstr ""
#: ../vn/vn-gui.c:916
#: ../vn/vn-gui.c:915
msgid "Connection lost"
msgstr ""
#: ../vn/vn-gui.c:918
#: ../vn/vn-gui.c:917
msgid "Connection closed"
msgstr ""
#: ../vn/vn-gui.c:920 ../vn/field/vn-http-image.c:119
#: ../vn/vn-gui.c:919 ../vn/field/vn-http-image.c:119
msgid "Loading"
msgstr ""
#: ../vn/vn-gui.c:922
#: ../vn/vn-gui.c:921
msgid "Ready"
msgstr ""
#: ../vn/vn-gui.c:1473
#: ../vn/vn-gui.c:1409
msgid "The connection used by Gui"
msgstr ""
#: ../vn/vn-gui.c:1479
#: ../vn/vn-gui.c:1415 ../vn/vn-login.c:611
msgid "Application"
msgstr ""
#: ../vn/vn-gui.c:1480
#: ../vn/vn-gui.c:1416
msgid "The application handler for the entire program"
msgstr ""
#: ../vn/vn-grid.c:422
msgid "The iterator used by VnGrid"
msgstr ""
#: ../vn/vn-handler.c:74
msgid "Are you sure you want to delete the current selection?"
msgstr ""
#: ../vn/vn-handler.c:82
msgid "Are you sure you want to save the changes?"
msgstr ""
#: ../vn/vn-handler.c:88
#: ../vn/vn-handler.c:85
msgid "Are you sure you want to undo all changes?"
msgstr ""
#: ../vn/vn-handler.c:214
#: ../vn/vn-handler.c:213
msgid "Undo changes"
msgstr ""
#: ../vn/vn-handler.c:217
#: ../vn/vn-handler.c:216
msgid "Save changes"
msgstr ""
#: ../vn/vn-handler.c:220
#: ../vn/vn-handler.c:219
msgid "Refresh data"
msgstr ""
#: ../vn/vn-handler.c:223
#: ../vn/vn-handler.c:222
msgid "Remove record"
msgstr ""
#: ../vn/vn-handler.c:226
#: ../vn/vn-handler.c:225
msgid "Add record"
msgstr ""
#: ../vn/vn-handler.c:229
#: ../vn/vn-handler.c:228
msgid "Move to the first row"
msgstr ""
#: ../vn/vn-handler.c:232
#: ../vn/vn-handler.c:231
msgid "Move to the previous row"
msgstr ""
#: ../vn/vn-handler.c:235
#: ../vn/vn-handler.c:234
msgid "Move to the next row"
msgstr ""
#: ../vn/vn-handler.c:238
#: ../vn/vn-handler.c:237
msgid "Move to the last row"
msgstr ""
#: ../vn/vn-handler.c:531
#: ../vn/vn-handler.c:534
msgid "Show flags"
msgstr ""
#: ../vn/vn-handler.c:532
#: ../vn/vn-handler.c:535
msgid "Sets the buttons that will be shown on the interface"
msgstr ""
#: ../vn/vn-handler.c:539
#: ../vn/vn-handler.c:542
msgid "Simple record"
msgstr ""
#: ../vn/vn-handler.c:540
#: ../vn/vn-handler.c:543
msgid "Sets if it is used to handle a iterator with a single record"
msgstr ""
@ -763,100 +679,111 @@ msgstr ""
msgid "The module"
msgstr ""
#: ../vn/vn-login.c:292 ../vn/vn-login.c:294
#: ../vn/vn-login.c:396 ../vn/vn-login.c:398 ../vn/vn-login.c:490
msgid "Login error"
msgstr ""
#: ../vn/vn-login.c:350
#: ../vn/vn-login.c:456
#, c-format
msgid "Bad connection settings, please check it."
msgstr ""
#: ../vn/vn-login.c:489
msgid "Application id"
#: ../vn/vn-login.c:488
msgid "Please select a connection"
msgstr ""
#: ../vn/vn-login.c:490
msgid "The application identifier"
#: ../vn/vn-login.c:612
msgid "The application"
msgstr ""
#: ../vn/vn-field.c:577
msgid "The current value of the field"
msgstr ""
#: ../vn/vn-field.c:583 ../glade/glade-db-iterator.c:71
#: ../glade/glade-db-iterator.c:116 ../glade/glade-sql-batch.c:445
msgid "Parameter"
msgstr ""
#: ../vn/vn-field.c:584
msgid "The param where the field can read/write its value"
msgstr ""
#: ../vn/vn-field.c:591
msgid "The iterator used to get the field param"
msgstr ""
#: ../vn/vn-field.c:598
#: ../vn/vn-field.c:584
msgid "The column name on the iterator"
msgstr ""
#: ../vn/vn-field.c:612
#: ../vn/vn-field.c:590
msgid "Glib Type"
msgstr ""
#: ../vn/vn-field.c:591
msgid "The type of the value"
msgstr ""
#: ../vn/vn-field.c:597 ../vn/vn-column.c:507
msgid "Editable"
msgstr ""
#: ../vn/vn-field.c:598
msgid "Whether the field value is user editable"
msgstr ""
#: ../vn/vn-field.c:619 ../vn/vn-column.c:515
#: ../vn/vn-field.c:604 ../vn/vn-column.c:514
msgid "Null"
msgstr ""
#: ../vn/vn-field.c:605 ../vn/vn-column.c:515
msgid "Whether the field value can be of type GVN_TYPE_NULL"
msgstr ""
#: ../vn/vn-field.c:632 ../vn/vn-column.c:528
#: ../vn/vn-field.c:611
msgid "Default Value"
msgstr ""
#: ../vn/vn-field.c:612
msgid "The default value"
msgstr ""
#: ../vn/vn-field.c:618 ../vn/vn-column.c:528
msgid "Style function"
msgstr ""
#: ../vn/vn-field.c:633
#: ../vn/vn-field.c:619
msgid ""
"A VnFieldStyleFunc to set the properties of each field depending on its value"
msgstr ""
#: ../vn/field/vn-entry.c:156 ../vn/field/vn-date-chooser.c:477
#: ../vn/field/vn-label.c:115 ../vn/column/vn-column-entry.c:127
#: ../vn/field/vn-entry.c:157 ../vn/field/vn-date-chooser.c:479
#: ../vn/field/vn-label.c:116 ../vn/column/vn-column-entry.c:127
msgid "Format"
msgstr ""
#: ../vn/field/vn-entry.c:157 ../vn/field/vn-label.c:116
#: ../vn/field/vn-entry.c:158 ../vn/field/vn-label.c:117
#: ../vn/column/vn-column-entry.c:128
msgid "The format string describing the output of the entry."
msgstr ""
#: ../vn/field/vn-spin.c:171 ../vn/column/vn-column-spin.c:201
#: ../vn/field/vn-spin.c:174 ../vn/column/vn-column-spin.c:202
msgid "Digits"
msgstr ""
#: ../vn/field/vn-spin.c:172 ../vn/column/vn-column-spin.c:202
#: ../vn/field/vn-spin.c:175 ../vn/column/vn-column-spin.c:203
msgid "The number of decimal places to display."
msgstr ""
#: ../vn/field/vn-combo.c:286 ../vn/column/vn-column-combo.c:340
#: ../vn/field/vn-combo.c:298 ../vn/column/vn-column-combo.c:340
msgid "Index column"
msgstr ""
#: ../vn/field/vn-combo.c:287 ../vn/column/vn-column-combo.c:341
#: ../vn/field/vn-combo.c:299 ../vn/column/vn-column-combo.c:341
msgid "The column index of the model"
msgstr ""
#: ../vn/field/vn-combo.c:293 ../vn/column/vn-column-combo.c:347
#: ../vn/field/vn-combo.c:305 ../vn/column/vn-column-combo.c:347
msgid "Show column"
msgstr ""
#: ../vn/field/vn-combo.c:294 ../vn/column/vn-column-combo.c:348
#: ../vn/field/vn-combo.c:306 ../vn/column/vn-column-combo.c:348
msgid "The column of the model shown by combo"
msgstr ""
#: ../vn/field/vn-completion.c:332
#: ../vn/field/vn-completion.c:334
msgid "Field"
msgstr ""
#: ../vn/field/vn-completion.c:333
#: ../vn/field/vn-completion.c:335
msgid "The name of the field used for the search"
msgstr ""
@ -864,30 +791,30 @@ msgstr ""
msgid "Change date"
msgstr ""
#: ../vn/field/vn-date-chooser.c:478
#: ../vn/field/vn-date-chooser.c:480
msgid "The date format string describing the order of the elements."
msgstr ""
#: ../vn/field/vn-date-chooser.c:479
#: ../vn/field/vn-date-chooser.c:481
msgctxt "Default date format string"
msgid "%a, %d %b %Y"
msgstr ""
#: ../vn/field/vn-date-chooser.c:485
#: ../vn/field/vn-date-chooser.c:487
msgid "Show time"
msgstr ""
#: ../vn/field/vn-date-chooser.c:486
#: ../vn/field/vn-date-chooser.c:488
msgid ""
"Whether to show the hour, minute and second fields to set the time of the "
"day in the popup."
msgstr ""
#: ../vn/field/vn-date-chooser.c:494
#: ../vn/field/vn-date-chooser.c:496
msgid "Show date"
msgstr ""
#: ../vn/field/vn-date-chooser.c:495
#: ../vn/field/vn-date-chooser.c:497
msgid "Whether to show the calendar to set the date in the popup."
msgstr ""
@ -904,32 +831,32 @@ msgid "File loader already set"
msgstr ""
#. Se usará para subir imagenes y cambiar nombres, o abrir un menu contextual
#. g_signal_connect (obj, "event", G_CALLBACK (vn_http_image_cb_event), obj);
#. g_signal_connect (self, "event", G_CALLBACK (vn_http_image_on_event), self);
#: ../vn/field/vn-http-image.c:184
msgid "No image set"
msgstr ""
#: ../vn/field/vn-http-image.c:211 ../vn/column/vn-column-image.c:536
#: ../vn/field/vn-http-image.c:212 ../vn/column/vn-column-image.c:536
msgid "File loader"
msgstr ""
#: ../vn/field/vn-http-image.c:212
#: ../vn/field/vn-http-image.c:213
msgid "A DbFileLoader, used to download the files"
msgstr ""
#: ../vn/field/vn-http-image.c:219
#: ../vn/field/vn-http-image.c:220
msgid "File path"
msgstr ""
#: ../vn/field/vn-http-image.c:220
#: ../vn/field/vn-http-image.c:221
msgid "The relative path to the image from file loader path"
msgstr ""
#: ../vn/field/vn-http-image.c:227
#: ../vn/field/vn-http-image.c:228
msgid "Image bytes"
msgstr ""
#: ../vn/field/vn-http-image.c:228
#: ../vn/field/vn-http-image.c:229
msgid "A GBytes structure with the image data"
msgstr ""
@ -994,16 +921,12 @@ msgstr ""
msgid "Access"
msgstr ""
#: ../vn/gui/login.glade.h:2
msgid "User:"
msgstr ""
#: ../vn/gui/login.glade.h:3
msgid "Password:"
msgid "Show password"
msgstr ""
#: ../vn/gui/login.glade.h:4
msgid "Press here to see the password"
msgid "Password"
msgstr ""
#: ../vn/gui/login.glade.h:5
@ -1015,11 +938,11 @@ msgid "Configuration"
msgstr ""
#: ../vn/gui/login.glade.h:7
msgid "Plugin:"
msgid "Connections"
msgstr ""
#: ../vn/gui/login.glade.h:8
msgid "Host:"
msgid "SSL CA:"
msgstr ""
#: ../vn/gui/login.glade.h:9
@ -1027,15 +950,27 @@ msgid "Schema:"
msgstr ""
#: ../vn/gui/login.glade.h:10
msgid "SSL CA:"
msgid "Host:"
msgstr ""
#: ../vn/gui/login.glade.h:11
msgid "Plugin:"
msgstr ""
#: ../vn/gui/login.glade.h:12
msgid ""
"Path to the file containing the CA certificate, if this is empty SSL won't "
"be used"
msgstr ""
#: ../vn/gui/login.glade.h:13
msgid "Name:"
msgstr ""
#: ../vn/gui/login.glade.h:14
msgid "User:"
msgstr ""
#: ../vn/gui/main.glade.h:1
msgid "Copyright - Verdnatura Levante S. L."
msgstr ""
@ -1148,6 +1083,10 @@ msgstr ""
msgid "Column"
msgstr ""
#: ../glade/glade-db-model.c:638
msgid "Param"
msgstr ""
#: ../glade/glade-db-model.c:646
msgctxt "Verb"
msgid "Link"
@ -1177,33 +1116,38 @@ msgstr ""
msgid "Edit Model"
msgstr ""
#: ../glade/glade-db-iterator.c:73
msgid "Properties"
msgstr ""
#: ../glade/glade-db-iterator.c:124
msgid "Iterator Editor"
msgstr ""
#: ../glade/glade-db-iterator.c:132
#: ../glade/glade-db-iterator.c:99
msgid "The model must have \"SQL\" set and \"Use file\" set to 'No'."
msgstr ""
#: ../glade/glade-db-iterator.c:144
#: ../glade/glade-db-iterator.c:111
#, c-format
msgid "%s can't have children before automatic generation."
msgstr ""
#: ../glade/glade-db-iterator.c:155
#: ../glade/glade-db-iterator.c:121
#, c-format
msgid "%s must have \"Model\" set. %s"
msgstr ""
#: ../glade/glade-db-iterator.c:180
#: ../glade/glade-db-iterator.c:147
#, c-format
msgid "Automatic generation of params for %s"
msgstr ""
#: ../glade/glade-db-iterator.c:198 ../glade/glade-db-iterator.c:220
#: ../glade/glade-sql-batch.c:445
msgid "Parameter"
msgstr ""
#: ../glade/glade-db-iterator.c:200
msgid "Properties"
msgstr ""
#: ../glade/glade-db-iterator.c:228
msgid "Iterator Editor"
msgstr ""
#: ../glade/glade-sql-batch.c:79
msgid "List of items"
msgstr ""
@ -1230,6 +1174,13 @@ msgstr ""
#: ../module/data/example.xml.h:5
msgid ""
"\n"
"\t\t\tShelfs\n"
"\t\t"
msgstr ""
#: ../module/data/example.xml.h:8
msgid ""
"\n"
"\t\t\tCustomer\n"
"\t\t"
msgstr ""
@ -1239,6 +1190,10 @@ msgid "Consulter"
msgstr ""
#: ../module/data/example-menu.xml.h:2
msgid "Shelfs"
msgstr ""
#: ../module/data/example-menu.xml.h:3
msgid "Customer"
msgstr ""

View File

@ -30,6 +30,10 @@
typedef struct _SqlJoin SqlJoin;
typedef struct _SqlJoinClass SqlJoinClass;
/**
* SqlJoinType:
* All the JOIN types possible for a #SqlJoin.
**/
typedef enum
{
SQL_JOIN_TYPE_INNER

View File

@ -29,6 +29,10 @@
typedef struct _SqlOperation SqlOperation;
typedef struct _SqlOperationClass SqlOperationClass;
/**
* SqlOperationType:
* All the operation types possible for a #SqlOperation.
**/
typedef enum
{
// Unary

View File

@ -133,7 +133,7 @@ static void sql_value_render (SqlValue * self, SqlRender * render)
switch (type)
{
case G_TYPE_BOOLEAN:
sql_render_add_token (render, g_value_get_boolean (value) ? "1" : "0");
sql_render_add_token (render, g_value_get_boolean (value) ? "TRUE" : "FALSE");
break;
case G_TYPE_CHAR:
sql_render_printf (render, "'%c'", g_value_get_schar (value));

View File

@ -4,8 +4,6 @@ Calc.function#property type="Db.CalcFunc"
Conn.render.object#parameter type="GLib.Object"
Iterator.params type="Db.Param"
Model.get skip=false name="get_values"
Model.set skip=false name="set_values"
Model.search skip=false

View File

@ -333,7 +333,7 @@ static void vn_column_combo_class_init (VnColumnComboClass * klass)
VN_COLUMN_CLASS (klass)->set_null = (VnColumnSetNullFunc) vn_column_combo_set_null;
VN_COLUMN_CLASS (klass)->model_changed = (VnColumnModelChangedFunc) vn_column_combo_model_changed;
g_object_class_override_property (k, PROP_MODEL, "model");
g_object_class_override_property (k, PROP_MODEL, "data-model");
g_object_class_install_property (k, PROP_INDEX_COLUMN,
g_param_spec_uint ("index-column"

View File

@ -183,6 +183,7 @@ static void vn_column_spin_init (VnColumnSpin * obj)
static void vn_column_spin_finalize (VnColumnSpin * obj)
{
g_free (obj->format);
G_OBJECT_CLASS (vn_column_spin_parent_class)->finalize (G_OBJECT (obj));
}

View File

@ -119,7 +119,7 @@ static void vn_check_set_value (VnCheck * self, const GValue * value)
static void vn_check_init (VnCheck * self)
{
self->button = GTK_TOGGLE_BUTTON (gtk_check_button_new ());
gtk_button_set_use_underline (GTK_BUTTON (self->button), TRUE);
gtk_toggle_button_set_mode (self->button, TRUE);
g_object_connect (self->button
,"signal::toggled", vn_check_on_toggled, self
,"signal::button-release-event", vn_check_on_secondary_button, self
@ -127,8 +127,7 @@ static void vn_check_init (VnCheck * self)
);
gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->button));
VN_FIELD_GET_CLASS (self)->set_widget (VN_FIELD (self),
GTK_WIDGET (self->button));
VN_FIELD_GET_CLASS (self)->set_widget (VN_FIELD (self), GTK_WIDGET (self->button));
}
static void vn_check_finalize (VnCheck * self)

View File

@ -88,25 +88,35 @@ static void vn_combo_on_model_ready (VnCombo * self, const GValue * value)
vn_combo_on_changed, self);
}
static void vn_combo_set_value (VnCombo * self, const GValue * value)
{
if (self->model && db_model_get_status (self->model) == DB_MODEL_STATUS_READY)
vn_combo_on_model_ready (self, value);
}
static void vn_combo_on_status_changed (DbModel * model, DbModelStatus status, VnCombo * self)
{
if (status == DB_MODEL_STATUS_READY)
{
gtk_combo_box_set_model (self->combo, self->tree);
self->tree_set = TRUE;
vn_combo_on_model_ready (self, gvn_param_get_value (GVN_PARAM (self)));
db_model_use_null_row (model, vn_field_get_null (VN_FIELD (self)));
}
else
{
gtk_combo_box_set_model (self->combo, NULL);
self->tree_set = FALSE;
}
}
static void vn_combo_set_widget_value (VnCombo * self, const GValue * value)
{
if (self->model && db_model_get_status (self->model) == DB_MODEL_STATUS_READY)
{
if (!self->tree_set)
vn_combo_on_status_changed (self->model, DB_MODEL_STATUS_READY, self);
vn_combo_on_model_ready (self, value);
}
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ DbModelHolder methods
static DbModel * vn_combo_get_model (VnCombo * self)
{
@ -165,7 +175,7 @@ void vn_combo_set_index_column (VnCombo * self, guint column)
g_return_if_fail (VN_IS_COMBO (self));
self->index_column = column;
vn_combo_set_value (self, gvn_param_get_value (GVN_PARAM (self)));
vn_combo_set_widget_value (self, gvn_param_get_value (GVN_PARAM (self)));
}
/**
@ -252,6 +262,7 @@ static void vn_combo_get_property (VnCombo * self, guint property_id,
static void vn_combo_init (VnCombo * self)
{
self->tree = NULL;
self->tree_set = FALSE;
self->model = NULL;
self->combo = GTK_COMBO_BOX (gtk_combo_box_new ());
@ -278,9 +289,9 @@ static void vn_combo_class_init (VnComboClass * klass)
k->finalize = (GObjectFinalizeFunc) vn_combo_finalize;
k->set_property = (GObjectSetPropertyFunc) vn_combo_set_property;
k->get_property = (GObjectGetPropertyFunc) vn_combo_get_property;
VN_FIELD_CLASS (klass)->set_value = (VnFieldSetValueFunc) vn_combo_set_value;
VN_FIELD_CLASS (klass)->set_value = (VnFieldSetValueFunc) vn_combo_set_widget_value;
g_object_class_override_property (k, PROP_MODEL, "model");
g_object_class_override_property (k, PROP_MODEL, "data-model");
g_object_class_install_property (k, PROP_INDEX_COLUMN,
g_param_spec_uint ("index-column"

View File

@ -40,6 +40,7 @@ struct _VnCombo
GtkTreeModel * tree;
guint show_column;
guint index_column;
gboolean tree_set;
};
struct _VnComboClass

View File

@ -327,7 +327,7 @@ static void vn_completion_class_init (VnCompletionClass * klass)
k->set_property = (GObjectSetPropertyFunc) vn_completion_set_property;
k->get_property = (GObjectGetPropertyFunc) vn_completion_get_property;
g_object_class_override_property (k, PROP_MODEL, "model");
g_object_class_override_property (k, PROP_MODEL, "data-model");
g_object_class_install_property (k, PROP_FIELD,
g_param_spec_string ("field"

View File

@ -113,7 +113,15 @@ static void vn_http_image_on_upload
*/
static void vn_http_image_set_value (VnHttpImage * self, const GValue * value)
{
gchar * full_path = g_strconcat (self->priv->path, "/",
gchar * full_path;
if (gvn_value_is_null (value))
{
SET_ICON ("missing-image", _("No image set"));
return;
}
full_path = g_strconcat (self->priv->path, "/",
g_value_get_string (value), NULL);
SET_ICON ("view-refresh", _("Loading"));

View File

@ -122,13 +122,13 @@ static void vn_batch_buildable_interface_init (GtkBuildableIface * iface)
iface->custom_finished = vn_batch_buildable_custom_finished;
}
static void vn_batch_init (VnBatch * obj)
static void vn_batch_init (VnBatch * self)
{
}
static void vn_batch_finalize (VnBatch * obj)
static void vn_batch_finalize (VnBatch * self)
{
G_OBJECT_CLASS (vn_batch_parent_class)->finalize (G_OBJECT (obj));
G_OBJECT_CLASS (vn_batch_parent_class)->finalize (G_OBJECT (self));
}
static void vn_batch_class_init (VnBatchClass * klass)

View File

@ -19,58 +19,58 @@
static void vn_iterator_buildable_init (GtkBuildableIface * iface);
G_DEFINE_TYPE_WITH_CODE (VnIterator, vn_iterator, DB_TYPE_ITERATOR,
G_DEFINE_TYPE_WITH_CODE (VnIterator, vn_iterator, DB_TYPE_SIMPLE_ITERATOR,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
vn_iterator_buildable_init)
);
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Methods for Glade
void vn_iterator_add_param (DbIterator * obj, DbParam * param)
void vn_iterator_add_param (DbSimpleIterator * self, DbParam * param)
{
VnIterator * i = (VnIterator *) obj;
g_return_if_fail (DB_IS_ITERATOR (obj));
VnIterator * i = (VnIterator *) self;
g_return_if_fail (DB_IS_SIMPLE_ITERATOR (self));
g_return_if_fail (DB_IS_PARAM (param));
i->params = g_list_prepend (i->params, param);
}
void vn_iterator_remove_param (DbIterator * obj, DbParam * param)
void vn_iterator_remove_param (DbSimpleIterator * self, DbParam * param)
{
VnIterator * i = (VnIterator *) obj;
g_return_if_fail (DB_IS_ITERATOR (obj));
VnIterator * i = (VnIterator *) self;
g_return_if_fail (DB_IS_SIMPLE_ITERATOR (self));
g_return_if_fail (DB_IS_PARAM (param));
i->params = g_list_remove (i->params, param);
}
GList * vn_iterator_get_params (DbIterator * obj)
GList * vn_iterator_get_params (DbSimpleIterator * self)
{
g_return_if_fail (DB_IS_ITERATOR (obj));
g_return_if_fail (DB_IS_SIMPLE_ITERATOR (self));
return g_list_copy (((VnIterator *) obj)->params);
return g_list_copy (((VnIterator *) self)->params);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ GtkBuildable
static void vn_iterator_buildable_add_child (GtkBuildable * obj,
static void vn_iterator_buildable_add_child (GtkBuildable * self,
GtkBuilder * builder, GObject * child, const gchar * type)
{
db_iterator_add_param ((DbIterator *) obj, (DbParam *) child);
db_iterator_add_param (DB_ITERATOR (self), DB_PARAM (child));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
static void vn_iterator_init (VnIterator * obj)
static void vn_iterator_init (VnIterator * self)
{
obj->params = NULL;
self->params = NULL;
}
static void vn_iterator_finalize (VnIterator * obj)
static void vn_iterator_finalize (VnIterator * self)
{
g_list_free_full (obj->params, g_object_unref);
g_list_free_full (self->params, g_object_unref);
G_OBJECT_CLASS (vn_iterator_parent_class)->finalize (G_OBJECT (obj));
G_OBJECT_CLASS (vn_iterator_parent_class)->finalize (G_OBJECT (self));
}
static void vn_iterator_class_init (VnIteratorClass * klass)

View File

@ -22,30 +22,30 @@
#include <gtk/gtk.h>
#define VN_TYPE_ITERATOR (vn_iterator_get_type ())
#define VN_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, VN_TYPE_ITERATOR, VnIterator))
#define VN_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, VN_TYPE_ITERATOR))
#define VN_ITERATOR(self) (G_TYPE_CHECK_INSTANCE_CAST (self, VN_TYPE_ITERATOR, VnIterator))
#define VN_IS_ITERATOR(self) (G_TYPE_CHECK_INSTANCE_TYPE (self, VN_TYPE_ITERATOR))
#define VN_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, VN_TYPE_ITERATOR, VnIteratorClass))
#define VN_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass, VN_TYPE_ITERATOR))
#define VN_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, VN_TYPE_ITERATOR, VnIteratorClass))
#define VN_ITERATOR_GET_CLASS(self) (G_TYPE_INSTANCE_GET_CLASS (self, VN_TYPE_ITERATOR, VnIteratorClass))
typedef struct _VnIterator VnIterator;
typedef struct _VnIteratorClass VnIteratorClass;
struct _VnIterator
{
DbIterator iterator;
DbSimpleIterator iterator;
GList * params;
};
struct _VnIteratorClass
{
DbIteratorClass parent;
DbSimpleIteratorClass parent;
};
GType vn_iterator_get_type ();
void vn_iterator_add_param (DbIterator * obj, DbParam * param);
void vn_iterator_remove_param (DbIterator * obj, DbParam * param);
GList * vn_iterator_get_params (DbIterator * obj);
void vn_iterator_add_param (DbSimpleIterator * self, DbParam * param);
void vn_iterator_remove_param (DbSimpleIterator * self, DbParam * param);
GList * vn_iterator_get_params (DbSimpleIterator * self);
#endif

View File

@ -150,12 +150,12 @@ static void vn_model_buildable_init (GtkBuildableIface * iface)
iface->custom_finished = vn_model_buildable_custom_finished;
}
static void vn_model_init (VnModel * obj)
static void vn_model_init (VnModel * self)
{}
static void vn_model_finalize (VnModel * obj)
static void vn_model_finalize (VnModel * self)
{
G_OBJECT_CLASS (vn_model_parent_class)->finalize (G_OBJECT (obj));
G_OBJECT_CLASS (vn_model_parent_class)->finalize (G_OBJECT (self));
}
static void vn_model_class_init (VnModelClass * klass)

View File

@ -22,11 +22,11 @@
#include <gtk/gtk.h>
#define VN_TYPE_MODEL (vn_model_get_type ())
#define VN_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, VN_TYPE_MODEL, VnModel))
#define VN_IS_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, VN_TYPE_MODEL))
#define VN_MODEL(self) (G_TYPE_CHECK_INSTANCE_CAST (self, VN_TYPE_MODEL, VnModel))
#define VN_IS_MODEL(self) (G_TYPE_CHECK_INSTANCE_TYPE (self, VN_TYPE_MODEL))
#define VN_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, VN_TYPE_MODEL, VnModelClass))
#define VN_IS_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass, VN_TYPE_MODEL))
#define VN_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, VN_TYPE_MODEL, VnModelClass))
#define VN_MODEL_GET_CLASS(self) (G_TYPE_INSTANCE_GET_CLASS (self, VN_TYPE_MODEL, VnModelClass))
typedef struct _VnModel VnModel;
typedef struct _VnModelClass VnModelClass;

View File

@ -6,8 +6,8 @@
<!-- interface-local-resource-path ../image -->
<object class="VnSet" id="models">
<child>
<object class="VnModel" id="model-last-conn">
<property name="sql">SELECT rowid, last_connection FROM config LIMIT 1</property>
<object class="VnModel" id="model-connections">
<property name="sql">SELECT rowid, name, plugin, schema, host, ssl_ca, user, password FROM connection</property>
<property name="update_flags">DB_MODEL_INSERT | DB_MODEL_DELETE | DB_MODEL_UPDATE</property>
</object>
</child>
@ -22,36 +22,25 @@
</object>
</child>
<child>
<object class="VnModel" id="model-connections">
<property name="sql">SELECT rowid, name, plugin, schema, host, ssl_ca, user, password FROM connection</property>
<object class="VnModel" id="model-last-conn">
<property name="sql">SELECT rowid, last_connection FROM config LIMIT 1</property>
<property name="update_flags">DB_MODEL_INSERT | DB_MODEL_DELETE | DB_MODEL_UPDATE</property>
</object>
</child>
</object>
<object class="VnSet" id="iterators">
<child>
<object class="VnIterator" id="iterator-last-conn">
<property name="model">model-last-conn</property>
<property name="mode">on-demand</property>
<signal name="status-changed" handler="vn_login_on_last_conn_ready" swapped="no"/>
</object>
</child>
<child>
<object class="VnIterator" id="iterator-login">
<property name="model">model-login</property>
<property name="data_model">model-login</property>
<property name="mode">on-demand</property>
<signal name="iter-changed" handler="vn_login_on_server_changed" swapped="no"/>
</object>
</child>
<child>
<object class="VnIterator" id="iterator-connections">
<property name="model">model-connections</property>
<property name="mode">on-iter</property>
<child>
<object class="DbParam" id="edit-connection">
<property name="column_name">rowid</property>
</object>
</child>
<object class="VnIterator" id="iterator-last-conn">
<property name="data_model">model-last-conn</property>
<property name="mode">on-demand</property>
<signal name="status-changed" handler="vn_login_on_last_conn_ready" swapped="no"/>
</object>
</child>
</object>
@ -63,6 +52,7 @@
<property name="window_position">center</property>
<property name="icon">../image/icon.svg</property>
<signal name="destroy" handler="vn_login_on_destroyed" swapped="no"/>
<signal name="key-press-event" handler="vn_login_on_key_pressed" swapped="no"/>
<child>
<object class="GtkBox" id="login-box">
<property name="visible">True</property>
@ -96,12 +86,7 @@
<property name="iterator">iterator-last-conn</property>
<property name="column_name">last_connection</property>
<property name="null">False</property>
<property name="model">model-connections</property>
<child internal-child="widget">
<object class="GtkComboBox" id="combo-widget1">
<property name="can_focus">False</property>
</object>
</child>
<property name="data_model">model-connections</property>
</object>
<packing>
<property name="expand">False</property>
@ -135,6 +120,7 @@
<property name="can_focus">True</property>
<property name="visibility">False</property>
<property name="secondary_icon_name">edit-find-symbolic</property>
<property name="secondary_icon_tooltip_text" translatable="yes">Show password</property>
<property name="placeholder_text" translatable="yes">Password</property>
<signal name="icon-press" handler="vn_login_on_pass_show" swapped="no"/>
<signal name="icon-release" handler="vn_login_on_pass_hide" swapped="no"/>
@ -199,8 +185,8 @@
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="vn_login_on_connect_clicked" swapped="no"/>
<accelerator key="KP_Enter" signal="clicked"/>
<accelerator key="Return" signal="clicked"/>
<accelerator key="KP_Enter" signal="clicked"/>
</object>
<packing>
<property name="expand">False</property>
@ -252,8 +238,8 @@
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="vn_login_on_settings_close_clicked" swapped="no"/>
<accelerator key="KP_Enter" signal="clicked"/>
<accelerator key="Return" signal="clicked"/>
<accelerator key="KP_Enter" signal="clicked"/>
</object>
<packing>
<property name="expand">False</property>
@ -291,7 +277,8 @@
<object class="VnGrid" id="connections-grid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="iterator">iterator-connections</property>
<property name="data_model">model-connections</property>
<property name="mode">on-iter</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="grid-selection"/>
</child>
@ -318,7 +305,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="iterator">iterator-connections</property>
<property name="iterator">connections-grid</property>
<property name="show_flags">VN_HANDLER_SHOW_REMOVE | VN_HANDLER_SHOW_ADD</property>
</object>
<packing>
@ -335,7 +322,7 @@
</packing>
</child>
<child>
<object class="GtkBox" id="connetion-box">
<object class="GtkBox" id="connection-box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
@ -398,7 +385,7 @@
<object class="VnEntry" id="ssl-ca">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">iterator-connections</property>
<property name="iterator">connections-grid</property>
<property name="column_name">ssl_ca</property>
<child internal-child="widget">
<object class="GtkEntry" id="entry-widget9">
@ -419,7 +406,7 @@
<object class="VnEntry" id="schema">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">iterator-connections</property>
<property name="iterator">connections-grid</property>
<property name="column_name">schema</property>
<child internal-child="widget">
<object class="GtkEntry" id="entry-widget11">
@ -437,7 +424,7 @@
<object class="VnEntry" id="host">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">iterator-connections</property>
<property name="iterator">connections-grid</property>
<property name="column_name">host</property>
<child internal-child="widget">
<object class="GtkEntry" id="entry-widget12">
@ -467,7 +454,7 @@
<object class="VnEntry" id="name">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">iterator-connections</property>
<property name="iterator">connections-grid</property>
<property name="column_name">name</property>
<child internal-child="widget">
<object class="GtkEntry" id="entry-widget13">
@ -485,7 +472,7 @@
<object class="VnEntry" id="plugin">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">iterator-connections</property>
<property name="iterator">connections-grid</property>
<property name="column_name">plugin</property>
<child internal-child="widget">
<object class="GtkEntry" id="entry-widget14">
@ -515,7 +502,7 @@
<object class="VnEntry" id="user1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">iterator-connections</property>
<property name="iterator">connections-grid</property>
<property name="column_name">user</property>
<child internal-child="widget">
<object class="GtkEntry" id="entry-widget15">
@ -539,7 +526,7 @@
<object class="VnHandler" id="handler-connection">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="iterator">iterator-connections</property>
<property name="iterator">connections-grid</property>
<property name="show_flags">VN_HANDLER_SHOW_UNDO | VN_HANDLER_SHOW_SAVE</property>
</object>
<packing>
@ -568,4 +555,12 @@
<action-widget response="0">close</action-widget>
</action-widgets>
</object>
<object class="VnSet" id="params">
<child>
<object class="DbParam" id="edit-connection">
<property name="iterator">connections-grid</property>
<property name="column_name">rowid</property>
</object>
</child>
</object>
</interface>

View File

@ -26,8 +26,6 @@
<attribute name="action">app.about</attribute>
<attribute name="accel">&lt;Primary&gt;h</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Quit</attribute>
<attribute name="action">app.quit</attribute>

View File

@ -294,7 +294,7 @@ DbModel * vn_column_get_model (VnColumn * obj)
GTK_TREE_VIEW_COLUMN (obj));
if (grid)
return vn_grid_get_model (VN_GRID (grid));
return db_model_holder_get_model (DB_MODEL_HOLDER (grid));
return NULL;
}

View File

@ -261,6 +261,7 @@ static void vn_field_set_widget (VnField * self, GtkWidget * widget)
{
self->widget = widget;
vn_field_update_widget (self);
gtk_widget_show (widget);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
@ -415,7 +416,7 @@ GtkWidget * vn_field_get_widget (VnField * self)
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Buildable
static GtkBuildableIface *parent_buildable_iface;
static GtkBuildableIface * parent_buildable_iface;
static GObject * vn_field_buildable_get_internal_child (GtkBuildable * buildable,
GtkBuilder * builder, const gchar * childname)
@ -543,6 +544,7 @@ static void vn_field_init (VnField * self)
static void vn_field_dispose (VnField * self)
{
vn_field_set_master (self, NULL);
G_OBJECT_CLASS (vn_field_parent_class)->dispose (G_OBJECT (self));
}
static void vn_field_finalize (VnField * self)

View File

@ -24,6 +24,16 @@ typedef struct
}
GvnSignalInfo;
/*
* gvn_object_link:
* @obj: instance
* @prop: property of @obj to be set to @prop_value
* @prop_value: the value to set on @prop
* @info: an array of GvnSignalInfo
*
* Connects the signals of an object passed on @prop_value to the callbacks
* listed in a GvnSignalInfo array.
*/
void _gvn_object_link (gpointer obj, gpointer * prop, gpointer prop_value, GvnSignalInfo * info)
{
gint i;
@ -386,6 +396,7 @@ typedef enum
}
VnGridModelProp;
/*Experimental way to connect a property object signals using gvn_object_link*/
GvnSignalInfo signal_info[] =
{
{"line-updated.after", vn_grid_model_on_line_updated

View File

@ -17,144 +17,53 @@
#include "vn-grid.h"
G_DEFINE_TYPE (VnGrid, vn_grid, GTK_TYPE_TREE_VIEW);
static void vn_grid_model_holder_init (DbModelHolderInterface * iface);
static void vn_grid_iterator_init (DbIteratorInterface * iface);
static void vn_grid_on_iter_changed (GtkTreeView * self);
static void vn_grid_set_iter (VnGrid * self, DbIter * iter);
static gboolean vn_grid_move_iter (VnGrid * self, DbIter * iter);
/**
* SECTION: vn-grid
* @Short_description: a grid to display data
* @Title: VnGrid
*
* #VnGrid is used to show data from a #DbModel organized in #VnColumns.
*/
G_DEFINE_TYPE_WITH_CODE (VnGrid, vn_grid, GTK_TYPE_TREE_VIEW,
G_IMPLEMENT_INTERFACE (DB_TYPE_MODEL_HOLDER,
vn_grid_model_holder_init)
G_IMPLEMENT_INTERFACE (DB_TYPE_ITERATOR,
vn_grid_iterator_init)
);
/**
* VnGrid:
* @params: (element-type Db.Param):
**/
/**
* vn_grid_new:
* @model: a #DbModel
*
* Creates a new grid
*
* Return value: #VnGrid created.
* Return value: (transfer full): #VnGrid created.
**/
VnGrid * vn_grid_new ()
VnGrid * vn_grid_new (DbModel * model)
{
return g_object_new (VN_TYPE_GRID, "rules-hint", TRUE, NULL);
}
/**
* vn_grid_new_with_iterator:
* @iterator: #DbIterator where the grid will be created
*
* Creates a new grid into a iterator
*
* Return value: #VnGrid created.
**/
VnGrid * vn_grid_new_with_iterator (DbIterator * iterator)
{
VnGrid * obj = vn_grid_new ();
g_object_set (obj, "iterator", iterator, NULL);
return obj;
return g_object_new (VN_TYPE_GRID, "rules-hint", TRUE, "data-model", model, NULL);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
static void vn_grid_on_iter_changed (DbIterator * iterator, GtkTreeView * obj);
static void vn_grid_on_selection_changed (GtkTreeSelection * selection, GtkTreeView * obj)
static void vn_grid_unref_param (VnGrid * self, DbParam * param)
{
GtkTreeIter iter;
GList * l, * list;
if (gtk_tree_selection_count_selected_rows (selection) <= 1)
return;
list = gtk_tree_selection_get_selected_rows (selection, NULL);
for (l = list; l; l = l->next)
if (gtk_tree_model_get_iter (gtk_tree_view_get_model (obj), &iter, l->data))
{
DbIter dbiter;
vn_gtk_tree_iter_to_db_iter (&iter, &dbiter);
db_iterator_select_iter (VN_GRID (obj)->iterator, &dbiter);
}
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
self->params = g_list_remove (self->params, param);
}
static void vn_grid_on_cursor_changed (GtkTreeView * tree_view, VnGrid * obj)
{
gint selected_rows;
if (!db_iterator_is_ready (obj->iterator))
return;
selected_rows = gtk_tree_selection_count_selected_rows (gtk_tree_view_get_selection (tree_view));
if (selected_rows == 1)
{
GtkTreeIter iter;
GtkTreePath * path;
gtk_tree_view_get_cursor (tree_view, &path, NULL);
if (path && gtk_tree_model_get_iter (gtk_tree_view_get_model (tree_view), &iter, path))
{
DbIter dbiter;
vn_gtk_tree_iter_to_db_iter (&iter, &dbiter);
g_signal_handlers_block_by_func (obj->iterator, vn_grid_on_iter_changed, obj);
db_iterator_move_iter (obj->iterator, &dbiter);
g_signal_handlers_unblock_by_func (obj->iterator, vn_grid_on_iter_changed, obj);
}
gtk_tree_path_free (path);
}
else if (selected_rows == 0)
db_iterator_move_iter (obj->iterator, NULL);
}
static void vn_grid_on_iter_changed (DbIterator * iterator, GtkTreeView * obj)
{
DbIter dbiter;
GtkTreeSelection * selection = gtk_tree_view_get_selection (obj);
if (db_iterator_get_iter (iterator, &dbiter) && gtk_tree_view_get_model (obj))
{
GtkTreeIter iter;
GtkTreePath * path;
vn_gtk_tree_iter_from_db_iter (&iter, &dbiter);
path = gtk_tree_model_get_path (gtk_tree_view_get_model (obj), &iter);
g_signal_handlers_block_by_func (obj, vn_grid_on_cursor_changed, iterator);
gtk_tree_view_set_cursor (obj, path, NULL, FALSE);
g_signal_handlers_unblock_by_func (obj, vn_grid_on_cursor_changed, iterator);
gtk_tree_path_free (path);
}
else if (selection)
gtk_tree_selection_unselect_all (selection);
}
static void vn_grid_on_model_changed (VnGrid * obj, GParamSpec * spec, gpointer data)
{
GList * n, * columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (obj));
for (n = columns; n; n = n->next)
if (VN_IS_COLUMN (n->data))
vn_column_model_changed (n->data);
g_list_free (columns);
}
static void vn_grid_on_status_changed (DbIterator * iterator, gboolean ready, VnGrid * obj)
{
obj->model = db_model_holder_get_model (DB_MODEL_HOLDER (iterator));
vn_grid_on_model_changed (obj, NULL, NULL);
if (ready)
{
GtkTreeModel * tree_model = GTK_TREE_MODEL (vn_grid_model_new (obj->model));
gtk_tree_view_set_model (GTK_TREE_VIEW (obj), tree_model);
vn_grid_on_iter_changed (obj->iterator, GTK_TREE_VIEW (obj));
g_object_unref (tree_model);
}
else
gtk_tree_view_set_model (GTK_TREE_VIEW (obj), NULL);
}
static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj,
static gboolean vn_grid_on_key_pressed (GtkTreeView * self,
GdkEventKey * event, gpointer data)
{
gboolean inverted, passed = FALSE;
@ -167,13 +76,30 @@ static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj,
GtkCellArea * area;
GtkCellEditable * editable;
// Remove new not inserted row when Escape is pressed
if (event->type == GDK_KEY_PRESS
&& event->keyval == GDK_KEY_Escape
&& VN_GRID (self)->mode != DB_ITERATOR_MODE_ON_DEMAND)
{
db_iterator_reverse_operations (DB_ITERATOR (self));
return FALSE;
}
// Move cursor when pressing Tab, Shift + Tab or Keypad Enter
if (!(event->type == GDK_KEY_PRESS
&& (event->keyval == GDK_KEY_Tab
|| event->keyval == GDK_KEY_ISO_Left_Tab
|| event->keyval == GDK_KEY_KP_Enter)))
return FALSE;
gtk_tree_view_get_cursor (obj, &path, &col);
gtk_tree_view_get_cursor (self, &path, &col);
if (!col || !path)
{
gtk_tree_path_free (path);
return FALSE;
}
selected = VN_COLUMN (col);
g_object_get (col, "cell-area", &area, NULL);
@ -184,7 +110,7 @@ static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj,
g_object_unref (area);
columns = gtk_tree_view_get_columns (obj);
columns = gtk_tree_view_get_columns (self);
inverted = event->keyval == GDK_KEY_ISO_Left_Tab ? TRUE : FALSE;
sel_tab_index = vn_column_get_tab_index (selected);
first = NULL;
@ -230,7 +156,7 @@ static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj,
g_list_free (columns);
if (!next)
if (!next && path)
{
gboolean leave = FALSE;
next = first ? first : selected;
@ -241,19 +167,19 @@ static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj,
{
DbIter iter;
if (db_model_get_iter (VN_GRID (obj)->model, &iter, gtk_tree_path_get_indices (path)[0])
&& db_model_get_row_operations (VN_GRID (obj)->model, &iter) == DB_MODEL_ROW_OP_INSERT)
if (db_model_get_iter (VN_GRID (self)->model, &iter, gtk_tree_path_get_indices (path)[0])
&& db_model_get_row_operations (VN_GRID (self)->model, &iter) == DB_MODEL_ROW_OP_INSERT)
leave = TRUE;
else
{
gtk_tree_path_next (path);
if (gtk_tree_path_get_indices (path)[0] >=
db_model_get_nrows (VN_GRID (obj)->model))
db_model_get_nrows (VN_GRID (self)->model))
{
if (db_model_get_update_flags (VN_GRID (obj)->model) &
if (db_model_get_update_flags (VN_GRID (self)->model) &
DB_MODEL_INSERT)
db_iterator_insert (VN_GRID (obj)->iterator);
db_iterator_insert (DB_ITERATOR (self));
else
leave = TRUE;
}
@ -267,164 +193,448 @@ static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj,
}
}
gtk_tree_view_set_cursor (obj, path, GTK_TREE_VIEW_COLUMN (next), TRUE);
gtk_tree_view_set_cursor (self, path, GTK_TREE_VIEW_COLUMN (next), TRUE);
gtk_tree_path_free (path);
return TRUE;
}
static gboolean vn_grid_on_escape_pressed (VnGrid * obj,
GdkEventKey * event, gpointer data)
static void vn_grid_on_cursor_changed (GtkTreeView * self)
{
if (event->type == GDK_KEY_PRESS
&& event->keyval == GDK_KEY_Escape
&& db_iterator_get_mode (obj->iterator) != DB_ITERATOR_MODE_ON_DEMAND)
db_iterator_reverse_operations (obj->iterator);
GtkTreeIter iter;
GtkTreePath * path;
if (gtk_tree_selection_count_selected_rows (gtk_tree_view_get_selection (self)) > 1)
return;
gtk_tree_view_get_cursor (self, &path, NULL);
if (path && gtk_tree_model_get_iter (gtk_tree_view_get_model (self), &iter, path))
{
DbIter dbiter;
vn_gtk_tree_iter_to_db_iter (&iter, &dbiter);
vn_grid_move_iter (VN_GRID (self), &dbiter);
}
gtk_tree_path_free (path);
}
static void vn_grid_on_iter_changed (GtkTreeView * self)
{
GtkTreeSelection * selection = gtk_tree_view_get_selection (self);
if (VN_GRID (self)->iter && gtk_tree_view_get_model (self))
{
GtkTreeIter iter;
GtkTreePath * path;
vn_gtk_tree_iter_from_db_iter (&iter, VN_GRID (self)->iter);
path = gtk_tree_model_get_path (gtk_tree_view_get_model (self), &iter);
g_signal_handlers_block_by_func (self, vn_grid_on_cursor_changed, NULL);
gtk_tree_view_set_cursor (self, path, NULL, FALSE);
g_signal_handlers_unblock_by_func (self, vn_grid_on_cursor_changed, NULL);
gtk_tree_path_free (path);
}
else if (selection)
gtk_tree_selection_unselect_all (selection);
}
static void vn_grid_on_model_changed (VnGrid * self, GParamSpec * spec, gpointer data)
{
GList * n, * columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (self));
for (n = columns; n; n = n->next)
if (VN_IS_COLUMN (n->data))
vn_column_model_changed (n->data);
g_list_free (columns);
}
static void vn_grid_row_num_changed (VnGrid * self)
{
if (self->iter)
self->row = db_model_get_path (self->model, self->iter);
else if (!self->remember_selection)
self->row = -1;
db_iterator_row_num_changed (DB_ITERATOR (self));
}
static void vn_grid_iter_changed (VnGrid * self)
{
vn_grid_row_num_changed (self);
db_iterator_iter_changed (DB_ITERATOR (self));
vn_grid_on_iter_changed (GTK_TREE_VIEW (self));
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ DbModelHolder methods
static void vn_grid_set_model_mode (VnGrid * self)
{
if (!self->model)
return;
if (self->mode == DB_ITERATOR_MODE_ON_CHANGE)
db_model_set_mode (self->model, DB_MODEL_MODE_ON_CHANGE);
else
db_model_set_mode (self->model, DB_MODEL_MODE_ON_DEMAND);
}
static void vn_grid_on_model_line_inserted (DbModel * model, DbIter * iter, VnGrid * self)
{
db_iterator_data_changed (DB_ITERATOR (self));
}
static void vn_grid_on_model_line_updated_after (DbModel * model, DbIter * iter, VnGrid * self)
{
if (self->iter && db_iter_compare (iter, self->iter))
vn_grid_iter_changed (self);
db_iterator_data_changed (DB_ITERATOR (self));
}
static void vn_grid_on_model_line_deleted (DbModel * model, gint row, VnGrid * self)
{
if (self->iter && row == self->row)
{
DbIter iter;
if (db_model_get_iter (model, &iter, row + 1)
|| db_model_get_iter (model, &iter, row - 1))
vn_grid_set_iter (self, &iter);
else
vn_grid_set_iter (self, NULL);
}
}
static void vn_grid_on_model_line_deleted_after (DbModel * model, gint row, VnGrid * self)
{
if (self->iter)
vn_grid_row_num_changed (self);
db_iterator_data_changed (DB_ITERATOR (self));
}
static void vn_grid_on_model_lines_reordered (DbModel * model, gint column, gint * new_order, VnGrid * self)
{
if (self->iter)
vn_grid_row_num_changed (self);
}
static void vn_grid_on_model_status_changed (DbModel * model, DbModelStatus status, VnGrid * self)
{
self->model = db_model_holder_get_model (DB_MODEL_HOLDER (self));
vn_grid_on_model_changed (self, NULL, NULL);
if (status == DB_MODEL_STATUS_READY)
{
DbIter iter;
GtkTreeModel * tree_model;
db_iterator_status_changed (DB_ITERATOR (self), TRUE);
tree_model = GTK_TREE_MODEL (vn_grid_model_new (self->model));
gtk_tree_view_set_model (GTK_TREE_VIEW (self), tree_model);
vn_grid_on_iter_changed (GTK_TREE_VIEW (self));
if (self->row >= 0 && self->row < db_model_get_nrows (self->model)
&& db_model_get_iter (self->model, &iter, self->row))
vn_grid_set_iter (self, &iter);
else
vn_grid_set_iter (self, NULL);
g_object_unref (tree_model);
}
else
{
vn_grid_set_iter (self, NULL);
db_iterator_status_changed (DB_ITERATOR (self), FALSE);
gtk_tree_view_set_model (GTK_TREE_VIEW (self), NULL);
}
}
static void vn_grid_on_model_operations_done (DbModel * model, VnGrid * self)
{
g_return_val_if_fail (VN_IS_GRID (self), NULL);
db_iterator_operations_done (DB_ITERATOR (self));
}
static DbModel * vn_grid_get_model (VnGrid * self)
{
g_return_val_if_fail (VN_IS_GRID (self), NULL);
return self->model;
}
static void vn_grid_set_model (VnGrid * self, DbModel * model)
{
g_return_if_fail (VN_IS_GRID (self));
if (!model)
return;
if (!self->model)
{
self->model = g_object_ref (model);
g_object_connect (model
,"signal::line-inserted", vn_grid_on_model_line_inserted, self
,"signal-after::line-updated", vn_grid_on_model_line_updated_after, self
,"signal::line-deleted", vn_grid_on_model_line_deleted, self
,"signal-after::line-deleted", vn_grid_on_model_line_deleted_after, self
,"signal::lines-reordered", vn_grid_on_model_lines_reordered, self
,"signal::status-changed", vn_grid_on_model_status_changed, self
,"signal::operations-done", vn_grid_on_model_operations_done, self
,NULL
);
vn_grid_set_model_mode (self);
vn_grid_on_model_status_changed (model,
db_model_get_status (model), self);
}
else
g_warning ("VnGrid: Can't reassign the 'data-model' property");
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ DbIterator methods
static DbIteratorMode vn_grid_get_mode (VnGrid * self)
{
g_return_val_if_fail (VN_IS_GRID (self), 0);
return self->mode;
}
static void vn_grid_set_mode (VnGrid * self, DbIteratorMode mode)
{
g_return_if_fail (VN_IS_GRID (self));
self->mode = mode;
vn_grid_set_model_mode (self);
}
static gint vn_grid_get_row (VnGrid * self)
{
g_return_val_if_fail (VN_IS_GRID (self), -1);
if (self->iter)
return self->row;
else
return -1;
}
static gboolean vn_grid_get_iter (VnGrid * self, DbIter ** iter)
{
g_return_val_if_fail (VN_IS_GRID (self), NULL);
if (!self->iter)
return FALSE;
*iter = self->iter;
return TRUE;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
/**
* vn_grid_get_iterator:
* @obj: a #VnGrid
*
* Gets the iterator used by @obj.
*
* Return value: (transfer none): the #DbIterator
**/
DbIterator * vn_grid_get_iterator (VnGrid * obj)
static void vn_grid_set_iter (VnGrid * self, DbIter * iter)
{
g_return_val_if_fail (VN_IS_GRID (obj), NULL);
return obj->iterator;
}
/**
* vn_grid_set_iterator:
* @obj: a #VnGrid
* @iterator: the #DbIterator
*
* Sets the iterator handled by tree view.
**/
void vn_grid_set_iterator (VnGrid * obj, DbIterator * iterator)
{
g_return_if_fail (VN_IS_GRID (obj));
g_return_if_fail (DB_IS_ITERATOR (iterator) || !iterator);
if (obj->iterator)
if (iter)
{
g_object_disconnect (obj->iterator
,"any-signal", vn_grid_on_iter_changed, obj
,"any-signal", vn_grid_on_status_changed, obj
,NULL
);
g_clear_object (&obj->iterator);
obj->model = NULL;
db_iter_free (self->iter);
self->iter = db_iter_copy (iter);
vn_grid_iter_changed (self);
}
if (iterator)
else if (self->iter)
{
obj->iterator = g_object_ref (iterator);
g_object_connect (iterator
,"signal::iter-changed", vn_grid_on_iter_changed, obj
,"signal::status-changed", vn_grid_on_status_changed, obj
,NULL
);
if (!self->remember_selection)
self->row = 0;
vn_grid_on_status_changed (iterator,
db_iterator_is_ready (iterator), obj);
db_iter_free (self->iter);
self->iter = NULL;
vn_grid_iter_changed (self);
}
}
/**
* vn_grid_get_model:
* @obj: a #VnGrid
*
* Gets the model used by @obj.
*
* Return value: (transfer none): the #DbModel
**/
DbModel * vn_grid_get_model (VnGrid * obj)
static gboolean vn_grid_move_iter (VnGrid * self, DbIter * iter)
{
g_return_val_if_fail (VN_IS_GRID (obj), NULL);
g_return_val_if_fail (VN_IS_GRID (self), FALSE);
return obj->model;
if (self->iter && db_iter_compare (self->iter, iter))
return FALSE;
if (self->iter && self->mode != DB_ITERATOR_MODE_ON_DEMAND)
{
if (db_model_get_row_operations (self->model, self->iter) == DB_MODEL_ROW_OP_INSERT)
db_model_reverse_operations (self->model);
db_model_perform_operations (self->model, FALSE);
}
vn_grid_set_iter (self, iter);
return TRUE;
}
static GList * vn_grid_get_param_list (VnGrid * self)
{
g_return_val_if_fail (VN_IS_GRID (self), NULL);
return self->params;
}
static void vn_grid_delete_selection (VnGrid * self)
{
GtkTreeModel * tree_model;
GtkTreeSelection * selection;
GList * selected, * l;
g_return_val_if_fail (VN_IS_GRID (self), NULL);
if (!self->model)
return;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self));
selected = gtk_tree_selection_get_selected_rows (selection, NULL);
tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
for (l = selected; l; l = l->next)
{
DbIter iter;
GtkTreeIter tree_iter;
gtk_tree_model_get_iter (tree_model, &tree_iter, l->data);
vn_gtk_tree_iter_to_db_iter (&tree_iter, &iter);
db_model_delete (self->model, &iter);
}
g_list_free_full (selected, (GDestroyNotify) gtk_tree_path_free);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Properties
typedef enum
{
PROP_ITERATOR = 1
PROP_MODEL = 1
,PROP_MODE
,PROP_REMEMBER_SELECTION
}
VnGridProp;
static void vn_grid_set_property (VnGrid * obj, guint id,
static void vn_grid_set_property (VnGrid * self, guint id,
const GValue * value, GParamSpec * pspec)
{
switch (id)
{
case PROP_ITERATOR:
vn_grid_set_iterator (obj, g_value_get_object (value));
case PROP_MODEL:
vn_grid_set_model (self, g_value_get_object (value));
break;
case PROP_MODE:
vn_grid_set_mode (self, g_value_get_enum (value));
break;
case PROP_REMEMBER_SELECTION:
self->remember_selection = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
G_OBJECT_WARN_INVALID_PROPERTY_ID (self, id, pspec);
}
}
static void vn_grid_get_property (VnGrid * obj, guint id,
static void vn_grid_get_property (VnGrid * self, guint id,
GValue * value, GParamSpec * pspec)
{
switch (id)
{
case PROP_ITERATOR:
g_value_set_object (value, obj->iterator);
case PROP_MODEL:
g_value_set_object (value, self->model);
break;
case PROP_MODE:
g_value_set_enum (value, self->mode);
break;
case PROP_REMEMBER_SELECTION:
g_value_set_boolean (value, self->remember_selection);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, id, pspec);
G_OBJECT_WARN_INVALID_PROPERTY_ID (self, id, pspec);
}
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
static void vn_grid_init (VnGrid * obj)
static void vn_grid_init (VnGrid * self)
{
GtkTreeSelection * selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj));
obj->iterator = NULL;
obj->model = NULL;
GtkTreeSelection * selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self));
self->mode = 0;
self->iter = 0;
self->row = 0;
self->params = NULL;
self->model = NULL;
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
g_signal_connect (selection, "changed",
G_CALLBACK (vn_grid_on_selection_changed), obj);
g_object_connect (obj
,"signal::notify::model", vn_grid_on_model_changed, obj
,"signal::key-press-event", vn_grid_on_cursor_key_pressed, obj
,"signal::key-press-event", vn_grid_on_escape_pressed, obj
,"signal-after::cursor-changed", vn_grid_on_cursor_changed, obj
g_signal_connect (self, "notify::model", G_CALLBACK (vn_grid_on_model_changed), NULL);
g_object_connect (self
,"signal-after::cursor-changed", vn_grid_on_cursor_changed, NULL
,"signal::key-press-event", vn_grid_on_key_pressed, NULL
,NULL
);
}
static void vn_grid_finalize (VnGrid * obj)
static void vn_grid_finalize (VnGrid * self)
{
vn_grid_set_iterator (obj, NULL);
GList * n;
G_OBJECT_CLASS (vn_grid_parent_class)->finalize (G_OBJECT (obj));
for (n = self->params; n; n = n->next)
g_object_weak_unref (n->data,
(GWeakNotify) vn_grid_unref_param, self);
g_list_free (self->params);
db_iter_free (self->iter);
self->iter = NULL;
if (self->model)
{
g_object_disconnect (self->model
,"any_signal", vn_grid_on_model_line_inserted, self
,"any_signal", vn_grid_on_model_line_updated_after, self
,"any_signal", vn_grid_on_model_line_deleted, self
,"any_signal", vn_grid_on_model_line_deleted_after, self
,"any_signal", vn_grid_on_model_lines_reordered, self
,"any_signal", vn_grid_on_model_status_changed, self
,"any_signal", vn_grid_on_model_operations_done, self
,NULL
);
g_object_unref (self->model);
}
G_OBJECT_CLASS (vn_grid_parent_class)->finalize (G_OBJECT (self));
}
static void vn_grid_class_init (VnGridClass * k)
static void vn_grid_class_init (VnGridClass * klass)
{
GObjectClass * klass = G_OBJECT_CLASS (k);
klass->set_property = (GObjectSetPropertyFunc) vn_grid_set_property;
klass->get_property = (GObjectGetPropertyFunc) vn_grid_get_property;
klass->finalize = (GObjectFinalizeFunc) vn_grid_finalize;
GObjectClass * k = G_OBJECT_CLASS (klass);
k->set_property = (GObjectSetPropertyFunc) vn_grid_set_property;
k->get_property = (GObjectGetPropertyFunc) vn_grid_get_property;
k->finalize = (GObjectFinalizeFunc) vn_grid_finalize;
g_object_class_install_property (klass, PROP_ITERATOR,
g_param_spec_object ("iterator"
,_("Iterator")
,_("The iterator used by VnGrid")
,DB_TYPE_ITERATOR
,G_PARAM_READWRITE
));
g_object_class_override_property (k, PROP_MODEL, "data-model");
g_object_class_override_property (k, PROP_MODE, "mode");
g_object_class_override_property (k, PROP_REMEMBER_SELECTION, "remember-selection");
}
static void vn_grid_model_holder_init (DbModelHolderInterface * iface)
{
iface->get_model = (DbModelHolderGetModelFunc) vn_grid_get_model;
iface->set_model = (DbModelHolderSetModelFunc) vn_grid_set_model;
}
static void vn_grid_iterator_init (DbIteratorInterface * iface)
{
iface->get_mode = (DbIteratorGetMode) vn_grid_get_mode;
iface->set_mode = (DbIteratorSetMode) vn_grid_set_mode;
iface->get_row = (DbIteratorGetRow) vn_grid_get_row;
iface->get_iter = (DbIteratorGetIter) vn_grid_get_iter;
iface->set_iter = (DbIteratorSetIter) vn_grid_set_iter;
iface->move_iter = (DbIteratorMoveIter) vn_grid_move_iter;
iface->get_param_list = (DbIteratorGetParamList) vn_grid_get_param_list;
iface->delete_selection = (DbIteratorDeleteSelection) vn_grid_delete_selection;
}

View File

@ -24,11 +24,11 @@
#include "vn-column.h"
#define VN_TYPE_GRID (vn_grid_get_type ())
#define VN_GRID(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, VN_TYPE_GRID, VnGrid))
#define VN_IS_GRID(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, VN_TYPE_GRID))
#define VN_GRID(self) (G_TYPE_CHECK_INSTANCE_CAST (self, VN_TYPE_GRID, VnGrid))
#define VN_IS_GRID(self) (G_TYPE_CHECK_INSTANCE_TYPE (self, VN_TYPE_GRID))
#define VN_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, VN_TYPE_GRID, VnGridClass))
#define VN_IS_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE (klass, VN_TYPE_GRID))
#define VN_GRID_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, VN_TYPE_GRID, VnGridClass))
#define VN_GRID_GET_CLASS(self) (G_TYPE_INSTANCE_GET_CLASS (self, VN_TYPE_GRID, VnGridClass))
typedef struct _VnGrid VnGrid;
typedef struct _VnGridClass VnGridClass;
@ -36,8 +36,12 @@ typedef struct _VnGridClass VnGridClass;
struct _VnGrid
{
GtkTreeView parent;
DbIterator * iterator;
DbIter * iter;
gint row;
GList * params;
DbModel * model;
DbIteratorMode mode;
gboolean remember_selection;
};
struct _VnGridClass
@ -48,9 +52,5 @@ struct _VnGridClass
GType vn_grid_get_type ();
VnGrid * vn_grid_new ();
VnGrid * vn_grid_new_with_iterator (DbIterator * iterator);
DbIterator * vn_grid_get_iterator (VnGrid * obj);
void vn_grid_set_iterator (VnGrid * obj, DbIterator * iterator);
DbModel * vn_grid_get_model (VnGrid * obj);
#endif

View File

@ -20,6 +20,8 @@
#include "vn-gui.h"
// Window signal Callbacks
VnWindow * vn_gui_add_window (VnGui * obj, VnWindow * window);
gboolean vn_gui_on_last_window_deleted (GtkWidget * widget, GdkEvent * event, VnWindow * window);
@ -31,4 +33,6 @@ void vn_gui_on_switch_page (GtkNotebook * notebook, VnForm * form, guint num, Vn
void vn_gui_on_page_removed (GtkNotebook * notebook, GtkWidget * page, guint num, VnWindow * window);
void vn_gui_on_page_added (GtkNotebook * notebook, GtkWidget * page, guint num, VnWindow * window);
void vn_gui_logout (VnGui * obj, gboolean exit);
#endif

View File

@ -36,24 +36,10 @@
* @Short_description: GUI manager
* @Title: VnGui
*
* Manages most of the GUI operations.
* Manages most of the main GUI operations.
**/
G_DEFINE_TYPE (VnGui, vn_gui, G_TYPE_OBJECT);
struct _VnWindow
{
VnGui * obj;
GtkWindow * widget;
GtkDialog * about;
GtkHeaderBar * header;
GtkWidget * menu_button;
GtkWidget * spinner;
GtkNotebook * notebook;
VnForm * active_form;
guint merge_id;
gboolean maximized;
};
enum {
COL_ICON
,COL_NAME
@ -89,8 +75,6 @@ void vn_gui_on_open_form_activated (GSimpleAction * action, GVariant * v, gpoint
static void vn_gui_reconnect (VnGui * obj);
static void vn_gui_on_conn_error (DbConn * conn, const GError * error, VnGui * obj);
static void vn_gui_on_conn_status_changed (DbConn * conn, DbConnStatus status, VnGui * obj);
void vn_gui_on_window_destroyed (GtkWindow * widget, VnWindow * window);
void vn_gui_on_page_removed (GtkNotebook * notebook, GtkWidget * page, guint num, VnWindow * window);
static guint signals[LAST_SIGNAL] = {0};
@ -455,12 +439,12 @@ static void vn_gui_set_menu_accels (VnGui * obj, GMenuModel * menu, gboolean ena
VnWindow * vn_gui_add_window (VnGui * obj, VnWindow * window)
{
gchar * user = db_conn_get_user (obj->conn);
GSList * n;
GtkWidget * button;
GtkWindow * widget = window->widget;
window->active_form = NULL;
window->merge_id = 0;
obj->windows = g_slist_prepend (obj->windows, window);
@ -473,8 +457,9 @@ VnWindow * vn_gui_add_window (VnGui * obj, VnWindow * window)
window->header = g_object_new (GTK_TYPE_HEADER_BAR
,"show-close-button", TRUE
,"title", obj->app_title
,"subtitle", db_conn_get_user (obj->conn)
,"subtitle", user
,NULL);
g_free (user);
gtk_window_set_titlebar (widget, GTK_WIDGET (window->header));
button = gtk_menu_button_new ();
@ -518,10 +503,24 @@ VnWindow * vn_gui_add_window (VnGui * obj, VnWindow * window)
/*
* Shows an error dialog.
*/
static void vn_gui_show_error (VnGui * obj, const GError * error)
static gboolean vn_gui_show_error_idle (VnGui * obj)
{
static gboolean stop;
GError * error = g_queue_pop_head (obj->errors);
if (!error)
{
obj->showing_error = FALSE;
stop = FALSE;
return G_SOURCE_REMOVE;
}
if (!stop)
{
gint response_id;
GtkWidget * dialog;
GtkWindow * window = obj->active_window ? obj->active_window->widget : NULL;
GtkWindow * window = obj->active_window ?
obj->active_window->widget : NULL;
if (error && error->code == DB_CONN_ERROR_LOST)
dialog = gtk_message_dialog_new (window
@ -547,10 +546,34 @@ static void vn_gui_show_error (VnGui * obj, const GError * error)
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("Unknown error"));
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
gtk_dialog_add_button (GTK_DIALOG (dialog)
,_("Colse all")
,GTK_RESPONSE_REJECT);
response_id = gtk_dialog_run (GTK_DIALOG (dialog));
if (response_id == GTK_RESPONSE_YES)
vn_gui_reconnect (obj);
else if (response_id == GTK_RESPONSE_REJECT)
stop = TRUE;
gtk_widget_destroy (GTK_WIDGET (dialog));
}
g_error_free (error);
return G_SOURCE_CONTINUE;
}
static void vn_gui_collect_error (VnGui * obj, const GError * error)
{
GError * e = g_error_copy (error);
g_queue_push_tail (obj->errors, e);
if (!obj->showing_error)
{
obj->showing_error = TRUE;
g_idle_add ((GSourceFunc) vn_gui_show_error_idle, obj);
}
}
/*
@ -586,7 +609,7 @@ static void vn_gui_close (VnGui * obj)
static gboolean vn_gui_reconnect_idle (GuiData * gui_data)
{
if (!gui_data->aux)
vn_gui_show_error (gui_data->obj, gui_data->error);
vn_gui_collect_error (gui_data->obj, gui_data->error);
return G_SOURCE_REMOVE;
}
@ -630,7 +653,7 @@ static gboolean vn_gui_logout_idle (GuiData * gui_data)
}
/*
* Thread function that tryes to close the connection asynchronously.
* Thread function that tries to close the connection asynchronously.
*/
static void vn_gui_logout_thread (GuiData * gui_data)
{
@ -667,19 +690,13 @@ static void vn_gui_hide_form (VnWindow * window)
actions[i].name);
if (menu)
vn_gui_set_menu_accels (window->obj, menu, FALSE);
vn_gui_set_menu_accels (window->gui, menu, FALSE);
gtk_widget_hide (window->menu_button);
window->active_form = NULL;
}
}
static void vn_gui_set_show_tabs (VnWindow * window)
{
gtk_notebook_set_show_tabs (window->notebook,
gtk_notebook_get_n_pages (window->notebook) > 1);
}
//--------------------------------------------------- Window handlers
/*
@ -687,7 +704,7 @@ static void vn_gui_set_show_tabs (VnWindow * window)
*/
gboolean vn_gui_on_last_window_deleted (GtkWidget * widget, GdkEvent * event, VnWindow * window)
{
VnGui * obj = window->obj;
VnGui * obj = window->gui;
if (obj->windows->next)
return FALSE;
@ -711,7 +728,7 @@ void vn_gui_on_window_destroyed (GtkWindow * widget, VnWindow * window)
*/
gboolean vn_gui_on_window_focused (GtkWidget * widget, GdkEvent * event, VnWindow * window)
{
window->obj->active_window = window;
window->gui->active_window = window;
return FALSE;
}
@ -737,7 +754,7 @@ void vn_gui_on_switch_page (GtkNotebook * notebook, VnForm * form, guint num, Vn
{
GtkTreeIter * iter;
GMenuModel * menu;
VnGui * obj = window->obj;
VnGui * obj = window->gui;
vn_gui_hide_form (window);
window->active_form = form;
@ -780,16 +797,16 @@ void vn_gui_on_page_removed (GtkNotebook * notebook,
{
if (gtk_notebook_get_n_pages (notebook) < 1)
{
if (!window->obj->windows->next)
if (!window->gui->windows->next)
{
vn_gui_hide_form (window);
gtk_header_bar_set_title (window->header, window->obj->app_title);
gtk_header_bar_set_title (window->header, window->gui->app_title);
}
else
gtk_widget_destroy (GTK_WIDGET (window->widget));
}
vn_gui_set_show_tabs (window);
vn_window_set_show_tabs (window);
}
/*
@ -798,7 +815,7 @@ void vn_gui_on_page_removed (GtkNotebook * notebook,
void vn_gui_on_page_added (GtkNotebook * notebook, GtkWidget * page, guint num,
VnWindow * window)
{
vn_gui_set_show_tabs (window);
vn_window_set_show_tabs (window);
}
//--------------------------------------------------- Action handlers
@ -809,7 +826,7 @@ void vn_gui_on_page_added (GtkNotebook * notebook, GtkWidget * page, guint num,
void vn_gui_on_open_form_activated (GSimpleAction * a, GVariant * p, gpointer obj)
{
VnWindow * window = obj;
vn_gui_open_form_at_window (window->obj, g_variant_get_string (p, NULL), window);
vn_gui_open_form_at_window (window->gui, g_variant_get_string (p, NULL), window);
}
/*
@ -860,10 +877,10 @@ void vn_gui_on_exit_activated (GSimpleAction * a, GVariant * v, gpointer obj)
void vn_gui_on_close_tab_activated (GSimpleAction * a, GVariant * v, gpointer w)
{
VnWindow * window = w;
VnGui * obj = window->obj;
VnGui * obj = window->gui;
if (window->active_form)
vn_gui_close_form (window->obj, window->active_form);
vn_gui_close_form (window->gui, window->active_form);
else if (!obj->windows->next)
vn_gui_logout (obj, TRUE);
else
@ -877,7 +894,7 @@ void vn_gui_on_close_tab_activated (GSimpleAction * a, GVariant * v, gpointer w)
*/
static void vn_gui_on_conn_error (DbConn * conn, const GError * error, VnGui * obj)
{
vn_gui_show_error (obj, error);
vn_gui_collect_error (obj, error);
}
/*
@ -961,8 +978,7 @@ void vn_gui_open (VnGui * obj)
if (mod_menu)
{
g_menu_prepend_submenu (section,
g_strdup (vn_mod_get_title (mod)), mod_menu);
g_menu_prepend_submenu (section, vn_mod_get_title (mod), mod_menu);
g_object_unref (mod_menu);
}
}
@ -1108,12 +1124,8 @@ VnForm * vn_gui_open_form_at_window (VnGui * obj, const gchar * form_name, VnWin
gchar * title;
VnMod * module;
GType form_type;
GtkBox * hbox;
GtkWidget * form;
GtkWidget * widget;
GtkWidget * button;
GtkTreeIter * iter;
GtkNotebook * notebook = NULL;
g_return_val_if_fail (VN_IS_GUI (obj), NULL);
@ -1141,34 +1153,11 @@ VnForm * vn_gui_open_form_at_window (VnGui * obj, const gchar * form_name, VnWin
);
vn_form_open (VN_FORM (form));
hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5));
widget = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
gtk_box_pack_start (hbox, widget, FALSE, FALSE, 0);
widget = gtk_label_new (title);
gtk_box_pack_start (hbox, widget, TRUE, TRUE, 0);
button = gtk_button_new ();
g_signal_connect (button, "clicked",
G_CALLBACK (vn_gui_close_form), form);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_box_pack_start (hbox, button, FALSE, FALSE, 0);
widget = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
gtk_button_set_image (GTK_BUTTON (button), widget);
if (!window)
window = obj->active_window;
notebook = window->notebook;
gtk_notebook_set_current_page (notebook,
gtk_notebook_append_page (notebook, form, GTK_WIDGET (hbox)));
gtk_notebook_set_tab_detachable (notebook, form, TRUE);
gtk_notebook_set_tab_reorderable (notebook, form, TRUE);
gtk_container_child_set (GTK_CONTAINER (notebook), form,
"tab-expand", TRUE, NULL);
gtk_widget_show_all (GTK_WIDGET (hbox));
vn_window_add_form (window, icon, title, form);
gtk_widget_show (form);
g_free (icon);
@ -1371,6 +1360,10 @@ static void vn_gui_init (VnGui * obj)
,G_TYPE_GTYPE // COL_TYPE
,G_TYPE_OBJECT // COL_MODULE
);
obj->errors = g_queue_new ();
obj->showing_error = FALSE;
// obj->err_handler = g_idle_add ((GSourceFunc) vn_gui_show_error_idle, obj);
}
static void vn_gui_finalize (VnGui * obj)
@ -1387,6 +1380,10 @@ static void vn_gui_finalize (VnGui * obj)
g_strfreev (obj->data_dirs);
g_free (obj->config_file);
g_free (obj->app_title);
g_queue_free (obj->errors);
g_source_remove (obj->err_handler);
G_OBJECT_CLASS (vn_gui_parent_class)->finalize (G_OBJECT (obj));
}

View File

@ -52,9 +52,13 @@ struct _VnGui
GtkTreeStore * tree;
GMenuModel * main_menu;
GHashTable * forms;
GSList * windows;
GSList * modules;
GHashTable * forms;
GQueue * errors;
gboolean showing_error;
guint err_handler;
gchar * config_file;
gchar ** lib_dirs;

View File

@ -181,6 +181,8 @@ static void action_group_set_enabled (GActionGroup * group, gboolean enabled)
GAction * a = g_action_map_lookup_action (G_ACTION_MAP (group), actions[i]);
g_simple_action_set_enabled (G_SIMPLE_ACTION (a), enabled);
}
g_strfreev (actions);
}
static void vn_handler_on_status_changed (DbIterator * iterator, gboolean ready, VnHandler * obj)
@ -311,6 +313,8 @@ void vn_handler_set_show_flags (VnHandler * obj, VnHandlerShowFlags show_flags)
l = l->next;
}
g_list_free (list);
if (obj->show_flags & VN_HANDLER_SHOW_ADD)
obj->add = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (obj->group), "add"));
@ -403,7 +407,7 @@ void vn_handler_set_simple_record (VnHandler * obj, gboolean simple)
enum
{
PROP_FORM = 1
PROP_ITERATOR = 1
,PROP_SHOW_FLAGS
,PROP_SIMPLE_RECORD
};
@ -413,7 +417,7 @@ static void vn_handler_set_property (VnHandler * obj, guint id,
{
switch (id)
{
case PROP_FORM:
case PROP_ITERATOR:
vn_handler_set_iterator (obj, g_value_get_object (value));
break;
case PROP_SHOW_FLAGS:
@ -432,7 +436,7 @@ static void vn_handler_get_property (VnHandler * obj, guint id,
{
switch (id)
{
case PROP_FORM:
case PROP_ITERATOR:
g_value_set_object (value, obj->iterator);
break;
case PROP_SHOW_FLAGS:
@ -506,6 +510,8 @@ static void vn_handler_init (VnHandler * obj)
static void vn_handler_finalize (VnHandler * obj)
{
vn_handler_set_iterator (obj, NULL);
g_object_unref (obj->group);
G_OBJECT_CLASS (vn_handler_parent_class)->finalize (G_OBJECT (obj));
}
@ -516,7 +522,7 @@ static void vn_handler_class_init (VnHandlerClass * klass)
k->set_property = (GObjectSetPropertyFunc) vn_handler_set_property;
k->get_property = (GObjectGetPropertyFunc) vn_handler_get_property;
g_object_class_install_property (k, PROP_FORM,
g_object_class_install_property (k, PROP_ITERATOR,
g_param_spec_object ("iterator"
,"Iterator"
,"The handled iterator"

View File

@ -17,6 +17,8 @@
#include "vn-login.h"
#include "vn-set.h"
#include "vn-gui-private.h"
#include <glib-unix.h>
#define LOGIN_UI _GUI_DIR"/login.glade"
#define CONFIG_DB _VN_CONFIG_DIR"/config.db"
@ -37,6 +39,8 @@ ConnectData;
void vn_login_on_gui_logout (VnGui * gui, VnLogin * self);
void vn_login_on_gui_exit (VnGui * gui, VnLogin * self);
static gboolean vn_login_on_signal (VnLogin * self);
G_DEFINE_TYPE (VnLogin, vn_login, G_TYPE_OBJECT);
/**
@ -48,7 +52,13 @@ G_DEFINE_TYPE (VnLogin, vn_login, G_TYPE_OBJECT);
**/
VnLogin * vn_login_new (GtkApplication * application)
{
return g_object_new (VN_TYPE_LOGIN, "application", application, NULL);
VnLogin * login = g_object_new (VN_TYPE_LOGIN, "application", application, NULL);
g_unix_signal_add (SIGINT, (GSourceFunc) vn_login_on_signal, login);
g_unix_signal_add (SIGTERM, (GSourceFunc) vn_login_on_signal, login);
g_unix_signal_add (SIGHUP, (GSourceFunc) vn_login_on_signal, login);
return login;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
@ -122,7 +132,7 @@ static void vn_login_load (VnLogin * self)
self->settings_dialog = BUILDER_GET (self->builder, "settings-dialog");
self->login_data = BUILDER_GET (self->builder, "iterator-login");
self->last_conn = BUILDER_GET (self->builder, "iterator-last-conn");
self->connections = BUILDER_GET (self->builder, "iterator-connections");
self->connections = BUILDER_GET (self->builder, "connections-grid");
self->settings_button = BUILDER_GET (self->builder, "settings-button");
gtk_builder_connect_signals (self->builder, self);
@ -270,6 +280,38 @@ void vn_login_on_server_changed (DbIterator * iterator, VnLogin * self)
gtk_button_clicked (self->connect);
}
/*
* Handles the SIGHUP, SIGTERM and SIGINT signals, closing normally.
*/
static gboolean vn_login_on_signal (VnLogin * self)
{
g_warning ("Signal received.");
if (self->gui)
vn_gui_logout (self->gui, TRUE);
else
gtk_widget_destroy (GTK_WIDGET (self->window));
return G_SOURCE_REMOVE;
}
/*
* Closes the login window when Escape is pressed.
*/
gboolean vn_login_on_key_pressed (GtkWidget * window, GdkEventKey * event, VnLogin * self)
{
if (event->type == GDK_KEY_PRESS
&& (event->keyval == GDK_KEY_Escape
|| ((event->keyval == GDK_KEY_q || event->keyval == GDK_KEY_Q)
&& (event->state & GDK_CONTROL_MASK))))
{
gtk_widget_destroy (window);
return TRUE;
}
return FALSE;
}
/*
* Closes the application when login window is destroyed.
*/

View File

@ -74,7 +74,7 @@ void vn_set_remove (VnSet * obj, GObject * child)
* to do further use of the list of objects.
*
* Return value: (transfer container) (element-type GObject): a #GList with all
* the objects, that must be freed with #g_list_free
* the objects which must be freed with #g_list_free
**/
GList * vn_set_get_objects_list (VnSet * obj)
{
@ -90,7 +90,7 @@ GList * vn_set_get_objects_list (VnSet * obj)
* Returns all the #GObject<!-- -->s in @obj.
*
* Return value: (transfer none) (element-type GObject): a #GList with all
* the objects, that must not be freed
* the objects which must not be freed
**/
const GList * vn_set_get_objects (VnSet * obj)
{

View File

@ -75,6 +75,48 @@ VnWindow * vn_window_new (VnGui * gui, gint x, gint y)
return self;
}
void vn_window_add_form (VnWindow * window, const gchar * icon, const gchar * title, GtkWidget * form)
{
GtkBox * hbox;
GtkWidget * widget, * button;
GtkNotebook * notebook;
g_return_if_fail (VN_IS_WINDOW (window));
hbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5));
widget = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_MENU);
gtk_box_pack_start (hbox, widget, FALSE, FALSE, 0);
widget = gtk_label_new (title);
gtk_box_pack_start (hbox, widget, TRUE, TRUE, 0);
button = gtk_button_new ();
g_signal_connect (button, "clicked",
G_CALLBACK (vn_gui_close_form), form);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_box_pack_start (hbox, button, FALSE, FALSE, 0);
widget = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
gtk_button_set_image (GTK_BUTTON (button), widget);
notebook = window->notebook;
gtk_notebook_set_current_page (notebook,
gtk_notebook_append_page (notebook, form, GTK_WIDGET (hbox)));
gtk_notebook_set_tab_detachable (notebook, form, TRUE);
gtk_notebook_set_tab_reorderable (notebook, form, TRUE);
gtk_container_child_set (GTK_CONTAINER (notebook), form,
"tab-expand", TRUE, NULL);
gtk_widget_show_all (GTK_WIDGET (hbox));
}
void vn_window_set_show_tabs (VnWindow * window)
{
gtk_notebook_set_show_tabs (window->notebook,
gtk_notebook_get_n_pages (window->notebook) > 1);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Class
static void vn_window_init (VnWindow * self)

View File

@ -55,5 +55,7 @@ struct _VnWindowClass
GType vn_window_get_type ();
VnWindow * vn_window_new (VnGui * gui, gint x, gint y);
void vn_window_set_show_tabs (VnWindow * window);
void vn_window_add_form (VnWindow * window, const gchar * icon, const gchar * title, GtkWidget * form);
#endif