[gtk+] inspector: Don't select 'randomly'
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: Don't select 'randomly'
- Date: Thu, 14 Jan 2016 04:26:33 +0000 (UTC)
commit dc5c82e29c1d1aa42622ce18ff1fbd02d43848be
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 13 23:24:38 2016 -0500
inspector: Don't select 'randomly'
While rescanning the object tree, we were emitting ::object-selected
signals, possibly causing wild blinking in the application window.
Don't do that.
https://bugzilla.gnome.org/show_bug.cgi?id=760572
gtk/inspector/object-tree.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/gtk/inspector/object-tree.c b/gtk/inspector/object-tree.c
index 5c4e504..0757b97 100644
--- a/gtk/inspector/object-tree.c
+++ b/gtk/inspector/object-tree.c
@@ -1114,6 +1114,24 @@ gtk_inspector_object_tree_append_object (GtkInspectorObjectTree *wt,
object_forall (object, child_callback, &data);
}
+static void
+block_selection_changed (GtkInspectorObjectTree *wt)
+{
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (wt->priv->tree));
+ g_signal_handlers_block_by_func (selection, on_selection_changed, wt);
+}
+
+static void
+unblock_selection_changed (GtkInspectorObjectTree *wt)
+{
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (wt->priv->tree));
+ g_signal_handlers_unblock_by_func (selection, on_selection_changed, wt);
+}
+
gboolean
select_object_internal (GtkInspectorObjectTree *wt,
GObject *object,
@@ -1130,10 +1148,10 @@ select_object_internal (GtkInspectorObjectTree *wt,
path = gtk_tree_model_get_path (GTK_TREE_MODEL (wt->priv->model), &iter);
gtk_tree_view_expand_to_path (GTK_TREE_VIEW (wt->priv->tree), path);
if (!activate)
- g_signal_handlers_block_by_func (selection, on_selection_changed, wt);
+ block_selection_changed (wt);
gtk_tree_selection_select_iter (selection, &iter);
if (!activate)
- g_signal_handlers_unblock_by_func (selection, on_selection_changed, wt);
+ unblock_selection_changed (wt);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (wt->priv->tree), path, NULL, TRUE, 0.5, 0);
if (activate)
@@ -1162,6 +1180,8 @@ gtk_inspector_object_tree_scan (GtkInspectorObjectTree *wt,
GdkScreen *screen;
GObject *selected;
+ block_selection_changed (wt);
+
selected = gtk_inspector_object_tree_get_selected (wt);
clear_store (wt);
@@ -1191,6 +1211,8 @@ gtk_inspector_object_tree_scan (GtkInspectorObjectTree *wt,
if (selected)
select_object_internal (wt, selected, FALSE);
+
+ unblock_selection_changed (wt);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]