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

commit 30c173bdca8ff41f061dd0b740b5faa4a845a2b7
Author: James Buren <[email protected]>
Date:   Sat Aug 11 13:13:24 2012 -0500

import greeting module

diff --git a/begin.c b/begin.c
new file mode 100644
index 0000000..1e82144
--- /dev/null
+++ b/begin.c
@@ -0,0 +1,75 @@
+#include "fwsetup.h"
+
+#define TEXTBOX_TEXT _(                        \
+"Welcome to the Frugalware Linux Installer!\n" \
+"\n"                                           \
+"Please click 'Next' to continue.\n"           \
+)
+
+#define NEXTBUTTON_TEXT _("Next")
+
+
+
+static enum order run_begin(struct database *db)
+{
+  assert(db != 0);
+
+#ifdef NEWT
+  int tb_width = 0;
+  int tb_height = 0;
+  int nb_width = 0;
+  int nb_height = 0;
+  newtComponent tb = 0;
+  newtComponent nb = 0;
+  newtComponent form = 0;
+  struct newtExitStruct es;
+
+  memzero(&es,sizeof(struct newtExitStruct));
+
+  if(!get_text_size(TEXTBOX_TEXT,&tb_width,&tb_height) || 
!get_button_size(NEXTBUTTON_TEXT,&nb_width,&nb_height))
+  {
+    eprintf(TEXTSIZE_TEXT);
+    return ORDER_ERROR;
+  }
+
+  
if(newtOpenWindow(db->window_x,db->window_y,db->window_width,db->window_height,WINDOWTITLE_TEXT)
 != 0)
+  {
+    eprintf(NEWTWINDOW_TEXT);
+    return ORDER_ERROR;
+  }
+
+  tb = newtTextbox(0,0,tb_width,tb_height,0);
+
+  newtTextboxSetText(tb,TEXTBOX_TEXT);
+
+  nb = 
newtButton(db->window_width-nb_width,db->window_height-nb_height,NEXTBUTTON_TEXT);
+
+  form = newtForm(0,0,0);
+
+  newtFormAddComponents(form,tb,nb,(void *) 0);
+
+  while(true)
+  {
+    newtFormRun(form,&es);
+
+    if(es.reason == NEWT_EXIT_COMPONENT && es.u.co == nb)
+      break;
+
+    memzero(&es,sizeof(struct newtExitStruct));
+  }
+
+  newtFormDestroy(form);
+
+  newtPopWindow();
+#endif
+
+  return ORDER_NEXT;
+}
+
+struct module module_begin =
+{
+  __FILE__,
+  run_begin
+};
+
+// -%- strip: yes; add-newline: yes; use-tabs: no; indent-width: 2; tab-width: 
2; -%-
diff --git a/fwsetup.c b/fwsetup.c
index 9f06b11..df69cd0 100644
--- a/fwsetup.c
+++ b/fwsetup.c
@@ -28,6 +28,8 @@ extern int main(void)

db.window_y = (db.screen_height - db.window_height) / 2;

+  module_begin.run(&db);
+
newtFinished();
#endif

diff --git a/fwsetup.h b/fwsetup.h
index fc97f83..c409904 100644
--- a/fwsetup.h
+++ b/fwsetup.h
@@ -54,5 +54,6 @@ struct module

extern void eprintf(const char *s,...) __attribute__((format(printf,1,2)));;
extern int main(void);
+extern struct module module_begin;

// -%- strip: yes; add-newline: yes; use-tabs: no; indent-width: 2; tab-width: 
2; -%-
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to