From: Charles Kerr Date: Sat, 25 Apr 2009 14:08:40 +0000 (+0000) Subject: (gtk) fix a couple of new gtk bugs reported by Rolcol X-Git-Tag: 1.60~53 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12089cc8836c2f61e83a5c9a46273e6e7573a0f2;p=transmission (gtk) fix a couple of new gtk bugs reported by Rolcol --- diff --git a/gtk/details.c b/gtk/details.c index 62b89a480..742b69960 100644 --- a/gtk/details.c +++ b/gtk/details.c @@ -60,6 +60,7 @@ struct DetailsImpl guint seedGlobalRadioTag; guint seedCustomRadioTag; guint seedCustomSpinTag; + guint maxPeersSpinTag; GtkWidget * state_lb; GtkWidget * progress_lb; @@ -320,13 +321,15 @@ refreshOptions( struct DetailsImpl * di, tr_torrent ** torrents, int n ) /* seedCustomSpin */ if( n ) { const double baseline = tr_torrentGetRatioLimit( torrents[0] ); - int i; - for( i=1; iseedCustomSpin, - di->seedCustomSpinTag, baseline ); + set_double_spin_if_different( di->seedCustomSpin, + di->seedCustomSpinTag, baseline ); + } + + /* maxPeersSpin */ + if( n ) { + const int baseline = tr_torrentGetPeerLimit( torrents[0] ); + set_int_spin_if_different( di->maxPeersSpin, + di->maxPeersSpinTag, baseline ); } } @@ -610,8 +613,9 @@ options_page_new( struct DetailsImpl * d ) w = gtk_spin_button_new_with_range( 1, 3000, 5 ); hig_workarea_add_row( t, &row, _( "_Maximum peers:" ), w, w ); - g_signal_connect( w, "value-changed", G_CALLBACK( max_peers_spun_cb ), d ); + tag = g_signal_connect( w, "value-changed", G_CALLBACK( max_peers_spun_cb ), d ); d->maxPeersSpin = w; + d->maxPeersSpinTag = tag; hig_workarea_finish( t, &row ); return t; diff --git a/gtk/main.c b/gtk/main.c index 83af9c440..59626b7db 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -204,7 +204,6 @@ refreshActions( struct cbdata * data ) action_sensitize( "delete-torrent", counts.totalCount != 0 ); action_sensitize( "verify-torrent", counts.totalCount != 0 ); action_sensitize( "open-torrent-folder", counts.totalCount == 1 ); - action_sensitize( "show-torrent-properties", counts.totalCount != 0 ); canUpdate = 0; gtk_tree_selection_selected_foreach( s, accumulateCanUpdateForeach, &canUpdate ); @@ -637,9 +636,32 @@ winsetup( struct cbdata * cbdata, } static gpointer -quitThreadFunc( gpointer core ) +quitThreadFunc( gpointer gdata ) { - tr_core_close( core ); + struct cbdata * cbdata = gdata; + + tr_core_close( cbdata->core ); + + /* shutdown the gui */ + if( cbdata->details ) + gtk_widget_destroy( GTK_WIDGET( cbdata->details ) ); + if( cbdata->prefs ) + gtk_widget_destroy( GTK_WIDGET( cbdata->prefs ) ); + if( cbdata->wind ) + gtk_widget_destroy( GTK_WIDGET( cbdata->wind ) ); + g_object_unref( cbdata->core ); + if( cbdata->icon ) + g_object_unref( cbdata->icon ); + if( cbdata->errqueue ) { + g_slist_foreach( cbdata->errqueue, (GFunc)g_free, NULL ); + g_slist_free( cbdata->errqueue ); + } + if( cbdata->dupqueue ) { + g_slist_foreach( cbdata->dupqueue, (GFunc)g_free, NULL ); + g_slist_free( cbdata->dupqueue ); + } + g_free( cbdata ); + gtk_main_quit( ); return NULL; } @@ -654,7 +676,6 @@ do_exit_cb( GtkWidget *w UNUSED, static void wannaquit( void * vdata ) { - TrCore * core; GtkWidget *r, *p, *b, *w, *c; struct cbdata *cbdata = vdata; @@ -698,29 +719,8 @@ wannaquit( void * vdata ) /* clear the UI */ gtk_list_store_clear( GTK_LIST_STORE( tr_core_model( cbdata->core ) ) ); - /* shutdown the gui */ - core = cbdata->core; - if( cbdata->details ) - gtk_widget_destroy( GTK_WIDGET( cbdata->details ) ); - if( cbdata->prefs ) - gtk_widget_destroy( GTK_WIDGET( cbdata->prefs ) ); - if( cbdata->wind ) - gtk_widget_destroy( GTK_WIDGET( cbdata->wind ) ); - g_object_unref( cbdata->core ); - if( cbdata->icon ) - g_object_unref( cbdata->icon ); - if( cbdata->errqueue ) { - g_slist_foreach( cbdata->errqueue, (GFunc)g_free, NULL ); - g_slist_free( cbdata->errqueue ); - } - if( cbdata->dupqueue ) { - g_slist_foreach( cbdata->dupqueue, (GFunc)g_free, NULL ); - g_slist_free( cbdata->dupqueue ); - } - g_free( cbdata ); - /* shut down libT */ - g_thread_create( quitThreadFunc, core, TRUE, NULL ); + g_thread_create( quitThreadFunc, vdata, TRUE, NULL ); } static void diff --git a/gtk/sexy-icon-entry.c b/gtk/sexy-icon-entry.c index 53ae48549..14cf76138 100644 --- a/gtk/sexy-icon-entry.c +++ b/gtk/sexy-icon-entry.c @@ -54,9 +54,7 @@ enum LAST_SIGNAL }; -static void sexy_icon_entry_class_init(SexyIconEntryClass *klass); static void sexy_icon_entry_editable_init(GtkEditableClass *iface); -static void sexy_icon_entry_init(SexyIconEntry *entry); static void sexy_icon_entry_finalize(GObject *obj); static void sexy_icon_entry_destroy(GtkObject *obj); static void sexy_icon_entry_map(GtkWidget *widget); diff --git a/gtk/util.c b/gtk/util.c index 5fe85e11b..dca5a2eea 100644 --- a/gtk/util.c +++ b/gtk/util.c @@ -203,7 +203,7 @@ char * gtr_localtime2( char * buf, time_t time, size_t buflen ) { char * tmp = gtr_localtime( time ); - g_strlcpy( buf, tmp, sizeof( buflen ) ); + g_strlcpy( buf, tmp, buflen ); g_free( tmp ); return buf; }