Skip to content

Commit

Permalink
[desktop] show video thumbnails on desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnorantGuru committed Nov 10, 2015
1 parent 034aaf9 commit 4484467
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 7 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -12,6 +12,7 @@
refresh now refreshes all tabs open to dir #582
new run-task socket task type refresh to refresh tabs or dirs #582
current device name and more total size info in status bar #582
[desktop] show video thumbnails on desktop
1.0.4 2015-10-17:
new spacefm-installer replaces self-extrct and install #571
README rewritten and manual updated for new installer #571
Expand Down
45 changes: 40 additions & 5 deletions src/desktop/desktop-window.c
Expand Up @@ -868,10 +868,22 @@ void desktop_window_set_icon_size( DesktopWindow* win, int size )
gtk_icon_theme_get_default(),
"folder-home", size, 0, NULL );
}
else if( vfs_file_info_is_image( fi ) && ! fi->big_thumbnail )
{
else if ( /* app_settings.show_thumbnail && */ !fi->big_thumbnail && (
#ifdef HAVE_FFMPEG
vfs_file_info_is_video( fi ) ||
#endif
( fi->size < app_settings.max_thumb_size &&
vfs_file_info_is_image( fi ) ) ) )
vfs_thumbnail_loader_request( win->dir, fi, TRUE );
/* thumbnails are always shown on the desktop
else if ( !app_settings.show_thumbnail )
{
vfs_thumbnail_loader_cancel_all_requests( win->dir, TRUE );
// Thumbnails are being disabled so ensure the large thumbnails are
// freed - with up to 256x256 images this is a lot of memory
vfs_dir_unload_thumbnails(win->dir, TRUE );
}
*/
}
}

Expand Down Expand Up @@ -2991,7 +3003,13 @@ void on_file_listed( VFSDir* dir, gboolean is_cancelled, DesktopWindow* self )
}
else
items = g_list_prepend( items, item );
if ( vfs_file_info_is_image( fi ) )

if ( /* app_settings.show_thumbnail && */ (
#ifdef HAVE_FFMPEG
vfs_file_info_is_video( fi ) ||
#endif
( fi->size < app_settings.max_thumb_size &&
vfs_file_info_is_image( fi ) ) ) )
vfs_thumbnail_loader_request( dir, fi, TRUE );
}
g_mutex_unlock( dir->mutex );
Expand Down Expand Up @@ -3080,8 +3098,14 @@ void on_file_created( VFSDir* dir, VFSFileInfo* file, gpointer user_data )

item = g_slice_new0( DesktopItem );
item->fi = vfs_file_info_ref( file );
if ( !item->fi->big_thumbnail && vfs_file_info_is_image( item->fi ) )
vfs_thumbnail_loader_request( dir, item->fi, TRUE );

if ( /* app_settings.show_thumbnail && */ !item->fi->big_thumbnail && (
#ifdef HAVE_FFMPEG
vfs_file_info_is_video( item->fi ) ||
#endif
( item->fi->size < app_settings.max_thumb_size &&
vfs_file_info_is_image( item->fi ) ) ) )
vfs_thumbnail_loader_request( dir, item->fi, TRUE );

GCompareDataFunc comp_func = get_sort_func( self );
if ( comp_func )
Expand Down Expand Up @@ -3240,6 +3264,17 @@ void on_file_changed( VFSDir* dir, VFSFileInfo* file, gpointer user_data )
if ( !item->fi->big_thumbnail && vfs_file_info_is_image( item->fi ) )
vfs_thumbnail_loader_request( dir, item->fi, TRUE );

/* check if reloading of thumbnail is needed.
* See also ptk-file-list.c:_ptk_file_list_file_changed() */
if ( /* app_settings.show_thumbnail && */ !item->fi->big_thumbnail && (
#ifdef HAVE_FFMPEG
( vfs_file_info_is_video( item->fi ) &&
time( NULL ) - *vfs_file_info_get_mtime( item->fi ) > 5 ) ||
#endif
( item->fi->size < app_settings.max_thumb_size
&& vfs_file_info_is_image( item->fi ) ) ) )
vfs_thumbnail_loader_request( dir, item->fi, TRUE );

if( gtk_widget_get_visible( w ) )
{
/* redraw the item */
Expand Down
4 changes: 3 additions & 1 deletion src/main-window.c
Expand Up @@ -1307,7 +1307,9 @@ void main_window_toggle_thumbnails_all_windows()
}
}

fm_desktop_update_thumbnails();

// thumbnails are always shown on the desktop
//fm_desktop_update_icons();

/* Ensuring free space at the end of the heap is freed to the OS,
* mainly to deal with the possibility thousands of large thumbnails
Expand Down
2 changes: 2 additions & 0 deletions src/pref-dialog.c
Expand Up @@ -515,6 +515,8 @@ static void on_response( GtkDialog* dlg, int response, FMPrefDlg* user_data )
app_settings.max_thumb_size = max_thumb;
// update all windows/all panels/all browsers + desktop
main_window_toggle_thumbnails_all_windows();
// thumbnails are always shown on the desktop
//fm_desktop_update_icons();
}

/* icon sizes are changed? */
Expand Down
3 changes: 2 additions & 1 deletion src/ptk/ptk-file-list.c
Expand Up @@ -276,7 +276,8 @@ static void _ptk_file_list_file_changed( VFSDir* dir, VFSFileInfo* file,
return;
}

/* check if reloading of thumbnail is needed. */
/* check if reloading of thumbnail is needed.
* See also desktop-window.c:on_file_changed() */
if ( list->max_thumbnail != 0 && (
#ifdef HAVE_FFMPEG
( vfs_file_info_is_video( file ) &&
Expand Down

0 comments on commit 4484467

Please sign in to comment.