Merge lp:~voluntatefaber/slingshot/resolution-adjustments into lp:~elementary-pantheon/slingshot/trunk

Proposed by Andrea Basso
Status: Merged
Merged at revision: 254
Proposed branch: lp:~voluntatefaber/slingshot/resolution-adjustments
Merge into: lp:~elementary-pantheon/slingshot/trunk
Diff against target: 145 lines (+46/-17)
4 files modified
org.pantheon.desktop.slingshot.gschema.xml (+2/-2)
src/SlingshotView.vala (+33/-13)
src/Widgets/CategoryView.vala (+2/-2)
src/Widgets/Grid.vala (+9/-0)
To merge this branch: bzr merge lp:~voluntatefaber/slingshot/resolution-adjustments
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
Review via email: mp+120272@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

I have not been able to compile Granite lately so I asked Tom to take a look at this branch. I approve that he approves.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'org.pantheon.desktop.slingshot.gschema.xml'
2--- org.pantheon.desktop.slingshot.gschema.xml 2012-07-13 11:57:20 +0000
3+++ org.pantheon.desktop.slingshot.gschema.xml 2012-08-18 23:21:21 +0000
4@@ -3,12 +3,12 @@
5 <key name="columns" type="i">
6 <default>5</default>
7 <summary>The default number of columns</summary>
8- <description>This value needs to be greater than 5 to be effective.</description>
9+ <description>This value needs to be greater than 3 to be effective.</description>
10 </key>
11 <key name="rows" type="i">
12 <default>3</default>
13 <summary>The default number of rows</summary>
14- <description>This value needs to be greater than 3 to be effective.</description>
15+ <description>This value needs to be greater than 1 to be effective.</description>
16 </key>
17 <key name="icon-size" type="i">
18 <default>64</default>
19
20=== modified file 'src/SlingshotView.vala'
21--- src/SlingshotView.vala 2012-08-17 21:51:24 +0000
22+++ src/SlingshotView.vala 2012-08-18 23:21:21 +0000
23@@ -119,6 +119,8 @@
24
25 debug ("In setup_size ()");
26 Slingshot.settings.screen_resolution = @"$(screen.get_width ())x$(screen.get_height ())";
27+ default_columns = 5;
28+ default_rows = 3;
29 while ((default_columns*130 +48 >= 2*screen.get_width ()/3)) {
30 default_columns--;
31 }
32@@ -126,8 +128,10 @@
33 while ((default_rows*145 + 72 >= 2*screen.get_height ()/3)) {
34 default_rows--;
35 }
36- if (Slingshot.settings.columns != default_columns)
37+
38+ if (Slingshot.settings.columns != default_columns) {
39 Slingshot.settings.columns = default_columns;
40+ }
41 if (Slingshot.settings.rows != default_rows)
42 Slingshot.settings.rows = default_rows;
43 }
44@@ -257,7 +261,8 @@
45 });
46
47 // Auto-update settings when changed
48- //Slingshot.settings.changed.connect (() => read_settings ());
49+ Slingshot.settings.changed["rows"].connect ( () => {read_settings (false, false, true);});
50+ Slingshot.settings.changed["columns"].connect ( () => {read_settings (false, true, false);});
51
52 // Auto-update applications grid
53 app_system.changed.connect (() => {
54@@ -271,6 +276,7 @@
55
56 // position on the right monitor when settings changed
57 screen.size_changed.connect (() => {
58+ setup_size ();
59 reposition ();
60 });
61 screen.monitors_changed.connect (() => {
62@@ -768,17 +774,31 @@
63
64 }
65
66- private void read_settings (bool first_start = false) {
67-
68- if (Slingshot.settings.columns > 3)
69- default_columns = Slingshot.settings.columns;
70- else
71- default_columns = Slingshot.settings.columns = 5;
72-
73- if (Slingshot.settings.rows > 1)
74- default_rows = Slingshot.settings.rows;
75- else
76- default_rows = Slingshot.settings.rows = 3;
77+ private void read_settings (bool first_start = false, bool check_columns = true, bool check_rows = true) {
78+
79+ if (check_columns) {
80+ if (Slingshot.settings.columns > 3)
81+ default_columns = Slingshot.settings.columns;
82+ else
83+ default_columns = Slingshot.settings.columns = 4;
84+ }
85+
86+ if (check_rows) {
87+ if (Slingshot.settings.rows > 1)
88+ default_rows = Slingshot.settings.rows;
89+ else
90+ default_rows = Slingshot.settings.rows = 2;
91+ }
92+
93+ if (!first_start) {
94+ grid_view.resize (default_rows, default_columns);
95+ populate_grid_view ();
96+ height_request = default_rows * 145 + 180;
97+
98+ category_view.app_view.resize (default_rows, default_columns);
99+ category_view.set_size_request (columns*130 + 17, view_height);
100+ category_view.show_filtered_apps (category_view.category_ids.get (category_view.category_switcher.selected));
101+ }
102
103 }
104
105
106=== modified file 'src/Widgets/CategoryView.vala'
107--- src/Widgets/CategoryView.vala 2012-08-17 21:23:25 +0000
108+++ src/Widgets/CategoryView.vala 2012-08-18 23:21:21 +0000
109@@ -41,7 +41,7 @@
110 private int current_position = 0;
111 private bool from_category = false;
112
113- private HashMap<int, string> category_ids = new HashMap<int, string> ();
114+ public HashMap<int, string> category_ids = new HashMap<int, string> ();
115
116 public CategoryView (SlingshotView parent) {
117
118@@ -227,7 +227,7 @@
119
120 }
121
122- private void show_filtered_apps (string category) {
123+ public void show_filtered_apps (string category) {
124
125 switcher.clear_children ();
126 app_view.clear ();
127
128=== modified file 'src/Widgets/Grid.vala'
129--- src/Widgets/Grid.vala 2012-06-20 22:54:03 +0000
130+++ src/Widgets/Grid.vala 2012-08-18 23:21:21 +0000
131@@ -121,6 +121,15 @@
132 }
133
134 }
135+
136+ public void resize (int rows, int columns) {
137+
138+ clear ();
139+ page.rows = rows;
140+ page.columns = columns;
141+ page.number = 1;
142+
143+ }
144
145 }
146

Subscribers

People subscribed via source and target branches