Changeset 5219


Ignore:
Timestamp:
Mar 7, 2008, 7:10:08 PM (14 years ago)
Author:
charles
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/notify.c

    r5187 r5219  
    3636    tr_torrent * tor = tr_torrent_handle( gtor );
    3737    const tr_info * info = tr_torrent_info( gtor );
     38    char * path = NULL;
    3839
    3940    if( !strcmp( action, "folder" ) )
    4041    {
    41         char * folder = g_build_filename( tr_torrentGetFolder(tor), info->name, NULL );
    42         char * argv[] = { "xdg-open", folder, NULL };
    43         g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL );
    44         g_free( folder );
     42        if( info->fileCount == 1 )
     43        {
     44            path = g_build_filename( tr_torrentGetFolder(tor), NULL );
     45        }
     46        else
     47        {
     48            path = g_build_filename( tr_torrentGetFolder(tor), info->name, NULL );
     49        }
    4550    }
    4651    else if( !strcmp( action, "file" ) )
    47     {
    48         char * path = g_build_filename( tr_torrentGetFolder(tor), info->files[0].name, NULL );
     52    {
     53        path = g_build_filename( tr_torrentGetFolder(tor), info->files[0].name, NULL );
     54    }
     55
     56    if( path )
     57    {
    4958        char * argv[] = { "xdg-open", path, NULL };
    5059        g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL );
    5160        g_free( path );
    52     } 
     61    }
    5362}
    5463
Note: See TracChangeset for help on using the changeset viewer.