From 75dfd0f18c9a637675e56b65a1a97b95f3e7cdec Mon Sep 17 00:00:00 2001 From: Antony Mee Date: Sun, 6 Aug 2006 03:19:12 +0000 Subject: [PATCH] * Auto-hide nearly everything if no type is selected. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1934 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- .../pptp/properties/nm-ppp-properties.c | 32 ++++++++++++++++--- vpn-daemons/pptp/properties/vpnui_impl.c | 1 + vpn-daemons/pptp/properties/vpnui_opt.c | 1 + vpn-daemons/pptp/properties/vpnui_variant.c | 5 +-- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/vpn-daemons/pptp/properties/nm-ppp-properties.c b/vpn-daemons/pptp/properties/nm-ppp-properties.c index 7b6a0922f..61dfa0d88 100644 --- a/vpn-daemons/pptp/properties/nm-ppp-properties.c +++ b/vpn-daemons/pptp/properties/nm-ppp-properties.c @@ -393,6 +393,10 @@ impl_hide_and_show (NetworkManagerVpnUIImpl *impl) { GtkWidget *serial_options = NULL; GtkWidget *gprs_options = NULL; + GtkWidget *auth_options = NULL; + GtkWidget *comp_enc_options = NULL; + GtkWidget *routing_options = NULL; + GtkWidget *ppp_options = NULL; GtkWidget *bluetooth_front = NULL; GtkWidget *pptp_front = NULL; GtkWidget *dialup_front = NULL; @@ -404,10 +408,11 @@ impl_hide_and_show (NetworkManagerVpnUIImpl *impl) combo = GTK_COMBO_BOX(glade_xml_get_widget(impl->xml, "ppp-connection-type")); if (combo==NULL) return; - variant_name=gtk_combo_box_get_active_text(combo); - if (variant_name==NULL) return; -// ppp_options = glade_xml_get_widget(impl->xml, "ppp-options"); + ppp_options = glade_xml_get_widget(impl->xml, "ppp-options"); + auth_options = glade_xml_get_widget(impl->xml, "auth-options"); + comp_enc_options = glade_xml_get_widget(impl->xml, "comp-enc-options"); + routing_options = glade_xml_get_widget(impl->xml, "routing-options"); gprs_options = glade_xml_get_widget(impl->xml, "gprs-options"); serial_options = glade_xml_get_widget(impl->xml, "serial-options"); bluetooth_front = glade_xml_get_widget(impl->xml, "bluetooth-front"); @@ -419,15 +424,34 @@ impl_hide_and_show (NetworkManagerVpnUIImpl *impl) if (dialup_front) gtk_widget_hide(dialup_front); if (gprs_options) gtk_widget_hide(gprs_options); if (serial_options) gtk_widget_hide(serial_options); + if (ppp_options) gtk_widget_hide(ppp_options); + if (auth_options) gtk_widget_hide(auth_options); + if (comp_enc_options) gtk_widget_hide(comp_enc_options); + if (routing_options) gtk_widget_hide(routing_options); + + variant_name=gtk_combo_box_get_active_text(combo); + if (variant_name==NULL) return; if (strcmp(variant_name,"pptp")==0) { - if (pptp_front) gtk_widget_show(pptp_front); + if (pptp_front) gtk_widget_show(pptp_front); + if (ppp_options) gtk_widget_show(ppp_options); + if (auth_options) gtk_widget_show(auth_options); + if (comp_enc_options) gtk_widget_show(comp_enc_options); + if (routing_options) gtk_widget_show(routing_options); } else if (strcmp(variant_name,"dialup")==0) { if (dialup_front) gtk_widget_show(dialup_front); if (serial_options) gtk_widget_show(serial_options); + if (ppp_options) gtk_widget_show(ppp_options); + if (auth_options) gtk_widget_show(auth_options); + if (comp_enc_options) gtk_widget_show(comp_enc_options); + if (routing_options) gtk_widget_show(routing_options); } else if (strcmp(variant_name,"btgprs")==0) { if (bluetooth_front) gtk_widget_show(bluetooth_front); if (gprs_options) gtk_widget_show(gprs_options); if (serial_options) gtk_widget_show(serial_options); + if (ppp_options) gtk_widget_show(ppp_options); + if (auth_options) gtk_widget_show(auth_options); + if (comp_enc_options) gtk_widget_show(comp_enc_options); + if (routing_options) gtk_widget_show(routing_options); } } diff --git a/vpn-daemons/pptp/properties/vpnui_impl.c b/vpn-daemons/pptp/properties/vpnui_impl.c index 0822389c8..39b89bce2 100644 --- a/vpn-daemons/pptp/properties/vpnui_impl.c +++ b/vpn-daemons/pptp/properties/vpnui_impl.c @@ -40,6 +40,7 @@ impl_clear_widget (NetworkManagerVpnUIImpl *impl) g_return_if_fail(impl!=NULL); if (impl->connection_name_opt!=NULL) vpnui_opt_set(impl->connection_name_opt,""); + if (impl->variant_combo!=NULL) gtk_combo_box_set_active(impl->variant_combo,-1); if (impl->defaults!=NULL) for (item=impl->config_options; item != NULL; item = g_slist_next(item)) { diff --git a/vpn-daemons/pptp/properties/vpnui_opt.c b/vpn-daemons/pptp/properties/vpnui_opt.c index e02f5a408..3a53a66a3 100644 --- a/vpn-daemons/pptp/properties/vpnui_opt.c +++ b/vpn-daemons/pptp/properties/vpnui_opt.c @@ -183,6 +183,7 @@ void vpnui_opt_set(VpnUIConfigOption *opt, const char *value) return; } } + gtk_combo_box_set_active(GTK_COMBO_BOX(opt->widget),-1); break; } diff --git a/vpn-daemons/pptp/properties/vpnui_variant.c b/vpn-daemons/pptp/properties/vpnui_variant.c index 926b93d3a..95a16ba79 100644 --- a/vpn-daemons/pptp/properties/vpnui_variant.c +++ b/vpn-daemons/pptp/properties/vpnui_variant.c @@ -80,6 +80,8 @@ vpnui_variant_byname (NetworkManagerVpnUIImpl *impl, const char *name) GSList *item; VpnUIVariant *variant; + if (name==NULL) return NULL; + for (item=impl->variants; item != NULL; item = g_slist_next(item)) { variant = (VpnUIVariant *)item->data; @@ -113,10 +115,9 @@ vpnui_variant_select_byname (NetworkManagerVpnUIImpl *impl, const char *name) VpnUIVariant *variant; g_return_if_fail(impl != NULL); - g_return_if_fail(name != NULL); variant = vpnui_variant_byname(impl,name); - g_return_if_fail(variant != NULL); + if (variant == NULL) return; vpnui_variant_select(variant); }