VnHandler portado a GAction
This commit is contained in:
parent
9a6839a26d
commit
0703b8b81d
|
@ -367,27 +367,27 @@ static void db_file_loader_thread_download (File * file, DbFileLoader * obj)
|
|||
if (!obj->priv->addr && !db_file_loader_resolve_host (obj, cancel, &error))
|
||||
{
|
||||
g_mutex_unlock (obj->priv->mutex);
|
||||
goto final;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
g_mutex_unlock (obj->priv->mutex);
|
||||
|
||||
if (!(connection = db_file_loader_connect (obj, cancel, &error)))
|
||||
goto final;
|
||||
goto exit;
|
||||
|
||||
request = db_file_loader_create_request (obj, file->name);
|
||||
send_stream = g_io_stream_get_output_stream (connection);
|
||||
|
||||
if (0 > g_output_stream_write (send_stream, request, strlen (request), cancel, &error)
|
||||
|| !g_output_stream_close (send_stream, cancel, &error))
|
||||
goto final;
|
||||
goto exit;
|
||||
|
||||
receive_stream = g_data_input_stream_new (g_io_stream_get_input_stream (connection));
|
||||
g_data_input_stream_set_newline_type (receive_stream, G_DATA_STREAM_NEWLINE_TYPE_CR_LF);
|
||||
status_line = g_data_input_stream_read_line (receive_stream, &len, cancel, &error);
|
||||
|
||||
if (!status_line)
|
||||
goto final;
|
||||
goto exit;
|
||||
|
||||
split = g_strsplit (status_line, " ", -1);
|
||||
guint status = g_strv_length (split) >= 2 ? atoi (split[1]) : 0;
|
||||
|
@ -454,7 +454,7 @@ static void db_file_loader_thread_download (File * file, DbFileLoader * obj)
|
|||
if (data)
|
||||
file->data = g_bytes_new_take (data, len);
|
||||
|
||||
final:
|
||||
exit:
|
||||
g_free (request);
|
||||
g_free (status_line);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.2 -->
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.0"/>
|
||||
<requires lib="vn" version="0.0"/>
|
||||
|
@ -220,8 +220,6 @@
|
|||
<object class="VnHandler" id="handler">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">end</property>
|
||||
<property name="show_flags">VN_HANDLER_SHOW_REFRESH | VN_HANDLER_SHOW_UNDO | VN_HANDLER_SHOW_SAVE | VN_HANDLER_SHOW_REMOVE | VN_HANDLER_SHOW_ADD | VN_HANDLER_SHOW_SCROLL</property>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
74
po/ca.po
74
po/ca.po
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: hedera 1.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-05-27 10:09+0200\n"
|
||||
"POT-Creation-Date: 2014-06-10 12:46+0200\n"
|
||||
"PO-Revision-Date: 2013-06-04 13:38+0200\n"
|
||||
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
|
||||
"Language-Team: Catalan\n"
|
||||
|
@ -162,7 +162,7 @@ msgstr "Recordar"
|
|||
msgid "Wether to rememeber the selection when model is refreshed"
|
||||
msgstr ""
|
||||
|
||||
#: ../db/db-model.c:3429 ../db/db-request.c:454 ../vn/vn-gui.c:1474
|
||||
#: ../db/db-model.c:3429 ../db/db-request.c:454 ../vn/vn-gui.c:1470
|
||||
#: ../vn/vn-form.c:245
|
||||
msgid "Connection"
|
||||
msgstr ""
|
||||
|
@ -423,59 +423,59 @@ msgstr ""
|
|||
msgid "The maximal size for the contents of the cache directory"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:517
|
||||
#: ../vn/vn-gui.c:516
|
||||
msgid "Connection has been lost. Do you want to reconnect?"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:524
|
||||
#: ../vn/vn-gui.c:523
|
||||
msgid "An error occurred in the connection."
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:527
|
||||
#: ../vn/vn-gui.c:526
|
||||
msgid "Database error"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:534
|
||||
#: ../vn/vn-gui.c:533
|
||||
msgid "Unknown error"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:866
|
||||
#: ../vn/vn-gui.c:865
|
||||
msgid "Closing connection"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:868
|
||||
#: ../vn/vn-gui.c:867
|
||||
msgid "Transaction started"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:870
|
||||
#: ../vn/vn-gui.c:869
|
||||
msgid "Connecting"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:872
|
||||
#: ../vn/vn-gui.c:871
|
||||
msgid "Connection lost"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:874
|
||||
#: ../vn/vn-gui.c:873
|
||||
msgid "Connection closed"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:876 ../vn/field/vn-http-image.c:116
|
||||
#: ../vn/vn-gui.c:875 ../vn/field/vn-http-image.c:116
|
||||
msgid "Loading"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:878 ../vn/gui/main.glade.h:2
|
||||
#: ../vn/vn-gui.c:877 ../vn/gui/main.glade.h:2
|
||||
msgid "Ready"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:1475
|
||||
#: ../vn/vn-gui.c:1471
|
||||
msgid "The connection used by Gui"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:1481
|
||||
#: ../vn/vn-gui.c:1477
|
||||
msgid "Application"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:1482
|
||||
#: ../vn/vn-gui.c:1478
|
||||
msgid "The application handler for the entire program"
|
||||
msgstr ""
|
||||
|
||||
|
@ -483,63 +483,67 @@ msgstr ""
|
|||
msgid "The iterator used by VnGrid"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:65
|
||||
#: ../vn/vn-handler.c:73
|
||||
msgid "Are you sure you want to delete the current selection?"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:90
|
||||
msgid "Are you sure that you want to undo all changes?"
|
||||
#: ../vn/vn-handler.c:81
|
||||
msgid "Are you sure you want to save the changes?"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:219
|
||||
#: ../vn/vn-handler.c:87
|
||||
msgid "Are you sure you want to undo all changes?"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:213
|
||||
msgid "Undo changes"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:226
|
||||
#: ../vn/vn-handler.c:216
|
||||
msgid "Save changes"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:233
|
||||
#: ../vn/vn-handler.c:219
|
||||
msgid "Refresh data"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:240
|
||||
#: ../vn/vn-handler.c:222
|
||||
msgid "Remove record"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:247
|
||||
#: ../vn/vn-handler.c:225
|
||||
msgid "Add record"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:254
|
||||
#: ../vn/vn-handler.c:228
|
||||
msgid "Move to the first row"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:261
|
||||
#: ../vn/vn-handler.c:231
|
||||
msgid "Move to the previous row"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:268
|
||||
#: ../vn/vn-handler.c:234
|
||||
msgid "Move to the next row"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:275
|
||||
#: ../vn/vn-handler.c:237
|
||||
msgid "Move to the last row"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:514
|
||||
#: ../vn/vn-handler.c:495
|
||||
msgid "Show flags"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:515
|
||||
#: ../vn/vn-handler.c:496
|
||||
msgid "Sets the buttons that will be shown on the interface"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:522
|
||||
#: ../vn/vn-handler.c:503
|
||||
msgid "Simple record"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:523
|
||||
#: ../vn/vn-handler.c:504
|
||||
msgid "Sets if it is used to handle a iterator with a single record"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1001,7 +1005,7 @@ msgstr ""
|
|||
msgid "<b>Add or remove links</b>"
|
||||
msgstr ""
|
||||
|
||||
#: ../glade/glade-db-model-editor.c:53
|
||||
#: ../glade/glade-db-model-editor.c:54
|
||||
msgid "List of parameters linked to the model"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1091,11 +1095,11 @@ msgstr ""
|
|||
msgid "Immediate changes"
|
||||
msgstr ""
|
||||
|
||||
#: ../module/src/vn-consulter.c:234
|
||||
#: ../module/src/vn-consulter.c:233
|
||||
msgid "Type or select a query"
|
||||
msgstr ""
|
||||
|
||||
#: ../module/src/vn-consulter.c:236
|
||||
#: ../module/src/vn-consulter.c:235
|
||||
msgid "Message"
|
||||
msgstr ""
|
||||
|
||||
|
|
74
po/es.po
74
po/es.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: hedera 1.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-05-27 10:09+0200\n"
|
||||
"POT-Creation-Date: 2014-06-10 12:46+0200\n"
|
||||
"PO-Revision-Date: 2013-06-04 13:36+0200\n"
|
||||
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
|
||||
"Language-Team: Spanish\n"
|
||||
|
@ -164,7 +164,7 @@ msgid "Wether to rememeber the selection when model is refreshed"
|
|||
msgstr ""
|
||||
"Si se recordará o no la fila seleccionado cuando se refresque el modelo"
|
||||
|
||||
#: ../db/db-model.c:3429 ../db/db-request.c:454 ../vn/vn-gui.c:1474
|
||||
#: ../db/db-model.c:3429 ../db/db-request.c:454 ../vn/vn-gui.c:1470
|
||||
#: ../vn/vn-form.c:245
|
||||
msgid "Connection"
|
||||
msgstr "Conexión"
|
||||
|
@ -435,59 +435,59 @@ msgstr "Tamaño máximo de la caché"
|
|||
msgid "The maximal size for the contents of the cache directory"
|
||||
msgstr "El tamaño máximo para los contenidos del directorio de caché"
|
||||
|
||||
#: ../vn/vn-gui.c:517
|
||||
#: ../vn/vn-gui.c:516
|
||||
msgid "Connection has been lost. Do you want to reconnect?"
|
||||
msgstr "Se ha perdido la conexión. ¿Quieres reconectar?"
|
||||
|
||||
#: ../vn/vn-gui.c:524
|
||||
#: ../vn/vn-gui.c:523
|
||||
msgid "An error occurred in the connection."
|
||||
msgstr "Ha habido un error en la conexión."
|
||||
|
||||
#: ../vn/vn-gui.c:527
|
||||
#: ../vn/vn-gui.c:526
|
||||
msgid "Database error"
|
||||
msgstr "Error en la base de datos"
|
||||
|
||||
#: ../vn/vn-gui.c:534
|
||||
#: ../vn/vn-gui.c:533
|
||||
msgid "Unknown error"
|
||||
msgstr "Error desconocido"
|
||||
|
||||
#: ../vn/vn-gui.c:866
|
||||
#: ../vn/vn-gui.c:865
|
||||
msgid "Closing connection"
|
||||
msgstr "Cerrando conexión"
|
||||
|
||||
#: ../vn/vn-gui.c:868
|
||||
#: ../vn/vn-gui.c:867
|
||||
msgid "Transaction started"
|
||||
msgstr "Transacción iniciada"
|
||||
|
||||
#: ../vn/vn-gui.c:870
|
||||
#: ../vn/vn-gui.c:869
|
||||
msgid "Connecting"
|
||||
msgstr "Conectando"
|
||||
|
||||
#: ../vn/vn-gui.c:872
|
||||
#: ../vn/vn-gui.c:871
|
||||
msgid "Connection lost"
|
||||
msgstr "Conexión perdida"
|
||||
|
||||
#: ../vn/vn-gui.c:874
|
||||
#: ../vn/vn-gui.c:873
|
||||
msgid "Connection closed"
|
||||
msgstr "Conexión cerrada"
|
||||
|
||||
#: ../vn/vn-gui.c:876 ../vn/field/vn-http-image.c:116
|
||||
#: ../vn/vn-gui.c:875 ../vn/field/vn-http-image.c:116
|
||||
msgid "Loading"
|
||||
msgstr "Cargando"
|
||||
|
||||
#: ../vn/vn-gui.c:878 ../vn/gui/main.glade.h:2
|
||||
#: ../vn/vn-gui.c:877 ../vn/gui/main.glade.h:2
|
||||
msgid "Ready"
|
||||
msgstr "Listo"
|
||||
|
||||
#: ../vn/vn-gui.c:1475
|
||||
#: ../vn/vn-gui.c:1471
|
||||
msgid "The connection used by Gui"
|
||||
msgstr "La conexión empleada por Gui"
|
||||
|
||||
#: ../vn/vn-gui.c:1481
|
||||
#: ../vn/vn-gui.c:1477
|
||||
msgid "Application"
|
||||
msgstr "Aplicación"
|
||||
|
||||
#: ../vn/vn-gui.c:1482
|
||||
#: ../vn/vn-gui.c:1478
|
||||
msgid "The application handler for the entire program"
|
||||
msgstr "El manejador de la aplicación para todo el programa"
|
||||
|
||||
|
@ -495,63 +495,67 @@ msgstr "El manejador de la aplicación para todo el programa"
|
|||
msgid "The iterator used by VnGrid"
|
||||
msgstr "El Iterator empleado por VnGrid"
|
||||
|
||||
#: ../vn/vn-handler.c:65
|
||||
#: ../vn/vn-handler.c:73
|
||||
msgid "Are you sure you want to delete the current selection?"
|
||||
msgstr "¿Estás seguro de que quieres eliminar los registros seleccionados?"
|
||||
|
||||
#: ../vn/vn-handler.c:90
|
||||
msgid "Are you sure that you want to undo all changes?"
|
||||
#: ../vn/vn-handler.c:81
|
||||
msgid "Are you sure you want to save the changes?"
|
||||
msgstr "¿Estás seguro de que quieres guardar los cambios?"
|
||||
|
||||
#: ../vn/vn-handler.c:87
|
||||
msgid "Are you sure you want to undo all changes?"
|
||||
msgstr "¿Estás seguro de que quieres deshacer todos los cambios?"
|
||||
|
||||
#: ../vn/vn-handler.c:219
|
||||
#: ../vn/vn-handler.c:213
|
||||
msgid "Undo changes"
|
||||
msgstr "Deshacer cambios"
|
||||
|
||||
#: ../vn/vn-handler.c:226
|
||||
#: ../vn/vn-handler.c:216
|
||||
msgid "Save changes"
|
||||
msgstr "Guardar cambios"
|
||||
|
||||
#: ../vn/vn-handler.c:233
|
||||
#: ../vn/vn-handler.c:219
|
||||
msgid "Refresh data"
|
||||
msgstr "Refrescar datos"
|
||||
|
||||
#: ../vn/vn-handler.c:240
|
||||
#: ../vn/vn-handler.c:222
|
||||
msgid "Remove record"
|
||||
msgstr "Eliminar registro"
|
||||
|
||||
#: ../vn/vn-handler.c:247
|
||||
#: ../vn/vn-handler.c:225
|
||||
msgid "Add record"
|
||||
msgstr "Añadir registro"
|
||||
|
||||
#: ../vn/vn-handler.c:254
|
||||
#: ../vn/vn-handler.c:228
|
||||
msgid "Move to the first row"
|
||||
msgstr "Mover a la primera fila"
|
||||
|
||||
#: ../vn/vn-handler.c:261
|
||||
#: ../vn/vn-handler.c:231
|
||||
msgid "Move to the previous row"
|
||||
msgstr "Mover a la fila anterior"
|
||||
|
||||
#: ../vn/vn-handler.c:268
|
||||
#: ../vn/vn-handler.c:234
|
||||
msgid "Move to the next row"
|
||||
msgstr "Mover a la siguiente fila"
|
||||
|
||||
#: ../vn/vn-handler.c:275
|
||||
#: ../vn/vn-handler.c:237
|
||||
msgid "Move to the last row"
|
||||
msgstr "Mover a la última fila"
|
||||
|
||||
#: ../vn/vn-handler.c:514
|
||||
#: ../vn/vn-handler.c:495
|
||||
msgid "Show flags"
|
||||
msgstr "Visibilidad"
|
||||
|
||||
#: ../vn/vn-handler.c:515
|
||||
#: ../vn/vn-handler.c:496
|
||||
msgid "Sets the buttons that will be shown on the interface"
|
||||
msgstr "Indica los botones que se mostrarán en la interfaz"
|
||||
|
||||
#: ../vn/vn-handler.c:522
|
||||
#: ../vn/vn-handler.c:503
|
||||
msgid "Simple record"
|
||||
msgstr "Registro simple"
|
||||
|
||||
#: ../vn/vn-handler.c:523
|
||||
#: ../vn/vn-handler.c:504
|
||||
msgid "Sets if it is used to handle a iterator with a single record"
|
||||
msgstr "Indica si se utiliza para manejar solo un registro"
|
||||
|
||||
|
@ -1040,7 +1044,7 @@ msgstr "Necesitas crear por lo menos un GvnParam o algun objeto derivado"
|
|||
msgid "<b>Add or remove links</b>"
|
||||
msgstr "<b>Añadir o quitar enlaces</b>"
|
||||
|
||||
#: ../glade/glade-db-model-editor.c:53
|
||||
#: ../glade/glade-db-model-editor.c:54
|
||||
msgid "List of parameters linked to the model"
|
||||
msgstr "Lista de parámetros vinculados al modelo"
|
||||
|
||||
|
@ -1130,11 +1134,11 @@ msgstr "Consulta:"
|
|||
msgid "Immediate changes"
|
||||
msgstr "Cambios inmediatos"
|
||||
|
||||
#: ../module/src/vn-consulter.c:234
|
||||
#: ../module/src/vn-consulter.c:233
|
||||
msgid "Type or select a query"
|
||||
msgstr "Escribe o elige una consulta"
|
||||
|
||||
#: ../module/src/vn-consulter.c:236
|
||||
#: ../module/src/vn-consulter.c:235
|
||||
msgid "Message"
|
||||
msgstr "Mensaje"
|
||||
|
||||
|
|
74
po/nl.po
74
po/nl.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: hedera 1.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-05-27 10:09+0200\n"
|
||||
"POT-Creation-Date: 2014-06-10 12:46+0200\n"
|
||||
"PO-Revision-Date: 2012-10-09 11:38+0200\n"
|
||||
"Last-Translator: Alejandro T. Colombini Gómez <atcolombini@verdnatura.es>\n"
|
||||
"Language-Team: Dutch\n"
|
||||
|
@ -163,7 +163,7 @@ msgstr ""
|
|||
msgid "Wether to rememeber the selection when model is refreshed"
|
||||
msgstr ""
|
||||
|
||||
#: ../db/db-model.c:3429 ../db/db-request.c:454 ../vn/vn-gui.c:1474
|
||||
#: ../db/db-model.c:3429 ../db/db-request.c:454 ../vn/vn-gui.c:1470
|
||||
#: ../vn/vn-form.c:245
|
||||
msgid "Connection"
|
||||
msgstr ""
|
||||
|
@ -424,59 +424,59 @@ msgstr ""
|
|||
msgid "The maximal size for the contents of the cache directory"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:517
|
||||
#: ../vn/vn-gui.c:516
|
||||
msgid "Connection has been lost. Do you want to reconnect?"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:524
|
||||
#: ../vn/vn-gui.c:523
|
||||
msgid "An error occurred in the connection."
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:527
|
||||
#: ../vn/vn-gui.c:526
|
||||
msgid "Database error"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:534
|
||||
#: ../vn/vn-gui.c:533
|
||||
msgid "Unknown error"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:866
|
||||
#: ../vn/vn-gui.c:865
|
||||
msgid "Closing connection"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:868
|
||||
#: ../vn/vn-gui.c:867
|
||||
msgid "Transaction started"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:870
|
||||
#: ../vn/vn-gui.c:869
|
||||
msgid "Connecting"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:872
|
||||
#: ../vn/vn-gui.c:871
|
||||
msgid "Connection lost"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:874
|
||||
#: ../vn/vn-gui.c:873
|
||||
msgid "Connection closed"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:876 ../vn/field/vn-http-image.c:116
|
||||
#: ../vn/vn-gui.c:875 ../vn/field/vn-http-image.c:116
|
||||
msgid "Loading"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:878 ../vn/gui/main.glade.h:2
|
||||
#: ../vn/vn-gui.c:877 ../vn/gui/main.glade.h:2
|
||||
msgid "Ready"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:1475
|
||||
#: ../vn/vn-gui.c:1471
|
||||
msgid "The connection used by Gui"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:1481
|
||||
#: ../vn/vn-gui.c:1477
|
||||
msgid "Application"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-gui.c:1482
|
||||
#: ../vn/vn-gui.c:1478
|
||||
msgid "The application handler for the entire program"
|
||||
msgstr ""
|
||||
|
||||
|
@ -484,63 +484,67 @@ msgstr ""
|
|||
msgid "The iterator used by VnGrid"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:65
|
||||
#: ../vn/vn-handler.c:73
|
||||
msgid "Are you sure you want to delete the current selection?"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:90
|
||||
msgid "Are you sure that you want to undo all changes?"
|
||||
#: ../vn/vn-handler.c:81
|
||||
msgid "Are you sure you want to save the changes?"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:219
|
||||
#: ../vn/vn-handler.c:87
|
||||
msgid "Are you sure you want to undo all changes?"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:213
|
||||
msgid "Undo changes"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:226
|
||||
#: ../vn/vn-handler.c:216
|
||||
msgid "Save changes"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:233
|
||||
#: ../vn/vn-handler.c:219
|
||||
msgid "Refresh data"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:240
|
||||
#: ../vn/vn-handler.c:222
|
||||
msgid "Remove record"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:247
|
||||
#: ../vn/vn-handler.c:225
|
||||
msgid "Add record"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:254
|
||||
#: ../vn/vn-handler.c:228
|
||||
msgid "Move to the first row"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:261
|
||||
#: ../vn/vn-handler.c:231
|
||||
msgid "Move to the previous row"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:268
|
||||
#: ../vn/vn-handler.c:234
|
||||
msgid "Move to the next row"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:275
|
||||
#: ../vn/vn-handler.c:237
|
||||
msgid "Move to the last row"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:514
|
||||
#: ../vn/vn-handler.c:495
|
||||
msgid "Show flags"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:515
|
||||
#: ../vn/vn-handler.c:496
|
||||
msgid "Sets the buttons that will be shown on the interface"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:522
|
||||
#: ../vn/vn-handler.c:503
|
||||
msgid "Simple record"
|
||||
msgstr ""
|
||||
|
||||
#: ../vn/vn-handler.c:523
|
||||
#: ../vn/vn-handler.c:504
|
||||
msgid "Sets if it is used to handle a iterator with a single record"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1001,7 +1005,7 @@ msgstr ""
|
|||
msgid "<b>Add or remove links</b>"
|
||||
msgstr ""
|
||||
|
||||
#: ../glade/glade-db-model-editor.c:53
|
||||
#: ../glade/glade-db-model-editor.c:54
|
||||
msgid "List of parameters linked to the model"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1091,10 +1095,10 @@ msgstr ""
|
|||
msgid "Immediate changes"
|
||||
msgstr ""
|
||||
|
||||
#: ../module/src/vn-consulter.c:234
|
||||
#: ../module/src/vn-consulter.c:233
|
||||
msgid "Type or select a query"
|
||||
msgstr ""
|
||||
|
||||
#: ../module/src/vn-consulter.c:236
|
||||
#: ../module/src/vn-consulter.c:235
|
||||
msgid "Message"
|
||||
msgstr ""
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkAdjustment" id="hour">
|
||||
<property name="upper">23</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="minute">
|
||||
<property name="upper">59</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="second">
|
||||
<property name="upper">59</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkBox" id="box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -19,7 +30,7 @@
|
|||
<property name="homogeneous">True</property>
|
||||
<property name="layout_style">expand</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<object class="GtkButton" id="ok">
|
||||
<property name="label" translatable="yes">OK</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
@ -27,7 +38,7 @@
|
|||
<signal name="clicked" handler="vn_date_chooser_on_ok_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
|
@ -94,7 +105,6 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="adjustment">hour</property>
|
||||
<property name="wrap">True</property>
|
||||
|
@ -124,7 +134,6 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="adjustment">minute</property>
|
||||
<property name="wrap">True</property>
|
||||
|
@ -154,7 +163,6 @@
|
|||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="adjustment">second</property>
|
||||
<property name="wrap">True</property>
|
||||
|
@ -174,14 +182,4 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="minute">
|
||||
<property name="upper">59</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="second">
|
||||
<property name="upper">59</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
41
vn/vn-gui.c
41
vn/vn-gui.c
|
@ -41,27 +41,6 @@
|
|||
**/
|
||||
G_DEFINE_TYPE (VnGui, vn_gui, G_TYPE_OBJECT);
|
||||
|
||||
// TODO global en vn-actions.h?
|
||||
void vn_gui_on_logout_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
void vn_gui_on_open_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
void vn_gui_on_about_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
void vn_gui_on_exit_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
|
||||
static const GActionEntry app_entries[] =
|
||||
{
|
||||
{"logout", vn_gui_on_logout_activated}
|
||||
,{"connect", vn_gui_on_open_activated}
|
||||
,{"about", vn_gui_on_about_activated}
|
||||
,{"quit", vn_gui_on_exit_activated}
|
||||
};
|
||||
|
||||
void vn_gui_on_close_tab_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
|
||||
static const GActionEntry win_entries[] =
|
||||
{
|
||||
{"close", vn_gui_on_close_tab_activated}
|
||||
};
|
||||
|
||||
struct _VnWindow
|
||||
{
|
||||
VnGui * obj;
|
||||
|
@ -98,6 +77,26 @@ typedef struct
|
|||
}
|
||||
GuiData;
|
||||
|
||||
void vn_gui_on_logout_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
void vn_gui_on_open_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
void vn_gui_on_about_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
void vn_gui_on_exit_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
|
||||
static const GActionEntry app_entries[] =
|
||||
{
|
||||
{"logout", vn_gui_on_logout_activated}
|
||||
,{"connect", vn_gui_on_open_activated}
|
||||
,{"about", vn_gui_on_about_activated}
|
||||
,{"quit", vn_gui_on_exit_activated}
|
||||
};
|
||||
|
||||
void vn_gui_on_close_tab_activated (GSimpleAction * a, GVariant * v, gpointer obj);
|
||||
|
||||
static const GActionEntry win_entries[] =
|
||||
{
|
||||
{"close", vn_gui_on_close_tab_activated}
|
||||
};
|
||||
|
||||
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);
|
||||
|
|
382
vn/vn-handler.c
382
vn/vn-handler.c
|
@ -17,7 +17,9 @@
|
|||
|
||||
#include "vn-handler.h"
|
||||
|
||||
G_DEFINE_TYPE (VnHandler, vn_handler, GTK_TYPE_BUTTON_BOX);
|
||||
#define ACTION_GROUP_NAME "handler"
|
||||
|
||||
G_DEFINE_TYPE (VnHandler, vn_handler, GTK_TYPE_BIN);
|
||||
|
||||
/**
|
||||
* vn_handler_new:
|
||||
|
@ -46,63 +48,55 @@ GtkWidget * vn_handler_new_with_iterator (DbIterator * iterator)
|
|||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Private
|
||||
|
||||
static void vn_handler_on_add_activated (GtkAction * action, VnHandler * obj)
|
||||
static gboolean vn_handler_dialog (VnHandler * obj, gchar * message)
|
||||
{
|
||||
db_iterator_insert (obj->iterator);
|
||||
}
|
||||
|
||||
static void vn_handler_on_remove_activated (GtkAction * action, VnHandler * obj)
|
||||
{
|
||||
GtkWidget * toplevel;
|
||||
GtkWidget * dialog;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (obj));
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel)
|
||||
GtkWidget * toplevel = gtk_widget_get_toplevel (GTK_WIDGET (obj)),
|
||||
* dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel)
|
||||
,GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT
|
||||
,GTK_MESSAGE_QUESTION
|
||||
,GTK_BUTTONS_OK_CANCEL
|
||||
,_("Are you sure you want to delete the current selection?")
|
||||
,"%s"
|
||||
,message
|
||||
);
|
||||
|
||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
|
||||
db_iterator_delete (obj->iterator);
|
||||
|
||||
gint response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
return response == GTK_RESPONSE_OK;
|
||||
}
|
||||
|
||||
static void vn_handler_on_save_activated (GtkAction * action, VnHandler * obj)
|
||||
static void vn_handler_on_add_activated (GSimpleAction * a, GVariant * p, gpointer obj)
|
||||
{
|
||||
db_iterator_perform_operations (obj->iterator);
|
||||
db_iterator_insert (VN_HANDLER (obj)->iterator);
|
||||
}
|
||||
|
||||
static void vn_handler_on_undo_activated (GtkAction * action, VnHandler * obj)
|
||||
static void vn_handler_on_remove_activated (GSimpleAction * a, GVariant * p, gpointer obj)
|
||||
{
|
||||
GtkWidget * toplevel;
|
||||
GtkWidget * dialog;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (obj));
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel)
|
||||
,GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT
|
||||
,GTK_MESSAGE_QUESTION
|
||||
,GTK_BUTTONS_OK_CANCEL
|
||||
,_("Are you sure that you want to undo all changes?")
|
||||
);
|
||||
|
||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
|
||||
db_iterator_reverse_operations (obj->iterator);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
if (db_iterator_get_mode (VN_HANDLER (obj)->iterator) == DB_ITERATOR_MODE_ON_DEMAND
|
||||
|| vn_handler_dialog (obj, _("Are you sure you want to delete the current selection?")))
|
||||
db_iterator_delete (VN_HANDLER (obj)->iterator);
|
||||
}
|
||||
|
||||
static void vn_handler_on_refresh_activated (GtkAction * action, VnHandler * obj)
|
||||
static void vn_handler_on_save_activated (GSimpleAction * a, GVariant * p, gpointer obj)
|
||||
{
|
||||
db_iterator_refresh (obj->iterator);
|
||||
if (db_iterator_get_mode (VN_HANDLER (obj)->iterator) != DB_ITERATOR_MODE_ON_DEMAND)
|
||||
db_iterator_perform_operations (VN_HANDLER (obj)->iterator);
|
||||
else if (vn_handler_dialog (obj, _("Are you sure you want to save the changes?")))
|
||||
db_iterator_perform_operations (VN_HANDLER (obj)->iterator);
|
||||
}
|
||||
|
||||
static void vn_handler_on_move_activated (GtkAction * action, VnHandler * obj)
|
||||
static void vn_handler_on_undo_activated (GSimpleAction * a, GVariant * p, gpointer obj)
|
||||
{
|
||||
if (vn_handler_dialog (obj, _("Are you sure you want to undo all changes?")))
|
||||
db_iterator_reverse_operations (VN_HANDLER (obj)->iterator);
|
||||
}
|
||||
|
||||
static void vn_handler_on_refresh_activated (GSimpleAction * a, GVariant * p, gpointer obj)
|
||||
{
|
||||
db_iterator_refresh (VN_HANDLER (obj)->iterator);
|
||||
}
|
||||
|
||||
static void vn_handler_on_move_activated (GSimpleAction * action, GVariant * p, gpointer o)
|
||||
{
|
||||
VnHandler * obj = o;
|
||||
DbIteratorMove move;
|
||||
|
||||
if (action == obj->move_previous)
|
||||
|
@ -119,30 +113,30 @@ static void vn_handler_on_move_activated (GtkAction * action, VnHandler * obj)
|
|||
|
||||
static void vn_handler_refresh_save_undo_status (VnHandler * obj)
|
||||
{
|
||||
gboolean sensitive = obj->iterator
|
||||
gboolean enabled = obj->iterator
|
||||
&& db_iterator_has_pending_operations (obj->iterator);
|
||||
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_SAVE)
|
||||
gtk_action_set_sensitive (obj->save, sensitive);
|
||||
g_simple_action_set_enabled (obj->save, enabled);
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_UNDO)
|
||||
gtk_action_set_sensitive (obj->undo, sensitive);
|
||||
g_simple_action_set_enabled (obj->undo, enabled);
|
||||
}
|
||||
|
||||
static void vn_handler_refresh_scroll_status (VnHandler * obj)
|
||||
{
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_SCROLL)
|
||||
{
|
||||
gboolean sensitive;
|
||||
gboolean enabled;
|
||||
gint row = db_iterator_get_row (obj->iterator);
|
||||
|
||||
sensitive = row > 0;
|
||||
gtk_action_set_sensitive (obj->move_first, sensitive);
|
||||
gtk_action_set_sensitive (obj->move_previous, sensitive);
|
||||
enabled = row > 0;
|
||||
g_simple_action_set_enabled (obj->move_first, enabled);
|
||||
g_simple_action_set_enabled (obj->move_previous, enabled);
|
||||
|
||||
sensitive = row != -1 && row < db_iterator_get_nrows (obj->iterator) - 1;
|
||||
gtk_action_set_sensitive (obj->move_next, sensitive);
|
||||
gtk_action_set_sensitive (obj->move_last, sensitive);
|
||||
enabled = row != -1 && row < db_iterator_get_nrows (obj->iterator) - 1;
|
||||
g_simple_action_set_enabled (obj->move_next, enabled);
|
||||
g_simple_action_set_enabled (obj->move_last, enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,13 +144,13 @@ static void vn_handler_on_data_changed (DbIterator * iterator, VnHandler * obj)
|
|||
{
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_ADD)
|
||||
{
|
||||
gboolean sensitive =
|
||||
gboolean enabled =
|
||||
db_iterator_get_update_flags (iterator) & DB_MODEL_INSERT
|
||||
&& (db_iterator_get_nrows (iterator) < 1 || !obj->simple_record);
|
||||
|
||||
gtk_action_set_sensitive (obj->add, sensitive);
|
||||
g_simple_action_set_enabled (obj->add, enabled);
|
||||
}
|
||||
|
||||
|
||||
vn_handler_refresh_save_undo_status (obj);
|
||||
vn_handler_refresh_scroll_status (obj);
|
||||
}
|
||||
|
@ -165,11 +159,11 @@ static void vn_handler_on_row_num_changed (DbIterator * iterator, VnHandler * ob
|
|||
{
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_REMOVE)
|
||||
{
|
||||
gboolean sensitive =
|
||||
gboolean enabled =
|
||||
db_iterator_get_update_flags (iterator) & DB_MODEL_DELETE
|
||||
&& db_iterator_get_nrows (iterator) > 0;
|
||||
|
||||
gtk_action_set_sensitive (obj->remove, sensitive);
|
||||
g_simple_action_set_enabled (obj->remove, enabled);
|
||||
}
|
||||
|
||||
vn_handler_refresh_scroll_status (obj);
|
||||
|
@ -180,9 +174,21 @@ static void vn_handler_on_operations_done (DbIterator * iterator, VnHandler * ob
|
|||
vn_handler_refresh_save_undo_status (obj);
|
||||
}
|
||||
|
||||
static void action_group_set_enabled (GActionGroup * group, gboolean enabled)
|
||||
{
|
||||
gint i;
|
||||
gchar ** actions = g_action_group_list_actions (group);
|
||||
|
||||
for (i = 0; actions[i]; i++)
|
||||
{
|
||||
GAction * a = g_action_map_lookup_action (G_ACTION_MAP (group), actions[i]);
|
||||
g_simple_action_set_enabled (G_SIMPLE_ACTION (a), enabled);
|
||||
}
|
||||
}
|
||||
|
||||
static void vn_handler_on_status_changed (DbIterator * iterator, gboolean ready, VnHandler * obj)
|
||||
{
|
||||
gtk_action_group_set_sensitive (obj->group, ready);
|
||||
action_group_set_enabled (obj->group, ready);
|
||||
vn_handler_on_row_num_changed (iterator, obj);
|
||||
vn_handler_on_data_changed (iterator, obj);
|
||||
}
|
||||
|
@ -190,12 +196,49 @@ static void vn_handler_on_status_changed (DbIterator * iterator, gboolean ready,
|
|||
static void vn_handler_refresh_status (VnHandler * obj)
|
||||
{
|
||||
if (!obj->iterator)
|
||||
gtk_action_group_set_sensitive (obj->group, FALSE);
|
||||
action_group_set_enabled (obj->group, FALSE);
|
||||
else
|
||||
vn_handler_on_status_changed (obj->iterator,
|
||||
db_iterator_is_ready (obj->iterator), obj);
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
gchar * icon;
|
||||
gchar * tooltip;
|
||||
}
|
||||
actions_data[] =
|
||||
{
|
||||
{
|
||||
"edit-undo-symbolic"
|
||||
,N_("Undo changes")
|
||||
},{
|
||||
"document-save-symbolic"
|
||||
,N_("Save changes")
|
||||
},{
|
||||
"view-refresh-symbolic"
|
||||
,N_("Refresh data")
|
||||
},{
|
||||
"list-remove-symbolic"
|
||||
,N_("Remove record")
|
||||
},{
|
||||
"list-add-symbolic"
|
||||
,N_("Add record")
|
||||
},{
|
||||
"go-first-symbolic"
|
||||
,N_("Move to the first row")
|
||||
},{
|
||||
"go-previous-symbolic"
|
||||
,N_("Move to the previous row")
|
||||
},{
|
||||
"go-next-symbolic"
|
||||
,N_("Move to the next row")
|
||||
},{
|
||||
"go-last-symbolic"
|
||||
,N_("Move to the last row")
|
||||
}
|
||||
};
|
||||
|
||||
static VnHandlerShowFlags entries_flags[] =
|
||||
{
|
||||
VN_HANDLER_SHOW_UNDO
|
||||
|
@ -209,71 +252,35 @@ static VnHandlerShowFlags entries_flags[] =
|
|||
,VN_HANDLER_SHOW_SCROLL
|
||||
};
|
||||
|
||||
static GtkActionEntry entries[] =
|
||||
static GActionEntry entries[] =
|
||||
{
|
||||
{
|
||||
"undo"
|
||||
,"edit-undo"
|
||||
,NULL
|
||||
,NULL
|
||||
,N_("Undo changes")
|
||||
,G_CALLBACK (vn_handler_on_undo_activated)
|
||||
,vn_handler_on_undo_activated
|
||||
},{
|
||||
"save"
|
||||
,"document-save"
|
||||
,NULL
|
||||
,NULL
|
||||
,N_("Save changes")
|
||||
,G_CALLBACK (vn_handler_on_save_activated)
|
||||
,vn_handler_on_save_activated
|
||||
},{
|
||||
"refresh"
|
||||
,"view-refresh"
|
||||
,NULL
|
||||
,NULL
|
||||
,N_("Refresh data")
|
||||
,G_CALLBACK (vn_handler_on_refresh_activated)
|
||||
,vn_handler_on_refresh_activated
|
||||
},{
|
||||
"remove"
|
||||
,"list-remove"
|
||||
,NULL
|
||||
,NULL
|
||||
,N_("Remove record")
|
||||
,G_CALLBACK (vn_handler_on_remove_activated)
|
||||
,vn_handler_on_remove_activated
|
||||
},{
|
||||
"add"
|
||||
,"list-add"
|
||||
,NULL
|
||||
,NULL
|
||||
,N_("Add record")
|
||||
,G_CALLBACK (vn_handler_on_add_activated)
|
||||
,vn_handler_on_add_activated
|
||||
},{
|
||||
"move-first"
|
||||
,"go-first"
|
||||
,NULL
|
||||
,NULL
|
||||
,N_("Move to the first row")
|
||||
,G_CALLBACK (vn_handler_on_move_activated)
|
||||
,vn_handler_on_move_activated
|
||||
},{
|
||||
"move-previous"
|
||||
,"go-previous"
|
||||
,NULL
|
||||
,NULL
|
||||
,N_("Move to the previous row")
|
||||
,G_CALLBACK (vn_handler_on_move_activated)
|
||||
,vn_handler_on_move_activated
|
||||
},{
|
||||
"move-next"
|
||||
,"go-next"
|
||||
,NULL
|
||||
,NULL
|
||||
,N_("Move to the next row")
|
||||
,G_CALLBACK (vn_handler_on_move_activated)
|
||||
,vn_handler_on_move_activated
|
||||
},{
|
||||
"move-last"
|
||||
,"go-last"
|
||||
,NULL
|
||||
,NULL
|
||||
,N_("Move to the last row")
|
||||
,G_CALLBACK (vn_handler_on_move_activated)
|
||||
,vn_handler_on_move_activated
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -281,6 +288,55 @@ static guint n_entries = G_N_ELEMENTS (entries);
|
|||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
|
||||
|
||||
/**
|
||||
* vn_handler_set_show_flags:
|
||||
* @obj: a #VnHandler
|
||||
* @show_flags: the buttons to be shown
|
||||
*
|
||||
* Sets the buttons that will be shown on the interface.
|
||||
**/
|
||||
void vn_handler_set_show_flags (VnHandler * obj, VnHandlerShowFlags show_flags)
|
||||
{
|
||||
gint i;
|
||||
GList * list = gtk_container_get_children (GTK_CONTAINER (obj->buttons)),
|
||||
* l = list;
|
||||
obj->show_flags = show_flags;
|
||||
|
||||
for (i = 0; i < n_entries && l; i++)
|
||||
{
|
||||
GtkWidget * button = l->data;
|
||||
|
||||
if (obj->show_flags & entries_flags[i])
|
||||
gtk_widget_show (button);
|
||||
else
|
||||
gtk_widget_hide (button);
|
||||
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_ADD)
|
||||
obj->add = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (obj->group), "add"));
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_REMOVE)
|
||||
obj->remove = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (obj->group), "remove"));
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_SAVE)
|
||||
obj->save = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (obj->group), "save"));
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_UNDO)
|
||||
obj->undo = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (obj->group), "undo"));
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_SCROLL)
|
||||
{
|
||||
obj->move_first = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (obj->group), "move-first"));
|
||||
obj->move_previous = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (obj->group), "move-previous"));
|
||||
obj->move_next = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (obj->group), "move-next"));
|
||||
obj->move_last = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP (obj->group), "move-last"));
|
||||
}
|
||||
|
||||
vn_handler_refresh_status (obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* vn_handler_get_iterator:
|
||||
* @obj: a #VnHandler
|
||||
|
@ -332,71 +388,6 @@ void vn_handler_set_iterator (VnHandler * obj, DbIterator * iterator)
|
|||
vn_handler_refresh_status (obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* vn_handler_set_show_flags:
|
||||
* @obj: a #VnHandler
|
||||
* @show_flags: the buttons to be shown
|
||||
*
|
||||
* Sets the buttons that will be shown on the interface.
|
||||
**/
|
||||
void vn_handler_set_show_flags (VnHandler * obj, VnHandlerShowFlags show_flags)
|
||||
{
|
||||
gint i;
|
||||
gint items;
|
||||
GList * j;
|
||||
|
||||
g_return_if_fail (VN_IS_HANDLER (obj));
|
||||
|
||||
for (j = gtk_action_group_list_actions (obj->group); j; j = j->next)
|
||||
gtk_action_group_remove_action (obj->group, j->data);
|
||||
|
||||
items = gtk_toolbar_get_n_items (obj->toolbar);
|
||||
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
GtkToolItem * tool_item = gtk_toolbar_get_nth_item (obj->toolbar, 0);
|
||||
gtk_container_remove (GTK_CONTAINER (obj->toolbar), GTK_WIDGET (tool_item));
|
||||
}
|
||||
|
||||
obj->show_flags = show_flags;
|
||||
|
||||
for (i = 0; i < n_entries; i++)
|
||||
{
|
||||
if (obj->show_flags & entries_flags[i])
|
||||
{
|
||||
gtk_action_group_add_actions (obj->group, &entries[i], 1, obj);
|
||||
|
||||
GtkAction * action = gtk_action_group_get_action (obj->group, entries[i].name);
|
||||
|
||||
GtkToolItem * item = GTK_TOOL_ITEM (gtk_action_create_tool_item (action));
|
||||
gtk_tool_item_set_homogeneous (item, TRUE);
|
||||
gtk_toolbar_insert (obj->toolbar, item, -1);
|
||||
}
|
||||
}
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_ADD)
|
||||
obj->add = gtk_action_group_get_action (obj->group, "add");
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_REMOVE)
|
||||
obj->remove = gtk_action_group_get_action (obj->group, "remove");
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_SAVE)
|
||||
obj->save = gtk_action_group_get_action (obj->group, "save");
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_UNDO)
|
||||
obj->undo = gtk_action_group_get_action (obj->group, "undo");
|
||||
|
||||
if (obj->show_flags & VN_HANDLER_SHOW_SCROLL)
|
||||
{
|
||||
obj->move_first = gtk_action_group_get_action (obj->group, "move-first");
|
||||
obj->move_previous = gtk_action_group_get_action (obj->group, "move-previous");
|
||||
obj->move_next = gtk_action_group_get_action (obj->group, "move-next");
|
||||
obj->move_last = gtk_action_group_get_action (obj->group, "move-last");
|
||||
}
|
||||
|
||||
vn_handler_refresh_status (obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* vn_handler_set_simple_record:
|
||||
* @obj: a #VnHandler
|
||||
|
@ -462,7 +453,10 @@ static void vn_handler_get_property (VnHandler * obj, guint id,
|
|||
|
||||
static void vn_handler_init (VnHandler * obj)
|
||||
{
|
||||
GdkRGBA color = {0.0, 0.0, 0.0, 0.0};
|
||||
gint i;
|
||||
gchar * css;
|
||||
GtkStyleContext * context;
|
||||
GtkCssProvider * provider;
|
||||
|
||||
obj->add = NULL;
|
||||
obj->remove = NULL;
|
||||
|
@ -472,22 +466,42 @@ static void vn_handler_init (VnHandler * obj)
|
|||
obj->move_last = NULL;
|
||||
obj->iterator = NULL;
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (obj), 6);
|
||||
gtk_box_set_homogeneous (GTK_BOX (obj), FALSE);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (obj), GTK_BUTTONBOX_END);
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (obj), GTK_ORIENTATION_HORIZONTAL);
|
||||
obj->group = G_ACTION_GROUP (g_simple_action_group_new ());
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (obj->group), entries, n_entries, obj);
|
||||
gtk_widget_insert_action_group (GTK_WIDGET (obj), ACTION_GROUP_NAME, obj->group);
|
||||
|
||||
obj->group = gtk_action_group_new ("form-handler");
|
||||
obj->buttons = GTK_WIDGET (g_object_new (GTK_TYPE_BUTTON_BOX
|
||||
,"layout-style", GTK_BUTTONBOX_EXPAND
|
||||
,"homogeneous", FALSE
|
||||
,NULL));
|
||||
|
||||
obj->toolbar = GTK_TOOLBAR (g_object_new (GTK_TYPE_TOOLBAR
|
||||
,"icon-size", GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
,"toolbar-style", GTK_TOOLBAR_BOTH_HORIZ
|
||||
,"show-arrow", FALSE
|
||||
,NULL
|
||||
));
|
||||
gtk_widget_override_background_color (GTK_WIDGET (obj->toolbar),
|
||||
GTK_STATE_FLAG_NORMAL, &color);
|
||||
gtk_box_pack_end (GTK_BOX (obj), GTK_WIDGET (obj->toolbar), FALSE, FALSE, 0);
|
||||
context = gtk_widget_get_style_context (obj->buttons);
|
||||
provider = gtk_css_provider_get_default ();
|
||||
css =
|
||||
"VnHandler GtkButtonBox\n"
|
||||
"{\n"
|
||||
" -GtkButtonBox-child-min-width: 0;\n"
|
||||
" -GtkButtonBox-child-internal-pad-x: 0;\n"
|
||||
"}";
|
||||
|
||||
if (gtk_css_provider_load_from_data (provider, css, -1, NULL))
|
||||
gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
else
|
||||
g_object_unref (provider);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (obj), obj->buttons);
|
||||
|
||||
for (i = 0; i < n_entries; i++)
|
||||
{
|
||||
GtkWidget * button = gtk_button_new_from_icon_name (actions_data[i].icon, GTK_ICON_SIZE_BUTTON);
|
||||
gchar * action_name = g_strconcat (ACTION_GROUP_NAME, ".", entries[i].name, NULL);
|
||||
gtk_actionable_set_action_name (GTK_ACTIONABLE (button), action_name);
|
||||
g_free (action_name);
|
||||
gtk_widget_set_tooltip_text (button, actions_data[i].tooltip);
|
||||
gtk_widget_set_no_show_all (button, TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (obj->buttons), button, FALSE, FALSE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void vn_handler_finalize (VnHandler * obj)
|
||||
|
|
103
vn/vn-handler.h
103
vn/vn-handler.h
|
@ -45,105 +45,26 @@ VnHandlerShowFlags;
|
|||
|
||||
struct _VnHandler
|
||||
{
|
||||
GtkButtonBox parent;
|
||||
DbIterator * iterator;
|
||||
VnHandlerShowFlags show_flags;/*
|
||||
* 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 VN_HANDLER_H
|
||||
#define VN_HANDLER_H
|
||||
|
||||
#include <db/db.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define VN_TYPE_HANDLER (vn_handler_get_type ())
|
||||
#define VN_IS_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, VN_TYPE_HANDLER))
|
||||
#define VN_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, VN_TYPE_HANDLER , VnHandler))
|
||||
#define VN_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST (klass, VN_TYPE_HANDLER, VnHandlerClass))
|
||||
#define VN_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS (obj, VN_TYPE_HANDLER, VnHandlerClass))
|
||||
|
||||
#define VN_TYPE_HANDLER_SHOW_FLAGS (vn_handler_show_flags_get_type ())
|
||||
|
||||
typedef struct _VnHandler VnHandler;
|
||||
typedef struct _VnHandlerClass VnHandlerClass;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VN_HANDLER_SHOW_REFRESH = 1 << 0
|
||||
,VN_HANDLER_SHOW_UNDO = 1 << 1
|
||||
,VN_HANDLER_SHOW_SAVE = 1 << 2
|
||||
,VN_HANDLER_SHOW_REMOVE = 1 << 3
|
||||
,VN_HANDLER_SHOW_ADD = 1 << 4
|
||||
,VN_HANDLER_SHOW_SCROLL = 1 << 5
|
||||
}
|
||||
VnHandlerShowFlags;
|
||||
|
||||
struct _VnHandler
|
||||
{
|
||||
GtkButtonBox parent;
|
||||
GtkBin parent;
|
||||
DbIterator * iterator;
|
||||
VnHandlerShowFlags show_flags;
|
||||
gboolean simple_record;
|
||||
GtkToolbar * toolbar;
|
||||
GtkActionGroup * group;
|
||||
GtkAction * move_first;
|
||||
GtkAction * move_previous;
|
||||
GtkAction * move_next;
|
||||
GtkAction * move_last;
|
||||
GtkAction * add;
|
||||
GtkAction * remove;
|
||||
GtkAction * save;
|
||||
GtkAction * undo;
|
||||
};
|
||||
|
||||
struct _VnHandlerClass
|
||||
{
|
||||
/* <private> */
|
||||
GtkButtonBoxClass parent;
|
||||
};
|
||||
|
||||
GType vn_handler_get_type ();
|
||||
GType vn_handler_show_flags_get_type () G_GNUC_CONST;
|
||||
|
||||
GtkWidget * vn_handler_new ();
|
||||
GtkWidget * vn_handler_new_with_iterator (DbIterator * iterator);
|
||||
DbIterator * vn_handler_get_iterator (VnHandler * obj);
|
||||
void vn_handler_set_iterator (VnHandler * obj, DbIterator * iterator);
|
||||
void vn_handler_set_show_flags (VnHandler * obj, VnHandlerShowFlags show_flags);
|
||||
void vn_handler_set_simple_record (VnHandler * obj, gboolean simple);
|
||||
|
||||
#endif
|
||||
gboolean simple_record;
|
||||
GtkToolbar * toolbar;
|
||||
GtkWidget * buttons;
|
||||
GActionGroup * group;
|
||||
GAction * move_first;
|
||||
GAction * move_previous;
|
||||
GAction * move_next;
|
||||
GAction * move_last;
|
||||
GAction * add;
|
||||
GAction * remove;
|
||||
GAction * save;
|
||||
GAction * undo;
|
||||
GSimpleAction * undo;
|
||||
GSimpleAction * save;
|
||||
GSimpleAction * remove;
|
||||
GSimpleAction * add;
|
||||
GSimpleAction * move_first;
|
||||
GSimpleAction * move_previous;
|
||||
GSimpleAction * move_next;
|
||||
GSimpleAction * move_last;
|
||||
};
|
||||
|
||||
struct _VnHandlerClass
|
||||
{
|
||||
/* <private> */
|
||||
GtkButtonBoxClass parent;
|
||||
GtkBinClass parent;
|
||||
};
|
||||
|
||||
GType vn_handler_get_type ();
|
||||
|
@ -156,4 +77,4 @@ void vn_handler_set_iterator (VnHandler * obj, DbIterator * iterator);
|
|||
void vn_handler_set_show_flags (VnHandler * obj, VnHandlerShowFlags show_flags);
|
||||
void vn_handler_set_simple_record (VnHandler * obj, gboolean simple);
|
||||
|
||||
#endif
|
||||
#endif
|
Reference in New Issue