Merge lp:~l-admin-3/snap-elementary/code-cleanup into lp:snap-elementary
- code-cleanup
- Merge into snap
Proposed by
Marcus Wichelmann
Status: | Merged |
---|---|
Approved by: | Cody Garver |
Approved revision: | 318 |
Merged at revision: | 318 |
Proposed branch: | lp:~l-admin-3/snap-elementary/code-cleanup |
Merge into: | lp:snap-elementary |
Diff against target: |
702 lines (+83/-112) 10 files modified
src/Dialogs/Preferences.vala (+0/-3) src/Resources.vala (+6/-8) src/Services/Settings.vala (+1/-5) src/Services/ThumbnailProvider.vala (+10/-10) src/Snap.vala (+1/-11) src/SnapWindow.vala (+29/-32) src/Widgets/Camera.vala (+24/-27) src/Widgets/Countdown.vala (+0/-1) src/Widgets/Gallery.vala (+9/-11) src/Widgets/NoCamera.vala (+3/-4) |
To merge this branch: | bzr merge lp:~l-admin-3/snap-elementary/code-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
elementary Apps team | Pending | ||
Review via email: mp+251072@code.launchpad.net |
Commit message
Remove some unnecessary blank lines and white-spaces
Description of the change
Removes some unnecessary blank lines and white-spaces.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/Dialogs/Preferences.vala' |
2 | --- src/Dialogs/Preferences.vala 2014-03-04 12:45:49 +0000 |
3 | +++ src/Dialogs/Preferences.vala 2015-02-26 12:36:24 +0000 |
4 | @@ -19,9 +19,7 @@ |
5 | ***/ |
6 | |
7 | namespace Snap.Dialogs { |
8 | - |
9 | public class Preferences : Gtk.Dialog { |
10 | - |
11 | public Preferences (string? title, SnapWindow? window) { |
12 | this.title = title; |
13 | this.type_hint = Gdk.WindowTypeHint.DIALOG; |
14 | @@ -29,6 +27,5 @@ |
15 | set_default_size (300, 200); |
16 | modal = true; |
17 | } |
18 | - |
19 | } |
20 | } |
21 | |
22 | === modified file 'src/Resources.vala' |
23 | --- src/Resources.vala 2015-01-09 16:27:39 +0000 |
24 | +++ src/Resources.vala 2015-02-26 12:36:24 +0000 |
25 | @@ -22,7 +22,6 @@ |
26 | using Snap.Services; |
27 | |
28 | namespace Resources { |
29 | - |
30 | public const string TAKE_BUTTON_STYLESHEET = """ |
31 | .take-button { |
32 | border-radius: 400px; |
33 | @@ -97,23 +96,23 @@ |
34 | } else { |
35 | new_filename += "." + ext; |
36 | } |
37 | - |
38 | + |
39 | string media_dir = get_media_dir (type); |
40 | if (!FileUtils.test (media_dir, FileTest.EXISTS)) |
41 | DirUtils.create (media_dir, 0777); |
42 | - |
43 | + |
44 | return GLib.Path.build_filename (Path.DIR_SEPARATOR_S, media_dir, new_filename); |
45 | } |
46 | - |
47 | + |
48 | /** |
49 | * @return a valid photo/video uri. |
50 | */ |
51 | - public string build_uri_from_filename (string filename) { |
52 | + public string build_uri_from_filename (string filename) { |
53 | var file = File.new_for_path (filename); |
54 | - |
55 | + |
56 | return file.get_uri (); |
57 | } |
58 | - |
59 | + |
60 | /** Thumbnail providers **/ |
61 | public ThumbnailProvider photo_thumb_provider; |
62 | public ThumbnailProvider video_thumb_provider; |
63 | @@ -123,7 +122,6 @@ |
64 | **/ |
65 | public Gdk.Pixbuf get_pixbuf_shadow (Gdk.Pixbuf pixbuf, int surface_size, |
66 | int shadow_size = 5, double alpha = 0.8) { |
67 | - |
68 | int S_WIDTH = (surface_size > 0)? surface_size : pixbuf.width; |
69 | int S_HEIGHT = (surface_size > 0)? surface_size : pixbuf.height; |
70 | |
71 | |
72 | === modified file 'src/Services/Settings.vala' |
73 | --- src/Services/Settings.vala 2014-05-24 18:20:03 +0000 |
74 | +++ src/Services/Settings.vala 2015-02-26 12:36:24 +0000 |
75 | @@ -20,9 +20,7 @@ |
76 | |
77 | |
78 | namespace Snap.Services { |
79 | - |
80 | public class Settings : Granite.Services.Settings { |
81 | - |
82 | public string bg_color { get; set; } |
83 | public bool countdown { get; set; } |
84 | public int countdown_time { get; set; } |
85 | @@ -31,7 +29,5 @@ |
86 | public Settings () { |
87 | base ("org.pantheon.snap.settings"); |
88 | } |
89 | - |
90 | } |
91 | - |
92 | -} |
93 | \ No newline at end of file |
94 | +} |
95 | |
96 | === modified file 'src/Services/ThumbnailProvider.vala' |
97 | --- src/Services/ThumbnailProvider.vala 2014-05-25 18:53:53 +0000 |
98 | +++ src/Services/ThumbnailProvider.vala 2015-02-26 12:36:24 +0000 |
99 | @@ -24,7 +24,7 @@ |
100 | public Gdk.Pixbuf pixbuf { get; protected set; } |
101 | public bool is_temp { get; public set; } |
102 | public File temp_file { get; public set; } |
103 | - |
104 | + |
105 | public Thumbnail (File file, Gdk.Pixbuf pixbuf) { |
106 | this.file = file; |
107 | this.pixbuf = pixbuf; |
108 | @@ -35,12 +35,12 @@ |
109 | private File path; |
110 | private Gee.Set<Thumbnail> cache; |
111 | private int temp_thumb; |
112 | - |
113 | + |
114 | public static const int THUMB_WIDTH = Widgets.Camera.WIDTH / 4; |
115 | public static const int THUMB_HEIGHT = Widgets.Camera.HEIGHT / 4; |
116 | - |
117 | + |
118 | public signal void thumbnail_loaded (Thumbnail thumbnail); |
119 | - |
120 | + |
121 | /** |
122 | * Creates a new object of time ThumbnailProvider. This type of objects are used |
123 | * to obtain thumbnails for files in a specific path |
124 | @@ -51,7 +51,7 @@ |
125 | this.cache = new Gee.TreeSet<Thumbnail> (); |
126 | this.temp_thumb = 0; |
127 | } |
128 | - |
129 | + |
130 | /** |
131 | * Asynchronously load thumbnails and add them in a Gee.TreeSet object. The thumbnail_loaded |
132 | * is emitted whenever a new Thumbnail is fully loaded |
133 | @@ -79,7 +79,7 @@ |
134 | warning ("Error: parse_thumbs failed: %s", err.message); |
135 | } |
136 | } |
137 | - |
138 | + |
139 | private Thumbnail? get_thumbnail (File file) { |
140 | Thumbnail? thumb = null; |
141 | try { |
142 | @@ -93,13 +93,13 @@ |
143 | } catch (Error err) { |
144 | warning ("Error: get_thumbnail failed: %s", err.message); |
145 | } |
146 | - |
147 | + |
148 | if (thumb == null) { |
149 | // Try to obtain the thumbnail with ffmpegthumbnailer |
150 | try { |
151 | string tmp_path = GLib.Environment.get_tmp_dir (); |
152 | string out_path = tmp_path + "/temp" + this.temp_thumb.to_string () + ".png"; |
153 | - string[] spawn_args = {"ffmpegthumbnailer", |
154 | + string[] spawn_args = {"ffmpegthumbnailer", |
155 | "-i", file.get_path (), // Input file |
156 | "-o", out_path, // Output file |
157 | "-c", "png", |
158 | @@ -135,7 +135,7 @@ |
159 | } |
160 | return thumb; |
161 | } |
162 | - |
163 | + |
164 | /** |
165 | * Execute this method on quitting to clean temp cache |
166 | */ |
167 | @@ -154,4 +154,4 @@ |
168 | } |
169 | } |
170 | } |
171 | -} |
172 | \ No newline at end of file |
173 | +} |
174 | |
175 | === modified file 'src/Snap.vala' |
176 | --- src/Snap.vala 2014-10-28 15:34:58 +0000 |
177 | +++ src/Snap.vala 2015-02-26 12:36:24 +0000 |
178 | @@ -19,11 +19,9 @@ |
179 | ***/ |
180 | |
181 | namespace Snap { |
182 | - |
183 | public Snap.Services.Settings settings; |
184 | |
185 | public class SnapApp : Granite.Application { |
186 | - |
187 | /** |
188 | * Translatable launcher (.desktop) strings to be added to template (.pot) file. |
189 | * These strings should reflect any changes in these launcher keys in .desktop file |
190 | @@ -38,7 +36,6 @@ |
191 | public SnapWindow window = null; |
192 | |
193 | construct { |
194 | - |
195 | build_data_dir = Constants.DATADIR; |
196 | build_pkg_data_dir = Constants.PKGDATADIR; |
197 | build_release_name = Constants.RELEASE_NAME; |
198 | @@ -59,11 +56,9 @@ |
199 | about_artists = { "Daniel Fore <daniel.p.fore@gmail.com >", "Harvey Cabaguio <harveycabaguio@gmail.com>", null }; |
200 | about_translators = "Launchpad Translators"; |
201 | about_license_type = Gtk.License.GPL_3_0; |
202 | - |
203 | } |
204 | |
205 | public SnapApp () { |
206 | - |
207 | Granite.Services.Logger.initialize ("Snap"); |
208 | Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.DEBUG; |
209 | |
210 | @@ -71,7 +66,6 @@ |
211 | } |
212 | |
213 | protected override void activate () { |
214 | - |
215 | if (get_windows () == null) { |
216 | window = new SnapWindow (this); |
217 | window.show (); |
218 | @@ -79,18 +73,14 @@ |
219 | else { |
220 | window.present (); |
221 | } |
222 | - |
223 | } |
224 | |
225 | public static int main (string[] args) { |
226 | - |
227 | Gst.init (ref args); |
228 | - |
229 | + |
230 | var app = new SnapApp (); |
231 | |
232 | return app.run (args); |
233 | - |
234 | } |
235 | - |
236 | } |
237 | } |
238 | |
239 | === modified file 'src/SnapWindow.vala' |
240 | --- src/SnapWindow.vala 2015-01-09 16:48:05 +0000 |
241 | +++ src/SnapWindow.vala 2015-02-26 12:36:24 +0000 |
242 | @@ -26,7 +26,7 @@ |
243 | private const string STOP_ICON_SYMBOLIC = "media-playback-stop-symbolic"; |
244 | |
245 | private Snap.SnapApp snap_app; |
246 | - |
247 | + |
248 | private Snap.Widgets.Camera camera; |
249 | private Snap.Widgets.Gallery gallery; |
250 | private Snap.Widgets.NoCamera no_camera; |
251 | @@ -43,10 +43,9 @@ |
252 | private bool camera_detected; |
253 | |
254 | public SnapWindow (Snap.SnapApp snap_app) { |
255 | - |
256 | this.snap_app = snap_app; |
257 | this.set_application (this.snap_app); |
258 | - |
259 | + |
260 | this.title = "Snap"; |
261 | this.window_position = Gtk.WindowPosition.CENTER; |
262 | this.icon_name = "snap-photobooth"; |
263 | @@ -89,9 +88,9 @@ |
264 | } |
265 | }); |
266 | gallery_button_box.pack_start (gallery_button, true, true, 0); |
267 | - |
268 | + |
269 | toolbar.pack_start (gallery_button_box); |
270 | - |
271 | + |
272 | // Mode switcher |
273 | mode_button = new Granite.Widgets.ModeButton (); |
274 | mode_button.valign = Gtk.Align.CENTER; |
275 | @@ -115,7 +114,7 @@ |
276 | take_button.get_style_context ().add_class ("take-button"); |
277 | take_button.get_style_context ().add_class ("destructive-action"); |
278 | take_button.get_style_context ().add_class ("raised"); |
279 | - take_button.clicked.connect (() => { |
280 | + take_button.clicked.connect (() => { |
281 | if (this.stack.get_visible_child () != this.camera) { |
282 | gallery_button.set_active (false); |
283 | return; |
284 | @@ -125,7 +124,7 @@ |
285 | if (this.camera.get_action_type() == Widgets.Camera.ActionType.VIDEO) { |
286 | set_take_button_icon (Snap.Widgets.Camera.ActionType.CAPTURING); |
287 | } |
288 | - |
289 | + |
290 | } else { |
291 | this.camera.take_stop (); |
292 | if (this.camera.get_action_type() == Widgets.Camera.ActionType.VIDEO) { |
293 | @@ -134,7 +133,7 @@ |
294 | } |
295 | }); |
296 | take_button.set_sensitive (camera_detected); |
297 | - |
298 | + |
299 | var take_button_box = new Gtk.ButtonBox (Gtk.Orientation.HORIZONTAL); |
300 | take_button_box.set_spacing (4); |
301 | take_button_box.set_layout (Gtk.ButtonBoxStyle.START); |
302 | @@ -144,13 +143,13 @@ |
303 | take_button.set_size_request (54, -1); |
304 | |
305 | toolbar.set_custom_title (take_button_box); |
306 | - |
307 | + |
308 | // Setup NoCamera widget |
309 | this.no_camera = new Snap.Widgets.NoCamera (); |
310 | - |
311 | + |
312 | // Setup gallery widget |
313 | this.gallery = new Snap.Widgets.Gallery (); |
314 | - |
315 | + |
316 | // Setup preview area |
317 | this.camera = new Snap.Widgets.Camera (); |
318 | this.camera.capture_start.connect (() => { |
319 | @@ -176,7 +175,7 @@ |
320 | this.stack.set_visible_child (this.camera); // Show camera on launch |
321 | else |
322 | this.stack.set_visible_child (this.no_camera); // Show no_camera on launch |
323 | - |
324 | + |
325 | // Statusbar |
326 | statusbar = new Gtk.Statusbar (); |
327 | |
328 | @@ -188,9 +187,8 @@ |
329 | |
330 | this.add (this.stack); |
331 | this.show_all (); |
332 | - |
333 | } |
334 | - |
335 | + |
336 | private bool detect_camera () { |
337 | try { |
338 | var video_devices = File.new_for_path ("/dev/."); |
339 | @@ -201,34 +199,34 @@ |
340 | debug ("camera found: %s", info.get_name ()); |
341 | return true; |
342 | } |
343 | - } |
344 | + } |
345 | } catch (Error err) { |
346 | debug ("camera detection failed: %s", err.message); |
347 | } |
348 | - |
349 | + |
350 | debug ("no camera"); |
351 | return false; |
352 | } |
353 | - |
354 | + |
355 | protected override bool delete_event (Gdk.EventAny event) { |
356 | Resources.photo_thumb_provider.clear_cache (); |
357 | Resources.video_thumb_provider.clear_cache (); |
358 | return false; |
359 | } |
360 | - |
361 | + |
362 | private void on_mode_changed () { |
363 | var type = (mode_button.selected == 0) ? |
364 | - Snap.Widgets.Camera.ActionType.PHOTO : Snap.Widgets.Camera.ActionType.VIDEO; |
365 | + Snap.Widgets.Camera.ActionType.PHOTO : Snap.Widgets.Camera.ActionType.VIDEO; |
366 | |
367 | Snap.settings.mode = type; |
368 | |
369 | this.camera.set_action_type (type); |
370 | this.set_take_button_icon (type); |
371 | } |
372 | - |
373 | + |
374 | private void set_take_button_icon (Snap.Widgets.Camera.ActionType? type) { |
375 | string icon_name; |
376 | - |
377 | + |
378 | if (type == Snap.Widgets.Camera.ActionType.PHOTO) |
379 | icon_name = PHOTO_ICON_SYMBOLIC; |
380 | else if (type == Snap.Widgets.Camera.ActionType.VIDEO) |
381 | @@ -253,31 +251,30 @@ |
382 | |
383 | return false; |
384 | } |
385 | - |
386 | + |
387 | private void lock_camera_actions () { |
388 | this.mode_button.set_sensitive (false); |
389 | } |
390 | - |
391 | + |
392 | private void unlock_camera_actions () { |
393 | this.mode_button.set_sensitive (true); |
394 | } |
395 | - |
396 | + |
397 | private void load_thumbnails () { |
398 | this.gallery.clear_view (); |
399 | Resources.photo_thumb_provider.parse_thumbs.begin (); |
400 | Resources.video_thumb_provider.parse_thumbs.begin (); |
401 | } |
402 | - |
403 | + |
404 | private void show_gallery () { |
405 | if (camera_detected) { |
406 | - this.camera.stop (); |
407 | + this.camera.stop (); |
408 | } |
409 | this.lock_camera_actions (); |
410 | this.stack.set_visible_child (this.gallery); |
411 | } |
412 | - |
413 | + |
414 | private void show_camera () { |
415 | - |
416 | if (camera_detected) { |
417 | this.stack.set_visible_child (this.camera); // Show camera on launch |
418 | this.camera.play (); |
419 | @@ -285,16 +282,16 @@ |
420 | } |
421 | else { |
422 | this.stack.set_visible_child (this.no_camera); // Show no_camera on launch |
423 | - } |
424 | + } |
425 | } |
426 | |
427 | private bool gallery_files_exists () { |
428 | FileInfo file_info; |
429 | - |
430 | + |
431 | try { |
432 | FileEnumerator enumerator_photo = photo_path.enumerate_children (FileAttribute.STANDARD_NAME, 0); |
433 | FileEnumerator enumerator_video = video_path.enumerate_children (FileAttribute.STANDARD_NAME, 0); |
434 | - |
435 | + |
436 | if ((file_info = enumerator_photo.next_file ()) != null || |
437 | (file_info = enumerator_video.next_file ()) != null) { |
438 | // Gallery is not empty |
439 | @@ -303,7 +300,7 @@ |
440 | } catch (Error perr) { |
441 | warning ("Error: check_gallery_files photo failed: %s", perr.message); |
442 | } |
443 | - |
444 | + |
445 | // Gallery is empty, button may be disabled |
446 | return false; |
447 | } |
448 | |
449 | === modified file 'src/Widgets/Camera.vala' |
450 | --- src/Widgets/Camera.vala 2015-01-09 16:25:07 +0000 |
451 | +++ src/Widgets/Camera.vala 2015-02-26 12:36:24 +0000 |
452 | @@ -1,27 +1,25 @@ |
453 | // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
454 | /*** |
455 | BEGIN LICENSE |
456 | - |
457 | + |
458 | Copyright (C) 2013 Mario Guerriero <mario@elementaryos.org> |
459 | This program is free software: you can redistribute it and/or modify it |
460 | under the terms of the GNU Lesser General Public License version 3, as |
461 | published by the Free Software Foundation. |
462 | - |
463 | + |
464 | This program is distributed in the hope that it will be useful, but |
465 | WITHOUT ANY WARRANTY; without even the implied warranties of |
466 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
467 | PURPOSE. See the GNU General Public License for more details. |
468 | - |
469 | + |
470 | You should have received a copy of the GNU General Public License along |
471 | with this program. If not, see <http://www.gnu.org/licenses> |
472 | - |
473 | + |
474 | END LICENSE |
475 | ***/ |
476 | |
477 | namespace Snap.Widgets { |
478 | - |
479 | public class Camera : Gtk.DrawingArea { |
480 | - |
481 | public enum ActionType { |
482 | PHOTO = 0, |
483 | VIDEO, |
484 | @@ -30,27 +28,26 @@ |
485 | |
486 | public static const int WIDTH = 640; |
487 | public static const int HEIGHT = 480; |
488 | - |
489 | + |
490 | private ActionType type; |
491 | - |
492 | + |
493 | private bool capturing = false; |
494 | - |
495 | + |
496 | private Gst.Element? camerabin = null; |
497 | private Gst.Element? videoflip = null; |
498 | - |
499 | + |
500 | public signal void capture_start (); |
501 | public signal void capture_stop (); |
502 | - |
503 | + |
504 | public class Camera () { |
505 | - |
506 | this.set_size_request (WIDTH, HEIGHT); // FIXME |
507 | |
508 | - this.videoflip = Gst.ElementFactory.make ("videoflip", "videoflip"); |
509 | + this.videoflip = Gst.ElementFactory.make ("videoflip", "videoflip"); |
510 | this.videoflip.set_property ("method", 4); |
511 | - |
512 | + |
513 | this.camerabin = Gst.ElementFactory.make ("camerabin","camera"); |
514 | this.camerabin.set_property ("viewfinder-filter", videoflip); |
515 | - |
516 | + |
517 | this.camerabin.bus.add_watch (0,(bus,message) => { |
518 | if (Gst.Video.is_video_overlay_prepare_window_handle_message (message)) |
519 | (message.src as Gst.Video.Overlay).set_window_handle ((uint*) Gdk.X11Window.get_xid (this.get_window())); |
520 | @@ -67,11 +64,11 @@ |
521 | if (visual != null) |
522 | this.set_visual (visual); |
523 | // workaround END |
524 | - |
525 | + |
526 | this.show_all (); |
527 | this.play (); |
528 | } |
529 | - |
530 | + |
531 | /** |
532 | * Change the camera recording type (switch between Video or Photo mode) |
533 | */ |
534 | @@ -79,21 +76,21 @@ |
535 | debug ("mode changed"); |
536 | this.type = type; |
537 | } |
538 | - |
539 | + |
540 | /** |
541 | * Starts Camera visualization |
542 | */ |
543 | public void play () { |
544 | - this.camerabin.set_state (Gst.State.PLAYING); |
545 | + this.camerabin.set_state (Gst.State.PLAYING); |
546 | } |
547 | - |
548 | + |
549 | /** |
550 | * Stops Camera visualization |
551 | */ |
552 | public void stop () { |
553 | - this.camerabin.set_state (Gst.State.NULL); |
554 | + this.camerabin.set_state (Gst.State.NULL); |
555 | } |
556 | - |
557 | + |
558 | /** |
559 | * Send to the Camera an acquire signal depending on its recording mode |
560 | */ |
561 | @@ -106,9 +103,9 @@ |
562 | // "(int) this.type + 1" is here because GST developers used mode 1 for photos |
563 | // and mode 2 for videos (can't understand why not 0 and 1) |
564 | this.camerabin.set_property ("mode", (int) this.type + 1); |
565 | - |
566 | + |
567 | this.capturing = (this.type == ActionType.VIDEO); |
568 | - |
569 | + |
570 | debug ("%s", location); |
571 | |
572 | camerabin.set_property ("location", location); |
573 | @@ -117,7 +114,7 @@ |
574 | if (this.type == ActionType.PHOTO) |
575 | this.capture_stop (); |
576 | } |
577 | - |
578 | + |
579 | /** |
580 | * Tells the camera to stop recording (to be used only in video mode) |
581 | */ |
582 | @@ -130,14 +127,14 @@ |
583 | |
584 | this.capture_stop (); |
585 | } |
586 | - |
587 | + |
588 | /** |
589 | * @return the action Camera is supposed to do |
590 | */ |
591 | public ActionType get_action_type () { |
592 | return type; |
593 | } |
594 | - |
595 | + |
596 | /** |
597 | * @return true if camera is recording a video, false otherwise |
598 | */ |
599 | |
600 | === modified file 'src/Widgets/Countdown.vala' |
601 | --- src/Widgets/Countdown.vala 2013-12-16 15:13:57 +0000 |
602 | +++ src/Widgets/Countdown.vala 2015-02-26 12:36:24 +0000 |
603 | @@ -66,7 +66,6 @@ |
604 | media_text = media_text.replace ("&", "&"); |
605 | |
606 | title_label.label = "<span size='20000' color='#fbfbfb'>" + media_text + "</span>"; |
607 | - |
608 | } |
609 | |
610 | public override bool draw (Cairo.Context ctx) { |
611 | |
612 | === modified file 'src/Widgets/Gallery.vala' |
613 | --- src/Widgets/Gallery.vala 2014-05-16 19:55:23 +0000 |
614 | +++ src/Widgets/Gallery.vala 2015-02-26 12:36:24 +0000 |
615 | @@ -1,27 +1,26 @@ |
616 | // -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*- |
617 | /*** |
618 | BEGIN LICENSE |
619 | - |
620 | + |
621 | Copyright (C) 2013 Mario Guerriero <mario@elementaryos.org> |
622 | This program is free software: you can redistribute it and/or modify it |
623 | under the terms of the GNU Lesser General Public License version 3, as |
624 | published by the Free Software Foundation. |
625 | - |
626 | + |
627 | This program is distributed in the hope that it will be useful, but |
628 | WITHOUT ANY WARRANTY; without even the implied warranties of |
629 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
630 | PURPOSE. See the GNU General Public License for more details. |
631 | - |
632 | + |
633 | You should have received a copy of the GNU General Public License along |
634 | with this program. If not, see <http://www.gnu.org/licenses> |
635 | - |
636 | + |
637 | END LICENSE |
638 | ***/ |
639 | |
640 | namespace Snap.Widgets { |
641 | |
642 | public class Gallery : Gtk.ScrolledWindow { |
643 | - |
644 | private Gtk.ListStore model; |
645 | private Gtk.IconView view; |
646 | |
647 | @@ -38,12 +37,12 @@ |
648 | |
649 | foreach (Gtk.TreePath path in paths) { |
650 | this.model.get_iter (out iter, path); |
651 | - |
652 | + |
653 | GLib.Value val; |
654 | this.model.get_value (iter, 1, out val); |
655 | - |
656 | + |
657 | thumb = (Services.Thumbnail) val; |
658 | - |
659 | + |
660 | Resources.launch_file (thumb.file); |
661 | } |
662 | }); |
663 | @@ -59,7 +58,7 @@ |
664 | this.model.append (out iter); |
665 | this.model.set (iter, 0, thumb.pixbuf, 1, thumb); |
666 | } |
667 | - |
668 | + |
669 | /** |
670 | + Simply clear the IconView as the name suggests |
671 | */ |
672 | @@ -67,5 +66,4 @@ |
673 | this.model.clear (); |
674 | } |
675 | } |
676 | - |
677 | -} |
678 | \ No newline at end of file |
679 | +} |
680 | |
681 | === modified file 'src/Widgets/NoCamera.vala' |
682 | --- src/Widgets/NoCamera.vala 2014-10-03 08:37:20 +0000 |
683 | +++ src/Widgets/NoCamera.vala 2015-02-26 12:36:24 +0000 |
684 | @@ -20,14 +20,13 @@ |
685 | namespace Snap.Widgets { |
686 | |
687 | public class NoCamera : Gtk.ScrolledWindow { |
688 | - |
689 | Gtk.Label no_camera_label; |
690 | - |
691 | + |
692 | public class NoCamera () { |
693 | no_camera_label = new Gtk.Label (""); |
694 | no_camera_label.set_markup ("<span color='gray'>%s</span>".printf(_("Your webcam has not been detected. Please be sure you plugged it in."))); |
695 | this.add (no_camera_label); |
696 | this.show_all (); |
697 | - } |
698 | + } |
699 | } |
700 | -} |
701 | \ No newline at end of file |
702 | +} |