]> granicus.if.org Git - transmission/commitdiff
(gtk) fix a couple of new gtk bugs reported by Rolcol
authorCharles Kerr <charles@transmissionbt.com>
Sat, 25 Apr 2009 14:08:40 +0000 (14:08 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sat, 25 Apr 2009 14:08:40 +0000 (14:08 +0000)
gtk/details.c
gtk/main.c
gtk/sexy-icon-entry.c
gtk/util.c

index 62b89a4800e33b56293d4058f11d0b5d510518ba..742b6996022e5dcf576f3f9c963f77a82b86f6bb 100644 (file)
@@ -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; i<n; ++i )
-            if( (int)(100*baseline) != (int)(100*tr_torrentGetRatioLimit(torrents[i])) )
-                break;
-        if( i == n )
-            set_double_spin_if_different( di->seedCustomSpin,
-                                          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;
index 83af9c4405a2357204b5a66a28441e052035a3ed..59626b7dbd0d640f23b7c6e5444a1de0ee3b4b11 100644 (file)
@@ -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
index 53ae485497a56115e7754d85a6d1634554562039..14cf76138cc95a1e2d61c643cfbdf6a4b4779d77 100644 (file)
@@ -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);
index 5fe85e11b2d7cef1e2f3f1c7db4bc4e8239ef60b..dca5a2eea3749c8d29b78cd60e5d72d5a0ac0572 100644 (file)
@@ -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;
 }