238
238
(int)event.x_root, (int)event.y_root, event.time);
241
return update_pointer_position (event.y, event.window.get_height ());
241
Gtk.Allocation allocation;
242
clutter.get_allocation (out allocation);
243
return update_pointer_position (event.y, allocation.height);
244
246
bottom_bar.time_widget.slider_motion_event.connect ((event) => {
246
248
bottom_bar.translate_coordinates (mainwindow, (int)event.x, (int)event.y, out x, out y);
247
update_pointer_position (y, mainwindow.get_window ().get_height ());
249
Gtk.Allocation allocation;
250
clutter.get_allocation (out allocation);
251
update_pointer_position (y, allocation.height);
250
254
mainwindow.button_press_event.connect ((event) => {
268
272
mainwindow.leave_notify_event.connect ((event) => {
269
273
if (event.window == null)
276
Gtk.Allocation allocation;
277
clutter.get_allocation (out allocation);
271
278
if (event.x == event.window.get_width ())
272
return update_pointer_position (event.window.get_height (), event.window.get_height ());
279
return update_pointer_position (event.window.get_height (), allocation.height);
273
280
else if (event.x == 0)
274
return update_pointer_position (event.window.get_height (), event.window.get_height ());
275
return update_pointer_position (event.y, event.window.get_height ());
281
return update_pointer_position (event.window.get_height (), allocation.height);
282
return update_pointer_position (event.y, allocation.height);
278
this.mainwindow.key_press_event.connect ( (e) => {
285
this.mainwindow.key_press_event.connect ((e) => {
279
286
return on_key_press_event (e);
283
290
mainwindow.destroy.connect (() => {on_destroy ();});
285
292
//playlist wants us to open a file
286
playlist.play.connect ( (file) => {
293
playlist.play.connect ((file) => {
287
294
this.play_file (file.get_uri ());
298
stage.notify["allocation"].connect (() => {
299
bottom_actor.width = stage.get_width ();
300
bottom_bar.queue_resize ();
301
bottom_actor.y = stage.get_height () - bottom_bar_size;
302
unfullscreen_actor.y = 6;
303
unfullscreen_actor.x = stage.get_width () - bottom_bar_size - 6;
305
stage.notify["allocation"].connect (() => {allocate_bottombar ();});
306
if (settings.resume_videos) {
307
if (settings.resume_videos == true && settings.last_played_videos.length > 0) {
307
310
foreach (var filename in settings.last_played_videos) {
308
var file = File.new_for_commandline_arg (filename);
309
playlist.add_item (file);
311
open_file (filename);
314
video_player.playing = false;
315
video_player.progress = settings.last_stopped;
316
video_player.playing = true;
320
private void allocate_bottombar () {
321
bottom_actor.width = stage.get_width ();
322
bottom_bar.queue_resize ();
323
bottom_actor.y = stage.get_height () - bottom_bar_size;
324
unfullscreen_actor.y = 6;
325
unfullscreen_actor.x = stage.get_width () - bottom_bar_size - 6;
314
328
private void setup_welcome_screen () {
315
329
welcome = new Granite.Widgets.Welcome (_("No Videos Open"), _("Select a source to begin playing."));
316
330
welcome.append ("document-open", _("Open file"), _("Open a saved file."));
318
332
//welcome.append ("internet-web-browser", _("Open a location"), _("Watch something from the infinity of the internet"));
319
333
var filename = settings.last_played_videos.length > 0 ? settings.last_played_videos[0] : "";
320
var last_file = File.new_for_uri (filename);
334
var last_file = File.new_for_path (filename);
321
335
welcome.append ("media-playback-start", _("Resume last video"), get_title (last_file.get_basename ()));
322
336
bool show_last_file = settings.last_played_videos.length > 0;
323
337
if (last_file.query_exists () == false) {
496
510
if (video_player.uri == null || video_player.uri == "" || video_player.uri.has_prefix ("dvd://"))
498
512
if (!video_player.at_end) {
499
/*for (var i = 0; i < last_played_videos.length (); i += 2){
500
if (video_player.uri == last_played_videos.nth_data (i)){
501
last_played_videos.nth (i+1).data = video_player.progress.to_string ();
502
save_last_played_videos ();
507
//not in list yet, insert at start
508
last_played_videos.insert (video_player.uri, 0);
509
last_played_videos.insert (video_player.progress.to_string (), 1);
510
if (last_played_videos.length () > 10) {
511
last_played_videos.delete_link (last_played_videos.nth (10));
512
last_played_videos.delete_link (last_played_videos.nth (11));
514
513
save_last_played_videos ();
536
536
if (bottom_bar.child_revealed == false)
537
537
bottom_bar.set_reveal_child (true);
539
if (y >= window_height - bottom_bar_size && y < window_height) {
539
if (y >= (window_height - bottom_bar_size) && y < window_height) {
540
540
bottom_bar.hovered = true;
542
542
bottom_bar.hovered = false;
588
588
private async void read_first_disk () {
589
589
var disk_manager = DiskManager.get_default ();
590
if (disk_manager.get_volumes ().length () <= 0)
590
592
var volume = disk_manager.get_volumes ().nth_data (0);
591
593
if (volume.can_mount () == true && volume.get_mount ().can_unmount () == false) {
621
624
Audience.recurse_over_dir (file, (file_ret) => {
622
625
playlist.add_item (file_ret);
624
628
file = playlist.get_first_item ();
625
629
} else if (is_subtitle (filename) && video_player.playing) {
626
630
video_player.set_subtitle_uri (filename);
628
631
} else if (video_player.playing == true) {
629
632
playlist.add_item (file);