Merge lp:~tintou/noise/gtk-3.10 into lp:~elementary-apps/noise/trunk
- gtk-3.10
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Victor Martinez |
Approved revision: | 1558 |
Merged at revision: | 1556 |
Proposed branch: | lp:~tintou/noise/gtk-3.10 |
Merge into: | lp:~elementary-apps/noise/trunk |
Diff against target: |
1165 lines (+270/-275) 13 files modified
CMakeLists.txt (+3/-3) src/CMakeLists.txt (+1/-1) src/Dialogs/EqualizerWindow.vala (+1/-2) src/Dialogs/MediaEditor.vala (+114/-120) src/Dialogs/PreferencesWindow.vala (+21/-15) src/Dialogs/RemoveFilesDialog.vala (+2/-2) src/Dialogs/SmartPlaylistEditor.vala (+4/-5) src/FileOperator.vala (+14/-10) src/LibraryWindow.vala (+37/-48) src/Noise.vala (+3/-3) src/Objects/LyricFetcher.vala (+0/-2) src/Widgets/EmbeddedAlert.vala (+1/-1) src/Widgets/TopDisplay.vala (+69/-63) |
To merge this branch: | bzr merge lp:~tintou/noise/gtk-3.10 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Victor Martinez (community) | Approve | ||
Cody Garver (community) | Needs Fixing | ||
Review via email: mp+204388@code.launchpad.net |
Commit message
Port to GTK+ 3.10
- Use Gtk.HeaderBar.
- Stop using deprecated code (Gtk.Stock, etc.)
Description of the change
Now using Gtk HeaderBar.
fixed some deprecation warnings.
fixed stock removal.
Cody Garver (codygarver) wrote : | # |
The "Cancel" button in the preferences is supposed to be "Close".
Corentin Noël (tintou) wrote : | # |
I've fixed everything, btw the modebutton in the preference dialog was already replaced
Victor Martinez (victored) wrote : | # |
This is looking good Corentin!
I'm afraid this branch is trying to do too much in a single merge. Besides the necessary CMake changes, the actual GTK-related changes start at diff line 4389.
Everything else is related to the removal of several "using" statements and the introduction of singletons (which really makes a lot of sense for the Settings classes). These changes could and should live on a separate branch.
Let's avoid cluttering the diff by updating the POT file after merging the actual code changes.
- 1557. By Corentin Noël
-
Corrected some code style
Corentin Noël (tintou) wrote : | # |
Updated the branch !
Victor Martinez (victored) wrote : | # |
Thanks!
The verbatim string changes in DataBaseManager
Regarding Gtk.Grid, let's just use "attach" when absolutely necessary. Whenever we use it as a replacement for Gtk.Box, using Gtk.Container.add is easier to read and maintain. We'd only set the desired orientation.
For instance, this:
+ content.attach (stack_switcher, 0, 0, 1, 1);
+ content.attach (stack, 0, 1, 1, 1);
+ content.attach (buttons, 0, 2, 1, 1);
... would become:
+ content.orientation = Gtk.Orientation
+ content.add (stack_switcher);
+ content.add (stack);
+ content.add (buttons);
I can't wait to see this merged! :)
- 1558. By Corentin Noël
-
Reverted some changes and fixed adding on container
Corentin Noël (tintou) wrote : | # |
Okay, I've reverted some changes and changed what you highlighted.
Victor Martinez (victored) wrote : | # |
Thanks again.
Looks good to go!
To be consistent with the rest of the code, after merging this branch please change diff line 493 to:
+ header.
because there's no need to translate the markup along with the string. Not a merge blocker though.
Victor Martinez (victored) wrote : | # |
edit:
+ header.
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2014-01-24 17:57:08 +0000 |
3 | +++ CMakeLists.txt 2014-02-07 15:39:13 +0000 |
4 | @@ -72,7 +72,7 @@ |
5 | gee-0.8 |
6 | libpeas-1.0 |
7 | libpeas-gtk-1.0 |
8 | - gtk+-3.0>=3.4.2 |
9 | + gtk+-3.0>=3.10 |
10 | granite |
11 | gstreamer-1.0 |
12 | gstreamer-tag-1.0 |
13 | @@ -148,7 +148,7 @@ |
14 | |
15 | find_package (Vala REQUIRED) |
16 | include (ValaVersion) |
17 | -ensure_vala_version ("0.18.0" MINIMUM) |
18 | +ensure_vala_version ("0.22.0" MINIMUM) |
19 | include (ValaPrecompile) |
20 | |
21 | set (DEPS_LIBRARIES ${DEPS_LIBRARIES} -lm) |
22 | @@ -163,4 +163,4 @@ |
23 | add_subdirectory (plugins) |
24 | add_subdirectory (po) |
25 | add_subdirectory (data) |
26 | -add_subdirectory (images) |
27 | +add_subdirectory (images) |
28 | \ No newline at end of file |
29 | |
30 | === modified file 'src/CMakeLists.txt' |
31 | --- src/CMakeLists.txt 2013-12-19 21:56:54 +0000 |
32 | +++ src/CMakeLists.txt 2014-02-07 15:39:13 +0000 |
33 | @@ -115,4 +115,4 @@ |
34 | |
35 | target_link_libraries (${EXEC_NAME} ${DEPS_LIBRARIES}) |
36 | |
37 | -install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION bin) |
38 | +install (TARGETS ${EXEC_NAME} RUNTIME DESTINATION bin) |
39 | \ No newline at end of file |
40 | |
41 | === modified file 'src/Dialogs/EqualizerWindow.vala' |
42 | --- src/Dialogs/EqualizerWindow.vala 2013-12-06 12:01:00 +0000 |
43 | +++ src/Dialogs/EqualizerWindow.vala 2014-02-07 15:39:13 +0000 |
44 | @@ -148,7 +148,7 @@ |
45 | var space_item = new ToolItem(); |
46 | space_item.set_expand(true); |
47 | |
48 | - close_button = new Button.from_stock ("window-close"); |
49 | + close_button = new Button.with_label (_("Close")); |
50 | var close_button_item = new ToolItem(); |
51 | close_button.set_size_request(120, -1); |
52 | close_button_item.set_expand(false); |
53 | @@ -454,4 +454,3 @@ |
54 | equalizer_settings.auto_switch_preset = preset_combo.automatic_chosen; |
55 | } |
56 | } |
57 | - |
58 | |
59 | === modified file 'src/Dialogs/MediaEditor.vala' |
60 | --- src/Dialogs/MediaEditor.vala 2013-12-02 07:25:17 +0000 |
61 | +++ src/Dialogs/MediaEditor.vala 2014-02-07 15:39:13 +0000 |
62 | @@ -29,10 +29,6 @@ |
63 | * Corentin Noël <tintou@mailoo.org> |
64 | */ |
65 | |
66 | -using Gtk; |
67 | -using Gee; |
68 | -using Granite; |
69 | - |
70 | /** |
71 | * TODO: make this dialog edit and handle Media objects and not media rowids. |
72 | * We need this in order to allow editing temporary tracks (such as Audio |
73 | @@ -42,29 +38,29 @@ |
74 | #if USE_GRANITE_DECORATED_WINDOW |
75 | public class Noise.MediaEditor : Granite.Widgets.LightWindow { |
76 | #else |
77 | -public class Noise.MediaEditor : Window { |
78 | +public class Noise.MediaEditor : Gtk.Window { |
79 | #endif |
80 | LyricFetcher lf; |
81 | |
82 | - LinkedList<int> _allMedias; |
83 | - LinkedList<int> _medias; |
84 | + Gee.LinkedList<int> _allMedias; |
85 | + Gee.LinkedList<int> _medias; |
86 | |
87 | //for padding around notebook mostly |
88 | - Granite.Widgets.StaticNotebook notebook; |
89 | + Gtk.Stack stack; |
90 | |
91 | - private HashMap<string, FieldEditor> fields;// a hashmap with each property and corresponding editor |
92 | - private TextView lyricsText; |
93 | - |
94 | - private Button _save; |
95 | - |
96 | - private Label lyricsInfobarLabel; |
97 | + private Gee.HashMap<string, FieldEditor> fields;// a hashmap with each property and corresponding editor |
98 | + private Gtk.TextView lyricsText; |
99 | + |
100 | + private Gtk.Button _save; |
101 | + |
102 | + private Gtk.Label lyricsInfobarLabel; |
103 | private Library library; |
104 | |
105 | - public signal void medias_saved(LinkedList<int> medias); |
106 | + public signal void medias_saved (Gee.LinkedList<int> medias); |
107 | |
108 | - public MediaEditor(LinkedList<int> allMedias, LinkedList<int> medias, Library library) { |
109 | + public MediaEditor (Gee.LinkedList<int> allMedias, Gee.LinkedList<int> medias, Library library) { |
110 | this.library = library; |
111 | - this.window_position = WindowPosition.CENTER; |
112 | + this.window_position = Gtk.WindowPosition.CENTER; |
113 | this.type_hint = Gdk.WindowTypeHint.DIALOG; |
114 | this.set_modal(false); |
115 | this.set_transient_for(App.main_window); |
116 | @@ -78,49 +74,47 @@ |
117 | _allMedias = allMedias; |
118 | _medias = medias; |
119 | |
120 | - // don't show notebook separator when using a decorated window |
121 | - #if USE_GRANITE_DECORATED_WINDOW |
122 | - notebook = new Granite.Widgets.StaticNotebook (false); |
123 | - #else |
124 | - notebook = new Granite.Widgets.StaticNotebook (); |
125 | - #endif |
126 | + stack = new Gtk.Stack (); |
127 | + var stack_switcher = new Gtk.StackSwitcher (); |
128 | + stack_switcher.set_stack (stack); |
129 | + stack_switcher.halign = Gtk.Align.CENTER; |
130 | |
131 | - notebook.append_page(createBasicContent (), new Label(_("Metadata"))); |
132 | + stack.add_titled (createBasicContent (), "metadata", _("Metadata")); |
133 | if(_medias.size == 1) |
134 | - notebook.append_page(createLyricsContent (), new Label(_("Lyrics"))); |
135 | + stack.add_titled (createLyricsContent (), "lyrics", _("Lyrics")); |
136 | else |
137 | lyricsText = null; |
138 | - |
139 | - var buttons = new Gtk.ButtonBox (Orientation.HORIZONTAL); |
140 | - buttons.set_layout (Gtk.ButtonBoxStyle.END); |
141 | |
142 | var arrows = new Granite.Widgets.NavigationArrows (); |
143 | |
144 | - _save = new Button.from_stock ("document-save"); |
145 | + _save = new Gtk.Button.with_label (_(STRING_SAVE)); |
146 | _save.set_size_request (85, -1); |
147 | |
148 | _save.valign = arrows.valign = Gtk.Align.END; |
149 | |
150 | + var buttons = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL); |
151 | + buttons.margin_top = 12; |
152 | + buttons.set_layout (Gtk.ButtonBoxStyle.END); |
153 | + |
154 | buttons.pack_start (arrows, false, false, 0); |
155 | buttons.pack_end (_save, false, false, 0); |
156 | |
157 | buttons.set_child_secondary (arrows, true); |
158 | |
159 | - var content = new Gtk.Box (Orientation.VERTICAL, 0); |
160 | - |
161 | - buttons.margin_top = 12; |
162 | - |
163 | - content.pack_start (notebook, true, true, 0); |
164 | - content.pack_start (buttons, false, true, 0); |
165 | - |
166 | + var content = new Gtk.Grid (); |
167 | + content.orientation = Gtk.Orientation.VERTICAL; |
168 | content.margin = 12; |
169 | |
170 | + content.add (stack_switcher); |
171 | + content.add (stack); |
172 | + content.add (buttons); |
173 | + |
174 | this.add (content); |
175 | - |
176 | + |
177 | this.show_all(); |
178 | - |
179 | + |
180 | arrows.sensitive = allMedias.size > 1; |
181 | - |
182 | + |
183 | if(_medias.size == 1) { |
184 | foreach(FieldEditor fe in fields.values) |
185 | fe.set_check_visible(false); |
186 | @@ -134,7 +128,7 @@ |
187 | } |
188 | |
189 | public Gtk.Box createBasicContent () { |
190 | - fields = new HashMap<string, FieldEditor>(); |
191 | + fields = new Gee.HashMap<string, FieldEditor>(); |
192 | Media sum = library.media_from_id(_medias.get(0)).copy(); |
193 | |
194 | /** find what these media have what common, and keep those values **/ |
195 | @@ -194,26 +188,26 @@ |
196 | if(sum.year == -1) |
197 | sum.year = Time().year; |
198 | |
199 | - fields.set("Title", new FieldEditor(_("Title"), sum.title, new Entry())); |
200 | - fields.set("Artist", new FieldEditor(_("Artist"), sum.artist, new Entry())); |
201 | - fields.set("Album Artist", new FieldEditor(_("Album Artist"), sum.album_artist, new Entry())); |
202 | - fields.set("Album", new FieldEditor(_("Album"), sum.album, new Entry())); |
203 | - fields.set("Genre", new FieldEditor(_("Genre"), sum.genre, new Entry())); |
204 | - fields.set("Composer", new FieldEditor(_("Composer"), sum.composer, new Entry())); |
205 | - fields.set("Grouping", new FieldEditor(_("Grouping"), sum.grouping, new Entry())); |
206 | - fields.set("Comment", new FieldEditor(_("Comment"), sum.comment, new TextView())); |
207 | - fields.set("Track", new FieldEditor(_("Track"), sum.track.to_string(), new SpinButton.with_range(0, 500, 1))); |
208 | - fields.set("Disc", new FieldEditor(_("Disc"), sum.album_number.to_string(), new SpinButton.with_range(0, 500, 1))); |
209 | - fields.set("Year", new FieldEditor(_("Year"), sum.year.to_string(), new SpinButton.with_range(0, 9999, 1))); |
210 | - fields.set("Rating", new FieldEditor(_("Rating"), sum.rating.to_string(), new Granite.Widgets.Rating(false, IconSize.MENU))); |
211 | + fields.set("Title", new FieldEditor(_("Title"), sum.title, new Gtk.Entry())); |
212 | + fields.set("Artist", new FieldEditor(_("Artist"), sum.artist, new Gtk.Entry())); |
213 | + fields.set("Album Artist", new FieldEditor(_("Album Artist"), sum.album_artist, new Gtk.Entry())); |
214 | + fields.set("Album", new FieldEditor(_("Album"), sum.album, new Gtk.Entry())); |
215 | + fields.set("Genre", new FieldEditor(_("Genre"), sum.genre, new Gtk.Entry())); |
216 | + fields.set("Composer", new FieldEditor(_("Composer"), sum.composer, new Gtk.Entry())); |
217 | + fields.set("Grouping", new FieldEditor(_("Grouping"), sum.grouping, new Gtk.Entry())); |
218 | + fields.set("Comment", new FieldEditor(_("Comment"), sum.comment, new Gtk.TextView())); |
219 | + fields.set("Track", new FieldEditor(_("Track"), sum.track.to_string(), new Gtk.SpinButton.with_range(0, 500, 1))); |
220 | + fields.set("Disc", new FieldEditor(_("Disc"), sum.album_number.to_string(), new Gtk.SpinButton.with_range(0, 500, 1))); |
221 | + fields.set("Year", new FieldEditor(_("Year"), sum.year.to_string(), new Gtk.SpinButton.with_range(0, 9999, 1))); |
222 | + fields.set("Rating", new FieldEditor(_("Rating"), sum.rating.to_string(), new Granite.Widgets.Rating(false, Gtk.IconSize.MENU))); |
223 | #if HAVE_PODCASTS && HAVE_INTERNET_RADIO |
224 | - fields.set("Media Type", new FieldEditor(_("Media Type"), sum.mediatype.to_string(), new ComboBoxText())); |
225 | + fields.set("Media Type", new FieldEditor(_("Media Type"), sum.mediatype.to_string(), new Gtk.ComboBoxText())); |
226 | #endif |
227 | |
228 | - var vert = new Box (Orientation.VERTICAL, 0); // separates editors with buttons and other stuff |
229 | - var horiz = new Box (Orientation.HORIZONTAL, 0); // separates text with numerical editors |
230 | - var textVert = new Box (Orientation.VERTICAL, 0); // separates text editors |
231 | - var numerVert = new Box (Orientation.VERTICAL, 0); // separates numerical editors |
232 | + var vert = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); // separates editors with buttons and other stuff |
233 | + var horiz = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); // separates text with numerical editors |
234 | + var textVert = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); // separates text editors |
235 | + var numerVert = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); // separates numerical editors |
236 | |
237 | textVert.pack_start(fields.get("Title"), false, true, 0); |
238 | textVert.pack_start(fields.get("Artist"), false, true, 5); |
239 | @@ -242,21 +236,21 @@ |
240 | } |
241 | |
242 | public Gtk.Box createLyricsContent () { |
243 | - var lyricsContent = new Gtk.Box (Orientation.VERTICAL, 10); |
244 | - |
245 | - lyricsInfobarLabel = new Label(""); |
246 | - |
247 | - lyricsInfobarLabel.set_justify(Justification.LEFT); |
248 | + var lyricsContent = new Gtk.Box (Gtk.Orientation.VERTICAL, 10); |
249 | + |
250 | + lyricsInfobarLabel = new Gtk.Label(""); |
251 | + |
252 | + lyricsInfobarLabel.set_justify(Gtk.Justification.LEFT); |
253 | lyricsInfobarLabel.set_single_line_mode(true); |
254 | lyricsInfobarLabel.ellipsize = Pango.EllipsizeMode.END; |
255 | |
256 | |
257 | - lyricsText = new TextView(); |
258 | - lyricsText.set_wrap_mode(WrapMode.WORD_CHAR); |
259 | + lyricsText = new Gtk.TextView(); |
260 | + lyricsText.set_wrap_mode(Gtk.WrapMode.WORD_CHAR); |
261 | lyricsText.get_buffer().text = library.media_from_id(_medias.get(0)).lyrics; |
262 | |
263 | - var text_scroll = new ScrolledWindow(null, null); |
264 | - text_scroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC); |
265 | + var text_scroll = new Gtk.ScrolledWindow(null, null); |
266 | + text_scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC); |
267 | |
268 | text_scroll.add(lyricsText); |
269 | |
270 | @@ -288,20 +282,20 @@ |
271 | |
272 | |
273 | public void lyricsFetched (Media m) { |
274 | - Gdk.threads_enter (); |
275 | - |
276 | - lyricsInfobarLabel.set_text (""); |
277 | - lyricsInfobarLabel.hide(); |
278 | - |
279 | - if (!String.is_white_space (m.lyrics)) { |
280 | - lyricsText.get_buffer().text = m.lyrics; |
281 | - } |
282 | - else { |
283 | - lyricsInfobarLabel.show_all(); |
284 | - lyricsInfobarLabel.set_markup (_("Lyrics not found for %s").printf ("<i>" + String.escape (m.title) + "</i>")); |
285 | - } |
286 | - |
287 | - Gdk.threads_leave (); |
288 | + Idle.add ( () => { |
289 | + |
290 | + lyricsInfobarLabel.set_text (""); |
291 | + lyricsInfobarLabel.hide(); |
292 | + |
293 | + if (!String.is_white_space (m.lyrics)) { |
294 | + lyricsText.get_buffer().text = m.lyrics; |
295 | + } |
296 | + else { |
297 | + lyricsInfobarLabel.show_all(); |
298 | + lyricsInfobarLabel.set_markup (_("Lyrics not found for %s").printf ("<i>" + String.escape (m.title) + "</i>")); |
299 | + } |
300 | + return false; |
301 | + }); |
302 | } |
303 | |
304 | |
305 | @@ -318,7 +312,7 @@ |
306 | i = _allMedias.get(indexOfCurrentFirst - 1); |
307 | |
308 | // now fetch the previous media on current_view |
309 | - var newMedias = new LinkedList<int>(); |
310 | + var newMedias = new Gee.LinkedList<int>(); |
311 | newMedias.add(i); |
312 | |
313 | change_media(newMedias); |
314 | @@ -336,13 +330,13 @@ |
315 | else |
316 | i = _allMedias.get(indexOfCurrentLast + 1); |
317 | |
318 | - var newMedias = new LinkedList<int>(); |
319 | + var newMedias = new Gee.LinkedList<int>(); |
320 | newMedias.add(i); |
321 | |
322 | change_media(newMedias); |
323 | } |
324 | |
325 | - public void change_media(LinkedList<int> newMedias) { |
326 | + public void change_media(Gee.LinkedList<int> newMedias) { |
327 | _medias = newMedias; |
328 | |
329 | Media sum = library.media_from_id(newMedias.get(0)); |
330 | @@ -379,7 +373,7 @@ |
331 | #endif |
332 | if(lyricsText == null) { |
333 | var lyrics = createLyricsContent (); |
334 | - notebook.append_page(lyrics, new Label(_("Lyrics"))); |
335 | + stack.add_titled (lyrics, "lyrics", _("Lyrics")); |
336 | lyrics.show_all(); |
337 | } |
338 | |
339 | @@ -441,35 +435,35 @@ |
340 | } |
341 | } |
342 | |
343 | -public class Noise.FieldEditor : Box { |
344 | +public class Noise.FieldEditor : Gtk.Box { |
345 | private string _name; |
346 | private string _original; |
347 | |
348 | private Gtk.Box nameBox; |
349 | |
350 | - private CheckButton check; |
351 | - private Label label; |
352 | - private Entry entry; |
353 | - private TextView textView; |
354 | - private SpinButton spinButton; |
355 | + private Gtk.CheckButton check; |
356 | + private Gtk.Label label; |
357 | + private Gtk.Entry entry; |
358 | + private Gtk.TextView textView; |
359 | + private Gtk.SpinButton spinButton; |
360 | private Granite.Widgets.Rating ratingWidget; |
361 | - private Image image; |
362 | + private Gtk.Image image; |
363 | #if HAVE_PODCASTS && HAVE_INTERNET_RADIO |
364 | - private ComboBoxText comboBox; |
365 | + private Gtk.ComboBoxText comboBox; |
366 | #endif |
367 | //private DoubleSpinButton doubleSpinButton; |
368 | |
369 | - public FieldEditor(string name, string original, Widget w) { |
370 | + public FieldEditor(string name, string original, Gtk.Widget w) { |
371 | _name = name; |
372 | _original = original; |
373 | set_orientation (Gtk.Orientation.VERTICAL); |
374 | this.spacing = 0; |
375 | |
376 | - check = new CheckButton(); |
377 | - label = new Label(_name); |
378 | + check = new Gtk.CheckButton(); |
379 | + label = new Gtk.Label(_name); |
380 | nameBox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); |
381 | |
382 | - label.justify = Justification.LEFT; |
383 | + label.justify = Gtk.Justification.LEFT; |
384 | label.xalign = 0.0f; |
385 | label.set_markup("<b>" + _name + "</b>"); |
386 | |
387 | @@ -478,10 +472,10 @@ |
388 | |
389 | this.pack_start(nameBox, false, false, 0); |
390 | |
391 | - if(w is Entry && !(w is SpinButton)) { |
392 | + if(w is Gtk.Entry && !(w is Gtk.SpinButton)) { |
393 | check.set_active(original != ""); |
394 | |
395 | - entry = (Entry)w; |
396 | + entry = (Gtk.Entry)w; |
397 | if(name != _("Genre") && name != _("Grouping")) |
398 | entry.set_size_request(300, -1); |
399 | else |
400 | @@ -491,16 +485,16 @@ |
401 | entry.changed.connect(entryChanged); |
402 | this.pack_start(entry, true, true, 0); |
403 | } |
404 | - else if(w is TextView) { |
405 | + else if(w is Gtk.TextView) { |
406 | check.set_active(original != ""); |
407 | |
408 | - textView = (TextView)w; |
409 | + textView = (Gtk.TextView)w; |
410 | textView.set_size_request(300, 90); |
411 | - textView.set_wrap_mode(WrapMode.WORD_CHAR); |
412 | + textView.set_wrap_mode(Gtk.WrapMode.WORD_CHAR); |
413 | textView.get_buffer().text = original; |
414 | |
415 | - ScrolledWindow scroll = new ScrolledWindow(null, null); |
416 | - scroll.set_policy(PolicyType.NEVER, PolicyType.AUTOMATIC); |
417 | + var scroll = new Gtk.ScrolledWindow(null, null); |
418 | + scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); |
419 | |
420 | scroll.add(textView); |
421 | |
422 | @@ -509,19 +503,19 @@ |
423 | textView.buffer.changed.connect(textViewChanged); |
424 | this.pack_start(scroll, true, true, 0); |
425 | } |
426 | - else if(w is SpinButton) { |
427 | + else if(w is Gtk.SpinButton) { |
428 | check.set_active(original != "0"); |
429 | |
430 | - spinButton = (SpinButton)w; |
431 | + spinButton = (Gtk.SpinButton)w; |
432 | spinButton.set_size_request(100, -1); |
433 | spinButton.value = check.get_active() ? double.parse(original) : 0.0; |
434 | spinButton.adjustment.value_changed.connect(spinButtonChanged); |
435 | this.pack_start(spinButton, true, true, 0); |
436 | } |
437 | - else if(w is Image) { |
438 | + else if(w is Gtk.Image) { |
439 | check.set_active(original != ""); |
440 | |
441 | - image = (Image)w; |
442 | + image = (Gtk.Image)w; |
443 | image.set_size_request(100, 100); |
444 | image.set_from_file(original); |
445 | //callback on file dialogue saved. setup here |
446 | @@ -537,10 +531,10 @@ |
447 | this.pack_start(ratingWidget, true, true, 0); |
448 | } |
449 | #if HAVE_PODCASTS && HAVE_INTERNET_RADIO |
450 | - else if(w is ComboBoxText) { |
451 | + else if(w is Gtk.ComboBoxText) { |
452 | check.set_active(original != "0"); |
453 | |
454 | - comboBox = (ComboBoxText)w; |
455 | + comboBox = (Gtk.ComboBoxText)w; |
456 | comboBox.append_text(_("Song")); |
457 | #if HAVE_PODCASTS |
458 | comboBox.append_text(_("Podcast")); |
459 | @@ -669,14 +663,14 @@ |
460 | } |
461 | } |
462 | |
463 | -public class Noise.StatsDisplay : Box { |
464 | +public class Noise.StatsDisplay : Gtk.Box { |
465 | public int plays; |
466 | public int skips; |
467 | public int last_played; |
468 | |
469 | - Label header; |
470 | - Label info; |
471 | - Button reset; |
472 | + Gtk.Label header; |
473 | + Gtk.Label info; |
474 | + Gtk.Button reset; |
475 | |
476 | public StatsDisplay(int plays, int skips, int last_played) { |
477 | this.plays = plays; |
478 | @@ -684,15 +678,15 @@ |
479 | this.last_played = last_played; |
480 | set_orientation (Gtk.Orientation.VERTICAL); |
481 | |
482 | - header = new Label(""); |
483 | - info = new Label(""); |
484 | - reset = new Button.with_label("Reset"); |
485 | + header = new Gtk.Label(""); |
486 | + info = new Gtk.Label(""); |
487 | + reset = new Gtk.Button.with_label(_("Reset")); |
488 | |
489 | - header.justify = Justification.LEFT; |
490 | + header.justify = Gtk.Justification.LEFT; |
491 | header.xalign = 0.0f; |
492 | - header.set_markup("<b>Stats</b>"); |
493 | + header.set_markup(_("<b>Stats</b>")); |
494 | |
495 | - info.justify = Justification.LEFT; |
496 | + info.justify = Gtk.Justification.LEFT; |
497 | info.xalign = 0.0f; |
498 | |
499 | setInfoText(); |
500 | @@ -746,4 +740,4 @@ |
501 | public double getVal2() { |
502 | return spin2.get_value(); |
503 | } |
504 | -}*/ |
505 | +}*/ |
506 | \ No newline at end of file |
507 | |
508 | === modified file 'src/Dialogs/PreferencesWindow.vala' |
509 | --- src/Dialogs/PreferencesWindow.vala 2013-12-07 02:16:17 +0000 |
510 | +++ src/Dialogs/PreferencesWindow.vala 2014-02-07 15:39:13 +0000 |
511 | @@ -31,9 +31,12 @@ |
512 | public const int MIN_WIDTH = 420; |
513 | public const int MIN_HEIGHT = 300; |
514 | |
515 | + public Gtk.FileChooserButton library_filechooser; |
516 | + |
517 | private Gee.Map<int, unowned Noise.SettingsWindow.NoteBook_Page> sections = new Gee.HashMap<int, unowned Noise.SettingsWindow.NoteBook_Page> (); |
518 | - private Granite.Widgets.StaticNotebook main_static_notebook; |
519 | - public Gtk.FileChooserButton library_filechooser; |
520 | + private Gtk.Stack main_stack; |
521 | + private Gtk.StackSwitcher main_stackswitcher; |
522 | + private int index = 0; |
523 | |
524 | public PreferencesWindow (LibraryWindow lw) { |
525 | build_ui (lw); |
526 | @@ -59,11 +62,9 @@ |
527 | return_val_if_fail (section != null, -1); |
528 | |
529 | // Pack the section |
530 | - // TODO: file a bug against granite's static notebook: append_page() |
531 | - // should return the index of the new page. |
532 | - main_static_notebook.append_page (section, new Gtk.Label (section.name)); |
533 | - int index = sections.size; |
534 | + main_stack.add_titled (section, "%d".printf (index), section.name); |
535 | sections.set (index, section); |
536 | + index++; |
537 | |
538 | section.show_all (); |
539 | |
540 | @@ -72,7 +73,8 @@ |
541 | |
542 | |
543 | public void remove_section (int index) { |
544 | - main_static_notebook.remove_page (index); |
545 | + var section = sections.get (index); |
546 | + section.destroy (); |
547 | sections.unset (index); |
548 | } |
549 | |
550 | @@ -86,13 +88,17 @@ |
551 | window_position = Gtk.WindowPosition.CENTER; |
552 | type_hint = Gdk.WindowTypeHint.DIALOG; |
553 | transient_for = parent_window; |
554 | - |
555 | - main_static_notebook = new Granite.Widgets.StaticNotebook (false); |
556 | - main_static_notebook.hexpand = true; |
557 | - main_static_notebook.margin_bottom = 24; |
558 | - |
559 | - ((Gtk.Box)get_content_area()).add (main_static_notebook); |
560 | - add_button ("window-close", Gtk.ResponseType.ACCEPT); |
561 | + var main_grid = new Gtk.Grid (); |
562 | + main_stack = new Gtk.Stack (); |
563 | + main_stackswitcher = new Gtk.StackSwitcher (); |
564 | + main_stackswitcher.set_stack (main_stack); |
565 | + main_stackswitcher.halign = Gtk.Align.CENTER; |
566 | + main_grid.attach (main_stackswitcher, 0, 0, 1, 1); |
567 | + main_grid.attach (main_stack, 0, 1, 1, 1); |
568 | + main_grid.hexpand = true; |
569 | + |
570 | + ((Gtk.Box)get_content_area()).add (main_grid); |
571 | + add_button (_("Close"), Gtk.ResponseType.ACCEPT); |
572 | } |
573 | } |
574 | |
575 | @@ -163,4 +169,4 @@ |
576 | page.add_option (new Gtk.Label (hide_on_close_desc), hide_on_close_switch, ref row); |
577 | |
578 | } |
579 | -} |
580 | +} |
581 | \ No newline at end of file |
582 | |
583 | === modified file 'src/Dialogs/RemoveFilesDialog.vala' |
584 | --- src/Dialogs/RemoveFilesDialog.vala 2013-12-06 12:01:00 +0000 |
585 | +++ src/Dialogs/RemoveFilesDialog.vala 2014-02-07 15:39:13 +0000 |
586 | @@ -55,7 +55,7 @@ |
587 | Label info = new Label(""); |
588 | trash_button = new Button.with_label (_("Move to Trash")); |
589 | remove_button = new Button.with_label (_("Remove from %s").printf (app_name)); |
590 | - cancel_button = new Button.with_label (_("Cancel")); |
591 | + cancel_button = new Button.with_label (_(STRING_CANCEL)); |
592 | |
593 | bool multiple_media = to_remove.size > 1; |
594 | |
595 | @@ -131,4 +131,4 @@ |
596 | add(padding); |
597 | show_all(); |
598 | } |
599 | -} |
600 | +} |
601 | \ No newline at end of file |
602 | |
603 | === modified file 'src/Dialogs/SmartPlaylistEditor.vala' |
604 | --- src/Dialogs/SmartPlaylistEditor.vala 2013-12-02 07:25:17 +0000 |
605 | +++ src/Dialogs/SmartPlaylistEditor.vala 2014-02-07 15:39:13 +0000 |
606 | @@ -87,7 +87,7 @@ |
607 | queries_grid.column_spacing = 12; |
608 | queries_grid.expand = true; |
609 | |
610 | - add_button = new Gtk.Button.from_stock ("list-add"); |
611 | + add_button = new Gtk.Button.with_label (_("Add")); |
612 | |
613 | /* create extra option: limiter */ |
614 | var limiter_grid = new Gtk.Grid (); |
615 | @@ -113,8 +113,8 @@ |
616 | /* add the Save button on bottom */ |
617 | var button_box = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL); |
618 | button_box.spacing = 6; |
619 | - save_button = new Gtk.Button.from_stock ("document-save"); |
620 | - var close_button = new Gtk.Button.from_stock ("dialog-cancel"); |
621 | + save_button = new Gtk.Button.with_label (_(STRING_SAVE)); |
622 | + var close_button = new Gtk.Button.with_label (_(STRING_CANCEL)); |
623 | button_box.set_layout (Gtk.ButtonBoxStyle.END); |
624 | button_box.pack_end (close_button, false, false, 0); |
625 | button_box.pack_end (save_button, false, false, 0); |
626 | @@ -255,7 +255,7 @@ |
627 | _valueNumerical = new Gtk.SpinButton.with_range (0, 9999, 1); |
628 | _valueOption = new Gtk.ComboBoxText (); |
629 | _valueRating = new Granite.Widgets.Rating (true, Gtk.IconSize.MENU, true); |
630 | - remove_button = new Gtk.Button.from_stock ("list-remove"); |
631 | + remove_button = new Gtk.Button.with_label (_("Remove")); |
632 | remove_button.halign = Gtk.Align.END; |
633 | |
634 | field_combobox.append_text (_("Album")); |
635 | @@ -442,4 +442,3 @@ |
636 | || compared == SmartQuery.FieldType.DATE_RELEASED); |
637 | } |
638 | } |
639 | - |
640 | |
641 | === modified file 'src/FileOperator.vala' |
642 | --- src/FileOperator.vala 2013-12-02 14:12:51 +0000 |
643 | +++ src/FileOperator.vala 2014-02-07 15:39:13 +0000 |
644 | @@ -274,15 +274,19 @@ |
645 | } |
646 | break; |
647 | case GLib.FileMonitorEvent.CREATED: |
648 | - var info = file.query_info (FileAttribute.STANDARD_TYPE + "," + GLib.FileAttribute.STANDARD_CONTENT_TYPE, GLib.FileQueryInfoFlags.NONE); |
649 | - if (info.get_file_type () == FileType.REGULAR && FileUtils.is_valid_content_type (info.get_content_type ())) { |
650 | - var list = new Gee.LinkedList<string> (); |
651 | - list.add (file.get_uri ()); |
652 | - import_files (list, ImportType.IMPORT); |
653 | - } else if (info.get_file_type () == FileType.DIRECTORY) { |
654 | - var list = new Gee.LinkedList<string> (); |
655 | - FileUtils.count_music_files (file, ref list); |
656 | - import_files (list, ImportType.IMPORT); |
657 | + try { |
658 | + var info = file.query_info (FileAttribute.STANDARD_TYPE + "," + GLib.FileAttribute.STANDARD_CONTENT_TYPE, GLib.FileQueryInfoFlags.NONE); |
659 | + if (info.get_file_type () == FileType.REGULAR && FileUtils.is_valid_content_type (info.get_content_type ())) { |
660 | + var list = new Gee.LinkedList<string> (); |
661 | + list.add (file.get_uri ()); |
662 | + import_files (list, ImportType.IMPORT); |
663 | + } else if (info.get_file_type () == FileType.DIRECTORY) { |
664 | + var list = new Gee.LinkedList<string> (); |
665 | + FileUtils.count_music_files (file, ref list); |
666 | + import_files (list, ImportType.IMPORT); |
667 | + } |
668 | + } catch (Error e) { |
669 | + critical (e.message); |
670 | } |
671 | break; |
672 | case GLib.FileMonitorEvent.MOVED: |
673 | @@ -385,4 +389,4 @@ |
674 | return false; |
675 | }); |
676 | } |
677 | -} |
678 | +} |
679 | \ No newline at end of file |
680 | |
681 | === modified file 'src/LibraryWindow.vala' |
682 | --- src/LibraryWindow.vala 2013-12-31 01:16:59 +0000 |
683 | +++ src/LibraryWindow.vala 2014-02-07 15:39:13 +0000 |
684 | @@ -47,20 +47,20 @@ |
685 | private Gtk.Paned view_container_hpaned; // view_container / info_panel |
686 | public InfoPanel info_panel; |
687 | |
688 | - private Gtk.Toolbar main_toolbar; // Toolbar |
689 | - private Gtk.ToolButton previousButton; |
690 | - private Gtk.ToolButton playButton; |
691 | - private Gtk.ToolButton nextButton; |
692 | + private Gtk.HeaderBar headerbar; |
693 | + private Gtk.Button previousButton; |
694 | + private Gtk.Button playButton; |
695 | + private Gtk.Button nextButton; |
696 | private Gtk.VolumeButton volumeButton; |
697 | |
698 | public Granite.Widgets.ThinPaned main_hpaned { get; private set; } |
699 | public SourceListView source_list_view { get; private set; } |
700 | public ViewContainer view_container { get; private set; } |
701 | public TopDisplay topDisplay { get; private set; } |
702 | - private FixedBin topDisplayBin { get; private set; } |
703 | public Widgets.ViewSelector viewSelector { get; private set; } |
704 | public Granite.Widgets.SearchBar searchField { get; private set; } |
705 | public Widgets.StatusBar statusbar { get; private set; } |
706 | + private FixedBin topDisplayBin; |
707 | |
708 | /* AppMenu items */ |
709 | private Gtk.Menu settingsMenu; |
710 | @@ -75,15 +75,18 @@ |
711 | private int window_height = 0; |
712 | |
713 | private Cancellable notification_cancellable; |
714 | - |
715 | + |
716 | PreferencesWindow? preferences = null; |
717 | - |
718 | + |
719 | private Gee.HashMap<unowned Playlist, int> match_playlists; |
720 | private Gee.HashMap<string, int> match_devices; |
721 | private Gee.HashMap<unowned Playlist, SourceListEntry> match_playlist_entry; |
722 | private Gee.HashMap<Playlist, TreeViewSetup> match_tvs; |
723 | |
724 | public LibraryWindow () { |
725 | + headerbar = new Gtk.HeaderBar (); |
726 | + headerbar.show_close_button = true; |
727 | + set_titlebar (headerbar); |
728 | //FIXME? App.player.player.media_not_found.connect (media_not_found); |
729 | |
730 | this.library_manager.media_updated.connect (medias_updated); |
731 | @@ -204,7 +207,7 @@ |
732 | debug ("setting up main window"); |
733 | |
734 | this.height_request = 350; |
735 | - this.width_request = 600; |
736 | + this.width_request = 400; |
737 | this.window_position = Gtk.WindowPosition.CENTER; |
738 | |
739 | // set the size based on saved settings |
740 | @@ -262,39 +265,24 @@ |
741 | |
742 | /** Toolbar widgets **/ |
743 | |
744 | - main_toolbar = new Gtk.Toolbar (); |
745 | - previousButton = new Gtk.ToolButton (null, null); |
746 | - playButton = new Gtk.ToolButton (null, null); |
747 | - nextButton = new Gtk.ToolButton (null, null); |
748 | + previousButton = new Gtk.Button.from_icon_name ("media-skip-backward", Gtk.IconSize.LARGE_TOOLBAR); |
749 | + previousButton.set_tooltip_text (_("Previous")); |
750 | + playButton = new Gtk.Button.from_icon_name ("media-playback-start", Gtk.IconSize.LARGE_TOOLBAR); |
751 | + playButton.set_tooltip_text (_("Play")); |
752 | + nextButton = new Gtk.Button.from_icon_name ("media-skip-forward", Gtk.IconSize.LARGE_TOOLBAR); |
753 | + nextButton.set_tooltip_text (_("Next")); |
754 | volumeButton = new Gtk.VolumeButton (); |
755 | topDisplay = new TopDisplay (); |
756 | - topDisplayBin = new FixedBin (-1, -1, 800, -1); |
757 | + topDisplayBin = new FixedBin (200, -1, 600, -1); |
758 | viewSelector = new Widgets.ViewSelector (); |
759 | searchField = new Granite.Widgets.SearchBar (_("Search Music")); |
760 | |
761 | - // Set ToolButton icons and tooltips |
762 | - previousButton.set_icon_name ("media-skip-backward"); |
763 | - previousButton.set_tooltip_text (_("Previous")); |
764 | - playButton.set_icon_name ("media-playback-start"); |
765 | - playButton.set_tooltip_text (_("Play")); |
766 | - nextButton.set_icon_name ("media-skip-forward"); |
767 | - nextButton.set_tooltip_text (_("Next")); |
768 | - |
769 | - main_toolbar.get_style_context ().add_class (Gtk.STYLE_CLASS_PRIMARY_TOOLBAR); |
770 | |
771 | topDisplayBin.set_widget (topDisplay, true, false); |
772 | |
773 | // Set search timeout in ms |
774 | searchField.pause_delay = 80; |
775 | |
776 | - var top_display_item = new Gtk.ToolItem (); |
777 | - var search_field_item = new Gtk.ToolItem (); |
778 | - var volume_item = new Gtk.ToolItem (); |
779 | - |
780 | - top_display_item.add (topDisplayBin); |
781 | - search_field_item.add (searchField); |
782 | - volume_item.add (volumeButton); |
783 | - |
784 | volumeButton.use_symbolic = true; |
785 | volumeButton.value = 1; |
786 | |
787 | @@ -304,18 +292,21 @@ |
788 | |
789 | viewSelector.valign = Gtk.Align.CENTER; |
790 | |
791 | - top_display_item.set_expand (true); |
792 | topDisplay.margin_left = 30; |
793 | topDisplay.margin_right = 30; |
794 | - |
795 | - main_toolbar.insert (previousButton, -1); |
796 | - main_toolbar.insert (playButton, -1); |
797 | - main_toolbar.insert (nextButton, -1); |
798 | - main_toolbar.insert (viewSelector, -1); |
799 | - main_toolbar.insert (top_display_item, -1); |
800 | - main_toolbar.insert (search_field_item, -1); |
801 | - main_toolbar.insert (volume_item, -1); |
802 | - main_toolbar.insert (((Noise.App) GLib.Application.get_default ()).create_appmenu (settingsMenu), -1); |
803 | + |
804 | + headerbar.pack_start (previousButton); |
805 | + headerbar.pack_start (playButton); |
806 | + headerbar.pack_start (nextButton); |
807 | + headerbar.pack_start (viewSelector); |
808 | + headerbar.set_custom_title (topDisplayBin); |
809 | + headerbar.pack_end (searchField); |
810 | + // FIXME: Workaround for a bug... |
811 | + var volume_grid = new Gtk.Grid (); |
812 | + volume_grid.attach (volumeButton, 0, 0, 1, 1); |
813 | + headerbar.pack_end (volume_grid); |
814 | + headerbar.pack_end (((Noise.App) GLib.Application.get_default ()).create_appmenu (settingsMenu)); |
815 | + headerbar.show_all (); |
816 | |
817 | |
818 | /** Info Panel **/ |
819 | @@ -348,7 +339,6 @@ |
820 | main_hpaned.pack2 (view_container_hpaned, true, false); |
821 | |
822 | // Add controls to the GUI |
823 | - verticalBox.pack_start (main_toolbar, false, false, 0); |
824 | verticalBox.pack_start (main_hpaned, true, true, 0); |
825 | verticalBox.pack_end (statusbar, false, false, 0); |
826 | |
827 | @@ -762,7 +752,7 @@ |
828 | source_list_view.change_playlist_category_visibility (have_media); |
829 | |
830 | if(!App.player.media_active || have_media && !App.player.playing) |
831 | - playButton.set_icon_name ("media-playback-start"); |
832 | + playButton.set_image (new Gtk.Image.from_icon_name ("media-playback-start", Gtk.IconSize.LARGE_TOOLBAR)); |
833 | |
834 | bool show_top_display = media_active || doing_ops; |
835 | topDisplay.set_visible (show_top_display); |
836 | @@ -1029,7 +1019,7 @@ |
837 | |
838 | |
839 | public virtual void playback_stopped (int was_playing) { |
840 | - playButton.set_icon_name ("media-playback-start"); |
841 | + playButton.set_image (new Gtk.Image.from_icon_name ("media-playback-start", Gtk.IconSize.LARGE_TOOLBAR)); |
842 | //reset some booleans |
843 | tested_for_video = false; |
844 | media_considered_previewed = false; |
845 | @@ -1042,13 +1032,13 @@ |
846 | } |
847 | |
848 | public virtual void playback_started () { |
849 | - playButton.set_icon_name ("media-playback-pause"); |
850 | + playButton.set_image (new Gtk.Image.from_icon_name ("media-playback-pause", Gtk.IconSize.LARGE_TOOLBAR)); |
851 | |
852 | debug ("playback started"); |
853 | } |
854 | |
855 | public virtual void playback_paused () { |
856 | - playButton.set_icon_name ("media-playback-start"); |
857 | + playButton.set_image (new Gtk.Image.from_icon_name ("media-playback-start", Gtk.IconSize.LARGE_TOOLBAR)); |
858 | |
859 | debug ("playback paused"); |
860 | } |
861 | @@ -1134,7 +1124,7 @@ |
862 | _(STRING_CANCEL), Gtk.ResponseType.CANCEL, |
863 | _(STRING_OPEN), Gtk.ResponseType.ACCEPT); |
864 | file_chooser.set_select_multiple (true); |
865 | - file_chooser.set_local_only(true); |
866 | + file_chooser.set_local_only (true); |
867 | |
868 | if (file_chooser.run () == Gtk.ResponseType.ACCEPT) { |
869 | foreach (var folder in file_chooser.get_filenames()) { |
870 | @@ -1415,5 +1405,4 @@ |
871 | |
872 | return base.configure_event (event); |
873 | } |
874 | -} |
875 | - |
876 | +} |
877 | \ No newline at end of file |
878 | |
879 | === modified file 'src/Noise.vala' |
880 | --- src/Noise.vala 2013-12-01 14:35:04 +0000 |
881 | +++ src/Noise.vala 2014-02-07 15:39:13 +0000 |
882 | @@ -56,11 +56,11 @@ |
883 | program_name = "Noise"; |
884 | exec_name = "noise"; |
885 | |
886 | - app_copyright = "2012-2013"; |
887 | + app_copyright = "2012-2014"; |
888 | application_id = "org.pantheon.noise"; |
889 | app_icon = "multimedia-audio-player"; |
890 | app_launcher = "noise.desktop"; |
891 | - app_years = "2012-2013"; |
892 | + app_years = "2012-2014"; |
893 | |
894 | main_url = "https://launchpad.net/noise"; |
895 | bug_url = "https://bugs.launchpad.net/noise/+filebug"; |
896 | @@ -144,4 +144,4 @@ |
897 | public string get_desktop_file_name () { |
898 | return app_launcher; |
899 | } |
900 | -} |
901 | +} |
902 | \ No newline at end of file |
903 | |
904 | === modified file 'src/Objects/LyricFetcher.vala' |
905 | --- src/Objects/LyricFetcher.vala 2013-05-01 13:50:20 +0000 |
906 | +++ src/Objects/LyricFetcher.vala 2014-02-07 15:39:13 +0000 |
907 | @@ -127,7 +127,6 @@ |
908 | else if ('-' == c) |
909 | fixed_string.append_unichar (c); |
910 | } |
911 | - warning (fixed_string.str); |
912 | return fixed_string.str; |
913 | } |
914 | |
915 | @@ -161,4 +160,3 @@ |
916 | return rv.str; |
917 | } |
918 | } |
919 | - |
920 | |
921 | === modified file 'src/Widgets/EmbeddedAlert.vala' |
922 | --- src/Widgets/EmbeddedAlert.vala 2012-12-24 08:30:13 +0000 |
923 | +++ src/Widgets/EmbeddedAlert.vala 2014-02-07 15:39:13 +0000 |
924 | @@ -343,4 +343,4 @@ |
925 | |
926 | return action_button; |
927 | } |
928 | -} |
929 | +} |
930 | \ No newline at end of file |
931 | |
932 | === modified file 'src/Widgets/TopDisplay.vala' |
933 | --- src/Widgets/TopDisplay.vala 2013-06-04 07:20:37 +0000 |
934 | +++ src/Widgets/TopDisplay.vala 2014-02-07 15:39:13 +0000 |
935 | @@ -20,11 +20,9 @@ |
936 | * Boston, MA 02111-1307, USA. |
937 | */ |
938 | |
939 | -using Gtk; |
940 | - |
941 | -public class Noise.TopDisplay : Box { |
942 | +public class Noise.TopDisplay : Gtk.Grid { |
943 | Gtk.Label label; |
944 | - Gtk.Box scaleBox; |
945 | + Gtk.Grid scale_grid; |
946 | Gtk.Label leftTime; |
947 | Gtk.Label rightTime; |
948 | Gtk.Scale scale; |
949 | @@ -34,55 +32,57 @@ |
950 | private bool is_seeking = false; |
951 | private uint timeout_id = 0; |
952 | |
953 | - public signal void scale_value_changed(ScrollType scroll, double val); |
954 | + public signal void scale_value_changed (Gtk.ScrollType scroll, double val); |
955 | |
956 | public TopDisplay() { |
957 | - |
958 | - this.orientation = Orientation.HORIZONTAL; |
959 | - |
960 | - label = new Label(""); |
961 | - scale = new Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 1, 1000); |
962 | - leftTime = new Label("0:00"); |
963 | - rightTime = new Label("0:00"); |
964 | - progressbar = new ProgressBar(); |
965 | - cancelButton = new Button(); |
966 | + width_request = 400; |
967 | + |
968 | + label = new Gtk.Label (""); |
969 | + label.hexpand = true; |
970 | + scale = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 1, 1000); |
971 | + scale.hexpand = true; |
972 | + leftTime = new Gtk.Label ("0:00"); |
973 | + rightTime = new Gtk.Label ("0:00"); |
974 | + progressbar = new Gtk.ProgressBar (); |
975 | + cancelButton = new Gtk.Button (); |
976 | |
977 | - scaleBox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); |
978 | + scale_grid = new Gtk.Grid (); |
979 | |
980 | leftTime.margin_right = rightTime.margin_left = 3; |
981 | |
982 | - scaleBox.pack_start(leftTime, false, false, 0); |
983 | - scaleBox.pack_start(scale, true, true, 0); |
984 | - scaleBox.pack_start(rightTime, false, false, 0); |
985 | + scale_grid.attach (leftTime, 0, 0, 1, 1); |
986 | + scale_grid.attach (scale, 1, 0, 1, 1); |
987 | + scale_grid.attach (rightTime, 2, 0, 1, 1); |
988 | |
989 | scale.set_draw_value (false); |
990 | scale.can_focus = false; |
991 | + scale.hexpand = true; |
992 | |
993 | - label.set_justify(Justification.CENTER); |
994 | - label.set_single_line_mode(false); |
995 | + label.set_justify (Gtk.Justification.CENTER); |
996 | + label.set_single_line_mode (false); |
997 | label.ellipsize = Pango.EllipsizeMode.END; |
998 | |
999 | - cancelButton.set_image(Icons.PROCESS_STOP.render_image (IconSize.MENU)); |
1000 | - cancelButton.set_relief(Gtk.ReliefStyle.NONE); |
1001 | + cancelButton.set_image (Icons.PROCESS_STOP.render_image (Gtk.IconSize.MENU)); |
1002 | + cancelButton.set_relief (Gtk.ReliefStyle.NONE); |
1003 | cancelButton.halign = cancelButton.valign = Gtk.Align.CENTER; |
1004 | |
1005 | - cancelButton.set_tooltip_text (_("Cancel")); |
1006 | + cancelButton.set_tooltip_text (_(STRING_CANCEL)); |
1007 | |
1008 | // all but cancel |
1009 | - var info = new Box(Gtk.Orientation.VERTICAL, 0); |
1010 | - info.pack_start(label, false, true, 0); |
1011 | - info.pack_start(progressbar, false, true, 0); |
1012 | - info.pack_start(scaleBox, false, true, 0); |
1013 | - |
1014 | - this.pack_start(info, true, true, 0); |
1015 | - this.pack_end(cancelButton, false, false, 0); |
1016 | - |
1017 | - this.cancelButton.clicked.connect(cancel_clicked); |
1018 | + var info = new Gtk.Grid (); |
1019 | + info.attach (label, 0, 0, 1, 1); |
1020 | + info.attach (progressbar, 0, 1, 1, 1); |
1021 | + info.attach (scale_grid, 0, 1, 1, 1); |
1022 | + |
1023 | + attach (info, 0, 0, 1, 1); |
1024 | + attach (cancelButton, 0, 0, 1, 1); |
1025 | + |
1026 | + cancelButton.clicked.connect (cancel_clicked); |
1027 | |
1028 | - this.scale.button_press_event.connect(scale_button_press); |
1029 | - this.scale.button_release_event.connect(scale_button_release); |
1030 | - this.scale.value_changed.connect(value_changed); |
1031 | - this.scale.change_value.connect(change_value); |
1032 | + scale.button_press_event.connect (scale_button_press); |
1033 | + scale.button_release_event.connect (scale_button_release); |
1034 | + scale.value_changed.connect (value_changed); |
1035 | + scale.change_value.connect (change_value); |
1036 | |
1037 | App.player.player.current_position_update.connect (player_position_update); |
1038 | |
1039 | @@ -152,15 +152,15 @@ |
1040 | |
1041 | /** scale functions **/ |
1042 | public void set_scale_range(double min, double max) { |
1043 | - scale.set_range(min, max); |
1044 | - } |
1045 | - |
1046 | - public void set_scale_value(double val) { |
1047 | - scale.set_value(val); |
1048 | - } |
1049 | - |
1050 | - public double get_scale_value() { |
1051 | - return scale.get_value(); |
1052 | + scale.set_range (min, max); |
1053 | + } |
1054 | + |
1055 | + public void set_scale_value (double val) { |
1056 | + scale.set_value (val); |
1057 | + } |
1058 | + |
1059 | + public double get_scale_value () { |
1060 | + return scale.get_value (); |
1061 | } |
1062 | |
1063 | public virtual bool scale_button_press(Gdk.EventButton event) { |
1064 | @@ -168,36 +168,42 @@ |
1065 | return true; |
1066 | } |
1067 | |
1068 | - App.player.player.current_position_update.disconnect(player_position_update); |
1069 | + App.player.player.current_position_update.disconnect (player_position_update); |
1070 | is_seeking = true; |
1071 | - change_value (ScrollType.NONE, get_current_time ()); |
1072 | + change_value (Gtk.ScrollType.NONE, get_current_time ()); |
1073 | |
1074 | return false; |
1075 | } |
1076 | |
1077 | - public virtual bool scale_button_release(Gdk.EventButton event) { |
1078 | + public virtual bool scale_button_release (Gdk.EventButton event) { |
1079 | is_seeking = false; |
1080 | |
1081 | - change_value (ScrollType.NONE, get_current_time ()); |
1082 | + change_value (Gtk.ScrollType.NONE, get_current_time ()); |
1083 | |
1084 | return false; |
1085 | } |
1086 | |
1087 | public double get_current_time () { |
1088 | Gtk.Allocation extents; |
1089 | - int point_x = 0; |
1090 | - int point_y = 0; |
1091 | - |
1092 | - scale.get_pointer (out point_x, out point_y); |
1093 | + double point_x = 0; |
1094 | + double point_y = 0; |
1095 | + Gdk.ModifierType mask; |
1096 | + unowned Gdk.Display display = Gdk.Display.get_default (); |
1097 | + unowned Gdk.Window scale_window = scale.get_window (); |
1098 | + unowned Gdk.DeviceManager device_manager = display.get_device_manager (); |
1099 | + scale_window.get_device_position_double (device_manager.get_client_pointer (), out point_x, out point_y, out mask); |
1100 | scale.get_allocation (out extents); |
1101 | + point_x = point_x - extents.x; |
1102 | + if (point_x < 0) |
1103 | + point_x = 0; |
1104 | |
1105 | // get miliseconds of media |
1106 | // calculate percentage to go to based on location |
1107 | return (double)point_x / (double)extents.width * scale.get_adjustment().upper; |
1108 | } |
1109 | |
1110 | - public virtual void value_changed() { |
1111 | - if(!scale.visible) |
1112 | + public virtual void value_changed () { |
1113 | + if (!scale.visible) |
1114 | return; |
1115 | |
1116 | double val = scale.get_value (); |
1117 | @@ -214,7 +220,7 @@ |
1118 | rightTime.set_text (TimeUtils.pretty_length_from_ms (media_duration_secs - elapsed_secs)); |
1119 | } |
1120 | |
1121 | - public virtual bool change_value(ScrollType scroll, double val) { |
1122 | + public virtual bool change_value (Gtk.ScrollType scroll, double val) { |
1123 | App.player.player.current_position_update.disconnect(player_position_update); |
1124 | scale.set_value(val); |
1125 | scale_value_changed(scroll, val); |
1126 | @@ -235,8 +241,8 @@ |
1127 | |
1128 | /** other functions **/ |
1129 | public void show_scale() { |
1130 | - scaleBox.set_no_show_all (false); |
1131 | - scaleBox.show_all (); |
1132 | + scale_grid.set_no_show_all (false); |
1133 | + scale_grid.show_all (); |
1134 | |
1135 | progressbar.set_no_show_all (true); |
1136 | progressbar.hide (); |
1137 | @@ -246,8 +252,8 @@ |
1138 | } |
1139 | |
1140 | public void show_progressbar() { |
1141 | - scaleBox.set_no_show_all (true); |
1142 | - scaleBox.hide(); |
1143 | + scale_grid.set_no_show_all (true); |
1144 | + scale_grid.hide(); |
1145 | |
1146 | progressbar.set_no_show_all (false); |
1147 | progressbar.show_all (); |
1148 | @@ -257,8 +263,8 @@ |
1149 | } |
1150 | |
1151 | public void hide_scale_and_progressbar() { |
1152 | - scaleBox.set_no_show_all (true); |
1153 | - scaleBox.hide(); |
1154 | + scale_grid.set_no_show_all (true); |
1155 | + scale_grid.hide(); |
1156 | |
1157 | progressbar.set_no_show_all (true); |
1158 | progressbar.hide (); |
1159 | @@ -296,4 +302,4 @@ |
1160 | set_media (current_media); |
1161 | } |
1162 | } |
1163 | -} |
1164 | +} |
1165 | \ No newline at end of file |
Diff line 3773 "Reset" is not translatable.
Diff lines 3978-3980 are out of alignment OR 3977 is out of alignment.
Otherwise, I approve this code.
You did not update the codestyle for some of the stuff you changed, but I would have done the same. It does not bother me.
There's more that could be replaced by Gtk >= 3.10 (like modebuttons in preferences) but this is a good start.
As a tip for the future, I recommend you find a standard location on your system like /tmp/noise for use when you update the translation template so it modifies less lines.