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
=== modified file 'lib/CMakeLists.txt'
--- lib/CMakeLists.txt 2016-09-28 18:36:03 +0000
+++ lib/CMakeLists.txt 2016-09-28 19:24:35 +0000
@@ -38,12 +38,9 @@
38 Widgets/Toast.vala38 Widgets/Toast.vala
39 Widgets/ToolButtonWithMenu.vala39 Widgets/ToolButtonWithMenu.vala
40 Widgets/PopOver.vala40 Widgets/PopOver.vala
41 Widgets/ContractorView.vala
42 Widgets/ContractorMenu.vala
43 Widgets/DecoratedWindow.vala41 Widgets/DecoratedWindow.vala
44 Widgets/LightWindow.vala42 Widgets/LightWindow.vala
45 Widgets/StatusBar.vala43 Widgets/StatusBar.vala
46 Widgets/SidebarPaned.vala
47 Widgets/StorageBar.vala44 Widgets/StorageBar.vala
48 Widgets/SourceList.vala45 Widgets/SourceList.vala
49 Widgets/CellRendererExpander.vala46 Widgets/CellRendererExpander.vala
5047
=== removed file 'lib/Widgets/ContractorMenu.vala'
--- lib/Widgets/ContractorMenu.vala 2016-06-09 01:28:31 +0000
+++ lib/Widgets/ContractorMenu.vala 1970-01-01 00:00:00 +0000
@@ -1,144 +0,0 @@
1/*
2 * Copyright (C) 2012-2013 Andrea Basso <andrea@elementaryos.org>
3 *
4 * This program or library is free software; you can redistribute it
5 * and/or modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA.
18 */
19
20/**
21 * This class provides a simple menu for managing Contractor.
22 * It uses a long-obsolete and unused revision of Contractor API and will not
23 * work with stable releases of Contractor.
24 */
25[Version (deprecated = true, deprecated_since = "0.2", replacement = "")]
26public class Granite.Widgets.ContractorMenu : Gtk.Menu {
27 /**
28 * The Hashtable of available contracts
29 */
30 HashTable<string,string>[] contracts;
31 /**
32 * The Hashtable of executables
33 */
34 Gee.HashMap <string,string> execs;
35 public delegate void ContractCallback ();
36 private string filepath;
37 private string filemime;
38
39 /**
40 * Passes when contract is clicked
41 */
42 public signal void contract_activated (string contract_name);
43
44 /**
45 * Makes new Contractor Meu
46 *
47 * @param filename the filename of the file
48 * @param mime the mime-type of the file
49 */
50 public ContractorMenu (string filename, string mime) {
51 filepath = filename;
52 filemime = mime;
53 load_items (filename, mime);
54 }
55
56 /**
57 * Adds new item to Contractor Menu
58 *
59 * @param name name of menu item
60 * @param icon_name the desired icon for menu item
61 * @param position desired position of menu item
62 * @param method method to be called when menu item is clicked
63 * @param use_stock tells whether to use stock for menu item
64 */
65 public void add_item (string name, string icon_name, int position, ContractCallback method, bool use_stock = true) {
66 var item = new Gtk.ImageMenuItem ();
67 item.set_always_show_image (true);
68 item.set_use_stock (use_stock);
69 var image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.MENU);
70 item.set_label (name);
71 item.set_image (image);
72 item.activate.connect (()=> {
73 contract_activated (name);
74 method();
75 });
76 insert(item, position);
77 item.show ();
78 }
79
80 /**
81 * Deletes a group of menu items
82 *
83 * @param names of menu items to delete
84 */
85 public void name_blacklist (string[] names) {
86 this.foreach ((item)=> {
87 if (((Gtk.MenuItem)item).get_label () in names)
88 remove (item);
89 });
90 }
91
92 private void load_items (string filename, string mime) {
93 contracts = Granite.Services.Contractor.get_contract (filename, mime);
94 execs = new Gee.HashMap<string,string> ();
95
96 for (int i=0;i<contracts.length;i++) {
97 execs[contracts[i].lookup ("Name")] = contracts[i].lookup ("Exec");
98
99 var item = new Gtk.ImageMenuItem ();
100 item.set_always_show_image (true);
101 var image = new Gtk.Image.from_icon_name (contracts[i].lookup ("IconName"), Gtk.IconSize.MENU);
102 item.set_label (contracts[i].lookup ("Name"));
103 item.set_image (image);
104 item.activate.connect ( ()=> {
105 try {
106 Process.spawn_command_line_async (execs.get(item.get_label ()));
107 } catch (Error e) {
108 error (e.message);
109 }
110 });
111 append (item);
112 item.show_all ();
113 }
114 }
115
116 /**
117 * Updates Contractor menu items
118 *
119 * @param filename the filename of the file
120 * @param mime the mime-type of the file
121 */
122 public void update (string? filename, string? mime) {
123 this.foreach ((w) => {remove (w);});
124
125 string fn = "";
126 string mm = "";
127
128 if (filename != null) {
129 fn = filename;
130 filepath = filename;
131 } else {
132 fn = filepath;
133 }
134
135 if (mime != null) {
136 mm = mime;
137 filemime = mime;
138 } else {
139 mm = filemime;
140 }
141
142 load_items (fn, mm);
143 }
144}
1450
=== removed file 'lib/Widgets/ContractorView.vala'
--- lib/Widgets/ContractorView.vala 2016-06-09 01:28:31 +0000
+++ lib/Widgets/ContractorView.vala 1970-01-01 00:00:00 +0000
@@ -1,219 +0,0 @@
1/*
2 * Copyright (C) 2011-2013 Tom Beckmann <tom@elementaryos.org>
3 *
4 * This program or library is free software; you can redistribute it
5 * and/or modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA.
18 */
19
20using Gtk;
21
22/**
23 * This class provides a simple way to look at contracts from Contractor.
24 * It uses a long-obsolete and unused revision of Contractor API and will not
25 * work with stable releases of Contractor.
26 */
27[Version (deprecated = true, deprecated_since = "0.2", replacement = "")]
28public class Granite.Widgets.ContractorView : TreeView {
29
30 /**
31 * indicates if it was possible to connect to contractor
32 */
33 public bool contractor_available;
34
35 public delegate void ContractCallback ();
36 private Gee.HashMap<int, DelegateWrapper?> outsiders;
37 private int[] blacklisted_pos;
38 private Gtk.ListStore list;
39
40 private struct DelegateWrapper { unowned ContractCallback method; }
41
42 /**
43 * the index of the currently selected contract
44 */
45 public int selected {
46 get {
47 TreePath path;
48 this.get_cursor (out path, null);
49 return int.parse (path.to_string ());
50 }
51 set {
52 this.set_cursor (new TreePath.from_string (value.to_string ()), null, false);
53 }
54 }
55
56 /**
57 * A contract was launched using double clicking
58 */
59 public signal void executed ();
60
61 /**
62 * the original array of contracts returned by contractor
63 */
64 HashTable<string,string>[] contracts;
65
66 /**
67 * Create the default ContractorView
68 *
69 * @param filename the file
70 * @param mime the mimetype of the file
71 * @param icon_size the size of the icon in pixel
72 * @param show_contract_name show the name of the contract in the list
73 */
74 public ContractorView (string filename, string mime, int icon_size = 32, bool show_contract_name = true) {
75 /* Setup the ListStore */
76 list = new Gtk.ListStore (2, typeof (Gdk.Pixbuf), typeof (string));
77 outsiders = new Gee.HashMap<int, DelegateWrapper?> ();
78 this.model = list;
79
80 /* GUI */
81 this.headers_visible = false;
82 this.hexpand = true;
83
84 /* Events */
85 row_activated.connect (() => {
86 run_selected ();
87 executed ();
88 });
89
90 /* View */
91 var cell1 = new CellRendererPixbuf ();
92 cell1.set_padding (5, 8);
93 this.insert_column_with_attributes (-1, "", cell1, "pixbuf", 0);
94 var cell2 = new CellRendererText ();
95 cell2.set_padding (2, 8);
96 this.insert_column_with_attributes (-1, "", cell2, "markup", 1);
97
98 this.contracts = Granite.Services.Contractor.get_contract (filename, mime);
99 if (this.contracts == null || this.contracts.length == 0) {
100 warning ("You should install contractor (or no contracts found for this mime).\n");
101 contractor_available = false;
102 TreeIter it;
103 list.append (out it);
104 bool contractor_installed = this.contracts == null;
105 string message = contractor_installed ? _("Could not contact Contractor. You may need to install it") : _("No action found for this file");
106 try {
107 var icon = IconTheme.get_default ().load_icon (
108 contractor_installed ? "dialog-error" : "dialog-information",
109 icon_size, 0);
110 list.set (it,
111 0, icon, 1, message);
112 }
113 catch (Error e) {
114 warning("%s\n", e.message);
115 }
116 set_sensitive(false);
117 }
118 else {
119 contractor_available = true;
120
121 for (var i=0; i<this.contracts.length; i++){
122 TreeIter it;
123 list.append (out it);
124 string text = this.contracts[i].lookup ("Description");
125 if (show_contract_name)
126 text = "<b>"+this.contracts[i].lookup ("Name")+"</b>\n"+text;
127 try{
128 list.set (it,
129 0, IconTheme.get_default ().load_icon (this.contracts[i].lookup ("IconName"),
130 icon_size, 0), 1, text);
131 }
132 catch (Error e) {
133 warning (e.message);
134 }
135 }
136 this.selected = 0;
137 }
138 }
139
140 /**
141 * A method to add items to the tree
142 *
143 * @param name the name
144 * @param desc the description
145 * @param icon_name the name of the icon to show
146 * @param icon_size the size of the icon in pixel
147 * @param position the posion the item will be inserted at (first position is 0)
148 * @param method a general method containing all the methods that should be called when the item is activated
149 * (must return void and mustn't have any parameter)
150 */
151 public void add_item (string name, string desc, string icon_name, int icon_size, int position, ContractCallback method) {
152 TreeIter it;
153 list.insert (out it, position);
154
155 string text = "<b>" + name + "</b>\n" + desc;
156
157 try{
158 list.set (it, 0, IconTheme.get_default ().load_icon (icon_name, icon_size, 0), 1, text);
159 } catch (Error e) {
160 error (e.message);
161 }
162
163 DelegateWrapper wr = { method };
164 outsiders[position] = wr;
165
166 this.selected = 0;
167 }
168
169 public void name_blacklist (string[] names) {
170 TreeIter it;
171 TreeIter it2;
172 Value value;
173 bool check;
174 int cur_pos = 0;
175 list.get_iter_first (out it);
176 list.get_iter_first (out it2);
177
178 while (true) {
179 list.get_value (it, 1, out value);
180 check = list.iter_next (ref it2);
181 string text = value.get_string ();
182
183 if (text[3:text.index_of ("</b>")] in names) {
184 list.remove (it);
185 blacklisted_pos += cur_pos;
186 }
187 if (!check)
188 break;
189
190 it = it2;
191 cur_pos++;
192 }
193 }
194
195
196 public void run_selected () {
197 if (this.selected in outsiders.keys ) {
198 outsiders[this.selected].method ();
199 } else {
200 try {
201 int corr = 0;
202 foreach (int i in outsiders.keys) { //adjust in case of items added
203 if (i > this.selected)
204 break;
205 corr++;
206 }
207 foreach (int i in blacklisted_pos) { //adjust in case of items removed
208 if (i > this.selected)
209 break;
210 corr--;
211 }
212 Process.spawn_command_line_async (
213 this.contracts[this.selected-corr].lookup ("Exec"));
214 } catch (Error e) {
215 error (e.message);
216 }
217 }
218 }
219}
2200
=== removed file 'lib/Widgets/SidebarPaned.vala'
--- lib/Widgets/SidebarPaned.vala 2016-06-09 01:28:31 +0000
+++ lib/Widgets/SidebarPaned.vala 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 2011-2013 Granite Developers
3 *
4 * This program or library is free software; you can redistribute it
5 * and/or modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA.
18 *
19 * Authored by: Victor Eduardo <victoreduardm@gmail.com>
20 */
21
22[Version (deprecated = true, deprecated_since = "0.2", replacement = "Granite.Widgets.ThinPaned")]
23public class Granite.Widgets.SidebarPaned : ThinPaned {
24}
25

Subscribers

People subscribed via source and target branches