Adding grid and two parties new to test.
This commit is contained in:
parent
ef7929a469
commit
fd70dfe203
@ -31,7 +31,7 @@ config_h = configure_file (
|
||||
},
|
||||
)
|
||||
|
||||
preloaded_images_files = [ 'psoe.jpg', 'pp.jpg', 'vox.jpg' ]
|
||||
preloaded_images_files = [ 'psoe.jpg', 'pp.jpg', 'vox.jpg', 'ciudadanos.jpg', 'por-andalucia.png' ]
|
||||
|
||||
foreach i : preloaded_images_files
|
||||
install_data(
|
||||
|
BIN
resources/preloaded_images/ciudadanos.jpg
Normal file
BIN
resources/preloaded_images/ciudadanos.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
BIN
resources/preloaded_images/por-andalucia.png
Normal file
BIN
resources/preloaded_images/por-andalucia.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
@ -34,6 +34,8 @@ string preloaded_images_path;
|
||||
string psoe_image;
|
||||
string pp_image;
|
||||
string vox_image;
|
||||
string ciudadanos;
|
||||
string por_andalucia;
|
||||
|
||||
void main () {
|
||||
var app = new Adw.Application ("me.sergiotarxz.recuento", 0);
|
||||
@ -41,6 +43,9 @@ void main () {
|
||||
psoe_image = preloaded_images_path + S + "psoe.jpg";
|
||||
pp_image = preloaded_images_path + S + "pp.jpg";
|
||||
vox_image = preloaded_images_path + S + "vox.jpg";
|
||||
ciudadanos = preloaded_images_path + S + "ciudadanos.jpg";
|
||||
por_andalucia = preloaded_images_path + S + "por-andalucia.png";
|
||||
|
||||
app.activate.connect ( () => {
|
||||
activate (app);
|
||||
});
|
||||
@ -53,12 +58,7 @@ void activate (Adw.Application app) {
|
||||
var scrolled_window = new Gtk.ScrolledWindow();
|
||||
var main_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.HORIZONTAL, 2);
|
||||
if (S == "\\") {
|
||||
var display = Gdk.Display.get_default ();
|
||||
var icon_theme = Gtk.IconTheme.get_for_display (display);
|
||||
icon_theme.add_search_path (@"share\\icons");
|
||||
}
|
||||
var parties_container = new Gtk.Box (Gtk.Orientation.VERTICAL, 2);
|
||||
parties_container.margin_bottom = 50;
|
||||
scrolled_window.vexpand = true;
|
||||
Sqlite.Database db = get_db ();
|
||||
@ -89,7 +89,17 @@ GLib.List<Gtk.Widget> fill_parties_container(Sqlite.Database db,
|
||||
Gtk.Box parties_container) {
|
||||
var list_inserted_widgets = new GLib.List<Gtk.Widget>();
|
||||
var parties = list_parties (db);
|
||||
parties.foreach ((party) => {
|
||||
var row_parties = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10);
|
||||
list_inserted_widgets.append (row_parties);
|
||||
parties_container.append (row_parties);
|
||||
uint64 i = 0;
|
||||
foreach (Party party in parties) {
|
||||
if (i == 3) {
|
||||
row_parties = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 10);
|
||||
list_inserted_widgets.append (row_parties);
|
||||
parties_container.append (row_parties);
|
||||
i = 0;
|
||||
}
|
||||
var party_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 10);
|
||||
var party_picture = new Gtk.Picture();
|
||||
var party_name_widget = new Gtk.Label (party.name);
|
||||
@ -107,9 +117,9 @@ GLib.List<Gtk.Widget> fill_parties_container(Sqlite.Database db,
|
||||
party_box.append (party_picture);
|
||||
party_box.append (party_name_widget);
|
||||
party_box.append (votes_widget);
|
||||
parties_container.append (party_box);
|
||||
list_inserted_widgets.append (party_box);
|
||||
});
|
||||
row_parties.append (party_box);
|
||||
i++;
|
||||
}
|
||||
return (owned) list_inserted_widgets;
|
||||
}
|
||||
|
||||
@ -156,6 +166,8 @@ void load_inital_data (Sqlite.Database db) {
|
||||
insert_party (db, "PSOE", psoe_image);
|
||||
insert_party (db, "PP", pp_image);
|
||||
insert_party (db, "VOX", vox_image);
|
||||
insert_party (db, "Ciudadanos", ciudadanos);
|
||||
insert_party (db, "Por Andalucía", por_andalucia);
|
||||
set_loaded_initial_data (db);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user