diff --git a/vpn-daemons/pptp/properties/nm-ppp-dialog.glade b/vpn-daemons/pptp/properties/nm-ppp-dialog.glade index 5084a5b43d..f946a037bd 100644 --- a/vpn-daemons/pptp/properties/nm-ppp-dialog.glade +++ b/vpn-daemons/pptp/properties/nm-ppp-dialog.glade @@ -230,14 +230,13 @@ - True False True - Show on connection on menu + Requires existing network connection True GTK_RELIEF_NORMAL True - False + True False True @@ -705,14 +704,14 @@ - + 10 True False 0 - + True False 4 @@ -957,14 +956,14 @@ - + 10 True False 0 - + True False 0 @@ -991,7 +990,7 @@ 0 - + True When this check box is cleared the "noauth" option is passed to pppd. True @@ -1124,14 +1123,14 @@ - + 10 True False 0 - + True False 6 @@ -1408,14 +1407,14 @@ - + 10 True False 0 - + True False 6 @@ -2132,14 +2131,14 @@ - + 10 True False 0 - + True False 4 @@ -2264,14 +2263,14 @@ - + 10 True False 0 - + True False 4 diff --git a/vpn-daemons/pptp/properties/nm-ppp-properties.c b/vpn-daemons/pptp/properties/nm-ppp-properties.c index 9cceb8189b..7b6a0922f8 100644 --- a/vpn-daemons/pptp/properties/nm-ppp-properties.c +++ b/vpn-daemons/pptp/properties/nm-ppp-properties.c @@ -42,7 +42,7 @@ #define BUILD_BLUETOOTH -#define VPNUI_DISPLAY_NAME _("Tunnel via pppd") +#define VPNUI_DISPLAY_NAME _("pppd tunnel (PPTP, BTGPRS, Dialup)") #define VPNUI_SERVICE_NAME "org.freedesktop.NetworkManager.ppp_starter" #define VPNUI_BASIC_DEFAULTS "connection-name='';" \ "ppp-debug=no;" \ @@ -50,9 +50,9 @@ "usepeerdns-overtunnel=yes;" \ "ppp-lock=yes;" \ "ppp-auth-peer=no;" \ - "refuse-eap=no;" \ - "refuse-chap=no;" \ - "refuse-mschap=no;" \ + "ppp-refuse-eap=no;" \ + "ppp-refuse-chap=no;" \ + "ppp-refuse-mschap=no;" \ "lcp-echo-failure=10;" \ "lcp-echo-interval=10;" \ "use-routes=no;" \ @@ -85,8 +85,8 @@ "compress-mppc=no;" \ "compress-bsd=no;" \ "compress-deflate=no;" \ - "mru=1400;" \ - "mtu=1400;" + "mru=1416;" \ + "mtu=1416;" #define VPNUI_DIALUP_DEFAULTS "phone-number=THIS DOESN'T DO ANYTHING;" \ "ppp-crtscts=yes;" \ "ppp-modem=yes;" \ @@ -103,6 +103,7 @@ #endif void impl_setup (NetworkManagerVpnUIImpl *impl); +void impl_hide_and_show (NetworkManagerVpnUIImpl *impl); void use_routes_toggled (GtkToggleButton *togglebutton, gpointer user_data); void editable_changed (GtkEditable *editable, gpointer user_data); void variant_changed (GtkComboBox *combo, gpointer user_data); @@ -292,11 +293,13 @@ impl_setup (NetworkManagerVpnUIImpl *impl) "routes" , VPN_UI_OPTTYPE_STRING , "routes", "X-NM-Routes", _("Specific networks available"), GTK_SIGNAL_FUNC(&editable_changed), &vld_routes_if_sens, impl ); + impl->routes_opt = opt; opt = vpnui_opt_new( "use-routes" , VPN_UI_OPTTYPE_YESNO , "use-routes", "Use-Routes", _("Limit to specific networks"), GTK_SIGNAL_FUNC(&use_routes_toggled), NULL, impl ); + impl->routes_toggle_opt = opt; variant = vpnui_variant_new( "pptp","Windows VPN (PPTP)", VPNUI_BASIC_DEFAULTS VPNUI_PPTP_DEFAULTS, @@ -328,7 +331,7 @@ impl_setup (NetworkManagerVpnUIImpl *impl) // Attach an import_button impl->w_import_button = GTK_BUTTON (glade_xml_get_widget (impl->xml, - "import-button")); + "import-config-button")); } void @@ -372,6 +375,8 @@ variant_changed (GtkComboBox *combo, gpointer user_data) vpnui_variant_select_byname(impl,variant_name); + impl_hide_and_show(impl); + // vpnui_expand_reset_all(impl); if (impl->callback != NULL) { @@ -383,3 +388,46 @@ variant_changed (GtkComboBox *combo, gpointer user_data) } +void +impl_hide_and_show (NetworkManagerVpnUIImpl *impl) +{ + GtkWidget *serial_options = NULL; + GtkWidget *gprs_options = NULL; + GtkWidget *bluetooth_front = NULL; + GtkWidget *pptp_front = NULL; + GtkWidget *dialup_front = NULL; + GtkComboBox *combo = NULL; + char *variant_name; + + if (impl==NULL) return; + if (impl->xml==NULL) return; + + 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"); + 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"); + dialup_front = glade_xml_get_widget(impl->xml, "dialup-front"); + pptp_front = glade_xml_get_widget(impl->xml, "pptp-front"); + + if (pptp_front) gtk_widget_hide(pptp_front); + if (bluetooth_front) gtk_widget_hide(bluetooth_front); + 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 (strcmp(variant_name,"pptp")==0) { + if (pptp_front) gtk_widget_show(pptp_front); + } else if (strcmp(variant_name,"dialup")==0) { + if (dialup_front) gtk_widget_show(dialup_front); + if (serial_options) gtk_widget_show(serial_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); + } +} diff --git a/vpn-daemons/pptp/properties/vpnui_impl.c b/vpn-daemons/pptp/properties/vpnui_impl.c index 5ad47d5131..1e0dd7e6f5 100644 --- a/vpn-daemons/pptp/properties/vpnui_impl.c +++ b/vpn-daemons/pptp/properties/vpnui_impl.c @@ -18,6 +18,7 @@ extern const char *GLADE_FILE; extern const char *GLADE_WIDGET; extern void impl_setup (NetworkManagerVpnUIImpl *impl); +extern void impl_hide_and_show (NetworkManagerVpnUIImpl *impl); static void impl_set_validity_changed_callback (NetworkManagerVpnUI *self, @@ -38,14 +39,15 @@ impl_clear_widget (NetworkManagerVpnUIImpl *impl) g_return_if_fail(impl!=NULL); - vpnui_opt_set(impl->connection_name_opt,""); + if (impl->connection_name_opt!=NULL) vpnui_opt_set(impl->connection_name_opt,""); if (impl->defaults!=NULL) for (item=impl->config_options; item != NULL; item = g_slist_next(item)) { vpnui_opt_set_default((VpnUIConfigOption *)item->data, impl->defaults); } - vpnui_expand_reset_all(impl); +// vpnui_expand_reset_all(impl); + impl_hide_and_show(impl); } static const char * @@ -97,12 +99,13 @@ impl_get_widget (NetworkManagerVpnUI *self, GSList *properties, GSList *routes, } str = g_string_free (route_str, FALSE); - vpnui_opt_set(impl->routes_opt,str); - vpnui_opt_set(impl->routes_toggle_opt,"yes"); + if(impl->routes_opt!=NULL) vpnui_opt_set(impl->routes_opt,str); + if(impl->routes_toggle_opt!=NULL) vpnui_opt_set(impl->routes_toggle_opt,"yes"); g_free (str); } - vpnui_expand_reset_all(impl); +// vpnui_expand_reset_all(impl); + impl_hide_and_show(impl); return impl->widget; } @@ -275,6 +278,8 @@ import_from_file (NetworkManagerVpnUIImpl *impl, const char *path) g_free (basename); + impl_hide_and_show(impl); + return file_is_good; // if (!file_is_good) { @@ -292,6 +297,15 @@ import_from_file (NetworkManagerVpnUIImpl *impl, const char *path) // } } +static void +show_widget (GtkWidget *widget, gpointer user_data) +{ + g_warning("Widget show event"); + + impl_hide_and_show((NetworkManagerVpnUIImpl *) user_data); +} + + static void import_button_clicked (GtkButton *button, gpointer user_data) { @@ -385,8 +399,8 @@ export_to_file (NetworkManagerVpnUIImpl *impl, const char *path, } str = g_string_free (route_str, FALSE); - vpnui_opt_set(impl->routes_opt,str); - vpnui_opt_set(impl->routes_toggle_opt,"yes"); + if (impl->routes_opt!=NULL) vpnui_opt_set(impl->routes_opt,str); + if (impl->routes_toggle_opt!=NULL) vpnui_opt_set(impl->routes_toggle_opt,"yes"); g_free (str); } @@ -515,6 +529,9 @@ impl_get_object (void) "clicked", GTK_SIGNAL_FUNC (import_button_clicked), impl); } + gtk_signal_connect (GTK_OBJECT (impl->widget), + "show", GTK_SIGNAL_FUNC (show_widget), impl); + /* make the widget reusable */ gtk_signal_connect (GTK_OBJECT (impl->widget), "delete-event", GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete), NULL); diff --git a/vpn-daemons/pptp/properties/vpnui_impl.h b/vpn-daemons/pptp/properties/vpnui_impl.h index a5d12cc277..d157e0fcfa 100644 --- a/vpn-daemons/pptp/properties/vpnui_impl.h +++ b/vpn-daemons/pptp/properties/vpnui_impl.h @@ -6,6 +6,7 @@ #define NM_VPN_API_SUBJECT_TO_CHANGE #include + struct impl_config { const char *display_name; @@ -21,10 +22,13 @@ struct impl_config typedef struct _VpnUIConfigOption VpnUIConfigOption; typedef struct _NetworkManagerVpnUIImpl NetworkManagerVpnUIImpl; +typedef void (*VpnUIHideShowCallback) (NetworkManagerVpnUIImpl *self); + struct _NetworkManagerVpnUIImpl { NetworkManagerVpnUI parent; NetworkManagerVpnUIDialogValidityCallback callback; + VpnUIHideShowCallback do_hide_and_show; gpointer callback_user_data; GladeXML *xml; diff --git a/vpn-daemons/pptp/properties/vpnui_variant.c b/vpn-daemons/pptp/properties/vpnui_variant.c index c4f39df1b9..926b93d3ac 100644 --- a/vpn-daemons/pptp/properties/vpnui_variant.c +++ b/vpn-daemons/pptp/properties/vpnui_variant.c @@ -104,7 +104,6 @@ vpnui_variant_select (VpnUIVariant *variant) for (item=impl->config_options; item != NULL; item = g_slist_next(item)) { vpnui_opt_set_default((VpnUIConfigOption *)item->data, impl->defaults); } - }