r495 - in trunk: . scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Feb 20 05:18:40 EST 2008


Author: icculus
Date: 2008-02-20 05:18:39 -0500 (Wed, 20 Feb 2008)
New Revision: 495

Modified:
   trunk/gui.h
   trunk/gui_gtkplus2.c
   trunk/gui_macosx.c
   trunk/gui_ncurses.c
   trunk/gui_stdio.c
   trunk/gui_www.c
   trunk/lua_glue.c
   trunk/scripts/mojosetup_mainline.lua
Log:
Let UI targets know when a new item in the progress dialog is starting, so
 the stdio UI can always print a new line of text for each file...otherwise,
 it was printing one line every second, so it would look like you installed
 a handful of files from any package...now it's one line for each file, and
 a big file might take several lines if it writes out over several seconds.

Every other UI just treats the new entry point as a no-op, as they don't need
 the information for these purposes.


Modified: trunk/gui.h
===================================================================
--- trunk/gui.h	2008-02-20 01:14:28 UTC (rev 494)
+++ trunk/gui.h	2008-02-20 10:18:39 UTC (rev 495)
@@ -80,7 +80,7 @@
 #define MOJOGUI_ENTRY_POINT_STR DEFINE_TO_STR(MOJOGUI_ENTRY_POINT)
 
 // Increment this value when MojoGui's structure changes.
-#define MOJOGUI_INTERFACE_REVISION 4
+#define MOJOGUI_INTERFACE_REVISION 5
 
 typedef struct MojoGui MojoGui;
 struct MojoGui
@@ -101,6 +101,7 @@
     char * (*destination)(const char **recommendations, int recnum,
                           int *command, boolean can_back, boolean can_fwd);
     boolean (*insertmedia)(const char *medianame);
+    void (*progressitem)(void);
     boolean (*progress)(const char *type, const char *component,
                         int percent, const char *item, boolean can_cancel);
     void (*final)(const char *msg);
@@ -152,6 +153,7 @@
 static char *MojoGui_##module##_destination(const char **r, int recnum, \
                             int *command, boolean can_back, boolean can_fwd); \
 static boolean MojoGui_##module##_insertmedia(const char *medianame); \
+static void MojoGui_##module##_progressitem(void); \
 static boolean MojoGui_##module##_progress(const char *typ, const char *comp, \
                                            int percent, const char *item, \
                                            boolean can_cancel); \
@@ -173,6 +175,7 @@
             MojoGui_##module##_options, \
             MojoGui_##module##_destination, \
             MojoGui_##module##_insertmedia, \
+            MojoGui_##module##_progressitem, \
             MojoGui_##module##_progress, \
             MojoGui_##module##_final, \
         }; \

Modified: trunk/gui_gtkplus2.c
===================================================================
--- trunk/gui_gtkplus2.c	2008-02-20 01:14:28 UTC (rev 494)
+++ trunk/gui_gtkplus2.c	2008-02-20 10:18:39 UTC (rev 495)
@@ -794,6 +794,12 @@
 } // MojoGui_gtkplus2_insertmedia
 
 
+static void MojoGui_gtkplus2_progressitem(void)
+{
+    // no-op in this UI target.
+} // MojoGui_gtkplus2_progressitem
+
+
 static boolean MojoGui_gtkplus2_progress(const char *type, const char *component,
                                          int percent, const char *item,
                                          boolean can_cancel)

Modified: trunk/gui_macosx.c
===================================================================
--- trunk/gui_macosx.c	2008-02-20 01:14:28 UTC (rev 494)
+++ trunk/gui_macosx.c	2008-02-20 10:18:39 UTC (rev 495)
@@ -196,6 +196,12 @@
 } // MojoGui_macosx_insertmedia
 
 
+static void MojoGui_macosx_progressitem(void)
+{
+    STUBBED("macosx progressitem");
+} // MojoGui_macosx_progressitem
+
+
 static int MojoGui_macosx_progress(const char *type, const char *component,
                                    int percent, const char *item,
                                    boolean can_cancel)

Modified: trunk/gui_ncurses.c
===================================================================
--- trunk/gui_ncurses.c	2008-02-20 01:14:28 UTC (rev 494)
+++ trunk/gui_ncurses.c	2008-02-20 10:18:39 UTC (rev 495)
@@ -1357,6 +1357,12 @@
 } // MojoGui_ncurses_insertmedia
 
 
+static void MojoGui_ncurses_progressitem(void)
+{
+    // no-op in this UI target.
+} // MojoGui_ncurses_progressitem
+
+
 static boolean MojoGui_ncurses_progress(const char *type, const char *component,
                                         int percent, const char *item,
                                         boolean can_cancel)

Modified: trunk/gui_stdio.c
===================================================================
--- trunk/gui_stdio.c	2008-02-20 01:14:28 UTC (rev 494)
+++ trunk/gui_stdio.c	2008-02-20 10:18:39 UTC (rev 495)
@@ -599,6 +599,13 @@
 } // MojoGui_stdio_insertmedia
 
 
+static void MojoGui_stdio_progressitem(void)
+{
+    // force new line of output on next call to MojoGui_stdio_progress()
+    percentTicks = 0;
+} // MojoGui_stdio_progressitem
+
+
 static boolean MojoGui_stdio_progress(const char *type, const char *component,
                                       int percent, const char *item,
                                       boolean can_cancel)
@@ -617,7 +624,9 @@
         printf("%s\n%s\n", type, component);
     } // if
 
-    // limit update spam... will only write every one second, tops.
+    // limit update spam... will only write every one second, tops,
+    //  on any given filename, but it writes each filename at least once
+    //  so it doesn't look like we only installed a few things.
     if (percentTicks <= now)
     {
         char *fmt = NULL;

Modified: trunk/gui_www.c
===================================================================
--- trunk/gui_www.c	2008-02-20 01:14:28 UTC (rev 494)
+++ trunk/gui_www.c	2008-02-20 10:18:39 UTC (rev 495)
@@ -1015,6 +1015,12 @@
 } // MojoGui_www_insertmedia
 
 
+static void MojoGui_www_progressitem(void)
+{
+    // no-op in this UI target.
+} // MojoGui_www_progressitem
+
+
 static boolean MojoGui_www_progress(const char *type, const char *component,
                                     int percent, const char *item,
                                     boolean can_cancel)

Modified: trunk/lua_glue.c
===================================================================
--- trunk/lua_glue.c	2008-02-20 01:14:28 UTC (rev 494)
+++ trunk/lua_glue.c	2008-02-20 10:18:39 UTC (rev 495)
@@ -1491,6 +1491,13 @@
 } // luahook_gui_insertmedia
 
 
+static int luahook_gui_progressitem(lua_State *L)
+{
+    GGui->progressitem();
+    return 0;
+} // luahook_gui_progressitem
+
+
 static int luahook_gui_progress(lua_State *L)
 {
     const char *type = luaL_checkstring(L, 1);
@@ -1694,6 +1701,7 @@
             set_cfunc(luaState, luahook_gui_options, "options");
             set_cfunc(luaState, luahook_gui_destination, "destination");
             set_cfunc(luaState, luahook_gui_insertmedia, "insertmedia");
+            set_cfunc(luaState, luahook_gui_progressitem, "progressitem");
             set_cfunc(luaState, luahook_gui_progress, "progress");
             set_cfunc(luaState, luahook_gui_final, "final");
             set_cfunc(luaState, luahook_gui_stop, "stop");

Modified: trunk/scripts/mojosetup_mainline.lua
===================================================================
--- trunk/scripts/mojosetup_mainline.lua	2008-02-20 01:14:28 UTC (rev 494)
+++ trunk/scripts/mojosetup_mainline.lua	2008-02-20 10:18:39 UTC (rev 495)
@@ -397,6 +397,7 @@
     -- !!! FIXME: perms may be nil...we need a MojoSetup.defaultPermsString()...
     manifest_add(MojoSetup.manifest, dest, manifestkey, "file", perms, nil, nil)
 
+    MojoSetup.gui.progressitem()
     local written, sums = writefn(callback)
     if not written then
         if not keepgoing then
@@ -1456,6 +1457,7 @@
                 end
 
                 MojoSetup.loginfo("Download '" .. url .. "' to '" .. f .. "'")
+                MojoSetup.gui.progressitem()
                 local downloaded, sums = MojoSetup.download(url, f, nil, nil, callback)
                 if not downloaded then
                     MojoSetup.fatal(_("File download failed!"))
@@ -1813,6 +1815,7 @@
             end
 
             local item = string.gsub(fname, "^.*/", "", 1)  -- chop off dirs...
+            MojoSetup.gui.progressitem()
             MojoSetup.gui.progress(ptype, component, percent, item, false)
             return true  -- !!! FIXME: need to disable cancel button in UI...
         end




More information about the mojosetup-commits mailing list