summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobey Pointer <robey@src.gnome.org>2001-02-08 07:37:06 +0000
committerRobey Pointer <robey@src.gnome.org>2001-02-08 07:37:06 +0000
commite80c31801f3f986cdfd14e5410d5a0d6bf7d0a68 (patch)
tree2008d6ac85a94b1abd5b8ffb540450ab2d014873
parent6767f2921b8965d0a34314a42be3e905f6561756 (diff)
downloadnautilus-e80c31801f3f986cdfd14e5410d5a0d6bf7d0a68.tar.gz
Do a softcat query for any suite ids in the initial package list, so
* components/services/install/lib/eazel-install-logic2.c: (expand_package_suites), (install_packages): Do a softcat query for any suite ids in the initial package list, so they're expanded first and then all future queries will return single packages. * components/services/install/lib/eazel-install-object.c: (eazel_install_emit_preflight_check): Don't restrict the preflight signal to toplevel packages anymore: we send the whole package tree now so no editing is necessary. * components/services/install/lib/eazel-install-xml-package-list.c: (osd_parse_provides), (osd_parse_shared): Softcat server has started filling in the sense flag differently (without notice, I might grumpily add), so handle both types now and whine if we can't figure out how to decode it. Log the softcat DB version now (eventually should store it somewhere). * components/services/install/lib/eazel-softcat.c: (eazel_softcat_error_string), (eazel_softcat_query), (eazel_softcat_get_info), (eazel_softcat_available_update): * components/services/install/lib/eazel-softcat.h: Split up the handling for single-package softcat queries and multi-package suite queries. * components/services/install/nautilus-view/main.c: (service_install_make_object), (main): Remove redundant 2nd ammonite_init call and a long-since useless printf from object creation. * components/services/install/nautilus-view/nautilus-service-instal l-view.c: (nautilus_service_install_downloading), (flatten_package_tree_foreach), (nautilus_service_install_done), (nautilus_service_install_failed): * components/services/install/nautilus-view/nautilus-service-instal l-view.h: Clean up final dialog text generation, and only ask about deleting RPMs if the user level is "advanced". Also don't ask if no files were even downloaded.
-rw-r--r--ChangeLog48
-rw-r--r--components/services/install-view/main.c4
-rw-r--r--components/services/install-view/nautilus-service-install-view.c48
-rw-r--r--components/services/install-view/nautilus-service-install-view.h1
-rw-r--r--components/services/install/lib/eazel-install-logic2.c31
-rw-r--r--components/services/install/lib/eazel-install-object.c13
-rw-r--r--components/services/install/lib/eazel-install-xml-package-list.c16
-rw-r--r--components/services/install/lib/eazel-softcat.c63
-rw-r--r--components/services/install/lib/eazel-softcat.h10
-rw-r--r--components/services/install/nautilus-view/main.c4
-rw-r--r--components/services/install/nautilus-view/nautilus-service-install-view.c48
-rw-r--r--components/services/install/nautilus-view/nautilus-service-install-view.h1
12 files changed, 199 insertions, 88 deletions
diff --git a/ChangeLog b/ChangeLog
index 4fb56955d..03e8ef35d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+2001-02-07 Robey Pointer <robey@eazel.com>
+
+ * components/services/install/lib/eazel-install-logic2.c:
+ (expand_package_suites), (install_packages):
+
+ Do a softcat query for any suite ids in the initial package list,
+ so they're expanded first and then all future queries will return
+ single packages.
+
+ * components/services/install/lib/eazel-install-object.c:
+ (eazel_install_emit_preflight_check):
+
+ Don't restrict the preflight signal to toplevel packages anymore:
+ we send the whole package tree now so no editing is necessary.
+
+ * components/services/install/lib/eazel-install-xml-package-list.c:
+ (osd_parse_provides), (osd_parse_shared):
+
+ Softcat server has started filling in the sense flag differently
+ (without notice, I might grumpily add), so handle both types now
+ and whine if we can't figure out how to decode it. Log the
+ softcat DB version now (eventually should store it somewhere).
+
+ * components/services/install/lib/eazel-softcat.c:
+ (eazel_softcat_error_string), (eazel_softcat_query),
+ (eazel_softcat_get_info), (eazel_softcat_available_update):
+ * components/services/install/lib/eazel-softcat.h:
+
+ Split up the handling for single-package softcat queries and
+ multi-package suite queries.
+
+ * components/services/install/nautilus-view/main.c:
+ (service_install_make_object), (main):
+
+ Remove redundant 2nd ammonite_init call and a long-since useless
+ printf from object creation.
+
+ * components/services/install/nautilus-view/nautilus-service-instal
+ l-view.c: (nautilus_service_install_downloading),
+ (flatten_package_tree_foreach), (nautilus_service_install_done),
+ (nautilus_service_install_failed):
+ * components/services/install/nautilus-view/nautilus-service-instal
+ l-view.h:
+
+ Clean up final dialog text generation, and only ask about deleting
+ RPMs if the user level is "advanced". Also don't ask if no files
+ were even downloaded.
+
2001-02-07 Ramiro Estrugo <ramiro@eazel.com>
reviewed by: Mike Fleming <mfleming@eazel.com>
diff --git a/components/services/install-view/main.c b/components/services/install-view/main.c
index aede7ef30..d1af31b3d 100644
--- a/components/services/install-view/main.c
+++ b/components/services/install-view/main.c
@@ -64,8 +64,6 @@ service_install_make_object (BonoboGenericFactory *factory,
gtk_signal_connect (GTK_OBJECT (nautilus_view), "destroy", service_install_object_destroyed, NULL);
- printf ("Returning new object %p\n", nautilus_view);
-
return BONOBO_OBJECT (nautilus_view);
}
@@ -94,8 +92,6 @@ main (int argc, char *argv[])
/* log to stderr, for now (but leave debug mode off) */
trilobite_set_log_handler (stderr, G_LOG_DOMAIN);
- ammonite_init (bonobo_poa());
-
registration_id = oaf_make_registration_id ("OAFIID:nautilus_service_install_view_factory:e59e53d1-e3d1-46fe-ae28-3ec5c56b7d32", getenv ("DISPLAY"));
factory = bonobo_generic_factory_new_multi (registration_id,
service_install_make_object,
diff --git a/components/services/install-view/nautilus-service-install-view.c b/components/services/install-view/nautilus-service-install-view.c
index 0d3887430..83be504a9 100644
--- a/components/services/install-view/nautilus-service-install-view.c
+++ b/components/services/install-view/nautilus-service-install-view.c
@@ -47,6 +47,7 @@
#include <libnautilus-extensions/nautilus-password-dialog.h>
#include <libnautilus-extensions/nautilus-stock-dialogs.h>
#include <libnautilus-extensions/nautilus-viewport.h>
+#include <libnautilus-extensions/nautilus-preferences.h>
#include <stdio.h>
#include <fcntl.h>
#include <dirent.h>
@@ -687,6 +688,7 @@ nautilus_service_install_downloading (EazelInstallCallback *cb, const PackageDat
/* install lib better damn well know the name of the package by the time we download it! */
g_assert (pack->name != NULL);
+ view->details->downloaded_anything = TRUE;
if (amount == 0) {
/* could be a redundant zero-trigger for the same rpm... */
@@ -833,7 +835,6 @@ flatten_package_tree_foreach (PackageData *package, GList **flattened_list)
*flattened_list = g_list_prepend (*flattened_list, package);
g_list_foreach (package->depends, (GFunc)flatten_package_tree_depends_foreach, flattened_list);
- g_list_foreach (package->soft_depends, (GFunc)flatten_package_tree_foreach, flattened_list);
}
}
@@ -1242,7 +1243,7 @@ nautilus_service_install_done (EazelInstallCallback *cb, gboolean success, Nauti
GtkWidget *toplevel;
GtkWidget *dialog;
char *message;
- char *real_message;
+ GString *real_message;
gboolean answer = FALSE;
gboolean question_dialog;
@@ -1283,44 +1284,51 @@ nautilus_service_install_done (EazelInstallCallback *cb, gboolean success, Nauti
NULL,
NULL);
} else {
+ real_message = g_string_new (message);
question_dialog = TRUE;
if (success && view->details->desktop_files &&
- !view->details->cancelled &&
- !view->details->already_installed) {
- real_message = g_strdup_printf (_("%s\n%s\nErase the leftover RPM files?"),
- message,
- nautilus_install_service_locate_menu_entries (view));
- } else if (view->details->cancelled_before_downloads || view->details->already_installed) {
- real_message = g_strdup (message);
+ !view->details->cancelled &&
+ !view->details->already_installed) {
+ g_string_sprintfa (real_message, "\n%s", nautilus_install_service_locate_menu_entries (view));
+ }
+ if (view->details->cancelled_before_downloads ||
+ view->details->already_installed ||
+ (nautilus_preferences_get_user_level () < NAUTILUS_USER_LEVEL_ADVANCED)) {
+ /* don't ask about erasing rpms */
question_dialog = FALSE;
- } else {
+ } else if (view->details->downloaded_anything) {
if (view->details->cancelled || view->details->failure) {
- real_message = g_strdup_printf (_("%s\nErase the RPM files?"), message);
+ g_string_sprintfa (real_message, "\n%s", _("Erase the RPM files?"));
} else {
- real_message = g_strdup_printf (_("%s\nErase the leftover RPM files?"), message);
+ g_string_sprintfa (real_message, "\n%s", _("Erase the leftover RPM files?"));
}
+ } else {
+ question_dialog = FALSE;
}
+
toplevel = gtk_widget_get_toplevel (view->details->message_box);
if (GTK_IS_WINDOW (toplevel)) {
if (question_dialog) {
- dialog = gnome_question_dialog_parented (real_message, (GnomeReplyCallback)reply_callback,
+ dialog = gnome_question_dialog_parented (real_message->str,
+ (GnomeReplyCallback)reply_callback,
&answer, GTK_WINDOW (toplevel));
} else {
- dialog = gnome_ok_dialog_parented (real_message, GTK_WINDOW (toplevel));
+ dialog = gnome_ok_dialog_parented (real_message->str, GTK_WINDOW (toplevel));
answer = FALSE;
}
} else {
if (question_dialog) {
- dialog = gnome_question_dialog (real_message, (GnomeReplyCallback)reply_callback, &answer);
+ dialog = gnome_question_dialog (real_message->str,
+ (GnomeReplyCallback)reply_callback, &answer);
} else {
- dialog = gnome_ok_dialog (real_message);
+ dialog = gnome_ok_dialog (real_message->str);
answer = FALSE;
}
}
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
- g_free (real_message);
+ g_string_free (real_message, TRUE);
if (answer) {
CORBA_exception_init (&ev);
@@ -1374,14 +1382,14 @@ nautilus_service_install_failed (EazelInstallCallback *cb, const PackageData *pa
g_assert (NAUTILUS_IS_SERVICE_INSTALL_VIEW (view));
- /* override the "success" result for install_done signal */
- view->details->failure = TRUE;
-
if (package->status == PACKAGE_ALREADY_INSTALLED) {
view->details->already_installed = TRUE;
return;
}
+ /* override the "success" result for install_done signal */
+ view->details->failure = TRUE;
+
tmp = packagedata_get_readable_name (package);
message = g_strdup_printf (_("Installation failed on %s"), tmp);
show_overall_feedback (view, message);
diff --git a/components/services/install-view/nautilus-service-install-view.h b/components/services/install-view/nautilus-service-install-view.h
index df7af9fd9..17a36f633 100644
--- a/components/services/install-view/nautilus-service-install-view.h
+++ b/components/services/install-view/nautilus-service-install-view.h
@@ -88,6 +88,7 @@ struct _NautilusServiceInstallViewDetails {
gboolean failure;
gboolean cancelled;
gboolean already_installed;
+ gboolean downloaded_anything;
int last_k; /* used to avoid flickering the KB count so much */
gboolean cancelled_before_downloads;
unsigned long download_bytes_total;
diff --git a/components/services/install/lib/eazel-install-logic2.c b/components/services/install/lib/eazel-install-logic2.c
index 0def9b947..7616e99b5 100644
--- a/components/services/install/lib/eazel-install-logic2.c
+++ b/components/services/install/lib/eazel-install-logic2.c
@@ -1667,6 +1667,36 @@ install_packages_helper (EazelInstall *service,
}
static void
+expand_package_suites (EazelInstall *service, GList **packages)
+{
+ GList *iter, *newlist, *sublist;
+ EazelSoftCatError err;
+ PackageData *pack;
+
+ newlist = NULL;
+ for (iter = g_list_first (*packages); iter != NULL; iter = g_list_next (iter)) {
+ pack = PACKAGEDATA (iter->data);
+ if (pack->suite_id != NULL) {
+ /* could be multiple packages */
+ sublist = NULL;
+ err = eazel_softcat_query (service->private->softcat, pack,
+ EAZEL_SOFTCAT_SENSE_EQ, MUST_HAVE, &sublist);
+ if (err != EAZEL_SOFTCAT_SUCCESS) {
+ g_warning ("softcat query on suite (%s) failed", pack->suite_id);
+ /* leave the package alone for now */
+ newlist = g_list_prepend (newlist, pack);
+ } else {
+ gtk_object_unref (GTK_OBJECT (pack));
+ newlist = g_list_concat (sublist, newlist);
+ }
+ } else {
+ newlist = g_list_prepend (newlist, pack);
+ }
+ }
+ *packages = newlist;
+}
+
+static void
set_toplevel (PackageData *package,
EazelInstall *service)
{
@@ -1681,6 +1711,7 @@ install_packages (EazelInstall *service, GList *categories)
GList *extra_packages = NULL;
packages = packagedata_list_copy (categorylist_flatten_to_packagelist (categories), TRUE);
+ expand_package_suites (service, &packages);
g_list_foreach (packages, (GFunc)set_toplevel, service);
do {
extra_packages = NULL;
diff --git a/components/services/install/lib/eazel-install-object.c b/components/services/install/lib/eazel-install-object.c
index 1d0a800d2..c914de236 100644
--- a/components/services/install/lib/eazel-install-object.c
+++ b/components/services/install/lib/eazel-install-object.c
@@ -1486,8 +1486,6 @@ gboolean
eazel_install_emit_preflight_check (EazelInstall *service,
GList *packages)
{
- GList *packages_in_signal = NULL;
- GList *iterator;
unsigned long size_packages, num_packages;
gboolean result;
GList *flat_packages;
@@ -1499,21 +1497,12 @@ eazel_install_emit_preflight_check (EazelInstall *service,
num_packages = g_list_length (flat_packages);
g_list_free (flat_packages);
- for (iterator = packages; iterator; glist_step (iterator)) {
- PackageData *pack = (PackageData*)iterator->data;
-
- if (eazel_install_get_ei2 (service) || pack->toplevel) {
- packages_in_signal = g_list_prepend (packages_in_signal, pack);
- }
- }
-
gtk_signal_emit (GTK_OBJECT (service),
signals[PREFLIGHT_CHECK],
- packages_in_signal,
+ packages,
size_packages,
num_packages,
&result);
- g_list_free (packages_in_signal);
return result;
}
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 b0c7e6ebf..bee39d8c8 100644
--- a/components/services/install/lib/eazel-install-xml-package-list.c
+++ b/components/services/install/lib/eazel-install-xml-package-list.c
@@ -676,7 +676,16 @@ osd_parse_provides (PackageData *pack, xmlNodePtr node, GList **feature_list)
dep = packagedependency_new ();
dep->version = trilobite_xml_get_string (child, "version");
tmp = trilobite_xml_get_string (child, "sense");
- dep->sense = eazel_softcat_convert_sense_flags (atoi (tmp));
+ if (atoi (tmp) > 0) {
+ /* old-style numeric "12" sense */
+ dep->sense = eazel_softcat_convert_sense_flags (atoi (tmp));
+ } else {
+ /* new-style symbolic ">=" sense */
+ dep->sense = eazel_softcat_string_to_sense_flags (tmp);
+ }
+ if (dep->sense == 0) {
+ g_warning ("unreadable sense %s from softcat :(", tmp);
+ }
g_free (tmp);
got_package = TRUE;
}
@@ -867,6 +876,7 @@ osd_parse_shared (xmlDocPtr doc)
{
GList *result;
xmlNodePtr base, child;
+ char *tmp;
result = NULL;
@@ -891,6 +901,10 @@ osd_parse_shared (xmlDocPtr doc)
} else {
trilobite_debug ("SOFTPKG parse failed");
}
+ } else if (g_strcasecmp (child->name, "DB_CONTROL") == 0) {
+ tmp = trilobite_xml_get_string (child, "VALUE");
+ trilobite_debug ("(softcat db revision %s)", tmp);
+ g_free (tmp);
} else {
trilobite_debug ("child is not a SOFTPKG, but a \"%s\"", child->name);
}
diff --git a/components/services/install/lib/eazel-softcat.c b/components/services/install/lib/eazel-softcat.c
index 31b5282d5..5c0630483 100644
--- a/components/services/install/lib/eazel-softcat.c
+++ b/components/services/install/lib/eazel-softcat.c
@@ -287,6 +287,8 @@ eazel_softcat_error_string (EazelSoftCatError err)
return "internal error";
case EAZEL_SOFTCAT_ERROR_SERVER_UNREACHABLE:
return "softcat server is unreachable";
+ case EAZEL_SOFTCAT_ERROR_MULTIPLE_RESPONSES:
+ return "softcat server returned multiple responses to a single-package query";
case EAZEL_SOFTCAT_ERROR_NO_SUCH_PACKAGE:
return "no such package";
}
@@ -602,10 +604,8 @@ remove_directories_from_provides_list (PackageData *pack)
}
}
-/* Given a partially filled packagedata object,
- check softcat, and fill it with the desired info */
EazelSoftCatError
-eazel_softcat_get_info (EazelSoftCat *softcat, PackageData *package, int sense_flags, int fill_flags)
+eazel_softcat_query (EazelSoftCat *softcat, PackageData *package, int sense_flags, int fill_flags, GList **result)
{
char *search_url;
char *body = NULL;
@@ -613,7 +613,6 @@ eazel_softcat_get_info (EazelSoftCat *softcat, PackageData *package, int sense_f
int tries_left;
gboolean got_happy;
GList *packages;
- PackageData *full_package;
int err;
search_url = get_search_url_for_package (softcat, package, sense_flags);
@@ -667,34 +666,44 @@ eazel_softcat_get_info (EazelSoftCat *softcat, PackageData *package, int sense_f
goto out;
}
- if (g_list_length (packages) > 1) {
- trilobite_debug ("more than one match: making a suite");
- err = EAZEL_SOFTCAT_SUCCESS;
+ trilobite_debug ("package info ok.");
+ *result = packages;
+ err = EAZEL_SOFTCAT_SUCCESS;
- /* clear out any old deps */
- if (package->soft_depends != NULL) {
- g_list_foreach (package->soft_depends, (GFunc)gtk_object_unref, NULL);
- }
- package->soft_depends = packages;
- g_free (package->filename);
- g_free (package->remote_url);
- package->filename = NULL;
- package->remote_url = NULL;
- } else {
- trilobite_debug ("package info ok.");
- err = EAZEL_SOFTCAT_SUCCESS;
+out:
+ g_free (body);
+ g_free (search_url);
+
+ return err;
+}
+
+/* Given a partially filled packagedata object,
+ check softcat, and fill it with the desired info */
+EazelSoftCatError
+eazel_softcat_get_info (EazelSoftCat *softcat, PackageData *package, int sense_flags, int fill_flags)
+{
+ GList *packages;
+ PackageData *full_package;
+ EazelSoftCatError err;
- full_package = (PackageData *) packages->data;
- packagedata_fill_in_missing (package, full_package, fill_flags);
- remove_directories_from_provides_list (package);
+ err = eazel_softcat_query (softcat, package, sense_flags, fill_flags, &packages);
+ if (err != EAZEL_SOFTCAT_SUCCESS) {
+ return err;
+ }
+
+ if (g_list_length (packages) > 1) {
+ g_warning ("softcat query returned %d results!", g_list_length (packages));
g_list_foreach (packages, (GFunc)gtk_object_unref, NULL);
g_list_free (packages);
+ err = EAZEL_SOFTCAT_ERROR_MULTIPLE_RESPONSES;
+ return err;
}
-out:
- g_free (body);
- g_free (search_url);
-
+ full_package = PACKAGEDATA (packages->data);
+ packagedata_fill_in_missing (package, full_package, fill_flags);
+ remove_directories_from_provides_list (package);
+ g_list_foreach (packages, (GFunc)gtk_object_unref, NULL);
+ g_list_free (packages);
return err;
}
@@ -722,7 +731,7 @@ eazel_softcat_available_update (EazelSoftCat *softcat, PackageData *oldpack, Pac
} else {
gtk_object_unref (GTK_OBJECT (tmp_pack));
/* Null in case it's givin */
- if (newpack!=NULL) {
+ if (newpack != NULL) {
(*newpack) = NULL;
}
}
diff --git a/components/services/install/lib/eazel-softcat.h b/components/services/install/lib/eazel-softcat.h
index 298cd47c7..d3f7789db 100644
--- a/components/services/install/lib/eazel-softcat.h
+++ b/components/services/install/lib/eazel-softcat.h
@@ -41,6 +41,7 @@ typedef enum {
EAZEL_SOFTCAT_SUCCESS = 0,
EAZEL_SOFTCAT_ERROR_BAD_MOJO,
EAZEL_SOFTCAT_ERROR_SERVER_UNREACHABLE,
+ EAZEL_SOFTCAT_ERROR_MULTIPLE_RESPONSES,
EAZEL_SOFTCAT_ERROR_NO_SUCH_PACKAGE
} EazelSoftCatError;
@@ -82,6 +83,15 @@ EazelSoftCatSense eazel_softcat_string_to_sense_flags (const char *str);
const char *eazel_softcat_error_string (EazelSoftCatError err);
+/* Query softcat about a package, and return a list of matching packages
+ * (because there may be more than one if the package refers to a suite).
+ */
+EazelSoftCatError eazel_softcat_query (EazelSoftCat *softcat,
+ PackageData *package,
+ int sense_flags,
+ int fill_flags,
+ GList **result);
+
/* Given a partially filled packagedata object,
check softcat, and fill it with the desired info */
EazelSoftCatError eazel_softcat_get_info (EazelSoftCat *softcat,
diff --git a/components/services/install/nautilus-view/main.c b/components/services/install/nautilus-view/main.c
index aede7ef30..d1af31b3d 100644
--- a/components/services/install/nautilus-view/main.c
+++ b/components/services/install/nautilus-view/main.c
@@ -64,8 +64,6 @@ service_install_make_object (BonoboGenericFactory *factory,
gtk_signal_connect (GTK_OBJECT (nautilus_view), "destroy", service_install_object_destroyed, NULL);
- printf ("Returning new object %p\n", nautilus_view);
-
return BONOBO_OBJECT (nautilus_view);
}
@@ -94,8 +92,6 @@ main (int argc, char *argv[])
/* log to stderr, for now (but leave debug mode off) */
trilobite_set_log_handler (stderr, G_LOG_DOMAIN);
- ammonite_init (bonobo_poa());
-
registration_id = oaf_make_registration_id ("OAFIID:nautilus_service_install_view_factory:e59e53d1-e3d1-46fe-ae28-3ec5c56b7d32", getenv ("DISPLAY"));
factory = bonobo_generic_factory_new_multi (registration_id,
service_install_make_object,
diff --git a/components/services/install/nautilus-view/nautilus-service-install-view.c b/components/services/install/nautilus-view/nautilus-service-install-view.c
index 0d3887430..83be504a9 100644
--- a/components/services/install/nautilus-view/nautilus-service-install-view.c
+++ b/components/services/install/nautilus-view/nautilus-service-install-view.c
@@ -47,6 +47,7 @@
#include <libnautilus-extensions/nautilus-password-dialog.h>
#include <libnautilus-extensions/nautilus-stock-dialogs.h>
#include <libnautilus-extensions/nautilus-viewport.h>
+#include <libnautilus-extensions/nautilus-preferences.h>
#include <stdio.h>
#include <fcntl.h>
#include <dirent.h>
@@ -687,6 +688,7 @@ nautilus_service_install_downloading (EazelInstallCallback *cb, const PackageDat
/* install lib better damn well know the name of the package by the time we download it! */
g_assert (pack->name != NULL);
+ view->details->downloaded_anything = TRUE;
if (amount == 0) {
/* could be a redundant zero-trigger for the same rpm... */
@@ -833,7 +835,6 @@ flatten_package_tree_foreach (PackageData *package, GList **flattened_list)
*flattened_list = g_list_prepend (*flattened_list, package);
g_list_foreach (package->depends, (GFunc)flatten_package_tree_depends_foreach, flattened_list);
- g_list_foreach (package->soft_depends, (GFunc)flatten_package_tree_foreach, flattened_list);
}
}
@@ -1242,7 +1243,7 @@ nautilus_service_install_done (EazelInstallCallback *cb, gboolean success, Nauti
GtkWidget *toplevel;
GtkWidget *dialog;
char *message;
- char *real_message;
+ GString *real_message;
gboolean answer = FALSE;
gboolean question_dialog;
@@ -1283,44 +1284,51 @@ nautilus_service_install_done (EazelInstallCallback *cb, gboolean success, Nauti
NULL,
NULL);
} else {
+ real_message = g_string_new (message);
question_dialog = TRUE;
if (success && view->details->desktop_files &&
- !view->details->cancelled &&
- !view->details->already_installed) {
- real_message = g_strdup_printf (_("%s\n%s\nErase the leftover RPM files?"),
- message,
- nautilus_install_service_locate_menu_entries (view));
- } else if (view->details->cancelled_before_downloads || view->details->already_installed) {
- real_message = g_strdup (message);
+ !view->details->cancelled &&
+ !view->details->already_installed) {
+ g_string_sprintfa (real_message, "\n%s", nautilus_install_service_locate_menu_entries (view));
+ }
+ if (view->details->cancelled_before_downloads ||
+ view->details->already_installed ||
+ (nautilus_preferences_get_user_level () < NAUTILUS_USER_LEVEL_ADVANCED)) {
+ /* don't ask about erasing rpms */
question_dialog = FALSE;
- } else {
+ } else if (view->details->downloaded_anything) {
if (view->details->cancelled || view->details->failure) {
- real_message = g_strdup_printf (_("%s\nErase the RPM files?"), message);
+ g_string_sprintfa (real_message, "\n%s", _("Erase the RPM files?"));
} else {
- real_message = g_strdup_printf (_("%s\nErase the leftover RPM files?"), message);
+ g_string_sprintfa (real_message, "\n%s", _("Erase the leftover RPM files?"));
}
+ } else {
+ question_dialog = FALSE;
}
+
toplevel = gtk_widget_get_toplevel (view->details->message_box);
if (GTK_IS_WINDOW (toplevel)) {
if (question_dialog) {
- dialog = gnome_question_dialog_parented (real_message, (GnomeReplyCallback)reply_callback,
+ dialog = gnome_question_dialog_parented (real_message->str,
+ (GnomeReplyCallback)reply_callback,
&answer, GTK_WINDOW (toplevel));
} else {
- dialog = gnome_ok_dialog_parented (real_message, GTK_WINDOW (toplevel));
+ dialog = gnome_ok_dialog_parented (real_message->str, GTK_WINDOW (toplevel));
answer = FALSE;
}
} else {
if (question_dialog) {
- dialog = gnome_question_dialog (real_message, (GnomeReplyCallback)reply_callback, &answer);
+ dialog = gnome_question_dialog (real_message->str,
+ (GnomeReplyCallback)reply_callback, &answer);
} else {
- dialog = gnome_ok_dialog (real_message);
+ dialog = gnome_ok_dialog (real_message->str);
answer = FALSE;
}
}
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
- g_free (real_message);
+ g_string_free (real_message, TRUE);
if (answer) {
CORBA_exception_init (&ev);
@@ -1374,14 +1382,14 @@ nautilus_service_install_failed (EazelInstallCallback *cb, const PackageData *pa
g_assert (NAUTILUS_IS_SERVICE_INSTALL_VIEW (view));
- /* override the "success" result for install_done signal */
- view->details->failure = TRUE;
-
if (package->status == PACKAGE_ALREADY_INSTALLED) {
view->details->already_installed = TRUE;
return;
}
+ /* override the "success" result for install_done signal */
+ view->details->failure = TRUE;
+
tmp = packagedata_get_readable_name (package);
message = g_strdup_printf (_("Installation failed on %s"), tmp);
show_overall_feedback (view, message);
diff --git a/components/services/install/nautilus-view/nautilus-service-install-view.h b/components/services/install/nautilus-view/nautilus-service-install-view.h
index df7af9fd9..17a36f633 100644
--- a/components/services/install/nautilus-view/nautilus-service-install-view.h
+++ b/components/services/install/nautilus-view/nautilus-service-install-view.h
@@ -88,6 +88,7 @@ struct _NautilusServiceInstallViewDetails {
gboolean failure;
gboolean cancelled;
gboolean already_installed;
+ gboolean downloaded_anything;
int last_k; /* used to avoid flickering the KB count so much */
gboolean cancelled_before_downloads;
unsigned long download_bytes_total;