inspector: clean up better when objects go away

Instead of manually doing it everywhere, just call set_object (NULL)
from the selection_changed handler. Fix all the set_object() functions
to deal with NULL.
This commit is contained in:
Matthias Clasen 2014-05-10 12:26:22 -04:00
parent cb85a1fa3a
commit a0cae6957e
2 changed files with 14 additions and 15 deletions

View File

@ -73,6 +73,9 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
gtk_tree_store_clear (oh->priv->model);
if (object == NULL)
return;
interfaces = g_hash_table_new (g_str_hash, g_str_equal);
type = ((GTypeInstance*)object)->g_class->g_type;

View File

@ -102,22 +102,18 @@ on_widget_tree_selection_changed (GtkInspectorWidgetTree *wt,
{
GObject *selected = gtk_inspector_widget_tree_get_selected_object (wt);
if (selected != NULL)
{
if (!gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->prop_list), selected))
return;
if (!gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->prop_list), selected))
return;
gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected);
gtk_inspector_signals_list_set_object (GTK_INSPECTOR_SIGNALS_LIST (iw->signals_list), selected);
gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected);
gtk_inspector_button_path_set_object (GTK_INSPECTOR_BUTTON_PATH (iw->button_path), selected);
gtk_inspector_classes_list_set_object (GTK_INSPECTOR_CLASSES_LIST (iw->classes_list), selected);
gtk_inspector_css_editor_set_object (GTK_INSPECTOR_CSS_EDITOR (iw->widget_css_editor), selected);
gtk_inspector_data_list_set_object (GTK_INSPECTOR_DATA_LIST (iw->data_list), selected);
if (GTK_IS_WIDGET (selected))
gtk_inspector_flash_widget (iw, GTK_WIDGET (selected));
}
gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected);
gtk_inspector_signals_list_set_object (GTK_INSPECTOR_SIGNALS_LIST (iw->signals_list), selected);
gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected);
gtk_inspector_button_path_set_object (GTK_INSPECTOR_BUTTON_PATH (iw->button_path), selected);
gtk_inspector_classes_list_set_object (GTK_INSPECTOR_CLASSES_LIST (iw->classes_list), selected);
gtk_inspector_css_editor_set_object (GTK_INSPECTOR_CSS_EDITOR (iw->widget_css_editor), selected);
gtk_inspector_data_list_set_object (GTK_INSPECTOR_DATA_LIST (iw->data_list), selected);
if (GTK_IS_WIDGET (selected))
gtk_inspector_flash_widget (iw, GTK_WIDGET (selected));
}
static void