Merge lp:~elementary-apps/noise/no-using-gtk into lp:~elementary-apps/noise/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: Corentin Noël
Approved revision: 1591
Merged at revision: 1592
Proposed branch: lp:~elementary-apps/noise/no-using-gtk
Merge into: lp:~elementary-apps/noise/trunk
Diff against target: 231 lines (+64/-70)
1 file modified
src/Dialogs/NotImportedWindow.vala (+64/-70)
To merge this branch: bzr merge lp:~elementary-apps/noise/no-using-gtk
Reviewer Review Type Date Requested Status
Corentin Noël Approve
Review via email: mp+216965@code.launchpad.net

Commit message

* Gets rid of "using Gtk"
* Some other minor codestyle fixes

Description of the change

* Gets rid of "using Gtk"
* Some other minor codestyle fixes

To post a comment you must log in.
Revision history for this message
Corentin Noël (tintou) wrote :

It's all fine here !

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Dialogs/NotImportedWindow.vala'
2--- src/Dialogs/NotImportedWindow.vala 2014-04-20 17:15:24 +0000
3+++ src/Dialogs/NotImportedWindow.vala 2014-04-24 01:44:34 +0000
4@@ -23,9 +23,7 @@
5 /* Merely a place holder for multiple pieces of information regarding
6 * the current media playing. Mostly here because of dependence. */
7
8-using Gtk;
9-
10-public class Noise.NotImportedWindow : Window{
11+public class Noise.NotImportedWindow : Gtk.Window {
12 Gee.LinkedList<string> _files;
13 string music_folder;
14
15@@ -33,131 +31,127 @@
16 private Gtk.Box content;
17 private Gtk.Box padding;
18
19- CheckButton trashAll;
20- ScrolledWindow filesScroll;
21- TreeView filesView;
22- ListStore filesModel;
23- Button moveToTrash;
24+ Gtk.CheckButton trashAll;
25+ Gtk.ScrolledWindow filesScroll;
26+ Gtk.TreeView filesView;
27+ Gtk.ListStore filesModel;
28+ Gtk.Button moveToTrash;
29
30- public NotImportedWindow(Gee.Collection<string> files, string music) {
31+ public NotImportedWindow (Gee.Collection<string> files, string music) {
32 _files = new Gee.LinkedList<string> ();
33 _files.add_all (files);
34 this.music_folder = music;
35
36- this.set_title(_("Not Imported Files"));
37-
38- // set the size based on saved gconf settings
39- //this.window_position = WindowPosition.CENTER;
40 this.type_hint = Gdk.WindowTypeHint.DIALOG;
41 this.set_modal (true);
42 this.set_transient_for (App.main_window);
43 this.destroy_with_parent = true;
44
45- set_default_size(475, -1);
46+ set_default_size (475, -1);
47 resizable = false;
48
49 content = new Gtk.Box (Gtk.Orientation.VERTICAL, 10);
50 padding = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 20);
51
52 // initialize controls
53- var warning = new Image.from_icon_name ("dialog-error", Gtk.IconSize.DIALOG);
54- var title = new Label(_("Unable to import %d items from %s").printf (files.size, music_folder));
55- var info = new Label(_("%s was unable to import %d items. The files may be damaged.").printf (((Noise.App) GLib.Application.get_default ()).get_name (), files.size));
56- trashAll = new CheckButton.with_label(_("Move all corrupted files to trash"));
57- filesScroll = new ScrolledWindow(null, null);
58- filesView = new TreeView();
59- filesModel = new ListStore(2, typeof(bool), typeof(string));
60- filesView.set_model(filesModel);
61- moveToTrash = new Button.with_label(_("Move to Trash"));
62- Button okButton = new Button.with_label(_("Ignore"));
63+ var warning = new Gtk.Image.from_icon_name ("dialog-error", Gtk.IconSize.DIALOG);
64+ var title = new Gtk.Label (_("Unable to import %d items from %s").printf (files.size, music_folder));
65+ var info = new Gtk.Label (_("%s was unable to import %d items. The files may be damaged.").printf (((Noise.App) GLib.Application.get_default ()).get_name (), files.size));
66+ trashAll = new Gtk.CheckButton.with_label (_("Move all corrupted files to trash"));
67+ filesScroll = new Gtk.ScrolledWindow (null, null);
68+ filesView = new Gtk.TreeView ();
69+ filesModel = new Gtk.ListStore (2, typeof(bool), typeof(string));
70+ filesView.set_model (filesModel);
71+ moveToTrash = new Gtk.Button.with_label (_("Move to Trash"));
72+ Gtk.Button okButton = new Gtk.Button.with_label (_("Ignore"));
73
74 // pretty up labels
75 title.xalign = 0.0f;
76- title.set_markup("<span weight=\"bold\" size=\"larger\">" + Markup.escape_text (_("Unable to import %d items from %s").printf (files.size, music_folder), -1) + "</span>");
77+ title.set_markup ("<span weight=\"bold\" size=\"larger\">" + Markup.escape_text (_("Unable to import %d items from %s").printf (files.size, music_folder), -1) + "</span>");
78 info.xalign = 0.0f;
79- info.set_line_wrap(false);
80+ info.set_line_wrap (false);
81
82 /* add cellrenderers to columns and columns to treeview */
83- var toggle = new CellRendererToggle ();
84+ var toggle = new Gtk.CellRendererToggle ();
85 toggle.toggled.connect ((toggle, path) => {
86- var tree_path = new TreePath.from_string (path);
87- TreeIter iter;
88+ var tree_path = new Gtk.TreePath.from_string (path);
89+ Gtk.TreeIter iter;
90 filesModel.get_iter (out iter, tree_path);
91 filesModel.set (iter, 0, !toggle.active);
92
93- moveToTrash.set_sensitive(false);
94- filesModel.foreach(updateMoveToTrashSensetivity);
95+ moveToTrash.set_sensitive (false);
96+ filesModel.foreach (updateMoveToTrashSensetivity);
97 });
98
99- var column = new TreeViewColumn ();
100+ var column = new Gtk.TreeViewColumn ();
101 column.title = _("del");
102 column.pack_start (toggle, false);
103 column.add_attribute (toggle, "active", 0);
104 filesView.append_column (column);
105
106- filesView.insert_column_with_attributes(-1, _("File Location"), new CellRendererText(), "text", 1, null);
107+ filesView.insert_column_with_attributes (-1, _("File Location"), new Gtk.CellRendererText(), "text", 1, null);
108 filesView.headers_visible = false;
109
110 /* fill the treeview */
111- foreach(string file in files) {
112- TreeIter item;
113- filesModel.append(out item);
114+ foreach (string file in files) {
115+ Gtk.TreeIter item;
116+ filesModel.append (out item);
117
118- filesModel.set(item, 0, false, 1, file.replace(music_folder, ""));
119+ filesModel.set (item, 0, false, 1, file.replace (music_folder, ""));
120 }
121
122- filesScroll.add(filesView);
123- filesScroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC);
124+ filesScroll.add (filesView);
125+ filesScroll.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
126
127- moveToTrash.set_sensitive(false);
128+ moveToTrash.set_sensitive (false);
129
130 /* set up controls layout */
131- var information = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
132- var information_text = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
133- information.pack_start(warning, false, false, 10);
134- information_text.pack_start(title, false, true, 10);
135- information_text.pack_start(info, false, true, 0);
136- information.pack_start(information_text, true, true, 10);
137-
138- var listBox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
139- listBox.pack_start(filesScroll, true, true, 5);
140-
141- Expander exp = new Expander(_("Select individual files to move to trash:"));
142- exp.add(listBox);
143+ var information = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
144+ var information_text = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
145+ information.pack_start (warning, false, false, 10);
146+ information_text.pack_start (title, false, true, 10);
147+ information_text.pack_start (info, false, true, 0);
148+ information.pack_start (information_text, true, true, 10);
149+
150+ var listBox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
151+ listBox.pack_start (filesScroll, true, true, 5);
152+
153+ Gtk.Expander exp = new Gtk.Expander (_("Select individual files to move to trash:"));
154+ exp.add (listBox);
155 exp.expanded = false;
156
157 var bottomButtons = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL);
158- bottomButtons.set_layout(ButtonBoxStyle.END);
159- bottomButtons.pack_end(moveToTrash, false, false, 0);
160- bottomButtons.pack_end(okButton, false, false, 10);
161- bottomButtons.set_spacing(10);
162+ bottomButtons.set_layout (Gtk.ButtonBoxStyle.END);
163+ bottomButtons.pack_end (moveToTrash, false, false, 0);
164+ bottomButtons.pack_end (okButton, false, false, 10);
165+ bottomButtons.set_spacing (10);
166
167 content.pack_start(information, false, true, 0);
168 content.pack_start(UI.wrap_alignment (trashAll, 5, 0, 0, 75), false, true, 0);
169 content.pack_start(UI.wrap_alignment (exp, 0, 0, 0, 75), true, true, 0);
170 content.pack_start(bottomButtons, false, true, 10);
171
172- padding.pack_start(content, true, true, 10);
173+ padding.pack_start (content, true, true, 10);
174
175- moveToTrash.clicked.connect(moveToTrashClick);
176- trashAll.toggled.connect(trashAllToggled);
177- okButton.clicked.connect( () => { this.destroy(); });
178- exp.activate.connect( () => {
179- if(exp.get_expanded()) {
180+ moveToTrash.clicked.connect (moveToTrashClick);
181+ trashAll.toggled.connect (trashAllToggled);
182+ okButton.clicked.connect ( () => { this.destroy(); });
183+ exp.activate.connect ( () => {
184+ if (exp.get_expanded()) {
185 resizable = true;
186 set_size_request(475, 180);
187 resize(475, 180);
188 resizable = false;
189- }
190- else
191+ } else {
192 set_size_request(475, 350);
193+ }
194 });
195
196- add(padding);
197- show_all();
198+ add (padding);
199+ show_all ();
200 }
201
202- public bool updateMoveToTrashSensetivity(TreeModel model, TreePath path, TreeIter iter) {
203+ public bool updateMoveToTrashSensetivity(Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter) {
204 bool sel = false;
205 model.get(iter, 0, out sel);
206
207@@ -169,13 +163,13 @@
208 return false;
209 }
210
211- public bool selectAll(TreeModel model, TreePath path, TreeIter iter) {
212+ public bool selectAll(Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter) {
213 filesModel.set(iter, 0, true);
214
215 return false;
216 }
217
218- public bool unselectAll(TreeModel model, TreePath path, TreeIter iter) {
219+ public bool unselectAll(Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter) {
220 filesModel.set(iter, 0, false);
221
222 return false;
223@@ -193,7 +187,7 @@
224 }
225 }
226
227- public bool deleteSelectedItems(TreeModel model, TreePath path, TreeIter iter) {
228+ public bool deleteSelectedItems(Gtk.TreeModel model, Gtk.TreePath path, Gtk.TreeIter iter) {
229 bool selected;
230 string location;
231 filesModel.get(iter, 0, out selected);

Subscribers

People subscribed via source and target branches