Merge lp:~elementary-apps/granite/remove-deprecated-since-0.2 into lp:~elementary-pantheon/granite/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
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 :

Builds and otherwise LGTM.

review: Approve
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/ContractorView.vala
contents conflict in lib/Widgets/SidebarPaned.vala

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

Subscribers

People subscribed via source and target branches