diff options
-rw-r--r-- | ChangeLog | 33 | ||||
-rw-r--r-- | components/services/install/lib/eazel-install-problem.c | 86 | ||||
-rw-r--r-- | components/services/install/lib/eazel-install-problem.h | 4 | ||||
-rw-r--r-- | nautilus-installer/src/Makefile.am | 1 | ||||
-rw-r--r-- | nautilus-installer/src/callbacks.c | 17 | ||||
-rw-r--r-- | nautilus-installer/src/installer.c | 122 | ||||
-rw-r--r-- | nautilus-installer/src/support.c | 1 | ||||
-rw-r--r-- | nautilus-installer/src/support.h | 1 |
8 files changed, 196 insertions, 69 deletions
@@ -1,3 +1,36 @@ +2000-11-21 Robey Pointer <robey@eazel.com> + + * components/services/install/lib/eazel-install-problem.c: + (eazel_install_problem_case_to_string), + (eazel_install_problem_case_foreach_to_string), + (eazel_install_problem_case_foreach_to_package_names), + (eazel_install_problem_cases_to_package_names), + (eazel_install_problem_find_dominant_problem_type): + * components/services/install/lib/eazel-install-problem.h: + + Add hack to let us ask for only the package names of items in the + problem list (and only those that need to be uninstalled). This + lets us build up a special bullet list for the "update not found" + installer panel. + + * nautilus-installer/src/callbacks.c: (begin_install), + (prep_retry): + * nautilus-installer/src/installer.c: (remove_problems_timer), + (jump_to_retry_page), (toggle_button_lock), + (toggle_button_toggled), (eazel_installer_set_default_texts): + + Fix up the "update not found" panel to match a reasonable UI, and + fix some bugs that caused it to go straight into another + (extremely confusing) panel that suggested you ignore "all + problems" and then listed no problems. + + * nautilus-installer/src/Makefile.am: + * nautilus-installer/src/support.c: + * nautilus-installer/src/support.h: + + Remove the unused support.c from the Makefile, and mark the files + as unused so that a more adventurous soul can cvs remove them soon. + 2000-11-21 Rebecca Schulman <rebecka@eazel.com> reviewed by: Pavel Cisler <pavel@eazel.com> diff --git a/components/services/install/lib/eazel-install-problem.c b/components/services/install/lib/eazel-install-problem.c index 84f9dcda9..97e8dc290 100644 --- a/components/services/install/lib/eazel-install-problem.c +++ b/components/services/install/lib/eazel-install-problem.c @@ -714,7 +714,7 @@ get_detailed_uninstall_cases_foreach (PackageData *pack, GetErrorsForEachData *d } static char* -eazel_install_problem_case_to_string (EazelInstallProblemCase *pcase) +eazel_install_problem_case_to_string (EazelInstallProblemCase *pcase, gboolean name_only) { char *message = NULL; switch (pcase->problem) { @@ -722,7 +722,9 @@ eazel_install_problem_case_to_string (EazelInstallProblemCase *pcase) char *required = packagedata_get_readable_name (pcase->u.update.pack); /* TRANSLATORS : This string is a solution to a dependency problem, %s is a package name or filename */ - message = g_strdup_printf (_("Update %s"), required); + if (! name_only) { + message = g_strdup_printf (_("Check for a new version of %s"), required); + } g_free (required); } break; @@ -731,9 +733,11 @@ eazel_install_problem_case_to_string (EazelInstallProblemCase *pcase) char *required_2 = packagedata_get_readable_name (pcase->u.force_install_both.pack_2); /* TRANSLATORS : This string is a solution to a dependency problem, both %s's are package names or filenames */ - message = g_strdup_printf (_("Install both %s and %s"), - required_1, - required_2); + if (! name_only) { + message = g_strdup_printf (_("Install both %s and %s"), + required_1, + required_2); + } g_free (required_1); g_free (required_2); } @@ -742,8 +746,12 @@ eazel_install_problem_case_to_string (EazelInstallProblemCase *pcase) char *required = packagedata_get_readable_name (pcase->u.remove.pack); /* TRANSLATORS : This string is a solution to a dependency problem, %s is a package name or filename */ - message = g_strdup_printf (_("Remove %s"), required); - g_free (required); + if (name_only) { + message = required; + } else { + message = g_strdup_printf (_("Remove %s from your system"), required); + g_free (required); + } } break; case EI_PROBLEM_FORCE_REMOVE: { @@ -751,28 +759,41 @@ eazel_install_problem_case_to_string (EazelInstallProblemCase *pcase) /* TRANSLATORS : This string is a solution to a dependency problem, %s is a package name or filename. "Force" is in the rpm sense of force, meaning that no dependency checking etc will be done */ - message = g_strdup_printf (_("Force remove %s"), required); - g_free (required); + if (name_only) { + message = required; + } else { + message = g_strdup_printf (_("Force the removal of %s from your system"), required); + g_free (required); + } } break; case EI_PROBLEM_INCONSISTENCY: { /* TRANSLATORS : This string is a solution to a dependency problem */ - message = g_strdup (_("Package database has an inconsistency")); + if (! name_only) { + message = g_strdup (_("Package database has an inconsistency")); + } } break; case EI_PROBLEM_BASE: g_warning ("%s:%d: should not be reached", __FILE__, __LINE__); break; case EI_PROBLEM_CANNOT_SOLVE: { - char *tmp = eazel_install_problem_case_to_string (pcase->u.cannot_solve.problem); - message = g_strdup_printf ("I could not solve \"%s\"", tmp); + char *tmp = eazel_install_problem_case_to_string (pcase->u.cannot_solve.problem, name_only); + if (! name_only) { + message = g_strdup_printf ("I could not solve \"%s\"", tmp); + } g_free (tmp); } break; case EI_PROBLEM_CASCADE_REMOVE: { GList *iterator; - GString *str = g_string_new ("Remove "); - + GString *str; + + if (name_only) { + str = g_string_new (""); + } else { + str = g_string_new ("Remove these packages: "); + } iterator = pcase->u.cascade.packages; while (iterator) { PackageData *pack = (PackageData*)iterator->data; @@ -796,10 +817,12 @@ eazel_install_problem_case_to_string (EazelInstallProblemCase *pcase) case EI_PROBLEM_CONTINUE_WITH_FORCE: { /* FIXME needs better string */ - if (pcase->file_conflict) { - message = g_strdup_printf ("Complete operation by ignoring file conflicts"); - } else { - message = g_strdup_printf ("Complete operation by ignoring problems"); + if (! name_only) { + if (pcase->file_conflict) { + message = g_strdup_printf ("Complete operation by ignoring file conflicts"); + } else { + message = g_strdup_printf ("Complete operation by ignoring problems"); + } } } break; @@ -811,7 +834,18 @@ static void eazel_install_problem_case_foreach_to_string (EazelInstallProblemCase *pcase, GList **output) { - char *message = eazel_install_problem_case_to_string (pcase); + char *message = eazel_install_problem_case_to_string (pcase, FALSE); + if (message) { + (*output) = g_list_prepend (*output, + message); + } +} + +static void +eazel_install_problem_case_foreach_to_package_names (EazelInstallProblemCase *pcase, + GList **output) +{ + char *message = eazel_install_problem_case_to_string (pcase, TRUE); if (message) { (*output) = g_list_prepend (*output, message); @@ -1082,6 +1116,18 @@ eazel_install_problem_cases_to_string (EazelInstallProblem *problem, return result; } +/* Like above, but only returns the package names, and only for packages that are about to be removed */ +GList * +eazel_install_problem_cases_to_package_names (EazelInstallProblem *problem, + GList *cases) +{ + GList *result = NULL; + g_list_foreach (cases, + (GFunc)eazel_install_problem_case_foreach_to_package_names, + &result); + return result; +} + EazelInstallProblemEnum eazel_install_problem_find_dominant_problem_type (EazelInstallProblem *problem, GList *problems) @@ -1095,7 +1141,7 @@ eazel_install_problem_find_dominant_problem_type (EazelInstallProblem *problem, dominant = pcase->problem; #ifdef EIP_DEBUG { - char *message = eazel_install_problem_case_to_string (pcase); + char *message = eazel_install_problem_case_to_string (pcase, FALSE); g_message ("dominant problem is now %d", dominant); g_message ("aka %s", message); g_free (message); diff --git a/components/services/install/lib/eazel-install-problem.h b/components/services/install/lib/eazel-install-problem.h index aac812f85..4b079a13c 100644 --- a/components/services/install/lib/eazel-install-problem.h +++ b/components/services/install/lib/eazel-install-problem.h @@ -167,6 +167,10 @@ GList * eazel_install_problem_tree_to_string (EazelInstallProblem *problem, GList * eazel_install_problem_cases_to_string (EazelInstallProblem *problem, GList *cases); +/* Like above, but only returns the package names, and only for packages that are about to be removed */ +GList * eazel_install_problem_cases_to_package_names (EazelInstallProblem *problem, + GList *cases); + /* This lets you know which type of problems the next call to eazel_install_handle_cases will handle. So if eg. the next type is EI_PROBLEM_FORCE_REMOVE, you can alert the user */ diff --git a/nautilus-installer/src/Makefile.am b/nautilus-installer/src/Makefile.am index fc256239d..3e9609b31 100644 --- a/nautilus-installer/src/Makefile.am +++ b/nautilus-installer/src/Makefile.am @@ -22,7 +22,6 @@ bin_PROGRAMS = eazel-installer eazel_installer_SOURCES = \ main.c \ - support.c support.h \ callbacks.c callbacks.h \ proxy.c proxy.h \ installer.c installer.h diff --git a/nautilus-installer/src/callbacks.c b/nautilus-installer/src/callbacks.c index 6348fd015..a6a754b70 100644 --- a/nautilus-installer/src/callbacks.c +++ b/nautilus-installer/src/callbacks.c @@ -55,7 +55,7 @@ begin_install (EazelInstaller *installer) druid = GNOME_DRUID (gtk_object_get_data (GTK_OBJECT (window), "druid")); - gnome_druid_set_buttons_sensitive(druid,FALSE,FALSE,TRUE); + gnome_druid_set_buttons_sensitive(druid, FALSE, FALSE, TRUE); /* First time ? If so, check which categories were marked */ if (installer->install_categories == NULL) { @@ -89,13 +89,14 @@ begin_install (EazelInstaller *installer) NULL); eazel_installer_post_install (installer); /* return TRUE; */ - } else - if (installer->successful && installer->install_categories) { - eazel_installer_do_install (installer, installer->install_categories, FALSE); - eazel_installer_post_install (installer); - } + } else { + if (installer->successful && installer->install_categories) { + eazel_installer_do_install (installer, installer->install_categories, FALSE); + eazel_installer_post_install (installer); + } - gnome_druid_set_buttons_sensitive(druid, FALSE, TRUE, TRUE); + gnome_druid_set_buttons_sensitive(druid, FALSE, TRUE, TRUE); + } /* FALSE means remove this source */ return FALSE; @@ -142,5 +143,5 @@ prep_retry (GnomeDruidPage *gnomedruidpage, GtkWidget *druid, EazelInstaller *installer) { - gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid), FALSE, TRUE, TRUE); + gnome_druid_set_buttons_sensitive (GNOME_DRUID (druid), FALSE, installer->uninstalling ? FALSE : TRUE, TRUE); } diff --git a/nautilus-installer/src/installer.c b/nautilus-installer/src/installer.c index 661cc1259..227efc8f2 100644 --- a/nautilus-installer/src/installer.c +++ b/nautilus-installer/src/installer.c @@ -113,11 +113,6 @@ typedef struct { "are items involved that might be important to you, we thought we'd\n" \ "check first.") #define D_RETRY_TITLE _("Just so you know...") -#define D_EVIL_RETRY_LABEL _("A serious problem has been encountered, but we think we can\n" \ - "fix it. We would like to try the following actions, but since it might\n" \ - "have undesireable side effects, you might want to skip to an install\n" \ - "where file conflicts are ignored. If not, just press next...") -#define D_EVIL_RETRY_TITLE _("Serious problem encountered....") #define D_SPLASH_TITLE _("Welcome to the Eazel Installer!") #define D_FINISHED_TITLE _("Congratulations!") @@ -144,6 +139,15 @@ typedef struct { #define D_ERROR_RED_HAT_7_NOT_SUPPORTED _("Sorry, but this preview installer won't work for Red Hat\n" \ "Linux 7.x systems.") +#define D_EVIL_RETRY_TITLE _("Update not found") +#define D_EVIL_RETRY_LABEL _("There doesn't appear to be a new version of any of the following\n" \ + "packages. Your current versions may still work, but if you would\n" \ + "like us to remove these packages for you, we can.") +#define D_EVIL_RETRY_LABEL_S _("There doesn't appear to be a new version of this package. Your\n" \ + "current version may still work, but if you like us to remove this\n" \ + "package for you, we can.") + + #define NAUTILUS_INSTALLER_RELEASE enum { @@ -165,6 +169,7 @@ enum { WHAT_TO_INSTALL_LABEL_SINGLE, RETRY_LABEL, EVIL_RETRY_LABEL, + EVIL_RETRY_LABEL_S, ERROR_TITLE, RETRY_TITLE, @@ -745,6 +750,13 @@ skip_over_remove_problems (GtkWidget *widget, jump_to_retry_page (installer); } +static gboolean +remove_problems_timer (EazelInstaller *installer) +{ + skip_over_remove_problems (NULL, installer); + return FALSE; +} + /* give the user an opportunity to retry the install, with new info */ static void jump_to_retry_page (EazelInstaller *installer) @@ -759,6 +771,7 @@ jump_to_retry_page (EazelInstaller *installer) GList *iter; GList *problems_as_strings; EazelInstallProblemEnum p; + int problem_count; g_message ("jump_to_retry_page"); @@ -778,17 +791,14 @@ jump_to_retry_page (EazelInstaller *installer) gtk_widget_show (vbox); nautilus_druid_page_eazel_put_widget (NAUTILUS_DRUID_PAGE_EAZEL (retry_page), vbox); - switch (p) { - case EI_PROBLEM_REMOVE: - case EI_PROBLEM_FORCE_REMOVE: - case EI_PROBLEM_CASCADE_REMOVE: + if ((p == EI_PROBLEM_REMOVE) || + (p == EI_PROBLEM_FORCE_REMOVE) || + (p == EI_PROBLEM_CASCADE_REMOVE)) { title = gtk_label_new_with_font (text_labels [EVIL_RETRY_TITLE], FONT_TITLE); installer->uninstalling = TRUE; - break; - default: + } else { title = gtk_label_new_with_font (text_labels [RETRY_TITLE], FONT_TITLE); installer->uninstalling = FALSE; - break; } gtk_label_set_justify (GTK_LABEL (title), GTK_JUSTIFY_LEFT); @@ -803,15 +813,20 @@ jump_to_retry_page (EazelInstaller *installer) add_padding_to_box (vbox, 0, 20); - switch (p) { - case EI_PROBLEM_REMOVE: - case EI_PROBLEM_FORCE_REMOVE: - case EI_PROBLEM_CASCADE_REMOVE: - label = gtk_label_new (text_labels [EVIL_RETRY_LABEL]); - break; - default: + if (installer->uninstalling) { + problems_as_strings = eazel_install_problem_cases_to_package_names (installer->problem, + installer->problems); + problem_count = g_list_length (problems_as_strings); + if (problem_count == 1) { + label = gtk_label_new (text_labels [EVIL_RETRY_LABEL_S]); + } else { + label = gtk_label_new (text_labels [EVIL_RETRY_LABEL]); + } + } else { + problems_as_strings = eazel_install_problem_cases_to_string (installer->problem, + installer->problems); + problem_count = g_list_length (problems_as_strings); label = gtk_label_new (text_labels [RETRY_LABEL]); - break; } gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); @@ -824,8 +839,6 @@ jump_to_retry_page (EazelInstaller *installer) add_padding_to_box (vbox, 0, 15); - problems_as_strings = eazel_install_problem_cases_to_string (installer->problem, - installer->problems); for (iter = problems_as_strings; iter != NULL; iter = g_list_next (iter)) { add_bullet_point_to_vbox (vbox, (char*)(iter->data)); g_free (iter->data); @@ -861,44 +874,72 @@ jump_to_retry_page (EazelInstaller *installer) add_padding_to_box (vbox, 0, 15); - switch (p) { - case EI_PROBLEM_REMOVE: - case EI_PROBLEM_FORCE_REMOVE: - case EI_PROBLEM_CASCADE_REMOVE: + if (installer->uninstalling) { g_message ("ranglebær"); hbox = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox); - button = gtk_button_new_with_label ("Ignore file conflicts"); - gtk_widget_set_name (button, "ignore_conflicts_button"); + label = gtk_label_new (""); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); + + if (problem_count == 1) { + button = gtk_button_new_with_label (_("Remove this package")); + } else { + button = gtk_button_new_with_label (_("Remove these packages")); + } + gtk_widget_set_name (button, "remove_button"); + gtk_signal_connect (GTK_OBJECT (button), "clicked", + GTK_SIGNAL_FUNC (start_over_callback), + installer); + gtk_widget_show (button); + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); + + add_padding_to_box (hbox, 10, 0); + + if (problem_count == 1) { + button = gtk_button_new_with_label (_("Keep this package")); + } else { + button = gtk_button_new_with_label (_("Keep these packages")); + } + gtk_widget_set_name (button, "ignore_button"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (skip_over_remove_problems), installer); gtk_widget_show (button); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); + add_padding_to_box (hbox, 90, 0); + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); - break; - default: - break; - } + } gtk_signal_connect (GTK_OBJECT (retry_page), "prepare", GTK_SIGNAL_FUNC (prep_retry), installer); - gtk_signal_connect (GTK_OBJECT (retry_page), "next", - GTK_SIGNAL_FUNC (start_over_callback), - installer); + if (! installer->uninstalling) { + gtk_signal_connect (GTK_OBJECT (retry_page), "next", + GTK_SIGNAL_FUNC (start_over_callback), + installer); + } gtk_signal_connect (GTK_OBJECT (retry_page), "cancel", GTK_SIGNAL_FUNC (dont_start_over_callback), installer); gnome_druid_set_page (installer->druid, GNOME_DRUID_PAGE (retry_page)); - /* user may want to not be bothered */ - if (installer_dont_ask_questions) { + /* user may want to not be bothered -- + * or, we may have just asked them a question and they answered that they wanted to ignore, so we should + * respect their wishes. UTTER HACK! i will kill this madness in the new xml scheme. + */ + if (installer_dont_ask_questions || (problem_count == 1 && p == EI_PROBLEM_CONTINUE_WITH_FORCE)) { log_debug ("skipping the question page; moving to the next round"); - gtk_timeout_add (0, (GtkFunction)start_over_timer, installer); + if (installer->uninstalling) { + /* assume they want to ignore conflicts */ + gtk_timeout_add (0, (GtkFunction)remove_problems_timer, installer); + } else { + gtk_timeout_add (0, (GtkFunction)start_over_timer, installer); + } } } @@ -1432,7 +1473,7 @@ toggle_button_lock (EazelInstaller *installer, char *name, gboolean lock) GtkWidget *label; char *temp; - button = lookup_widget (installer->window, name); + button = gtk_object_get_data (GTK_OBJECT (installer->window), name); temp = g_strdup_printf ("%s/label", gtk_widget_get_name (GTK_WIDGET (button))); label = gtk_object_get_data (GTK_OBJECT (installer->window), name); g_free (temp); @@ -1473,7 +1514,7 @@ toggle_button_toggled (GtkToggleButton *button, if (category->exclusive && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) { for (iterator = installer->categories; iterator; iterator = iterator->next) { category2 = (CategoryData *)(iterator->data); - other_button = lookup_widget (installer->window, category2->name); + other_button = gtk_object_get_data (GTK_OBJECT (installer->window), category2->name); if (other_button && (category != category2)) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (other_button), FALSE); } @@ -1918,6 +1959,7 @@ eazel_installer_set_default_texts (EazelInstaller *installer) text_labels [WHAT_TO_INSTALL_LABEL_SINGLE] = g_strdup (D_WHAT_TO_INSTALL_LABEL_SINGLE); text_labels [RETRY_LABEL] = g_strdup (D_RETRY_LABEL); text_labels [EVIL_RETRY_LABEL] = g_strdup (D_EVIL_RETRY_LABEL); + text_labels [EVIL_RETRY_LABEL_S] = g_strdup (D_EVIL_RETRY_LABEL_S); text_labels [INFO_EAZEL_HACKING_TEXT] = g_strdup (D_INFO_EAZEL_HACKING_TEXT); text_labels [INFO_EAZEL_HACKING_TITLE] = g_strdup (D_INFO_EAZEL_HACKING_TITLE); } diff --git a/nautilus-installer/src/support.c b/nautilus-installer/src/support.c index fcf404ae1..ee7d2a951 100644 --- a/nautilus-installer/src/support.c +++ b/nautilus-installer/src/support.c @@ -1,5 +1,6 @@ /* * DO NOT EDIT THIS FILE - it is generated by Glade. + * NOTHING USES THIS FILE ANYMORE. */ #ifdef HAVE_CONFIG_H diff --git a/nautilus-installer/src/support.h b/nautilus-installer/src/support.h index 34652b068..16d7b6765 100644 --- a/nautilus-installer/src/support.h +++ b/nautilus-installer/src/support.h @@ -1,5 +1,6 @@ /* * DO NOT EDIT THIS FILE - it is generated by Glade. + * NOTHING USES THIS FILE ANYMORE. */ #include <gnome.h> |