From dd99fe116b2750165c0d9d5efc262c5223264522 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Sun, 14 Jul 2019 12:59:13 -0400 Subject: [PATCH] add asignatura window --- src/asignatura_window.vala | 36 ++++++++++++++++++++++++++++++++++++ src/main_window.vala | 11 ++++++++++- src/meson.build | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/asignatura_window.vala diff --git a/src/asignatura_window.vala b/src/asignatura_window.vala new file mode 100644 index 0000000..003d5e1 --- /dev/null +++ b/src/asignatura_window.vala @@ -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 () { + } + } +} diff --git a/src/main_window.vala b/src/main_window.vala index 04ad65d..368b9c8 100644 --- a/src/main_window.vala +++ b/src/main_window.vala @@ -24,6 +24,9 @@ namespace Colegio { [GtkChild] private Gtk.Box mainbox; + [GtkChild] + private Gtk.MenuItem asignaturas; + [GtkChild] private Gtk.MenuItem q1; @@ -52,7 +55,13 @@ namespace Colegio { [GtkCallback] 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); query_window.set_transient_for (this); // Set this window as the parent of the new window query_window.initialize (); diff --git a/src/meson.build b/src/meson.build index 9003d1c..7680f17 100644 --- a/src/meson.build +++ b/src/meson.build @@ -14,6 +14,7 @@ config_data_file = configure_file(input: 'config.vala.in', configuration: config_data) vala_sources = files( + 'asignatura_window.vala', 'colegio.vala', 'db.vala', 'dbwrapper.vala',