diff options
author | Eskil Heyn Olsen <eskil@src.gnome.org> | 2000-08-31 11:17:23 +0000 |
---|---|---|
committer | Eskil Heyn Olsen <eskil@src.gnome.org> | 2000-08-31 11:17:23 +0000 |
commit | d6571fb86bb85b560cabe75fc1bd58580a643def (patch) | |
tree | 4005a4deb66e8f6653cb129f0760e3405a1dd172 | |
parent | 8e861a1c7671a67086f2d7214ad5cf2be0626dd3 (diff) | |
download | nautilus-d6571fb86bb85b560cabe75fc1bd58580a643def.tar.gz |
Debug output.
* components/services/install/lib/eazel-install-object.c:
(eazel_install_emit_done):
Debug output.
* components/services/install/lib/eazel-install-rpm-glue.c:
(eazel_install_flatten_categories), (install_new_packages),
(eazel_install_download_packages),
(eazel_install_pre_install_packages),
(eazel_install_do_install_packages),
(eazel_install_prune_packages),
(eazel_install_package_name_compare),
(eazel_install_fetch_rpm_dependencies):
Revamped a lot to prevent multiple downloads of the same file (bug
2643), as the installer revealed some easy ways to trigger
that. Basically, I no longer handle each category individually,
but flatten the list. Also handles package-list xml's with
dependency trees.
* components/services/install/lib/eazel-install-xml-package-list.c:
(parse_category), (osd_parse_implementation), (osd_parse_softpkg):
Removed xml_get_prop and use xml_get_value instead.
* nautilus-installer/src/Makefile:
* nautilus-installer/src/Makefile.am:
* nautilus-installer/src/callbacks.c: (begin_install):
* nautilus-installer/src/installer.c: (create_pixmap),
(create_what_to_do_page), (create_install_page),
(create_finish_page_good), (create_finish_page_evil),
(create_window), (install_done), (toggle_button_lock),
(toggle_button_toggled), (eazel_installer_add_category),
(create_info_druid_page), (check_system),
(eazel_install_parse_dont_shows), (eazel_install_parse_must_haves),
(eazel_install_parse_depends), (eazel_installer_load_dependencies),
(eazel_install_get_depends), (eazel_installer_initialize):
* nautilus-installer/src/installer.h:
* nautilus-installer/src/link.sh:
* nautilus-installer/src/main.c: (nautilus_pixmap_file):
* nautilus-installer/src/package-list-depends.xml:
* nautilus-installer/src/prescript:
Slam bam thank you mam. Now uses the nautilus-druid, and only grew
by 100k... phew.
Added some funky xml parsing so you can control category
dependency via a xml file.
-rw-r--r-- | ChangeLog | 46 | ||||
-rw-r--r-- | components/services/install/lib/eazel-install-object.c | 1 | ||||
-rw-r--r-- | components/services/install/lib/eazel-install-rpm-glue.c | 206 | ||||
-rw-r--r-- | components/services/install/lib/eazel-install-xml-package-list.c | 26 | ||||
-rw-r--r-- | nautilus-installer/src/Makefile | 12 | ||||
-rw-r--r-- | nautilus-installer/src/Makefile.am | 5 | ||||
-rw-r--r-- | nautilus-installer/src/callbacks.c | 2 | ||||
-rw-r--r-- | nautilus-installer/src/installer.c | 577 | ||||
-rw-r--r-- | nautilus-installer/src/installer.h | 13 | ||||
-rwxr-xr-x | nautilus-installer/src/link.sh | 8 | ||||
-rw-r--r-- | nautilus-installer/src/main.c | 3 | ||||
-rw-r--r-- | nautilus-installer/src/package-list-depends.xml | 11 | ||||
-rw-r--r-- | nautilus-installer/src/prescript | 2 |
13 files changed, 660 insertions, 252 deletions
@@ -1,3 +1,49 @@ +2000-08-31 Eskil Heyn Olsen <eskil@eazel.com> + + * components/services/install/lib/eazel-install-object.c: + (eazel_install_emit_done): + Debug output. + + * components/services/install/lib/eazel-install-rpm-glue.c: + (eazel_install_flatten_categories), (install_new_packages), + (eazel_install_download_packages), + (eazel_install_pre_install_packages), + (eazel_install_do_install_packages), + (eazel_install_prune_packages), + (eazel_install_package_name_compare), + (eazel_install_fetch_rpm_dependencies): + Revamped a lot to prevent multiple downloads of the same file (bug + 2643), as the installer revealed some easy ways to trigger + that. Basically, I no longer handle each category individually, + but flatten the list. Also handles package-list xml's with + dependency trees. + + * components/services/install/lib/eazel-install-xml-package-list.c: + (parse_category), (osd_parse_implementation), (osd_parse_softpkg): + Removed xml_get_prop and use xml_get_value instead. + + * nautilus-installer/src/Makefile: + * nautilus-installer/src/Makefile.am: + * nautilus-installer/src/callbacks.c: (begin_install): + * nautilus-installer/src/installer.c: (create_pixmap), + (create_what_to_do_page), (create_install_page), + (create_finish_page_good), (create_finish_page_evil), + (create_window), (install_done), (toggle_button_lock), + (toggle_button_toggled), (eazel_installer_add_category), + (create_info_druid_page), (check_system), + (eazel_install_parse_dont_shows), (eazel_install_parse_must_haves), + (eazel_install_parse_depends), (eazel_installer_load_dependencies), + (eazel_install_get_depends), (eazel_installer_initialize): + * nautilus-installer/src/installer.h: + * nautilus-installer/src/link.sh: + * nautilus-installer/src/main.c: (nautilus_pixmap_file): + * nautilus-installer/src/package-list-depends.xml: + * nautilus-installer/src/prescript: + Slam bam thank you mam. Now uses the nautilus-druid, and only grew + by 100k... phew. + Added some funky xml parsing so you can control category + dependency via a xml file. + 2000-08-31 J Shane Culpepper <pepper@eazel.com> * components/services/summary/lib/eazel-summary-shared.c: diff --git a/components/services/install/lib/eazel-install-object.c b/components/services/install/lib/eazel-install-object.c index bb583f0d0..a0e9d25ff 100644 --- a/components/services/install/lib/eazel-install-object.c +++ b/components/services/install/lib/eazel-install-object.c @@ -1057,6 +1057,7 @@ void eazel_install_emit_done (EazelInstall *service, gboolean result) { SANITY(service); + g_message ("D: emit_done (%s)", result ? "TRUE" : "FALSE"); gtk_signal_emit (GTK_OBJECT (service), signals[DONE], result); } diff --git a/components/services/install/lib/eazel-install-rpm-glue.c b/components/services/install/lib/eazel-install-rpm-glue.c index d116de9d3..d5fe8ac7b 100644 --- a/components/services/install/lib/eazel-install-rpm-glue.c +++ b/components/services/install/lib/eazel-install-rpm-glue.c @@ -59,11 +59,8 @@ typedef void (*rpm_install_cb)(char* name, char* group, void* user_data); -static gboolean download_all_packages (EazelInstall *service, - GList* categories); - -static gboolean install_packages (EazelInstall *service, - GList* categories); +static gboolean eazel_install_do_install_packages (EazelInstall *service, + GList* packages); typedef void* (*RpmCallbackFunc) (const Header, const rpmCallbackType, const unsigned long, const unsigned long, @@ -97,6 +94,28 @@ static void eazel_install_prune_packages (EazelInstall *service, PackageData *pack, ...); +static gboolean eazel_install_download_packages (EazelInstall *service, + gboolean toplevel, + GList **packages, + GList **failed_packages); + + +static GList * +eazel_install_flatten_categories (EazelInstall *service, + GList *categories) +{ + GList* packages = NULL; + GList* iterator, *category_iterator; + + for (category_iterator = categories; category_iterator; category_iterator = category_iterator->next) { + CategoryData *cat = (CategoryData*)category_iterator->data; + packages = g_list_concat (packages, cat->packages); + } + + + return packages; +} + EazelInstallStatus install_new_packages (EazelInstall *service, GList *categories) { EazelInstallStatus result; @@ -141,9 +160,15 @@ install_new_packages (EazelInstall *service, GList *categories) { if (categories == NULL) { result = EAZEL_INSTALL_NOTHING; } else { - if (download_all_packages (service, categories)) { + /* First, collect all packages in one list */ + GList *packages = eazel_install_flatten_categories (service, categories); + + /* Now download all the packages */ + if (eazel_install_download_packages (service, TRUE, &packages, NULL)) { result = EAZEL_INSTALL_DOWNLOADS; - if (install_packages (service,categories)) { + + /* Files downloaded, now install */ + if (eazel_install_do_install_packages (service, packages)) { result |= EAZEL_INSTALL_INSTALL_OK; } } @@ -152,7 +177,6 @@ install_new_packages (EazelInstall *service, GList *categories) { return result; } /* end install_new_packages */ - static gboolean eazel_install_download_packages (EazelInstall *service, gboolean toplevel, @@ -193,12 +217,23 @@ eazel_install_download_packages (EazelInstall *service, package->filename = g_strdup (tmp); fetch_package = TRUE; } - - } else { - g_message (_("Will download %s"), package->name); - } + } else if (!eazel_install_get_force (service) && package->version) { + /* If the package has a version set, check that we don't already have + the same or newer installed. This is almost the same check as + in eazel_install_pre_install_package. The reason for two checks is + - first check before download (if possible) + - after download, when we for sure have access to the version, check again + */ + int inst_status = eazel_install_check_existing_packages (service, package); + if (inst_status <= 0) { + fetch_package = FALSE; + remove_list = g_list_prepend (remove_list, package); + g_message (_("%s already installed"), package->name); + } + } if (fetch_package) { + g_message (_("Will download %s"), package->name); if (eazel_install_fetch_package (service, package)==FALSE) { remove_list = g_list_prepend (remove_list, package); } else { @@ -225,88 +260,55 @@ eazel_install_download_packages (EazelInstall *service, return TRUE; } -/* - Returns FALSE if some packages failed; - */ -static gboolean -download_all_packages (EazelInstall *service, - GList* categories) -{ - gboolean result; - GList *iterator; - - result = FALSE; - for (iterator = categories; iterator; iterator=iterator->next) { - gboolean tmp_result; - CategoryData* cat = (CategoryData*)iterator->data; - - g_message (_("Downloading packages for category %s"), cat->name); - tmp_result = eazel_install_download_packages (service, TRUE, &cat->packages, NULL); - result = result ? TRUE : tmp_result; - } - - return result; -} - /* Checks for pre-existance of all the packages and returns a flattened packagelist (flattens the soft_ and hard_depends */ static GList* eazel_install_pre_install_packages (EazelInstall *service, - GList *categories) + GList **packages) { - GList* packages = NULL; - GList* iterator, *category_iterator; + GList *iterator; + GList *failed_packages = NULL; - for (category_iterator = categories; category_iterator; category_iterator = category_iterator->next) { - GList *failed_packages = NULL; - CategoryData *cat = (CategoryData*)category_iterator->data; - - /* Check for existing installed packages */ - for (iterator = cat->packages; iterator; iterator = iterator->next) { - PackageData *pack; - int inst_status; - - pack = (PackageData*)iterator->data; - inst_status = eazel_install_check_existing_packages (service, pack); - g_message ("D: %s: install status = %d", pack->name, inst_status); - /* If in force mode, install it under all circumstances. - if not, only install if not already installed in same - version or up/downgrade is set */ - if (eazel_install_get_force (service) || - (eazel_install_get_downgrade (service) && inst_status == -1) || - (eazel_install_get_update (service) && inst_status == 1) || - inst_status == 2) { - packages = g_list_prepend (packages, pack); - } else { - g_message ("D: Skipping %s...", pack->name); - pack->status = PACKAGE_ALREADY_INSTALLED; - failed_packages = g_list_prepend (failed_packages, pack); - } + for (iterator = *packages; iterator; iterator = iterator->next) { + PackageData *pack; + int inst_status; + + pack = (PackageData*)iterator->data; + inst_status = eazel_install_check_existing_packages (service, pack); + g_message ("D: %s: install status = %d", pack->name, inst_status); + /* If in force mode, install it under all circumstances. + if not, only install if not already installed in same + version or up/downgrade is set */ + if (eazel_install_get_force (service) || + (eazel_install_get_downgrade (service) && inst_status == -1) || + (eazel_install_get_update (service) && inst_status == 1) || + inst_status == 2) { + g_message (_("%s..."), pack->name); + } else { + g_message (_("Skipping %s..."), pack->name); + pack->status = PACKAGE_ALREADY_INSTALLED; + failed_packages = g_list_prepend (failed_packages, pack); } + } - for (iterator = failed_packages; iterator; iterator=iterator->next) { - eazel_install_prune_packages (service, - (PackageData*)iterator->data, - &cat->packages, NULL); - } + for (iterator = failed_packages; iterator; iterator=iterator->next) { + eazel_install_prune_packages (service, + (PackageData*)iterator->data, + packages, NULL); } - - - return packages; + g_list_free (failed_packages); } static gboolean -install_packages (EazelInstall *service, - GList* categories) +eazel_install_do_install_packages (EazelInstall *service, + GList* packages) { - gboolean rv; - GList* packages; + gboolean rv = FALSE; GList* failedfiles = NULL; - rv = TRUE; - packages = eazel_install_pre_install_packages (service, categories); + eazel_install_pre_install_packages (service, &packages); if (packages) { if (eazel_install_prepare_package_system (service) == FALSE) { @@ -314,12 +316,12 @@ install_packages (EazelInstall *service, } eazel_install_ensure_deps (service, &packages, &failedfiles); eazel_install_free_package_system (service); - - if (eazel_install_start_transaction (service, packages) != 0) { - rv = FALSE; - } - - g_list_free (packages); + if (g_list_length (packages)) { + if (eazel_install_start_transaction (service, packages) == 0) { + rv = TRUE; + } + g_list_free (packages); + } } return rv; @@ -1020,7 +1022,9 @@ eazel_install_prune_packages (EazelInstall *service, for (iterator = pruned; iterator; iterator = iterator->next) { PackageData *pack; pack = (PackageData*)iterator->data; - packagedata_destroy (pack); + /* Note, don't destroy, all packages are destroyed when the + categories are destroyed */ + /* packagedata_destroy (pack); */ }; g_list_free (pruned); @@ -1322,6 +1326,9 @@ int eazel_install_package_name_compare (PackageData *pack, char *name) { + g_message ("eazel_install_package_conflict_compare (%s, %s)", + pack->name, + name); return strcmp (pack->name, name); } @@ -1421,7 +1428,9 @@ eazel_install_fetch_rpm_dependencies (EazelInstall *service, { int iterator; GHashTable *extras; - GList *to_remove, *remove_iterator; + GList *to_remove; + GList *remove_iterator; + GList *extras_in_this_batch = NULL; struct rpmDependencyConflict conflict; gboolean fetch_from_file_dependency; gboolean fetch_result; @@ -1442,10 +1451,24 @@ eazel_install_fetch_rpm_dependencies (EazelInstall *service, conflict = service->private->packsys.rpm.conflicts[iterator]; + /* Check if a previous conflict solve has fixed this conflict */ + /* + if (g_list_find_custom (extras_in_this_batch, + conflict.needsName, + (GCompareFunc)eazel_install_package_name_compare)) { + g_message ("D: already handled %s", conflict.needsName); + continue; + } + */ + if (g_list_find_custom (extras_in_this_batch, + conflict.byName, + (GCompareFunc)eazel_install_package_name_compare)) { + g_message ("D: already handled %s", conflict.needsName); + continue; + } pack_entry = g_list_find_custom (*packages, (gpointer)&conflict, (GCompareFunc)eazel_install_package_conflict_compare); - if (pack_entry == NULL) { switch (conflict.sense) { case RPMDEP_SENSE_REQUIRES: { @@ -1531,13 +1554,9 @@ eazel_install_fetch_rpm_dependencies (EazelInstall *service, if (*conflict.needsName=='/' || strstr (conflict.needsName, ".so")) { g_message (_("Processing dep for %s : requires library %s"), pack->name, conflict.needsName); -#ifndef EAZEL_INSTALL_SLIM dep = packagedata_new (); dep->name = g_strdup (conflict.needsName); fetch_from_file_dependency = TRUE; -#else - continue; -#endif } else { dep = packagedata_new_from_rpm_conflict (conflict); dep->archtype = g_strdup (pack->archtype); @@ -1575,6 +1594,12 @@ eazel_install_fetch_rpm_dependencies (EazelInstall *service, extralist = g_list_append (extralist, dep); g_hash_table_insert (extras, pack->name, extralist); + /* This list contains all the packages added in this call + to fetch_rpm_dependencies. It's used in the initial check, + to avoid that multiple requests for a file results in + multiple downloads */ + extras_in_this_batch = g_list_prepend (extras_in_this_batch, dep); + pack->status = PACKAGE_PARTLY_RESOLVED; } else { /* @@ -1615,6 +1640,7 @@ eazel_install_fetch_rpm_dependencies (EazelInstall *service, /* iterate over all the lists in extras and add to extrapackages */ g_hash_table_foreach (extras, (GHFunc)eazel_install_add_to_extras_foreach, extrapackages); g_hash_table_destroy (extras); + g_list_free (extras_in_this_batch); /* Removed packages marked as failed. No need to delete them, as they're in (*failedpackages) */ diff --git a/components/services/install/lib/eazel-install-xml-package-list.c b/components/services/install/lib/eazel-install-xml-package-list.c index d02fed8c7..0adc82458 100644 --- a/components/services/install/lib/eazel-install-xml-package-list.c +++ b/components/services/install/lib/eazel-install-xml-package-list.c @@ -111,20 +111,6 @@ parse_package (xmlNode* package, gboolean set_toplevel) { } /* end parse package */ -/* Returns a g_strdupped xmlGetProp val */ -static char * -xml_get_prop (xmlNode *node, char *tag) { - char *tmp = NULL; - char *result = NULL; - - tmp = xmlGetProp (node, tag); - if (tmp) { - result = g_strdup (tmp); - free (tmp); - } - return result; -} - static CategoryData* parse_category (xmlNode* cat) { @@ -132,7 +118,7 @@ parse_category (xmlNode* cat) { xmlNode* pkg; category = categorydata_new (); - category->name = xml_get_prop (cat, "name"); + category->name = xml_get_value (cat, "name"); pkg = cat->childs->childs; if (pkg == NULL) { @@ -504,7 +490,7 @@ osd_parse_implementation (PackageData *pack, child = node->childs; while (child) { if (g_strcasecmp (child->name, "PROCESSOR")==0) { - pack->archtype = xml_get_prop (child, "VALUE"); + pack->archtype = xml_get_value (child, "VALUE"); } else if (g_strcasecmp (child->name, "OS")==0) { char *dtmp = xmlGetProp (child, "VALUE"); if (dtmp) { @@ -513,9 +499,9 @@ osd_parse_implementation (PackageData *pack, } g_free (dtmp); } else if (g_strcasecmp (child->name, "CODEBASE")==0) { - pack->filename = xml_get_prop (child, "HREF"); + pack->filename = xml_get_value (child, "HREF"); { - char *stmp = xml_get_prop (child, "SIZE"); + char *stmp = xml_get_value (child, "SIZE"); if (stmp) { pack->bytesize = atoi (stmp); } else { @@ -541,8 +527,8 @@ osd_parse_softpkg (xmlNodePtr softpkg) result = packagedata_new (); - result->name = xml_get_prop (softpkg, "NAME"); - result->version = xml_get_prop (softpkg, "VERSION"); + result->name = xml_get_value (softpkg, "NAME"); + result->version = xml_get_value (softpkg, "VERSION"); child = softpkg->childs; while (child) { diff --git a/nautilus-installer/src/Makefile b/nautilus-installer/src/Makefile index bb70b38df..61282d993 100644 --- a/nautilus-installer/src/Makefile +++ b/nautilus-installer/src/Makefile @@ -59,6 +59,8 @@ PRE_UNINSTALL = : POST_UNINSTALL = : host_alias = i686-pc-linux-gnu host_triplet = i686-pc-linux-gnu +AMMONITE_CFLAGS = -I/gnome/include +AMMONITE_LIBS = -L/gnome/lib -lammonite -lammonite-gtk AS = @AS@ BONOBOX_CFLAGS = -I/gnome/include -DNEED_GNOMESUPPORT_H -I/gnome/lib/gnome-libs/include -I/gnome/lib/glib/include -I/usr/X11R6/include -I/gnome/include/gnome-xml BONOBOX_LIBS = -rdynamic -L/gnome/lib -L/usr/X11R6/lib -L/usr/lib -lbonobo -lgdk_pixbuf -ltiff -ljpeg -lpng -lgnomeprint -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -ldb1 -ldl -lxml -lz -loaf -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lglib -lnsl -lm -lbonobox @@ -66,7 +68,7 @@ BONOBO_CFLAGS = -I/gnome/include -DNEED_GNOMESUPPORT_H -I/gnome/lib/gnome-libs/i BONOBO_LIBS = -rdynamic -L/gnome/lib -L/usr/X11R6/lib -L/usr/lib -lbonobo -lgdk_pixbuf -ltiff -ljpeg -lpng -lgnomeprint -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -ldb1 -ldl -lxml -lz -loaf -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lglib -lnsl -lm BONOBO_PRINT_CFLAGS = BONOBO_PRINT_LIBS = -CATALOGS = +CATALOGS = da.gmo de.gmo fr.gmo ga.gmo gl.gmo it.gmo ja.gmo ko.gmo no.gmo pt_BR.gmo ru.gmo sv.gmo tr.gmo uk.gmo zh_TW.Big5.gmo CATOBJEXT = .gmo CC = gcc CPP = gcc -E @@ -156,7 +158,7 @@ l = NULL = -INCLUDES = -I$(top_srcdir)/components/services/install/lib -I$(top_srcdir)/components/services/trilobite -I/usr/include/rpm $(GNOMEUI_CFLAGS) $(XML_CFLAGS) $(GHTTP_CFLAGS) $(GNOME_INCLUDEDIR) -DGNOMELOCALEDIR=\""$(datadir)/locale"\" -DG_LOG_DOMAIN=\"Nautilus-Installer\" $(NULL) +INCLUDES = -I$(top_srcdir)/libnautilus-extensions -I$(top_srcdir)/components/services/install/lib -I$(top_srcdir)/components/services/trilobite -I/usr/include/rpm $(GNOMEUI_CFLAGS) $(XML_CFLAGS) $(GHTTP_CFLAGS) $(GNOME_INCLUDEDIR) -DGNOMELOCALEDIR=\""$(datadir)/locale"\" -DG_LOG_DOMAIN=\"Nautilus-Installer\" $(NULL) CPPFLAGS = -DEAZEL_INSTALL_NO_CORBA -DEAZEL_INSTALL_SLIM -DNO_TEXT_BOX @@ -170,7 +172,7 @@ nautilus_installer_SOURCES = main.c support.c support.h callbacks.c callback nautilus_installer_LDFLAGS = -static -nautilus_installer_LDADD = $(top_builddir)/components/services/trilobite/libtrilobite/helixcode-utils.o $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-distribution.o $(top_builddir)/components/services/install/lib/libeazelinstall_minimal.a $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-root-helper.o $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-utils.o -L/gnome/lib -lgnomeui -lgnome -lart_lgpl -lgdk_imlib -lgtk -lgdk -lgmodule -lglib -L/usr/X11R6/lib -ldl -lXext -lX11 -lm -lSM -lICE -lghttp -L/usr/lib -lrpm -lz -ldb1 -lpopt -lxml +nautilus_installer_LDADD = $(top_builddir)/components/services/trilobite/libtrilobite/helixcode-utils.o $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-distribution.o $(top_builddir)/components/services/install/lib/libeazelinstall_minimal.a $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-root-helper.o $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-utils.o $(top_builddir)/libnautilus-extensions/nautilus-druid.o $(top_builddir)/libnautilus-extensions/nautilus-druid-page-eazel.o -L/gnome/lib -lgdk_pixbuf -lgnomecanvaspixbuf -lgnomeui -lgnome -lart_lgpl -lgdk_imlib -lgtk -lgdk -lgmodule -lglib -L/usr/X11R6/lib -ldl -lXext -lX11 -lm -lSM -lICE -lghttp -L/usr/lib -lrpm -lz -ldb1 -lpopt -lxml mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../../config.h @@ -187,7 +189,9 @@ $(top_builddir)/components/services/trilobite/libtrilobite/helixcode-utils.o \ $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-distribution.o \ $(top_builddir)/components/services/install/lib/libeazelinstall_minimal.a \ $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-root-helper.o \ -$(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-utils.o +$(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-utils.o \ +$(top_builddir)/libnautilus-extensions/nautilus-druid.o \ +$(top_builddir)/libnautilus-extensions/nautilus-druid-page-eazel.o COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) diff --git a/nautilus-installer/src/Makefile.am b/nautilus-installer/src/Makefile.am index 2abbeee62..3e197af86 100644 --- a/nautilus-installer/src/Makefile.am +++ b/nautilus-installer/src/Makefile.am @@ -3,6 +3,7 @@ NULL = INCLUDES = \ + -I$(top_srcdir)/libnautilus-extensions \ -I$(top_srcdir)/components/services/install/lib \ -I$(top_srcdir)/components/services/trilobite \ -I/usr/include/rpm \ @@ -35,7 +36,11 @@ nautilus_installer_LDADD = \ $(top_builddir)/components/services/install/lib/libeazelinstall_minimal.a \ $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-root-helper.o \ $(top_builddir)/components/services/trilobite/libtrilobite/trilobite-core-utils.o \ + $(top_builddir)/libnautilus-extensions/nautilus-druid.o \ + $(top_builddir)/libnautilus-extensions/nautilus-druid-page-eazel.o \ -L/gnome/lib \ + -lgdk_pixbuf \ + -lgnomecanvaspixbuf \ -lgnomeui \ -lgnome \ -lart_lgpl \ diff --git a/nautilus-installer/src/callbacks.c b/nautilus-installer/src/callbacks.c index ddb9c9490..e8728d1f9 100644 --- a/nautilus-installer/src/callbacks.c +++ b/nautilus-installer/src/callbacks.c @@ -49,7 +49,6 @@ begin_install (EazelInstaller *installer) GList *install_categories = NULL; druid = GNOME_DRUID (gtk_object_get_data (GTK_OBJECT (window), "druid")); - nextpage = GNOME_DRUID_PAGE (gtk_object_get_data (GTK_OBJECT (window), "finish_page")); gnome_druid_set_buttons_sensitive(druid,TRUE,FALSE,TRUE); for (iterator = installer->categories; iterator; iterator = iterator->next) { @@ -65,7 +64,6 @@ begin_install (EazelInstaller *installer) eazel_installer_do_install (installer, install_categories); } gnome_druid_set_buttons_sensitive(druid,TRUE,TRUE,TRUE); - gnome_druid_set_page (druid, nextpage); return FALSE; } diff --git a/nautilus-installer/src/installer.c b/nautilus-installer/src/installer.c index b3ec7dcab..892950bc0 100644 --- a/nautilus-installer/src/installer.c +++ b/nautilus-installer/src/installer.c @@ -37,6 +37,9 @@ #include <dirent.h> #include <sys/utsname.h> +#include <nautilus-druid.h> +#include <nautilus-druid-page-eazel.h> + #include "installer.h" #include "callbacks.h" #include "installer.h" @@ -49,7 +52,7 @@ #include "Step_Three_Top.xpm" #include "Step_One_Top.xpm" #include "Final_Top.xpm" - +#include "evil.xpm" #define EAZEL_SERVICES_DIR_HOME "/var/eazel" #define EAZEL_SERVICES_DIR EAZEL_SERVICES_DIR_HOME "/services" @@ -59,18 +62,52 @@ #define TMP_DIR "/tmp/eazel-install" #define RPMRC "/usr/lib/rpm/rpmrc" #define REMOTE_RPM_DIR "/RPMS" +#define CATEGORY_DEPENDS_LIST "package-list-depends.xml" int installer_debug = 0; int installer_output = 0; int installer_test = 0; int installer_force = 0; int installer_local = 0; +int installer_no_helix = 0; char *installer_server =NULL; int installer_server_port = 0; static GtkObjectClass *eazel_installer_parent_class; +static GdkPixbuf* +create_pixmap (GtkWidget *widget, + char **xpmdata, + int x, int y) +{ + GtkWidget *pixmap; + GdkColormap *colormap; + GdkPixmap *gdkpixmap; + GdkBitmap *mask; + GdkPixbuf *pixbuf; + + colormap = gtk_widget_get_colormap (widget); + + gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, + colormap, + &mask, + NULL, + (gchar**)xpmdata); + + g_assert (gdkpixmap); + + pixbuf = gdk_pixbuf_get_from_drawable (NULL, + gdkpixmap, + colormap, + 0,0,0,0, + x, y); + + gdk_pixmap_unref (gdkpixmap); + gdk_bitmap_unref (mask); + + return pixbuf; +} static void set_white_stuff (GtkWidget *w) @@ -98,9 +135,14 @@ create_what_to_do_page (GtkWidget *druid, GtkWidget *window) GtkWidget *label10; GtkWidget *fixed3; - what_to_do_page = gnome_druid_page_standard_new_with_vals ("", NULL); + what_to_do_page = nautilus_druid_page_eazel_new_with_vals (NAUTILUS_DRUID_PAGE_EAZEL_OTHER, + _("Step two..."), + _("You have several choices for what you would like the installer to do.\n" + "Please choose one and click on the \"Next\" button to begin install."), + NULL, + NULL, + NULL); - set_white_stuff (GTK_WIDGET (what_to_do_page)); gtk_widget_set_name (what_to_do_page, "what_to_do_page"); gtk_widget_ref (what_to_do_page); @@ -108,39 +150,13 @@ create_what_to_do_page (GtkWidget *druid, GtkWidget *window) (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show_all (what_to_do_page); gnome_druid_append_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (what_to_do_page)); - gnome_druid_page_standard_set_bg_color (GNOME_DRUID_PAGE_STANDARD (what_to_do_page), - &what_to_do_page_bg_color); - gnome_druid_page_standard_set_logo_bg_color (GNOME_DRUID_PAGE_STANDARD (what_to_do_page), - &what_to_do_page_logo_bg_color); - gnome_druid_page_standard_set_title_color (GNOME_DRUID_PAGE_STANDARD (what_to_do_page), - &what_to_do_page_title_color); - gnome_druid_page_standard_set_title (GNOME_DRUID_PAGE_STANDARD (what_to_do_page), _("What to do ?")); - - druid_vbox1 = GNOME_DRUID_PAGE_STANDARD (what_to_do_page)->vbox; - set_white_stuff (GTK_WIDGET (druid_vbox1)); - gtk_widget_set_name (druid_vbox1, "druid_vbox1"); - gtk_widget_ref (druid_vbox1); - gtk_object_set_data_full (GTK_OBJECT (window), "druid_vbox1", druid_vbox1, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (druid_vbox1); vbox3 = gtk_vbox_new (FALSE, 0); gtk_widget_set_name (vbox3, "vbox3"); gtk_widget_ref (vbox3); gtk_object_set_data_full (GTK_OBJECT (window), "vbox3", vbox3, - (GtkDestroyNotify) gtk_widget_unref); + (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox3); - gtk_box_pack_start (GTK_BOX (druid_vbox1), vbox3, TRUE, TRUE, 0); - - label10 = gtk_label_new (_("You have several choices for what you would like the installer to do.\n" - "Please choose one and click on the \"Next\" button to begin install.")); - gtk_widget_set_name (label10, "label10"); - gtk_widget_ref (label10); - gtk_object_set_data_full (GTK_OBJECT (window), "label10", label10, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (label10); - gtk_box_pack_start (GTK_BOX (vbox3), label10, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_LEFT); fixed3 = gtk_fixed_new (); set_white_stuff (GTK_WIDGET (fixed3)); @@ -151,6 +167,9 @@ create_what_to_do_page (GtkWidget *druid, GtkWidget *window) gtk_widget_show (fixed3); gtk_box_pack_start (GTK_BOX (vbox3), fixed3, TRUE, TRUE, 0); + nautilus_druid_page_eazel_put_widget (NAUTILUS_DRUID_PAGE_EAZEL (what_to_do_page), + vbox3); + return what_to_do_page; } @@ -181,28 +200,18 @@ create_install_page (GtkWidget *druid, GtkWidget *window) "install Nautilus\n")); download_description_length = strlen (download_description); - install_page = gnome_druid_page_standard_new_with_vals ("", NULL); - set_white_stuff (GTK_WIDGET (install_page)); + install_page = nautilus_druid_page_eazel_new_with_vals (NAUTILUS_DRUID_PAGE_EAZEL_OTHER, + _("Step three..."), + NULL, + NULL, + NULL, + NULL); gtk_widget_set_name (install_page, "install_page"); gtk_widget_ref (install_page); gtk_object_set_data_full (GTK_OBJECT (window), "install_page", install_page, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show_all (install_page); gnome_druid_append_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (install_page)); - gnome_druid_page_standard_set_bg_color (GNOME_DRUID_PAGE_STANDARD (install_page), - &install_page_bg_color); - gnome_druid_page_standard_set_logo_bg_color (GNOME_DRUID_PAGE_STANDARD (install_page), - &install_page_logo_bg_color); - gnome_druid_page_standard_set_title_color (GNOME_DRUID_PAGE_STANDARD (install_page), - &install_page_title_color); - gnome_druid_page_standard_set_title (GNOME_DRUID_PAGE_STANDARD (install_page), _("Progress...")); - - druid_vbox2 = GNOME_DRUID_PAGE_STANDARD (install_page)->vbox; - gtk_widget_set_name (druid_vbox2, "druid_vbox2"); - gtk_widget_ref (druid_vbox2); - gtk_object_set_data_full (GTK_OBJECT (window), "druid_vbox2", druid_vbox2, - (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (druid_vbox2); vbox5 = gtk_vbox_new (FALSE, 0); set_white_stuff (GTK_WIDGET (vbox5)); @@ -211,7 +220,8 @@ create_install_page (GtkWidget *druid, GtkWidget *window) gtk_object_set_data_full (GTK_OBJECT (window), "vbox5", vbox5, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (vbox5); - gtk_box_pack_start (GTK_BOX (druid_vbox2), vbox5, TRUE, TRUE, 0); + nautilus_druid_page_eazel_put_widget (NAUTILUS_DRUID_PAGE_EAZEL (install_page), + vbox5); table2 = gtk_table_new (3, 2, FALSE); set_white_stuff (GTK_WIDGET (table2)); @@ -283,35 +293,63 @@ create_install_page (GtkWidget *druid, GtkWidget *window) } GtkWidget* -create_finish_page (GtkWidget *druid, GtkWidget *window) +create_finish_page_good (GtkWidget *druid, + GtkWidget *window) { GtkWidget *finish_page; GdkColor finish_page_bg_color = { 0, 3341, 23130, 26214 }; GdkColor finish_page_textbox_color = { 0, 65535, 65535, 65535 }; GdkColor finish_page_logo_bg_color = { 0, 3341, 23130, 26214 }; GdkColor finish_page_title_color = { 0, 65535, 65535, 65535 }; + GdkPixbuf *top = create_pixmap (window, (char**)step_three_top, 51, 51); + GdkPixbuf *left = create_pixmap (window, (char**)banner_left, 101, 255); + GdkPixbuf *background = NULL; + + finish_page = nautilus_druid_page_eazel_new_with_vals (NAUTILUS_DRUID_PAGE_EAZEL_FINISH, + _("Finished..."), + _("You can find the nautilus icon in the applications menu.\n\n" + "Thanks for taking the time to try out Nautilus.\n\n" + "May your life be a healthy and happy one."), + top, + left, + background); + + gtk_widget_set_name (finish_page, "finish_page"); + gtk_widget_ref (finish_page); + gtk_object_set_data_full (GTK_OBJECT (window), "finish_page", finish_page, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (finish_page); + gnome_druid_append_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (finish_page)); + + return finish_page; +} - finish_page = gnome_druid_page_finish_new (); +GtkWidget* +create_finish_page_evil (GtkWidget *druid, + GtkWidget *window) +{ + GtkWidget *finish_page; + GdkColor finish_page_bg_color = { 0, 3341, 23130, 26214 }; + GdkColor finish_page_textbox_color = { 0, 65535, 65535, 65535 }; + GdkColor finish_page_logo_bg_color = { 0, 3341, 23130, 26214 }; + GdkColor finish_page_title_color = { 0, 65535, 65535, 65535 }; + GdkPixbuf *top = create_pixmap (window, (char**)evil_xpm, 48, 48); + GdkPixbuf *left = create_pixmap (window, (char**)banner_left, 101, 255); + GdkPixbuf *background = NULL; + + finish_page = nautilus_druid_page_eazel_new_with_vals (NAUTILUS_DRUID_PAGE_EAZEL_FINISH, + _("Finished..."), + _("Your machine is now possessed..."), + top, + left, + background); + gtk_widget_set_name (finish_page, "finish_page"); gtk_widget_ref (finish_page); gtk_object_set_data_full (GTK_OBJECT (window), "finish_page", finish_page, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (finish_page); gnome_druid_append_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (finish_page)); - gnome_druid_page_finish_set_bg_color (GNOME_DRUID_PAGE_FINISH (finish_page), - &finish_page_bg_color); - gnome_druid_page_finish_set_textbox_color (GNOME_DRUID_PAGE_FINISH (finish_page), - &finish_page_textbox_color); - gnome_druid_page_finish_set_logo_bg_color (GNOME_DRUID_PAGE_FINISH (finish_page), - &finish_page_logo_bg_color); - gnome_druid_page_finish_set_title_color (GNOME_DRUID_PAGE_FINISH (finish_page), - &finish_page_title_color); - gnome_druid_page_finish_set_title (GNOME_DRUID_PAGE_FINISH (finish_page), _("Finished")); - gnome_druid_page_finish_set_text (GNOME_DRUID_PAGE_FINISH (finish_page), - _("If the installation was successfull, you can\n" - "find the nautilus icon in the applications menu.\n\n" - "Thanks for taking the time to try out Nautilus.\n\n" - "May your life be a healthy and happy one.")); return finish_page; } @@ -330,20 +368,47 @@ create_window (EazelInstaller *installer) GtkWidget *install_page; GtkWidget *finish_page; - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + GdkPixbuf + *top = NULL, + *left = NULL, + *background = NULL; + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_name (window, "window"); gtk_object_set_data (GTK_OBJECT (window), "window", window); gtk_window_set_title (GTK_WINDOW (window), _("Nautilus install tool")); - druid = gnome_druid_new (); + druid = nautilus_druid_new (); gtk_widget_set_name (druid, "druid"); gtk_widget_ref (druid); gtk_object_set_data_full (GTK_OBJECT (window), "druid", druid, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (druid); gtk_container_add (GTK_CONTAINER (window), druid); + installer->druid = GNOME_DRUID (druid); + + top = create_pixmap (window, (char**)step_one_top, 51, 51); + left = create_pixmap (window, (char**)banner_left, 101, 255); + + start_page = nautilus_druid_page_eazel_new_with_vals (NAUTILUS_DRUID_PAGE_EAZEL_START, + _("Step one..."), + _("This is the internal Nautilus installer.\n\n" + "Lots of text should go here letting you know what you need\n" + "to have installed before you should even begin to think about\n" + "using this. For example:\n" + "\n" + " * Stuff\n" + " * More stuff\n" + " * Other stuff\n" + "\n" + "If you meet these requirements, hit the \"Next\" button to continue!\n\n"), + top, + left, + background); + + + installer->back_page = GNOME_DRUID_PAGE (start_page); - start_page = gnome_druid_page_start_new (); gtk_widget_set_name (start_page, "start_page"); gtk_widget_ref (start_page); gtk_object_set_data_full (GTK_OBJECT (window), "start_page", start_page, @@ -351,30 +416,11 @@ create_window (EazelInstaller *installer) gtk_widget_show (start_page); gnome_druid_append_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (start_page)); gnome_druid_set_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (start_page)); - gnome_druid_page_start_set_bg_color (GNOME_DRUID_PAGE_START (start_page), - &start_page_bg_color); - gnome_druid_page_start_set_textbox_color (GNOME_DRUID_PAGE_START (start_page), - &start_page_textbox_color); - gnome_druid_page_start_set_logo_bg_color (GNOME_DRUID_PAGE_START (start_page), - &start_page_logo_bg_color); - gnome_druid_page_start_set_title_color (GNOME_DRUID_PAGE_START (start_page), - &start_page_title_color); - gnome_druid_page_start_set_title (GNOME_DRUID_PAGE_START (start_page), _("Step one:")); - gnome_druid_page_start_set_text (GNOME_DRUID_PAGE_START (start_page), - _("This is the internal Nautilus installer.\n\n" - "Lots of text should go here letting you know what you need\n" - "to have installed before you should even begin to think about\n" - "using this. For example:\n" - "\n" - " * Stuff\n" - " * More stuff\n" - " * Other stuff\n" - "\n" - "If you meet these requirements, hit the \"Next\" button to continue!\n\n")); what_to_do_page = create_what_to_do_page (druid, window); install_page = create_install_page (druid, window); - finish_page = create_finish_page (druid, window); + installer->finish_good = GNOME_DRUID_PAGE (create_finish_page_good (druid, window)); + installer->finish_evil = GNOME_DRUID_PAGE (create_finish_page_evil (druid, window)); gtk_signal_connect (GTK_OBJECT (druid), "cancel", GTK_SIGNAL_FUNC (druid_cancel), @@ -385,40 +431,16 @@ create_window (EazelInstaller *installer) gtk_signal_connect (GTK_OBJECT (install_page), "prepare", GTK_SIGNAL_FUNC (prep_install), installer); - gtk_signal_connect (GTK_OBJECT (finish_page), "finish", + gtk_signal_connect (GTK_OBJECT (installer->finish_good), "finish", + GTK_SIGNAL_FUNC (druid_finish), + installer); + gtk_signal_connect (GTK_OBJECT (installer->finish_evil), "finish", GTK_SIGNAL_FUNC (druid_finish), installer); return window; } -static void -set_images (GtkWidget *window) -{ - - GnomeDruidPage *page; - - page = GNOME_DRUID_PAGE (gtk_object_get_data(GTK_OBJECT (window), "start_page")); - gnome_druid_page_start_set_logo (GNOME_DRUID_PAGE_START (page), - gdk_imlib_create_image_from_xpm_data (step_one_top)); - gnome_druid_page_start_set_watermark (GNOME_DRUID_PAGE_START (page), - gdk_imlib_create_image_from_xpm_data (banner_left)); - - page = GNOME_DRUID_PAGE (gtk_object_get_data(GTK_OBJECT (window), "what_to_do_page")); - gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (page), - gdk_imlib_create_image_from_xpm_data (step_two_top)); - - page = GNOME_DRUID_PAGE (gtk_object_get_data(GTK_OBJECT (window), "install_page")); - gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (page), - gdk_imlib_create_image_from_xpm_data (step_three_top)); - - page = GNOME_DRUID_PAGE (gtk_object_get_data(GTK_OBJECT (window), "finish_page")); - gnome_druid_page_finish_set_logo (GNOME_DRUID_PAGE_FINISH (page), - gdk_imlib_create_image_from_xpm_data (final_top)); - gnome_druid_page_finish_set_watermark (GNOME_DRUID_PAGE_FINISH (page), - gdk_imlib_create_image_from_xpm_data (banner_left)); -} - static void eazel_install_progress (EazelInstall *service, const PackageData *package, @@ -692,14 +714,65 @@ eazel_install_delete_files (EazelInstall *service, return TRUE ; } +static void +install_done (EazelInstall *service, + gboolean result, + EazelInstaller *installer) +{ + g_message ("Done, result is %s", result ? "good":"evil"); + if (result) { + gnome_druid_set_page (installer->druid, installer->finish_good); + } else { + gnome_druid_set_page (installer->druid, installer->finish_evil); + } +} + +static void +toggle_button_lock (EazelInstaller *installer, char *name, gboolean lock) +{ + GtkWidget *button; + + button = lookup_widget (installer->window, + name); + if (button) { + if (lock) { + gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); + } else { + gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE); + } + } else { + g_warning ("Wanted to lock unknown button %s", name); + } +} + +static void +toggle_button_toggled (GtkToggleButton *button, + EazelInstaller *installer) +{ + GList *deps; + GList *iterator; + + g_message ("%s toggled to %s", + gtk_widget_get_name (GTK_WIDGET (button)), + button->active ? "ACTIVE" : "deactivated"); + + deps = g_hash_table_lookup (installer->category_deps, gtk_widget_get_name (GTK_WIDGET (button))); + for (iterator = deps; iterator; iterator = iterator->next) { + toggle_button_lock (installer, + (char*)iterator->data, + button->active); + } +} + static void eazel_installer_add_category (EazelInstaller *installer, CategoryData *category) { static int magic = 24; - GtkWidget *button; - GtkWidget *fixed; + GtkWidget *button; GtkWidget *fixed; static GSList *fixed_group = NULL; + gboolean render = TRUE; if (installer->debug) { fprintf (stdout, "Read category \"%s\"\n", category->name); @@ -712,12 +785,32 @@ eazel_installer_add_category (EazelInstaller *installer, gtk_widget_ref (button); gtk_object_set_data_full (GTK_OBJECT (installer->window), category->name, button, (GtkDestroyNotify) gtk_widget_unref); - gtk_widget_show (button); - gtk_fixed_put (GTK_FIXED (fixed), button, 72, magic); - gtk_widget_set_uposition (button, 72, magic); - gtk_widget_set_usize (button, 0, 0); - magic += 32; + if (g_list_find_custom (installer->must_have_categories, category->name, (GCompareFunc)g_strcasecmp)) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); + } else if (g_list_find_custom (installer->implicit_must_have, category->name, + (GCompareFunc)g_strcasecmp)) { + gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); + } + if (g_list_find_custom (installer->dont_show, category->name, (GCompareFunc)g_strcasecmp)) { + render = FALSE; + } + if (render) { + gtk_fixed_put (GTK_FIXED (fixed), button, 72, magic); + gtk_widget_set_uposition (button, 72, magic); + gtk_widget_set_usize (button, 0, 0); + gtk_widget_show (button); + magic += 32; + } + + /* We need to add this signal last, to avoid + activating MUST_INSTALL dependencies, + which should be handled by check_system */ + gtk_signal_connect (GTK_OBJECT (button), + "toggled", + GTK_SIGNAL_FUNC (toggle_button_toggled), + installer); } static void @@ -745,6 +838,67 @@ make_dirs () } } +static GtkWidget* +create_info_druid_page (EazelInstaller *installer, + char *title, + char *text) +{ + GtkWidget *page; + GtkWidget *druid; + GdkColor page_bg_color = { 0, 3341, 23130, 26214 }; + GdkColor page_logo_bg_color = { 0, 3341, 23130, 26214 }; + GdkColor page_title_color = { 0, 65535, 65535, 65535 }; + GtkWidget *vbox; + GtkWidget *label; + GtkWidget *canvas; + GnomeCanvasItem *text_canvas; + + page = nautilus_druid_page_eazel_new (NAUTILUS_DRUID_PAGE_EAZEL_OTHER); + nautilus_druid_page_eazel_set_title (NAUTILUS_DRUID_PAGE_EAZEL (page), title); + nautilus_druid_page_eazel_set_text (NAUTILUS_DRUID_PAGE_EAZEL (page), text); + + //set_white_stuff (GTK_WIDGET (page)); + + //gtk_widget_set_name (page, title); + gtk_widget_ref (page); + gtk_object_set_data_full (GTK_OBJECT (installer->window), title, page, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show_all (page); +/* + gnome_druid_page_standard_set_bg_color (GNOME_DRUID_PAGE_STANDARD (page), + &page_bg_color); + gnome_druid_page_standard_set_logo_bg_color (GNOME_DRUID_PAGE_STANDARD (page), + &page_logo_bg_color); + gnome_druid_page_standard_set_title_color (GNOME_DRUID_PAGE_STANDARD (page), + &page_title_color); + gnome_druid_page_standard_set_title (GNOME_DRUID_PAGE_STANDARD (page), title); + + vbox = GNOME_DRUID_PAGE_STANDARD (page)->vbox; + set_white_stuff (GTK_WIDGET (vbox)); + gtk_widget_show (vbox); + + canvas = gnome_canvas_new (); + gtk_box_pack_start (GTK_BOX (vbox), canvas, TRUE, TRUE, 0); + set_white_stuff (GTK_WIDGET (canvas)); + + text_canvas = + gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), + gnome_canvas_text_get_type (), + "text", g_strdup (text), + "justification", GTK_JUSTIFY_LEFT, + "font", "-adobe-helvetica-medium-r-normal-*-*-120-*-*-p-*-iso8859-1", + "fontset", "-adobe-helvetica-medium-r-normal-*-*-120-*-*-p-*-iso8859-1,*-r-*", + "anchor", GTK_ANCHOR_CENTER, + NULL); + gnome_canvas_item_show (text_canvas); + gtk_widget_show (GTK_WIDGET (canvas)); +*/ + gnome_druid_insert_page (installer->druid, installer->back_page, GNOME_DRUID_PAGE (page)); + installer->back_page = GNOME_DRUID_PAGE (page); + + return page; +} + void check_system (EazelInstaller *installer) { @@ -760,6 +914,7 @@ check_system (EazelInstaller *installer) g_message ("host = %s", ub.nodename); if (!installer_test && g_strncasecmp (ub.nodename, "toothgnasher", 12)==0) { GnomeDialog *d; + d = GNOME_DIALOG (gnome_warning_dialog_parented ("Eskil, din nar. Du må aldrig nogensinde\n" "udføre denne installation på din egen\n" "maskine! Den smadrer jo alt!\n" @@ -789,16 +944,16 @@ check_system (EazelInstaller *installer) exit (1); } - if (!g_file_test ("/etc/pam.d/helix-update", G_FILE_TEST_ISFILE)) { + if (installer_no_helix || !g_file_test ("/etc/pam.d/helix-update", G_FILE_TEST_ISFILE)) { GnomeDialog *d; - d = GNOME_DIALOG (gnome_warning_dialog_parented (_("You do not have HelixCode gnome installed.\n" - "This means I will install the required parts\n" - "for you, but you might want to abort the\n" - "installer and go to http://www.helixcode.com\n" - "and download the full HelixCode Gnome\n" - "installation"), - GTK_WINDOW (installer->window))); - gnome_dialog_run_and_close (d); + create_info_druid_page (installer, + "HelixCode GNOME missing...", + _("You do not have HelixCode gnome installed.\n\n" + "This means I will install the required parts for you, but you might\n" + "want to abort the installer and go to http://www.helixcode.com and\n" + "download the full HelixCode Gnome installation")); + installer->implicit_must_have = g_list_prepend (installer->implicit_must_have, + g_strdup ("HelixCode basics")); } } @@ -843,7 +998,126 @@ eazel_installer_do_install (EazelInstaller *installer, } } +static void +eazel_install_parse_dont_shows (EazelInstaller *installer, + xmlNodePtr node) +{ + xmlNodePtr child; + + child = node->childs; + g_assert (child); + while (child) { + if (g_strcasecmp (child->name, "NAME")==0) { + char *tmp = xmlNodeGetContent (child); + installer->dont_show = + g_list_prepend (installer->dont_show, + g_strdup (tmp)); + g_message ("Must not show %s", tmp); + free (tmp); + } else { + g_message ("unparsed tag %s", child->name); + } + child = child->next; + } +} +static void +eazel_install_parse_must_haves (EazelInstaller *installer, + xmlNodePtr node) +{ + xmlNodePtr child; + + child = node->childs; + g_assert (child); + while (child) { + if (g_strcasecmp (child->name, "NAME")==0) { + char *tmp = xmlNodeGetContent (child); + installer->must_have_categories = + g_list_prepend (installer->must_have_categories, + g_strdup (tmp)); + g_message ("Must install %s", tmp); + free (tmp); + } else { + g_message ("unparsed tag %s", child->name); + } + child = child->next; + } +} + +static void +eazel_install_parse_depends (EazelInstaller *installer, + xmlNodePtr node) +{ + xmlNodePtr child; + + child = node->childs; + g_assert (child); + while (child) { + if (g_strcasecmp (child->name, "DEPENDENCY")==0) { + xmlNodePtr dep = child->childs; + char *key = g_strdup (xml_get_value (child, "for")); + + g_assert (dep); + while (dep) { + char *tmp = xmlNodeGetContent (dep); + GList *deps; + g_message ("%s deps on %s", key, tmp); + deps = g_hash_table_lookup (installer->category_deps, + key); + deps = g_list_prepend (deps, g_strdup (tmp)); + g_hash_table_insert (installer->category_deps, + key, + deps); + dep = dep->next; + free (tmp); + } + } else { + g_message ("unparsed tag %s", child->name); + } + child = child->next; + } +} + +static void +eazel_installer_load_dependencies (EazelInstaller *installer, + char *depxml) +{ + xmlDocPtr doc; + xmlNodePtr base; + + g_assert (depxml); + + doc = xmlParseFile (depxml); + if (!doc) { + xmlFreeDoc (doc); + return; + } + base = doc->root; + g_assert (base); + if (g_strcasecmp (base->name, "INSTALLER_DEPENDS")==0) { + xmlNodePtr node; + + node = base->childs; + g_assert (node); + while (node) { + if (g_strcasecmp (node->name, "MUST_INSTALL")==0) { + eazel_install_parse_must_haves (installer, node); + } else if (g_strcasecmp (node->name, "DEPENDS")==0) { + eazel_install_parse_depends (installer, node); + } else if (g_strcasecmp (node->name, "DONT_SHOW")==0) { + eazel_install_parse_dont_shows (installer, node); + } else { + g_message ("unparsed tag %s", node->name); + } + node = node->next; + } + } else { + g_assert_not_reached (); + } + + xmlFreeDoc (doc); + return; +} /***************************************** GTK+ object stuff @@ -890,6 +1164,34 @@ eazel_installer_class_initialize (EazelInstallerClass *klass) } static void +eazel_install_get_depends (EazelInstaller *installer) +{ + char *url; + char *destination; + gboolean retval; + + url = g_strdup_printf ("http://%s:%d/%s", + eazel_install_get_server (installer->service), + eazel_install_get_server_port (installer->service), + CATEGORY_DEPENDS_LIST); + + destination = g_strdup (CATEGORY_DEPENDS_LIST); + + retval = eazel_install_fetch_file (installer->service, + url, + "package list", + destination); + eazel_installer_load_dependencies (installer, destination); + if (retval == FALSE) { + g_warning (_("Unable to retrieve dependency xml!\n")); + } + + g_free (destination); + g_free (url); + +} + +static void eazel_installer_initialize (EazelInstaller *object) { EazelInstaller *installer; GList *iterator; @@ -914,9 +1216,12 @@ eazel_installer_initialize (EazelInstaller *object) { installer->test = installer_test; installer->debug = installer_debug; installer->output = installer_output; + installer->category_deps = g_hash_table_new (g_str_hash, g_str_equal); + installer->must_have_categories = NULL; + installer->window = create_window (installer); - set_images (installer->window); + check_system (installer); gtk_widget_show (installer->window); @@ -973,6 +1278,10 @@ eazel_installer_initialize (EazelInstaller *object) { "install_failed", GTK_SIGNAL_FUNC (install_failed), installer); + gtk_signal_connect (GTK_OBJECT (installer->service), + "done", + GTK_SIGNAL_FUNC (install_done), + installer); if (!installer->debug) { char *log; @@ -983,6 +1292,9 @@ eazel_installer_initialize (EazelInstaller *object) { eazel_install_fetch_remote_package_list (installer->service); installer->categories = parse_local_xml_package_list (package_destination); + + eazel_install_get_depends (installer); + for (iterator = installer->categories; iterator; iterator=iterator->next) { eazel_installer_add_category (installer, (CategoryData*)iterator->data); } @@ -1028,3 +1340,4 @@ eazel_installer_new() return installer; } + diff --git a/nautilus-installer/src/installer.h b/nautilus-installer/src/installer.h index 5077df28a..7f2bb4540 100644 --- a/nautilus-installer/src/installer.h +++ b/nautilus-installer/src/installer.h @@ -49,13 +49,22 @@ struct _EazelInstaller { GtkObject parent; + GnomeDruid *druid; + GnomeDruidPage *back_page; + GnomeDruidPage *finish_good; + GnomeDruidPage *finish_evil; GtkWidget *window; + EazelInstall *service; - GList *categories; - char *failure_info; + GList *categories; GHashTable *category_deps; + GList *must_have_categories; + GList *implicit_must_have; + GList *dont_show; + + char *failure_info; gboolean debug, output; gboolean test; diff --git a/nautilus-installer/src/link.sh b/nautilus-installer/src/link.sh index 8a3432a40..a694ba853 100755 --- a/nautilus-installer/src/link.sh +++ b/nautilus-installer/src/link.sh @@ -1,5 +1,7 @@ #! /bin/bash +GNOME=/gnome + pushd `pwd` cd ../../components/services/install/lib make -f makefile.staticlib clean @@ -14,7 +16,11 @@ gcc -static -O -Werror -o nautilus-installer main.o support.o callbacks.o instal ../../components/services/trilobite/libtrilobite/helixcode-utils.o \ ../../components/services/trilobite/libtrilobite/trilobite-core-distribution.o \ ../../components/services/trilobite/libtrilobite/trilobite-core-utils.o \ --L/gnome/lib -lgnomeui -lgnome -lart_lgpl -lgdk_imlib -lgtk -lgdk -lgmodule -lglib \ +../..//libnautilus-extensions/nautilus-druid.o \ +../../libnautilus-extensions/nautilus-druid-page-eazel.o \ +-L$GNOME/lib -lgnomecanvaspixbuf -lgdk_pixbuf \ +-lgnomeui -lgnome -lart_lgpl \ +-lgtk -lgdk -lgmodule -lglib -lgdk_imlib \ -L/usr/X11R6/lib -ldl -lXext -lX11 -lm -lSM -lICE /usr/lib/libesd.a /usr/lib/libaudiofile.a -lghttp \ -L/usr/lib -lrpm -lbz2 -lz -ldb1 -lpopt -lxml diff --git a/nautilus-installer/src/main.c b/nautilus-installer/src/main.c index b4f3ced63..ea55aff98 100644 --- a/nautilus-installer/src/main.c +++ b/nautilus-installer/src/main.c @@ -35,6 +35,7 @@ extern int installer_debug; extern int installer_output; extern int installer_test; extern int installer_force; +extern int installer_no_helix; extern char *installer_server; extern int installer_server_port; extern char* installer_local; @@ -46,6 +47,7 @@ static const struct poptOption options[] = { {"force", 'f', POPT_ARG_NONE, &installer_force, 0, N_("Forced install"), NULL}, {"local", '\0', POPT_ARG_STRING, &installer_local, 0, N_("Use local, specify xml file to yse"), NULL}, {"server", '\0', POPT_ARG_STRING, &installer_server, 0, N_("Specify server"), NULL}, + {"nohelix", '\0', POPT_ARG_NONE, &installer_no_helix, 0, N_("Assume no-helix"), NULL}, {"port", '\0', POPT_ARG_INT, &installer_server_port, 0 , N_("Set port numer (80)"), NULL}, {NULL, '\0', 0, NULL, 0} }; @@ -74,3 +76,4 @@ main (int argc, char *argv[]) const gpointer oaf_popt_options = NULL; gpointer oaf_init (int argc, char *argv[]) {} int bonobo_init (gpointer a, gpointer b, gpointer c) {}; +char *nautilus_pixmap_file (const char *a) { return NULL; }; diff --git a/nautilus-installer/src/package-list-depends.xml b/nautilus-installer/src/package-list-depends.xml new file mode 100644 index 000000000..3de1e5952 --- /dev/null +++ b/nautilus-installer/src/package-list-depends.xml @@ -0,0 +1,11 @@ +<INSTALLER_DEPENDS> + <DEPENDS> + <DEPENDENCY for="Nautilus preview 1"> + <ON>HelixCode basics</ON> + </DEPENDENCY> + <DEPENDENCY for="Nautilus Mozilla support"> + <ON>Mozilla milestone 17</ON> + <ON>Nautilus preview 1</ON> + </DEPENDENCY> + </DEPENDS> +</INSTALLER_DEPENDS> diff --git a/nautilus-installer/src/prescript b/nautilus-installer/src/prescript index e8da00d86..7ed207f54 100644 --- a/nautilus-installer/src/prescript +++ b/nautilus-installer/src/prescript @@ -3,7 +3,7 @@ if test x$DISPLAY = x; then fi if test $UID -ne 0; then echo "" - echo "Nautilus-Installer v 0.2" + echo "Nautilus-Installer v 0.3" echo "" echo "Fisk er dumme og heste er grimme" echo "To mænd, gik ud i en skov, tog bukserne af, til de begge" |