changeset 15552:7ebe32203e67

If you delete the last log for a month, delete the month header as well.
author Richard Laager <rlaager@wiktel.com>
date Mon, 05 Feb 2007 03:37:10 +0000
parents fa13722c7756
children 2286aac43694
files pidgin/gtklog.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtklog.c	Mon Feb 05 03:06:25 2007 +0000
+++ b/pidgin/gtklog.c	Mon Feb 05 03:37:10 2007 +0000
@@ -220,7 +220,22 @@
 	}
 	else
 	{
-		gtk_tree_store_remove((GtkTreeStore *)data[0], (GtkTreeIter *)data[1]);
+		GtkTreeStore *treestore = data[0];
+		GtkTreeIter *iter = (GtkTreeIter *)data[1];
+		GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(treestore), iter);
+		gboolean first = !gtk_tree_path_prev(path);
+
+		if (!gtk_tree_store_remove(treestore, iter) && first)
+		{
+			/* iter was the last child at its level */
+
+			if (gtk_tree_path_up(path))
+			{
+				gtk_tree_model_get_iter(GTK_TREE_MODEL(treestore), iter, path);
+				gtk_tree_store_remove(treestore, iter);
+			}
+		}
+		gtk_tree_path_free(path);
 	}
 
 	delete_log_cleanup_cb(data);