changeset 2612:7938953630fa

[gaim-migrate @ 2625] I forgot about this. Don't show empty conversations. committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Thu, 25 Oct 2001 20:09:36 +0000
parents d324478ee203
children 6f7e1fc3e132
files src/dialogs.c
diffstat 1 files changed, 27 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Thu Oct 25 18:30:22 2001 +0000
+++ b/src/dialogs.c	Thu Oct 25 20:09:36 2001 +0000
@@ -3478,13 +3478,16 @@
 	GtkWidget *clear_button;
 	GtkWidget *save_button;
 	GtkWidget *list = NULL;
-	GtkWidget *item;
+	GList *item_list = NULL;
+	GtkWidget *item = NULL;
+	GtkWidget *last = NULL;
 	GtkWidget *frame;
 
 	int options;
 	guint block;
 	char convo_start[32];
 	long offset = 0;
+	unsigned int i = 0;
 
 
 	options = GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL;
@@ -3547,8 +3550,20 @@
 			if (strstr(buf, "---- New C")) {
 				int length;
 				char *temp = strchr(buf, '@');
+
 				if (temp == NULL || strlen(temp) < 2)
 					continue;
+
+				if (i == 1) {
+					if (item_list) {
+						item_list = g_list_remove(item_list, last);
+						last = NULL;
+					}
+				}
+					
+
+				i = 0;
+
 				temp++;
 				length = strcspn(temp, "-");
 				if (length > 31) length = 31;
@@ -3562,13 +3577,23 @@
 				gtk_object_set_data(GTK_OBJECT(item), "box", (gpointer)bbox);
 				gtk_object_set_data(GTK_OBJECT(item), "window", (gpointer)window);
 				gtk_signal_connect(GTK_OBJECT(item), "select", GTK_SIGNAL_FUNC(log_show_convo), layout);
-				gtk_container_add(GTK_CONTAINER(list), item);
+				last = item;
+				item_list = g_list_append(item_list, item);
+				
 				gtk_widget_show(item);
 			}
+			i++;
 		}
 		fclose(fp);
 	}
 
+	if (i == 1) {
+		if (item_list)
+			item_list = g_list_remove(item_list, item);
+	}
+	
+	gtk_list_insert_items(GTK_LIST(list), item_list, 0 );
+
 	gtk_signal_disconnect(GTK_OBJECT(window), block);
 	gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(destroy_dialog), window);