inspector: Add a button to clear all recordings

Clears the recordings list, and even better: Frees all your memory.
This commit is contained in:
Benjamin Otte 2016-11-01 18:32:50 +01:00
parent e02ff7c064
commit 72a9c53262
2 changed files with 18 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include "recorder.h"
#include <gtk/gtkbutton.h>
#include <gtk/gtklabel.h>
#include <gtk/gtklistbox.h>
#include <gtk/gtktreeselection.h>
@ -60,6 +61,15 @@ static GParamSpec *props[LAST_PROP] = { NULL, };
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorRecorder, gtk_inspector_recorder, GTK_TYPE_BIN)
static void
recordings_clear_all (GtkButton *button,
GtkInspectorRecorder *recorder)
{
GtkInspectorRecorderPrivate *priv = gtk_inspector_recorder_get_instance_private (recorder);
g_list_store_remove_all (G_LIST_STORE (priv->recordings));
}
static void
recordings_list_row_selected (GtkListBox *box,
GtkListBoxRow *row,
@ -209,6 +219,7 @@ gtk_inspector_recorder_class_init (GtkInspectorRecorderClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorRecorder, render_node_view);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorRecorder, render_node_tree);
gtk_widget_class_bind_template_callback (widget_class, recordings_clear_all);
gtk_widget_class_bind_template_callback (widget_class, recordings_list_row_selected);
gtk_widget_class_bind_template_callback (widget_class, render_node_list_selection_changed);
}

View File

@ -17,6 +17,13 @@
<property name="active" bind-source="GtkInspectorRecorder" bind-property="recording" bind-flags="bidirectional|sync-create"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="icon-name">edit-clear-all</property>
<signal name="clicked" handler="recordings_clear_all"/>
</object>
</child>
</object>
</child>
<child>