inspector: Hide the inspector tab when empty

This commit is contained in:
Matthias Clasen 2014-11-08 21:29:51 -05:00
parent 7dd466ad74
commit 0c20ba7dcb

View File

@ -176,16 +176,18 @@ add_gesture_group (GtkInspectorGestures *sl,
void
gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
GObject *object)
{
clear_all (sl);
if (GTK_IS_WIDGET (object))
{
GHashTable *hash;
GHashTableIter iter;
GList *list, *l;
gint phase;
clear_all (sl);
gtk_widget_hide (GTK_WIDGET (sl));
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++)
{
@ -195,6 +197,9 @@ gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
g_list_free (list);
}
if (g_hash_table_size (hash))
gtk_widget_show (GTK_WIDGET (sl));
while (g_hash_table_size (hash) > 0)
{
gpointer key, value;
@ -206,11 +211,6 @@ gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
}
g_hash_table_unref (hash);
gtk_widget_show (GTK_WIDGET (sl));
}
else
gtk_widget_hide (GTK_WIDGET (sl));
}
static void