Skip to content

Commit 3b3be9f

Browse files
author
Corentin Noël
committed
Added .deck and .card classes.
1 parent 4c930f6 commit 3b3be9f

File tree

5 files changed

+81
-4
lines changed

5 files changed

+81
-4
lines changed

src/Application.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
namespace ProjectManager {
2424
const string project_manager = N_("About Project Manager");
25-
public class ProjectManager : Granite.Application {
25+
public class App : Granite.Application {
2626
MainWindow main_window;
2727

2828
construct {
@@ -64,7 +64,7 @@ namespace ProjectManager {
6464
}
6565

6666
public static int main (string[] args) {
67-
var application = new ProjectManager ();
67+
var application = new App ();
6868
return application.run (args);
6969
}
7070
}

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ensure_vala_version ("0.26" MINIMUM)
99
include(ValaPrecompile)
1010
vala_precompile(VALA_C ${EXEC_NAME}
1111
Application.vala
12+
Card.vala
1213
Database.vala
1314
MainWindow.vala
1415
ProjectList.vala

src/Card.vala

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
2+
/*-
3+
* Copyright (c) 2015 elementary LLC.
4+
*
5+
* This library is free software; you can redistribute it and/or
6+
* modify it under the terms of the GNU General Public
7+
* License as published by the Free Software Foundation; either
8+
* version 3 of the License, or (at your option) any later version.
9+
*
10+
* This library 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 GNU
13+
* General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public
16+
* License along with this library; if not, write to the
17+
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18+
* Boston, MA 02111-1307, USA.
19+
*
20+
* Authored by: Corentin Noël <[email protected]>
21+
*/
22+
23+
public class ProjectManager.Card : Gtk.ListBoxRow {
24+
Gtk.Grid grid;
25+
public Card () {
26+
27+
}
28+
29+
construct {
30+
selectable = false;
31+
var frame = new Gtk.Frame (null);
32+
frame.margin = 12;
33+
frame.get_style_context ().add_class ("card");
34+
grid = new Gtk.Grid ();
35+
grid.margin = 3;
36+
frame.add (grid);
37+
add (frame);
38+
}
39+
40+
public Gtk.Grid get_content_grid () {
41+
return grid;
42+
}
43+
}

src/Panels/Bugs.vala

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,52 @@ public class ProjectManager.Panels.Bugs : Gtk.Grid {
6464
expand = true;
6565
var pane = new Gtk.Paned (Gtk.Orientation.HORIZONTAL);
6666
list_box = new Gtk.ListBox ();
67+
list_box.activate_on_single_click = true;
6768
list_box.set_sort_func ((row1, row2) => sort (row1, row2));
6869
list_box.set_header_func ((row, before) => header (row, before));
70+
list_box.row_activated.connect ((row) => {
71+
var headrow = row as BugHeadRow;
72+
if (headrow != null) {
73+
create_bug_cards (headrow.bug);
74+
}
75+
});
76+
6977
var scrolled_left = new Gtk.ScrolledWindow (null, null);
78+
scrolled_left.hscrollbar_policy = Gtk.PolicyType.NEVER;
7079
scrolled_left.expand = true;
7180
scrolled_left.add (list_box);
7281
bug_list_box = new Gtk.ListBox ();
82+
bug_list_box.get_style_context ().add_class ("deck");
7383
var scrolled_right = new Gtk.ScrolledWindow (null, null);
84+
scrolled_right.hscrollbar_policy = Gtk.PolicyType.NEVER;
7485
scrolled_right.add (bug_list_box);
7586
pane.pack1 (scrolled_left, false, false);
7687
pane.pack2 (scrolled_right, false, false);
7788
add (pane);
7889
}
7990

91+
private void create_bug_cards (Bug bug) {
92+
bug_list_box.get_children ().foreach ((child) => {
93+
child.destroy ();
94+
});
95+
96+
var card = new ProjectManager.Card ();
97+
var grid = card.get_content_grid ();
98+
var title = new Gtk.Label (bug.summary);
99+
title.wrap = true;
100+
title.hexpand = true;
101+
title.get_style_context ().add_class ("h2");
102+
((Gtk.Misc) title).xalign = 0;
103+
var reported = new Gtk.Label (_("Reported by %s").printf (bug.owner.name));
104+
((Gtk.Misc) reported).xalign = 0;
105+
var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL);
106+
grid.attach (title, 0, 0, 1, 1);
107+
grid.attach (reported, 0, 1, 1, 1);
108+
//grid.attach (separator, 0, 2, 1, 1);
109+
card.show_all ();
110+
bug_list_box.add (card);
111+
}
112+
80113
private int sort (Gtk.ListBoxRow row1, Gtk.ListBoxRow row2) {
81114
var headrow1 = row1 as BugHeadRow;
82115
var headrow2 = row2 as BugHeadRow;

src/Platform/Launchpad/Bug.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public class ProjectManager.Launchpad.Malone : Bug {
6666
return 0;
6767
case "Triaged":
6868
return 1;
69-
case "Confirmed":
70-
return 2;
7169
case "Incomplete":
70+
return 2;
71+
case "Confirmed":
7272
return 3;
7373
case "Opinion":
7474
return 4;

0 commit comments

Comments
 (0)