Merge lp:~artem-anufrij/audience/Bugfix-1386040 into lp:~audience-members/audience/trunk

Proposed by Artem Anufrij
Status: Work in progress
Proposed branch: lp:~artem-anufrij/audience/Bugfix-1386040
Merge into: lp:~audience-members/audience/trunk
Diff against target: 179 lines (+144/-3) (has conflicts)
1 file modified
src/Audience.vala (+144/-3)
Text conflict in src/Audience.vala
To merge this branch: bzr merge lp:~artem-anufrij/audience/Bugfix-1386040
Reviewer Review Type Date Requested Status
kay van der Zander (community) code Needs Fixing
Review via email: mp+274643@code.launchpad.net

This proposal supersedes a proposal from 2014-11-11.

Description of the change

Check privacy mode. IF ENABLED: don't save the settings (last videos, current video, process, last folder).

To post a comment you must log in.
Revision history for this message
Viko Adi Rahmawan (vikoadi) wrote : Posted in a previous version of this proposal

I think this process of defining what to save and what to open is a really complex task. As we see in the switchboard we have a blacklisting based on file path and what open it.

Checking this gsettings might be not enough and we need a more sophisticated process involving Zeitgeist , Gtk.RecentManager, etc. And it might be useful for other project too, it would be awesome if it can be a part of Granite.

I don't know about how Security and Privacy is designed in pantheon, and i think it need to be discussed in a bigger forum.

Revision history for this message
Danielle Foré (danrabbit) wrote : Posted in a previous version of this proposal

I think for the purpose of this bug report, it would be acceptable to just not write any changes to gsettings while privacy mode is active.

Revision history for this message
kay van der Zander (kay20) wrote :

hey nice job on including privacy.
still there are some bad parts as in not functional or not readable enough.
please fix them.

review: Needs Fixing (code)

Unmerged revisions

460. By artem-anufrij

Check privacy mode. IF ENABLE: don't save the settings (last videos, current video, process, last folder).

459. By artem-anufrij

Check privacy mode. IF ENABLE: don't save the settings (last videos, current video, process).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Audience.vala'
--- src/Audience.vala 2015-09-21 18:26:27 +0000
+++ src/Audience.vala 2015-10-15 21:57:54 +0000
@@ -234,6 +234,107 @@
234 default:234 default:
235 break;235 break;
236 }236 }
237<<<<<<< TREE
238=======
239
240 return true;
241 }
242
243 private void on_configure_window (uint video_w, uint video_h) {
244 Gdk.Rectangle monitor;
245 var screen = Gdk.Screen.get_default ();
246 screen.get_monitor_geometry (screen.get_monitor_at_window (mainwindow.get_window ()), out monitor);
247
248 int width = 0, height = 0;
249 if (monitor.width > video_w && monitor.height > video_h) {
250 width = (int)video_w;
251 height = (int)video_h;
252 } else {
253 width = (int)(monitor.width * 0.9);
254 height = (int)((double)video_h / video_w * width);
255 }
256
257 mainwindow.get_window ().move_resize (monitor.width / 2 - width / 2 + monitor.x,
258 monitor.height / 2 - height / 2 + monitor.y,
259 width, height);
260
261 if (settings.keep_aspect) {
262 var geom = Gdk.Geometry ();
263 geom.min_aspect = geom.max_aspect = video_w / (double)video_h;
264 mainwindow.get_window ().set_geometry_hints (geom, Gdk.WindowHints.ASPECT);
265 }
266 }
267
268 private void on_window_state_changed (Gdk.WindowState window_state) {
269 bool currently_maximized = (window_state & Gdk.WindowState.MAXIMIZED) == 0;
270
271 if (!currently_maximized && !fullscreened && !welcome.is_visible ()) {
272 mainwindow.fullscreen ();
273 fullscreened = true;
274 }
275 }
276
277 /*DnD*/
278 private void setup_drag_n_drop () {
279 Gtk.TargetEntry uris = {"text/uri-list", 0, 0};
280 Gtk.drag_dest_set (mainwindow, Gtk.DestDefaults.ALL, {uris}, Gdk.DragAction.MOVE);
281 mainwindow.drag_data_received.connect ( (ctx, x, y, sel, info, time) => {
282 foreach (var uri in sel.get_uris ()) {
283 open_file (uri);
284 }
285
286 welcome.hide ();
287 clutter.show_all ();
288 });
289 }
290
291 private void on_destroy () {
292
293 if (is_privacy_mode_enabled ()) {
294 clear_video_settings ();
295 return;
296 }
297
298 if (video_player.uri.has_prefix ("dvd://")) {
299 clear_video_settings ();
300 return;
301 }
302
303 if (video_player.uri == null || video_player.uri == "")
304 return;
305
306 save_last_played_videos ();
307 }
308
309 private int old_h = - 1;
310 private int old_w = - 1;
311 private void on_size_allocate (Gtk.Allocation alloc) {
312 if (alloc.width != old_w || alloc.height != old_h) {
313 if (video_player.relayout ()) {
314 old_w = alloc.width;
315 old_h = alloc.height;
316 }
317 }
318 }
319
320 private bool update_pointer_position (double y, int window_height) {
321 allocate_bottombar ();
322 mainwindow.get_window ().set_cursor (null);
323 if (bottom_bar_size == 0) {
324 int minimum = 0;
325 bottom_bar.get_preferred_height (out minimum, out bottom_bar_size);
326 }
327
328 if (bottom_bar.child_revealed == false)
329 bottom_bar.set_reveal_child (true);
330
331 if (y >= (window_height - bottom_bar_size) && y < window_height) {
332 bottom_bar.hovered = true;
333 } else {
334 bottom_bar.hovered = false;
335 }
336
337>>>>>>> MERGE-SOURCE
237 return false;338 return false;
238 }339 }
239340
@@ -241,8 +342,18 @@
241 settings.last_stopped = 0;342 settings.last_stopped = 0;
242 settings.last_played_videos = null;343 settings.last_played_videos = null;
243 settings.current_video = "";344 settings.current_video = "";
244 }345 settings.last_folder = "";
245346 }
347
348<<<<<<< TREE
349=======
350 private void restore_playlist () {
351 foreach (var filename in settings.last_played_videos) {
352 playlist.add_item (File.new_for_uri (filename));
353 }
354 }
355
356>>>>>>> MERGE-SOURCE
246 public void run_open_file () {357 public void run_open_file () {
247 var file = new Gtk.FileChooserDialog (_("Open"), mainwindow, Gtk.FileChooserAction.OPEN,358 var file = new Gtk.FileChooserDialog (_("Open"), mainwindow, Gtk.FileChooserAction.OPEN,
248 _("_Cancel"), Gtk.ResponseType.CANCEL, _("_Open"), Gtk.ResponseType.ACCEPT);359 _("_Cancel"), Gtk.ResponseType.CANCEL, _("_Open"), Gtk.ResponseType.ACCEPT);
@@ -320,8 +431,30 @@
320 }431 }
321432
322 public override void activate () {433 public override void activate () {
434<<<<<<< TREE
323 if (mainwindow == null) {435 if (mainwindow == null) {
324 build ();436 build ();
437=======
438 build ();
439
440 if (is_privacy_mode_enabled ())
441 return;
442
443 if (settings.resume_videos == true
444 && settings.last_played_videos.length > 0
445 && settings.current_video != ""
446 && file_exists (settings.current_video)) {
447 restore_playlist ();
448
449 if (settings.last_stopped > 0) {
450 welcome.hide ();
451 clutter.show_all ();
452 open_file (settings.current_video);
453 video_player.playing = false;
454 Idle.add (() => {video_player.progress = settings.last_stopped; return false;});
455 video_player.playing = !settings.playback_wait;
456 }
457>>>>>>> MERGE-SOURCE
325 }458 }
326 }459 }
327460
@@ -369,7 +502,15 @@
369502
370503
371 }504 }
372505<<<<<<< TREE
506
507=======
508
509 public bool is_privacy_mode_enabled () {
510 var privacy_settings = new GLib.Settings ("org.gnome.desktop.privacy");
511 return privacy_settings.get_boolean ("remember-recent-files") || privacy_settings.get_boolean ("remember-app-usage");
512 }
513>>>>>>> MERGE-SOURCE
373 }514 }
374}515}
375516

Subscribers

People subscribed via source and target branches