1
// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
3
* Copyright (c) 2014-2017 elementary LLC. (https://elementary.io)
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18
* Authored by: Corentin Noël <corentin@elementary.io>
22
public class Welcome.FlowBoxItem : Gtk.FlowBoxChild {
23
private Gtk.Label name_label;
24
private Gtk.Grid themed_grid;
25
public string s_title;
26
private string s_icon_name;
28
public FlowBoxItem (string title, string icon) {
30
var display_image = new Gtk.Image ();
31
display_image.icon_size = Gtk.IconSize.DIALOG;
32
display_image.valign = Gtk.Align.CENTER;
33
display_image.halign = Gtk.Align.END;
34
display_image.margin_end = 12;
36
name_label = new Gtk.Label (null);
37
name_label.wrap = true;
38
//name_label.max_width_chars = 5;
40
var grid = new Gtk.Grid ();
41
grid.orientation = Gtk.Orientation.HORIZONTAL;
42
//grid.column_spacing = 6;
43
grid.halign = Gtk.Align.CENTER;
44
grid.valign = Gtk.Align.CENTER;
45
//grid.margin_top = 32;
47
//grid.margin_bottom = 32;
48
grid.margin_start = 16;
49
grid.add (display_image);
50
grid.add (name_label);
52
var expanded_grid = new Gtk.Grid ();
53
expanded_grid.expand = true;
54
expanded_grid.margin = 12;
56
themed_grid = new Gtk.Grid ();
57
themed_grid.get_style_context ().add_class ("options");
58
themed_grid.attach (grid, 0, 0, 1, 1);
59
themed_grid.attach (expanded_grid, 0, 0, 1, 1);
60
themed_grid.margin = 5;
64
//tooltip_text = app_category.summary ?? "";
66
display_image.icon_name = icon;
67
((Gtk.Misc) name_label).xalign = 0;
68
name_label.halign = Gtk.Align.START;
69
name_label.label = title;
72
display_image.destroy ();
73
name_label.justify = Gtk.Justification.CENTER;