add tour window

This commit is contained in:
Chris Cromer 2019-01-05 19:08:51 -03:00
parent 1c3db1d9d9
commit 6da01d3bff
Signed by: cromer
GPG Key ID: 39CC813FF3C8708A
6 changed files with 99 additions and 10 deletions

View File

@ -19,9 +19,11 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
<template class="SernaturMainWindow" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="title">SERNATUR</property>
<property name="window_position">center</property>
<property name="icon_name">sernatur</property>
<property name="show_menubar">False</property>
<signal name="configure-event" handler="resize_window" swapped="no"/>
<signal name="destroy" handler="window_quit" swapped="no"/>
<signal name="window-state-event" handler="maximize_window" swapped="no"/>
<child>
<placeholder/>
@ -51,6 +53,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Tours</property>
<signal name="activate" handler="menu_tours" swapped="no"/>
</object>
</child>
<child>
@ -126,35 +129,35 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Regions with discounts</property>
<property name="label" translatable="yes">(Q1) Regions with discounts</property>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Tour values</property>
<property name="label" translatable="yes">(Q2) Tour values</property>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Coordinator total</property>
<property name="label" translatable="yes">(Q3) Coordinator total</property>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Tourist total</property>
<property name="label" translatable="yes">(Q4) Tourist total</property>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Vehicle total</property>
<property name="label" translatable="yes">(Q5) Vehicle total</property>
</object>
</child>
</object>

View File

@ -14,7 +14,8 @@
-->
<gresources>
<gresource prefix="/cl/cromer/ubb/sernatur">
<file preprocess="xml-stripblanks">sernatur.window.ui</file>
<file preprocess="xml-stripblanks">main.window.ui</file>
<file preprocess="xml-stripblanks">tour.window.ui</file>
<file preprocess="xml-stripblanks">splash.ui</file>
<file preprocess="to-pixdata">pixdata/logo-sernatur.svg</file>
<file preprocess="to-pixdata">pixdata/icon-sernatur.png</file>

35
data/ui/tour.window.ui Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1
Copyright 2018 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="SernaturTourWindow" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="title">Tour</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="icon_name">sernatur</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="show_menubar">False</property>
<child>
<placeholder/>
</child>
</template>
</interface>

View File

@ -22,12 +22,18 @@ namespace Sernatur {
/**
* The MainWindow class
*/
[GtkTemplate (ui = "/cl/cromer/ubb/sernatur/sernatur.window.ui")]
[GtkTemplate (ui = "/cl/cromer/ubb/sernatur/main.window.ui")]
public class MainWindow : Gtk.ApplicationWindow {
private TourWindow tour_window;
private Gtk.Grid content;
[GtkChild]
private Gtk.Box mainbox;
[GtkCallback]
private void window_quit(Gtk.Widget widget) {
application.quit ();
}
/**
* This is a callback for when the window is maximized or unmaximized
* @param widget The widget that called this GtkCallback
@ -68,6 +74,14 @@ namespace Sernatur {
return false;
}
[GtkCallback]
private void menu_tours(Gtk.MenuItem menu_item) {
tour_window = new TourWindow (application);
tour_window.set_transient_for (this); // Set this window as the parent of the new window
tour_window.set_keep_above (true);
tour_window.present ();
}
[GtkCallback]
private void menu_quit(Gtk.MenuItem menu_item) {
application.quit ();
@ -133,7 +147,7 @@ namespace Sernatur {
}
print (dgettext (null, "Postgresql server version:") + " %d\n", conn.get_server_version ());
var tour = Tour.get_all_tours (conn);
/*var tour = Tour.get_all_tours (conn);
print (tour[0].ciudad.region.nombre_region + "\n");
var tiene_enfermedad = TieneEnfermedad.get_all_tiene_enfermedades (conn);
print (tiene_enfermedad[0].turista.contacto_emergencia.nombre_emergencia + "\n");
@ -162,7 +176,7 @@ namespace Sernatur {
}
catch (InvalidRut e) {
print ("Rut is invalid");
}
}*/
}
}
}

View File

@ -15,7 +15,8 @@ config_data_file = configure_file(input: 'config.vala.in',
vala_sources = files(
'sernatur.vala',
'sernatur-window.vala')
'main-window.vala',
'tour-window.vala')
sources = vala_sources
sources += gresource

35
src/tour-window.vala Normal file
View File

@ -0,0 +1,35 @@
/*
* Copyright 2018 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.
*/
/**
* The main Sernatur namespace
*/
namespace Sernatur {
using LibSernatur.Person;
using LibSernatur.DB;
/**
* The TourWindow class
*/
[GtkTemplate (ui = "/cl/cromer/ubb/sernatur/tour.window.ui")]
public class TourWindow : Gtk.ApplicationWindow {
/**
* Initialize the main window class
* @param application The application used to make the GLib object
*/
public TourWindow (Gtk.Application application) {
GLib.Object (application: application);
}
}
}