about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@devio.us>2012-08-08 13:55:10 -0400
committerJosh Rickmar <jrick@devio.us>2012-08-08 13:55:10 -0400
commita6664259fb1c2843fa3d966c5eaaaff6f6ab2cc6 (patch)
tree6104b6f8bb4fc7140a0c9f98ca07f6544c81ae83
parentcbb9ceb61e7687ffa15520fa0bf5b83f1a39a6e8 (diff)
parent561f6b9bc44682b50e47d922c2e646a609870934 (diff)
downloadxombrero-a6664259fb1c2843fa3d966c5eaaaff6f6ab2cc6.tar.gz
Merge in my about:allthethings toplevel changes
-rw-r--r--about.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/about.c b/about.c
index b1a8777..861e7d2 100644
--- a/about.c
+++ b/about.c
@@ -2161,9 +2161,9 @@ xt_append_settings(char *str, GObject *object, char *name, int recurse)
 	char *newstr, *settings;
 
 	settings = show_g_object_settings(object, name, recurse);
-	if (str == NULL) {
+	if (str == NULL)
 		str = g_strdup("");
-	}
+
 	newstr = g_strdup_printf("%s%s %s%s };\n", str, name, settings, name);
 	g_free(str);
 
@@ -2189,12 +2189,23 @@ about_webkit(struct tab *t, struct karg *arg)
 	return (0);
 }
 
+static int		toplevelcount = 0;
+
+void
+xt_append_toplevel(GtkWindow *w, char **body)
+{
+	char			*n;
+
+	n = g_strdup_printf("toplevel#%d", toplevelcount++);
+	*body = xt_append_settings(*body, G_OBJECT(w), n, 0);
+	g_free(n);
+}
+
 int
 allthethings(struct tab *t, struct karg *arg)
 {
+	GList			*list;
 	char			*page, *body, *b;
-	GList			*list, *liter;
-	int			toplevelcount = 0;
 
 	body = xt_append_settings(NULL, G_OBJECT(t->wv), "t->wv", 1);
 	body = xt_append_settings(body, G_OBJECT(t->inspector),
@@ -2203,14 +2214,12 @@ allthethings(struct tab *t, struct karg *arg)
 	body = xt_append_settings(body, G_OBJECT(session),
 	    "session", 1);
 #endif
+	toplevelcount = 0;
 	list = gtk_window_list_toplevels();
-	for(liter = list; liter != NULL; liter = liter->next) {
-		b = g_strdup_printf("toplevel#%x", toplevelcount++);
-		
-		body = xt_append_settings(body, G_OBJECT(liter->data), b, 1);
-
-		g_free(b);
-	}
+	g_list_foreach(list, (GFunc)g_object_ref, NULL);
+	g_list_foreach(list, (GFunc)xt_append_toplevel, &body);
+	g_list_foreach(list, (GFunc)g_object_unref, NULL);
+	g_list_free(list);
 		
 	b = body;
 	body = g_strdup_printf("<pre>%scan paste clipboard = %d\n</pre>", body,