forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
38f226b5ce
commit
305ea71b97
@ -360,6 +360,31 @@ gtk_inspector_recorder_is_recording (GtkInspectorRecorder *recorder)
|
|||||||
return priv->recording;
|
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
|
void
|
||||||
gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
|
gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
@ -367,7 +392,6 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
|
|||||||
const cairo_region_t *region,
|
const cairo_region_t *region,
|
||||||
GskRenderNode *node)
|
GskRenderNode *node)
|
||||||
{
|
{
|
||||||
GtkInspectorRecorderPrivate *priv = gtk_inspector_recorder_get_instance_private (recorder);
|
|
||||||
GtkInspectorRecording *recording;
|
GtkInspectorRecording *recording;
|
||||||
GdkFrameClock *frame_clock;
|
GdkFrameClock *frame_clock;
|
||||||
|
|
||||||
@ -382,7 +406,7 @@ gtk_inspector_recorder_record_render (GtkInspectorRecorder *recorder,
|
|||||||
gdk_window_get_height (window) },
|
gdk_window_get_height (window) },
|
||||||
region,
|
region,
|
||||||
node);
|
node);
|
||||||
g_list_store_append (G_LIST_STORE (priv->recordings), recording);
|
gtk_inspector_recorder_add_recording (recorder, recording);
|
||||||
g_object_unref (recording);
|
g_object_unref (recording);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user