📄 prefs.c
字号:
// ------------------------------------- // Workstation Utils Tab: // ------------------------------------- if (ifconfig_flag == 0) { gtk_toggle_button_set_active((GtkToggleButton *) ifconfig_arp, 1); } else if (ifconfig_flag == 1) { gtk_toggle_button_set_active((GtkToggleButton *) ifconfig_promisc, 1); } else if (ifconfig_flag == 2) { gtk_toggle_button_set_active((GtkToggleButton *) ifconfig_allmulti, 1); } // Workstation Utils Tab: df options // ------------------------------------- gtk_toggle_button_set_active((GtkToggleButton *) check_df_a, df_flag_a); gtk_toggle_button_set_active((GtkToggleButton *) check_df_h, df_flag_h); gtk_toggle_button_set_active((GtkToggleButton *) check_df_T, df_flag_t); // Workstation Utils Tab: netstat options // ------------------------------------- if (netstat_flag == 0) { gtk_toggle_button_set_active((GtkToggleButton *) netstat_u, 1); } else if (netstat_flag == 1) { gtk_toggle_button_set_active((GtkToggleButton *) netstat_M, 1); } else if (netstat_flag == 2) { gtk_toggle_button_set_active((GtkToggleButton *) netstat_i, 1); } else if (netstat_flag == 3) { gtk_toggle_button_set_active((GtkToggleButton *) netstat_p, 1); } // ------------------------------------- // Grep Prefs Tab: // ------------------------------------- if (grep_flag == 0) { gtk_toggle_button_set_active((GtkToggleButton *) ps_flag_none, 1); } else if (grep_flag == 1) { gtk_toggle_button_set_active((GtkToggleButton *) ps_flag_e, 1); } else if (grep_flag == 2) { gtk_toggle_button_set_active((GtkToggleButton *) ps_flag_eh, 1); } else if (grep_flag == 3) { gtk_toggle_button_set_active((GtkToggleButton *) ps_flag_efh, 1); } gtk_toggle_button_set_active((GtkToggleButton *) checkbutton_grep_case, use_grep_i_flag); gtk_toggle_button_set_active((GtkToggleButton *) checkbutton_omit_sh, omit_grep_sh_output); // ------------------------------------- // Network Prefs Tab: Ping Options // ------------------------------------- gtk_spin_button_set_value((GtkSpinButton *) spinbutton1, (float) ping_c); gtk_spin_button_set_value((GtkSpinButton *) spinbutton2, (float) ping_w); gtk_spin_button_set_value((GtkSpinButton *) spinbutton3, (float) ping_i); // Network Prefs Tab: Traceroute Options // ------------------------------------- gtk_toggle_button_set_active((GtkToggleButton *) checkbutton_traceroute_n, use_traceroute_n); // Network Prefs Tab: Host Options // ------------------------------------- gtk_toggle_button_set_active((GtkToggleButton *) checkbutton_host_v, use_host_v); // Network Prefs Tab: Finger Options // ------------------------------------- if (finger_flag == 0) { gtk_toggle_button_set_active((GtkToggleButton *) finger_s, 1); } else if (finger_flag == 1) { gtk_toggle_button_set_active((GtkToggleButton *) finger_l, 1); } // Network Prefs Tab: Nslookup Options // ------------------------------------- gtk_spin_button_set_value((GtkSpinButton *) spinbutton4, (float) nslookup_retries); gtk_spin_button_set_value((GtkSpinButton *) spinbutton5, (float) nslookup_timeout); return;}// ------------------------------------------------------------------------- //// ------------------------------------------------------------------------- //// ----------------> Preferences Dialog Callbacks <----------------- //// ------------------------------------------------------------------------- //// ------------------------------------------------------------------------- //voidon_propertybox1_apply (GnomePropertyBox *gnomepropertybox, gint arg1, gpointer user_data){ // This function is called whenever the <APPLY> button is clicked, --OR-- // when <OK> is clicked after making a change to a widget and // gnome_property_box_changed() has been called. // Gnome docs had this (?) if (arg1 != -1) { return; } // PREF: Toolbar Setting // As of 12/2001, GLADE doe snot support callbacks for GtkOptionMenu (see the FAQ) // Brents Cheap Way Out(tm): // just get the setting when the dialog is closing and before pref values // are written to disk -> we dont really need any functionality outside of this. on_optionmenu_toolbar_clicked(NULL, NULL); // Call function to save all prefs variables to gwcc.conf file! if (save_all_changes(gnomepropertybox, 0, NULL) != 0) { gnome_dialog_run_and_close(GNOME_DIALOG(gnome_error_dialog ("OOPS! Something Went Wrong!\nPlease email me the Error Dialog string..."))); } // Apply Toolbar Settings to Main Application Window (utils.c) // as soon as we can (on Pref Dialog <OK> or <Apply> button pressed) set_current_toolbar_style(NULL);}// ------------------------------------------------------------------------- //// ---------------> General Options TAB - Callbacks <---------------- //// ------------------------------------------------------------------------- //// Save File Options: Timestamp Files?// -----------------------------------voidon_checkbutton_ts_files_toggled (GtkToggleButton *togglebutton, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * checkbutton_ts_files = lookup_widget(propertybox1, "checkbutton_ts_files"); // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox*)propertybox1); // All Global Variables are set here (not in individual callbacks). if (GTK_TOGGLE_BUTTON(checkbutton_ts_files)->active) { timestamp_saved_file = 1; } else { timestamp_saved_file = 0; }}// Save File Options: OVERWRITE// ----------------------------voidon_radiobutton_save_overwrite_toggled (GtkToggleButton *button, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * radiobutton_save_overwrite = lookup_widget(propertybox1, "radiobutton_save_overwrite"); // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox *) propertybox1); // Set Preferences Value if (GTK_TOGGLE_BUTTON(radiobutton_save_overwrite)->active) { file_save_flag = 0; }}// Save File Options: APPEND// -------------------------voidon_radiobutton_save_append_toggled (GtkToggleButton *button, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * radiobutton_save_append = lookup_widget(propertybox1, "radiobutton_save_append"); // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox *) propertybox1); // Set Preferences Value if (GTK_TOGGLE_BUTTON(radiobutton_save_append)->active) { file_save_flag = 1; }}// Save File Options: SEQUENTIAL// -----------------------------voidon_radiobutton_save_seq_toggled (GtkToggleButton *button, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * radiobutton_save_seq = lookup_widget(propertybox1, "radiobutton_save_seq"); // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox *) propertybox1); // Set Preferences Value if (GTK_TOGGLE_BUTTON(radiobutton_save_seq)->active) { file_save_flag = 2; }}// General Options: Fixed Font Size// ---------------------------------voidon_fontpicker1_font_set (GnomeFontPicker *gnomefontpicker, gchar *arg1, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * fontpicker1 = lookup_widget(propertybox1, "fontpicker1"); fixed_font_ptr = gnome_font_picker_get_font_name((GnomeFontPicker*) fontpicker1); sprintf(fixed_font, "%s", fixed_font_ptr); // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox *) propertybox1);}voidon_radiobutton_units_m_toggled (GtkToggleButton *togglebutton, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * radiobutton_units_m = lookup_widget(propertybox1, "radiobutton_units_m"); // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox *) propertybox1); // Set Preferences Value if (GTK_TOGGLE_BUTTON(radiobutton_units_m)->active) { display_units = 0; }}voidon_radiobutton_units_k_toggled (GtkToggleButton *togglebutton, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * radiobutton_units_k = lookup_widget(propertybox1, "radiobutton_units_k"); // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox *) propertybox1); // Set Preferences Value if (GTK_TOGGLE_BUTTON(radiobutton_units_k)->active) { display_units = 1; }}// General Options: Timestamp Output// ---------------------------------voidon_check_add_timestamp_toggled (GtkToggleButton *togglebutton, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * check_add_timestamp = lookup_widget(propertybox1, "check_add_timestamp"); // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox *) propertybox1); // Set Preferences Value if (GTK_TOGGLE_BUTTON(check_add_timestamp)->active) { timestamp_scn_output = 1; } else { timestamp_scn_output = 0; }}// ------------------------------------------------------------------------- //// ---------------> Workstation Utils TAB - Callbacks <---------------- //// ------------------------------------------------------------------------- //voidon_ifconfig_arp_toggled (GtkToggleButton *togglebutton, gpointer user_data){ // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox*)propertybox1); // All Global Variables are set here (not in individual callbacks). ifconfig_flag = 0;}voidon_ifconfig_promisc_toggled (GtkToggleButton *togglebutton, gpointer user_data){ // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox*)propertybox1); // All Global Variables are set here (not in individual callbacks). ifconfig_flag = 1;}voidon_ifconfig_allmulti_toggled (GtkToggleButton *togglebutton, gpointer user_data){ // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox*)propertybox1); // All Global Variables are set here (not in individual callbacks). ifconfig_flag = 2;}voidon_check_df_a_toggled (GtkToggleButton *togglebutton, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * check_df_a = lookup_widget(propertybox1, "check_df_a"); // Activate 'Apply' button and 'Save' callback in Prefs Dialog. gnome_property_box_changed((GnomePropertyBox *) propertybox1); // Set Preferences Value if (GTK_TOGGLE_BUTTON(check_df_a)->active) { df_flag_a = 1; } else { df_flag_a = 0; }}voidon_check_df_h_toggled (GtkToggleButton *togglebutton, gpointer user_data){ // Get pointers to window widgets and declare local variables GtkWidget * check_df_h = lookup_widget(propertybox1, "check_df_h"); // Activate 'Apply' button and 'Save' callback in Prefs Dialog.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -