Changeset 11040


Ignore:
Timestamp:
Jul 23, 2010, 7:10:02 PM (12 years ago)
Author:
charles
Message:

(trunk gtk) minor cleanup to last night's ComboBox? utilities

Location:
trunk/gtk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r11012 r11040  
    262262        if( i == n ) {
    263263            g_signal_handler_block( di->bandwidthCombo, di->bandwidthComboTag );
    264             gtr_priority_combo_set_value( di->bandwidthCombo, baseline );
     264            gtr_priority_combo_set_value( GTK_COMBO_BOX( di->bandwidthCombo ), baseline );
    265265            g_signal_handler_unblock( di->bandwidthCombo, di->bandwidthComboTag );
    266266        }
     
    419419
    420420static void
    421 onPriorityChanged( GtkComboBox * w, struct DetailsImpl * di )
    422 {
    423     const tr_priority_t priority = gtr_priority_combo_get_value( GTK_WIDGET( w ) );
     421onPriorityChanged( GtkComboBox * combo_box, struct DetailsImpl * di )
     422{
     423    const tr_priority_t priority = gtr_priority_combo_get_value( combo_box );
    424424    torrent_set_int( di, "bandwidthPriority", priority );
    425425}
  • trunk/gtk/msgwin.c

    r11038 r11040  
    5656
    5757static void
    58 level_combo_changed_cb( GtkWidget * w, gpointer gdata )
     58level_combo_changed_cb( GtkComboBox * combo_box, gpointer gdata )
    5959{
    6060    struct MsgData * data = gdata;
    61     const int level = gtr_combo_box_get_active_val( w );
     61    const int level = gtr_combo_box_get_active_enum( combo_box );
    6262
    6363    tr_setMessageLevel( level );
     
    366366                                            _( "Debug" ),       TR_MSG_DBG,
    367367                                            NULL );
    368     gtr_combo_box_set_active_val( w, pref_int_get( TR_PREFS_KEY_MSGLEVEL ) );
     368    gtr_combo_box_set_active_enum( GTK_COMBO_BOX( w ), pref_int_get( TR_PREFS_KEY_MSGLEVEL ) );
    369369    return w;
    370370}
  • trunk/gtk/tr-prefs.c

    r11038 r11040  
    449449
    450450static void
    451 onIntComboChanged( GtkComboBox * w, gpointer core )
    452 {
    453     const int val = gtr_combo_box_get_active_val( GTK_WIDGET( w ) );
    454     const char * key = g_object_get_data( G_OBJECT( w ), PREF_KEY );
     451onIntComboChanged( GtkComboBox * combo_box, gpointer core )
     452{
     453    const int val = gtr_combo_box_get_active_enum( combo_box );
     454    const char * key = g_object_get_data( G_OBJECT( combo_box ), PREF_KEY );
    455455    tr_core_set_pref_int( TR_CORE( core ), key, val );
    456456}
     
    463463                                            _( "Require encryption" ), TR_ENCRYPTION_REQUIRED,
    464464                                            NULL );
    465     gtr_combo_box_set_active_val( w, pref_int_get( key ) );
     465    gtr_combo_box_set_active_enum( GTK_COMBO_BOX( w ), pref_int_get( key ) );
    466466    g_object_set_data_full( G_OBJECT( w ), PREF_KEY, tr_strdup( key ), g_free );
    467467    g_signal_connect( w, "changed", G_CALLBACK( onIntComboChanged ), core );
     
    918918                                             "SOCKS5", TR_PROXY_SOCKS5,
    919919                                             NULL );
    920     gtr_combo_box_set_active_val( w, pref_int_get( key ) );
     920    gtr_combo_box_set_active_enum( GTK_COMBO_BOX( w ), pref_int_get( key ) );
    921921    g_object_set_data_full( G_OBJECT( w ), PREF_KEY, tr_strdup( key ), g_free );
    922922    g_signal_connect( w, "changed", G_CALLBACK( onIntComboChanged ), core );
     
    10841084                                            _( "Saturday" ),  TR_SCHED_SAT,
    10851085                                            NULL );
    1086     gtr_combo_box_set_active_val( w, pref_int_get( key ) );
     1086    gtr_combo_box_set_active_enum( GTK_COMBO_BOX( w ), pref_int_get( key ) );
    10871087    g_object_set_data_full( G_OBJECT( w ), PREF_KEY, tr_strdup( key ), g_free );
    10881088    g_signal_connect( w, "changed", G_CALLBACK( onIntComboChanged ), core );
  • trunk/gtk/util.c

    r11038 r11040  
    654654
    655655void
    656 gtr_combo_box_set_active_val( GtkWidget * w, int value )
     656gtr_combo_box_set_active_enum( GtkComboBox * combo_box, int value )
    657657{
    658658    int i;
     
    660660    const int column = 0;
    661661    GtkTreeIter iter;
    662     GtkComboBox * combobox = GTK_COMBO_BOX( w );
    663     GtkTreeModel * model = gtk_combo_box_get_model( combobox );
     662    GtkTreeModel * model = gtk_combo_box_get_model( combo_box );
    664663
    665664    /* do the value and current value match? */
    666     if( gtk_combo_box_get_active_iter( combobox, &iter ) ) {
     665    if( gtk_combo_box_get_active_iter( combo_box, &iter ) ) {
    667666        gtk_tree_model_get( model, &iter, column, &currentValue, -1 );
    668667        if( currentValue == value )
     
    675674        gtk_tree_model_get( model, &iter, column, &currentValue, -1 );
    676675        if( currentValue == value ) {
    677             gtk_combo_box_set_active_iter( combobox, &iter );
     676            gtk_combo_box_set_active_iter( combo_box, &iter );
    678677            return;
    679678        }
     
    714713
    715714int
    716 gtr_combo_box_get_active_val( GtkWidget * w )
     715gtr_combo_box_get_active_enum( GtkComboBox * combo_box )
    717716{
    718717    int value = 0;
    719718    GtkTreeIter iter;
    720     GtkComboBox * combo_box = GTK_COMBO_BOX( w );
    721719
    722720    if( gtk_combo_box_get_active_iter( combo_box, &iter ) )
  • trunk/gtk/util.h

    r11038 r11040  
    170170
    171171GtkWidget * gtr_priority_combo_new( void );
    172 #define gtr_priority_combo_get_value(w) gtr_combo_box_get_active_val(w)
    173 #define gtr_priority_combo_set_value(w,val) gtr_combo_box_set_active_val(w,val)
    174 
    175 GtkWidget * gtr_combo_box_new_enum( const char * text_1, ... );
    176 int gtr_combo_box_get_active_val( GtkWidget * w );
    177 void gtr_combo_box_set_active_val( GtkWidget * w, int value );
     172#define gtr_priority_combo_get_value(w)     gtr_combo_box_get_active_enum(w)
     173#define gtr_priority_combo_set_value(w,val) gtr_combo_box_set_active_enum(w,val)
     174
     175GtkWidget * gtr_combo_box_new_enum        ( const char * text_1, ... );
     176int         gtr_combo_box_get_active_enum ( GtkComboBox * );
     177void        gtr_combo_box_set_active_enum ( GtkComboBox *, int value );
    178178
    179179/***
Note: See TracChangeset for help on using the changeset viewer.