Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwife.git;a=commitdiff;h=2b59178290335c0691c4a506bffe0e571d1917c6

commit 2b59178290335c0691c4a506bffe0e571d1917c6
Author: Elentir <elen...@mailoo.org>
Date:   Mon Dec 28 21:30:02 2009 +0100

add msgbox to apply the current network config in netconf plugin

diff --git a/src/plugins/configsource.c b/src/plugins/configsource.c
index 132a50f..fad681d 100644
--- a/src/plugins/configsource.c
+++ b/src/plugins/configsource.c
@@ -55,7 +55,7 @@ static GtkWidget *viewserver = NULL;

extern GtkWidget *assistant;

-int run_net_config();
+int run_net_config(GList **config);
int is_connected(char *host, int port, int timeouttime);

enum
@@ -319,7 +319,7 @@ int prerun(GList **config)
switch(fwife_question(_("You need an active internet connection ,\n do you want 
to configure your network now?")))
{
case GTK_RESPONSE_YES:
-                               while(run_net_config() == -1) {}
+                               while(run_net_config(config) == -1) {}
break;
case GTK_RESPONSE_NO:
break;
@@ -997,9 +997,7 @@ int post_net_config(fwnet_profile_t *newprofile, 
fwnet_interface_t *interface)

char *host = strdup("frugalware");
fwnet_writeconfig(newprofile, host);
-       free(host);
-       free(newprofile);
-       free(interface);
+       free(host);

system("netconfig start");

@@ -1098,7 +1096,7 @@ int select_interface(fwnet_interface_t *interface)
return 0;
}

-int run_net_config()
+int run_net_config(GList **config)
{
char *nettype = NULL;
char *ptr = NULL;
@@ -1119,8 +1117,11 @@ int run_net_config()
return -1;

nettype = ask_nettype();
-       if(nettype == NULL)
+       if(nettype == NULL) {
+               free(newprofile);
+               free(newinterface);
return -1;
+       }

if(fwnet_is_wireless_device(newinterface->name)) {
switch(fwife_question(_("It seems that this network card has a wireless 
extension.\n\nConfigure your wireless now?")))
@@ -1149,11 +1150,19 @@ int run_net_config()
} else if(!strcmp(nettype, "static")) {
configure_static(newinterface);
} else {
+               free(newprofile);
+               free(newinterface);
return -1;
}

-       if(post_net_config(newprofile, newinterface) == -1)
+       if(post_net_config(newprofile, newinterface) == -1) {
+               free(newprofile);
+               free(newinterface);
return -1;
+       }
+
+       /* save network profile for later usage in netconf*/
+       data_put(config, "netprofile", newprofile);

return 0;
}
diff --git a/src/plugins/netconf.c b/src/plugins/netconf.c
index 52afe03..6fc9b1c 100644
--- a/src/plugins/netconf.c
+++ b/src/plugins/netconf.c
@@ -814,6 +814,20 @@ int prerun(GList **config)
GtkWidget *cellview;
GtkTreeIter iter;

+       fwnet_profile_t *oldprofile = (fwnet_profile_t*)data_get(*config, 
"netprofile");
+       if(oldprofile != NULL) {
+               switch(fwife_question(_("You can now reconfigure your network 
if you want to configure others interfaces or just apply current network 
configuration.\n\n\
+                       Do you want to apply the current configuration ?")))
+               {
+                       case GTK_RESPONSE_YES:
+                               newprofile = oldprofile;
+                               skip_to_next_plugin();
+                               return 0;
+                       case GTK_RESPONSE_NO:
+                               break;
+               }
+       }
+
cellview = gtk_cell_view_new ();
connectimg = gtk_widget_render_icon (cellview, GTK_STOCK_NETWORK,
GTK_ICON_SIZE_BUTTON, NULL);
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to