El VnGrid es navegable con Tab y Shift + Tab
Cambios en los archivos de pkg-config
This commit is contained in:
parent
642c9bb807
commit
cfb0bcea3f
|
@ -96,7 +96,6 @@ AC_CONFIG_FILES([
|
|||
module/data/Makefile
|
||||
main/Makefile
|
||||
main/vn-hedera.desktop
|
||||
main/vn-hedera-debug.desktop
|
||||
vapi/Makefile
|
||||
glade/Makefile
|
||||
docs/Makefile
|
||||
|
|
|
@ -499,7 +499,7 @@ void db_file_loader_download (DbFileLoader * obj,
|
|||
|
||||
if (!obj->priv->pool)
|
||||
obj->priv->pool = g_thread_pool_new ((GFunc) db_file_loader_thread_download,
|
||||
obj, 5, FALSE, NULL);
|
||||
obj, 2, FALSE, NULL);
|
||||
|
||||
file = file_new (obj, path, NULL, func, user_data, TRUE);
|
||||
g_hash_table_add (obj->priv->downloading, file);
|
||||
|
@ -539,7 +539,7 @@ void db_file_loader_upload (DbFileLoader * obj,
|
|||
//TODO? create a pool only for uploads
|
||||
if (!obj->priv->pool)
|
||||
obj->priv->pool = g_thread_pool_new ((GFunc) db_file_loader_thread_upload,
|
||||
obj, 3, TRUE, NULL);
|
||||
obj, 2, TRUE, NULL);
|
||||
|
||||
file = file_new (obj, path, data, func, user_data, TRUE);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@/hedera
|
||||
includedir=@includedir@/hedera
|
||||
libdir=@libdir@/@PACKAGE@
|
||||
includedir=@includedir@/@PACKAGE@
|
||||
|
||||
Name: Db
|
||||
Description: Database Access Module for Hedera Library
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<glade-catalog name="vn" library="gladevn" since="1.0" domain="glade3" depends="gtk+" book="hedera">
|
||||
<glade-catalog name="vn" version="1.0" library="gladevn" domain="glade3" depends="gtk+" book="hedera">
|
||||
|
||||
<init-function>glade_vn_init</init-function>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@/hedera
|
||||
includedir=@includedir@/hedera
|
||||
libdir=@libdir@/@PACKAGE@
|
||||
includedir=@includedir@/@PACKAGE@
|
||||
|
||||
Name: Gvn
|
||||
Description: Utility Module for Hedera Library
|
||||
|
|
|
@ -23,8 +23,7 @@ $(hedera_bin_SCRIPTS): $(SCRIPT)
|
|||
pkgconfig_DATA = hedera.pc
|
||||
|
||||
desktop_DATA = \
|
||||
vn-hedera.desktop \
|
||||
vn-hedera-debug.desktop
|
||||
vn-hedera.desktop
|
||||
|
||||
man_MANS = hedera.1
|
||||
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@/hedera
|
||||
includedir=@includedir@/hedera
|
||||
libdir=@libdir@/@PACKAGE@
|
||||
includedir=@includedir@/@PACKAGE@
|
||||
datarootdir=@datarootdir@
|
||||
datadir=@datadir@/@PACKAGE@
|
||||
plugindir=@libdir@/@PACKAGE@/plugin
|
||||
modulelibdir=${libdir}/module
|
||||
moduledatadir=${datadir}/module
|
||||
modulequerydir=${moduledatadir}/sql
|
||||
|
||||
Name: Hedera
|
||||
Description: The Hedera Library
|
||||
Description: Hedera database access Library
|
||||
Version: @VERSION@
|
||||
Requires: gtk+-3.0 gvn sql db vn
|
||||
Libs: -L${libdir}
|
||||
Libs: -Wl,-R${libdir}
|
||||
Cflags: -I${includedir}
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
UPDATE=1
|
||||
DISABLE_UPDATER=0
|
||||
CONFIG_FILE=$HOME/.config/hedera/config.sh
|
||||
|
||||
if [ -x $CONFIG_FILE ]
|
||||
then
|
||||
. $CONFIG_FILE
|
||||
fi
|
||||
|
||||
while getopts ":u" OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
u)
|
||||
UPDATE=0
|
||||
DISABLE_UPDATER=1
|
||||
;;
|
||||
\?|:)
|
||||
echo "Usage: hedera [-u]"
|
||||
|
@ -15,7 +21,7 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
if [ "$UPDATE" -eq "1" -a -x @bindir@/vn-updater-gui ]
|
||||
if [ "$DISABLE_UPDATER" -eq "0" -a -x @bindir@/vn-updater-gui ]
|
||||
then
|
||||
echo "Running updater..."
|
||||
@bindir@/vn-updater-gui
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=Development Hedera
|
||||
GenericName=Office Tool
|
||||
Comment=Runtime for the Hedera system (Development)
|
||||
Exec=hedera -u
|
||||
Icon=@prefix@/share/@PACKAGE@/vn/image/icon-debug.svg
|
||||
Terminal=true
|
||||
Type=Application
|
||||
Categories=GNOME;GTK;Development;
|
||||
StartupNotify=true
|
||||
Version=@VERSION@
|
|
@ -50,7 +50,7 @@ void vn_consulter_multisend_clicked (GtkButton * button, VnConsulter * obj)
|
|||
if (vn_grid_get_model (obj->grid))
|
||||
{
|
||||
if (!obj->source)
|
||||
obj->source = g_timeout_add (100, (GSourceFunc) idle_sender, obj);
|
||||
obj->source = g_timeout_add (50, (GSourceFunc) idle_sender, obj);
|
||||
else if (g_source_remove (obj->source))
|
||||
obj->source = 0;
|
||||
}
|
||||
|
@ -200,6 +200,9 @@ static void vn_consulter_open (VnConsulter * obj)
|
|||
gint i;
|
||||
VnForm * form = VN_FORM (obj);
|
||||
|
||||
obj->file = g_strconcat
|
||||
(FILE_KW, vn_mod_get_name (form->mod), "/consulter", NULL);
|
||||
|
||||
gchar * queries[] =
|
||||
{
|
||||
//MySQL (kk schema)
|
||||
|
@ -214,7 +217,7 @@ static void vn_consulter_open (VnConsulter * obj)
|
|||
"FROM item i LEFT JOIN movement m ON i.id = m.item_id"
|
||||
,"/*pg*/SELECT m.id, amount, item_id, name, color "
|
||||
"FROM movement m JOIN item ON m.item_id = item.id"
|
||||
,FILE_KW"example/consulter"
|
||||
,obj->file
|
||||
,"/*pg*/ SELECT id1, id2, name, ok, date, number, floating, image "
|
||||
"FROM prueben"
|
||||
,NULL
|
||||
|
@ -243,7 +246,13 @@ static void vn_consulter_init (VnConsulter * obj)
|
|||
obj->source = 0;
|
||||
}
|
||||
|
||||
static void vn_consulter_finalize (VnConsulter * obj)
|
||||
{
|
||||
g_free (obj->file);
|
||||
}
|
||||
|
||||
static void vn_consulter_class_init (VnConsulterClass * k)
|
||||
{
|
||||
G_OBJECT_CLASS (k)->finalize = (GObjectFinalizeFunc) vn_consulter_finalize;
|
||||
VN_FORM_CLASS (k)->open = (VnFormOpenFunc) vn_consulter_open;
|
||||
}
|
||||
|
|
|
@ -36,8 +36,9 @@ struct _VnConsulter
|
|||
GtkTreeView * tv;
|
||||
VnGrid * grid;
|
||||
VnHandler * handler;
|
||||
|
||||
guint source;
|
||||
|
||||
gchar * file;
|
||||
guint source;
|
||||
};
|
||||
|
||||
struct _VnConsulterClass
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
G_DEFINE_ABSTRACT_TYPE (VnColumn, vn_column, GTK_TYPE_TREE_VIEW_COLUMN);
|
||||
|
||||
static GdkRGBA vn_column_red;
|
||||
static GdkRGBA vn_column_green;
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
|
||||
|
||||
static void vn_column_value_changed (VnColumn * obj, const gchar * path, const GValue * value)
|
||||
|
@ -50,9 +53,9 @@ static void vn_column_data_func (GtkTreeViewColumn * col, GtkCellRenderer * cell
|
|||
);
|
||||
|
||||
if (ops & DB_MODEL_ROW_OP_DELETE)
|
||||
background = obj->red;
|
||||
background = &vn_column_red;
|
||||
else if (ops & DB_MODEL_ROW_OP_INSERT || ops & DB_MODEL_ROW_OP_UPDATE)
|
||||
background = obj->green;
|
||||
background = &vn_column_green;
|
||||
else
|
||||
background = NULL;
|
||||
|
||||
|
@ -358,17 +361,10 @@ static void vn_column_init (VnColumn * obj)
|
|||
{
|
||||
obj->column_index = -1;
|
||||
obj->column_name = NULL;
|
||||
obj->red = g_new (GdkRGBA, 1);
|
||||
gdk_rgba_parse (obj->red, "#fcc");
|
||||
obj->green = g_new (GdkRGBA, 1);
|
||||
gdk_rgba_parse (obj->green, "#cfc");
|
||||
}
|
||||
|
||||
static void vn_column_finalize (VnColumn * obj)
|
||||
{
|
||||
gdk_rgba_free (obj->red);
|
||||
gdk_rgba_free (obj->green);
|
||||
|
||||
G_OBJECT_CLASS (vn_column_parent_class)->finalize (G_OBJECT (obj));
|
||||
}
|
||||
|
||||
|
@ -382,6 +378,9 @@ static void vn_column_class_init (VnColumnClass * klass)
|
|||
klass->set_renderer = vn_column_set_renderer;
|
||||
klass->model_changed = NULL;
|
||||
|
||||
gdk_rgba_parse (&vn_column_red, "#fcc");
|
||||
gdk_rgba_parse (&vn_column_green, "#cfc");
|
||||
|
||||
g_object_class_install_property (k, PROP_COLUMN_INDEX,
|
||||
g_param_spec_int ("column-index"
|
||||
,_("Column index")
|
||||
|
|
|
@ -47,8 +47,6 @@ struct _VnColumn
|
|||
gchar * column_name;
|
||||
gboolean editable;
|
||||
gboolean null;
|
||||
GdkRGBA * red;
|
||||
GdkRGBA * green;
|
||||
VnColumnSetValueFunc set_value;
|
||||
};
|
||||
|
||||
|
|
131
vn/vn-grid.c
131
vn/vn-grid.c
|
@ -99,7 +99,7 @@ static void vn_grid_on_model_changed (VnGrid * obj, GParamSpec * spec, gpointer
|
|||
if (VN_IS_COLUMN (n->data))
|
||||
vn_column_model_changed (n->data);
|
||||
|
||||
g_list_free (columns);
|
||||
g_list_free (columns);
|
||||
}
|
||||
|
||||
static void vn_grid_on_status_changed (DbIterator * iterator, gboolean ready, VnGrid * obj)
|
||||
|
@ -118,6 +118,131 @@ static void vn_grid_on_status_changed (DbIterator * iterator, gboolean ready, Vn
|
|||
gtk_tree_view_set_model (GTK_TREE_VIEW (obj), NULL);
|
||||
}
|
||||
|
||||
static gboolean vn_grid_on_cursor_key_pressed (GtkTreeView * obj,
|
||||
GdkEventKey * event, gpointer data)
|
||||
{
|
||||
guint count, i;
|
||||
GList * n, * columns;
|
||||
GtkTreePath * path;
|
||||
GtkTreeViewColumn * col, * next_col = NULL;
|
||||
GtkCellArea * area;
|
||||
|
||||
if (!(event->type == GDK_KEY_PRESS
|
||||
&& (event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_ISO_Left_Tab)))
|
||||
return FALSE;
|
||||
|
||||
gtk_tree_view_get_cursor (obj, &path, &col);
|
||||
|
||||
g_object_get (col, "cell-area", &area, NULL);
|
||||
gtk_cell_editable_editing_done (gtk_cell_area_get_edit_widget (area));
|
||||
g_object_unref (area);
|
||||
|
||||
columns = gtk_tree_view_get_columns (obj);
|
||||
count = gtk_tree_view_get_n_columns (obj);
|
||||
|
||||
if (event->keyval == GDK_KEY_Tab)
|
||||
{
|
||||
i = 0;
|
||||
|
||||
for (n = columns; n; n = n->next, i++)
|
||||
if (n->data == col)
|
||||
{
|
||||
if (n->next && i + 1 < gtk_tree_view_get_n_columns (obj))
|
||||
{
|
||||
if (n->next->data && VN_IS_COLUMN (n->next->data)
|
||||
&& !vn_column_get_editable ((VN_COLUMN (n->next->data))))
|
||||
{
|
||||
col = n->next->data;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
next_col = n->next->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_tree_path_next (path);
|
||||
|
||||
if (VN_IS_COLUMN (columns->data)
|
||||
&& !vn_column_get_editable ((VN_COLUMN (columns->data))))
|
||||
{
|
||||
for (n = columns->next; n; n = n->next)
|
||||
if (n->data && VN_IS_COLUMN (n->data)
|
||||
&& vn_column_get_editable ((VN_COLUMN (n->data))))
|
||||
{
|
||||
next_col = n->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
next_col = columns->data;
|
||||
|
||||
if (gtk_tree_path_get_indices (path)[0] >= db_model_get_nrows
|
||||
(VN_GRID (obj)->model))
|
||||
{
|
||||
gtk_tree_path_free (path);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // Shift + Tab pressed
|
||||
{
|
||||
GList * inv_columns = g_list_last (columns);
|
||||
i = count - 1;
|
||||
|
||||
for (n = inv_columns; n; n = n->prev, i--)
|
||||
if (n->data == col)
|
||||
{
|
||||
if (n->prev && i > 0)
|
||||
{
|
||||
if (n->prev->data && VN_IS_COLUMN (n->prev->data)
|
||||
&& !vn_column_get_editable ((VN_COLUMN (n->prev->data))))
|
||||
{
|
||||
col = n->prev->data;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
next_col = n->prev->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
gint current = gtk_tree_path_get_indices (path)[0];
|
||||
gtk_tree_path_prev (path);
|
||||
|
||||
if (VN_IS_COLUMN (inv_columns->data)
|
||||
&& !vn_column_get_editable ((VN_COLUMN (inv_columns->data))))
|
||||
{
|
||||
for (n = inv_columns->prev; n; n = n->prev)
|
||||
if (n->data && VN_IS_COLUMN (n->data)
|
||||
&& vn_column_get_editable ((VN_COLUMN (n->data))))
|
||||
{
|
||||
next_col = n->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
next_col = inv_columns->data;
|
||||
|
||||
if (current == 0 && gtk_tree_path_get_indices (path)[0] == 0)
|
||||
{
|
||||
gtk_tree_path_free (path);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (columns);
|
||||
gtk_tree_view_set_cursor (obj, path, next_col, TRUE);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
|
||||
|
||||
/**
|
||||
|
@ -335,12 +460,14 @@ static void vn_grid_init (VnGrid * obj)
|
|||
|
||||
g_signal_connect (obj, "notify::model",
|
||||
G_CALLBACK (vn_grid_on_model_changed), NULL);
|
||||
|
||||
g_signal_connect (obj, "key-press-event",
|
||||
G_CALLBACK (vn_grid_on_cursor_key_pressed), NULL);
|
||||
}
|
||||
|
||||
static void vn_grid_finalize (VnGrid * obj)
|
||||
{
|
||||
vn_grid_set_iterator (obj, NULL);
|
||||
g_signal_handlers_disconnect_by_func (obj, vn_grid_on_model_changed, NULL);
|
||||
|
||||
G_OBJECT_CLASS (vn_grid_parent_class)->finalize (G_OBJECT (obj));
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ struct _VnGrid
|
|||
GtkTreeView parent;
|
||||
DbIterator * iterator;
|
||||
DbModel * model;
|
||||
|
||||
};
|
||||
|
||||
struct _VnGridClass
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@/hedera
|
||||
includedir=@includedir@/hedera
|
||||
libdir=@libdir@/@PACKAGE@
|
||||
includedir=@includedir@/@PACKAGE@
|
||||
|
||||
Name: Vn
|
||||
Description: Graphical UI Module for Hedera Library
|
||||
|
|
Reference in New Issue