mirror of
https://github.com/transmission/transmission
synced 2024-12-24 08:43:27 +00:00
(gtk) tweak the notification `open' actions (wereHamster)
This commit is contained in:
parent
414b8168d9
commit
0578a024ad
1 changed files with 16 additions and 7 deletions
19
gtk/notify.c
19
gtk/notify.c
|
@ -35,17 +35,26 @@ notifyCallback( NotifyNotification * n UNUSED,
|
|||
TrTorrent * gtor = TR_TORRENT( gdata );
|
||||
tr_torrent * tor = tr_torrent_handle( gtor );
|
||||
const tr_info * info = tr_torrent_info( gtor );
|
||||
char * path = NULL;
|
||||
|
||||
if( !strcmp( action, "folder" ) )
|
||||
{
|
||||
char * folder = g_build_filename( tr_torrentGetFolder(tor), info->name, NULL );
|
||||
char * argv[] = { "xdg-open", folder, NULL };
|
||||
g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL );
|
||||
g_free( folder );
|
||||
if( info->fileCount == 1 )
|
||||
{
|
||||
path = g_build_filename( tr_torrentGetFolder(tor), NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
path = g_build_filename( tr_torrentGetFolder(tor), info->name, NULL );
|
||||
}
|
||||
}
|
||||
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 };
|
||||
g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL );
|
||||
g_free( path );
|
||||
|
|
Loading…
Reference in a new issue