Merge lp:~artem-anufrij/webby-browser/webby-browser into lp:webby-browser

Proposed by Artem Anufrij on 2015-03-23
Status: Merged
Approved by: Erasmo Marín on 2015-03-24
Approved revision: 12
Merged at revision: 10
Proposed branch: lp:~artem-anufrij/webby-browser/webby-browser
Merge into: lp:webby-browser
Diff against target: 100 lines (+34/-10)
3 files modified
CMakeLists.txt (+6/-5)
src/ApplicationsView.vala (+27/-4)
src/Webby.vala (+1/-1)
To merge this branch: bzr merge lp:~artem-anufrij/webby-browser/webby-browser
Reviewer Review Type Date Requested Status
Erasmo Marín 2015-03-23 Pending
Review via email: mp+253865@code.launchpad.net
To post a comment you must log in.
Erasmo Marín (erasmo-marin) wrote :

Thanks, it looks good. The only thing you need to fix is line 74, can you put the "}" with the "else" in the same line? that's all.

11. By Artem Anufrij on 2015-03-23

code style

12. By Artem Anufrij on 2015-03-23

code style

Artem Anufrij (artem-anufrij) wrote :

done :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-02-26 20:16:44 +0000
3+++ CMakeLists.txt 2015-03-23 21:20:10 +0000
4@@ -86,7 +86,7 @@
5 #
6
7 find_package(PkgConfig)
8-pkg_check_modules(DEPS REQUIRED gobject-2.0 glib-2.0 gio-2.0 gtk+-3.0>=3.12 gthread-2.0 granite gee-0.8 webkit2gtk-3.0 libsoup-2.4)
9+pkg_check_modules(DEPS REQUIRED gobject-2.0 glib-2.0 gio-2.0 gtk+-3.0>=3.12 gthread-2.0 granite gee-0.8 webkit2gtk-3.0 libsoup-2.4 gdk-pixbuf-2.0)
10
11 add_definitions(${DEPS_CFLAGS})
12
13@@ -99,15 +99,16 @@
14
15 set(PKG_DEPS gtk+-3.0
16 granite
17- gio-2.0
18+ gio-2.0
19 gee-0.8
20 posix
21 webkit2gtk-3.0
22- libsoup-2.4)
23+ libsoup-2.4
24+ gdk-pixbuf-2.0)
25
26
27 set(SRC_FILES
28- src/ApplicationsView.vala
29+ src/ApplicationsView.vala
30 src/AppWindow.vala
31 src/Assistant.vala
32 src/DesktopFile.vala
33@@ -130,7 +131,7 @@
34 --thread
35 -g
36 --debug
37- --target-glib=2.32
38+ --target-glib=2.32
39 )
40
41 add_definitions(${CFLAGS}-lm -Wall -Winit-self -Wwrite-strings -Wunreachable-code -Wstrict-prototypes)
42
43=== modified file 'src/ApplicationsView.vala'
44--- src/ApplicationsView.vala 2015-02-26 20:16:44 +0000
45+++ src/ApplicationsView.vala 2015-03-23 21:20:10 +0000
46@@ -10,7 +10,7 @@
47 GLib.Object (orientation: Gtk.Orientation.VERTICAL);
48 var scrolled = new Gtk.ScrolledWindow (null, null);
49 scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER;
50-
51+
52 icon_view = new Gtk.FlowBox();
53 icon_view.valign = Gtk.Align.START;
54 icon_view.vexpand = false;
55@@ -68,9 +68,32 @@
56 vexpand = false;
57
58 label = new Gtk.Label (label_str);
59- image = new Gtk.Image();
60- image.icon_name = icon;
61- image.pixel_size = 64;
62+
63+ if (File.new_for_path (icon).query_exists ()) {
64+ var pix = new Gdk.Pixbuf.from_file (icon);
65+
66+ int new_height = 64;
67+ int new_width = 64;
68+ int margin_vertical = 0;
69+ int margin_horizontal = 0;
70+
71+ if (pix.height > pix.width) {
72+ new_width = new_width * pix.width / pix.height;
73+ margin_horizontal = (new_height - new_width) / 2;
74+ } else if (pix.height < pix.width) {
75+ new_height = new_height * pix.height / pix.width;
76+ margin_vertical = (new_width - new_height) / 2;
77+ }
78+ image = new Gtk.Image.from_pixbuf (pix.scale_simple (new_width, new_height, Gdk.InterpType.BILINEAR));
79+ image.margin_top = margin_vertical;
80+ image.margin_bottom = margin_vertical;
81+ image.margin_right = margin_horizontal;
82+ image.margin_left = margin_horizontal;
83+ } else {
84+ image = new Gtk.Image ();
85+ image.icon_name = icon;
86+ image.pixel_size = 64;
87+ }
88
89 this.margin = 5;
90 this.margin_start = 20;
91
92=== modified file 'src/Webby.vala'
93--- src/Webby.vala 2015-02-26 01:32:45 +0000
94+++ src/Webby.vala 2015-03-23 21:20:10 +0000
95@@ -13,4 +13,4 @@
96
97 Gtk.main ();
98 return 0;
99-}
100+}

Subscribers

People subscribed via source and target branches

to all changes: