add asignatura window

This commit is contained in:
Chris Cromer 2019-07-14 12:59:13 -04:00
parent 8c8e9851b8
commit dd99fe116b
Signed by: cromer
GPG Key ID: 39CC813FF3C8708A
3 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,36 @@
/*
* Copyright 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 Colegio {
using Constants;
using Misc;
using DB;
using DB.Wrapper;
using Postgres;
[GtkTemplate (ui = "/cl/cromer/ubb/colegio/query.window.ui")]
public class AsignaturaWindow : Gtk.ApplicationWindow {
private Connection conn;
public AsignaturaWindow (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
}
public void initialize () {
}
}
}

View File

@ -24,6 +24,9 @@ namespace Colegio {
[GtkChild] [GtkChild]
private Gtk.Box mainbox; private Gtk.Box mainbox;
[GtkChild]
private Gtk.MenuItem asignaturas;
[GtkChild] [GtkChild]
private Gtk.MenuItem q1; private Gtk.MenuItem q1;
@ -52,7 +55,13 @@ namespace Colegio {
[GtkCallback] [GtkCallback]
private void on_activate_menu(Gtk.MenuItem menu_item) { private void on_activate_menu(Gtk.MenuItem menu_item) {
if (menu_item == q1) { if (menu_item == asignaturas) {
var asignatura_window = new AsignaturaWindow (application, conn);
asignatura_window.set_transient_for (this); // Set this window as the parent of the new window
asignatura_window.initialize ();
asignatura_window.show_all ();
}
else if (menu_item == q1) {
var query_window = new QueryWindow (application, conn, QueryWindow.Query.Q1); var query_window = new QueryWindow (application, conn, QueryWindow.Query.Q1);
query_window.set_transient_for (this); // Set this window as the parent of the new window query_window.set_transient_for (this); // Set this window as the parent of the new window
query_window.initialize (); query_window.initialize ();

View File

@ -14,6 +14,7 @@ config_data_file = configure_file(input: 'config.vala.in',
configuration: config_data) configuration: config_data)
vala_sources = files( vala_sources = files(
'asignatura_window.vala',
'colegio.vala', 'colegio.vala',
'db.vala', 'db.vala',
'dbwrapper.vala', 'dbwrapper.vala',