📄 interface.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 */#ifdef HAVE_CONFIG_H# include <config.h>#endif#include "commonheader.h"#include "callbacks.h"#include "interface.h"#include "support.h"#include "tree.h"// callbacks for menu itemsstatic GnomeUIInfo file_menu_uiinfo[] ={ { GNOME_APP_UI_ITEM, N_("Exit"), NULL, on_exit_activate, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT, 0, 0, NULL }, GNOMEUIINFO_END};static GnomeUIInfo operations_menu_uiinfo[] ={ { GNOME_APP_UI_ITEM, N_("Add Adapter"), NULL, on_add_adapter_activate, NULL, NULL, GNOME_APP_PIXMAP_FILENAME, "hotplug/card_insert-small.xpm", 0, 0, NULL }, { GNOME_APP_UI_ITEM, N_("Remove Adapter"), NULL, on_remove_adapter_activate, NULL, NULL, GNOME_APP_PIXMAP_FILENAME, "hotplug/card_remove-small.xpm", 0, 0, NULL }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, N_("Insert Driver"), NULL, on_insert_driver_activate, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_REDO, 0, 0, NULL }, { GNOME_APP_UI_ITEM, N_("Remove Driver"), NULL, on_remove_driver_activate, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_UNDO, 0, 0, NULL }, GNOMEUIINFO_SEPARATOR, { GNOME_APP_UI_ITEM, N_("Enable Attention Status"), NULL, on_enable_attention_status_activate, NULL, NULL, GNOME_APP_PIXMAP_FILENAME, "hotplug/yellow-small.xpm", 0, 0, NULL }, { GNOME_APP_UI_ITEM, N_("Disable Attention Status"), NULL, on_disable_attention_status_activate, NULL, NULL, GNOME_APP_PIXMAP_FILENAME, "hotplug/disable-small.xpm", 0, 0, NULL }, GNOMEUIINFO_END};static GnomeUIInfo view_menu_uiinfo[] ={ { GNOME_APP_UI_ITEM, N_("Refresh"), NULL, on_refresh_activate, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_REFRESH, 0, 0, NULL }, GNOMEUIINFO_END};static GnomeUIInfo help_menu_uiinfo[] ={ { GNOME_APP_UI_ITEM, N_("About..."), NULL, on_about_activate, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT, 0, 0, NULL }, GNOMEUIINFO_END};static GnomeUIInfo menubar_uiinfo[] ={ { GNOME_APP_UI_SUBTREE, N_("File"), NULL, file_menu_uiinfo, NULL, NULL, GNOME_APP_PIXMAP_NONE, N_("File"), 0, 0, NULL }, { GNOME_APP_UI_SUBTREE, N_("Operations"), NULL, operations_menu_uiinfo, NULL, NULL, GNOME_APP_PIXMAP_NONE, N_("Operations"), 0, 0, NULL }, { GNOME_APP_UI_SUBTREE, N_("View"), NULL, view_menu_uiinfo, NULL, NULL, GNOME_APP_PIXMAP_NONE, N_("View"), 0, 0, NULL }, { GNOME_APP_UI_SUBTREE, N_("Help"), NULL, help_menu_uiinfo, NULL, NULL, GNOME_APP_PIXMAP_NONE, N_("Help"), 0, 0, NULL }, GNOMEUIINFO_END};// nullify global variablesGtkWidget* g_add_adapter_button = NULL;GtkWidget* g_add_adapter_menu_item = NULL;GtkWidget* g_remove_adapter_button = NULL;GtkWidget* g_remove_adapter_menu_item = NULL;GtkWidget* g_insert_driver_button = NULL;GtkWidget* g_insert_driver_menu_item = NULL;GtkWidget* g_remove_driver_button = NULL;GtkWidget* g_remove_driver_menu_item = NULL;GtkWidget* g_enable_att_status_button = NULL;GtkWidget* g_enable_att_status_menu_item = NULL;GtkWidget* g_disable_att_status_button = NULL;GtkWidget* g_disable_att_status_menu_item = NULL;GtkWidget*create_window (void){ GtkWidget *window; GtkWidget *vbox1; GtkWidget *menubar; GtkWidget *toolbar; GtkWidget *tmp_toolbar_icon; GtkWidget *Add; GtkWidget *Remove; GtkWidget *label5; GtkWidget *Insert; GtkWidget *Remove2; GtkWidget *label6; GtkWidget *Enable; GtkWidget *Disable; GtkWidget *label7; GtkWidget *Help; GtkWidget *hpaned1; GtkWidget *scrolledwindow1; GtkWidget *tree; GtkWidget *label8; GtkWidget *scrolledwindow2; GtkWidget *clist; GtkWidget *label9; GtkWidget *label10; GtkWidget *statusbar; allocate_colors(); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_object_set_data (GTK_OBJECT (window), "window", window); gtk_window_set_title (GTK_WINDOW (window), _("Compaq PCI Hot Plug for Linux")); gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER); gtk_window_set_default_size (GTK_WINDOW (window), 700, 500); g_window = window; vbox1 = gtk_vbox_new (FALSE, 0); gtk_widget_ref (vbox1); gtk_object_set_data_full (GTK_OBJECT (window), "vbox1", vbox1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (window), vbox1); menubar = gtk_menu_bar_new (); gtk_widget_ref (menubar); gtk_object_set_data_full (GTK_OBJECT (window), "menubar", menubar, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (menubar); gtk_box_pack_start (GTK_BOX (vbox1), menubar, FALSE, FALSE, 0); gnome_app_fill_menu (GTK_MENU_SHELL (menubar), menubar_uiinfo, NULL, FALSE, 0); gtk_widget_ref (menubar_uiinfo[0].widget); gtk_object_set_data_full (GTK_OBJECT (window), "file", menubar_uiinfo[0].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (file_menu_uiinfo[0].widget); gtk_object_set_data_full (GTK_OBJECT (window), "exit", file_menu_uiinfo[0].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (menubar_uiinfo[1].widget); gtk_object_set_data_full (GTK_OBJECT (window), "operations", menubar_uiinfo[1].widget, (GtkDestroyNotify) gtk_widget_unref); g_add_adapter_menu_item = operations_menu_uiinfo[0].widget; gtk_widget_ref (operations_menu_uiinfo[0].widget); gtk_object_set_data_full (GTK_OBJECT (window), "add_adapter", operations_menu_uiinfo[0].widget, (GtkDestroyNotify) gtk_widget_unref); g_remove_adapter_menu_item = operations_menu_uiinfo[1].widget; gtk_widget_ref (operations_menu_uiinfo[1].widget); gtk_object_set_data_full (GTK_OBJECT (window), "remove_adapter", operations_menu_uiinfo[1].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (operations_menu_uiinfo[2].widget); gtk_object_set_data_full (GTK_OBJECT (window), "separator1", operations_menu_uiinfo[2].widget, (GtkDestroyNotify) gtk_widget_unref); g_insert_driver_menu_item = operations_menu_uiinfo[3].widget; gtk_widget_ref (operations_menu_uiinfo[3].widget); gtk_object_set_data_full (GTK_OBJECT (window), "insert_driver", operations_menu_uiinfo[3].widget, (GtkDestroyNotify) gtk_widget_unref); g_remove_driver_menu_item = operations_menu_uiinfo[4].widget; gtk_widget_ref (operations_menu_uiinfo[4].widget); gtk_object_set_data_full (GTK_OBJECT (window), "remove_driver", operations_menu_uiinfo[4].widget, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_ref (operations_menu_uiinfo[5].widget); gtk_object_set_data_full (GTK_OBJECT (window), "separator", operations_menu_uiinfo[5].widget, (GtkDestroyNotify) gtk_widget_unref); g_enable_att_status_menu_item = operations_menu_uiinfo[6].widget;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -