On Sa, 2004-01-10 at 06:23, Michael Robert Gray wrote:
> This patch should activate the 'clear nonexistant files' button. I have
> been using this code for a little while and it seems to work OK.
>
> MRG
Hi Robert
thanks for that patch, it looks usable. We are in a code freeze right
now and try to get the next release more stable then the last two. We
will see to integrate your patch after 0.93.3 has been released.
Since I seem to have been the only recipient of the mail, I reattached
the patch and sent it to the developers mailing list too.
Cheers
--
Richard Eckart <[EMAIL PROTECTED]>
Index: gtk-gnutella-current/gtk-gnutella.glade
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/gtk-gnutella.glade,v
retrieving revision 1.193
diff -u -r1.193 gtk-gnutella.glade
--- gtk-gnutella-current/gtk-gnutella.glade 4 Jan 2004 21:02:51 -0000 1.193
+++ gtk-gnutella-current/gtk-gnutella.glade 10 Jan 2004 04:10:56 -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.93
diff -u -r1.93 gtk2-gnutella.glade
--- gtk-gnutella-current/gtk2-gnutella.glade 4 Jan 2004 21:02:51 -0000 1.93
+++ gtk-gnutella-current/gtk2-gnutella.glade 10 Jan 2004 04:19:40 -0000
@@ -16364,7 +16364,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.109
diff -u -r1.109 interface-glade1.c
--- gtk-gnutella-current/src/interface-glade1.c 4 Jan 2004 21:02:51 -0000 1.109
+++ gtk-gnutella-current/src/interface-glade1.c 10 Jan 2004 04:23:35 -0000
@@ -2860,7 +2860,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.96
diff -u -r1.96 interface-glade2.c
--- gtk-gnutella-current/src/interface-glade2.c 4 Jan 2004 21:02:52 -0000 1.96
+++ gtk-gnutella-current/src/interface-glade2.c 10 Jan 2004 04:34:46 -0000
@@ -9481,7 +9481,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.21
diff -u -r1.21 upload_stats.c
--- gtk-gnutella-current/src/upload_stats.c 27 Jul 2003 22:03:04 -0000 1.21
+++ gtk-gnutella-current/src/upload_stats.c 10 Jan 2004 04:34:51 -0000
@@ -311,7 +311,24 @@
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);
+ s = g_list_first(upload_stats_list);
+ 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 10 Jan 2004 04:34:52 -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 10 Jan 2004 04:34:52 -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);