1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

(gtk) tweak the notification `open' actions (wereHamster)

This commit is contained in:
Charles Kerr 2008-03-07 19:10:08 +00:00
parent 414b8168d9
commit 0578a024ad

View file

@ -35,17 +35,26 @@ notifyCallback( NotifyNotification * n UNUSED,
TrTorrent * gtor = TR_TORRENT( gdata ); TrTorrent * gtor = TR_TORRENT( gdata );
tr_torrent * tor = tr_torrent_handle( gtor ); tr_torrent * tor = tr_torrent_handle( gtor );
const tr_info * info = tr_torrent_info( gtor ); const tr_info * info = tr_torrent_info( gtor );
char * path = NULL;
if( !strcmp( action, "folder" ) ) if( !strcmp( action, "folder" ) )
{ {
char * folder = g_build_filename( tr_torrentGetFolder(tor), info->name, NULL ); if( info->fileCount == 1 )
char * argv[] = { "xdg-open", folder, NULL }; {
g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL ); path = g_build_filename( tr_torrentGetFolder(tor), NULL );
g_free( folder ); }
else
{
path = g_build_filename( tr_torrentGetFolder(tor), info->name, NULL );
}
} }
else if( !strcmp( action, "file" ) ) else if( !strcmp( action, "file" ) )
{ {
char * path = g_build_filename( tr_torrentGetFolder(tor), info->files[0].name, NULL ); path = g_build_filename( tr_torrentGetFolder(tor), info->files[0].name, NULL );
}
if( path )
{
char * argv[] = { "xdg-open", path, NULL }; char * argv[] = { "xdg-open", path, NULL };
g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL ); g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL );
g_free( path ); g_free( path );