I found a bug in my original patch.  Also i completed gtk2
implementation of the function as well.




Index: gtk-gnutella-current/gtk-gnutella.glade
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/gtk-gnutella.glade,v
retrieving revision 1.195
diff -u -r1.195 gtk-gnutella.glade
--- gtk-gnutella-current/gtk-gnutella.glade     12 Jan 2004 11:10:33 -0000      1.195
+++ gtk-gnutella-current/gtk-gnutella.glade     13 Jan 2004 16:50:52 -0000
@@ -2872,7 +2872,6 @@
                <widget>
                  <class>GtkButton</class>
                  <name>button_ul_stats_clear_deleted</name>
-                 <sensitive>False</sensitive>
                  <tooltip>Somebody tell me a sensible tooltip for this.</tooltip>
                  <can_focus>True</can_focus>
                  <signal>
Index: gtk-gnutella-current/gtk2-gnutella.glade
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/gtk2-gnutella.glade,v
retrieving revision 1.95
diff -u -r1.95 gtk2-gnutella.glade
--- gtk-gnutella-current/gtk2-gnutella.glade    12 Jan 2004 11:10:33 -0000      1.95
+++ gtk-gnutella-current/gtk2-gnutella.glade    13 Jan 2004 16:55:04 -0000
@@ -16461,7 +16461,6 @@
              <child>
                <widget class="GtkButton" id="button_ul_stats_clear_deleted">
                  <property name="visible">True</property>
-                 <property name="sensitive">False</property>
                  <property name="tooltip" translatable="yes">Somebody tell me a 
sensible tooltip for this.</property>
                  <property name="can_focus">True</property>
                  <property name="relief">GTK_RELIEF_NORMAL</property>
Index: gtk-gnutella-current/src/interface-glade1.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/interface-glade1.c,v
retrieving revision 1.111
diff -u -r1.111 interface-glade1.c
--- gtk-gnutella-current/src/interface-glade1.c 12 Jan 2004 11:10:33 -0000      1.111
+++ gtk-gnutella-current/src/interface-glade1.c 13 Jan 2004 16:58:20 -0000
@@ -2865,7 +2865,6 @@
                             (GtkDestroyNotify) gtk_widget_unref);
   gtk_widget_show (button_ul_stats_clear_deleted);
   gtk_box_pack_start (GTK_BOX (ul_stats_hbox2), button_ul_stats_clear_deleted, FALSE, 
FALSE, 0);
-  gtk_widget_set_sensitive (button_ul_stats_clear_deleted, FALSE);
   gtk_tooltips_set_tip (tooltips, button_ul_stats_clear_deleted, _("Somebody tell me 
a sensible tooltip for this."), NULL);
 
   button_ul_stats_clear_all = gtk_button_new_with_label (_("Clear all"));
Index: gtk-gnutella-current/src/interface-glade2.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/interface-glade2.c,v
retrieving revision 1.98
diff -u -r1.98 interface-glade2.c
--- gtk-gnutella-current/src/interface-glade2.c 12 Jan 2004 11:10:34 -0000      1.98
+++ gtk-gnutella-current/src/interface-glade2.c 13 Jan 2004 17:01:52 -0000
@@ -9527,7 +9527,6 @@
   gtk_widget_set_name (button_ul_stats_clear_deleted, 
"button_ul_stats_clear_deleted");
   gtk_widget_show (button_ul_stats_clear_deleted);
   gtk_box_pack_start (GTK_BOX (ul_stats_hbox2), button_ul_stats_clear_deleted, FALSE, 
FALSE, 0);
-  gtk_widget_set_sensitive (button_ul_stats_clear_deleted, FALSE);
   gtk_tooltips_set_tip (tooltips, button_ul_stats_clear_deleted, _("Somebody tell me 
a sensible tooltip for this."), NULL);
 
   alignment38 = gtk_alignment_new (0.5, 0.5, 0, 0);
Index: gtk-gnutella-current/src/upload_stats.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/upload_stats.c,v
retrieving revision 1.22
diff -u -r1.22 upload_stats.c
--- gtk-gnutella-current/src/upload_stats.c     11 Jan 2004 19:55:13 -0000      1.22
+++ gtk-gnutella-current/src/upload_stats.c     13 Jan 2004 17:01:58 -0000
@@ -305,7 +305,23 @@
 
 void upload_stats_prune_nonexistent()
 {
-       /* for each row, get the filename, check if filename is ? */
+       GList *s;
+       struct ul_stats *stat;
+       struct shared_file *file;
+       
+       for (s = g_list_first(upload_stats_list); NULL != s; s = g_list_next(s)) {
+       redo:
+               stat = s->data;
+               file = shared_file_by_name(stat->filename);
+               if (!file || file->file_size != stat->size) {
+                       upload_stats_list = g_list_remove_link(upload_stats_list, s);
+                       upload_stats_gui_remove(stat);
+                       g_free(stat);
+                       if(!((s = g_list_first(upload_stats_list))))
+                               break;
+                       goto redo;
+               }
+       }
 }
 
 /*
Index: gtk-gnutella-current/src/upload_stats_gui.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/upload_stats_gui.c,v
retrieving revision 1.9
diff -u -r1.9 upload_stats_gui.c
--- gtk-gnutella-current/src/upload_stats_gui.c 9 Aug 2003 22:16:04 -0000       1.9
+++ gtk-gnutella-current/src/upload_stats_gui.c 13 Jan 2004 17:01:59 -0000
@@ -125,6 +125,15 @@
        gtk_clist_sort(clist);
 }
 
+void upload_stats_gui_remove(struct ul_stats *stat)
+{
+       GtkCList *clist = GTK_CLIST(lookup_widget(main_window, "clist_ul_stats"));
+       gint row;
+       
+       row = gtk_clist_find_row_from_data(clist, stat);
+       if(-1 != row)
+               gtk_clist_remove(clist, row);
+}
 
 /*
  * Called when a row of the upload stats should be updated
Index: gtk-gnutella-current/src/upload_stats_gui.h
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/upload_stats_gui.h,v
retrieving revision 1.5
diff -u -r1.5 upload_stats_gui.h
--- gtk-gnutella-current/src/upload_stats_gui.h 15 Jul 2003 09:07:59 -0000      1.5
+++ gtk-gnutella-current/src/upload_stats_gui.h 13 Jan 2004 17:01:59 -0000
@@ -28,6 +28,7 @@
 
 void upload_stats_gui_init(void);
 void upload_stats_gui_add(struct ul_stats *);
+void upload_stats_gui_remove(struct ul_stats *);
 void upload_stats_gui_update(const gchar *, guint64);
 void upload_stats_gui_clear_all(void);
 
Index: gtk-gnutella-current/src/upload_stats_gui2.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/upload_stats_gui2.c,v
retrieving revision 1.20
diff -u -r1.20 upload_stats_gui2.c
--- gtk-gnutella-current/src/upload_stats_gui2.c        8 Sep 2003 18:06:37 -0000      
 1.20
+++ gtk-gnutella-current/src/upload_stats_gui2.c        13 Jan 2004 17:02:03 -0000
@@ -279,6 +279,17 @@
                (-1));
 }
 
+void upload_stats_gui_remove(struct ul_stats *us)
+{
+       GtkListStore *store;
+       GtkTreeIter iter;
+
+       store = GTK_LIST_STORE(gtk_tree_view_get_model(upload_stats_treeview));
+       g_assert(store != NULL);
+       if(upload_stats_gui_find(us->filename, us->size, GTK_TREE_MODEL(store), &iter))
+               gtk_list_store_remove(store, &iter);
+}
+
 /**
  * Initialize the upload statistics gui.
  *

Reply via email to