📄 set_attention_status.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 "callbacks.h"#include "interface.h"#include "refresh_table.h"#include "refresh_tree.h"#include "set_attention_status.h"#include "tree.h"// since enabling/disabling the attention status is a slot-based operation, the ioctl call is placed in this functionvoid set_attention_status_from_slot (int function, GtkCTree* tree, GtkCTreeNode* node, GtkWidget* table, GtkWidget* status_bar, pci_tree_node* user_data){ int rt = 0; char msg[MAXLEN]; pci_tree_node* tmp_p_node; if (selected_row != NOT_SELECTED) { stuff.type_of_request = SET_ATTENTION_STATUS; stuff.physical_slot = selected_row; if (function == ENABLE_ATT_STATUS) stuff.value = 1; else stuff.value = 0; rt = ioctl(dev_hpc, GUI_BACK_DOOR, &stuff); // rt = 0 is success refresh_tree(tree); refresh_table(table, g_node); tmp_p_node = ctree_partner(tree, root_nodes[selected_row-1], slot_based); if (tmp_p_node->type == 0) { public_slot_info* slot = (public_slot_info*) tmp_p_node->node_info; if ( (rt == 0 && slot->attention_status == 1 && function == ENABLE_ATT_STATUS) || (rt == 0 && slot->attention_status == 0 && function == DISABLE_ATT_STATUS) ) { if (function == ENABLE_ATT_STATUS) sprintf(msg, "Slot %d: The attention status has been enabled.", selected_row); else sprintf(msg, "Slot %d: The attention status has been disabled.", selected_row); gtk_statusbar_pop(GTK_STATUSBAR(status_bar), context_id); gtk_statusbar_push(GTK_STATUSBAR(status_bar), context_id, msg); } else { if (function == ENABLE_ATT_STATUS) sprintf(msg, "Slot %d: Problems occurred while enabling the attention status.", selected_row); else sprintf(msg, "Slot %d: Problems occurred while disabling the attention status.", selected_row); gtk_statusbar_pop(GTK_STATUSBAR(status_bar), context_id); gtk_statusbar_push(GTK_STATUSBAR(status_bar), context_id, msg); } } }}// obtain the slot node and re-direct to the slot-based functionvoid set_attention_status_from_adapter (int function, GtkCTree* tree, GtkCTreeNode* node, GtkWidget* table, GtkWidget* status_bar, pci_tree_node* user_data){ GtkCTreeNode* parent_node; pci_tree_node* data; parent_node = get_parent(node); data = (pci_tree_node*) gtk_ctree_node_get_row_data(tree, parent_node); set_attention_status_from_slot(function, tree, parent_node, table, status_bar, data);}// obtain the slot node and re-direct to the slot-based functionvoid set_attention_status_from_function (int function, GtkCTree* tree, GtkCTreeNode* node, GtkWidget* table, GtkWidget* status_bar, pci_tree_node* user_data){ GtkCTreeNode* parent_node; pci_tree_node* data; parent_node = get_parent(node); data = (pci_tree_node*) gtk_ctree_node_get_row_data(tree, parent_node); set_attention_status_from_slot(function, tree, parent_node, table, status_bar, data);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -