Changeset 5583
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/actions.c
r5536 r5583 102 102 { "help-menu", NULL, N_("_Help"), NULL, NULL, NULL }, 103 103 { "add-torrent-toolbar", GTK_STOCK_ADD, NULL, NULL, N_("Add a torrent"), G_CALLBACK(action_cb) }, 104 { "add-torrent-menu", GTK_STOCK_ADD, N_("_Add..."), NULL, N_("Add a torrent"), G_CALLBACK(action_cb) },104 { "add-torrent-menu", GTK_STOCK_ADD, N_("_Add..."), "<control>D", N_("Add a torrent"), G_CALLBACK(action_cb) }, 105 105 { "start-torrent", GTK_STOCK_MEDIA_PLAY, 106 106 N_("_Start"), "<control>S", N_("Start torrent"), G_CALLBACK(action_cb) }, … … 126 126 { "show-torrent-details", GTK_STOCK_INFO, 127 127 N_("_Details"), "<alt>Return", N_("Torrent details"), G_CALLBACK(action_cb) }, 128 { "open-torrent-folder", GTK_STOCK_OPEN, 129 N_("_Open Folder"), NULL, NULL, G_CALLBACK(action_cb) }, 128 130 { "show-about-dialog", GTK_STOCK_ABOUT, NULL, NULL, NULL, G_CALLBACK(action_cb) }, 129 131 { "update-tracker", GTK_STOCK_NETWORK, -
trunk/gtk/main.c
r5517 r5583 200 200 action_sensitize( "delete-torrent", counts.totalCount!=0 ); 201 201 action_sensitize( "verify-torrent", counts.totalCount!=0 ); 202 action_sensitize( "open-torrent-folder", counts.totalCount==1 ); 202 203 action_sensitize( "show-torrent-details", counts.totalCount==1 ); 203 204 … … 936 937 937 938 static void 939 openFolderForeach( GtkTreeModel * model, 940 GtkTreePath * path UNUSED, 941 GtkTreeIter * iter, 942 gpointer user_data UNUSED ) 943 { 944 TrTorrent * gtor = NULL; 945 gtk_tree_model_get( model, iter, MC_TORRENT, >or, -1 ); 946 tr_torrent_open_folder( gtor ); 947 g_object_unref( G_OBJECT( gtor ) ); 948 } 949 950 static void 938 951 showInfoForeach (GtkTreeModel * model, 939 952 GtkTreePath * path UNUSED, … … 1040 1053 gtk_tree_selection_selected_foreach( s, recheckTorrentForeach, NULL ); 1041 1054 changed |= gtk_tree_selection_count_selected_rows( s ) != 0; 1055 } 1056 else if (!strcmp (action_name, "open-torrent-folder")) 1057 { 1058 GtkTreeSelection * s = tr_window_get_selection(data->wind); 1059 gtk_tree_selection_selected_foreach( s, openFolderForeach, data ); 1042 1060 } 1043 1061 else if (!strcmp (action_name, "show-torrent-details")) -
trunk/gtk/notify.c
r5231 r5583 16 16 #include <glib/gi18n.h> 17 17 #include "notify.h" 18 #include "util.h" 18 19 19 20 #ifndef HAVE_LIBNOTIFY … … 37 38 { 38 39 TrTorrent * gtor = TR_TORRENT( gdata ); 39 tr_torrent * tor = tr_torrent_handle( gtor );40 const tr_info * info = tr_torrent_info( gtor );41 char * path = NULL;42 40 43 41 if( !strcmp( action, "folder" ) ) 44 42 { 45 if( info->fileCount == 1 ) 46 { 47 path = g_build_filename( tr_torrentGetFolder(tor), NULL ); 48 } 49 else 50 { 51 path = g_build_filename( tr_torrentGetFolder(tor), info->name, NULL ); 52 } 43 tr_torrent_open_folder( gtor ); 53 44 } 54 45 else if( !strcmp( action, "file" ) ) 55 46 { 56 path = g_build_filename( tr_torrentGetFolder(tor), info->files[0].name, NULL ); 57 } 58 59 if( path ) 60 { 61 gboolean opened = FALSE; 62 #ifdef HAVE_GIO 63 GFile * file = g_file_new_for_path( path ); 64 char * uri = g_file_get_uri( file ); 65 opened = g_app_info_launch_default_for_uri( uri, NULL, NULL ); 66 g_free( uri ); 67 g_object_unref( G_OBJECT( file ) ); 68 #endif 69 if( !opened ) { 70 char * argv[] = { "xdg-open", path, NULL }; 71 g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL ); 72 } 73 g_free( path ); 47 tr_torrent * tor = tr_torrent_handle( gtor ); 48 const tr_info * info = tr_torrent_info( gtor ); 49 char * path = g_build_filename( tr_torrentGetFolder(tor), info->files[0].name, NULL ); 50 gtr_open_file( path ); 51 g_free( path ); 74 52 } 75 53 } -
trunk/gtk/tr-torrent.c
r5539 r5583 345 345 } 346 346 } 347 348 void 349 tr_torrent_open_folder( TrTorrent * gtor ) 350 { 351 tr_torrent * tor = tr_torrent_handle( gtor ); 352 const tr_info * info = tr_torrent_info( gtor ); 353 char * path = info->fileCount == 1 354 ? g_build_filename( tr_torrentGetFolder(tor), NULL ) 355 : g_build_filename( tr_torrentGetFolder(tor), info->name, NULL ); 356 gtr_open_file( path ); 357 g_free( path ); 358 } -
trunk/gtk/tr-torrent.h
r5122 r5583 81 81 82 82 void 83 tr_torrent_open_folder( TrTorrent * tor ); 84 85 void 83 86 tr_torrent_check_seeding_cap ( TrTorrent* ); 84 87 void -
trunk/gtk/ui.h
r5536 r5583 6 6 " <menuitem action='new-torrent'/>\n" 7 7 " <separator/>\n" 8 " <menuitem action='show-torrent-details'/>\n" 9 " <menuitem action='open-torrent-folder'/>\n" 10 " <separator/>\n" 8 11 " <menuitem action='start-torrent'/>\n" 9 12 " <menuitem action='update-tracker'/>\n" 10 13 " <menuitem action='pause-torrent'/>\n" 11 14 " <menuitem action='verify-torrent'/>\n" 12 " <menuitem action='show-torrent-details'/>\n"13 15 " <menuitem action='remove-torrent'/>\n" 14 16 " <menuitem action='delete-torrent'/>\n" … … 58 60 " <popup name='main-window-popup'>\n" 59 61 " <menuitem action='show-torrent-details'/>\n" 62 " <menuitem action='open-torrent-folder'/>\n" 60 63 " <separator/>\n" 61 64 " <menuitem action='start-torrent'/>\n" -
trunk/gtk/util.c
r5313 r5583 437 437 } 438 438 } 439 440 void 441 gtr_open_file( const char * path ) 442 { 443 if( path ) 444 { 445 gboolean opened = FALSE; 446 #ifdef HAVE_GIO 447 if( !opened ) 448 { 449 GFile * file = g_file_new_for_path( path ); 450 char * uri = g_file_get_uri( file ); 451 opened = g_app_info_launch_default_for_uri( uri, NULL, NULL ); 452 g_free( uri ); 453 g_object_unref( G_OBJECT( file ) ); 454 } 455 #endif 456 if( !opened ) 457 { 458 char * argv[] = { "xdg-open", (char*)path, NULL }; 459 g_spawn_async( NULL, argv, NULL, G_SPAWN_SEARCH_PATH, 460 NULL, NULL, NULL, NULL ); 461 } 462 } 463 } -
trunk/gtk/util.h
r5276 r5583 84 84 getdownloaddir( void ); 85 85 86 void gtr_open_file( const char * path ); 87 86 88 #ifdef GTK_MAJOR_VERSION 87 89
Note: See TracChangeset
for help on using the changeset viewer.