static void on_something_selected (GtkTreeSelection *selection, gpointer user_data) { GtkTreeModel *model; GtkTreeIter iter; if (gtk_tree_selection_get_selected (selection, &model, &iter)) { guint icon_type; gtk_tree_model_get (model, &iter, 5, &icon_type, -1); /* We recognise things by how they look, don't we? */ if (icon_type == ICON_DEVICE) { GUPnPDeviceInfo *info; gtk_tree_model_get (model, &iter, 2, &info, -1); show_device_details (info); g_object_unref (info); } else if (icon_type == ICON_SERVICE) { GUPnPServiceInfo *info; gtk_tree_model_get (model, &iter, 2, &info, -1); show_service_details (info); g_object_unref (info); } else if (icon_type == ICON_VARIABLE) { GUPnPServiceStateVariableInfo *info; gtk_tree_model_get (model, &iter, 4, &info, -1); show_state_variable_details (info); } else if (icon_type == ICON_ACTION) { GUPnPServiceActionInfo *info; gtk_tree_model_get (model, &iter, 4, &info, -1); show_action_details (info); } else if (icon_type == ICON_ACTION_ARG_IN || icon_type == ICON_ACTION_ARG_OUT) { GUPnPServiceActionArgInfo *info; gtk_tree_model_get (model, &iter, 4, &info, -1); show_action_arg_details (info); } else show_default_details (); } else show_default_details (); }
// Callback for when device details have been fetched void device_details_fetched(int device_id, char *location, char *name, DeviceType device_type) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Details fetched - ID: %d, Location: %s, Name: %s, DeviceType: %d", device_id, location, name, device_type); reset_inactivity_timer(); if (g_device_id_list[g_device_selected] == device_id) { show_device_details(location, name, device_type); s_device_type = device_type; s_device_status = DSUpdating; show_device_status(DSUpdating, ""); // Fetch device status after a brief delay to avoid busy comms error if (status_fetch_delay_timer == NULL) status_fetch_delay_timer = app_timer_register(100, status_fetch_delayed, NULL); else app_timer_reschedule(status_fetch_delay_timer, 100); } }