Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=a8ffb85f3c69cafce78ed24c52a21e3077ed02e0
commit a8ffb85f3c69cafce78ed24c52a21e3077ed02e0 Author: James Buren <[email protected]> Date: Fri Sep 7 01:30:01 2012 -0500 move all titles and textbox strings to text.h diff --git a/src/install.c b/src/install.c index 460e417..54bd370 100644 --- a/src/install.c +++ b/src/install.c @@ -639,7 +639,7 @@ static bool install_run(void) while(true) { - bool success = ui_window_install(INSTALL_TITLE_TEXT,groups); + bool success = ui_window_install(groups); struct install *grp = 0; if(!success) diff --git a/src/local.h b/src/local.h index 5e7bfa6..070f67d 100644 --- a/src/local.h +++ b/src/local.h @@ -60,8 +60,8 @@ extern int ui_main(int argc,char **argv); extern void ui_dialog_text(const char *title,const char *text); extern bool ui_dialog_yesno(const char *title,const char *text,bool defaultno); extern bool ui_dialog_progress(const char *title,const char *text,int percent); -extern bool ui_window_root(const char *title,const char *text,struct account *data); -extern bool ui_window_install(const char *title,struct install *groups); +extern bool ui_window_root(struct account *data); +extern bool ui_window_install(struct install *groups); extern FILE *logfile; extern int main(int argc,char **argv); diff --git a/src/text.h b/src/text.h index f1532db..739a97c 100644 --- a/src/text.h +++ b/src/text.h @@ -10,12 +10,11 @@ #define PASSWORD_ENTER_TEXT _("Enter Password") #define PASSWORD_CONFIRM_TEXT _("Confirm Password") #define PASSWORD_LENGTH 6 -#define PASSWORD_SHORT_TITLE _("Passwords Too Short") -#define PASSWORD_SHORT_TEXT _("Your passwords must be at least 6 characters long.\n") +#define PASSWORD_SHORT_TITLE _("Password Too Short") +#define PASSWORD_SHORT_TEXT _("Your password must be at least 6 characters long.\n") #define PASSWORD_MISMATCH_TITLE _("Passwords Do Not Match") #define PASSWORD_MISMATCH_TEXT _("The passwords you have entered do not match.\n") - -#define INSTALL_TITLE_TEXT _("Package Group Selection") -#define INSTALL_WINDOW_TEXT _( \ -"It is now time to select which package groups to install.\n" \ -) +#define INSTALL_TITLE _("Package Group Selection") +#define INSTALL_TEXT _("Please select which package groups you wish to install.\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 d39b133..2a73626 100644 --- a/src/ui_newt.c +++ b/src/ui_newt.c @@ -38,7 +38,7 @@ extern int ui_main(int argc,char **argv) while(true) { - module = modules[n + 1]; + module = modules[n]; if(module == 0) break; @@ -70,11 +70,6 @@ extern int ui_main(int argc,char **argv) ++n; } - struct account root; - - if(ui_window_root("test","Root!\n",&root)) - fprintf(logfile,"%s\n",root.password); - newtFinished(); return code; @@ -265,7 +260,7 @@ extern bool ui_dialog_progress(const char *title,const char *text,int percent) return true; } -extern bool ui_window_root(const char *title,const char *text,struct account *data) +extern bool ui_window_root(struct account *data) { int textbox_width = 0; int textbox_height = 0; @@ -289,14 +284,14 @@ extern bool ui_window_root(const char *title,const char *text,struct account *da newtComponent form = 0; struct newtExitStruct es = {0}; - if(title == 0 || text == 0 || data == 0) + if(data == 0) { errno = EINVAL; fprintf(logfile,"%s: %s\n",__func__,strerror(errno)); return false; } - if(!get_text_screen_size(text,&textbox_width,&textbox_height)) + if(!get_text_screen_size(ROOT_TEXT,&textbox_width,&textbox_height)) return false; if(!get_label_screen_size(PASSWORD_ENTER_TEXT,&label1_width,&label1_height)) @@ -314,7 +309,7 @@ extern bool ui_window_root(const char *title,const char *text,struct account *da if(!get_button_screen_size(NEXT_BUTTON_TEXT,&next_width,&next_height)) return false; - if(newtCenteredWindow(NEWT_WIDTH,NEWT_HEIGHT,title) != 0) + if(newtCenteredWindow(NEWT_WIDTH,NEWT_HEIGHT,ROOT_TITLE) != 0) { fprintf(logfile,_("Failed to open a NEWT window.\n")); return false; @@ -322,7 +317,7 @@ extern bool ui_window_root(const char *title,const char *text,struct account *da textbox = newtTextbox(0,0,textbox_width,textbox_height,0); - newtTextboxSetText(textbox,text); + newtTextboxSetText(textbox,ROOT_TEXT); label1 = newtLabel(0,textbox_height+1,PASSWORD_ENTER_TEXT); @@ -379,7 +374,7 @@ extern bool ui_window_root(const char *title,const char *text,struct account *da return true; } -extern bool ui_window_install(const char *title,struct install *data) +extern bool ui_window_install(struct install *data) { int textbox_width = 0; int textbox_height = 0; @@ -396,25 +391,32 @@ extern bool ui_window_install(const char *title,struct install *data) struct newtExitStruct es = {0}; bool result = true; - if(!get_text_screen_size(INSTALL_WINDOW_TEXT,&textbox_width,&textbox_height)) - return 0; + if(data == 0) + { + errno = EINVAL; + fprintf(logfile,"%s: %s\n",__func__,strerror(errno)); + return false; + } + + if(!get_text_screen_size(INSTALL_TEXT,&textbox_width,&textbox_height)) + return false; if(!get_button_screen_size(NEXT_BUTTON_TEXT,&next_width,&next_height)) - return 0; + return false; checkboxtree_width = NEWT_WIDTH; checkboxtree_height = NEWT_HEIGHT - textbox_height - next_height - 2; - if(newtCenteredWindow(NEWT_WIDTH,NEWT_HEIGHT,title) != 0) + if(newtCenteredWindow(NEWT_WIDTH,NEWT_HEIGHT,INSTALL_TITLE) != 0) { fprintf(logfile,_("Failed to open a NEWT window.\n")); - return 0; + return false; } textbox = newtTextbox(0,0,textbox_width,textbox_height,0); - newtTextboxSetText(textbox,INSTALL_WINDOW_TEXT); + newtTextboxSetText(textbox,INSTALL_TEXT); next = newtButton(NEWT_WIDTH-next_width,NEWT_HEIGHT-next_height,NEXT_BUTTON_TEXT); _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
