static gboolean ppp_dialog_check_fields (GstConnectionDialog *dialog) { gchar *connection_type; gboolean valid = TRUE; if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->connection_configured))) return TRUE; connection_type = connection_combo_get_value (GTK_COMBO_BOX (dialog->ppp_type_combo)); if (!connection_type) return FALSE; if (strcmp (connection_type, "modem") == 0) valid = (get_entry_text (dialog->login) && get_entry_text (dialog->phone_number) && get_entry_text (gtk_bin_get_child (GTK_BIN (dialog->serial_port)))); else if (strcmp (connection_type, "isdn") == 0) valid = (get_entry_text (dialog->login) && get_entry_text (dialog->phone_number)); else if (strcmp (connection_type, "pppoe") == 0) valid = (get_entry_text (dialog->login) && gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->pppoe_interface_combo)) != -1); else if (strcmp (connection_type, "gprs") == 0) valid = (get_entry_text (dialog->apn) && get_entry_text (gtk_bin_get_child (GTK_BIN (dialog->serial_port)))); g_free (connection_type); return valid; }
static void wireless_dialog_save (GstConnectionDialog *dialog) { gchar *key_type; key_type = connection_combo_get_value (GTK_COMBO_BOX (dialog->key_type_combo)); g_object_set (G_OBJECT (dialog->iface), "essid", get_entry_text (gtk_bin_get_child (GTK_BIN (dialog->essid))), "key", get_entry_text (dialog->wep_key), "key-type", key_type, NULL); g_free (key_type); }
static void ethernet_dialog_save (GstConnectionDialog *dialog, gboolean active) { gchar *config_method = connection_combo_get_value (GTK_COMBO_BOX (dialog->bootproto_combo)); g_object_set (G_OBJECT (dialog->iface), "ip-address", get_entry_text (dialog->address), "ip-mask", get_entry_text (dialog->netmask), "gateway-address", get_entry_text (dialog->gateway), "config-method", config_method, NULL); g_free (config_method); }
void on_ppp_type_changed (GtkWidget *widget, gpointer data) { GstConnectionDialog *dialog; gchar *type; dialog = GST_NETWORK_TOOL (tool)->dialog; type = connection_combo_get_value (GTK_COMBO_BOX (dialog->ppp_type_combo)); on_dialog_changed (widget, data); if (!type) return; if (strcmp (type, "modem") == 0) { gtk_widget_show (dialog->modem_page); gtk_widget_show (dialog->isp_frame); gtk_widget_show (dialog->modem_settings_table); gtk_widget_show (dialog->modem_isp_table); gtk_widget_hide (dialog->pppoe_settings_table); gtk_widget_hide (dialog->gprs_isp_table); } else if (strcmp (type, "isdn") == 0) { gtk_widget_show (dialog->isp_frame); gtk_widget_show (dialog->modem_isp_table); gtk_widget_hide (dialog->modem_page); gtk_widget_hide (dialog->gprs_isp_table); } else if (strcmp (type, "pppoe") == 0) { gtk_widget_show (dialog->modem_page); gtk_widget_show (dialog->pppoe_settings_table); gtk_widget_show (dialog->modem_isp_table); gtk_widget_hide (dialog->isp_frame); gtk_widget_hide (dialog->modem_settings_table); } else if (strcmp (type, "gprs") == 0) { gtk_widget_show (dialog->modem_page); gtk_widget_show (dialog->isp_frame); gtk_widget_show (dialog->modem_settings_table); gtk_widget_show (dialog->gprs_isp_table); gtk_widget_hide (dialog->modem_isp_table); gtk_widget_hide (dialog->pppoe_settings_table); } }
void on_bootproto_changed (GtkWidget *widget, gpointer data) { GstConnectionDialog *dialog; gchar *method; gboolean enabled; dialog = GST_NETWORK_TOOL (tool)->dialog; method = connection_combo_get_value (GTK_COMBO_BOX (dialog->bootproto_combo)); enabled = (method && strcmp (method, "static") == 0); gtk_widget_set_sensitive (dialog->address, enabled); gtk_widget_set_sensitive (dialog->netmask, enabled); gtk_widget_set_sensitive (dialog->gateway, enabled); g_free (method); }
static gboolean ethernet_dialog_check_fields (GstConnectionDialog *dialog) { gchar *address, *netmask, *gateway, *config_method; gboolean active, ret; address = get_entry_text (dialog->address); netmask = get_entry_text (dialog->netmask); gateway = get_entry_text (dialog->gateway); config_method = connection_combo_get_value (GTK_COMBO_BOX (dialog->bootproto_combo)); active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->connection_configured)); ret = (!active || config_method && strcmp (config_method, "static") != 0 || (gst_filter_check_ip_address (address) == GST_ADDRESS_IPV4 && gst_filter_check_ip_address (netmask) == GST_ADDRESS_IPV4 && (!gateway || gst_filter_check_ip_address (gateway) == GST_ADDRESS_IPV4))); g_free (config_method); return ret; }
static void ppp_dialog_save (GstConnectionDialog *dialog) { gchar *connection_type; GtkTreeModel *model; GtkTreeIter iter; OobsIfaceEthernet *ethernet = NULL; connection_type = connection_combo_get_value (GTK_COMBO_BOX (dialog->ppp_type_combo)); model = gtk_combo_box_get_model (GTK_COMBO_BOX (dialog->pppoe_interface_combo)); if (gtk_tree_model_get_iter_first (model, &iter)) gtk_tree_model_get (model, &iter, 0, ðernet, -1); g_object_set (G_OBJECT (dialog->iface), "connection-type", connection_type, "login", get_entry_text (dialog->login), "password", get_entry_text (dialog->password), "phone-number", get_entry_text (dialog->phone_number), "phone-prefix", get_entry_text (dialog->dial_prefix), "default-gateway", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->default_gw)), "use-peer-dns", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->peerdns)), "persistent", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->persist)), "serial-port", get_entry_text (gtk_bin_get_child (GTK_BIN (dialog->serial_port))), "volume", gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->volume)), "dial-type", gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->dial_type)), "apn", get_entry_text (dialog->apn), "ethernet", ethernet, NULL); if (ethernet) g_object_unref (ethernet); g_free (connection_type); }