Merge lp:~victored/granite/remove-outstanding-deprecations into lp:~elementary-pantheon/granite/granite
- remove-outstanding-deprecations
- Merge into granite
Proposed by
Victor Martinez
Status: | Work in progress |
---|---|
Proposed branch: | lp:~victored/granite/remove-outstanding-deprecations |
Merge into: | lp:~elementary-pantheon/granite/granite |
Diff against target: |
619 lines (+2/-494) 11 files modified
CMakeLists.txt (+1/-1) lib/Application.vala (+0/-10) lib/CMakeLists.txt (+1/-5) lib/Services/Contractor.vala (+0/-67) lib/Widgets/AppMenu.vala (+0/-9) lib/Widgets/CellRendererBadge.vala (+0/-1) lib/Widgets/CellRendererExpander.vala (+0/-1) lib/Widgets/CollapsiblePaned.vala (+0/-16) lib/Widgets/ContractorMenu.vala (+0/-142) lib/Widgets/ContractorView.vala (+0/-217) lib/Widgets/SidebarPaned.vala (+0/-25) |
To merge this branch: | bzr merge lp:~victored/granite/remove-outstanding-deprecations |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
xapantu (community) | Abstain | ||
Sergey "Shnatsel" Davidoff (community) | Disapprove | ||
Review via email: mp+180671@code.launchpad.net |
Commit message
Remove outstanding deprecations from previous releases.
Description of the change
Remove outstanding deprecations from previous releases.
Please note that I am not removing Granite.
I did not remove the deprecated method from DynamicNotebook either since it's a widget with too many API clients.
Expect applications failing to build after landing this into trunk.
To post a comment you must log in.
- 606. By Victor Martinez
-
Bump version to 0.3.0, and SO version to 2
Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote : | # |
review:
Disapprove
Revision history for this message
xapantu (xapantu) wrote : | # |
For now we are not going to merge it, it must be done the next time we are forced to do a SO bump (so we already lost an occasion to do it).
review:
Abstain
Unmerged revisions
- 606. By Victor Martinez
-
Bump version to 0.3.0, and SO version to 2
- 605. By Victor Martinez
-
Remove outstanding deprecations from previous releases.
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 2013-08-16 22:52:50 +0000 | |||
3 | +++ CMakeLists.txt 2013-08-16 23:42:02 +0000 | |||
4 | @@ -5,7 +5,7 @@ | |||
5 | 5 | project (granite C) | 5 | project (granite C) |
6 | 6 | 6 | ||
7 | 7 | set (PKG_NAME ${CMAKE_PROJECT_NAME}) | 7 | set (PKG_NAME ${CMAKE_PROJECT_NAME}) |
9 | 8 | set (PKG_VERSION 0.2.2) | 8 | set (PKG_VERSION 0.3.0) |
10 | 9 | set (API_VERSION 1.0) | 9 | set (API_VERSION 1.0) |
11 | 10 | 10 | ||
12 | 11 | # Used to create GObject introspection files | 11 | # Used to create GObject introspection files |
13 | 12 | 12 | ||
14 | === modified file 'lib/Application.vala' | |||
15 | --- lib/Application.vala 2013-03-20 15:42:25 +0000 | |||
16 | +++ lib/Application.vala 2013-08-16 23:42:02 +0000 | |||
17 | @@ -23,13 +23,6 @@ | |||
18 | 23 | using Granite.Widgets; | 23 | using Granite.Widgets; |
19 | 24 | 24 | ||
20 | 25 | namespace Granite { | 25 | namespace Granite { |
21 | 26 | |||
22 | 27 | /** | ||
23 | 28 | * Global deprecated object.. | ||
24 | 29 | */ | ||
25 | 30 | [Deprecated (since = "granite-0.1")] | ||
26 | 31 | public static Granite.Application app; | ||
27 | 32 | |||
28 | 33 | /** | 26 | /** |
29 | 34 | * This is the base class for all Granite-based apps. It has methods that help | 27 | * This is the base class for all Granite-based apps. It has methods that help |
30 | 35 | * to create a great deal of an app's functionality. | 28 | * to create a great deal of an app's functionality. |
31 | @@ -80,9 +73,6 @@ | |||
32 | 80 | Logger.DisplayLevel = LogLevel.WARN; | 73 | Logger.DisplayLevel = LogLevel.WARN; |
33 | 81 | 74 | ||
34 | 82 | Intl.bindtextdomain (exec_name, build_data_dir + "/locale"); | 75 | Intl.bindtextdomain (exec_name, build_data_dir + "/locale"); |
35 | 83 | |||
36 | 84 | // Deprecated | ||
37 | 85 | Granite.app = this; | ||
38 | 86 | } | 76 | } |
39 | 87 | 77 | ||
40 | 88 | #if LINUX | 78 | #if LINUX |
41 | 89 | 79 | ||
42 | === modified file 'lib/CMakeLists.txt' | |||
43 | --- lib/CMakeLists.txt 2013-06-08 20:38:28 +0000 | |||
44 | +++ lib/CMakeLists.txt 2013-08-16 23:42:02 +0000 | |||
45 | @@ -1,5 +1,5 @@ | |||
46 | 1 | # increase when you break the API | 1 | # increase when you break the API |
48 | 2 | set (PKG_SOVERSION 1) | 2 | set (PKG_SOVERSION 2) |
49 | 3 | 3 | ||
50 | 4 | # Increase when you add functionality | 4 | # Increase when you add functionality |
51 | 5 | set (PKG_SOMINOR 0.1) | 5 | set (PKG_SOMINOR 0.1) |
52 | @@ -15,7 +15,6 @@ | |||
53 | 15 | Services/Logger.vala | 15 | Services/Logger.vala |
54 | 16 | Services/Paths.vala | 16 | Services/Paths.vala |
55 | 17 | Services/System.vala | 17 | Services/System.vala |
56 | 18 | Services/Contractor.vala | ||
57 | 19 | Services/ContractorProxy.vala | 18 | Services/ContractorProxy.vala |
58 | 20 | Services/IconFactory.vala | 19 | Services/IconFactory.vala |
59 | 21 | Services/SimpleCommand.vala | 20 | Services/SimpleCommand.vala |
60 | @@ -34,12 +33,9 @@ | |||
61 | 34 | Widgets/Welcome.vala | 33 | Widgets/Welcome.vala |
62 | 35 | Widgets/ToolButtonWithMenu.vala | 34 | Widgets/ToolButtonWithMenu.vala |
63 | 36 | Widgets/PopOver.vala | 35 | Widgets/PopOver.vala |
64 | 37 | Widgets/ContractorView.vala | ||
65 | 38 | Widgets/ContractorMenu.vala | ||
66 | 39 | Widgets/DecoratedWindow.vala | 36 | Widgets/DecoratedWindow.vala |
67 | 40 | Widgets/LightWindow.vala | 37 | Widgets/LightWindow.vala |
68 | 41 | Widgets/StatusBar.vala | 38 | Widgets/StatusBar.vala |
69 | 42 | Widgets/SidebarPaned.vala | ||
70 | 43 | Widgets/SourceList.vala | 39 | Widgets/SourceList.vala |
71 | 44 | Widgets/CellRendererExpander.vala | 40 | Widgets/CellRendererExpander.vala |
72 | 45 | Widgets/CellRendererBadge.vala | 41 | Widgets/CellRendererBadge.vala |
73 | 46 | 42 | ||
74 | === removed file 'lib/Services/Contractor.vala' | |||
75 | --- lib/Services/Contractor.vala 2013-04-23 04:40:58 +0000 | |||
76 | +++ lib/Services/Contractor.vala 1970-01-01 00:00:00 +0000 | |||
77 | @@ -1,67 +0,0 @@ | |||
78 | 1 | /*** | ||
79 | 2 | Copyright (C) 2011-2013 Lucas Baudin <xapantu@gmail.com> | ||
80 | 3 | |||
81 | 4 | This program or library is free software; you can redistribute it | ||
82 | 5 | and/or modify it under the terms of the GNU Lesser General Public | ||
83 | 6 | License as published by the Free Software Foundation; either | ||
84 | 7 | version 3 of the License, or (at your option) any later version. | ||
85 | 8 | |||
86 | 9 | This library is distributed in the hope that it will be useful, | ||
87 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
88 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
89 | 12 | Lesser General Public License for more details. | ||
90 | 13 | |||
91 | 14 | You should have received a copy of the GNU Lesser General | ||
92 | 15 | Public License along with this library; if not, write to the | ||
93 | 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
94 | 17 | Boston, MA 02110-1301 USA. | ||
95 | 18 | ***/ | ||
96 | 19 | |||
97 | 20 | namespace Granite.Services { | ||
98 | 21 | [DBus (name = "org.elementary.Contractor")] | ||
99 | 22 | interface ContractorDBus : Object { | ||
100 | 23 | public abstract GLib.HashTable<string,string>[] GetServicesByLocation (string strlocation, string? file_mime = "") throws IOError; | ||
101 | 24 | public abstract GLib.HashTable<string,string>[] GetServicesByLocationsList (GLib.HashTable<string,string>[] locations) throws IOError; | ||
102 | 25 | } | ||
103 | 26 | |||
104 | 27 | /** | ||
105 | 28 | * A way to handle contractor, a way to communicate between apps. | ||
106 | 29 | * | ||
107 | 30 | * /!\ Highly unstable API | ||
108 | 31 | */ | ||
109 | 32 | [Deprecated (replacement = "Granite.Services.ContractorProxy", since = "0.2")] | ||
110 | 33 | public class Contractor : Object { | ||
111 | 34 | internal ContractorDBus contract; | ||
112 | 35 | internal static Contractor? contractor = null; | ||
113 | 36 | |||
114 | 37 | /** | ||
115 | 38 | * This creates a new Contractor | ||
116 | 39 | */ | ||
117 | 40 | public Contractor () { | ||
118 | 41 | } | ||
119 | 42 | |||
120 | 43 | internal static void ensure () { | ||
121 | 44 | } | ||
122 | 45 | |||
123 | 46 | /** | ||
124 | 47 | * This searches for available contracts of a particular file | ||
125 | 48 | * | ||
126 | 49 | * @param uri uri of file | ||
127 | 50 | * @param mime mime type of file | ||
128 | 51 | * @return Hashtable of available contracts | ||
129 | 52 | */ | ||
130 | 53 | public static GLib.HashTable<string,string>[] get_contract (string uri, string mime) { | ||
131 | 54 | return { new GLib.HashTable<string,string> (null, null) }; | ||
132 | 55 | } | ||
133 | 56 | |||
134 | 57 | /** | ||
135 | 58 | * generate contracts for arguments and filter them by common parent mimetype. | ||
136 | 59 | * | ||
137 | 60 | * @param locations Hashtable of locations | ||
138 | 61 | * @return Hashtable of available contracts | ||
139 | 62 | */ | ||
140 | 63 | public static GLib.HashTable<string,string>[] get_selection_contracts (GLib.HashTable<string, string>[] locations) { | ||
141 | 64 | return { new GLib.HashTable<string,string> (null, null) }; | ||
142 | 65 | } | ||
143 | 66 | } | ||
144 | 67 | } | ||
145 | 68 | 0 | ||
146 | === modified file 'lib/Widgets/AppMenu.vala' | |||
147 | --- lib/Widgets/AppMenu.vala 2013-03-20 15:42:25 +0000 | |||
148 | +++ lib/Widgets/AppMenu.vala 2013-08-16 23:42:02 +0000 | |||
149 | @@ -64,15 +64,6 @@ | |||
150 | 64 | } | 64 | } |
151 | 65 | 65 | ||
152 | 66 | /** | 66 | /** |
153 | 67 | * Create a new AppMenu, parameters are unused now. | ||
154 | 68 | */ | ||
155 | 69 | [Deprecated (since = "granite-0.1")] | ||
156 | 70 | public AppMenu.with_urls (Gtk.Menu menu, string help_url, string translate_url, string bug_url) { | ||
157 | 71 | critical("This is a deprecated creation method: AppMenu.with_urls"); | ||
158 | 72 | base (new Image.from_icon_name ("application-menu", IconSize.MENU), _("Menu"), menu); | ||
159 | 73 | } | ||
160 | 74 | |||
161 | 75 | /** | ||
162 | 76 | * This method adds makes a properly formatted App Menu menu from given menu | 67 | * This method adds makes a properly formatted App Menu menu from given menu |
163 | 77 | * | 68 | * |
164 | 78 | * @param menu menu to format | 69 | * @param menu menu to format |
165 | 79 | 70 | ||
166 | === modified file 'lib/Widgets/CellRendererBadge.vala' | |||
167 | --- lib/Widgets/CellRendererBadge.vala 2013-03-21 12:23:37 +0000 | |||
168 | +++ lib/Widgets/CellRendererBadge.vala 2013-08-16 23:42:02 +0000 | |||
169 | @@ -122,7 +122,6 @@ | |||
170 | 122 | ctx.render_layout (context, x, y, text_layout); | 122 | ctx.render_layout (context, x, y, text_layout); |
171 | 123 | } | 123 | } |
172 | 124 | 124 | ||
173 | 125 | [Deprecated (replacement = "Gtk.CellRenderer.get_preferred_size", since = "")] | ||
174 | 126 | public override void get_size (Gtk.Widget widget, Gdk.Rectangle? cell_area, | 125 | public override void get_size (Gtk.Widget widget, Gdk.Rectangle? cell_area, |
175 | 127 | out int x_offset, out int y_offset, | 126 | out int x_offset, out int y_offset, |
176 | 128 | out int width, out int height) | 127 | out int width, out int height) |
177 | 129 | 128 | ||
178 | === modified file 'lib/Widgets/CellRendererExpander.vala' | |||
179 | --- lib/Widgets/CellRendererExpander.vala 2013-04-23 05:28:57 +0000 | |||
180 | +++ lib/Widgets/CellRendererExpander.vala 2013-08-16 23:42:02 +0000 | |||
181 | @@ -96,7 +96,6 @@ | |||
182 | 96 | revert_style_changes (widget); | 96 | revert_style_changes (widget); |
183 | 97 | } | 97 | } |
184 | 98 | 98 | ||
185 | 99 | [Deprecated (replacement = "Gtk.CellRenderer.get_preferred_size", since = "")] | ||
186 | 100 | public override void get_size (Gtk.Widget widget, Gdk.Rectangle? cell_area, | 99 | public override void get_size (Gtk.Widget widget, Gdk.Rectangle? cell_area, |
187 | 101 | out int x_offset, out int y_offset, | 100 | out int x_offset, out int y_offset, |
188 | 102 | out int width, out int height) | 101 | out int width, out int height) |
189 | 103 | 102 | ||
190 | === modified file 'lib/Widgets/CollapsiblePaned.vala' | |||
191 | --- lib/Widgets/CollapsiblePaned.vala 2013-03-20 15:42:25 +0000 | |||
192 | +++ lib/Widgets/CollapsiblePaned.vala 2013-08-16 23:42:02 +0000 | |||
193 | @@ -35,8 +35,6 @@ | |||
194 | 35 | */ | 35 | */ |
195 | 36 | public class CollapsiblePaned : Gtk.Paned { | 36 | public class CollapsiblePaned : Gtk.Paned { |
196 | 37 | public CollapseMode collapse_mode { get; set; default = CollapseMode.NONE; } | 37 | public CollapseMode collapse_mode { get; set; default = CollapseMode.NONE; } |
197 | 38 | //public signal void shrink(); //TODO: Make the default action overwritable | ||
198 | 39 | //public new signal void expand(int saved_state); //TODO same | ||
199 | 40 | 38 | ||
200 | 41 | private int saved_state = 10; | 39 | private int saved_state = 10; |
201 | 42 | private uint last_click_time = 0; | 40 | private uint last_click_time = 0; |
202 | @@ -86,18 +84,4 @@ | |||
203 | 86 | return false; | 84 | return false; |
204 | 87 | } | 85 | } |
205 | 88 | } | 86 | } |
206 | 89 | |||
207 | 90 | [Deprecated (replacement = "Granite.Widgets.CollapsiblePaned", since = "granite-0.2")] | ||
208 | 91 | public class HCollapsablePaned : CollapsiblePaned { | ||
209 | 92 | public HCollapsablePaned () { | ||
210 | 93 | base (Gtk.Orientation.HORIZONTAL); | ||
211 | 94 | } | ||
212 | 95 | } | ||
213 | 96 | |||
214 | 97 | [Deprecated (replacement = "Granite.Widgets.CollapsiblePaned", since = "granite-0.2")] | ||
215 | 98 | public class VCollapsablePaned : CollapsiblePaned { | ||
216 | 99 | public VCollapsablePaned () { | ||
217 | 100 | base (Gtk.Orientation.VERTICAL); | ||
218 | 101 | } | ||
219 | 102 | } | ||
220 | 103 | } | 87 | } |
221 | 104 | 88 | ||
222 | === removed file 'lib/Widgets/ContractorMenu.vala' | |||
223 | --- lib/Widgets/ContractorMenu.vala 2013-04-22 19:05:09 +0000 | |||
224 | +++ lib/Widgets/ContractorMenu.vala 1970-01-01 00:00:00 +0000 | |||
225 | @@ -1,142 +0,0 @@ | |||
226 | 1 | /*** | ||
227 | 2 | Copyright (C) 2012-2013 Andrea Basso <andrea@elementaryos.org> | ||
228 | 3 | |||
229 | 4 | This program or library is free software; you can redistribute it | ||
230 | 5 | and/or modify it under the terms of the GNU Lesser General Public | ||
231 | 6 | License as published by the Free Software Foundation; either | ||
232 | 7 | version 3 of the License, or (at your option) any later version. | ||
233 | 8 | |||
234 | 9 | This library is distributed in the hope that it will be useful, | ||
235 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
236 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
237 | 12 | Lesser General Public License for more details. | ||
238 | 13 | |||
239 | 14 | You should have received a copy of the GNU Lesser General | ||
240 | 15 | Public License along with this library; if not, write to the | ||
241 | 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
242 | 17 | Boston, MA 02110-1301 USA. | ||
243 | 18 | ***/ | ||
244 | 19 | |||
245 | 20 | /** | ||
246 | 21 | * This class provides a simple menu for managing Contractor. | ||
247 | 22 | */ | ||
248 | 23 | [Deprecated (since = "0.2")] | ||
249 | 24 | public class Granite.Widgets.ContractorMenu : Gtk.Menu { | ||
250 | 25 | /** | ||
251 | 26 | * The Hashtable of available contracts | ||
252 | 27 | */ | ||
253 | 28 | HashTable<string,string>[] contracts; | ||
254 | 29 | /** | ||
255 | 30 | * The Hashtable of executables | ||
256 | 31 | */ | ||
257 | 32 | Gee.HashMap <string,string> execs; | ||
258 | 33 | public delegate void ContractCallback (); | ||
259 | 34 | private string filepath; | ||
260 | 35 | private string filemime; | ||
261 | 36 | |||
262 | 37 | /** | ||
263 | 38 | * Passes when contract is clicked | ||
264 | 39 | */ | ||
265 | 40 | public signal void contract_activated (string contract_name); | ||
266 | 41 | |||
267 | 42 | /** | ||
268 | 43 | * Makes new Contractor Meu | ||
269 | 44 | * | ||
270 | 45 | * @param filename the filename of the file | ||
271 | 46 | * @param mime the mime-type of the file | ||
272 | 47 | */ | ||
273 | 48 | public ContractorMenu (string filename, string mime) { | ||
274 | 49 | filepath = filename; | ||
275 | 50 | filemime = mime; | ||
276 | 51 | load_items (filename, mime); | ||
277 | 52 | } | ||
278 | 53 | |||
279 | 54 | /** | ||
280 | 55 | * Adds new item to Contractor Menu | ||
281 | 56 | * | ||
282 | 57 | * @param name name of menu item | ||
283 | 58 | * @param icon_name the desired icon for menu item | ||
284 | 59 | * @param position desired position of menu item | ||
285 | 60 | * @param method method to be called when menu item is clicked | ||
286 | 61 | * @param use_stock tells whether to use stock for menu item | ||
287 | 62 | */ | ||
288 | 63 | public void add_item (string name, string icon_name, int position, ContractCallback method, bool use_stock = true) { | ||
289 | 64 | var item = new Gtk.ImageMenuItem (); | ||
290 | 65 | item.set_always_show_image (true); | ||
291 | 66 | item.set_use_stock (use_stock); | ||
292 | 67 | var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.MENU); | ||
293 | 68 | item.set_label (name); | ||
294 | 69 | item.set_image (image); | ||
295 | 70 | item.activate.connect (()=> { | ||
296 | 71 | contract_activated (name); | ||
297 | 72 | method(); | ||
298 | 73 | }); | ||
299 | 74 | insert(item, position); | ||
300 | 75 | item.show (); | ||
301 | 76 | } | ||
302 | 77 | |||
303 | 78 | /** | ||
304 | 79 | * Deletes a group of menu items | ||
305 | 80 | * | ||
306 | 81 | * @param names of menu items to delete | ||
307 | 82 | */ | ||
308 | 83 | public void name_blacklist (string[] names) { | ||
309 | 84 | this.foreach ((item)=> { | ||
310 | 85 | if (((Gtk.MenuItem)item).get_label () in names) | ||
311 | 86 | remove (item); | ||
312 | 87 | }); | ||
313 | 88 | } | ||
314 | 89 | |||
315 | 90 | private void load_items (string filename, string mime) { | ||
316 | 91 | contracts = Granite.Services.Contractor.get_contract (filename, mime); | ||
317 | 92 | execs = new Gee.HashMap<string,string> (); | ||
318 | 93 | |||
319 | 94 | for (int i=0;i<contracts.length;i++) { | ||
320 | 95 | execs[contracts[i].lookup ("Name")] = contracts[i].lookup ("Exec"); | ||
321 | 96 | |||
322 | 97 | var item = new Gtk.ImageMenuItem (); | ||
323 | 98 | item.set_always_show_image (true); | ||
324 | 99 | var image = new Gtk.Image.from_icon_name (contracts[i].lookup ("IconName"), Gtk.IconSize.MENU); | ||
325 | 100 | item.set_label (contracts[i].lookup ("Name")); | ||
326 | 101 | item.set_image (image); | ||
327 | 102 | item.activate.connect ( ()=> { | ||
328 | 103 | try { | ||
329 | 104 | Process.spawn_command_line_async (execs.get(item.get_label ())); | ||
330 | 105 | } catch (Error e) { | ||
331 | 106 | error (e.message); | ||
332 | 107 | } | ||
333 | 108 | }); | ||
334 | 109 | append (item); | ||
335 | 110 | item.show_all (); | ||
336 | 111 | } | ||
337 | 112 | } | ||
338 | 113 | |||
339 | 114 | /** | ||
340 | 115 | * Updates Contractor menu items | ||
341 | 116 | * | ||
342 | 117 | * @param filename the filename of the file | ||
343 | 118 | * @param mime the mime-type of the file | ||
344 | 119 | */ | ||
345 | 120 | public void update (string? filename, string? mime) { | ||
346 | 121 | this.foreach ((w) => {remove (w);}); | ||
347 | 122 | |||
348 | 123 | string fn = ""; | ||
349 | 124 | string mm = ""; | ||
350 | 125 | |||
351 | 126 | if (filename != null) { | ||
352 | 127 | fn = filename; | ||
353 | 128 | filepath = filename; | ||
354 | 129 | } else { | ||
355 | 130 | fn = filepath; | ||
356 | 131 | } | ||
357 | 132 | |||
358 | 133 | if (mime != null) { | ||
359 | 134 | mm = mime; | ||
360 | 135 | filemime = mime; | ||
361 | 136 | } else { | ||
362 | 137 | mm = filemime; | ||
363 | 138 | } | ||
364 | 139 | |||
365 | 140 | load_items (fn, mm); | ||
366 | 141 | } | ||
367 | 142 | } | ||
368 | 143 | 0 | ||
369 | === removed file 'lib/Widgets/ContractorView.vala' | |||
370 | --- lib/Widgets/ContractorView.vala 2013-04-22 19:05:09 +0000 | |||
371 | +++ lib/Widgets/ContractorView.vala 1970-01-01 00:00:00 +0000 | |||
372 | @@ -1,217 +0,0 @@ | |||
373 | 1 | /*** | ||
374 | 2 | Copyright (C) 2011-2013 Tom Beckmann <tom@elementaryos.org> | ||
375 | 3 | |||
376 | 4 | This program or library is free software; you can redistribute it | ||
377 | 5 | and/or modify it under the terms of the GNU Lesser General Public | ||
378 | 6 | License as published by the Free Software Foundation; either | ||
379 | 7 | version 3 of the License, or (at your option) any later version. | ||
380 | 8 | |||
381 | 9 | This library is distributed in the hope that it will be useful, | ||
382 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
383 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
384 | 12 | Lesser General Public License for more details. | ||
385 | 13 | |||
386 | 14 | You should have received a copy of the GNU Lesser General | ||
387 | 15 | Public License along with this library; if not, write to the | ||
388 | 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
389 | 17 | Boston, MA 02110-1301 USA. | ||
390 | 18 | ***/ | ||
391 | 19 | |||
392 | 20 | using Gtk; | ||
393 | 21 | |||
394 | 22 | /** | ||
395 | 23 | * This class provides a simple way to look at contracts from Contractor | ||
396 | 24 | */ | ||
397 | 25 | [Deprecated (since = "0.2")] | ||
398 | 26 | public class Granite.Widgets.ContractorView : TreeView { | ||
399 | 27 | |||
400 | 28 | /** | ||
401 | 29 | * indicates if it was possible to connect to contractor | ||
402 | 30 | */ | ||
403 | 31 | public bool contractor_available; | ||
404 | 32 | |||
405 | 33 | public delegate void ContractCallback (); | ||
406 | 34 | private Gee.HashMap<int, DelegateWrapper?> outsiders; | ||
407 | 35 | private int[] blacklisted_pos; | ||
408 | 36 | private ListStore list; | ||
409 | 37 | |||
410 | 38 | private struct DelegateWrapper { unowned ContractCallback method; } | ||
411 | 39 | |||
412 | 40 | /** | ||
413 | 41 | * the index of the currently selected contract | ||
414 | 42 | */ | ||
415 | 43 | public int selected { | ||
416 | 44 | get { | ||
417 | 45 | TreePath path; | ||
418 | 46 | this.get_cursor (out path, null); | ||
419 | 47 | return int.parse (path.to_string ()); | ||
420 | 48 | } | ||
421 | 49 | set { | ||
422 | 50 | this.set_cursor (new TreePath.from_string (value.to_string ()), null, false); | ||
423 | 51 | } | ||
424 | 52 | } | ||
425 | 53 | |||
426 | 54 | /** | ||
427 | 55 | * A contract was launched using double clicking | ||
428 | 56 | */ | ||
429 | 57 | public signal void executed (); | ||
430 | 58 | |||
431 | 59 | /** | ||
432 | 60 | * the original array of contracts returned by contractor | ||
433 | 61 | */ | ||
434 | 62 | HashTable<string,string>[] contracts; | ||
435 | 63 | |||
436 | 64 | /** | ||
437 | 65 | * Create the default ContractorView | ||
438 | 66 | * | ||
439 | 67 | * @param filename the file | ||
440 | 68 | * @param mime the mimetype of the file | ||
441 | 69 | * @param icon_size the size of the icon in pixel | ||
442 | 70 | * @param show_contract_name show the name of the contract in the list | ||
443 | 71 | */ | ||
444 | 72 | public ContractorView (string filename, string mime, int icon_size = 32, bool show_contract_name = true) { | ||
445 | 73 | /* Setup the ListStore */ | ||
446 | 74 | list = new ListStore (2, typeof (Gdk.Pixbuf), typeof (string)); | ||
447 | 75 | outsiders = new Gee.HashMap<int, DelegateWrapper?> (); | ||
448 | 76 | this.model = list; | ||
449 | 77 | |||
450 | 78 | /* GUI */ | ||
451 | 79 | this.headers_visible = false; | ||
452 | 80 | this.hexpand = true; | ||
453 | 81 | |||
454 | 82 | /* Events */ | ||
455 | 83 | row_activated.connect (() => { | ||
456 | 84 | run_selected (); | ||
457 | 85 | executed (); | ||
458 | 86 | }); | ||
459 | 87 | |||
460 | 88 | /* View */ | ||
461 | 89 | var cell1 = new CellRendererPixbuf (); | ||
462 | 90 | cell1.set_padding (5, 8); | ||
463 | 91 | this.insert_column_with_attributes (-1, "", cell1, "pixbuf", 0); | ||
464 | 92 | var cell2 = new CellRendererText (); | ||
465 | 93 | cell2.set_padding (2, 8); | ||
466 | 94 | this.insert_column_with_attributes (-1, "", cell2, "markup", 1); | ||
467 | 95 | |||
468 | 96 | this.contracts = Granite.Services.Contractor.get_contract (filename, mime); | ||
469 | 97 | if (this.contracts == null || this.contracts.length == 0) { | ||
470 | 98 | warning ("You should install contractor (or no contracts found for this mime).\n"); | ||
471 | 99 | contractor_available = false; | ||
472 | 100 | TreeIter it; | ||
473 | 101 | list.append (out it); | ||
474 | 102 | bool contractor_installed = this.contracts == null; | ||
475 | 103 | string message = contractor_installed ? _("Could not contact Contractor. You may need to install it") : _("No action found for this file"); | ||
476 | 104 | try { | ||
477 | 105 | var icon = IconTheme.get_default ().load_icon ( | ||
478 | 106 | contractor_installed ? Gtk.Stock.DIALOG_ERROR : Gtk.Stock.DIALOG_INFO, | ||
479 | 107 | icon_size, 0); | ||
480 | 108 | list.set (it, | ||
481 | 109 | 0, icon, 1, message); | ||
482 | 110 | } | ||
483 | 111 | catch (Error e) { | ||
484 | 112 | warning("%s\n", e.message); | ||
485 | 113 | } | ||
486 | 114 | set_sensitive(false); | ||
487 | 115 | } | ||
488 | 116 | else { | ||
489 | 117 | contractor_available = true; | ||
490 | 118 | |||
491 | 119 | for (var i=0; i<this.contracts.length; i++){ | ||
492 | 120 | TreeIter it; | ||
493 | 121 | list.append (out it); | ||
494 | 122 | string text = this.contracts[i].lookup ("Description"); | ||
495 | 123 | if (show_contract_name) | ||
496 | 124 | text = "<b>"+this.contracts[i].lookup ("Name")+"</b>\n"+text; | ||
497 | 125 | try{ | ||
498 | 126 | list.set (it, | ||
499 | 127 | 0, IconTheme.get_default ().load_icon (this.contracts[i].lookup ("IconName"), | ||
500 | 128 | icon_size, 0), 1, text); | ||
501 | 129 | } | ||
502 | 130 | catch (Error e) { | ||
503 | 131 | warning (e.message); | ||
504 | 132 | } | ||
505 | 133 | } | ||
506 | 134 | this.selected = 0; | ||
507 | 135 | } | ||
508 | 136 | } | ||
509 | 137 | |||
510 | 138 | /** | ||
511 | 139 | * A method to add items to the tree | ||
512 | 140 | * | ||
513 | 141 | * @param name the name | ||
514 | 142 | * @param desc the description | ||
515 | 143 | * @param icon_name the name of the icon to show | ||
516 | 144 | * @param icon_size the size of the icon in pixel | ||
517 | 145 | * @param position the posion the item will be inserted at (first position is 0) | ||
518 | 146 | * @param method a general method containing all the methods that should be called when the item is activated | ||
519 | 147 | * (must return void and mustn't have any parameter) | ||
520 | 148 | */ | ||
521 | 149 | public void add_item (string name, string desc, string icon_name, int icon_size, int position, ContractCallback method) { | ||
522 | 150 | TreeIter it; | ||
523 | 151 | list.insert (out it, position); | ||
524 | 152 | |||
525 | 153 | string text = "<b>" + name + "</b>\n" + desc; | ||
526 | 154 | |||
527 | 155 | try{ | ||
528 | 156 | list.set (it, 0, IconTheme.get_default ().load_icon (icon_name, icon_size, 0), 1, text); | ||
529 | 157 | } catch (Error e) { | ||
530 | 158 | error (e.message); | ||
531 | 159 | } | ||
532 | 160 | |||
533 | 161 | DelegateWrapper wr = { method }; | ||
534 | 162 | outsiders[position] = wr; | ||
535 | 163 | |||
536 | 164 | this.selected = 0; | ||
537 | 165 | } | ||
538 | 166 | |||
539 | 167 | public void name_blacklist (string[] names) { | ||
540 | 168 | TreeIter it; | ||
541 | 169 | TreeIter it2; | ||
542 | 170 | Value value; | ||
543 | 171 | bool check; | ||
544 | 172 | int cur_pos = 0; | ||
545 | 173 | list.get_iter_first (out it); | ||
546 | 174 | list.get_iter_first (out it2); | ||
547 | 175 | |||
548 | 176 | while (true) { | ||
549 | 177 | list.get_value (it, 1, out value); | ||
550 | 178 | check = list.iter_next (ref it2); | ||
551 | 179 | string text = value.get_string (); | ||
552 | 180 | |||
553 | 181 | if (text[3:text.index_of ("</b>")] in names) { | ||
554 | 182 | list.remove (it); | ||
555 | 183 | blacklisted_pos += cur_pos; | ||
556 | 184 | } | ||
557 | 185 | if (!check) | ||
558 | 186 | break; | ||
559 | 187 | |||
560 | 188 | it = it2; | ||
561 | 189 | cur_pos++; | ||
562 | 190 | } | ||
563 | 191 | } | ||
564 | 192 | |||
565 | 193 | |||
566 | 194 | public void run_selected () { | ||
567 | 195 | if (this.selected in outsiders.keys ) { | ||
568 | 196 | outsiders[this.selected].method (); | ||
569 | 197 | } else { | ||
570 | 198 | try { | ||
571 | 199 | int corr = 0; | ||
572 | 200 | foreach (int i in outsiders.keys) { //adjust in case of items added | ||
573 | 201 | if (i > this.selected) | ||
574 | 202 | break; | ||
575 | 203 | corr++; | ||
576 | 204 | } | ||
577 | 205 | foreach (int i in blacklisted_pos) { //adjust in case of items removed | ||
578 | 206 | if (i > this.selected) | ||
579 | 207 | break; | ||
580 | 208 | corr--; | ||
581 | 209 | } | ||
582 | 210 | Process.spawn_command_line_async ( | ||
583 | 211 | this.contracts[this.selected-corr].lookup ("Exec")); | ||
584 | 212 | } catch (Error e) { | ||
585 | 213 | error (e.message); | ||
586 | 214 | } | ||
587 | 215 | } | ||
588 | 216 | } | ||
589 | 217 | } | ||
590 | 218 | 0 | ||
591 | === removed file 'lib/Widgets/SidebarPaned.vala' | |||
592 | --- lib/Widgets/SidebarPaned.vala 2013-03-21 12:23:37 +0000 | |||
593 | +++ lib/Widgets/SidebarPaned.vala 1970-01-01 00:00:00 +0000 | |||
594 | @@ -1,25 +0,0 @@ | |||
595 | 1 | /*** | ||
596 | 2 | Copyright (C) 2011-2013 Granite Developers | ||
597 | 3 | |||
598 | 4 | This program or library is free software; you can redistribute it | ||
599 | 5 | and/or modify it under the terms of the GNU Lesser General Public | ||
600 | 6 | License as published by the Free Software Foundation; either | ||
601 | 7 | version 3 of the License, or (at your option) any later version. | ||
602 | 8 | |||
603 | 9 | This library is distributed in the hope that it will be useful, | ||
604 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
605 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
606 | 12 | Lesser General Public License for more details. | ||
607 | 13 | |||
608 | 14 | You should have received a copy of the GNU Lesser General | ||
609 | 15 | Public License along with this library; if not, write to the | ||
610 | 16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
611 | 17 | Boston, MA 02110-1301 USA. | ||
612 | 18 | |||
613 | 19 | Authored by: Victor Eduardo <victoreduardm@gmail.com> | ||
614 | 20 | ***/ | ||
615 | 21 | |||
616 | 22 | [Deprecated (replacement = "Granite.Widgets.ThinPaned", since = "granite-0.2")] | ||
617 | 23 | public class Granite.Widgets.SidebarPaned : ThinPaned { | ||
618 | 24 | } | ||
619 | 25 |
why would you remove deprecated things? Deprecation warnings are a good idea, but breaking compilation for older code and third-party apps is not.
And soname bumps are generally painful, so I don't think deleting deprecated stuff justifies a soname bump.