Changeset 8283


Ignore:
Timestamp:
Apr 25, 2009, 2:08:40 PM (13 years ago)
Author:
charles
Message:

(gtk) fix a couple of new gtk bugs reported by Rolcol

Location:
trunk/gtk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r8282 r8283  
    6161    guint seedCustomRadioTag;
    6262    guint seedCustomSpinTag;
     63    guint maxPeersSpinTag;
    6364
    6465    GtkWidget * state_lb;
     
    321322    if( n ) {
    322323        const double baseline = tr_torrentGetRatioLimit( torrents[0] );
    323         int i;
    324         for( i=1; i<n; ++i )
    325             if( (int)(100*baseline) != (int)(100*tr_torrentGetRatioLimit(torrents[i])) )
    326                 break;
    327         if( i == n )
    328             set_double_spin_if_different( di->seedCustomSpin,
    329                                           di->seedCustomSpinTag, baseline );
     324        set_double_spin_if_different( di->seedCustomSpin,
     325                                      di->seedCustomSpinTag, baseline );
     326    }
     327
     328    /* maxPeersSpin */
     329    if( n ) {
     330        const int baseline = tr_torrentGetPeerLimit( torrents[0] );
     331        set_int_spin_if_different( di->maxPeersSpin,
     332                                   di->maxPeersSpinTag, baseline );
    330333    }
    331334}
     
    611614    w = gtk_spin_button_new_with_range( 1, 3000, 5 );
    612615    hig_workarea_add_row( t, &row, _( "_Maximum peers:" ), w, w );
    613     g_signal_connect( w, "value-changed", G_CALLBACK( max_peers_spun_cb ), d );
     616    tag = g_signal_connect( w, "value-changed", G_CALLBACK( max_peers_spun_cb ), d );
    614617    d->maxPeersSpin = w;
     618    d->maxPeersSpinTag = tag;
    615619
    616620    hig_workarea_finish( t, &row );
  • trunk/gtk/main.c

    r8279 r8283  
    205205    action_sensitize( "verify-torrent", counts.totalCount != 0 );
    206206    action_sensitize( "open-torrent-folder", counts.totalCount == 1 );
    207     action_sensitize( "show-torrent-properties", counts.totalCount != 0 );
    208207
    209208    canUpdate = 0;
     
    638637
    639638static gpointer
    640 quitThreadFunc( gpointer core )
    641 {
    642     tr_core_close( core );
    643     gtk_main_quit( );
    644     return NULL;
    645 }
    646 
    647 static void
    648 do_exit_cb( GtkWidget *w  UNUSED,
    649             gpointer data UNUSED )
    650 {
    651     exit( 0 );
    652 }
    653 
    654 static void
    655 wannaquit( void * vdata )
    656 {
    657     TrCore * core;
    658     GtkWidget *r, *p, *b, *w, *c;
    659     struct cbdata *cbdata = vdata;
    660 
    661     /* stop the update timer */
    662     if( cbdata->timer )
    663     {
    664         g_source_remove( cbdata->timer );
    665         cbdata->timer = 0;
    666     }
    667 
    668     c = GTK_WIDGET( cbdata->wind );
    669     gtk_container_remove( GTK_CONTAINER( c ), gtk_bin_get_child( GTK_BIN( c ) ) );
    670 
    671     r = gtk_alignment_new( 0.5, 0.5, 0.01, 0.01 );
    672     gtk_container_add( GTK_CONTAINER( c ), r );
    673 
    674     p = gtk_table_new( 3, 2, FALSE );
    675     gtk_table_set_col_spacings( GTK_TABLE( p ), GUI_PAD_BIG );
    676     gtk_container_add( GTK_CONTAINER( r ), p );
    677 
    678     w = gtk_image_new_from_stock( GTK_STOCK_NETWORK, GTK_ICON_SIZE_DIALOG );
    679     gtk_table_attach_defaults( GTK_TABLE( p ), w, 0, 1, 0, 2 );
    680 
    681     w = gtk_label_new( NULL );
    682     gtk_label_set_markup( GTK_LABEL( w ), _( "<b>Closing Connections</b>" ) );
    683     gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
    684     gtk_table_attach_defaults( GTK_TABLE( p ), w, 1, 2, 0, 1 );
    685 
    686     w = gtk_label_new( _( "Sending upload/download totals to tracker..." ) );
    687     gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
    688     gtk_table_attach_defaults( GTK_TABLE( p ), w, 1, 2, 1, 2 );
    689 
    690     b = gtk_alignment_new( 0.0, 1.0, 0.01, 0.01 );
    691     w = gtr_button_new_from_stock( GTK_STOCK_QUIT, _( "_Quit Now" ) );
    692     g_signal_connect( w, "clicked", G_CALLBACK( do_exit_cb ), NULL );
    693     gtk_container_add( GTK_CONTAINER( b ), w );
    694     gtk_table_attach( GTK_TABLE( p ), b, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 10 );
    695 
    696     gtk_widget_show_all( r );
    697 
    698     /* clear the UI */
    699     gtk_list_store_clear( GTK_LIST_STORE( tr_core_model( cbdata->core ) ) );
     639quitThreadFunc( gpointer gdata )
     640{
     641    struct cbdata * cbdata = gdata;
     642
     643    tr_core_close( cbdata->core );
    700644
    701645    /* shutdown the gui */
    702     core = cbdata->core;
    703646    if( cbdata->details )
    704647        gtk_widget_destroy( GTK_WIDGET( cbdata->details ) );
     
    720663    g_free( cbdata );
    721664
     665    gtk_main_quit( );
     666    return NULL;
     667}
     668
     669static void
     670do_exit_cb( GtkWidget *w  UNUSED,
     671            gpointer data UNUSED )
     672{
     673    exit( 0 );
     674}
     675
     676static void
     677wannaquit( void * vdata )
     678{
     679    GtkWidget *r, *p, *b, *w, *c;
     680    struct cbdata *cbdata = vdata;
     681
     682    /* stop the update timer */
     683    if( cbdata->timer )
     684    {
     685        g_source_remove( cbdata->timer );
     686        cbdata->timer = 0;
     687    }
     688
     689    c = GTK_WIDGET( cbdata->wind );
     690    gtk_container_remove( GTK_CONTAINER( c ), gtk_bin_get_child( GTK_BIN( c ) ) );
     691
     692    r = gtk_alignment_new( 0.5, 0.5, 0.01, 0.01 );
     693    gtk_container_add( GTK_CONTAINER( c ), r );
     694
     695    p = gtk_table_new( 3, 2, FALSE );
     696    gtk_table_set_col_spacings( GTK_TABLE( p ), GUI_PAD_BIG );
     697    gtk_container_add( GTK_CONTAINER( r ), p );
     698
     699    w = gtk_image_new_from_stock( GTK_STOCK_NETWORK, GTK_ICON_SIZE_DIALOG );
     700    gtk_table_attach_defaults( GTK_TABLE( p ), w, 0, 1, 0, 2 );
     701
     702    w = gtk_label_new( NULL );
     703    gtk_label_set_markup( GTK_LABEL( w ), _( "<b>Closing Connections</b>" ) );
     704    gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
     705    gtk_table_attach_defaults( GTK_TABLE( p ), w, 1, 2, 0, 1 );
     706
     707    w = gtk_label_new( _( "Sending upload/download totals to tracker..." ) );
     708    gtk_misc_set_alignment( GTK_MISC( w ), 0.0, 0.5 );
     709    gtk_table_attach_defaults( GTK_TABLE( p ), w, 1, 2, 1, 2 );
     710
     711    b = gtk_alignment_new( 0.0, 1.0, 0.01, 0.01 );
     712    w = gtr_button_new_from_stock( GTK_STOCK_QUIT, _( "_Quit Now" ) );
     713    g_signal_connect( w, "clicked", G_CALLBACK( do_exit_cb ), NULL );
     714    gtk_container_add( GTK_CONTAINER( b ), w );
     715    gtk_table_attach( GTK_TABLE( p ), b, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 10 );
     716
     717    gtk_widget_show_all( r );
     718
     719    /* clear the UI */
     720    gtk_list_store_clear( GTK_LIST_STORE( tr_core_model( cbdata->core ) ) );
     721
    722722    /* shut down libT */
    723     g_thread_create( quitThreadFunc, core, TRUE, NULL );
     723    g_thread_create( quitThreadFunc, vdata, TRUE, NULL );
    724724}
    725725
  • trunk/gtk/sexy-icon-entry.c

    r6998 r8283  
    5555};
    5656
    57 static void sexy_icon_entry_class_init(SexyIconEntryClass *klass);
    5857static void sexy_icon_entry_editable_init(GtkEditableClass *iface);
    59 static void sexy_icon_entry_init(SexyIconEntry *entry);
    6058static void sexy_icon_entry_finalize(GObject *obj);
    6159static void sexy_icon_entry_destroy(GtkObject *obj);
  • trunk/gtk/util.c

    r8282 r8283  
    204204{
    205205    char * tmp = gtr_localtime( time );
    206     g_strlcpy( buf, tmp, sizeof( buflen ) );
     206    g_strlcpy( buf, tmp, buflen );
    207207    g_free( tmp );
    208208    return buf;
Note: See TracChangeset for help on using the changeset viewer.