tourist and illness finished

This commit is contained in:
Chris Cromer 2019-01-21 00:58:30 -03:00
parent eb58d519fb
commit 0044048c7d
Signed by: cromer
GPG Key ID: 39CC813FF3C8708A
26 changed files with 2832 additions and 133 deletions

View File

@ -68,28 +68,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
<property name="can_focus">False</property>
<property name="label" translatable="yes">Tourists</property>
<signal name="activate" handler="on_activate_menu" swapped="no"/>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="illnesses">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Illnesses</property>
<signal name="activate" handler="on_activate_menu" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="participate">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Participate</property>
<signal name="activate" handler="on_activate_menu" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>

View File

@ -11,6 +11,12 @@ tour_gresource = gnome.compile_resources('tour_gresource',
c_name: meson.project_name() + '_resource_tour',
export: true,
install_header: true)
tourist_gresource = gnome.compile_resources('tourist_gresource',
'tourist.gresource.xml',
source_dir: '.',
c_name: meson.project_name() + '_resource_tourist',
export: true,
install_header: true)
place_gresource = gnome.compile_resources('place_gresource',
'place.gresource.xml',
source_dir: '.',

322
data/ui/tourist.editor.ui Normal file
View File

@ -0,0 +1,322 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright 2018-2019 Chris Cromer
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<interface domain="sernatur">
<requires lib="gtk+" version="3.20"/>
<object class="GtkAdjustment" id="day_adjustment">
<property name="lower">1</property>
<property name="upper">31</property>
<property name="value">1</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="year_adjustment">
<property name="lower">1900</property>
<property name="upper">2019</property>
<property name="value">2019</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<template class="SernaturTouristEditor" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="title" translatable="yes">Tourist Editor</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="show_menubar">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">RUN</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="run">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="max_length">50</property>
<property name="caps_lock_warning">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Name</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="tourist_name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="max_length">50</property>
<property name="caps_lock_warning">False</property>
<property name="input_purpose">number</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="spacing">25</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Cancel the modification of this tourist.</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="illnesses">
<property name="label" translatable="yes">Illnesses</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Add or edit illnesses.</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="save">
<property name="label" translatable="yes">Save</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Save this tourist.</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Birthdate</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Year</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Day</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="year">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="caps_lock_warning">False</property>
<property name="input_purpose">number</property>
<property name="adjustment">year_adjustment</property>
<property name="numeric">True</property>
<property name="value">2019</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="day">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="caps_lock_warning">False</property>
<property name="input_purpose">number</property>
<property name="adjustment">day_adjustment</property>
<property name="numeric">True</property>
<property name="value">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="month">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">0</property>
<items>
<item translatable="yes">January</item>
<item translatable="yes">February</item>
<item translatable="yes">March</item>
<item translatable="yes">April</item>
<item translatable="yes">May</item>
<item translatable="yes">June</item>
<item translatable="yes">July</item>
<item translatable="yes">August</item>
<item translatable="yes">September</item>
<item translatable="yes">October</item>
<item translatable="yes">November</item>
<item translatable="yes">December</item>
</items>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2018-2019 Chris Cromer
~
~ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
~
~ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
~
~ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
~
~ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
~
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<gresources>
<gresource prefix="/cl/cromer/ubb/sernatur">
<file preprocess="xml-stripblanks">tourist.list.ui</file>
<file preprocess="xml-stripblanks">tourist.editor.ui</file>
<file preprocess="xml-stripblanks">tourist.illnesses.ui</file>
<file preprocess="xml-stripblanks">tourist.illness.editor.ui</file>
</gresource>
</gresources>

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright 2018-2019 Chris Cromer
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<interface domain="sernatur">
<requires lib="gtk+" version="3.20"/>
<template class="SernaturTouristIllnessEditor" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="title" translatable="yes">Add Illness</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="show_menubar">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="row_spacing">5</property>
<property name="column_spacing">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Illness</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="button_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="spacing">25</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="close_illness">
<property name="label" translatable="yes">Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Close this window.</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="add_illness">
<property name="label" translatable="yes">Add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Save this place.</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="illness">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright 2018-2019 Chris Cromer
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<interface domain="sernatur">
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="liststore1"/>
<template class="SernaturTouristIllnesses" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="title" translatable="yes">Illnesses</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="default_height">480</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="show_menubar">False</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="illness_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscroll_policy">natural</property>
<property name="vscroll_policy">natural</property>
<property name="model">liststore1</property>
<property name="fixed_height_mode">True</property>
<property name="enable_grid_lines">both</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="selection">
<property name="mode">multiple</property>
<signal name="changed" handler="on_changed_selection" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="illness">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Illness</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="column_spacing">25</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkButton" id="add_illness">
<property name="label" translatable="yes">Add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Add new illnesses.</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="close_illness">
<property name="label" translatable="yes">Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Close this window.</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete_illness">
<property name="label" translatable="yes">Delete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Delete illnesses.</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

193
data/ui/tourist.list.ui Normal file
View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright 2018-2019 Chris Cromer
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<interface domain="sernatur">
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="liststore1"/>
<template class="SernaturTouristList" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="title" translatable="yes">Tourists</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="default_height">480</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="show_menubar">False</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="tourist_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscroll_policy">natural</property>
<property name="vscroll_policy">natural</property>
<property name="model">liststore1</property>
<property name="fixed_height_mode">True</property>
<property name="enable_grid_lines">both</property>
<property name="enable_tree_lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="selection">
<property name="mode">multiple</property>
<signal name="changed" handler="on_changed_selection" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="run">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">RUN</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="tourist_name">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Name</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">1</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="birthdate">
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Birthdate</property>
<property name="clickable">True</property>
<signal name="clicked" handler="on_clicked_column" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="markup">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="hexpand">True</property>
<property name="column_spacing">25</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkButton" id="edit_tourist">
<property name="label" translatable="yes">Edit</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Edit selected tourist.</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="new_tourist">
<property name="label" translatable="yes">New</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Create a new tourist.</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="delete_tourist">
<property name="label" translatable="yes">Delete</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Delete selected tourist.</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="close_tourist">
<property name="label" translatable="yes">Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Close this window.</property>
<signal name="clicked" handler="on_clicked_button" swapped="no"/>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
</template>
</interface>

View File

@ -94,7 +94,7 @@ namespace LibSernatur {
* @return Returns a list of Ciudad
* @throws PostgresError If there is a problem with with escaping strings
*/
public static List<Ciudad> get_all_ciudades_in_region(Connection conn, uint region_id) throws PostgresError {
public static List<Ciudad> get_all_ciudades_in_region (Connection conn, uint region_id) throws PostgresError {
var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_CITIES_BY_REGION, region_id));
if (res.get_status () != ExecStatus.TUPLES_OK) {
#if DEBUG

View File

@ -44,8 +44,9 @@ namespace LibSernatur {
* Get all tuples and fields from database
* @param conn The database connection to use
* @return Returns a list of Enfermedad
* @throws PostgresError If there is a problem with with escaping strings
*/
public static List<Enfermedad> get_all_enfermedades (Connection conn) {
public static List<Enfermedad> get_all_enfermedades (Connection conn) throws PostgresError {
var res = conn.db.exec ("
SELECT id_enfermedad, descripcion_enfermedad FROM enfermedad
");

View File

@ -94,6 +94,112 @@ JOIN enfermedad E ON (TE.id_enfermedad = E.id_enfermedad)
}
return list;
}
/**
* Get all tuples and fields from database that are connected with a certain RUN
* @param conn The database connection to use
* @param run The RUN to search for
* @return Returns a list of TieneEnfermedad
* @throws PostgresError If there is a problem with with escaping strings
*/
public static List<TieneEnfermedad> get_all_tiene_enfermedades_by_run (Connection conn, string run) throws PostgresError {
var res = conn.db.exec ("
SELECT T.rut_turista, T.nombre_turista, T.fecha_nacimento,
C.id_contacto, C.telefono_emergencia, C.nombre_emergencia,
E.id_enfermedad, E.descripcion_enfermedad
FROM tiene_enfermedad TE
JOIN turista T ON (TE.rut_turista = T.rut_turista)
LEFT JOIN contacto_emergencia C ON (T.id_contacto = C.id_contacto)
JOIN enfermedad E ON (TE.id_enfermedad = E.id_enfermedad)
WHERE (TE.rut_turista = '" + conn.escape (run) + "')
");
if (res.get_status () != ExecStatus.TUPLES_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
return new List<TieneEnfermedad> ();
#endif
}
var wra = new ResultWrapper (res);
List<TieneEnfermedad> list = new List<TieneEnfermedad> ();
int n = res.get_n_tuples ();
for (int i = 0; i < n; i++) {
try {
var tiene_enfermedad = new TieneEnfermedad (
new Turista (wra.get_string_n (i, "rut_turista"),
wra.get_string_n (i, "nombre_turista"),
wra.get_string_n (i, "fecha_nacimento"),
new ContactoEmergencia (wra.get_int_n (i, "id_contacto"),
wra.get_int_n (i, "telefono_emergencia"),
wra.get_string_n (i, "nombre_emergencia")
)
),
new Enfermedad (wra.get_int_n (i, "id_enfermedad"),
wra.get_string_n (i, "descripcion_enfermedad")
)
);
list.append (tiene_enfermedad);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
}
return list;
}
/**
* Insert an illness in the database
* @param conn The database connection
* @param tiene_enfermedad The illness to insert
* @throws PostgresError Thrown if there is a problem with escaping strings
*/
public static void insert_illness (Connection conn, TieneEnfermedad tiene_enfermedad) throws PostgresError {
var res = conn.db.exec ("
INSERT INTO tiene_enfermedad
(rut_turista, id_enfermedad)
VALUES
(
'" + conn.escape (tiene_enfermedad.turista.rut_turista) + "',
" + tiene_enfermedad.enfermedad.id_enfermedad.to_string () + "
)
");
if (res.get_status () != ExecStatus.COMMAND_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
}
/**
* Delete an illness in the database
* @param conn The database connection
* @param tiene_enfermedad The illness to delete
* @throws PostgresError Thrown if there is a problem with escaping strings
*/
public static void delete_illness (Connection conn, TieneEnfermedad tiene_enfermedad) throws PostgresError {
var res = conn.db.exec ("
DELETE FROM tiene_enfermedad
WHERE (
rut_turista = '" + conn.escape (tiene_enfermedad.turista.rut_turista) + "' AND
id_enfermedad = " + tiene_enfermedad.enfermedad.id_enfermedad.to_string () + "
)
");
if (res.get_status () != ExecStatus.COMMAND_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
}
}
}
}

View File

@ -71,7 +71,7 @@ namespace LibSernatur {
* @throws PostgresError If there is a problem with with escaping strings
*/
public static List<Tour> get_all_tours (Connection conn) throws PostgresError {
var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_TOURS, null));
var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_TOURS));
if (res.get_status () != ExecStatus.TUPLES_OK) {
#if DEBUG
error (conn.db.get_error_message ());

View File

@ -22,15 +22,15 @@ namespace LibSernatur {
*/
public class Turista : Object {
/**
* The RUT of the tourist
* The RUT of the touristist
*/
public string rut_turista { get; set; default = ""; }
/**
* The tourist name
* The touristist name
*/
public string nombre_turista { get; set; default = ""; }
/**
* The birth date of the tourist
* The birth date of the touristist
*/
public string fecha_nacimento { get; set; default = ""; }
/**
@ -40,9 +40,9 @@ namespace LibSernatur {
/**
* Initilize the Turista class
* @param rut_turista The RUT of the tourist
* @param nombre_turista The tourist name
* @param fecha_nacimento The birth date of the tourist
* @param rut_turista The RUT of the touristist
* @param nombre_turista The touristist name
* @param fecha_nacimento The birth date of the touristist
* @param contacto_emergencia The emergency contact
*/
public Turista (string rut_turista = "", string nombre_turista = "", string fecha_nacimento = "", ContactoEmergencia? contacto_emergencia = null) {
@ -56,14 +56,10 @@ namespace LibSernatur {
* Get all tuples and fields from database
* @param conn The database connection to use
* @return Returns a list of Turista
* @throws PostgresError If there is a problem with with escaping strings
*/
public static List<Turista> get_all_turistas (Connection conn) {
var res = conn.db.exec ("
SELECT T.rut_turista, T.nombre_turista, T.fecha_nacimento,
C.id_contacto, C.telefono_emergencia, C.nombre_emergencia
FROM turista T
JOIN contacto_emergencia C ON (T.id_contacto = C.id_contacto)
");
public static List<Turista> get_all_turistas (Connection conn) throws PostgresError {
var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_TOURISTS));
if (res.get_status () != ExecStatus.TUPLES_OK) {
#if DEBUG
error (conn.db.get_error_message ());
@ -98,6 +94,114 @@ JOIN contacto_emergencia C ON (T.id_contacto = C.id_contacto)
}
return list;
}
/**
* Get a single tuple and field from database
* @param conn The database connection to use
* @return Returns a Turista
* @throws PostgresError If there is a problem with with escaping strings
*/
public static Turista? get_turista_by_run (Connection conn, string run) throws PostgresError {
var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_TOURIST_BY_RUN, run));
if (res.get_status () != ExecStatus.TUPLES_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
return null;
#endif
}
var wra = new ResultWrapper (res);
Turista turista = null;
int n = res.get_n_tuples ();
for (int i = 0; i < n; i++) {
try {
turista = new Turista (wra.get_string_n (i, "rut_turista"),
wra.get_string_n (i, "nombre_turista"),
wra.get_string_n (i, "fecha_nacimento"),
new ContactoEmergencia (wra.get_int_n (i, "id_contacto"),
wra.get_int_n (i, "telefono_emergencia"),
wra.get_string_n (i, "nombre_emergencia")
)
);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
}
return turista;
}
/**
* Update a tourist in the database
* @param conn The database connection
* @param tourist The tourist to update
* @throws PostgresError Thrown if there is a problem with escaping strings
* @throws DBError Thrown if an invalid value is passed
*/
public static void update_tourist (Connection conn, Turista tourist, string original_run) throws PostgresError, DBError {
if (tourist.rut_turista.strip () == "") {
throw new DBError.INVALID_VALUE (_ ("The RUN of the tourist is invalid!"));
}
var res = conn.db.exec (Query.get_query (conn, Query.Type.UPDATE_TOURIST, tourist, original_run));
if (res.get_status () != ExecStatus.COMMAND_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
}
/**
* Insert a tourist in the database
* @param conn The database connection
* @param tourist The tourist to insert
* @throws PostgresError Thrown if there is a problem with escaping strings
* @throws DBError Thrown if an invalid value is passed
*/
public static void insert_tourist (Connection conn, Turista tourist) throws PostgresError, DBError {
if (tourist.rut_turista.strip () == "") {
throw new DBError.INVALID_VALUE (_ ("The RUN of the tourist is invalid!"));
}
var res = conn.db.exec (Query.get_query (conn, Query.Type.INSERT_TOURIST, tourist));
if (res.get_status () != ExecStatus.COMMAND_OK) {
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
}
/**
* Delete a tourist in the database
* @param conn The database connection
* @param tourist The tourist to delete
* @throws PostgresError Thrown if there is a problem with escaping strings
* @throws DBError Thrown if an invalid value is passed
*/
public static void delete_tourist (Connection conn, Turista tourist) throws PostgresError, DBError {
if (tourist.rut_turista.strip () == "") {
throw new DBError.INVALID_VALUE (_ ("The RUN of the tourist is invalid!"));
}
var res = conn.db.exec (Query.get_query (conn, Query.Type.DELETE_TOURIST, tourist));
if (res.get_status () != ExecStatus.COMMAND_OK) {
if (res.get_error_field (FieldCode.SQLSTATE) == "23503") {
throw new DBError.FOREIGN_KEY_CONSTAINT (res.get_error_field (FieldCode.MESSAGE_PRIMARY));
}
#if DEBUG
error (conn.db.get_error_message ());
#else
warning (conn.db.get_error_message ());
#endif
}
}
}
}
}

View File

@ -180,7 +180,7 @@ namespace LibSernatur {
throw new InvalidRut.INVALID (_ ("The RUT %s has an invalid character!"), rut);
}
}
catch (Error e) {
catch (RegexError e) {
#if DEBUG
error (e.message);
#else
@ -202,7 +202,7 @@ namespace LibSernatur {
}
pretty();
}
catch (Error e) {
catch (RegexError e) {
#if DEBUG
error (e.message);
#else

View File

@ -39,10 +39,24 @@ namespace LibSernatur {
SELECT_VEHICLE_REQUIRED_BY_TOUR,
INSERT_VEHICLE_REQUIRED,
UPDATE_VEHICLE_REQUIRED,
DELETE_VEHICLE_REQUIRED
DELETE_VEHICLE_REQUIRED,
SELECT_ALL_TOURISTS,
SELECT_TOURIST_BY_RUN,
INSERT_TOURIST,
UPDATE_TOURIST,
DELETE_TOURIST
}
public static string get_query (Connection conn, Type type, T? t = null) throws PostgresError {
/**
* Return a query to be run
* @param conn The connection which is used for escaping strings
* @param type Which type of query is required
* @param t Generic variable whose use depends on the query
* @param t2 Generic variable whose use depends on the query
* @return Returns a string which contains a query
* @throws PostgresError Thrown if escaping strings fails
*/
public static string get_query (Connection conn, Type type, T? t = null, T? t2 = null) throws PostgresError {
switch (type) {
case SELECT_ALL_CITIES:
return "
@ -247,7 +261,7 @@ id_tour = " + tour.id_tour.to_string () + "
case INSERT_VEHICLE_REQUIRED:
RequerirAuto requerir_auto = (RequerirAuto) t;
return "
return "
INSERT INTO requerir_auto
(id_tour, patente, chofer)
VALUES
@ -259,7 +273,7 @@ VALUES
case UPDATE_VEHICLE_REQUIRED:
RequerirAuto requerir_auto = (RequerirAuto) t;
return "
return "
UPDATE requerir_auto SET
patente = '" + conn.escape (requerir_auto.vehiculo.patente) + "',
chofer = '" + conn.escape (requerir_auto.chofer) + "'
@ -267,10 +281,55 @@ WHERE id_tour = " + requerir_auto.tour.id_tour.to_string ();
case DELETE_VEHICLE_REQUIRED:
Tour tour = (Tour) t;
return "
return "
DELETE FROM requerir_auto
WHERE (
id_tour = " + tour.id_tour.to_string () + "
)";
case SELECT_ALL_TOURISTS:
return "
SELECT T.rut_turista, T.nombre_turista, T.fecha_nacimento,
C.id_contacto, C.telefono_emergencia, C.nombre_emergencia
FROM turista T
LEFT JOIN contacto_emergencia C ON (T.id_contacto = C.id_contacto)";
case SELECT_TOURIST_BY_RUN:
string run = (string) t;
return "
SELECT T.rut_turista, T.nombre_turista, T.fecha_nacimento,
C.id_contacto, C.telefono_emergencia, C.nombre_emergencia
FROM turista T
LEFT JOIN contacto_emergencia C ON (T.id_contacto = C.id_contacto)
WHERE rut_turista = '" + conn.escape (run) + "'";
case INSERT_TOURIST:
Turista turista = (Turista) t;
return "
INSERT INTO turista
(rut_turista, nombre_turista, fecha_nacimento)
VALUES
(
'" + conn.escape (turista.rut_turista) + "'',
'" + conn.escape (turista.nombre_turista) + "',
'" + conn.escape (turista.fecha_nacimento) + "'
)";
case UPDATE_TOURIST:
Turista turista = (Turista) t;
return "
UPDATE turista SET
rut_turista = '" + conn.escape (turista.rut_turista) + "',
nombre_turista = '" + conn.escape (turista.nombre_turista) + "',
fecha_nacimento = '" + conn.escape (turista.fecha_nacimento) + "'
WHERE rut_turista = '" + conn.escape ((string) t2) + "'";
case DELETE_TOURIST:
Turista turista = (Turista) t;
return "
DELETE FROM turista
WHERE (
rut_turista = '" + conn.escape (turista.rut_turista) + "'
)";
default:

View File

@ -6,12 +6,18 @@ lib/db/ciudad.vala
lib/db/lugar.vala
lib/db/region.vala
lib/db/tour.vala
lib/db/requerir_auto.vala
lib/db/turista.vala
src/sernatur.vala
src/main_window.vala
src/tour_list.vala
src/tour_editor.vala
src/tour_places.vala
src/tour_assign_vehicle.vala
src/tourist_list.vala
src/tourist_editor.vala
src/tourist_illnesses.vala
src/tourist_illness_editor.vala
src/query_window.vala
data/ui/main.window.ui
data/ui/main.splash.ui
@ -20,6 +26,10 @@ data/ui/tour.editor.ui
data/ui/tour.places.ui
data/ui/tour.place.editor.ui
data/ui/tour.assign.vehicle.ui
data/ui/tourist.list.ui
data/ui/tourist.editor.ui
data/ui/tourist.illnesses.ui
data/ui/tourist.illness.editor.ui
data/ui/place.editor.ui
data/ui/query.window.ui
data/ui/query.tree.ui

187
po/es.po
View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sernatur\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-01-20 17:47-0300\n"
"PO-Revision-Date: 2019-01-20 17:51-0300\n"
"POT-Creation-Date: 2019-01-21 00:47-0300\n"
"PO-Revision-Date: 2019-01-21 00:57-0300\n"
"Last-Translator: Chris Cromer <chris@cromer.cl>\n"
"Language-Team: none\n"
"Language: es\n"
@ -45,7 +45,7 @@ msgid "The verifier %C is invalid!"
msgstr "El verificador %C es invalido!"
#: lib/db/asociado.vala:121 lib/db/tour.vala:123 lib/db/tour.vala:145
#: lib/db/tour.vala:180
#: lib/db/tour.vala:180 lib/db/requerir_auto.vala:196
msgid "The id of the tour is invalid!"
msgstr "El id del tour es invalido!"
@ -69,6 +69,14 @@ msgstr "El id del lugar es invalida!"
msgid "The id of the region is invalid!"
msgstr "El id de la región es invalida!"
#: lib/db/requerir_auto.vala:154 lib/db/requerir_auto.vala:175
msgid "The id of the tour or the license plate for the vehicle is invalid!"
msgstr "El id del tour o del patente es invalido!"
#: lib/db/turista.vala:149 lib/db/turista.vala:170 lib/db/turista.vala:191
msgid "The RUN of the tourist is invalid!"
msgstr "El RUN de la turista es invalido!"
#: src/sernatur.vala:87
#, c-format
msgid "Error: %s\n"
@ -85,14 +93,16 @@ msgstr ""
msgid "SERNATUR version: "
msgstr "Versión de SERNATUR: "
#: src/main_window.vala:216
#: src/main_window.vala:227
msgid "Error: Could not connect to the database!"
msgstr "Error: No se puede conectar al base de datos!"
#: src/main_window.vala:228 src/tour_list.vala:233 src/tour_editor.vala:231
#: src/main_window.vala:239 src/tour_list.vala:233 src/tour_editor.vala:231
#: src/tour_editor.vala:248 src/tour_editor.vala:280 src/tour_editor.vala:297
#: src/tour_editor.vala:329 src/tour_editor.vala:346
#: src/tour_assign_vehicle.vala:99
#: src/tour_assign_vehicle.vala:99 src/tourist_list.vala:206
#: src/tourist_editor.vala:99 src/tourist_editor.vala:112
#: src/tourist_editor.vala:128 src/tourist_editor.vala:141
msgid "Error"
msgstr "Error"
@ -148,23 +158,66 @@ msgstr "Error: El nombre del chofer no puede estar en blanco!"
msgid "Unassigned"
msgstr "Sin asignar"
#: src/query_window.vala:290 data/ui/main.window.ui:127
#: src/tourist_list.vala:164
msgid "Are you sure you wish to delete this tourist?"
msgstr "¿Usted está seguro que quiere borrar esta turista?"
#: src/tourist_list.vala:171
msgid "Are you sure you wish to delete these tourists?"
msgstr "¿Usted está seguro que quiere borrar estas turistas?"
#: src/tourist_list.vala:202
#, c-format
msgid ""
"Error: Could not delete tourist \"%s\" because there is still information "
"associated with them!"
msgstr ""
"Error: No se puede borrar la turista \"%s\" porque hay información asociado "
"con la turista!"
#: src/tourist_editor.vala:95
msgid "Error: Tourist name cannot be left blank!"
msgstr "Error: El nombre de la turista no puede estar en blanco!"
#: src/tourist_editor.vala:108
msgid "Error: Tourist RUN cannot be left blank!"
msgstr "Error: El RUN de la turista no puede estar en blanco!"
#: src/tourist_editor.vala:124
msgid "Error: The RUN entered is invalid!"
msgstr "Error: El RUN ingresado es invalido!"
#: src/tourist_editor.vala:137
#, c-format
msgid "Error: A tourist with the RUN \"%s\" already exists!"
msgstr "Error: Una turista con el RUN \"%s\" ya existe!"
#: src/tourist_illnesses.vala:129
msgid "Are you sure you wish to delete this illness from this tourist?"
msgstr "¿Usted está seguro que quiere borrar este enfermedad de la turista?"
#: src/tourist_illnesses.vala:136
msgid "Are you sure you wish to delete these illnesses from this tourist?"
msgstr ""
"¿Usted está seguro que quiere borrar estos enfermedades de esta turista?"
#: src/query_window.vala:290 data/ui/main.window.ui:105
msgid "(Q1) Regions with discounts"
msgstr "(Q1) Regiones sin descuentos"
#: src/query_window.vala:303 data/ui/main.window.ui:135
#: src/query_window.vala:303 data/ui/main.window.ui:113
msgid "(Q2) Tour values"
msgstr "(Q2) Valores tour"
#: src/query_window.vala:316 data/ui/main.window.ui:143
#: src/query_window.vala:316 data/ui/main.window.ui:121
msgid "(Q3) Coordinator total"
msgstr "(Q3) Total de coordinadores"
#: src/query_window.vala:329 data/ui/main.window.ui:151
#: src/query_window.vala:329 data/ui/main.window.ui:129
msgid "(Q4) Tourist total"
msgstr "(Q4) Total de turistas"
#: src/query_window.vala:342 data/ui/main.window.ui:159
#: src/query_window.vala:342 data/ui/main.window.ui:137
msgid "(Q5) Vehicle total"
msgstr "(Q5) Total de vehículos"
@ -180,23 +233,15 @@ msgstr "Tours"
msgid "Staff"
msgstr "Empleados"
#: data/ui/main.window.ui:69
#: data/ui/main.window.ui:69 data/ui/tourist.list.ui:23
msgid "Tourists"
msgstr "Turistas"
#: data/ui/main.window.ui:79
msgid "Illnesses"
msgstr "Enfermedades"
#: data/ui/main.window.ui:87
msgid "Participate"
msgstr "Participar"
#: data/ui/main.window.ui:105
#: data/ui/main.window.ui:83
msgid "Quit"
msgstr "Salir"
#: data/ui/main.window.ui:117
#: data/ui/main.window.ui:95
msgid "_Views"
msgstr "_Vistas"
@ -231,7 +276,7 @@ msgstr "Ciudad"
msgid "Region"
msgstr "Región"
#: data/ui/tour.list.ui:170
#: data/ui/tour.list.ui:170 data/ui/tourist.list.ui:128
msgid "Edit"
msgstr "Editar"
@ -240,6 +285,7 @@ msgid "Edit selected tour."
msgstr "Editar el tour seleccionado."
#: data/ui/tour.list.ui:185 data/ui/tour.places.ui:212
#: data/ui/tourist.list.ui:143
msgid "New"
msgstr "Nuevo"
@ -247,7 +293,8 @@ msgstr "Nuevo"
msgid "Create a new tour."
msgstr "Crear un tour nuevo."
#: data/ui/tour.list.ui:199
#: data/ui/tour.list.ui:199 data/ui/tourist.list.ui:157
#: data/ui/tourist.illnesses.ui:128
msgid "Delete"
msgstr "Borrar"
@ -256,11 +303,14 @@ msgid "Delete selected tour."
msgstr "Borrar el tour seleccionado."
#: data/ui/tour.list.ui:214 data/ui/tour.places.ui:198
#: data/ui/query.window.ui:66
#: data/ui/tourist.list.ui:172 data/ui/tourist.illnesses.ui:114
#: data/ui/tourist.illness.editor.ui:73 data/ui/query.window.ui:66
msgid "Close"
msgstr "Cerrar"
#: data/ui/tour.list.ui:218 data/ui/tour.places.ui:202
#: data/ui/tourist.list.ui:176 data/ui/tourist.illnesses.ui:118
#: data/ui/tourist.illness.editor.ui:77
msgid "Close this window."
msgstr "Cerrar esta ventana."
@ -277,7 +327,8 @@ msgid "Create a new city by typing here."
msgstr "Crear una nueva ciudad con escribir aquí."
#: data/ui/tour.editor.ui:286 data/ui/tour.place.editor.ui:149
#: data/ui/tour.assign.vehicle.ui:67 data/ui/place.editor.ui:250
#: data/ui/tour.assign.vehicle.ui:67 data/ui/tourist.editor.ui:131
#: data/ui/place.editor.ui:250
msgid "Cancel"
msgstr "Cancelar"
@ -302,7 +353,8 @@ msgid "Assign a vehicle to this tour."
msgstr "Asignar un vehículo a este tour."
#: data/ui/tour.editor.ui:343 data/ui/tour.place.editor.ui:168
#: data/ui/tour.assign.vehicle.ui:86 data/ui/place.editor.ui:269
#: data/ui/tour.assign.vehicle.ui:86 data/ui/tourist.editor.ui:169
#: data/ui/place.editor.ui:269
msgid "Save"
msgstr "Guardar"
@ -338,7 +390,8 @@ msgstr "Fecha de Salida"
msgid "Departure Time"
msgstr "Hora de Salida"
#: data/ui/tour.places.ui:184
#: data/ui/tour.places.ui:184 data/ui/tourist.illnesses.ui:100
#: data/ui/tourist.illness.editor.ui:92
msgid "Add"
msgstr "Agregar"
@ -370,67 +423,83 @@ msgstr "Salida"
msgid "Cancel the modification of this place."
msgstr "Cancelar la modificación de este lugar."
#: data/ui/tour.place.editor.ui:172 data/ui/place.editor.ui:273
#: data/ui/tour.place.editor.ui:172 data/ui/tourist.illness.editor.ui:96
#: data/ui/place.editor.ui:273
msgid "Save this place."
msgstr "Guardar este lugar."
#: data/ui/tour.place.editor.ui:270 data/ui/tour.place.editor.ui:440
#: data/ui/tourist.editor.ui:223
msgid "Year"
msgstr "Año"
#: data/ui/tour.place.editor.ui:286 data/ui/tour.place.editor.ui:456
#: data/ui/tourist.editor.ui:239
msgid "Month"
msgstr "Mes"
#: data/ui/tour.place.editor.ui:298 data/ui/tour.place.editor.ui:472
#: data/ui/tourist.editor.ui:251
msgid "Day"
msgstr "Día"
#: data/ui/tour.place.editor.ui:341 data/ui/tour.place.editor.ui:517
#: data/ui/tourist.editor.ui:294
msgid "January"
msgstr "Enero"
#: data/ui/tour.place.editor.ui:342 data/ui/tour.place.editor.ui:518
#: data/ui/tourist.editor.ui:295
msgid "February"
msgstr "Febraro"
#: data/ui/tour.place.editor.ui:343 data/ui/tour.place.editor.ui:519
#: data/ui/tourist.editor.ui:296
msgid "March"
msgstr "Marzo"
#: data/ui/tour.place.editor.ui:344 data/ui/tour.place.editor.ui:520
#: data/ui/tourist.editor.ui:297
msgid "April"
msgstr "Abril"
#: data/ui/tour.place.editor.ui:345 data/ui/tour.place.editor.ui:521
#: data/ui/tourist.editor.ui:298
msgid "May"
msgstr "Mayo"
#: data/ui/tour.place.editor.ui:346 data/ui/tour.place.editor.ui:522
#: data/ui/tourist.editor.ui:299
msgid "June"
msgstr "Junio"
#: data/ui/tour.place.editor.ui:347 data/ui/tour.place.editor.ui:523
#: data/ui/tourist.editor.ui:300
msgid "July"
msgstr "Julio"
#: data/ui/tour.place.editor.ui:348 data/ui/tour.place.editor.ui:524
#: data/ui/tourist.editor.ui:301
msgid "August"
msgstr "Agosto"
#: data/ui/tour.place.editor.ui:349 data/ui/tour.place.editor.ui:525
#: data/ui/tourist.editor.ui:302
msgid "September"
msgstr "Septiembre"
#: data/ui/tour.place.editor.ui:350 data/ui/tour.place.editor.ui:526
#: data/ui/tourist.editor.ui:303
msgid "October"
msgstr "Octubre"
#: data/ui/tour.place.editor.ui:351 data/ui/tour.place.editor.ui:527
#: data/ui/tourist.editor.ui:304
msgid "November"
msgstr "Noviembre"
#: data/ui/tour.place.editor.ui:352 data/ui/tour.place.editor.ui:528
#: data/ui/tourist.editor.ui:305
msgid "December"
msgstr "Diciembre"
@ -450,6 +519,66 @@ msgstr "Conductor"
msgid "The licence plate, make, year, and capacity of the vehicle."
msgstr "La patente, marca, año y capacidad del vehículo."
#: data/ui/tourist.list.ui:68 data/ui/tourist.editor.ui:60
msgid "RUN"
msgstr "RUN"
#: data/ui/tourist.list.ui:82 data/ui/tourist.editor.ui:93
msgid "Name"
msgstr "Nombre"
#: data/ui/tourist.list.ui:96 data/ui/tourist.editor.ui:201
msgid "Birthdate"
msgstr "Fecha de nacimiento"
#: data/ui/tourist.list.ui:133
msgid "Edit selected tourist."
msgstr "Editar la turista seleccionada."
#: data/ui/tourist.list.ui:147
msgid "Create a new tourist."
msgstr "Crear una turista nueva."
#: data/ui/tourist.list.ui:162
msgid "Delete selected tourist."
msgstr "Borrar la turista seleccionada."
#: data/ui/tourist.editor.ui:36
msgid "Tourist Editor"
msgstr "Editor de Turista"
#: data/ui/tourist.editor.ui:135
msgid "Cancel the modification of this tourist."
msgstr "Cancelar la modificación de esta turista."
#: data/ui/tourist.editor.ui:150 data/ui/tourist.illnesses.ui:23
msgid "Illnesses"
msgstr "Enfermedades"
#: data/ui/tourist.editor.ui:154
msgid "Add or edit illnesses."
msgstr "Agregar o editar enfermedades."
#: data/ui/tourist.editor.ui:173
msgid "Save this tourist."
msgstr "Guardar esta turista."
#: data/ui/tourist.illnesses.ui:68 data/ui/tourist.illness.editor.ui:53
msgid "Illness"
msgstr "Enfermedad"
#: data/ui/tourist.illnesses.ui:104
msgid "Add new illnesses."
msgstr "Agregar nuevo enfermedades."
#: data/ui/tourist.illnesses.ui:132
msgid "Delete illnesses."
msgstr "Borrar enfermedades."
#: data/ui/tourist.illness.editor.ui:22
msgid "Add Illness"
msgstr "Agregar Enfermedad"
#: data/ui/place.editor.ui:27
msgid "Place Editor"
msgstr "Editor de Lugar"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sernatur\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-01-20 17:47-0300\n"
"PO-Revision-Date: 2019-01-20 17:54-0300\n"
"POT-Creation-Date: 2019-01-21 00:47-0300\n"
"PO-Revision-Date: 2019-01-21 00:57-0300\n"
"Last-Translator: Chris Cromer <chris@cromer.cl>\n"
"Language-Team: none\n"
"Language: es\n"
@ -45,7 +45,7 @@ msgid "The verifier %C is invalid!"
msgstr "La wea %C es invalido!"
#: lib/db/asociado.vala:121 lib/db/tour.vala:123 lib/db/tour.vala:145
#: lib/db/tour.vala:180
#: lib/db/tour.vala:180 lib/db/requerir_auto.vala:196
msgid "The id of the tour is invalid!"
msgstr "El id de la wea es invalida!"
@ -69,6 +69,14 @@ msgstr "El id de la wea es invalida!"
msgid "The id of the region is invalid!"
msgstr "El id de la wea es invalida!"
#: lib/db/requerir_auto.vala:154 lib/db/requerir_auto.vala:175
msgid "The id of the tour or the license plate for the vehicle is invalid!"
msgstr "El id del tour o del patente es invalido!"
#: lib/db/turista.vala:149 lib/db/turista.vala:170 lib/db/turista.vala:191
msgid "The RUN of the tourist is invalid!"
msgstr "El RUN de la turista es invalido!"
#: src/sernatur.vala:87
#, c-format
msgid "Error: %s\n"
@ -85,14 +93,16 @@ msgstr ""
msgid "SERNATUR version: "
msgstr "Versión de SERNATUR: "
#: src/main_window.vala:216
#: src/main_window.vala:227
msgid "Error: Could not connect to the database!"
msgstr "Puta la wea: No se puede conectar al base de datos!"
#: src/main_window.vala:228 src/tour_list.vala:233 src/tour_editor.vala:231
#: src/main_window.vala:239 src/tour_list.vala:233 src/tour_editor.vala:231
#: src/tour_editor.vala:248 src/tour_editor.vala:280 src/tour_editor.vala:297
#: src/tour_editor.vala:329 src/tour_editor.vala:346
#: src/tour_assign_vehicle.vala:99
#: src/tour_assign_vehicle.vala:99 src/tourist_list.vala:206
#: src/tourist_editor.vala:99 src/tourist_editor.vala:112
#: src/tourist_editor.vala:128 src/tourist_editor.vala:141
msgid "Error"
msgstr "Puta la wea"
@ -148,23 +158,66 @@ msgstr "Error: El nombre del weon no puede estar en blanco!"
msgid "Unassigned"
msgstr "Ninguna wea"
#: src/query_window.vala:290 data/ui/main.window.ui:127
#: src/tourist_list.vala:164
msgid "Are you sure you wish to delete this tourist?"
msgstr "¿Usted está seguro que quiere borrar esta turista?"
#: src/tourist_list.vala:171
msgid "Are you sure you wish to delete these tourists?"
msgstr "¿Usted está seguro que quiere borrar estas turistas?"
#: src/tourist_list.vala:202
#, c-format
msgid ""
"Error: Could not delete tourist \"%s\" because there is still information "
"associated with them!"
msgstr ""
"Error: No se puede borrar la turista \"%s\" porque hay información asociado "
"con la turista!"
#: src/tourist_editor.vala:95
msgid "Error: Tourist name cannot be left blank!"
msgstr "Error: El nombre de la turista no puede estar en blanco!"
#: src/tourist_editor.vala:108
msgid "Error: Tourist RUN cannot be left blank!"
msgstr "Error: El RUN de la turista no puede estar en blanco!"
#: src/tourist_editor.vala:124
msgid "Error: The RUN entered is invalid!"
msgstr "Error: El RUN ingresado es invalido!"
#: src/tourist_editor.vala:137
#, c-format
msgid "Error: A tourist with the RUN \"%s\" already exists!"
msgstr "Error: Una turista con el RUN \"%s\" ya existe!"
#: src/tourist_illnesses.vala:129
msgid "Are you sure you wish to delete this illness from this tourist?"
msgstr "¿Usted está seguro que quiere borrar este enfermedad de la turista?"
#: src/tourist_illnesses.vala:136
msgid "Are you sure you wish to delete these illnesses from this tourist?"
msgstr ""
"¿Usted está seguro que quiere borrar estos enfermedades de esta turista?"
#: src/query_window.vala:290 data/ui/main.window.ui:105
msgid "(Q1) Regions with discounts"
msgstr "(Q1) Regiones sin descuentos"
#: src/query_window.vala:303 data/ui/main.window.ui:135
#: src/query_window.vala:303 data/ui/main.window.ui:113
msgid "(Q2) Tour values"
msgstr "(Q2) Valores tour"
#: src/query_window.vala:316 data/ui/main.window.ui:143
#: src/query_window.vala:316 data/ui/main.window.ui:121
msgid "(Q3) Coordinator total"
msgstr "(Q3) Total de coordinadores"
#: src/query_window.vala:329 data/ui/main.window.ui:151
#: src/query_window.vala:329 data/ui/main.window.ui:129
msgid "(Q4) Tourist total"
msgstr "(Q4) Total de turistas"
#: src/query_window.vala:342 data/ui/main.window.ui:159
#: src/query_window.vala:342 data/ui/main.window.ui:137
msgid "(Q5) Vehicle total"
msgstr "(Q5) Total de vehículos"
@ -180,23 +233,15 @@ msgstr "Tours"
msgid "Staff"
msgstr "Weones flojos"
#: data/ui/main.window.ui:69
#: data/ui/main.window.ui:69 data/ui/tourist.list.ui:23
msgid "Tourists"
msgstr "Weones visitores"
#: data/ui/main.window.ui:79
msgid "Illnesses"
msgstr "Enfermedades"
#: data/ui/main.window.ui:87
msgid "Participate"
msgstr "Participar"
#: data/ui/main.window.ui:105
#: data/ui/main.window.ui:83
msgid "Quit"
msgstr "Salir de la wea"
#: data/ui/main.window.ui:117
#: data/ui/main.window.ui:95
msgid "_Views"
msgstr "_Vistas"
@ -231,7 +276,7 @@ msgstr "Ciudad"
msgid "Region"
msgstr "Región"
#: data/ui/tour.list.ui:170
#: data/ui/tour.list.ui:170 data/ui/tourist.list.ui:128
msgid "Edit"
msgstr "Editar la wea"
@ -240,6 +285,7 @@ msgid "Edit selected tour."
msgstr "Editar la wea seleccionado."
#: data/ui/tour.list.ui:185 data/ui/tour.places.ui:212
#: data/ui/tourist.list.ui:143
msgid "New"
msgstr "Nueva wea"
@ -247,7 +293,8 @@ msgstr "Nueva wea"
msgid "Create a new tour."
msgstr "Crear una wea nueva."
#: data/ui/tour.list.ui:199
#: data/ui/tour.list.ui:199 data/ui/tourist.list.ui:157
#: data/ui/tourist.illnesses.ui:128
msgid "Delete"
msgstr "Borrar la wea"
@ -256,11 +303,14 @@ msgid "Delete selected tour."
msgstr "Borrar la wea seleccionado."
#: data/ui/tour.list.ui:214 data/ui/tour.places.ui:198
#: data/ui/query.window.ui:66
#: data/ui/tourist.list.ui:172 data/ui/tourist.illnesses.ui:114
#: data/ui/tourist.illness.editor.ui:73 data/ui/query.window.ui:66
msgid "Close"
msgstr "Cerrar la wea"
#: data/ui/tour.list.ui:218 data/ui/tour.places.ui:202
#: data/ui/tourist.list.ui:176 data/ui/tourist.illnesses.ui:118
#: data/ui/tourist.illness.editor.ui:77
msgid "Close this window."
msgstr "Cerrar la wea."
@ -277,7 +327,8 @@ msgid "Create a new city by typing here."
msgstr "Crear una nueva wea con escribir aquí."
#: data/ui/tour.editor.ui:286 data/ui/tour.place.editor.ui:149
#: data/ui/tour.assign.vehicle.ui:67 data/ui/place.editor.ui:250
#: data/ui/tour.assign.vehicle.ui:67 data/ui/tourist.editor.ui:131
#: data/ui/place.editor.ui:250
msgid "Cancel"
msgstr "Cancelar la wea"
@ -302,7 +353,8 @@ msgid "Assign a vehicle to this tour."
msgstr "Asignar un vehículo a esta wea."
#: data/ui/tour.editor.ui:343 data/ui/tour.place.editor.ui:168
#: data/ui/tour.assign.vehicle.ui:86 data/ui/place.editor.ui:269
#: data/ui/tour.assign.vehicle.ui:86 data/ui/tourist.editor.ui:169
#: data/ui/place.editor.ui:269
msgid "Save"
msgstr "Guardar la wea"
@ -338,7 +390,8 @@ msgstr "Fecha de Salida"
msgid "Departure Time"
msgstr "Hora de Salida"
#: data/ui/tour.places.ui:184
#: data/ui/tour.places.ui:184 data/ui/tourist.illnesses.ui:100
#: data/ui/tourist.illness.editor.ui:92
msgid "Add"
msgstr "Agregar una wea"
@ -370,67 +423,83 @@ msgstr "Salida"
msgid "Cancel the modification of this place."
msgstr "Cancelar la modificación de esta wea."
#: data/ui/tour.place.editor.ui:172 data/ui/place.editor.ui:273
#: data/ui/tour.place.editor.ui:172 data/ui/tourist.illness.editor.ui:96
#: data/ui/place.editor.ui:273
msgid "Save this place."
msgstr "Guardar esta wea."
#: data/ui/tour.place.editor.ui:270 data/ui/tour.place.editor.ui:440
#: data/ui/tourist.editor.ui:223
msgid "Year"
msgstr "Año"
#: data/ui/tour.place.editor.ui:286 data/ui/tour.place.editor.ui:456
#: data/ui/tourist.editor.ui:239
msgid "Month"
msgstr "Mes"
#: data/ui/tour.place.editor.ui:298 data/ui/tour.place.editor.ui:472
#: data/ui/tourist.editor.ui:251
msgid "Day"
msgstr "Día"
#: data/ui/tour.place.editor.ui:341 data/ui/tour.place.editor.ui:517
#: data/ui/tourist.editor.ui:294
msgid "January"
msgstr "Enero"
#: data/ui/tour.place.editor.ui:342 data/ui/tour.place.editor.ui:518
#: data/ui/tourist.editor.ui:295
msgid "February"
msgstr "Febraro"
#: data/ui/tour.place.editor.ui:343 data/ui/tour.place.editor.ui:519
#: data/ui/tourist.editor.ui:296
msgid "March"
msgstr "Marzo"
#: data/ui/tour.place.editor.ui:344 data/ui/tour.place.editor.ui:520
#: data/ui/tourist.editor.ui:297
msgid "April"
msgstr "Abril"
#: data/ui/tour.place.editor.ui:345 data/ui/tour.place.editor.ui:521
#: data/ui/tourist.editor.ui:298
msgid "May"
msgstr "Mayo"
#: data/ui/tour.place.editor.ui:346 data/ui/tour.place.editor.ui:522
#: data/ui/tourist.editor.ui:299
msgid "June"
msgstr "Junio"
#: data/ui/tour.place.editor.ui:347 data/ui/tour.place.editor.ui:523
#: data/ui/tourist.editor.ui:300
msgid "July"
msgstr "Julio"
#: data/ui/tour.place.editor.ui:348 data/ui/tour.place.editor.ui:524
#: data/ui/tourist.editor.ui:301
msgid "August"
msgstr "Agosto"
#: data/ui/tour.place.editor.ui:349 data/ui/tour.place.editor.ui:525
#: data/ui/tourist.editor.ui:302
msgid "September"
msgstr "Septiembre"
#: data/ui/tour.place.editor.ui:350 data/ui/tour.place.editor.ui:526
#: data/ui/tourist.editor.ui:303
msgid "October"
msgstr "Octubre"
#: data/ui/tour.place.editor.ui:351 data/ui/tour.place.editor.ui:527
#: data/ui/tourist.editor.ui:304
msgid "November"
msgstr "Noviembre"
#: data/ui/tour.place.editor.ui:352 data/ui/tour.place.editor.ui:528
#: data/ui/tourist.editor.ui:305
msgid "December"
msgstr "Diciembre"
@ -450,6 +519,66 @@ msgstr "Conductor"
msgid "The licence plate, make, year, and capacity of the vehicle."
msgstr "La patente, marca, año y capacidad de la wea."
#: data/ui/tourist.list.ui:68 data/ui/tourist.editor.ui:60
msgid "RUN"
msgstr "RUN"
#: data/ui/tourist.list.ui:82 data/ui/tourist.editor.ui:93
msgid "Name"
msgstr "Nombre"
#: data/ui/tourist.list.ui:96 data/ui/tourist.editor.ui:201
msgid "Birthdate"
msgstr "Fecha de nacimiento"
#: data/ui/tourist.list.ui:133
msgid "Edit selected tourist."
msgstr "Editar la turista seleccionada."
#: data/ui/tourist.list.ui:147
msgid "Create a new tourist."
msgstr "Crear una turista nueva."
#: data/ui/tourist.list.ui:162
msgid "Delete selected tourist."
msgstr "Borrar la turista seleccionada."
#: data/ui/tourist.editor.ui:36
msgid "Tourist Editor"
msgstr "Editor de Turista"
#: data/ui/tourist.editor.ui:135
msgid "Cancel the modification of this tourist."
msgstr "Cancelar la modificación de esta turista."
#: data/ui/tourist.editor.ui:150 data/ui/tourist.illnesses.ui:23
msgid "Illnesses"
msgstr "Enfermedades"
#: data/ui/tourist.editor.ui:154
msgid "Add or edit illnesses."
msgstr "Agregar o editar enfermedades."
#: data/ui/tourist.editor.ui:173
msgid "Save this tourist."
msgstr "Guardar esta turista."
#: data/ui/tourist.illnesses.ui:68 data/ui/tourist.illness.editor.ui:53
msgid "Illness"
msgstr "Enfermedad"
#: data/ui/tourist.illnesses.ui:104
msgid "Add new illnesses."
msgstr "Agregar nuevo enfermedades."
#: data/ui/tourist.illnesses.ui:132
msgid "Delete illnesses."
msgstr "Borrar enfermedades."
#: data/ui/tourist.illness.editor.ui:22
msgid "Add Illness"
msgstr "Agregar Enfermedad"
#: data/ui/place.editor.ui:27
msgid "Place Editor"
msgstr "Editor de la Wea"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: sernatur\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-01-20 17:47-0300\n"
"POT-Creation-Date: 2019-01-21 00:47-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -42,7 +42,7 @@ msgid "The verifier %C is invalid!"
msgstr ""
#: lib/db/asociado.vala:121 lib/db/tour.vala:123 lib/db/tour.vala:145
#: lib/db/tour.vala:180
#: lib/db/tour.vala:180 lib/db/requerir_auto.vala:196
msgid "The id of the tour is invalid!"
msgstr ""
@ -66,6 +66,14 @@ msgstr ""
msgid "The id of the region is invalid!"
msgstr ""
#: lib/db/requerir_auto.vala:154 lib/db/requerir_auto.vala:175
msgid "The id of the tour or the license plate for the vehicle is invalid!"
msgstr ""
#: lib/db/turista.vala:149 lib/db/turista.vala:170 lib/db/turista.vala:191
msgid "The RUN of the tourist is invalid!"
msgstr ""
#: src/sernatur.vala:87
#, c-format
msgid "Error: %s\n"
@ -80,14 +88,16 @@ msgstr ""
msgid "SERNATUR version: "
msgstr ""
#: src/main_window.vala:216
#: src/main_window.vala:227
msgid "Error: Could not connect to the database!"
msgstr ""
#: src/main_window.vala:228 src/tour_list.vala:233 src/tour_editor.vala:231
#: src/main_window.vala:239 src/tour_list.vala:233 src/tour_editor.vala:231
#: src/tour_editor.vala:248 src/tour_editor.vala:280 src/tour_editor.vala:297
#: src/tour_editor.vala:329 src/tour_editor.vala:346
#: src/tour_assign_vehicle.vala:99
#: src/tour_assign_vehicle.vala:99 src/tourist_list.vala:206
#: src/tourist_editor.vala:99 src/tourist_editor.vala:112
#: src/tourist_editor.vala:128 src/tourist_editor.vala:141
msgid "Error"
msgstr ""
@ -141,23 +151,63 @@ msgstr ""
msgid "Unassigned"
msgstr ""
#: src/query_window.vala:290 data/ui/main.window.ui:127
#: src/tourist_list.vala:164
msgid "Are you sure you wish to delete this tourist?"
msgstr ""
#: src/tourist_list.vala:171
msgid "Are you sure you wish to delete these tourists?"
msgstr ""
#: src/tourist_list.vala:202
#, c-format
msgid ""
"Error: Could not delete tourist \"%s\" because there is still information "
"associated with them!"
msgstr ""
#: src/tourist_editor.vala:95
msgid "Error: Tourist name cannot be left blank!"
msgstr ""
#: src/tourist_editor.vala:108
msgid "Error: Tourist RUN cannot be left blank!"
msgstr ""
#: src/tourist_editor.vala:124
msgid "Error: The RUN entered is invalid!"
msgstr ""
#: src/tourist_editor.vala:137
#, c-format
msgid "Error: A tourist with the RUN \"%s\" already exists!"
msgstr ""
#: src/tourist_illnesses.vala:129
msgid "Are you sure you wish to delete this illness from this tourist?"
msgstr ""
#: src/tourist_illnesses.vala:136
msgid "Are you sure you wish to delete these illnesses from this tourist?"
msgstr ""
#: src/query_window.vala:290 data/ui/main.window.ui:105
msgid "(Q1) Regions with discounts"
msgstr ""
#: src/query_window.vala:303 data/ui/main.window.ui:135
#: src/query_window.vala:303 data/ui/main.window.ui:113
msgid "(Q2) Tour values"
msgstr ""
#: src/query_window.vala:316 data/ui/main.window.ui:143
#: src/query_window.vala:316 data/ui/main.window.ui:121
msgid "(Q3) Coordinator total"
msgstr ""
#: src/query_window.vala:329 data/ui/main.window.ui:151
#: src/query_window.vala:329 data/ui/main.window.ui:129
msgid "(Q4) Tourist total"
msgstr ""
#: src/query_window.vala:342 data/ui/main.window.ui:159
#: src/query_window.vala:342 data/ui/main.window.ui:137
msgid "(Q5) Vehicle total"
msgstr ""
@ -173,23 +223,15 @@ msgstr ""
msgid "Staff"
msgstr ""
#: data/ui/main.window.ui:69
#: data/ui/main.window.ui:69 data/ui/tourist.list.ui:23
msgid "Tourists"
msgstr ""
#: data/ui/main.window.ui:79
msgid "Illnesses"
msgstr ""
#: data/ui/main.window.ui:87
msgid "Participate"
msgstr ""
#: data/ui/main.window.ui:105
#: data/ui/main.window.ui:83
msgid "Quit"
msgstr ""
#: data/ui/main.window.ui:117
#: data/ui/main.window.ui:95
msgid "_Views"
msgstr ""
@ -224,7 +266,7 @@ msgstr ""
msgid "Region"
msgstr ""
#: data/ui/tour.list.ui:170
#: data/ui/tour.list.ui:170 data/ui/tourist.list.ui:128
msgid "Edit"
msgstr ""
@ -233,6 +275,7 @@ msgid "Edit selected tour."
msgstr ""
#: data/ui/tour.list.ui:185 data/ui/tour.places.ui:212
#: data/ui/tourist.list.ui:143
msgid "New"
msgstr ""
@ -240,7 +283,8 @@ msgstr ""
msgid "Create a new tour."
msgstr ""
#: data/ui/tour.list.ui:199
#: data/ui/tour.list.ui:199 data/ui/tourist.list.ui:157
#: data/ui/tourist.illnesses.ui:128
msgid "Delete"
msgstr ""
@ -249,11 +293,14 @@ msgid "Delete selected tour."
msgstr ""
#: data/ui/tour.list.ui:214 data/ui/tour.places.ui:198
#: data/ui/query.window.ui:66
#: data/ui/tourist.list.ui:172 data/ui/tourist.illnesses.ui:114
#: data/ui/tourist.illness.editor.ui:73 data/ui/query.window.ui:66
msgid "Close"
msgstr ""
#: data/ui/tour.list.ui:218 data/ui/tour.places.ui:202
#: data/ui/tourist.list.ui:176 data/ui/tourist.illnesses.ui:118
#: data/ui/tourist.illness.editor.ui:77
msgid "Close this window."
msgstr ""
@ -270,7 +317,8 @@ msgid "Create a new city by typing here."
msgstr ""
#: data/ui/tour.editor.ui:286 data/ui/tour.place.editor.ui:149
#: data/ui/tour.assign.vehicle.ui:67 data/ui/place.editor.ui:250
#: data/ui/tour.assign.vehicle.ui:67 data/ui/tourist.editor.ui:131
#: data/ui/place.editor.ui:250
msgid "Cancel"
msgstr ""
@ -295,7 +343,8 @@ msgid "Assign a vehicle to this tour."
msgstr ""
#: data/ui/tour.editor.ui:343 data/ui/tour.place.editor.ui:168
#: data/ui/tour.assign.vehicle.ui:86 data/ui/place.editor.ui:269
#: data/ui/tour.assign.vehicle.ui:86 data/ui/tourist.editor.ui:169
#: data/ui/place.editor.ui:269
msgid "Save"
msgstr ""
@ -331,7 +380,8 @@ msgstr ""
msgid "Departure Time"
msgstr ""
#: data/ui/tour.places.ui:184
#: data/ui/tour.places.ui:184 data/ui/tourist.illnesses.ui:100
#: data/ui/tourist.illness.editor.ui:92
msgid "Add"
msgstr ""
@ -363,67 +413,83 @@ msgstr ""
msgid "Cancel the modification of this place."
msgstr ""
#: data/ui/tour.place.editor.ui:172 data/ui/place.editor.ui:273
#: data/ui/tour.place.editor.ui:172 data/ui/tourist.illness.editor.ui:96
#: data/ui/place.editor.ui:273
msgid "Save this place."
msgstr ""
#: data/ui/tour.place.editor.ui:270 data/ui/tour.place.editor.ui:440
#: data/ui/tourist.editor.ui:223
msgid "Year"
msgstr ""
#: data/ui/tour.place.editor.ui:286 data/ui/tour.place.editor.ui:456
#: data/ui/tourist.editor.ui:239
msgid "Month"
msgstr ""
#: data/ui/tour.place.editor.ui:298 data/ui/tour.place.editor.ui:472
#: data/ui/tourist.editor.ui:251
msgid "Day"
msgstr ""
#: data/ui/tour.place.editor.ui:341 data/ui/tour.place.editor.ui:517
#: data/ui/tourist.editor.ui:294
msgid "January"
msgstr ""
#: data/ui/tour.place.editor.ui:342 data/ui/tour.place.editor.ui:518
#: data/ui/tourist.editor.ui:295
msgid "February"
msgstr ""
#: data/ui/tour.place.editor.ui:343 data/ui/tour.place.editor.ui:519
#: data/ui/tourist.editor.ui:296
msgid "March"
msgstr ""
#: data/ui/tour.place.editor.ui:344 data/ui/tour.place.editor.ui:520
#: data/ui/tourist.editor.ui:297
msgid "April"
msgstr ""
#: data/ui/tour.place.editor.ui:345 data/ui/tour.place.editor.ui:521
#: data/ui/tourist.editor.ui:298
msgid "May"
msgstr ""
#: data/ui/tour.place.editor.ui:346 data/ui/tour.place.editor.ui:522
#: data/ui/tourist.editor.ui:299
msgid "June"
msgstr ""
#: data/ui/tour.place.editor.ui:347 data/ui/tour.place.editor.ui:523
#: data/ui/tourist.editor.ui:300
msgid "July"
msgstr ""
#: data/ui/tour.place.editor.ui:348 data/ui/tour.place.editor.ui:524
#: data/ui/tourist.editor.ui:301
msgid "August"
msgstr ""
#: data/ui/tour.place.editor.ui:349 data/ui/tour.place.editor.ui:525
#: data/ui/tourist.editor.ui:302
msgid "September"
msgstr ""
#: data/ui/tour.place.editor.ui:350 data/ui/tour.place.editor.ui:526
#: data/ui/tourist.editor.ui:303
msgid "October"
msgstr ""
#: data/ui/tour.place.editor.ui:351 data/ui/tour.place.editor.ui:527
#: data/ui/tourist.editor.ui:304
msgid "November"
msgstr ""
#: data/ui/tour.place.editor.ui:352 data/ui/tour.place.editor.ui:528
#: data/ui/tourist.editor.ui:305
msgid "December"
msgstr ""
@ -443,6 +509,66 @@ msgstr ""
msgid "The licence plate, make, year, and capacity of the vehicle."
msgstr ""
#: data/ui/tourist.list.ui:68 data/ui/tourist.editor.ui:60
msgid "RUN"
msgstr ""
#: data/ui/tourist.list.ui:82 data/ui/tourist.editor.ui:93
msgid "Name"
msgstr ""
#: data/ui/tourist.list.ui:96 data/ui/tourist.editor.ui:201
msgid "Birthdate"
msgstr ""
#: data/ui/tourist.list.ui:133
msgid "Edit selected tourist."
msgstr ""
#: data/ui/tourist.list.ui:147
msgid "Create a new tourist."
msgstr ""
#: data/ui/tourist.list.ui:162
msgid "Delete selected tourist."
msgstr ""
#: data/ui/tourist.editor.ui:36
msgid "Tourist Editor"
msgstr ""
#: data/ui/tourist.editor.ui:135
msgid "Cancel the modification of this tourist."
msgstr ""
#: data/ui/tourist.editor.ui:150 data/ui/tourist.illnesses.ui:23
msgid "Illnesses"
msgstr ""
#: data/ui/tourist.editor.ui:154
msgid "Add or edit illnesses."
msgstr ""
#: data/ui/tourist.editor.ui:173
msgid "Save this tourist."
msgstr ""
#: data/ui/tourist.illnesses.ui:68 data/ui/tourist.illness.editor.ui:53
msgid "Illness"
msgstr ""
#: data/ui/tourist.illnesses.ui:104
msgid "Add new illnesses."
msgstr ""
#: data/ui/tourist.illnesses.ui:132
msgid "Delete illnesses."
msgstr ""
#: data/ui/tourist.illness.editor.ui:22
msgid "Add Illness"
msgstr ""
#: data/ui/place.editor.ui:27
msgid "Place Editor"
msgstr ""

View File

@ -38,6 +38,11 @@ namespace Sernatur {
*/
[GtkChild]
private Gtk.MenuItem tours;
/**
* The tourists menu item
*/
[GtkChild]
private Gtk.MenuItem tourists;
/**
* The Q1 menu item
*/
@ -130,6 +135,12 @@ namespace Sernatur {
tour_list.initialize ();
tour_list.show_all ();
}
if (menu_item == tourists) {
var tourist_list = new TouristList (application, conn);
tourist_list.set_transient_for (this); // Set this window as the parent of the new window
tourist_list.initialize ();
tourist_list.show_all ();
}
else if (menu_item == q1) {
var query_window = new QueryWindow (application, conn, Query.Q1);
query_window.set_transient_for (this); // Set this window as the parent of the new window

View File

@ -21,6 +21,10 @@ vala_sources = files(
'tour_places.vala',
'tour_place_editor.vala',
'tour_assign_vehicle.vala',
'tourist_list.vala',
'tourist_editor.vala',
'tourist_illnesses.vala',
'tourist_illness_editor.vala',
'place_editor.vala',
'queries.vala',
'query_window.vala')
@ -28,6 +32,7 @@ vala_sources = files(
sources = vala_sources
sources += main_gresource
sources += tour_gresource
sources += tourist_gresource
sources += place_gresource
sources += query_gresource
sources += config_data_file
@ -35,6 +40,7 @@ sources += config_data_file
vala_args = ['--vapidir=' + join_paths(meson.source_root(), 'vapi')]
vala_args += ['--gresources=' + join_paths(meson.source_root(), 'data/ui/main.gresource.xml')]
vala_args += ['--gresources=' + join_paths(meson.source_root(), 'data/ui/tour.gresource.xml')]
vala_args += ['--gresources=' + join_paths(meson.source_root(), 'data/ui/tourist.gresource.xml')]
vala_args += ['--gresources=' + join_paths(meson.source_root(), 'data/ui/place.gresource.xml')]
vala_args += ['--gresources=' + join_paths(meson.source_root(), 'data/ui/query.gresource.xml')]

View File

@ -17,7 +17,7 @@ namespace Sernatur {
using LibSernatur.DB;
/**
* The tour list window class
* The tour place window class
*/
[GtkTemplate (ui = "/cl/cromer/ubb/sernatur/tour.places.ui")]
public class TourPlaces : Gtk.ApplicationWindow {

322
src/tourist_editor.vala Normal file
View File

@ -0,0 +1,322 @@
/*
* Copyright 2018-2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Sernatur {
using LibSernatur.DB;
using LibSernatur.Misc;
/**
* The tourist editor window class
*/
[GtkTemplate (ui = "/cl/cromer/ubb/sernatur/tourist.editor.ui")]
public class TouristEditor : Gtk.ApplicationWindow {
/**
* The open database connection
*/
private Connection conn;
/**
* The tourist to edit
*/
private Turista tourist;
/**
* The tourist run
*/
[GtkChild]
private Gtk.Entry run;
/**
* The tourist name
*/
[GtkChild]
private Gtk.Entry tourist_name;
/**
* The birth year
*/
[GtkChild]
private Gtk.SpinButton year;
/**
* The birth day
*/
[GtkChild]
private Gtk.SpinButton day;
/**
* The birth month
*/
[GtkChild]
private Gtk.ComboBoxText month;
/**
* The save button
*/
[GtkChild]
private Gtk.Button save;
/**
* The illnesses button
*/
[GtkChild]
private Gtk.Button illnesses;
/**
* The cancel button
*/
[GtkChild]
private Gtk.Button cancel;
/**
* A list of associated places, this is only used in the case of a new tourist
*/
//private List<Asociado> list_asociado = null;
/**
* A saved copy of the original RUN
*/
private string original_run;
/**
* This signal is called when a tourist is saved
*/
public signal void save_tourist ();
/**
* Validate the tourist data before trying to insert it into the database
* @return Returns true if the data is valid
*/
private bool validate_tourist_data () {
if (tourist.nombre_turista.strip () == "") {
var msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.CLOSE,
_ ("Error: Tourist name cannot be left blank!"));
msg.response.connect ((response_id) => {
msg.destroy ();
});
msg.set_title (_ ("Error"));
msg.run ();
return false;
}
if (tourist.rut_turista.strip () == "") {
var msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.CLOSE,
_ ("Error: Tourist RUN cannot be left blank!"));
msg.response.connect ((response_id) => {
msg.destroy ();
});
msg.set_title (_ ("Error"));
msg.run ();
return false;
}
try {
new Rut (tourist.rut_turista.strip ());
}
catch (Error e) {
var msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.CLOSE,
_ ("Error: The RUN entered is invalid!"));
msg.response.connect ((response_id) => {
msg.destroy ();
});
msg.set_title (_ ("Error"));
msg.run ();
return false;
}
if (tourist_exists () && tourist.rut_turista != original_run) {
var msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.CLOSE,
_ ("Error: A tourist with the RUN \"%s\" already exists!"), tourist.rut_turista);
msg.response.connect ((response_id) => {
msg.destroy ();
});
msg.set_title (_ ("Error"));
msg.run ();
return false;
}
return true;
}
private bool tourist_exists () {
try {
tourist.rut_turista = new Rut (run.get_text ().strip ()).get_clean_rut ();
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
try {
Turista turista = Turista.get_turista_by_run (conn, tourist.rut_turista);
if (turista == null) {
return false;
}
else {
return true;
}
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
return false;
#endif
}
}
/**
* This callback is called when a button is clicked
* @param button The button that was clicked
*/
[GtkCallback]
public void on_clicked_button (Gtk.Button button) {
if (button == save) {
if (update_tourist_instance () && validate_tourist_data ()) {
if (!tourist_exists () && original_run == null) {
try {
Turista.insert_tourist (conn, tourist);
/*if (list_asociado != null) {
// Not enough time
// Insert all the pending illnesses
list_asociado.foreach ((entry) => {
try {
//Asociado.insert_asociado (conn, entry);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
});
}*/
save_tourist (); // Signal the parent to update itself
this.close ();
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
}
else {
try {
Turista.update_tourist (conn, tourist, original_run);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
finally {
save_tourist (); // Signal the parent to update itself
this.close ();
}
}
}
}
else if (button == illnesses) {
var tourist_illnesses = new TouristIllnesses (application, conn, tourist);
tourist_illnesses.set_transient_for (this); // Set this window as the parent of the new window
tourist_illnesses.initialize ();
tourist_illnesses.show_all ();
//tourist_illnesses.save_places.connect (on_save_places);
}
else if (button == cancel) {
this.close ();
}
}
/**
* Called when some associated places are saved and a tourist id doesn't exist yet
* @param tourist_places The TouristPlaces instance that called this signal
* @param list_asociado The list of new associations
*/
/*private void on_save_places (TouristPlaces tourist_places, List<Asociado> list_asociado) {
this.list_asociado = list_asociado.copy ();
places.sensitive = false;
}*/
/**
* Called when a vehcile is assigned to the tourist, and the tourist is not in the database yet
* @param tourist_assign_vehicle The TouristAssignVehicle instance that called this signal
* @param requerir_auto The vehicle to assign to this tourist
*/
/*private void on_save_vehicle (TouristAssignVehicle tourist_assign_vehicle, RequerirAuto? requerir_auto) {
if (requerir_auto != null) {
this.requerir_auto = requerir_auto;
vehicle.sensitive = false;
}
}*/
/**
* Update the the tourist object with new info from the editor
* @return Returns false if the information is not valid
*/
private bool update_tourist_instance () {
tourist.rut_turista = run.get_text ().strip ();
tourist.nombre_turista = tourist_name.get_text ().strip ();
tourist.fecha_nacimento = year.get_value ().to_string () + "-" +
(month.get_active () + 1).to_string () + "-" +
day.get_value ().to_string ();
return true;
}
/**
* Initialize the tourist editor class
* @param application The application used to make the GLib object
* @param conn The database connection to use
* @param tourist The tourist to edit
*/
public TouristEditor (Gtk.Application application, Connection conn, Turista? tourist) {
Object (application: application);
this.conn = conn;
this.tourist = tourist;
}
/**
* Initialize what is needed for this window
*/
public void initialize () {
if (tourist != null) {
original_run = tourist.rut_turista;
try {
run.set_text (new Rut (tourist.rut_turista).get_rut ());
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
tourist_name.set_text (tourist.nombre_turista);
string[] birth_date = tourist.fecha_nacimento.split ("-", 3);
year.set_value (double.parse (birth_date[0]));
month.set_active (int.parse (birth_date[1]) - 1);
day.set_value (double.parse (birth_date[2]));
}
else {
illnesses.destroy ();
tourist = new Turista ();
}
}
}
}

View File

@ -0,0 +1,180 @@
/*
* Copyright 2018-2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Sernatur {
using LibSernatur.DB;
/**
* The tourist add illness window class
*/
[GtkTemplate (ui = "/cl/cromer/ubb/sernatur/tourist.illness.editor.ui")]
public class TouristIllnessEditor : Gtk.ApplicationWindow {
/**
* The open database connection
*/
private Connection conn;
/**
* The place data stored in the list store
*/
private enum Column {
/**
* The illness description
*/
ILLNESS_DESCRIPTION,
/**
* The illness object
*/
ILLNESS,
/**
* The number of colums in this enum
*/
N_COLUMNS
}
/**
* The add illness button
*/
[GtkChild]
private Gtk.Button add_illness;
/**
* The close button
*/
[GtkChild]
private Gtk.Button close_illness;
/**
* The illness
*/
[GtkChild]
private Gtk.ComboBoxText illness;
/**
* A list of the illnesses from the database
*/
private List<Enfermedad> illnesses;
/**
* The list that stores the illnesses for the combo box
*/
private Gtk.ListStore illness_list_store;
/**
* This signal is called when an illness is saved
*/
public signal void save_illness ();
/**
* The illness to be added
*/
private TieneEnfermedad tiene_enfermedad;
/**
* This callback is called when a button is clicked
* @param button The button that was clicked
*/
[GtkCallback]
public void on_clicked_button (Gtk.Button button) {
if (button == add_illness) {
// Insert is all that is needed
update_illness_instance ();
try {
TieneEnfermedad.insert_illness (conn, tiene_enfermedad);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
save_illness (); // Signal the parent to update itself
this.close ();
}
else if (button == close_illness) {
this.close ();
}
}
/**
* Update the the illness object with new info from the editor
*/
private void update_illness_instance () {
Enfermedad enfermedad;
Gtk.TreeIter iter;
illness.get_active_iter (out iter);
illness_list_store.get (iter,
Column.ILLNESS, out enfermedad);
tiene_enfermedad.enfermedad = enfermedad;
}
/**
* Initialize the tour illness editor class
* @param application The application used to make the GLib object
* @param conn The database connection to use
* @param tiene_enfermedad The place to edit
*/
public TouristIllnessEditor (Gtk.Application application, Connection conn, TieneEnfermedad tiene_enfermedad) {
Object (application: application);
this.conn = conn;
this.tiene_enfermedad = tiene_enfermedad;
}
/**
* Initialize what is needed for this window
*/
public void initialize () {
try {
illnesses = Enfermedad.get_all_enfermedades (conn);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
illnesses.sort_with_data ((a, b) => {
return strcmp (a.descripcion_enfermedad, b.descripcion_enfermedad);
});
illness_list_store = new Gtk.ListStore (Column.N_COLUMNS,
typeof (string),
typeof (Enfermedad));
illness.set_model (illness_list_store);
try {
var has_illness_list = TieneEnfermedad.get_all_tiene_enfermedades_by_run (conn, tiene_enfermedad.turista.rut_turista);
illnesses.foreach ((entry) => {
var can_add = true;
has_illness_list.foreach ((entry2) => {
if (entry.id_enfermedad == entry2.enfermedad.id_enfermedad) {
can_add = false;
}
});
if (can_add) {
Gtk.TreeIter iter;
illness_list_store.append (out iter);
illness_list_store.set (iter,
Column.ILLNESS_DESCRIPTION, entry.descripcion_enfermedad,
Column.ILLNESS, entry);
}
});
illness.set_active (0);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
}
}
}

297
src/tourist_illnesses.vala Normal file
View File

@ -0,0 +1,297 @@
/*
* Copyright 2018-2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Sernatur {
using LibSernatur.Misc;
using LibSernatur.DB;
/**
* The tourist illness window class
*/
[GtkTemplate (ui = "/cl/cromer/ubb/sernatur/tourist.illnesses.ui")]
public class TouristIllnesses : Gtk.ApplicationWindow {
/**
* The open database connection
*/
private Connection conn;
/**
* The tourist to edit
*/
private Turista tourist;
/**
* The columns of the tree view
*/
private enum Column {
/**
* The illness description
*/
ILLNESS_DESCRIPTION,
/**
* The illness object
*/
ILLNESS,
/**
* The number of colums in this enum
*/
N_COLUMNS
}
/**
* The list that stores the contents in the tree view
*/
private Gtk.ListStore list_store;
/**
* The list of illnesses
*/
private List<TieneEnfermedad> illness_list;
/**
* The tree view widget
*/
[GtkChild]
private Gtk.TreeView illness_tree;
/**
* The illness column
*/
[GtkChild]
private Gtk.TreeViewColumn illness;
/**
* The add button
*/
[GtkChild]
private Gtk.Button add_illness;
/**
* The close button
*/
[GtkChild]
private Gtk.Button close_illness;
/**
* The delete button
*/
[GtkChild]
private Gtk.Button delete_illness;
/**
* The row selection
*/
[GtkChild]
private Gtk.TreeSelection selection;
/**
* The associated tours to save if the user decides to save the tour
*/
private List<TieneEnfermedad> new_illness_list = new List<TieneEnfermedad> ();
/**
* This callback is called when the user clicks on a row
* @param selection The selection object
*/
[GtkCallback]
private void on_changed_selection(Gtk.TreeSelection selection) {
if (selection.count_selected_rows () == 1) {
delete_illness.sensitive =true;
}
else if (selection.count_selected_rows () > 1) {
delete_illness.sensitive = true;
}
else {
delete_illness.sensitive = false;
}
}
/**
* This callback is run when the user clicks on a button
* @param button The button that was clicked
*/
[GtkCallback]
private void on_clicked_button (Gtk.Button button) {
if (button == add_illness) {
var illness_editor = new TouristIllnessEditor (application, conn, new TieneEnfermedad (tourist));
illness_editor.set_transient_for (this); // Set this window as the parent of the new window
illness_editor.initialize ();
illness_editor.show_all ();
illness_editor.save_illness.connect (on_save_tourist_illness);
}
else if (button == delete_illness) {
Gtk.MessageDialog msg;
if (selection.count_selected_rows () == 1) {
msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.YES_NO,
_ ("Are you sure you wish to delete this illness from this tourist?"));
}
else {
msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.YES_NO,
_ ("Are you sure you wish to delete these illnesses from this tourist?"));
}
msg.response.connect ((response_id) => {
switch (response_id) {
case Gtk.ResponseType.YES:
Gtk.TreeModel model;
var path = selection.get_selected_rows (out model);
path.foreach ((entry) => {
var tree_row_reference = new Gtk.TreeRowReference (model, entry);
Gtk.TreeIter iter;
list_store.get_iter (out iter, tree_row_reference.get_path ());
TieneEnfermedad has_illness;
model.get (iter,
Column.ILLNESS, out has_illness);
try {
TieneEnfermedad.delete_illness (conn, has_illness);
}
catch (PostgresError e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
});
delete_illness.sensitive = false;
reset_columns ();
list_store.clear ();
update_list_store ();
break;
}
msg.destroy ();
});
msg.show ();
}
else if (button == close_illness) {
this.close ();
}
}
/**
* This callback is run when the user clicks on a column to reorder the rows
* @param column The column that was clicked
*/
[GtkCallback]
private void on_clicked_column (Gtk.TreeViewColumn column) {
delete_illness.sensitive = false;
if (column == illness) {
if (!illness.sort_indicator) {
reset_columns ();
illness.sort_indicator = true;
}
if (illness.sort_order == Gtk.SortType.ASCENDING) {
illness.sort_order = Gtk.SortType.DESCENDING;
}
else {
illness.sort_order = Gtk.SortType.ASCENDING;
}
illness_list.sort_with_data ((a, b) => {
if (illness.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.enfermedad.descripcion_enfermedad, b.enfermedad.descripcion_enfermedad);
}
else {
return strcmp (b.enfermedad.descripcion_enfermedad, a.enfermedad.descripcion_enfermedad);
}
});
}
list_store.clear ();
illness_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
list_store.set (iter,
Column.ILLNESS_DESCRIPTION, entry.enfermedad.descripcion_enfermedad,
Column.ILLNESS, entry);
});
new_illness_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
list_store.set (iter,
Column.ILLNESS_DESCRIPTION, entry.enfermedad.descripcion_enfermedad,
Column.ILLNESS, entry);
});
}
/**
* Reset the sort indicator and order of all the columns
*/
private void reset_columns () {
illness.sort_indicator = false;
illness.sort_order = Gtk.SortType.DESCENDING;
}
/**
* Called when a illness is saved
* @param illness_editor The editor that saved the illness
*/
public void on_save_tourist_illness (TouristIllnessEditor illness_editor) {
reset_columns ();
list_store.clear ();
update_list_store ();
}
/**
* Update the list store with the data from the database
*/
private void update_list_store () {
try {
illness_list = TieneEnfermedad.get_all_tiene_enfermedades_by_run (conn, tourist.rut_turista);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
illness_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
list_store.set (iter,
Column.ILLNESS_DESCRIPTION, entry.enfermedad.descripcion_enfermedad,
Column.ILLNESS, entry);
});
}
/**
* Initialize the tour list class
* @param application The application used to make the GLib object
* @param conn The database connection to use
* @param tourist The tourist which is the parent of this window
*/
public TouristIllnesses (Gtk.Application application, Connection conn, Turista? tourist) {
Object (application: application);
this.conn = conn;
this.tourist = tourist;
this.set_visible (true); // This fixes: Gtk-CRITICAL **: 23:58:22.139: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
}
/**
* Initialize what is needed for this window
*/
public void initialize () {
list_store = new Gtk.ListStore (Column.N_COLUMNS,
typeof (string),
typeof (TieneEnfermedad));
if (tourist != null) {
update_list_store ();
}
illness_tree.set_model (list_store);
}
}
}

420
src/tourist_list.vala Normal file
View File

@ -0,0 +1,420 @@
/*
* Copyright 2018-2019 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace Sernatur {
using LibSernatur.Misc;
using LibSernatur.DB;
/**
* The tourist list window class
*/
[GtkTemplate (ui = "/cl/cromer/ubb/sernatur/tourist.list.ui")]
public class TouristList : Gtk.ApplicationWindow {
/**
* The open database connection
*/
private Connection conn;
/**
* The columns of the tree view
*/
private enum Column {
/**
* The tourist's run
*/
RUN,
/**
* The tourist's name
*/
NAME,
/**
* The tourist's birthdate
*/
BIRTHDATE,
/**
* The tourist object
*/
TOURIST,
/**
* The number of colums in this enum
*/
N_COLUMNS
}
/**
* The list that stores the contents in the tree view
*/
private Gtk.ListStore list_store;
/**
* The list of tourists
*/
private List<Turista> tourist_list;
/**
* The tree view widget
*/
[GtkChild]
private Gtk.TreeView tourist_tree;
/**
* Thew new tourist button
*/
[GtkChild]
private Gtk.Button new_tourist;
/**
* The edit tourist button
*/
[GtkChild]
private Gtk.Button edit_tourist;
/**
* The delete tourist button
*/
[GtkChild]
private Gtk.Button delete_tourist;
/**
* The close tourist button
*/
[GtkChild]
private Gtk.Button close_tourist;
/**
* The tourist's RUN
*/
[GtkChild]
private Gtk.TreeViewColumn run;
/**
* The tourist's name
*/
[GtkChild]
private Gtk.TreeViewColumn tourist_name;
/**
* The birthdate
*/
[GtkChild]
private Gtk.TreeViewColumn birthdate;
/**
* The row selection
*/
[GtkChild]
private Gtk.TreeSelection selection;
/**
* This callback is called when the user clicks on a row
* @param selection The selection object
*/
[GtkCallback]
private void on_changed_selection(Gtk.TreeSelection selection) {
if (selection.count_selected_rows () == 1) {
edit_tourist.sensitive = true;
delete_tourist.sensitive =true;
}
else if (selection.count_selected_rows () > 1) {
edit_tourist.sensitive = false;
delete_tourist.sensitive = true;
}
else {
edit_tourist.sensitive = false;
delete_tourist.sensitive = false;
}
}
/**
* This callback is run when the user clicks on a button
* @param button The button that was clicked
*/
[GtkCallback]
private void on_clicked_button (Gtk.Button button) {
if (button == new_tourist) {
var tourist_editor = new TouristEditor (application, conn, null);
tourist_editor.set_transient_for (this); // Set this window as the parent of the new window
tourist_editor.initialize ();
tourist_editor.show_all ();
tourist_editor.save_tourist.connect (on_save);
}
else if (button == edit_tourist) {
Gtk.TreeModel model;
var path = selection.get_selected_rows (out model);
path.foreach ((entry) => {
var tree_row_reference = new Gtk.TreeRowReference (model, entry);
Gtk.TreeIter iter;
list_store.get_iter (out iter, tree_row_reference.get_path ());
Turista tourist;
model.get (iter,
Column.TOURIST, out tourist);
var tourist_editor = new TouristEditor (application, conn, tourist);
tourist_editor.set_transient_for (this); // Set this window as the parent of the new window
tourist_editor.initialize ();
tourist_editor.show_all ();
tourist_editor.save_tourist.connect (on_save);
});
}
else if (button == delete_tourist) {
Gtk.MessageDialog msg;
if (selection.count_selected_rows () == 1) {
msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.YES_NO,
_ ("Are you sure you wish to delete this tourist?"));
}
else {
msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.YES_NO,
_ ("Are you sure you wish to delete these tourists?"));
}
msg.response.connect ((response_id) => {
switch (response_id) {
case Gtk.ResponseType.YES:
Gtk.TreeModel model;
var path = selection.get_selected_rows (out model);
path.foreach ((entry) => {
var tree_row_reference = new Gtk.TreeRowReference (model, entry);
Gtk.TreeIter iter;
list_store.get_iter (out iter, tree_row_reference.get_path ());
Turista tourist;
model.get (iter,
Column.TOURIST, out tourist);
try {
Turista.delete_tourist (conn, tourist);
}
catch (PostgresError e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
catch (DBError e) {
if (e.code == 1) {
warning (e.message);
var msg2 = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.CLOSE,
_ ("Error: Could not delete tourist \"%s\" because there is still information associated with them!"), tourist.nombre_turista);
msg2.response.connect ((response_id) => {
msg2.destroy ();
});
msg2.set_title (_ ("Error"));
msg2.run ();
}
else {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
}
});
edit_tourist.sensitive = false;
delete_tourist.sensitive = false;
reset_columns ();
list_store.clear ();
update_list_store ();
break;
}
msg.destroy ();
});
msg.show ();
}
else if (button == close_tourist) {
this.close ();
}
}
/**
* Called when a new or old tourist is saved
* @param tourist_editor The editor that saved the tourist
*/
public void on_save(TouristEditor tourist_editor) {
edit_tourist.sensitive = false;
delete_tourist.sensitive = false;
reset_columns ();
list_store.clear ();
update_list_store ();
}
/**
* This callback is run when the user clicks on a column to reorder the rows
* @param column The column that was clicked
*/
[GtkCallback]
private void on_clicked_column (Gtk.TreeViewColumn column) {
edit_tourist.sensitive = false;
delete_tourist.sensitive = false;
if (column == run) {
if (!run.sort_indicator) {
reset_columns ();
run.sort_indicator = true;
}
if (run.sort_order == Gtk.SortType.ASCENDING) {
run.sort_order = Gtk.SortType.DESCENDING;
}
else {
run.sort_order = Gtk.SortType.ASCENDING;
}
tourist_list.sort_with_data ((a, b) => {
if (run.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.rut_turista, b.rut_turista);
}
else {
return strcmp (b.rut_turista, a.rut_turista);
}
});
}
else if (column == tourist_name) {
if (!tourist_name.sort_indicator) {
reset_columns ();
tourist_name.sort_indicator = true;
}
if (tourist_name.sort_order == Gtk.SortType.ASCENDING) {
tourist_name.sort_order = Gtk.SortType.DESCENDING;
}
else {
tourist_name.sort_order = Gtk.SortType.ASCENDING;
}
tourist_list.sort_with_data ((a, b) => {
if (tourist_name.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.nombre_turista, b.nombre_turista);
}
else {
return strcmp (b.nombre_turista, a.nombre_turista);
}
});
}
else if (column == birthdate) {
if (!birthdate.sort_indicator) {
reset_columns ();
birthdate.sort_indicator = true;
}
if (birthdate.sort_order == Gtk.SortType.ASCENDING) {
birthdate.sort_order = Gtk.SortType.DESCENDING;
}
else {
birthdate.sort_order = Gtk.SortType.ASCENDING;
}
tourist_list.sort_with_data ((a, b) => {
if (birthdate.sort_order == Gtk.SortType.ASCENDING) {
return strcmp (a.fecha_nacimento, b.fecha_nacimento);
}
else {
return strcmp (b.fecha_nacimento, a.fecha_nacimento);
}
});
}
list_store.clear ();
tourist_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
try {
list_store.set (iter,
Column.RUN, new Rut (entry.rut_turista).get_rut (),
Column.NAME, entry.nombre_turista,
Column.BIRTHDATE, entry.fecha_nacimento,
Column.TOURIST, entry);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
});
}
/**
* Reset the sort indicator and order of all the columns
*/
private void reset_columns () {
run.sort_indicator = false;
run.sort_order = Gtk.SortType.DESCENDING;
tourist_name.sort_indicator = false;
tourist_name.sort_order = Gtk.SortType.DESCENDING;
birthdate.sort_indicator = false;
birthdate.sort_order = Gtk.SortType.DESCENDING;
}
/**
* Update the list store with the data from the database
*/
private void update_list_store () {
try {
tourist_list = Turista.get_all_turistas (conn);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
tourist_list.foreach ((entry) => {
Gtk.TreeIter iter;
list_store.append (out iter);
try {
list_store.set (iter,
Column.RUN, new Rut (entry.rut_turista).get_rut (),
Column.NAME, entry.nombre_turista,
Column.BIRTHDATE, entry.fecha_nacimento,
Column.TOURIST, entry);
}
catch (Error e) {
#if DEBUG
error (e.message);
#else
warning (e.message);
#endif
}
});
}
/**
* Initialize the tourist list class
* @param application The application used to make the GLib object
* @param conn The database connection to use
*/
public TouristList (Gtk.Application application, Connection conn) {
Object (application: application);
this.conn = conn;
this.set_visible (true); // This fixes: Gtk-CRITICAL **: 23:58:22.139: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
}
/**
* Initialize what is needed for this window
*/
public void initialize () {
list_store = new Gtk.ListStore (Column.N_COLUMNS,
typeof (string),
typeof (string),
typeof (string),
typeof (Turista));
update_list_store ();
tourist_tree.set_model (list_store);
}
}
}