Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=8dd3fbf7801aa43ec7f32000ed7ceb1be4a134d6

commit 8dd3fbf7801aa43ec7f32000ed7ceb1be4a134d6
Author: James Buren <[email protected]>
Date:   Fri Sep 7 01:45:53 2012 -0500

move check for base group selection to UI from module

diff --git a/src/install.c b/src/install.c
index 54bd370..9b32fb9 100644
--- a/src/install.c
+++ b/src/install.c
@@ -637,36 +637,10 @@ static bool install_run(void)
if(!install_groups_get(&groups))
return false;

-  while(true)
+  if(!ui_window_install(groups))
{
-    bool success = ui_window_install(groups);
-    struct install *grp = 0;
-
-    if(!success)
-    {
-      install_groups_free(groups);
-      return false;
-    }
-
-    for( grp = groups ; grp->name != 0 ; ++grp )
-      if(strcmp(grp->name,"base") == 0)
-        break;
-
-    if(grp == 0)
-    {
-      errno = EINVAL;
-      fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
-      install_groups_free(groups);
-      return false;
-    }
-
-    if(!grp->checked)
-    {
-      ui_dialog_text(_("Group Selection Error"),_("You must select at least 
the 'base' group.\n"));
-      continue;
-    }
-
-    break;
+    install_groups_free(groups);
+    return false;
}

if(!install_groups_install(groups))
diff --git a/src/text.h b/src/text.h
index 739a97c..ff8fa5c 100644
--- a/src/text.h
+++ b/src/text.h
@@ -16,5 +16,7 @@
#define PASSWORD_MISMATCH_TEXT _("The passwords you have entered do not 
match.\n")
#define INSTALL_TITLE _("Package Group Selection")
#define INSTALL_TEXT _("Please select which package groups you wish to 
install.\n")
+#define NO_BASE_TITLE _("Group Selection Error")
+#define NO_BASE_TEXT _("You must select at least the base package group.\n")
#define ROOT_TITLE _("Changing Root Password")
#define ROOT_TEXT _("Please enter a password below that is at least 6 
characters long.\n")
diff --git a/src/ui_newt.c b/src/ui_newt.c
index 2a73626..d3792ab 100644
--- a/src/ui_newt.c
+++ b/src/ui_newt.c
@@ -386,7 +386,7 @@ extern bool ui_window_install(struct install *data)
newtComponent next = 0;
newtComponent checkboxtree = 0;
int i = 0;
-  struct install *pkg = 0;
+  struct install *grp = 0;
newtComponent form = 0;
struct newtExitStruct es = {0};
bool result = true;
@@ -424,14 +424,14 @@ extern bool ui_window_install(struct install *data)

newtCheckboxTreeSetWidth(checkboxtree,checkboxtree_width);

-  pkg = data;
+  grp = data;

-  while(pkg->name != 0)
+  while(grp->name != 0)
{
-    
newtCheckboxTreeAddItem(checkboxtree,pkg->name,&pkg->checked,0,i,NEWT_ARG_LAST);
-    newtCheckboxTreeSetEntryValue(checkboxtree,&pkg->checked,(pkg->checked) ? 
'*' : ' ');
+    
newtCheckboxTreeAddItem(checkboxtree,grp->name,&grp->checked,0,i,NEWT_ARG_LAST);
+    newtCheckboxTreeSetEntryValue(checkboxtree,&grp->checked,(grp->checked) ? 
'*' : ' ');
++i;
-    ++pkg;
+    ++grp;
}

form = newtForm(0,0,NEWT_FLAG_NOF12);
@@ -446,17 +446,33 @@ extern bool ui_window_install(struct install *data)

if(es.reason == NEWT_EXIT_COMPONENT && es.u.co == next)
{
+      grp = data;
+
+      while(grp->name != 0)
+      {
+        if(strcmp(grp->name,"base") == 0)
+          break;
+        ++grp;
+      }
+
+      if(grp != 0 && newtCheckboxTreeGetEntryValue(checkboxtree,&grp->checked) 
!= '*')
+      {
+        ui_dialog_text(NO_BASE_TITLE,NO_BASE_TEXT);
+        continue;
+      }
+
result = true;
+
break;
}
}

-  pkg = data;
+  grp = data;

-  while(pkg->name != 0)
+  while(grp->name != 0)
{
-    pkg->checked = (newtCheckboxTreeGetEntryValue(checkboxtree,&pkg->checked) 
== '*');
-    ++pkg;
+    grp->checked = (newtCheckboxTreeGetEntryValue(checkboxtree,&grp->checked) 
== '*');
+    ++grp;
}

newtFormDestroy(form);
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to