📄 refresh_tree.c
字号:
/* * Compaq Hot Plug Controller Graphical User Interface * Copyright 2000, 2001 Compaq Computer Corporation * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or * NON INFRINGEMENT. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * Please send all questions or concerns to linuxhotplug@compaq.com */#include "commonheader.h"#include "refresh_tree.h"#include "tree.h"#include "build_tree.h"#include "callbacks.h"// refresh the pci tree node structure by re-reading the proc structure (via the build helper function)void refresh_pci_tree_node(pci_tree_node* node){ int type; FILE* fd = NULL; // file descriptor while (node) { fd = fopen(node->proc_path, "r"); if (fd) { // valid file descriptor fscanf(fd, "%*s %d", &type); build_pci_tree_node_helper(node->node_info, node->type, node->proc_path, fd); fclose(fd); } node = node->next; }}// update the pci tree node list and re-direct to the appropriate render node functionvoid refresh_tree_data(GtkCTree* tree, GtkCTreeNode* node, gpointer data){ pci_tree_node* node_data = (pci_tree_node*) gtk_ctree_node_get_row_data(tree, node); refresh_pci_tree_node(node_data); node_data = ctree_partner(tree, node, slot_based); (*(node_data->render_node))(tree, node, node_data);}// refresh the tree from the user perspectivevoid refresh_tree(GtkCTree* tree){ int index; pci_tree_node* p_node = (pci_tree_node*) gtk_ctree_node_get_row_data(tree, g_node); gtk_clist_freeze(GTK_CLIST(tree)); for (index=0; index < MAXSLOTS; index++) { if (root_nodes[index] != 0) gtk_ctree_pre_recursive(tree, root_nodes[index], refresh_tree_data, NULL); } if (p_node) { // enable/disable the appropriate buttons based on state of selected node set_adapter_button_status(g_node, p_node); set_driver_button_status(g_node, p_node); set_attention_status_button_status(g_node, p_node); } gtk_clist_thaw(GTK_CLIST(tree));}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -