[gtk+] inspector Reselect bottom row in recorder
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector Reselect bottom row in recorder
- Date: Sat, 19 Nov 2016 20:01:44 +0000 (UTC)
commit 305ea71b97539c65d6c980830af7fbfc74e30b6e
Author: Benjamin Otte <otte redhat com>
Date: Sat Nov 19 20:55:08 2016 +0100
inspector Reselect bottom row in recorder
When inserting a new recording and the bottommost row was selected,
select the newly added row. This way, you can observe the ongoing
recording.
gtk/inspector/recorder.c | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index c1027ad..d3f2aed 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -360,6 +360,31 @@ gtk_inspector_recorder_is_recording (GtkInspectorRecorder *recorder)
return priv->recording;
}
+static void
+gtk_inspector_recorder_add_recording (GtkInspectorRecorder *recorder,
+ GtkInspectorRecording *recording)
+{
+ GtkInspectorRecorderPrivate *priv = gtk_inspector_recorder_get_instance_private (recorder);
+ guint count;
+ GtkListBoxRow *selected_row;
+ gboolean should_select_new_row;
+
+ count = g_list_model_get_n_items (priv->recordings);
+ selected_row = gtk_list_box_get_selected_row (GTK_LIST_BOX (priv->recordings_list));
+ if (count == 0 || selected_row == NULL)
+ should_select_new_row = TRUE;
+ else
+ should_select_new_row = (gtk_list_box_row_get_index (selected_row) == count - 1);
+
+ g_list_store_append (G_LIST_STORE (priv->recordings), recording);
+
+ if (should_select_new_row)
+ {
+ gtk_list_box_select_row (GTK_LIST_BOX (priv->recordings_list),
+ gtk_list_box_get_row_at_index (GTK_LIST_BOX (priv->recordings_list), count));
+ }
+}
+
void
gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
GtkWidget *widget,
@@ -367,7 +392,6 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
const cairo_region_t *region,
GskRenderNode *node)
{
- GtkInspectorRecorderPrivate *priv = gtk_inspector_recorder_get_instance_private (recorder);
GtkInspectorRecording *recording;
GdkFrameClock *frame_clock;
@@ -382,7 +406,7 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
gdk_window_get_height (window) },
region,
node);
- g_list_store_append (G_LIST_STORE (priv->recordings), recording);
+ gtk_inspector_recorder_add_recording (recorder, recording);
g_object_unref (recording);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]