Changeset 7910


Ignore:
Timestamp:
Feb 18, 2009, 6:40:36 PM (13 years ago)
Author:
charles
Message:

(1.5x gtk) #1846: GTK client has no pause all / resume all buttons

Location:
branches/1.5x/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/1.5x/gtk/actions.c

    r7664 r7910  
    121121    { "pause-torrent", GTK_STOCK_MEDIA_PAUSE, N_( "_Pause" ), "<control>P", N_( "Pause torrent" ), G_CALLBACK( action_cb ) },
    122122    { "pause-all-torrents", GTK_STOCK_MEDIA_PAUSE, N_( "_Pause All" ), NULL, N_( "Pause all torrents" ), G_CALLBACK( action_cb ) },
     123    { "start-all-torrents", GTK_STOCK_MEDIA_PLAY, N_( "_Start All" ), NULL, N_( "Start all torrents" ), G_CALLBACK( action_cb ) },
    123124    { "remove-torrent", GTK_STOCK_REMOVE, NULL, "Delete", N_( "Remove torrent" ), G_CALLBACK( action_cb ) },
    124125    { "delete-torrent", GTK_STOCK_DELETE, N_( "_Delete Files and Remove" ), "<shift>Delete", NULL, G_CALLBACK( action_cb ) },
  • branches/1.5x/gtk/main.c

    r7767 r7910  
    209209refreshTorrentActions( struct cbdata * data )
    210210{
    211     int                canUpdate;
     211    int canUpdate;
    212212    struct counts_data counts;
    213213    GtkTreeSelection * s = data->sel;
     
    232232        GtkTreeView *  view = gtk_tree_selection_get_tree_view( s );
    233233        GtkTreeModel * model = gtk_tree_view_get_model( view );
    234         const int  torrentCount = gtk_tree_model_iter_n_children( model, NULL ) != 0;
     234        const int torrentCount = gtk_tree_model_iter_n_children( model, NULL ) != 0;
    235235        action_sensitize( "select-all", torrentCount != 0 );
    236236        action_sensitize( "deselect-all", torrentCount != 0 );
     
    239239    {
    240240        tr_session * session = tr_core_session( data->core );
    241         int activeCount = tr_sessionGetActiveTorrentCount( session );
    242         action_sensitize( "pause-all-torrents", activeCount != 0 );
     241        const int active = tr_sessionGetActiveTorrentCount( session );
     242        const int total = tr_sessionCountTorrents( session );
     243        action_sensitize( "pause-all-torrents", active != 0 );
     244        action_sensitize( "start-all-torrents", active != total );
    243245    }
    244246}
     
    13771379
    13781380static void
     1381startAllTorrents( struct cbdata * data )
     1382{
     1383    tr_session * session = tr_core_session( data->core );
     1384    const char * cmd = "{ \"method\": \"torrent-start\" }";
     1385    tr_rpc_request_exec_json( session, cmd, strlen( cmd ), NULL, NULL );
     1386}
     1387
     1388static void
    13791389pauseAllTorrents( struct cbdata * data )
    13801390{
     
    14091419    {
    14101420        pauseAllTorrents( data );
     1421    }
     1422    else if( !strcmp( action_name, "start-all-torrents" ) )
     1423    {
     1424        startAllTorrents( data );
    14111425    }
    14121426    else if( !strcmp( action_name, "pause-torrent" ) )
  • branches/1.5x/gtk/ui.h

    r7664 r7910  
    1515    "      <menuitem action='remove-torrent'/>\n"
    1616    "      <menuitem action='delete-torrent'/>\n"
     17    "      <separator/>\n"
     18    "      <menuitem action='start-all-torrents'/>\n"
     19    "      <menuitem action='pause-all-torrents'/>\n"
    1720    "      <separator/>\n"
    1821    "      <menuitem action='quit'/>\n"
     
    7982    "    <menuitem action='show-about-dialog'/>\n"
    8083    "    <separator/>\n"
     84    "    <menuitem action='start-all-torrents'/>\n"
    8185    "    <menuitem action='pause-all-torrents'/>\n"
    8286    "    <separator/>\n"
Note: See TracChangeset for help on using the changeset viewer.