inspector: Hide the inspector tab when empty
This commit is contained in:
@ -176,16 +176,18 @@ add_gesture_group (GtkInspectorGestures *sl,
|
|||||||
void
|
void
|
||||||
gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
|
gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
|
||||||
GObject *object)
|
GObject *object)
|
||||||
{
|
|
||||||
clear_all (sl);
|
|
||||||
|
|
||||||
if (GTK_IS_WIDGET (object))
|
|
||||||
{
|
{
|
||||||
GHashTable *hash;
|
GHashTable *hash;
|
||||||
GHashTableIter iter;
|
GHashTableIter iter;
|
||||||
GList *list, *l;
|
GList *list, *l;
|
||||||
gint phase;
|
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);
|
hash = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||||
for (phase = GTK_PHASE_NONE; phase <= GTK_PHASE_TARGET; phase++)
|
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);
|
g_list_free (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_hash_table_size (hash))
|
||||||
|
gtk_widget_show (GTK_WIDGET (sl));
|
||||||
|
|
||||||
while (g_hash_table_size (hash) > 0)
|
while (g_hash_table_size (hash) > 0)
|
||||||
{
|
{
|
||||||
gpointer key, value;
|
gpointer key, value;
|
||||||
@ -206,11 +211,6 @@ gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_hash_table_unref (hash);
|
g_hash_table_unref (hash);
|
||||||
|
|
||||||
gtk_widget_show (GTK_WIDGET (sl));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gtk_widget_hide (GTK_WIDGET (sl));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user