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

commit 97660a61f3041eeb97e185a667217775385d94c4
Author: James Buren <[email protected]>
Date:   Sat Aug 11 16:01:30 2012 -0500

import goodbye module

diff --git a/end.c b/end.c
new file mode 100644
index 0000000..6037103
--- /dev/null
+++ b/end.c
@@ -0,0 +1,89 @@
+#include "fwsetup.h"
+
+#define TEXTBOX_TEXT _(                               \
+"Frugalware Linux has been successfully installed.\n" \
+"\n"                                                  \
+"Please click 'Next' to exit.\n"                      \
+)
+
+static enum order end_run(struct database *db)
+{
+  assert(db != 0);
+
+  enum order order = ORDER_NONE;
+
+#ifdef NEWT
+  int tb_width = 0;
+  int tb_height = 0;
+  int pb_width = 0;
+  int pb_height = 0;
+  int nb_width = 0;
+  int nb_height = 0;
+  newtComponent tb = 0;
+  newtComponent pb = 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(PREVIOUSBUTTON_TEXT,&pb_width,&pb_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);
+
+  pb = 
newtButton(db->window_width-pb_width-nb_width,db->window_height-pb_height,PREVIOUSBUTTON_TEXT);
+
+  nb = 
newtButton(db->window_width-nb_width,db->window_height-nb_height,NEXTBUTTON_TEXT);
+
+  form = newtForm(0,0,0);
+
+  newtFormAddComponents(form,tb,pb,nb,(void *) 0);
+
+  newtFormSetCurrent(form,nb);
+
+  while(true)
+  {
+    newtFormRun(form,&es);
+
+    if(es.reason == NEWT_EXIT_COMPONENT && es.u.co == pb)
+    {
+      order = ORDER_PREVIOUS;
+      break;
+    }
+
+    if(es.reason == NEWT_EXIT_COMPONENT && es.u.co == nb)
+    {
+      order = ORDER_NEXT;
+      break;
+    }
+
+    memzero(&es,sizeof(struct newtExitStruct));
+  }
+
+  newtFormDestroy(form);
+
+  newtPopWindow();
+#endif
+
+  return order;
+}
+
+struct module end_module =
+{
+  __FILE__,
+  end_run
+};
+
+// -%- strip: yes; add-newline: yes; use-tabs: no; indent-width: 2; tab-width: 
2; -%-
diff --git a/fwsetup.c b/fwsetup.c
index e95eea8..a4d78f6 100644
--- a/fwsetup.c
+++ b/fwsetup.c
@@ -1,6 +1,6 @@
#include "fwsetup.h"

-#define MODULE_COUNT (2 + 1)
+#define MODULE_COUNT (2 + 2)
#define EMPTY_MODULE (&(struct module) { 0, 0 })

static struct database db;
@@ -17,6 +17,8 @@ extern int main(void)

modules[1] = begin_module;

+  modules[2] = end_module;
+
db.locale = setlocale(LC_ALL,"");

#ifdef NEWT
diff --git a/fwsetup.h b/fwsetup.h
index 79761bf..0755d1f 100644
--- a/fwsetup.h
+++ b/fwsetup.h
@@ -58,5 +58,6 @@ struct module
extern void eprintf(const char *s,...) __attribute__((format(printf,1,2)));;
extern int main(void);
extern struct module begin_module;
+extern struct module end_module;

// -%- 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