[gtk+] inspector: Hide the inspector tab when empty
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: Hide the inspector tab when empty
- Date: Sun, 9 Nov 2014 02:43:48 +0000 (UTC)
commit 0c20ba7dcb09cd4ea6d22fc7334987663d3e423a
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Nov 8 21:29:51 2014 -0500
inspector: Hide the inspector tab when empty
gtk/inspector/gestures.c | 58 +++++++++++++++++++++++-----------------------
1 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/gtk/inspector/gestures.c b/gtk/inspector/gestures.c
index 039e21a..b45dd24 100644
--- a/gtk/inspector/gestures.c
+++ b/gtk/inspector/gestures.c
@@ -177,40 +177,40 @@ void
gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
GObject *object)
{
+ GHashTable *hash;
+ GHashTableIter iter;
+ GList *list, *l;
+ gint phase;
+
clear_all (sl);
+ gtk_widget_hide (GTK_WIDGET (sl));
- if (GTK_IS_WIDGET (object))
+ if (!GTK_IS_WIDGET (object))
+ return;
+
+ hash = g_hash_table_new (g_direct_hash, g_direct_equal);
+ for (phase = GTK_PHASE_NONE; phase <= GTK_PHASE_TARGET; phase++)
{
- GHashTable *hash;
- GHashTableIter iter;
- GList *list, *l;
- gint phase;
-
- hash = g_hash_table_new (g_direct_hash, g_direct_equal);
- for (phase = GTK_PHASE_NONE; phase <= GTK_PHASE_TARGET; phase++)
- {
- list = _gtk_widget_list_controllers (GTK_WIDGET (object), phase);
- for (l = list; l; l = l->next)
- g_hash_table_insert (hash, l->data, GINT_TO_POINTER (phase));
- g_list_free (list);
- }
+ list = _gtk_widget_list_controllers (GTK_WIDGET (object), phase);
+ for (l = list; l; l = l->next)
+ g_hash_table_insert (hash, l->data, GINT_TO_POINTER (phase));
+ g_list_free (list);
+ }
- while (g_hash_table_size (hash) > 0)
- {
- gpointer key, value;
- GtkGesture *gesture;
- g_hash_table_iter_init (&iter, hash);
- g_hash_table_iter_next (&iter, &key, &value);
- gesture = key;
- add_gesture_group (sl, object, gesture, hash);
- }
-
- g_hash_table_unref (hash);
-
- gtk_widget_show (GTK_WIDGET (sl));
+ if (g_hash_table_size (hash))
+ gtk_widget_show (GTK_WIDGET (sl));
+
+ while (g_hash_table_size (hash) > 0)
+ {
+ gpointer key, value;
+ GtkGesture *gesture;
+ g_hash_table_iter_init (&iter, hash);
+ g_hash_table_iter_next (&iter, &key, &value);
+ gesture = key;
+ add_gesture_group (sl, object, gesture, hash);
}
- else
- gtk_widget_hide (GTK_WIDGET (sl));
+
+ g_hash_table_unref (hash);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]