Implemented captive-install-acquire Gnome interface.
authorshort <>
Sat, 6 Sep 2003 14:14:58 +0000 (14:14 +0000)
committershort <>
Sat, 6 Sep 2003 14:14:58 +0000 (14:14 +0000)
Various multi-UI code generalizations.

19 files changed:
TODO
autogen.pl
configure.in
src/install/acquire/Makefile.am
src/install/acquire/cabinet.c
src/install/acquire/captivemodid.c
src/install/acquire/captivemodid.h
src/install/acquire/final.c [new file with mode: 0644]
src/install/acquire/final.h [new file with mode: 0644]
src/install/acquire/main.c
src/install/acquire/main.h
src/install/acquire/moduriload.c
src/install/acquire/ui-gnome-support.c [new file with mode: 0644]
src/install/acquire/ui-gnome-support.h [new file with mode: 0644]
src/install/acquire/ui-gnome.c [new file with mode: 0644]
src/install/acquire/ui-gnome.glade [new file with mode: 0644]
src/install/acquire/ui-gnome.gladep [new file with mode: 0644]
src/install/acquire/ui-gnome.h [new file with mode: 0644]
src/install/acquire/ui-line.c

diff --git a/TODO b/TODO
index c3a8d3b..c080c34 100644 (file)
--- a/TODO
+++ b/TODO
@@ -15,3 +15,4 @@ Why native NT autocheck (=w/o errors) the volume after our DISMOUNT_VOLUME?
  - ntfsprogs: not updated last ('boot backup') media sector due to Linux kernel
 'src/install/fstab/' should not reformat '/etc/fstab' - how to modify it?
 'src/install/acquire/cabextract/' should be GnomeVFS cabextract:// module.
+Fix 'src/install/acquire/' GTK+ compiler warning - see its 'Makefile.am'.
index a9ba200..cb3e53d 100755 (executable)
@@ -49,6 +49,10 @@ AutoGen->run(
                                ./src/client/gnomevfs/captive.conf
                                ./src/install/fstab/captive-install-fstab
                                ./src/install/acquire/captive-install-acquire
+                               ./src/install/acquire/ui-gnome-callbacks.[ch]
+                               ./src/install/acquire/ui-gnome-interface.[ch]
+                               ./src/install/acquire/ui-gnome.glade.bak
+                               ./src/install/acquire/ui-gnome.gladep.bak
                                ./src/libcaptive/cc/marshallers.[ch]
                                ./src/libcaptive/ke/exports.c
                                ./src/libcaptive/reactos/*/*.[cS]
index 96adad4..a6a726b 100644 (file)
@@ -261,6 +261,10 @@ AC_CHECK_LIB(ntfs,ntfs_mount,
 AC_SUBST(LIBNTFS_LIBS)
 AM_CONDITIONAL(HAVE_LIBNTFS,test -n "$LIBNTFS_LIBS")
 
+PKG_CHECK_MODULES(GNOMEUI,libgnomeui-2.0)
+AC_SUBST(GNOMEUI_CFLAGS)
+AC_SUBST(GNOMEUI_LIBS)
+
 
 AC_SUBST(CFLAGS)
 AC_SUBST(LIBS)
index d5a5443..8051567 100644 (file)
 
 include $(top_srcdir)/Makefile-head.am
 
+GLADE_IN= \
+               ui-gnome.glade \
+               ui-gnome.gladep
+
+GLADE_OUT= \
+               ui-gnome-interface.c \
+               ui-gnome-interface.h \
+               ui-gnome-callbacks.h
+
 captive_install_acquire_SOURCES= \
                cabextract/cabextract.c \
                cabextract/cabextract.h \
@@ -27,6 +36,8 @@ captive_install_acquire_SOURCES= \
                captivemodid.h \
                diskscan.c \
                diskscan.h \
+               final.c \
+               final.h \
                main.c \
                main.h \
                microsoftcom.c \
@@ -34,19 +45,49 @@ captive_install_acquire_SOURCES= \
                moduriload.c \
                moduriload.h \
                ui-line.c \
-               ui-line.h
+               ui-line.h \
+               ui-gnome.c \
+               ui-gnome.h \
+               ui-gnome-support.c \
+               ui-gnome-support.h \
+               $(GLADE_OUT)
+
+EXTRA_DIST+= \
+               $(GLADE_IN) \
+               cabextract/.vimrc
+
+captive_install_acquire-ui-gnome-interface.$(OBJEXT): ui-gnome-callbacks.h
+
+# touch(1) as 'ui-gnome-callbacks.h' are not overwritten if not changed:
+$(GLADE_OUT): $(GLADE_IN)
+       glade-2 --write-source $<
+       @touch ui-gnome-callbacks.h
+
+CLEANFILES+= \
+               ui-gnome-callbacks.c \
+               ui-gnome.glade.bak \
+               ui-gnome.gladep.bak
+
 captive_install_acquire_CFLAGS=$(GNOME_VFS_CFLAGS) $(LIBXML_CFLAGS) $(OPENSSL_CFLAGS)
-captive_install_acquire_LDADD =$(GNOME_VFS_LIBS)   $(LIBXML_LIBS)   $(OPENSSL_LIBS)   $(LIBNTFS_LIBS) $(POPT_LIBS)
-captive_install_acquire_LDADD+= $(READLINE_LIBS)    $(INTLLIBS)
+captive_install_acquire_LDADD =$(GNOME_VFS_LIBS)   $(LIBXML_LIBS)   $(OPENSSL_LIBS)
+captive_install_acquire_LDADD+= $(READLINE_LIBS)    $(LIBNTFS_LIBS) $(POPT_LIBS) $(INTLLIBS)
 captive_install_acquire_LDFLAGS=$(READLINE_LDFLAGS)
 
+# FIXME: /usr/include/gtk-2.0/gtk/gtkitemfactory.h:51: warning: function declaration isn't a prototype
+# /* We use () here to mean unspecified arguments. This is deprecated
+#  * as of C99, but we can't change it without breaking compatibility.
+#  * (Note that if we are included from a C++ program () will mean
+#  * (void) so an explicit cast will be needed.)
+#  */
+# typedef void  (*GtkItemFactoryCallback)  ();
+# We cannot put '-Wno-strict-prototypes' as we get always overriden by $(CFLAGS) !
+captive_install_acquire_CFLAGS+=$(GNOMEUI_CFLAGS)
+captive_install_acquire_LDADD +=$(GNOMEUI_LIBS)
+
 captive_install_acquire_CFLAGS+=-DSYSCONFDIR="$(sysconfdir)"
 captive_install_acquire_CFLAGS+=-DVARLIBCAPTIVEDIR="$(localstatedir)/lib/$(PACKAGE)"
 captive_install_acquire_LDADD+=../libcaptive-install/libcaptive-install.a
 
-EXTRA_DIST+= \
-               cabextract/.vimrc
-
 sysconf_DATA= \
                w32-mod-id.captivemodid.xml
 
index f18695c..d9ba35c 100644 (file)
@@ -37,7 +37,10 @@ void acquire_cabinet_seek(struct acquire_cabinet *acquire_cabinet,GnomeVFSFileOf
 {
        g_return_if_fail(acquire_cabinet!=NULL);
 
-       (*ui_search_is_aborted)();
+       /* Do not: (*ui_progress)(acquire_cabinet->uri);
+        * as we currently extract some specific file out of it.
+        */
+       (*ui_progress)(NULL);
 
        acquire_cabinet->offset=offset;
 }
@@ -46,7 +49,7 @@ void acquire_cabinet_seek_skip(struct acquire_cabinet *acquire_cabinet,GnomeVFSF
 {
        g_return_if_fail(acquire_cabinet!=NULL);
 
-       (*ui_search_is_aborted)();
+       (*ui_progress)(NULL);
 
        acquire_cabinet->offset+=offset;
 }
@@ -55,7 +58,7 @@ GnomeVFSFileOffset acquire_cabinet_tell(struct acquire_cabinet *acquire_cabinet)
 {
        g_return_val_if_fail(acquire_cabinet!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
 
-       (*ui_search_is_aborted)();
+       (*ui_progress)(NULL);
 
        return acquire_cabinet->offset;
 }
@@ -74,7 +77,7 @@ GnomeVFSFileSize bytes_read_now;
        g_return_val_if_fail(acquire_cabinet!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
        g_return_val_if_fail(buffer!=NULL || bytes==0,GNOME_VFS_ERROR_BAD_PARAMETERS);
 
-       if ((*ui_search_is_aborted)())
+       if ((*ui_progress)(NULL))
                return GNOME_VFS_ERROR_INTERRUPTED;
 
        bytes=MAX(0,MIN(bytes,acquire_cabinet->size-acquire_cabinet->offset));
@@ -209,7 +212,7 @@ int file_write(struct file *fi, UBYTE *buf, size_t length)
        g_return_val_if_fail(fi==file_write_fi_assertion,0);
        g_return_val_if_fail(file_write_bytearray!=NULL,0);
 
-       if ((*ui_search_is_aborted)())
+       if ((*ui_progress)(NULL))
                return 0;
 
        g_byte_array_append(file_write_bytearray,buf,length);
@@ -224,7 +227,7 @@ struct file *filelist,*fi;
 
        g_return_if_fail(acquire_cabinet!=NULL);
 
-       if ((*ui_search_is_aborted)())
+       if ((*ui_progress)(acquire_cabinet->uri))
                return;
 
        basecab=find_cabs_in_file(acquire_cabinet);
@@ -244,8 +247,11 @@ GnomeVFSURI *uri_fi;
                if (!captivemodid_module_length_is_valid(fi->length))
                        continue;
 
-               if ((*ui_search_is_aborted)())
+               uri_fi=gnome_vfs_uri_append_file_name(acquire_cabinet->uri,fi->filename);
+               if ((*ui_progress)(uri_fi)) {
+                       gnome_vfs_uri_unref(uri_fi);
                        return;
+                       }
 
                file_write_fi_assertion=fi;
                file_write_bytearray=g_byte_array_new();
@@ -256,11 +262,11 @@ GnomeVFSURI *uri_fi;
                if (fi->length!=file_write_bytearray->len) {
                        g_byte_array_free(file_write_bytearray,
                                        TRUE);  /* free_segment */
+                       gnome_vfs_uri_unref(uri_fi);
                        continue;
                        }
                file_buffer=g_byte_array_free(file_write_bytearray,
                                FALSE); /* free_segment */
-               uri_fi=gnome_vfs_uri_append_file_name(acquire_cabinet->uri,fi->filename);
                mod_uri_load_file_from_memory(file_buffer,fi->length,uri_fi);
                gnome_vfs_uri_unref(uri_fi);
                g_free(file_buffer);
index cc14139..e1998ba 100644 (file)
@@ -241,6 +241,17 @@ fail_free_module:
        g_free(module);
 }
 
+static void captivemodid_load_foreach
+               (const xmlChar *type /* key */,gpointer priority_gpointer /* value */,gpointer user_data /* unused */)
+{
+       g_return_if_fail(type!=NULL);
+
+       g_return_if_fail(captivemodid_module_best_priority_notify!=NULL);
+
+       (*captivemodid_module_best_priority_notify)(type);
+}
+
+void (*captivemodid_module_best_priority_notify)(const gchar *module_type);
 
 gboolean captivemodid_load(const gchar *captivemodid_pathname)
 {
@@ -279,5 +290,10 @@ const xmlChar *xml_name;
                        }
                }
        xmlFreeTextReader(xml_reader);
+
+       if (captivemodid_module_best_priority_notify) {
+               g_hash_table_foreach(module_type_best_priority_hash,
+                                               (GHFunc)captivemodid_load_foreach,NULL);
+               }
        return TRUE;
 }
index bc0390f..f654f34 100644 (file)
@@ -24,6 +24,7 @@
 #include <glib/gtypes.h>
 #include <libgnomevfs/gnome-vfs-file-size.h>
 #include <libxml/tree.h>       /* for xmlChar */
+#include <glib/ghash.h>
 
 
 G_BEGIN_DECLS
@@ -36,6 +37,8 @@ struct captivemodid_module {
        gint priority;
        };
 
+extern void (*captivemodid_module_best_priority_notify)(const gchar *module_type);
+
 gchar *calc_md5(gconstpointer base,size_t length);
 gboolean captivemodid_module_length_is_valid(GnomeVFSFileSize file_size);
 struct captivemodid_module *captivemodid_module_md5_lookup(const gchar *file_md5);
diff --git a/src/install/acquire/final.c b/src/install/acquire/final.c
new file mode 100644 (file)
index 0000000..508efd9
--- /dev/null
@@ -0,0 +1,81 @@
+/* $Id$
+ * Final result message of drivers acquiring installation utility
+ * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "final.h"     /* self */
+#include <glib/gmessages.h>
+#include <stdio.h>
+#include <mntent.h>
+#include <glib/gstring.h>
+#include <string.h>
+
+#include <captive/macros.h>
+
+
+/* Config: */
+#define FILENAME_ETC_FSTAB        "/etc/fstab"
+
+
+gchar *final_text(gboolean all_modules_found)
+{
+const gchar *base;
+FILE *mntentfiler;
+struct mntent *mntent;
+GString *gstring;
+gboolean any_dirs_found;
+
+       if (!all_modules_found)
+               base=_(
+                               "Although essential modules (\"ntoskrnl.exe\" and \"ntfs.sys\") are available "
+                               "you may still want to get their better version and/or more modules. ");
+       else 
+               base=_("All needed modules were found in their best preferred versions.");
+       gstring=g_string_new(base);
+
+       any_dirs_found=FALSE;
+       /* FIXME: locking! */
+       if (!(mntentfiler=setmntent(FILENAME_ETC_FSTAB,"r")))
+               g_error(_("Cannot open \"%s\" for reading: %m"),FILENAME_ETC_FSTAB);
+       while ((mntent=getmntent(mntentfiler))) {
+               if (strcmp(mntent->mnt_type,"captive-ntfs"))
+                       continue;
+               if (!any_dirs_found) {
+                       gstring=g_string_append(gstring,captive_printf_alloca(_("\n"
+                                       "Found NTFS disk partitions are prepared in %s. "
+                                       "You can mount them by commands mount(8) or usermount(1) such as:\n"
+                                       "\tmount /mnt/captive-LABEL_C\n"
+                                       "Available captive-ntfs partitions:"),FILENAME_ETC_FSTAB));
+                       any_dirs_found=TRUE;
+                       }
+               gstring=g_string_append(gstring,"\n\t");
+               gstring=g_string_append(gstring,mntent->mnt_dir);
+               }
+       if (!any_dirs_found)
+               gstring=g_string_append(gstring,_("\n"
+                               "Despite drivers were found no NTFS disk partitions were found on your computer. "
+                               "You still can mount read/write NTFS partitions by using filesystem type 'captive-ntfs' such as:\n"
+                               "\tmkdir /mnt/captive-LABEL_C\n"
+                               "\tmount -t captive-ntfs /dev/hda1 /mnt/captive-LABEL_C"));
+       if (1!=endmntent(mntentfiler))
+               g_warning(_("Cannot close \"%s\" after reading: %m"),FILENAME_ETC_FSTAB);
+       
+       return g_string_free(gstring,
+                       FALSE); /* free_segment */
+}
diff --git a/src/install/acquire/final.h b/src/install/acquire/final.h
new file mode 100644 (file)
index 0000000..1cd9263
--- /dev/null
@@ -0,0 +1,34 @@
+/* $Id$
+ * Include file for final result message of drivers acquiring installation utility
+ * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_INSTALL_ACQUIRE_FINAL_H
+#define _CAPTIVE_INSTALL_ACQUIRE_FINAL_H 1
+
+
+#include <glib/gtypes.h>
+
+
+G_BEGIN_DECLS
+
+gchar *final_text(gboolean all_modules_found);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_INSTALL_ACQUIRE_FINAL_H */
index 5983c1e..abd4799 100644 (file)
 #include <libgnomevfs/gnome-vfs-init.h>
 #include "ui-line.h"
 #include "microsoftcom.h"
+#include <libgnomevfs/gnome-vfs-uri.h>
+#include "diskscan.h"
+#include "moduriload.h"
+#include <libgnome/gnome-program.h>
+#include <libgnomeui/gnome-ui-init.h>
+#include <setjmp.h>
+#include "ui-gnome.h"
 
 #include <captive/macros.h>
 
 
-#include "captivemodid.h"
-#include <glib/glist.h>
-#include "moduriload.h"
-#include "diskscan.h"
-
-
 int optarg_verbose;
 int optarg_dry;
 static int optarg_microsoft_com;
 static int optarg_scan_disks;
 static int optarg_scan_disks_quick;
+static int optarg_text;
 static char *optarg_modid_path=G_STRINGIFY(SYSCONFDIR) "/w32-mod-id.captivemodid.xml";
 static GList *optarg_scan_path_list;   /* of (char *) */
 
@@ -68,6 +70,8 @@ static const struct poptOption popt_table[]={
                        argDescrip: (argDescripP), \
                }
 
+               BUG_ACQUIRE_POPT(0  ,"text"            ,POPT_ARG_NONE  ,&optarg_text   ,0,
+                               N_("Disable Gnome UI; --text must be first argument"),NULL),
                BUG_ACQUIRE_POPT('v',"verbose"         ,POPT_ARG_NONE  ,&optarg_verbose,0,N_("Display additional debug information"),NULL),
                BUG_ACQUIRE_POPT('n',"dry"             ,POPT_ARG_NONE  ,&optarg_dry    ,0,N_("No modifications, no files written"),NULL),
                BUG_ACQUIRE_POPT(0  ,"modid-path"      ,POPT_ARG_STRING|POPT_ARGFLAG_SHOW_DEFAULT,&optarg_modid_path,0,
@@ -81,10 +85,14 @@ static const struct poptOption popt_table[]={
                                N_("Download from microsoft.com; Legal: You may need to have valid Microsoft Windows XP license."),NULL),
 
 #undef BUG_ACQUIRE_POPT
-               POPT_AUTOHELP
                POPT_TABLEEND
                };
 
+static const struct poptOption popt_table_autohelp[]={
+               { NULL,'\0',POPT_ARG_INCLUDE_TABLE,(struct poptOption *)&popt_table,0,PACKAGE },
+               POPT_AUTOHELP
+               POPT_TABLEEND
+               };
 
 /* poptCallbackType captive_popt_callback */
 static void acquire_popt_callback
@@ -100,12 +108,14 @@ static void acquire_popt_callback
 
 void (*ui_interactive)(void);
 
-static gboolean ui_search_is_aborted_dummy(void)
+static gboolean ui_progress_dummy(GnomeVFSURI *uri)
 {
+       /* 'uri' may be NULL */
+
        return FALSE;   /* not aborted */
 }
 
-gboolean (*ui_search_is_aborted)(void)=ui_search_is_aborted_dummy;
+gboolean (*ui_progress)(GnomeVFSURI *uri)=ui_progress_dummy;
 
 static GList *mod_uri_list_local;
 static void mod_uri_list_local_init(void)
@@ -153,11 +163,32 @@ static void scan_batch(void)
                microsoft_com();
 }
 
+static jmp_buf gnome_init_atexit_jmpbuf;
+static gboolean gnome_init_atexit_disable;
+
+static void gnome_init_atexit_handler(void)
+{
+       if (gnome_init_atexit_disable)
+               return;
+
+       longjmp(gnome_init_atexit_jmpbuf,1);
+       g_assert_not_reached();
+       _exit(EXIT_FAILURE);
+}
+
+gboolean gnome_init_g_log_handler_hit;
+static void gnome_init_g_log_handler(const gchar *log_domain,GLogLevelFlags log_level,const gchar *message,gpointer user_data)
+{
+       gnome_init_g_log_handler_hit=TRUE;
+       g_log_default_handler(log_domain,log_level,message,user_data);
+}
+
 int main(int argc,char **argv)
 {
 poptContext context;
 int errint;
 gboolean is_interactive;
+gboolean no_gnome;
 
 #if 0
        g_log_set_always_fatal(~(0
@@ -175,29 +206,66 @@ gboolean is_interactive;
        if (!gnome_vfs_init())
                g_error(_("GnomeVFS failed to initialize"));
 
-       context=poptGetContext(
-                       PACKAGE,        /* name */
-                       argc,(/*en-const*/const char **)argv,   /* argc,argv */
-                       popt_table,     /* options */
-                       POPT_CONTEXT_POSIXMEHARDER);    /* flags; && !POPT_CONTEXT_KEEP_FIRST */
-       if (context==NULL) {
-               g_assert_not_reached(); /* argument recognization args_error */
-               return EXIT_FAILURE;
-               }
-       errint=poptReadDefaultConfig(context,
-                       TRUE);  /* useEnv */
-       if (errint!=0) {
-               g_assert_not_reached(); /* argument recognization args_error */
-               return EXIT_FAILURE;
-               }
-       errint=poptGetNextOpt(context);
-       if (errint!=-1) {
-               g_assert_not_reached(); /* some non-callbacked argument reached */
-               return EXIT_FAILURE;
+       if (argv[1] && !strcmp(argv[1],"--text"))
+               optarg_text=1;
+
+       no_gnome=(optarg_text || !getenv("DISPLAY") || !*getenv("DISPLAY"));
+
+       if (no_gnome) {
+               context=poptGetContext(
+                               PACKAGE,        /* name */
+                               argc,(/*en-const*/const char **)argv,   /* argc,argv */
+                               popt_table_autohelp,    /* options */
+                               POPT_CONTEXT_POSIXMEHARDER);    /* flags; && !POPT_CONTEXT_KEEP_FIRST */
+               if (context==NULL) {
+                       g_assert_not_reached(); /* argument recognization args_error */
+                       return EXIT_FAILURE;
+                       }
+               errint=poptReadDefaultConfig(context,
+                               TRUE);  /* useEnv */
+               if (errint!=0) {
+                       g_assert_not_reached(); /* argument recognization args_error */
+                       return EXIT_FAILURE;
+                       }
+               errint=poptGetNextOpt(context);
+               if (errint!=-1) {
+                       g_assert_not_reached(); /* some non-callbacked argument reached */
+                       return EXIT_FAILURE;
+                       }
+               if (poptPeekArg(context)) {
+                       g_error(_("No arguments expected"));
+                       return EXIT_FAILURE;
+                       }
                }
-       if (poptPeekArg(context)) {
-               g_error(_("No arguments expected"));
-               return EXIT_FAILURE;
+       else {
+GnomeProgram *gnome_program;
+guint handler_id;
+
+               gnome_init_atexit_disable=FALSE;
+               g_atexit(gnome_init_atexit_handler);
+               gnome_init_g_log_handler_hit=FALSE;
+               handler_id=g_log_set_handler(
+                               "Gtk",  /* log_domain */
+                               G_LOG_LEVEL_WARNING,    /* log_levels */
+                               gnome_init_g_log_handler,       /* log_func */
+                               NULL);  /* user_data */
+               if (!setjmp(gnome_init_atexit_jmpbuf))
+                       gnome_program=gnome_program_init(PACKAGE,VERSION,LIBGNOMEUI_MODULE,argc,argv,
+                                       GNOME_PARAM_POPT_TABLE,popt_table,
+                                       GNOME_PARAM_POPT_FLAGS,(int)POPT_CONTEXT_POSIXMEHARDER,
+                                       NULL);
+               else {
+                       no_gnome=TRUE;
+                       /* No message: (captive-install-acquire:3693): Gtk-WARNING **: cannot open display:
+                        * was reported, probably only '--help' message was shown.
+                        */
+                       if (!gnome_init_g_log_handler_hit)
+                               exit(EXIT_SUCCESS);
+                       }
+               gnome_init_atexit_disable=TRUE;
+               g_log_remove_handler(
+                               "Gtk",  /* log_domain */
+                               handler_id);    /* handler_id */
                }
 
        is_interactive=(1
@@ -207,30 +275,20 @@ gboolean is_interactive;
                        && ! optarg_microsoft_com);
 
        /* Initialize UI here to catch all GLog errors below. */
-       if (!ui_line_init())
+       if (1
+                       && (no_gnome || !ui_gnome_init())
+                       && !ui_line_init())
                g_error(_("No UI interface could be initialized"));
 
        if (!captivemodid_load(optarg_modid_path) && !captivemodid_load("./w32-mod-id.captivemodid.xml"))
                g_error(_("Unable to load modid database: %s"),optarg_modid_path);
 
-{
-void (*acquire_module_available_notify_orig)(struct module_available *module_available);
-void (*acquire_module_all_modules_found_notify_orig)(void);
-
-       acquire_module_available_notify_orig=acquire_module_available_notify;
-       acquire_module_available_notify=NULL;
-       acquire_module_all_modules_found_notify_orig=acquire_module_all_modules_found_notify;
-       acquire_module_all_modules_found_notify=NULL;
        mod_uri_load(gnome_vfs_uri_new("file://" G_STRINGIFY(VARLIBCAPTIVEDIR)));
-       acquire_module_available_notify=acquire_module_available_notify_orig;
-       acquire_module_all_modules_found_notify=acquire_module_all_modules_found_notify_orig;
-       }
 
        if (!is_interactive)
                scan_batch();
-       else if (!(*ui_search_is_aborted)()) {
+       else
                (*ui_interactive)();
-               }
 
        gnome_vfs_shutdown();
 
index 5f3c32b..7a5537c 100644 (file)
@@ -30,7 +30,7 @@ G_BEGIN_DECLS
 extern gboolean optarg_verbose;
 extern gboolean optarg_dry;
 extern void (*ui_interactive)(void);
-extern gboolean (*ui_search_is_aborted)(void);
+extern gboolean (*ui_progress)(GnomeVFSURI *uri);
 
 void scan_disks_quick(void);
 void scan_disks(void);
index af56ad2..59256d6 100644 (file)
@@ -135,6 +135,9 @@ struct captivemodid_module *module;
        g_return_if_fail(file_base!=NULL);
        g_return_if_fail(uri!=NULL);
 
+       if ((*ui_progress)(uri))
+               return;
+
        file_md5=calc_md5(file_base,file_length);
        if (!(module=captivemodid_module_md5_lookup(file_md5)))
                goto fail_free_file_md5;
@@ -240,14 +243,20 @@ static gboolean mod_uri_load_directory_visit_func
 
        *recurse=FALSE;
 
-       if ((*ui_search_is_aborted)())
-               return FALSE;   /* abort traversal */
+       /* Do not: (*ui_progress)(root_uri);
+        * here as we are called with the same 'root_uri' for all of our 'rel_path's.
+        */
+       (*ui_progress)(NULL);
 
        switch (info->type) {
                case GNOME_VFS_FILE_TYPE_REGULAR: {
 GnomeVFSURI *file_uri;
 
                        file_uri=gnome_vfs_uri_append_path(root_uri,rel_path);
+                       if ((*ui_progress)(file_uri)) {
+                               gnome_vfs_uri_unref(file_uri);
+                               return FALSE;   /* abort traversal */
+                               }
                        mod_uri_load_file(file_uri);
                        gnome_vfs_uri_unref(file_uri);
                        } break;
@@ -260,6 +269,10 @@ GnomeVFSDirectoryHandle *directory_handle;
                         * Check the directory accessibility manually:
                         */
                        directory_uri=gnome_vfs_uri_append_path(root_uri,rel_path);
+                       if ((*ui_progress)(directory_uri)) {
+                               gnome_vfs_uri_unref(directory_uri);
+                               return FALSE;   /* abort traversal */
+                               }
                        if (GNOME_VFS_OK==gnome_vfs_directory_open_from_uri(&directory_handle,directory_uri,GNOME_VFS_FILE_INFO_DEFAULT)) {
                                *recurse=TRUE;
                                gnome_vfs_directory_close(directory_handle);    /* errors ignored */
diff --git a/src/install/acquire/ui-gnome-support.c b/src/install/acquire/ui-gnome-support.c
new file mode 100644 (file)
index 0000000..68576d2
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * DO NOT EDIT THIS FILE - it is generated by Glade.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <gnome.h>
+
+#include "ui-gnome-support.h"
+
+GtkWidget*
+lookup_widget                          (GtkWidget       *widget,
+                                        const gchar     *widget_name)
+{
+  GtkWidget *parent, *found_widget;
+
+  for (;;)
+    {
+      if (GTK_IS_MENU (widget))
+        parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
+      else
+        parent = widget->parent;
+      if (!parent)
+        parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
+      if (parent == NULL)
+        break;
+      widget = parent;
+    }
+
+  found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
+                                                 widget_name);
+  if (!found_widget)
+    g_warning ("Widget not found: %s", widget_name);
+  return found_widget;
+}
+
+/* This is an internally used function to create pixmaps. */
+GtkWidget*
+create_pixmap                          (GtkWidget       *widget,
+                                        const gchar     *filename)
+{
+  GtkWidget *pixmap;
+  gchar *pathname;
+
+  if (!filename || !filename[0])
+      return gtk_image_new ();
+
+  pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP,
+                                        filename, TRUE, NULL);
+  if (!pathname)
+    {
+      g_warning (_("Couldn't find pixmap file: %s"), filename);
+      return gtk_image_new ();
+    }
+
+  pixmap = gtk_image_new_from_file (pathname);
+  g_free (pathname);
+  return pixmap;
+}
+
+/* This is an internally used function to create pixmaps. */
+GdkPixbuf*
+create_pixbuf                          (const gchar     *filename)
+{
+  gchar *pathname = NULL;
+  GdkPixbuf *pixbuf;
+  GError *error = NULL;
+
+  if (!filename || !filename[0])
+      return NULL;
+
+  pathname = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP,
+                                        filename, TRUE, NULL);
+
+  if (!pathname)
+    {
+      g_warning (_("Couldn't find pixmap file: %s"), filename);
+      return NULL;
+    }
+
+  pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
+  if (!pixbuf)
+    {
+      fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
+               pathname, error->message);
+      g_error_free (error);
+    }
+  g_free (pathname);
+  return pixbuf;
+}
+
+/* This is used to set ATK action descriptions. */
+void
+glade_set_atk_action_description       (AtkAction       *action,
+                                        const gchar     *action_name,
+                                        const gchar     *description)
+{
+  gint n_actions, i;
+
+  n_actions = atk_action_get_n_actions (action);
+  for (i = 0; i < n_actions; i++)
+    {
+      if (!strcmp (atk_action_get_name (action, i), action_name))
+        atk_action_set_description (action, i, description);
+    }
+}
+
diff --git a/src/install/acquire/ui-gnome-support.h b/src/install/acquire/ui-gnome-support.h
new file mode 100644 (file)
index 0000000..13d1746
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * DO NOT EDIT THIS FILE - it is generated by Glade.
+ */
+
+#include <gnome.h>
+
+/*
+ * Public Functions.
+ */
+
+/*
+ * This function returns a widget in a component created by Glade.
+ * Call it with the toplevel widget in the component (i.e. a window/dialog),
+ * or alternatively any widget in the component, and the name of the widget
+ * you want returned.
+ */
+GtkWidget*  lookup_widget              (GtkWidget       *widget,
+                                        const gchar     *widget_name);
+
+
+
+/*
+ * Private Functions.
+ */
+
+/* This is used to create the pixmaps used in the interface. */
+GtkWidget*  create_pixmap              (GtkWidget       *widget,
+                                        const gchar     *filename);
+
+/* This is used to create the pixbufs used in the interface. */
+GdkPixbuf*  create_pixbuf              (const gchar     *filename);
+
+/* This is used to set ATK action descriptions. */
+void        glade_set_atk_action_description (AtkAction       *action,
+                                              const gchar     *action_name,
+                                              const gchar     *description);
+
diff --git a/src/install/acquire/ui-gnome.c b/src/install/acquire/ui-gnome.c
new file mode 100644 (file)
index 0000000..9510b81
--- /dev/null
@@ -0,0 +1,597 @@
+/* $Id$
+ * Drivers acquiring installation utility
+ * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "config.h"
+
+#include "ui-gnome.h"  /* self */
+#include <glib/gmessages.h>
+#include "moduriload.h"
+#include "main.h"
+#include <gtk/gtkmain.h>
+#include <gtk/gtktreeviewcolumn.h>
+#include <gtk/gtkbox.h>
+#include <sys/time.h>
+#include <libgnomeui/gnome-app.h>
+#include <gtk/gtktreestore.h>
+#include <gtk/gtkframe.h>
+#include <gtk/gtkentry.h>
+#include <libgnomeui/gnome-druid.h>
+#include <libgnomeui/gnome-app-util.h>
+#include <libgnomeui/gnome-druid-page-edge.h>
+#include "final.h"
+
+#include <captive/macros.h>
+
+
+/* Config: */
+#define PROGRESS_UPDATE_USEC 100000
+
+
+static GnomeApp *App;
+static GtkTreeStore *DriversTreeStore;
+static GtkFrame *DriversFrame;
+static GtkFrame *ProgressFrame;
+static GtkEntry *ProgressEntry;
+static GnomeDruid *Druid;
+static GtkButton *DruidButtonSkip;
+static GtkButton *DruidButtonOK;
+static GtkTreeView *DriversTreeView;
+static GnomeDruidPage *PageStart;
+static GnomeDruidPage *ScanDiskPage;
+static GnomeDruidPage *ScanPathPage;
+static GnomeDruidPage *MicrosoftComPage;
+static GnomeDruidPage *PageFinish;
+static GtkEntry *ScanPathLocationComboEntry;
+static GtkButton *MicrosoftComConfirmButton;
+enum {
+               DRIVERS_TREE_STORE_COLUMN_TYPE,
+               DRIVERS_TREE_STORE_COLUMN_ID,
+               DRIVERS_TREE_STORE_COLUMN_NUM,  /* total # */
+               };
+#define DRIVERS_TREE_STORE_COLUMN_TYPE_LIST G_TYPE_STRING,G_TYPE_STRING
+
+
+/* map: (gchar *)type-> (GtkTreeIter *) */
+static GHashTable *DriversTreeStore_Iter_hash;
+
+static void DriversTreeStore_Iter_hash_key_destroy_func(gchar *type)
+{
+       g_return_if_fail(type!=NULL);
+
+       g_free(type);
+}
+
+static void DriversTreeStore_Iter_hash_init(void)
+{
+       if (DriversTreeStore_Iter_hash)
+               return;
+       DriversTreeStore_Iter_hash=g_hash_table_new_full(g_str_hash,g_str_equal,
+                       (GDestroyNotify)DriversTreeStore_Iter_hash_key_destroy_func,
+                       NULL);  /* value_destroy_func */
+}
+
+static GtkTreeIter *DriversTreeStore_Iter_hash_get_iter(const gchar *type)
+{
+GtkTreeIter *r;
+
+       g_return_val_if_fail(type!=NULL,NULL);
+
+       DriversTreeStore_Iter_hash_init();
+       if (!(r=g_hash_table_lookup(DriversTreeStore_Iter_hash,type))) {
+               captive_new(r);
+               gtk_tree_store_append(DriversTreeStore,
+                               r,      /* iter */
+                               NULL);  /* parent */
+               g_hash_table_insert(DriversTreeStore_Iter_hash,g_strdup(type),r);
+               }
+
+       return r;
+}
+
+static gboolean some_modules_found=FALSE;
+static gboolean in_progress=FALSE;
+static GnomeDruidPage *page_active;
+
+static void state_changed(void)
+{
+       /* Not yet initialized? */
+       if (!App)
+               return;
+
+       gtk_widget_set_sensitive(GTK_WIDGET(DruidButtonSkip),
+                       (page_active!=PageStart && page_active!=PageFinish));
+       gtk_widget_set_sensitive(GTK_WIDGET(DruidButtonOK),some_modules_found);
+
+       if (in_progress) {
+               gtk_widget_set_sensitive(Druid->next,FALSE);
+               gtk_widget_set_sensitive(GTK_WIDGET(DruidButtonOK),some_modules_found);
+               gtk_widget_set_sensitive(GTK_WIDGET(MicrosoftComConfirmButton),FALSE);
+               }
+       else {
+               /* It is checked by GTK+ whether the text changed: */
+               gtk_entry_set_text(ProgressEntry,"");
+               gtk_widget_set_sensitive(Druid->next,
+                               (page_active!=PageFinish && page_active!=MicrosoftComPage));
+               gtk_widget_set_sensitive(GTK_WIDGET(MicrosoftComConfirmButton),
+                               (page_active==MicrosoftComPage));
+               }
+}
+
+static void ui_gnome_module_best_priority_notify(const gchar *module_type)
+{
+GtkTreeIter *iter;
+
+       g_return_if_fail(module_type!=NULL);
+
+       iter=DriversTreeStore_Iter_hash_get_iter(module_type);
+       gtk_tree_store_set(DriversTreeStore,iter,
+                       DRIVERS_TREE_STORE_COLUMN_TYPE,module_type,
+                       DRIVERS_TREE_STORE_COLUMN_ID  ,
+                                       ((0
+                                                                       || !strcmp(module_type,"ntoskrnl.exe")
+                                                                       || !strcmp(module_type,"ntfs.sys"))
+                                                       ? _("NOT FOUND; essential module for NTFS disks access")
+                                                       : _("not found; optional module")),
+                       -1);
+}
+
+static void ui_gnome_module_available_notify(struct module_available *module_available)
+{
+GtkTreeIter *iter;
+static gboolean some_module_ntoskrnl_exe_found=FALSE;
+static gboolean some_module_ntfs_sys_found=FALSE;
+
+       g_return_if_fail(module_available!=NULL);
+       g_return_if_fail(module_available->module!=NULL);
+
+       iter=DriversTreeStore_Iter_hash_get_iter(module_available->module->type);
+       gtk_tree_store_set(DriversTreeStore,iter,
+                       DRIVERS_TREE_STORE_COLUMN_TYPE,module_available->module->type,
+                       DRIVERS_TREE_STORE_COLUMN_ID  ,module_available->module->id,
+                       -1);
+
+       if (!strcmp(module_available->module->type,"ntoskrnl.exe"))
+               some_module_ntoskrnl_exe_found=TRUE;
+       if (!strcmp(module_available->module->type,"ntfs.sys"))
+               some_module_ntfs_sys_found=TRUE;
+
+       some_modules_found=some_module_ntoskrnl_exe_found && some_module_ntfs_sys_found;
+       state_changed();
+}
+
+static gboolean all_modules_found=FALSE;
+
+static void ui_gnome_all_modules_found_notify(void)
+{
+       all_modules_found=TRUE;
+       state_changed();
+}
+
+static gboolean aborted=FALSE;
+static gboolean aborted_back=FALSE;    /* 'Back' button was clicked. */
+static struct timeval ProgressEntry_updated_timeval;
+
+static void progress_start(void)
+{
+       in_progress=TRUE;
+       aborted=FALSE;
+       aborted_back=FALSE;
+       CAPTIVE_MEMZERO(&ProgressEntry_updated_timeval);
+       state_changed();
+}
+
+static void progress_end(void)
+{
+       in_progress=FALSE;
+       state_changed();
+}
+
+static gboolean ui_gnome_progress(GnomeVFSURI *uri)
+{
+       /* 'uri' may be NULL */
+
+       if (ProgressEntry) {
+static gchar *uri_text=NULL;
+
+               /* Store 'uri' on each call (not just if 'diff_timeval' permits)
+                * as we may get into long cabinet extraction phase with 'uri==NULL' calls
+                * where we want to display the currently processed 'uri'.
+                */
+               if (uri) {
+                       g_free(uri_text);
+                       uri_text=gnome_vfs_uri_to_string(uri,GNOME_VFS_URI_HIDE_PASSWORD);
+                       }
+
+               if (uri_text) {
+struct timeval now_timeval;
+struct timeval diff_timeval;
+
+                       gettimeofday(   /* FIXME: errors ignored */
+                                       &now_timeval,   /* tv */
+                                       NULL);  /* tz */
+                       timersub(&now_timeval,&ProgressEntry_updated_timeval,&diff_timeval);
+                       if (!ProgressEntry_updated_timeval.tv_sec || diff_timeval.tv_sec>0 || diff_timeval.tv_usec>=PROGRESS_UPDATE_USEC) {
+                               gtk_entry_set_text(ProgressEntry,
+                                               uri_text+(strncmp(uri_text,"file://",strlen("file://")) ? 0 : strlen("file://")));
+                               ProgressEntry_updated_timeval=now_timeval;
+                               }
+                       }
+               }
+       while (gtk_events_pending())
+               gtk_main_iteration();
+
+       if (aborted)
+               return TRUE;
+       if (all_modules_found)
+               return TRUE;
+
+       return FALSE;
+}
+
+/* FIXME: Change it to "prepare" signal. */
+void on_Page_map(GtkWidget *vbox_widget,GtkWidget *page_widget)
+{
+       g_return_if_fail(vbox_widget==NULL || GTK_IS_VBOX(vbox_widget));
+       g_return_if_fail(GNOME_IS_DRUID_PAGE(page_widget));
+
+       page_active=GNOME_DRUID_PAGE(page_widget);
+       if (page_active==PageFinish) {
+               gnome_druid_set_show_finish(Druid,FALSE);       /* set it each time */
+               /**/ if (!some_modules_found)
+                       gnome_druid_page_edge_set_text(GNOME_DRUID_PAGE_EDGE(PageFinish),_(
+                                       "We need at least some version of drivers essential for this project:"
+                                       "ntoskrnl.exe and ntfs.sys. Please click 'Back' button to obtain them"
+                                       "by several methods offered by this installer."));
+               else {
+gchar *text;
+
+                       text=final_text(all_modules_found);
+                       gnome_druid_page_edge_set_text(GNOME_DRUID_PAGE_EDGE(PageFinish),text);
+                       g_free(text);
+                       }
+               }
+       if (page_active==ScanPathPage)
+               gtk_widget_grab_focus(GTK_WIDGET(ScanPathLocationComboEntry));
+       state_changed();
+
+       if (!vbox_widget)
+               return;
+
+       /* FIXME: 'freeze' apparently does not help 'repositioning' of
+        * 'DriversTreeView' during first 'map' of each 'Page'.
+        */
+       gtk_widget_freeze_child_notify(vbox_widget);
+
+       gtk_widget_reparent(GTK_WIDGET(DriversFrame),vbox_widget);
+       gtk_widget_reparent(GTK_WIDGET(ProgressFrame),vbox_widget);
+
+       gtk_box_reorder_child(GTK_BOX(vbox_widget),GTK_WIDGET(DriversFrame),
+                       0);     /* position */
+
+       gtk_box_set_child_packing(GTK_BOX(vbox_widget),GTK_WIDGET(DriversFrame),
+                       FALSE,  /* expand */
+                       TRUE,   /* fill */
+                       0,      /* padding */
+                       GTK_PACK_START);
+       gtk_box_set_child_packing(GTK_BOX(vbox_widget),GTK_WIDGET(ProgressFrame),
+                       FALSE,  /* expand */
+                       TRUE,   /* fill */
+                       0,      /* padding */
+                       GTK_PACK_START);
+
+       /* FIXME: Needed to fix (0,0)-position inside parent GdkWindow. */
+       gtk_widget_queue_resize(GTK_WIDGET(DriversTreeView));
+       gtk_widget_queue_resize(GTK_WIDGET(ProgressEntry));
+
+       gtk_widget_thaw_child_notify(vbox_widget);
+}
+
+gboolean on_Page_next(GnomeDruidPage *gnomedruidpage,GtkWidget *widget,gpointer user_data /* unused */)
+{
+       g_return_val_if_fail(GNOME_IS_DRUID_PAGE(gnomedruidpage),FALSE);
+
+       if (in_progress)        /* bogus callback - we should be non-sensitive */
+               return TRUE;    /* ignore button press */
+
+       /**/ if (page_active==PageStart) {
+               if (all_modules_found) {
+                       gnome_druid_set_page(Druid,PageFinish);
+                       return TRUE;    /* ignore button press */
+                       }
+               }
+       else if (page_active==ScanDiskPage) {
+               progress_start();
+               scan_disks_quick();
+               scan_disks();
+               progress_end();
+               if (aborted_back) {
+                       gnome_druid_set_page(Druid,PageStart);
+                       return TRUE;    /* ignore button press */
+                       }
+               if (all_modules_found) {
+                       gnome_druid_set_page(Druid,PageFinish);
+                       return TRUE;    /* ignore button press */
+                       }
+               return FALSE;   /* proceed to next page */
+               }
+       else if (page_active==ScanPathPage) {
+const gchar *scan_path_uri_text=gtk_entry_get_text(ScanPathLocationComboEntry);
+
+               if (scan_path_uri_text && *scan_path_uri_text) {
+GnomeVFSURI *scan_path_uri;
+
+                       if ((scan_path_uri=gnome_vfs_uri_new(scan_path_uri_text))) {
+                               progress_start();
+                               mod_uri_load(scan_path_uri);
+                               progress_end();
+                               gnome_vfs_uri_unref(scan_path_uri);
+                               if (aborted_back) {
+                                       gnome_druid_set_page(Druid,(all_modules_found ? PageStart : ScanDiskPage));
+                                       return TRUE;    /* ignore button press */
+                                       }
+                               if (all_modules_found) {
+                                       gnome_druid_set_page(Druid,PageFinish);
+                                       return TRUE;    /* ignore button press */
+                                       }
+                               gtk_entry_set_text(ScanPathLocationComboEntry,"");
+                               }
+                       else
+                               g_warning(_("Invalid URI: %s"),scan_path_uri_text);
+                       gtk_widget_grab_focus(GTK_WIDGET(ScanPathLocationComboEntry));
+                       return TRUE;    /* ignore button press; we cleared the URI entry */
+                       }
+               return FALSE;   /* proceed to next page */
+               }
+
+       return FALSE;   /* proceed to next page */
+}
+
+void on_MicrosoftComConfirmButton_clicked(GtkButton *button,gpointer user_data)
+{
+       g_return_if_fail(GTK_IS_BUTTON(button));
+
+       if (in_progress)        /* bogus callback */
+               return;
+       if (page_active!=MicrosoftComPage)      /* bogus callback */
+               return;
+
+       progress_start();
+       microsoft_com();
+       progress_end();
+       if (aborted_back) {
+               gnome_druid_set_page(Druid,(all_modules_found ? PageStart : ScanPathPage));
+               return;
+               }
+       if (all_modules_found) {
+               gnome_druid_set_page(Druid,PageFinish);
+               return;
+               }
+
+       gnome_druid_set_page(Druid,PageFinish);
+}
+
+void on_DruidButtonSkip_clicked(GtkButton *button,gpointer user_data /* unused */)
+{
+       g_return_if_fail(GTK_IS_BUTTON(button));
+
+       if (in_progress) {
+               aborted=TRUE;
+               state_changed();
+               return;
+               }
+       if (all_modules_found)
+               gnome_druid_set_page(Druid,PageFinish);
+       else if (page_active==ScanDiskPage)
+               gnome_druid_set_page(Druid,ScanPathPage);
+       else if (page_active==ScanPathPage)
+               gnome_druid_set_page(Druid,MicrosoftComPage);
+       else if (page_active==MicrosoftComPage)
+               gnome_druid_set_page(Druid,PageFinish);
+}
+
+gboolean on_Page_back(GnomeDruidPage *gnomedruidpage,GtkWidget *widget,gpointer user_data)
+{
+       g_return_val_if_fail(GNOME_IS_DRUID_PAGE(gnomedruidpage),FALSE);
+
+       if (!in_progress) {
+               if (all_modules_found) {
+                       gnome_druid_set_page(Druid,PageStart);
+                       return TRUE;    /* ignore button press */
+                       }
+               return FALSE;   /* proceed to previous page */
+               }
+
+       aborted=TRUE;
+       aborted_back=TRUE;
+       state_changed();
+
+       return TRUE;    /* ignore button press now; we will respect 'aborted_back' */
+}
+
+void on_Druid_cancel(GnomeDruid *gnomedruid,gpointer user_data /* unused */)
+{
+       g_return_if_fail(GNOME_IS_DRUID(gnomedruid));
+
+       /* gtk_main_quit() would not abort the current operation. */
+       exit(EXIT_SUCCESS);
+}
+
+static void on_DruidButtonOK_clicked_dialog_callback(gint reply,gint *replyp /* data */)
+{
+       g_return_if_fail(reply>=0);
+       g_return_if_fail(replyp!=NULL);
+
+       *replyp=reply;
+}
+
+void on_DruidButtonOK_clicked(GtkButton *button,gpointer user_data /* unused */)
+{
+GtkWidget *dialog;
+gint reply;
+
+       g_return_if_fail(GTK_IS_BUTTON(button));
+
+       if (all_modules_found)
+               exit(EXIT_SUCCESS);
+
+       /* TODO: Avoid dialog if already on Finish page. */
+       reply=-1;
+       dialog=gnome_app_ok_cancel_modal(App,_(
+                       "Although essential modules (\"ntoskrnl.exe\" and \"ntfs.sys\") are available"
+                       "you may still want to get their better version and/or more modules."
+                       "Really quit?"),
+                       (GnomeReplyCallback)on_DruidButtonOK_clicked_dialog_callback,
+                       &reply);        /* data */
+       g_signal_connect((gpointer)dialog,"close",G_CALLBACK(gtk_main_quit),NULL);
+       gtk_main();
+       /* 'dialog' gets destroyed automatically */
+       if (reply==0)   /* 0 for 'OK', 1 for 'Cancel', left -1 for dialog close. */
+               exit(EXIT_SUCCESS);
+}
+
+static void button_stock_set_label(GtkWidget *widget,const gchar *label_text_new /* callback_data */)
+{
+       g_return_if_fail(GTK_IS_WIDGET(widget));
+       g_return_if_fail(label_text_new!=NULL);
+
+       /**/ if (GTK_IS_CONTAINER(widget))
+               gtk_container_foreach(GTK_CONTAINER(widget),
+                               (GtkCallback)button_stock_set_label,    /* callback */
+                               (/* de-conts */ gchar *)label_text_new);        /* callback_data */
+       else if (GTK_IS_LABEL(widget))
+               gtk_label_set_text_with_mnemonic(GTK_LABEL(widget),label_text_new);
+}
+
+/* of "ui-gnome-interface.h": */
+GtkWidget *create_App(void);
+/* of "ui-gnome-support.h": */
+GtkWidget *lookup_widget(GtkWidget *widget,const gchar *widget_name);
+
+static void App_init(void)
+{
+GtkTreeViewColumn *column;
+GtkCellRenderer *cell;
+GtkBox *druid_button_box;
+
+       App=GNOME_APP(create_App());
+
+       DriversTreeView=GTK_TREE_VIEW(lookup_widget(GTK_WIDGET(App),"DriversTreeView"));
+       DriversFrame=GTK_FRAME(lookup_widget(GTK_WIDGET(App),"DriversFrame"));
+       ProgressFrame=GTK_FRAME(lookup_widget(GTK_WIDGET(App),"ProgressFrame"));
+       Druid=GNOME_DRUID(lookup_widget(GTK_WIDGET(App),"Druid"));
+       PageStart=GNOME_DRUID_PAGE(lookup_widget(GTK_WIDGET(App),"PageStart"));
+       ScanDiskPage=GNOME_DRUID_PAGE(lookup_widget(GTK_WIDGET(App),"ScanDiskPage"));
+       ScanPathPage=GNOME_DRUID_PAGE(lookup_widget(GTK_WIDGET(App),"ScanPathPage"));
+       MicrosoftComPage=GNOME_DRUID_PAGE(lookup_widget(GTK_WIDGET(App),"MicrosoftComPage"));
+       PageFinish=GNOME_DRUID_PAGE(lookup_widget(GTK_WIDGET(App),"PageFinish"));
+       ScanPathLocationComboEntry=GTK_ENTRY(lookup_widget(GTK_WIDGET(App),"ScanPathLocationComboEntry"));
+       MicrosoftComConfirmButton=GTK_BUTTON(lookup_widget(GTK_WIDGET(App),"MicrosoftComConfirmButton"));
+       ProgressEntry=GTK_ENTRY(lookup_widget(GTK_WIDGET(App),"ProgressEntry"));
+
+       druid_button_box=GTK_BOX(gtk_widget_get_parent(Druid->next));
+
+       DriversTreeStore=gtk_tree_store_new(DRIVERS_TREE_STORE_COLUMN_NUM,DRIVERS_TREE_STORE_COLUMN_TYPE_LIST);
+       gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(DriversTreeStore),
+                       DRIVERS_TREE_STORE_COLUMN_TYPE,GTK_SORT_ASCENDING);
+       gtk_tree_view_set_model(DriversTreeView,GTK_TREE_MODEL(DriversTreeStore));
+
+       column=gtk_tree_view_column_new();
+       cell=gtk_cell_renderer_text_new();
+       gtk_tree_view_column_pack_start(column,cell,
+                       TRUE);  /* expand */
+       gtk_tree_view_column_set_attributes(column,cell,
+                       "text",DRIVERS_TREE_STORE_COLUMN_TYPE,
+                       NULL);
+       gtk_tree_view_append_column(DriversTreeView,column);
+
+       column=gtk_tree_view_column_new();
+       cell=gtk_cell_renderer_text_new();
+       gtk_tree_view_column_pack_start(column,cell,
+                       TRUE);  /* expand */
+       gtk_tree_view_column_set_attributes(column,cell,
+                       "text",DRIVERS_TREE_STORE_COLUMN_ID,
+                       NULL);
+       gtk_tree_view_append_column(DriversTreeView,column);
+
+       /* gnome_druid_set_show_finish() just replaces Next<->Finish buttons displayed. */
+       gtk_widget_hide(GTK_WIDGET(Druid->finish));
+
+       DruidButtonSkip=GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_REDO));
+       gtk_container_foreach(GTK_CONTAINER(DruidButtonSkip),
+                       (GtkCallback)button_stock_set_label,    /* callback */
+                       _("_Skip"));    /* callback_data */
+       gtk_box_pack_end(druid_button_box,GTK_WIDGET(DruidButtonSkip),FALSE,TRUE,0);
+       gtk_widget_show(GTK_WIDGET(DruidButtonSkip));
+       g_signal_connect((gpointer)DruidButtonSkip,"clicked",G_CALLBACK(on_DruidButtonSkip_clicked),NULL);
+
+       DruidButtonOK=GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_OK));
+       gtk_box_pack_end(druid_button_box,GTK_WIDGET(DruidButtonOK),FALSE,TRUE,0);
+       gtk_widget_show(GTK_WIDGET(DruidButtonOK));
+       g_signal_connect((gpointer)DruidButtonOK,"clicked",G_CALLBACK(on_DruidButtonOK_clicked),NULL);
+
+       state_changed();
+}
+
+static void ui_gnome_g_log_handler(const gchar *log_domain,GLogLevelFlags log_level,const gchar *message,gpointer user_data)
+{
+GtkWidget *dialog;
+
+       /* Ignore arrors by cabextract during its abortion. */
+       if (in_progress && aborted)
+               return;
+
+       /**/ if (log_level & G_LOG_LEVEL_ERROR)
+               dialog=gnome_app_error(App,message);
+       else if (log_level & (G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING))
+               dialog=gnome_app_warning(App,message);
+       else
+               dialog=gnome_app_message(App,message);
+
+       gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
+       g_signal_connect((gpointer)dialog,"close",G_CALLBACK(gtk_main_quit),NULL);
+       gtk_main();
+       /* 'dialog' gets destroyed automatically */
+}
+
+static void ui_gnome_interactive(void)
+{
+       gtk_widget_show_all(GTK_WIDGET(App));
+       gtk_main();
+       exit(EXIT_SUCCESS);
+}
+
+gboolean ui_gnome_init(void)
+{
+       acquire_module_available_notify=ui_gnome_module_available_notify;
+       acquire_module_all_modules_found_notify=ui_gnome_all_modules_found_notify;
+       ui_progress=ui_gnome_progress;
+       ui_interactive=ui_gnome_interactive;
+       captivemodid_module_best_priority_notify=ui_gnome_module_best_priority_notify;
+
+       /* Graphic widgets will all be hidden yet. */
+       App_init();
+       /* ui_gnome_g_log_handler() needs 'App'. */
+       g_log_set_handler(
+                       G_LOG_DOMAIN,   /* log_domain; "Captive" */
+                       G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL,    /* log_levels */
+                       ui_gnome_g_log_handler, /* log_func */
+                       NULL);  /* user_data */
+
+       return TRUE;
+}
diff --git a/src/install/acquire/ui-gnome.glade b/src/install/acquire/ui-gnome.glade
new file mode 100644 (file)
index 0000000..ab9e721
--- /dev/null
@@ -0,0 +1,413 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+<requires lib="bonobo"/>
+
+<widget class="GnomeApp" id="App">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Captive Microsoft Windows Drivers Acquire</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="enable_layout_config">False</property>
+  <signal name="destroy" handler="gtk_main_quit" last_modification_time="Sat, 06 Sep 2003 11:12:25 GMT"/>
+
+  <child internal-child="dock">
+    <widget class="BonoboDock" id="Bonobo">
+      <property name="visible">True</property>
+      <property name="allow_floating">False</property>
+
+      <child>
+       <widget class="GnomeDruid" id="Druid">
+         <property name="border_width">4</property>
+         <property name="visible">True</property>
+         <property name="show_help">False</property>
+         <signal name="cancel" handler="on_Druid_cancel" last_modification_time="Fri, 05 Sep 2003 17:20:04 GMT"/>
+
+         <child>
+           <widget class="GnomeDruidPageEdge" id="PageStart">
+             <property name="visible">True</property>
+             <property name="position">GNOME_EDGE_START</property>
+             <property name="title" translatable="yes">Captive Microsoft Windows Drivers Acquire</property>
+             <property name="text" translatable="yes">Program allows safe read/write mount of NTFS disk drives.
+It uses original Microsoft Windows driver files to access the disks. As these files are licensed by Microsoft we will acquire them now for your installation.</property>
+             <signal name="map" handler="on_Page_map" object="NULL" last_modification_time="Sat, 06 Sep 2003 07:27:32 GMT"/>
+             <signal name="next" handler="on_Page_next" last_modification_time="Sat, 06 Sep 2003 12:43:57 GMT"/>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GnomeDruidPageStandard" id="ScanDiskPage">
+             <property name="visible">True</property>
+             <property name="title" translatable="yes">Local Disks Drivers Scan</property>
+             <signal name="map" handler="on_Page_map" object="ScanDiskVBox" last_modification_time="Fri, 05 Sep 2003 14:58:14 GMT"/>
+             <signal name="next" handler="on_Page_next" last_modification_time="Sat, 06 Sep 2003 08:09:08 GMT"/>
+             <signal name="back" handler="on_Page_back" last_modification_time="Sat, 06 Sep 2003 10:56:46 GMT"/>
+
+             <child internal-child="vbox">
+               <widget class="GtkVBox" id="ScanDiskVBox">
+                 <property name="border_width">16</property>
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">6</property>
+
+                 <child>
+                   <widget class="GtkFrame" id="DriversFrame">
+                     <property name="visible">True</property>
+                     <property name="label_xalign">0</property>
+                     <property name="label_yalign">0.5</property>
+                     <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+                     <child>
+                       <widget class="GtkTreeView" id="DriversTreeView">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="headers_visible">False</property>
+                         <property name="rules_hint">False</property>
+                         <property name="reorderable">False</property>
+                         <property name="enable_search">False</property>
+                       </widget>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="DriversFrameLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Currently found drivers</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                       <packing>
+                         <property name="type">label_item</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkFrame" id="ScanDiskInfoFrame">
+                     <property name="visible">True</property>
+                     <property name="label_xalign">0</property>
+                     <property name="label_yalign">0.5</property>
+                     <property name="shadow_type">GTK_SHADOW_IN</property>
+
+                     <child>
+                       <widget class="GtkLabel" id="ScanDiskInfo">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">We will scan your local hard drives to find any existing drivers usable for this project.</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">True</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkFrame" id="ProgressFrame">
+                     <property name="visible">True</property>
+                     <property name="label_xalign">0</property>
+                     <property name="label_yalign">0.5</property>
+                     <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+                     <child>
+                       <widget class="GtkEntry" id="ProgressEntry">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="editable">False</property>
+                         <property name="visibility">True</property>
+                         <property name="max_length">0</property>
+                         <property name="text" translatable="yes"></property>
+                         <property name="has_frame">False</property>
+                         <property name="invisible_char" translatable="yes">*</property>
+                         <property name="activates_default">False</property>
+                       </widget>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="ProgressLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Scanned File...</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                       <packing>
+                         <property name="type">label_item</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+               </widget>
+             </child>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GnomeDruidPageStandard" id="ScanPathPage">
+             <property name="visible">True</property>
+             <property name="title" translatable="yes">Custom Drivers Location</property>
+             <signal name="map" handler="on_Page_map" object="ScanPathVBox" last_modification_time="Fri, 05 Sep 2003 14:53:59 GMT"/>
+             <signal name="next" handler="on_Page_next" last_modification_time="Sat, 06 Sep 2003 08:09:22 GMT"/>
+             <signal name="back" handler="on_Page_back" last_modification_time="Sat, 06 Sep 2003 10:56:56 GMT"/>
+
+             <child internal-child="vbox">
+               <widget class="GtkVBox" id="ScanPathVBox">
+                 <property name="border_width">16</property>
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">6</property>
+
+                 <child>
+                   <widget class="GtkFrame" id="ScanPathInfoFrame">
+                     <property name="visible">True</property>
+                     <property name="label_xalign">0</property>
+                     <property name="label_yalign">0.5</property>
+                     <property name="shadow_type">GTK_SHADOW_IN</property>
+
+                     <child>
+                       <widget class="GtkLabel" id="ScanPathInfo">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Here you can specify custom path to the drivers. Besides regular disk path you can also specify www URL such as: http://machine/path/name
+If you have no idea simply go Forward.</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">True</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkFrame" id="ScanPathLocationFrame">
+                     <property name="visible">True</property>
+                     <property name="label_xalign">0</property>
+                     <property name="label_yalign">0.5</property>
+                     <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+                     <child>
+                       <widget class="GnomeFileEntry" id="ScanPathLocationFileEntry">
+                         <property name="visible">True</property>
+                         <property name="max_saved">10</property>
+                         <property name="directory_entry">False</property>
+                         <property name="modal">False</property>
+
+                         <child internal-child="entry">
+                           <widget class="GtkEntry" id="ScanPathLocationComboEntry">
+                             <property name="visible">True</property>
+                             <property name="can_focus">True</property>
+                             <property name="editable">True</property>
+                             <property name="visibility">True</property>
+                             <property name="max_length">0</property>
+                             <property name="text" translatable="yes"></property>
+                             <property name="has_frame">True</property>
+                             <property name="invisible_char" translatable="yes">*</property>
+                             <property name="activates_default">False</property>
+                           </widget>
+                         </child>
+                       </widget>
+                     </child>
+
+                     <child>
+                       <widget class="GtkLabel" id="ScanPathLocationLabel">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Specify location</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">False</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                       <packing>
+                         <property name="type">label_item</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+               </widget>
+             </child>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GnomeDruidPageStandard" id="MicrosoftComPage">
+             <property name="visible">True</property>
+             <property name="title" translatable="yes">Download From microsoft.com</property>
+             <signal name="map" handler="on_Page_map" object="MicrosoftComVBox" last_modification_time="Fri, 05 Sep 2003 14:54:24 GMT"/>
+             <signal name="next" handler="on_Page_next" last_modification_time="Sat, 06 Sep 2003 08:09:39 GMT"/>
+             <signal name="back" handler="on_Page_back" last_modification_time="Sat, 06 Sep 2003 10:57:09 GMT"/>
+
+             <child internal-child="vbox">
+               <widget class="GtkVBox" id="MicrosoftComVBox">
+                 <property name="border_width">16</property>
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">6</property>
+
+                 <child>
+                   <widget class="GtkFrame" id="MicrosoftComInfoFrame">
+                     <property name="visible">True</property>
+                     <property name="label_xalign">0</property>
+                     <property name="label_yalign">0.5</property>
+                     <property name="shadow_type">GTK_SHADOW_IN</property>
+
+                     <child>
+                       <widget class="GtkLabel" id="MicrosoftComInfo">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="label" translatable="yes">You can download the best available version of needed drivers from Microsoft. They can be found in Microsoft Windows XP Service Pack 1 Checked Build.
+URL: http://www.microsoft.com/WindowsXP/pro/downloads/servicepacks/sp1/checkedbuild.asp
+Legal: In some countries you need to have valid Microsoft Windows XP license to use it.
+We will need to download approx 29MB od data right now (takes 2 hours on 33.6 modem).</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_LEFT</property>
+                         <property name="wrap">True</property>
+                         <property name="selectable">True</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkHBox" id="MicrosoftComConfirmHBox">
+                     <property name="visible">True</property>
+                     <property name="homogeneous">False</property>
+                     <property name="spacing">0</property>
+
+                     <child>
+                       <widget class="GtkLabel" id="MicrosoftComConfirmInfo">
+                         <property name="visible">True</property>
+                         <property name="label" translatable="yes">Are you legally entitled to download Microsoft Windows XP Service Pack?</property>
+                         <property name="use_underline">False</property>
+                         <property name="use_markup">False</property>
+                         <property name="justify">GTK_JUSTIFY_CENTER</property>
+                         <property name="wrap">True</property>
+                         <property name="selectable">False</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">True</property>
+                         <property name="fill">True</property>
+                       </packing>
+                     </child>
+
+                     <child>
+                       <widget class="GtkButton" id="MicrosoftComConfirmButton">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="label" translatable="yes">Yes, start the download.</property>
+                         <property name="use_underline">True</property>
+                         <property name="relief">GTK_RELIEF_NORMAL</property>
+                         <signal name="clicked" handler="on_MicrosoftComConfirmButton_clicked" last_modification_time="Fri, 05 Sep 2003 17:25:27 GMT"/>
+                       </widget>
+                       <packing>
+                         <property name="padding">0</property>
+                         <property name="expand">False</property>
+                         <property name="fill">False</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+               </widget>
+             </child>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GnomeDruidPageEdge" id="PageFinish">
+             <property name="visible">True</property>
+             <property name="position">GNOME_EDGE_FINISH</property>
+             <property name="title" translatable="yes">Microsoft Windows Drivers Captivated</property>
+             <property name="text" translatable="yes"></property>
+             <signal name="map" handler="on_Page_map" object="NULL" last_modification_time="Sat, 06 Sep 2003 07:27:55 GMT"/>
+             <signal name="back" handler="on_Page_back" last_modification_time="Sat, 06 Sep 2003 12:44:12 GMT"/>
+           </widget>
+         </child>
+       </widget>
+      </child>
+    </widget>
+    <packing>
+      <property name="padding">0</property>
+      <property name="expand">True</property>
+      <property name="fill">True</property>
+    </packing>
+  </child>
+</widget>
+
+</glade-interface>
diff --git a/src/install/acquire/ui-gnome.gladep b/src/install/acquire/ui-gnome.gladep
new file mode 100644 (file)
index 0000000..60e1f88
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
+
+<glade-project>
+  <name>ui-gnome</name>
+  <program_name>captive-install-acquire</program_name>
+  <source_directory>.</source_directory>
+  <use_widget_names>TRUE</use_widget_names>
+  <output_main_file>FALSE</output_main_file>
+  <output_support_files>FALSE</output_support_files>
+  <output_build_files>FALSE</output_build_files>
+  <backup_source_files>FALSE</backup_source_files>
+  <main_source_file>ui-gnome-interface.c</main_source_file>
+  <main_header_file>ui-gnome-interface.h</main_header_file>
+  <handler_source_file>ui-gnome-callbacks.c</handler_source_file>
+  <handler_header_file>ui-gnome-callbacks.h</handler_header_file>
+  <support_source_file>ui-gnome-support.c</support_source_file>
+  <support_header_file>ui-gnome-support.h</support_header_file>
+</glade-project>
diff --git a/src/install/acquire/ui-gnome.h b/src/install/acquire/ui-gnome.h
new file mode 100644 (file)
index 0000000..84d67af
--- /dev/null
@@ -0,0 +1,34 @@
+/* $Id$
+ * Include file for drivers acquiring installation utility
+ * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _CAPTIVE_INSTALL_ACQUIRE_UI_GNOME_H
+#define _CAPTIVE_INSTALL_ACQUIRE_UI_GNOME_H 1
+
+
+#include <glib/gtypes.h>
+
+
+G_BEGIN_DECLS
+
+gboolean ui_gnome_init(void);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_INSTALL_ACQUIRE_UI_GNOME_H */
index c349d11..13191a5 100644 (file)
@@ -25,6 +25,7 @@
 #include "main.h"
 #include <unistd.h>
 #include <time.h>
+#include "final.h"
 
 #ifdef HAVE_LIBREADLINE
 #include <readline/readline.h>
@@ -70,11 +71,13 @@ static gboolean aborted=FALSE;
 static time_t search_start_time;
 static gboolean abort_msg_printed=FALSE;
 
-static gboolean ui_line_search_is_aborted(void)
+static gboolean ui_line_progress(GnomeVFSURI *uri)
 {
 fd_set readfds;
 struct timeval timeval;
 
+       /* 'uri' may be NULL */
+
        if (aborted)
                return TRUE;
        if (all_modules_found)
@@ -103,7 +106,7 @@ struct timeval timeval;
        return FALSE;
 }
 
-static void ui_line_search_is_aborted_reset(void)
+static void ui_line_progress_reset(void)
 {
        aborted=FALSE;
        search_start_time=0;
@@ -120,7 +123,7 @@ char line[1024],*s;
 
        g_return_val_if_fail(prompt!=NULL,NULL);
 
-       ui_line_search_is_aborted_reset();
+       ui_line_progress_reset();
 
 #ifdef HAVE_LIBREADLINE
        line=readline(prompt);
@@ -144,6 +147,7 @@ char line[1024],*s;
 
 /* FIXME: HACK: Encode module essentiality to '.captivemodid.xml'. */
 struct print_modules_available_foreach_param {
+       gboolean do_print;
        gboolean ntoskrnl_exe_found;
        gboolean ntfs_sys_found;
        };
@@ -158,7 +162,8 @@ static void print_modules_available_foreach
        g_return_if_fail(!strcmp(type,module_available->module->type));
        g_return_if_fail(param!=NULL);
 
-       print_ui_line_module_available(module_available);
+       if (param->do_print)
+               print_ui_line_module_available(module_available);
 
        /**/ if (!strcmp(type,"ntoskrnl.exe"))
                param->ntoskrnl_exe_found=TRUE;
@@ -171,8 +176,10 @@ static gboolean print_modules_available(void)
 {
 struct print_modules_available_foreach_param param;
 gboolean r;
+static gboolean first_time=TRUE;
 
        putchar('\n');
+       param.do_print=!first_time;
        param.ntoskrnl_exe_found=FALSE;
        param.ntfs_sys_found=FALSE;
        if (module_available_hash)
@@ -186,9 +193,11 @@ gboolean r;
        if (r)
                puts(_(
                                "Essential modules (\"ntoskrnl.exe\" and \"ntfs.sys\") are available.\n"
-                               "You still may want to get their better version and/or more modules."));
+                               "You may still want to get their better version and/or more modules."));
        putchar('\n');
 
+       first_time=FALSE;
+
        return r;
 }
 
@@ -215,8 +224,11 @@ gboolean essentials_available;
                        free(line);
                        return FALSE;
                        }
-               if (!strncasecmp(line,_("done"),strlen(line)))
+               if (!strncasecmp(line,_("done"),strlen(line))) {
+                       putchar('\n');
+                       puts(final_text(all_modules_found));
                        exit(EXIT_SUCCESS);
+                       }
                free(line);
                }
        /* NOTREACHED */
@@ -270,13 +282,16 @@ GnomeVFSURI *uri;
                if (!all_modules_found)
                        puts(_("\nWe tried all available drivers acquiration method - the options will start again."));
                }
+       putchar('\n');
+       puts(final_text(all_modules_found));
 }
 
 gboolean ui_line_init(void)
 {
        acquire_module_available_notify=ui_line_module_available_notify;
        acquire_module_all_modules_found_notify=ui_line_all_modules_found_notify;
-       ui_search_is_aborted=ui_line_search_is_aborted;
+       ui_progress=ui_line_progress;
        ui_interactive=ui_line_interactive;
+       /* 'captivemodid_module_best_priority_notify' left NULL. */
        return TRUE;
 }