Adding debug print.

This commit is contained in:
sergiotarxz 2022-06-30 10:00:12 +02:00
parent 915959a34e
commit 7c3d0881d2

View File

@ -39,7 +39,8 @@ void activate (Adw.Application app) {
var scrolled_window = new Gtk.ScrolledWindow(); var scrolled_window = new Gtk.ScrolledWindow();
var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
var window_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); var window_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
var parties_container = new Gtk.Box (Gtk.Orientation.VERTICAL, 2); var parties_container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 2);
parties_container.margin_bottom = 50;
scrolled_window.vexpand = true; scrolled_window.vexpand = true;
Sqlite.Database db = get_db (); Sqlite.Database db = get_db ();
load_inital_data (db); load_inital_data (db);
@ -70,16 +71,13 @@ GLib.List<Gtk.Widget> fill_parties_container(Sqlite.Database db,
var list_inserted_widgets = new GLib.List<Gtk.Widget>(); var list_inserted_widgets = new GLib.List<Gtk.Widget>();
var parties = list_parties (db); var parties = list_parties (db);
parties.foreach ((party) => { parties.foreach ((party) => {
var party_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10); var party_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 10);
var party_picture = new Gtk.Picture(); var party_picture = new Gtk.Picture();
var party_name_widget = new Gtk.Label (party.name); var party_name_widget = new Gtk.Label (party.name);
var adjustment = new Gtk.Adjustment (party.votes, 0, 50000, 1, 1, 1); var adjustment = new Gtk.Adjustment (party.votes, 0, 50000, 1, 1, 1);
var votes_widget = new Gtk.SpinButton (adjustment, 0.1, 0); var votes_widget = new Gtk.SpinButton (adjustment, 0.1, 0);
party_box.hexpand = true; party_box.hexpand = true;
votes_widget.margin_top = 75;
votes_widget.margin_bottom = 75;
party_picture.height_request = 200; party_picture.height_request = 200;
party_picture.width_request = 200;
party_picture.can_shrink = true; party_picture.can_shrink = true;
party_picture.set_filename (party.image); party_picture.set_filename (party.image);
votes_widget.value_changed.connect (() => { votes_widget.value_changed.connect (() => {
@ -87,8 +85,6 @@ GLib.List<Gtk.Widget> fill_parties_container(Sqlite.Database db,
party.votes = (uint64) votes_widget.get_value (); party.votes = (uint64) votes_widget.get_value ();
modify_party_votes (db_lambda, party); modify_party_votes (db_lambda, party);
}); });
votes_widget.set_halign(Gtk.Align.END);
votes_widget.hexpand = true;
party_box.append (party_picture); party_box.append (party_picture);
party_box.append (party_name_widget); party_box.append (party_name_widget);
party_box.append (votes_widget); party_box.append (votes_widget);
@ -272,6 +268,7 @@ Sqlite.Database get_db () {
Sqlite.Database db; Sqlite.Database db;
string home = GLib.Environment.get_home_dir (); string home = GLib.Environment.get_home_dir ();
string final_sqlite_path = @"$home/$SQLITE_PATH"; string final_sqlite_path = @"$home/$SQLITE_PATH";
print final_sqlite_path;
int rc = Sqlite.Database.open (final_sqlite_path, out db); int rc = Sqlite.Database.open (final_sqlite_path, out db);
apply_migrations (db); apply_migrations (db);
if (rc != Sqlite.OK) { if (rc != Sqlite.OK) {