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

Proposed by Artem Anufrij on 2015-10-15
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 code 2015-10-15 Needs Fixing on 2015-10-16
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.
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.

Daniel Fore (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.

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 on 2014-11-11

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

459. By artem-anufrij on 2014-11-11

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
1=== modified file 'src/Audience.vala'
2--- src/Audience.vala 2015-09-21 18:26:27 +0000
3+++ src/Audience.vala 2015-10-15 21:57:54 +0000
4@@ -234,6 +234,107 @@
5 default:
6 break;
7 }
8+<<<<<<< TREE
9+=======
10+
11+ return true;
12+ }
13+
14+ private void on_configure_window (uint video_w, uint video_h) {
15+ Gdk.Rectangle monitor;
16+ var screen = Gdk.Screen.get_default ();
17+ screen.get_monitor_geometry (screen.get_monitor_at_window (mainwindow.get_window ()), out monitor);
18+
19+ int width = 0, height = 0;
20+ if (monitor.width > video_w && monitor.height > video_h) {
21+ width = (int)video_w;
22+ height = (int)video_h;
23+ } else {
24+ width = (int)(monitor.width * 0.9);
25+ height = (int)((double)video_h / video_w * width);
26+ }
27+
28+ mainwindow.get_window ().move_resize (monitor.width / 2 - width / 2 + monitor.x,
29+ monitor.height / 2 - height / 2 + monitor.y,
30+ width, height);
31+
32+ if (settings.keep_aspect) {
33+ var geom = Gdk.Geometry ();
34+ geom.min_aspect = geom.max_aspect = video_w / (double)video_h;
35+ mainwindow.get_window ().set_geometry_hints (geom, Gdk.WindowHints.ASPECT);
36+ }
37+ }
38+
39+ private void on_window_state_changed (Gdk.WindowState window_state) {
40+ bool currently_maximized = (window_state & Gdk.WindowState.MAXIMIZED) == 0;
41+
42+ if (!currently_maximized && !fullscreened && !welcome.is_visible ()) {
43+ mainwindow.fullscreen ();
44+ fullscreened = true;
45+ }
46+ }
47+
48+ /*DnD*/
49+ private void setup_drag_n_drop () {
50+ Gtk.TargetEntry uris = {"text/uri-list", 0, 0};
51+ Gtk.drag_dest_set (mainwindow, Gtk.DestDefaults.ALL, {uris}, Gdk.DragAction.MOVE);
52+ mainwindow.drag_data_received.connect ( (ctx, x, y, sel, info, time) => {
53+ foreach (var uri in sel.get_uris ()) {
54+ open_file (uri);
55+ }
56+
57+ welcome.hide ();
58+ clutter.show_all ();
59+ });
60+ }
61+
62+ private void on_destroy () {
63+
64+ if (is_privacy_mode_enabled ()) {
65+ clear_video_settings ();
66+ return;
67+ }
68+
69+ if (video_player.uri.has_prefix ("dvd://")) {
70+ clear_video_settings ();
71+ return;
72+ }
73+
74+ if (video_player.uri == null || video_player.uri == "")
75+ return;
76+
77+ save_last_played_videos ();
78+ }
79+
80+ private int old_h = - 1;
81+ private int old_w = - 1;
82+ private void on_size_allocate (Gtk.Allocation alloc) {
83+ if (alloc.width != old_w || alloc.height != old_h) {
84+ if (video_player.relayout ()) {
85+ old_w = alloc.width;
86+ old_h = alloc.height;
87+ }
88+ }
89+ }
90+
91+ private bool update_pointer_position (double y, int window_height) {
92+ allocate_bottombar ();
93+ mainwindow.get_window ().set_cursor (null);
94+ if (bottom_bar_size == 0) {
95+ int minimum = 0;
96+ bottom_bar.get_preferred_height (out minimum, out bottom_bar_size);
97+ }
98+
99+ if (bottom_bar.child_revealed == false)
100+ bottom_bar.set_reveal_child (true);
101+
102+ if (y >= (window_height - bottom_bar_size) && y < window_height) {
103+ bottom_bar.hovered = true;
104+ } else {
105+ bottom_bar.hovered = false;
106+ }
107+
108+>>>>>>> MERGE-SOURCE
109 return false;
110 }
111
112@@ -241,8 +342,18 @@
113 settings.last_stopped = 0;
114 settings.last_played_videos = null;
115 settings.current_video = "";
116- }
117-
118+ settings.last_folder = "";
119+ }
120+
121+<<<<<<< TREE
122+=======
123+ private void restore_playlist () {
124+ foreach (var filename in settings.last_played_videos) {
125+ playlist.add_item (File.new_for_uri (filename));
126+ }
127+ }
128+
129+>>>>>>> MERGE-SOURCE
130 public void run_open_file () {
131 var file = new Gtk.FileChooserDialog (_("Open"), mainwindow, Gtk.FileChooserAction.OPEN,
132 _("_Cancel"), Gtk.ResponseType.CANCEL, _("_Open"), Gtk.ResponseType.ACCEPT);
133@@ -320,8 +431,30 @@
134 }
135
136 public override void activate () {
137+<<<<<<< TREE
138 if (mainwindow == null) {
139 build ();
140+=======
141+ build ();
142+
143+ if (is_privacy_mode_enabled ())
144+ return;
145+
146+ if (settings.resume_videos == true
147+ && settings.last_played_videos.length > 0
148+ && settings.current_video != ""
149+ && file_exists (settings.current_video)) {
150+ restore_playlist ();
151+
152+ if (settings.last_stopped > 0) {
153+ welcome.hide ();
154+ clutter.show_all ();
155+ open_file (settings.current_video);
156+ video_player.playing = false;
157+ Idle.add (() => {video_player.progress = settings.last_stopped; return false;});
158+ video_player.playing = !settings.playback_wait;
159+ }
160+>>>>>>> MERGE-SOURCE
161 }
162 }
163
164@@ -369,7 +502,15 @@
165
166
167 }
168-
169+<<<<<<< TREE
170+
171+=======
172+
173+ public bool is_privacy_mode_enabled () {
174+ var privacy_settings = new GLib.Settings ("org.gnome.desktop.privacy");
175+ return privacy_settings.get_boolean ("remember-recent-files") || privacy_settings.get_boolean ("remember-app-usage");
176+ }
177+>>>>>>> MERGE-SOURCE
178 }
179 }
180

Subscribers

People subscribed via source and target branches