Merge lp:~elementary-apps/granite/remove-deprecated-since-0.2 into lp:~elementary-pantheon/granite/granite
- remove-deprecated-since-0.2
- Merge into granite
Proposed by
Danielle Foré
Status: | Rejected |
---|---|
Rejected by: | Danielle Foré |
Proposed branch: | lp:~elementary-apps/granite/remove-deprecated-since-0.2 |
Merge into: | lp:~elementary-pantheon/granite/granite |
Diff against target: |
419 lines (+0/-391) 4 files modified
lib/CMakeLists.txt (+0/-3) lib/Widgets/ContractorMenu.vala (+0/-144) lib/Widgets/ContractorView.vala (+0/-219) lib/Widgets/SidebarPaned.vala (+0/-25) |
To merge this branch: | bzr merge lp:~elementary-apps/granite/remove-deprecated-since-0.2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zisu Andrei (community) | Approve | ||
Rico Tzschichholz | Pending | ||
Review via email: mp+307076@code.launchpad.net |
Commit message
Remove widgets that have been deprecated since 0.2
Description of the change
This removes only widgets that have been deprecated since version 0.2 (That's Luna version, 3 years ago)
To post a comment you must log in.
Revision history for this message
Zisu Andrei (matzipan) wrote : | # |
Rico's advice is to hold and merge along with multiple API breaks.
Revision history for this message
RabbitBot (rabbitbot-a) wrote : | # |
Attempt to merge into lp:granite failed due to conflicts:
contents conflict in lib/Widgets/
contents conflict in lib/Widgets/
Unmerged revisions
- 995. By Danielle Foré
-
remove deprecated widgets
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/CMakeLists.txt' | |||
2 | --- lib/CMakeLists.txt 2016-09-28 18:36:03 +0000 | |||
3 | +++ lib/CMakeLists.txt 2016-09-28 19:24:35 +0000 | |||
4 | @@ -38,12 +38,9 @@ | |||
5 | 38 | Widgets/Toast.vala | 38 | Widgets/Toast.vala |
6 | 39 | Widgets/ToolButtonWithMenu.vala | 39 | Widgets/ToolButtonWithMenu.vala |
7 | 40 | Widgets/PopOver.vala | 40 | Widgets/PopOver.vala |
8 | 41 | Widgets/ContractorView.vala | ||
9 | 42 | Widgets/ContractorMenu.vala | ||
10 | 43 | Widgets/DecoratedWindow.vala | 41 | Widgets/DecoratedWindow.vala |
11 | 44 | Widgets/LightWindow.vala | 42 | Widgets/LightWindow.vala |
12 | 45 | Widgets/StatusBar.vala | 43 | Widgets/StatusBar.vala |
13 | 46 | Widgets/SidebarPaned.vala | ||
14 | 47 | Widgets/StorageBar.vala | 44 | Widgets/StorageBar.vala |
15 | 48 | Widgets/SourceList.vala | 45 | Widgets/SourceList.vala |
16 | 49 | Widgets/CellRendererExpander.vala | 46 | Widgets/CellRendererExpander.vala |
17 | 50 | 47 | ||
18 | === removed file 'lib/Widgets/ContractorMenu.vala' | |||
19 | --- lib/Widgets/ContractorMenu.vala 2016-06-09 01:28:31 +0000 | |||
20 | +++ lib/Widgets/ContractorMenu.vala 1970-01-01 00:00:00 +0000 | |||
21 | @@ -1,144 +0,0 @@ | |||
22 | 1 | /* | ||
23 | 2 | * Copyright (C) 2012-2013 Andrea Basso <andrea@elementaryos.org> | ||
24 | 3 | * | ||
25 | 4 | * This program or library is free software; you can redistribute it | ||
26 | 5 | * and/or modify it under the terms of the GNU Lesser General Public | ||
27 | 6 | * License as published by the Free Software Foundation; either | ||
28 | 7 | * version 3 of the License, or (at your option) any later version. | ||
29 | 8 | * | ||
30 | 9 | * This library is distributed in the hope that it will be useful, | ||
31 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
32 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
33 | 12 | * Lesser General Public License for more details. | ||
34 | 13 | * | ||
35 | 14 | * You should have received a copy of the GNU Lesser General | ||
36 | 15 | * Public License along with this library; if not, write to the | ||
37 | 16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
38 | 17 | * Boston, MA 02110-1301 USA. | ||
39 | 18 | */ | ||
40 | 19 | |||
41 | 20 | /** | ||
42 | 21 | * This class provides a simple menu for managing Contractor. | ||
43 | 22 | * It uses a long-obsolete and unused revision of Contractor API and will not | ||
44 | 23 | * work with stable releases of Contractor. | ||
45 | 24 | */ | ||
46 | 25 | [Version (deprecated = true, deprecated_since = "0.2", replacement = "")] | ||
47 | 26 | public class Granite.Widgets.ContractorMenu : Gtk.Menu { | ||
48 | 27 | /** | ||
49 | 28 | * The Hashtable of available contracts | ||
50 | 29 | */ | ||
51 | 30 | HashTable<string,string>[] contracts; | ||
52 | 31 | /** | ||
53 | 32 | * The Hashtable of executables | ||
54 | 33 | */ | ||
55 | 34 | Gee.HashMap <string,string> execs; | ||
56 | 35 | public delegate void ContractCallback (); | ||
57 | 36 | private string filepath; | ||
58 | 37 | private string filemime; | ||
59 | 38 | |||
60 | 39 | /** | ||
61 | 40 | * Passes when contract is clicked | ||
62 | 41 | */ | ||
63 | 42 | public signal void contract_activated (string contract_name); | ||
64 | 43 | |||
65 | 44 | /** | ||
66 | 45 | * Makes new Contractor Meu | ||
67 | 46 | * | ||
68 | 47 | * @param filename the filename of the file | ||
69 | 48 | * @param mime the mime-type of the file | ||
70 | 49 | */ | ||
71 | 50 | public ContractorMenu (string filename, string mime) { | ||
72 | 51 | filepath = filename; | ||
73 | 52 | filemime = mime; | ||
74 | 53 | load_items (filename, mime); | ||
75 | 54 | } | ||
76 | 55 | |||
77 | 56 | /** | ||
78 | 57 | * Adds new item to Contractor Menu | ||
79 | 58 | * | ||
80 | 59 | * @param name name of menu item | ||
81 | 60 | * @param icon_name the desired icon for menu item | ||
82 | 61 | * @param position desired position of menu item | ||
83 | 62 | * @param method method to be called when menu item is clicked | ||
84 | 63 | * @param use_stock tells whether to use stock for menu item | ||
85 | 64 | */ | ||
86 | 65 | public void add_item (string name, string icon_name, int position, ContractCallback method, bool use_stock = true) { | ||
87 | 66 | var item = new Gtk.ImageMenuItem (); | ||
88 | 67 | item.set_always_show_image (true); | ||
89 | 68 | item.set_use_stock (use_stock); | ||
90 | 69 | var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.MENU); | ||
91 | 70 | item.set_label (name); | ||
92 | 71 | item.set_image (image); | ||
93 | 72 | item.activate.connect (()=> { | ||
94 | 73 | contract_activated (name); | ||
95 | 74 | method(); | ||
96 | 75 | }); | ||
97 | 76 | insert(item, position); | ||
98 | 77 | item.show (); | ||
99 | 78 | } | ||
100 | 79 | |||
101 | 80 | /** | ||
102 | 81 | * Deletes a group of menu items | ||
103 | 82 | * | ||
104 | 83 | * @param names of menu items to delete | ||
105 | 84 | */ | ||
106 | 85 | public void name_blacklist (string[] names) { | ||
107 | 86 | this.foreach ((item)=> { | ||
108 | 87 | if (((Gtk.MenuItem)item).get_label () in names) | ||
109 | 88 | remove (item); | ||
110 | 89 | }); | ||
111 | 90 | } | ||
112 | 91 | |||
113 | 92 | private void load_items (string filename, string mime) { | ||
114 | 93 | contracts = Granite.Services.Contractor.get_contract (filename, mime); | ||
115 | 94 | execs = new Gee.HashMap<string,string> (); | ||
116 | 95 | |||
117 | 96 | for (int i=0;i<contracts.length;i++) { | ||
118 | 97 | execs[contracts[i].lookup ("Name")] = contracts[i].lookup ("Exec"); | ||
119 | 98 | |||
120 | 99 | var item = new Gtk.ImageMenuItem (); | ||
121 | 100 | item.set_always_show_image (true); | ||
122 | 101 | var image = new Gtk.Image.from_icon_name (contracts[i].lookup ("IconName"), Gtk.IconSize.MENU); | ||
123 | 102 | item.set_label (contracts[i].lookup ("Name")); | ||
124 | 103 | item.set_image (image); | ||
125 | 104 | item.activate.connect ( ()=> { | ||
126 | 105 | try { | ||
127 | 106 | Process.spawn_command_line_async (execs.get(item.get_label ())); | ||
128 | 107 | } catch (Error e) { | ||
129 | 108 | error (e.message); | ||
130 | 109 | } | ||
131 | 110 | }); | ||
132 | 111 | append (item); | ||
133 | 112 | item.show_all (); | ||
134 | 113 | } | ||
135 | 114 | } | ||
136 | 115 | |||
137 | 116 | /** | ||
138 | 117 | * Updates Contractor menu items | ||
139 | 118 | * | ||
140 | 119 | * @param filename the filename of the file | ||
141 | 120 | * @param mime the mime-type of the file | ||
142 | 121 | */ | ||
143 | 122 | public void update (string? filename, string? mime) { | ||
144 | 123 | this.foreach ((w) => {remove (w);}); | ||
145 | 124 | |||
146 | 125 | string fn = ""; | ||
147 | 126 | string mm = ""; | ||
148 | 127 | |||
149 | 128 | if (filename != null) { | ||
150 | 129 | fn = filename; | ||
151 | 130 | filepath = filename; | ||
152 | 131 | } else { | ||
153 | 132 | fn = filepath; | ||
154 | 133 | } | ||
155 | 134 | |||
156 | 135 | if (mime != null) { | ||
157 | 136 | mm = mime; | ||
158 | 137 | filemime = mime; | ||
159 | 138 | } else { | ||
160 | 139 | mm = filemime; | ||
161 | 140 | } | ||
162 | 141 | |||
163 | 142 | load_items (fn, mm); | ||
164 | 143 | } | ||
165 | 144 | } | ||
166 | 145 | 0 | ||
167 | === removed file 'lib/Widgets/ContractorView.vala' | |||
168 | --- lib/Widgets/ContractorView.vala 2016-06-09 01:28:31 +0000 | |||
169 | +++ lib/Widgets/ContractorView.vala 1970-01-01 00:00:00 +0000 | |||
170 | @@ -1,219 +0,0 @@ | |||
171 | 1 | /* | ||
172 | 2 | * Copyright (C) 2011-2013 Tom Beckmann <tom@elementaryos.org> | ||
173 | 3 | * | ||
174 | 4 | * This program or library is free software; you can redistribute it | ||
175 | 5 | * and/or modify it under the terms of the GNU Lesser General Public | ||
176 | 6 | * License as published by the Free Software Foundation; either | ||
177 | 7 | * version 3 of the License, or (at your option) any later version. | ||
178 | 8 | * | ||
179 | 9 | * This library is distributed in the hope that it will be useful, | ||
180 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
181 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
182 | 12 | * Lesser General Public License for more details. | ||
183 | 13 | * | ||
184 | 14 | * You should have received a copy of the GNU Lesser General | ||
185 | 15 | * Public License along with this library; if not, write to the | ||
186 | 16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
187 | 17 | * Boston, MA 02110-1301 USA. | ||
188 | 18 | */ | ||
189 | 19 | |||
190 | 20 | using Gtk; | ||
191 | 21 | |||
192 | 22 | /** | ||
193 | 23 | * This class provides a simple way to look at contracts from Contractor. | ||
194 | 24 | * It uses a long-obsolete and unused revision of Contractor API and will not | ||
195 | 25 | * work with stable releases of Contractor. | ||
196 | 26 | */ | ||
197 | 27 | [Version (deprecated = true, deprecated_since = "0.2", replacement = "")] | ||
198 | 28 | public class Granite.Widgets.ContractorView : TreeView { | ||
199 | 29 | |||
200 | 30 | /** | ||
201 | 31 | * indicates if it was possible to connect to contractor | ||
202 | 32 | */ | ||
203 | 33 | public bool contractor_available; | ||
204 | 34 | |||
205 | 35 | public delegate void ContractCallback (); | ||
206 | 36 | private Gee.HashMap<int, DelegateWrapper?> outsiders; | ||
207 | 37 | private int[] blacklisted_pos; | ||
208 | 38 | private Gtk.ListStore list; | ||
209 | 39 | |||
210 | 40 | private struct DelegateWrapper { unowned ContractCallback method; } | ||
211 | 41 | |||
212 | 42 | /** | ||
213 | 43 | * the index of the currently selected contract | ||
214 | 44 | */ | ||
215 | 45 | public int selected { | ||
216 | 46 | get { | ||
217 | 47 | TreePath path; | ||
218 | 48 | this.get_cursor (out path, null); | ||
219 | 49 | return int.parse (path.to_string ()); | ||
220 | 50 | } | ||
221 | 51 | set { | ||
222 | 52 | this.set_cursor (new TreePath.from_string (value.to_string ()), null, false); | ||
223 | 53 | } | ||
224 | 54 | } | ||
225 | 55 | |||
226 | 56 | /** | ||
227 | 57 | * A contract was launched using double clicking | ||
228 | 58 | */ | ||
229 | 59 | public signal void executed (); | ||
230 | 60 | |||
231 | 61 | /** | ||
232 | 62 | * the original array of contracts returned by contractor | ||
233 | 63 | */ | ||
234 | 64 | HashTable<string,string>[] contracts; | ||
235 | 65 | |||
236 | 66 | /** | ||
237 | 67 | * Create the default ContractorView | ||
238 | 68 | * | ||
239 | 69 | * @param filename the file | ||
240 | 70 | * @param mime the mimetype of the file | ||
241 | 71 | * @param icon_size the size of the icon in pixel | ||
242 | 72 | * @param show_contract_name show the name of the contract in the list | ||
243 | 73 | */ | ||
244 | 74 | public ContractorView (string filename, string mime, int icon_size = 32, bool show_contract_name = true) { | ||
245 | 75 | /* Setup the ListStore */ | ||
246 | 76 | list = new Gtk.ListStore (2, typeof (Gdk.Pixbuf), typeof (string)); | ||
247 | 77 | outsiders = new Gee.HashMap<int, DelegateWrapper?> (); | ||
248 | 78 | this.model = list; | ||
249 | 79 | |||
250 | 80 | /* GUI */ | ||
251 | 81 | this.headers_visible = false; | ||
252 | 82 | this.hexpand = true; | ||
253 | 83 | |||
254 | 84 | /* Events */ | ||
255 | 85 | row_activated.connect (() => { | ||
256 | 86 | run_selected (); | ||
257 | 87 | executed (); | ||
258 | 88 | }); | ||
259 | 89 | |||
260 | 90 | /* View */ | ||
261 | 91 | var cell1 = new CellRendererPixbuf (); | ||
262 | 92 | cell1.set_padding (5, 8); | ||
263 | 93 | this.insert_column_with_attributes (-1, "", cell1, "pixbuf", 0); | ||
264 | 94 | var cell2 = new CellRendererText (); | ||
265 | 95 | cell2.set_padding (2, 8); | ||
266 | 96 | this.insert_column_with_attributes (-1, "", cell2, "markup", 1); | ||
267 | 97 | |||
268 | 98 | this.contracts = Granite.Services.Contractor.get_contract (filename, mime); | ||
269 | 99 | if (this.contracts == null || this.contracts.length == 0) { | ||
270 | 100 | warning ("You should install contractor (or no contracts found for this mime).\n"); | ||
271 | 101 | contractor_available = false; | ||
272 | 102 | TreeIter it; | ||
273 | 103 | list.append (out it); | ||
274 | 104 | bool contractor_installed = this.contracts == null; | ||
275 | 105 | string message = contractor_installed ? _("Could not contact Contractor. You may need to install it") : _("No action found for this file"); | ||
276 | 106 | try { | ||
277 | 107 | var icon = IconTheme.get_default ().load_icon ( | ||
278 | 108 | contractor_installed ? "dialog-error" : "dialog-information", | ||
279 | 109 | icon_size, 0); | ||
280 | 110 | list.set (it, | ||
281 | 111 | 0, icon, 1, message); | ||
282 | 112 | } | ||
283 | 113 | catch (Error e) { | ||
284 | 114 | warning("%s\n", e.message); | ||
285 | 115 | } | ||
286 | 116 | set_sensitive(false); | ||
287 | 117 | } | ||
288 | 118 | else { | ||
289 | 119 | contractor_available = true; | ||
290 | 120 | |||
291 | 121 | for (var i=0; i<this.contracts.length; i++){ | ||
292 | 122 | TreeIter it; | ||
293 | 123 | list.append (out it); | ||
294 | 124 | string text = this.contracts[i].lookup ("Description"); | ||
295 | 125 | if (show_contract_name) | ||
296 | 126 | text = "<b>"+this.contracts[i].lookup ("Name")+"</b>\n"+text; | ||
297 | 127 | try{ | ||
298 | 128 | list.set (it, | ||
299 | 129 | 0, IconTheme.get_default ().load_icon (this.contracts[i].lookup ("IconName"), | ||
300 | 130 | icon_size, 0), 1, text); | ||
301 | 131 | } | ||
302 | 132 | catch (Error e) { | ||
303 | 133 | warning (e.message); | ||
304 | 134 | } | ||
305 | 135 | } | ||
306 | 136 | this.selected = 0; | ||
307 | 137 | } | ||
308 | 138 | } | ||
309 | 139 | |||
310 | 140 | /** | ||
311 | 141 | * A method to add items to the tree | ||
312 | 142 | * | ||
313 | 143 | * @param name the name | ||
314 | 144 | * @param desc the description | ||
315 | 145 | * @param icon_name the name of the icon to show | ||
316 | 146 | * @param icon_size the size of the icon in pixel | ||
317 | 147 | * @param position the posion the item will be inserted at (first position is 0) | ||
318 | 148 | * @param method a general method containing all the methods that should be called when the item is activated | ||
319 | 149 | * (must return void and mustn't have any parameter) | ||
320 | 150 | */ | ||
321 | 151 | public void add_item (string name, string desc, string icon_name, int icon_size, int position, ContractCallback method) { | ||
322 | 152 | TreeIter it; | ||
323 | 153 | list.insert (out it, position); | ||
324 | 154 | |||
325 | 155 | string text = "<b>" + name + "</b>\n" + desc; | ||
326 | 156 | |||
327 | 157 | try{ | ||
328 | 158 | list.set (it, 0, IconTheme.get_default ().load_icon (icon_name, icon_size, 0), 1, text); | ||
329 | 159 | } catch (Error e) { | ||
330 | 160 | error (e.message); | ||
331 | 161 | } | ||
332 | 162 | |||
333 | 163 | DelegateWrapper wr = { method }; | ||
334 | 164 | outsiders[position] = wr; | ||
335 | 165 | |||
336 | 166 | this.selected = 0; | ||
337 | 167 | } | ||
338 | 168 | |||
339 | 169 | public void name_blacklist (string[] names) { | ||
340 | 170 | TreeIter it; | ||
341 | 171 | TreeIter it2; | ||
342 | 172 | Value value; | ||
343 | 173 | bool check; | ||
344 | 174 | int cur_pos = 0; | ||
345 | 175 | list.get_iter_first (out it); | ||
346 | 176 | list.get_iter_first (out it2); | ||
347 | 177 | |||
348 | 178 | while (true) { | ||
349 | 179 | list.get_value (it, 1, out value); | ||
350 | 180 | check = list.iter_next (ref it2); | ||
351 | 181 | string text = value.get_string (); | ||
352 | 182 | |||
353 | 183 | if (text[3:text.index_of ("</b>")] in names) { | ||
354 | 184 | list.remove (it); | ||
355 | 185 | blacklisted_pos += cur_pos; | ||
356 | 186 | } | ||
357 | 187 | if (!check) | ||
358 | 188 | break; | ||
359 | 189 | |||
360 | 190 | it = it2; | ||
361 | 191 | cur_pos++; | ||
362 | 192 | } | ||
363 | 193 | } | ||
364 | 194 | |||
365 | 195 | |||
366 | 196 | public void run_selected () { | ||
367 | 197 | if (this.selected in outsiders.keys ) { | ||
368 | 198 | outsiders[this.selected].method (); | ||
369 | 199 | } else { | ||
370 | 200 | try { | ||
371 | 201 | int corr = 0; | ||
372 | 202 | foreach (int i in outsiders.keys) { //adjust in case of items added | ||
373 | 203 | if (i > this.selected) | ||
374 | 204 | break; | ||
375 | 205 | corr++; | ||
376 | 206 | } | ||
377 | 207 | foreach (int i in blacklisted_pos) { //adjust in case of items removed | ||
378 | 208 | if (i > this.selected) | ||
379 | 209 | break; | ||
380 | 210 | corr--; | ||
381 | 211 | } | ||
382 | 212 | Process.spawn_command_line_async ( | ||
383 | 213 | this.contracts[this.selected-corr].lookup ("Exec")); | ||
384 | 214 | } catch (Error e) { | ||
385 | 215 | error (e.message); | ||
386 | 216 | } | ||
387 | 217 | } | ||
388 | 218 | } | ||
389 | 219 | } | ||
390 | 220 | 0 | ||
391 | === removed file 'lib/Widgets/SidebarPaned.vala' | |||
392 | --- lib/Widgets/SidebarPaned.vala 2016-06-09 01:28:31 +0000 | |||
393 | +++ lib/Widgets/SidebarPaned.vala 1970-01-01 00:00:00 +0000 | |||
394 | @@ -1,25 +0,0 @@ | |||
395 | 1 | /* | ||
396 | 2 | * Copyright (C) 2011-2013 Granite Developers | ||
397 | 3 | * | ||
398 | 4 | * This program or library is free software; you can redistribute it | ||
399 | 5 | * and/or modify it under the terms of the GNU Lesser General Public | ||
400 | 6 | * License as published by the Free Software Foundation; either | ||
401 | 7 | * version 3 of the License, or (at your option) any later version. | ||
402 | 8 | * | ||
403 | 9 | * This library is distributed in the hope that it will be useful, | ||
404 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
405 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
406 | 12 | * Lesser General Public License for more details. | ||
407 | 13 | * | ||
408 | 14 | * You should have received a copy of the GNU Lesser General | ||
409 | 15 | * Public License along with this library; if not, write to the | ||
410 | 16 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
411 | 17 | * Boston, MA 02110-1301 USA. | ||
412 | 18 | * | ||
413 | 19 | * Authored by: Victor Eduardo <victoreduardm@gmail.com> | ||
414 | 20 | */ | ||
415 | 21 | |||
416 | 22 | [Version (deprecated = true, deprecated_since = "0.2", replacement = "Granite.Widgets.ThinPaned")] | ||
417 | 23 | public class Granite.Widgets.SidebarPaned : ThinPaned { | ||
418 | 24 | } | ||
419 | 25 |
Builds and otherwise LGTM.