Ticket #4607: gtk-expand-less.patch

File gtk-expand-less.patch, 2.9 KB (added by jauthu, 11 years ago)
  • gtk/conf.c

     
    114114    tr_bencDictAddStr( d, PREF_KEY_SORT_MODE, "sort-by-name" );
    115115    tr_bencDictAddBool( d, PREF_KEY_SORT_REVERSED, FALSE );
    116116    tr_bencDictAddBool( d, PREF_KEY_COMPACT_VIEW, FALSE );
     117
     118    tr_bencDictAddBool( d, PREF_KEY_EXPAND_LESS_IN_FILE_TREE, FALSE );
    117119}
    118120
    119121static char*
  • gtk/tr-prefs.c

     
    360360    g_signal_connect( w, "toggled", G_CALLBACK( target_cb ), w2 );
    361361    hig_workarea_add_row_w( t, &row, w, w2, NULL );
    362362
     363    hig_workarea_add_section_divider( t, &row );
     364    hig_workarea_add_section_title( t, &row, _( "Miscellaneous" ) );
     365
     366    s = _( "Expand _less in file tree" );
     367    w = new_check_button( s, PREF_KEY_EXPAND_LESS_IN_FILE_TREE, core );
     368    hig_workarea_add_wide_control( t, &row, w );
     369
     370
    363371    hig_workarea_finish( t, &row );
    364372    return t;
    365373}
  • gtk/tr-prefs.h

     
    5050#define PREF_KEY_TORRENT_COMPLETE_SOUND_ENABLED          "torrent-complete-sound-enabled"
    5151#define PREF_KEY_TRASH_CAN_ENABLED                       "trash-can-enabled"
    5252#define PREF_KEY_USER_HAS_GIVEN_INFORMED_CONSENT         "user-has-given-informed-consent"
     53#define PREF_KEY_EXPAND_LESS_IN_FILE_TREE                "expand-less-in-file-tree"
    5354
    5455enum
    5556{
  • gtk/file-list.c

     
    1919#include <libtransmission/transmission.h>
    2020#include <libtransmission/utils.h>
    2121
     22#include "conf.h"
    2223#include "file-list.h"
    2324#include "hig.h"
    2425#include "icons.h"
     
    173174            int child_priority;
    174175            int64_t child_have, child_size;
    175176
     177
    176178            gtk_tree_model_get( model, &child, FC_SIZE, &child_size,
    177179                                               FC_HAVE, &child_have,
    178180                                               FC_PRIORITY, &child_priority,
     
    566568    }
    567569
    568570    gtk_tree_view_set_model( GTK_TREE_VIEW( data->view ), data->model );
    569     gtk_tree_view_expand_all( GTK_TREE_VIEW( data->view ) );
     571    if ( gtr_pref_flag_get( PREF_KEY_EXPAND_LESS_IN_FILE_TREE ) )
     572    {
     573        GtkTreePath* tree_path = gtk_tree_path_new_first();
     574        gtk_tree_view_expand_row( GTK_TREE_VIEW( data->view ), tree_path, FALSE );
     575    }
     576    else
     577    {
     578        gtk_tree_view_expand_all( GTK_TREE_VIEW( data->view ) );
     579    }
     580
    570581    g_object_unref( data->model );
    571582}
    572583
     
    911922    gtr_file_list_set_torrent( ret, torrentId );
    912923
    913924    pango_font_description_free( pango_font_description );
     925
    914926    return ret;
    915927}