kerenl-shark: Use callbacks for updating the filter between graph and list

Have the graph send callbacks to update the lists filters.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
diff --git a/kernel-shark.c b/kernel-shark.c
index ddeee9f..274a13c 100644
--- a/kernel-shark.c
+++ b/kernel-shark.c
@@ -83,6 +83,21 @@
 	trace_view_select(info->treeview, cursor);
 }
 
+static void ks_graph_filter(struct graph_info *ginfo,
+			    struct filter_task *task_filter,
+			    struct filter_task *hide_tasks)
+{
+	struct graph_callbacks *cbs;
+	struct shark_info *info;
+
+	cbs = trace_graph_get_callbacks(ginfo);
+	info = container_of(cbs, struct shark_info, graph_cbs);
+
+	if (info->list_filter_enabled)
+		trace_view_update_filters(info->treeview,
+					  task_filter, hide_tasks);
+}
+
 static void free_info(struct shark_info *info)
 {
 	tracecmd_close(info->handle);
@@ -231,12 +246,6 @@
 
 	trace_graph_filter_add_remove_task(info->ginfo, info->selected_task);
 
-	if (info->list_filter_enabled) {
-		trace_view_update_filters(info->treeview,
-					  info->ginfo->task_filter,
-					  info->ginfo->hide_tasks);
-	}
-
 	if (!filter_task_count(info->ginfo->task_filter))
 		info->list_filter_enabled = 0;
 }
@@ -248,12 +257,6 @@
 
 	trace_graph_filter_hide_show_task(info->ginfo, info->selected_task);
 
-	if (info->list_filter_enabled) {
-		trace_view_update_filters(info->treeview,
-					  info->ginfo->task_filter,
-					  info->ginfo->hide_tasks);
-	}
-
 	if (!filter_task_count(info->ginfo->task_filter) &&
 	    !filter_task_count(info->ginfo->hide_tasks))
 		info->list_filter_enabled = 0;
@@ -266,9 +269,6 @@
 
 	trace_graph_clear_tasks(info->ginfo);
 
-	if (info->list_filter_enabled)
-		trace_view_update_filters(info->treeview, NULL, NULL);
-
 	info->list_filter_enabled = 0;
 }
 
@@ -593,6 +593,7 @@
 	/* --- Set up Graph --- */
 
 	info->graph_cbs.select = ks_graph_select;
+	info->graph_cbs.filter = ks_graph_filter;
 
 	info->ginfo = trace_graph_create_with_callbacks(handle, &info->graph_cbs);
 	widget = trace_graph_get_window(info->ginfo);
diff --git a/trace-graph.c b/trace-graph.c
index b530314..513ed92 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -344,6 +344,10 @@
 	else
 		graph_filter_task_add_pid(ginfo, pid);
 
+	if (ginfo->callbacks && ginfo->callbacks->filter)
+		ginfo->callbacks->filter(ginfo, ginfo->task_filter,
+					 ginfo->hide_tasks);
+
 	if (filter_enabled)
 		redraw_graph(ginfo);
 }
@@ -361,6 +365,10 @@
 	else
 		graph_hide_task_add_pid(ginfo, pid);
 
+	if (ginfo->callbacks && ginfo->callbacks->filter)
+		ginfo->callbacks->filter(ginfo, ginfo->task_filter,
+					 ginfo->hide_tasks);
+
 	if (filter_enabled)
 		redraw_graph(ginfo);
 }
@@ -387,6 +395,10 @@
 
 	graph_filter_task_clear(ginfo);
 
+	if (ginfo->callbacks && ginfo->callbacks->filter)
+		ginfo->callbacks->filter(ginfo, ginfo->task_filter,
+					 ginfo->hide_tasks);
+
 	if (filter_enabled)
 		redraw_graph(ginfo);
 }
diff --git a/trace-graph.h b/trace-graph.h
index d323acb..36320b3 100644
--- a/trace-graph.h
+++ b/trace-graph.h
@@ -7,9 +7,13 @@
 struct graph_info;
 
 typedef void (graph_select_cb)(struct graph_info *ginfo, guint64 time);
+typedef void (graph_filter_cb)(struct graph_info *ginfo,
+			       struct filter_task *task_filter,
+			       struct filter_task *hide_tasks);
 
 struct graph_callbacks {
 	graph_select_cb		*select;
+	graph_filter_cb		*filter;
 };
 
 struct graph_info {