gnome-settings-daemon/gnome-packagekit-BNC383261.patch

190 lines
8.5 KiB
Diff

Index: gnome-packagekit-2.91.4/src/gpk-check-update.c
===================================================================
--- gnome-packagekit-2.91.4.orig/src/gpk-check-update.c
+++ gnome-packagekit-2.91.4/src/gpk-check-update.c
@@ -453,6 +453,11 @@ gpk_check_update_show_error (GpkCheckUpd
g_object_unref (cupdate->priv->error_code);
cupdate->priv->error_code = g_object_ref (error_code);
+ if (error_enum == PK_ERROR_ENUM_DEP_RESOLUTION_FAILED) {
+ gpk_error_dialog_modal_yast (NULL, title, message, pk_error_get_details (error_code));
+ goto out;
+ }
+
/* do the bubble */
g_debug ("title=%s, message=%s", title, message);
notification = notify_notification_new (title, message, NULL);
Index: gnome-packagekit-2.91.4/src/gpk-dbus-task.c
===================================================================
--- gnome-packagekit-2.91.4.orig/src/gpk-dbus-task.c
+++ gnome-packagekit-2.91.4/src/gpk-dbus-task.c
@@ -336,7 +336,7 @@ gpk_dbus_task_error_msg (GpkDbusTask *dt
/* hide the main window */
window = gpk_modal_dialog_get_window (dtask->priv->dialog);
- gpk_error_dialog_modal_with_time (window, title, message, details, dtask->priv->timestamp);
+ gpk_error_dialog_modal_with_time (window, title, message, details, dtask->priv->timestamp, FALSE);
}
/**
Index: gnome-packagekit-2.91.4/src/gpk-error.c
===================================================================
--- gnome-packagekit-2.91.4.orig/src/gpk-error.c
+++ gnome-packagekit-2.91.4/src/gpk-error.c
@@ -31,6 +31,32 @@
#include "gpk-common.h"
#include "gpk-error.h"
+static gboolean
+gpk_error_dialog_run_yast (gpointer unused)
+{
+ gboolean retval;
+ GError *error = NULL;
+
+ PkControl *control = pk_control_new ();
+ if (!pk_control_suggest_daemon_quit(control, NULL, &error))
+ g_debug ("Failure calling pk_control_suggest_daemon_quit:%s", error->message);
+ g_object_unref (control);
+
+ retval = g_spawn_command_line_async ("gnomesu -- /sbin/yast2 online_update", NULL);
+ if (!retval)
+ g_debug ("Failure launching yast2 online_update");
+ return FALSE;
+}
+
+static void
+gpk_error_dialog_yast_cb (GtkButton *button, gpointer data)
+{
+ g_debug ("user wants to try YaST...");
+ /* we want to make sure and finish up outstanding stuff before we launch yast so we can release the libzypp lock */
+ g_timeout_add_seconds (2, gpk_error_dialog_run_yast, NULL);
+ gtk_main_quit ();
+}
+
/**
* gpk_error_dialog_expanded_cb:
**/
@@ -59,13 +85,15 @@ gpk_error_dialog_expanded_cb (GObject *o
* Shows a modal error, and blocks until the user clicks close
**/
gboolean
-gpk_error_dialog_modal_with_time (GtkWindow *window, const gchar *title, const gchar *message, const gchar *details, guint timestamp)
+gpk_error_dialog_modal_with_time (GtkWindow *window, const gchar *title, const gchar *message, const gchar *details, guint timestamp, gboolean prompt_yast)
{
GtkWidget *widget;
+ GtkWidget *button;
GtkBuilder *builder;
GtkTextBuffer *buffer = NULL;
guint retval;
GError *error = NULL;
+ gchar *full_message;
g_return_val_if_fail (message != NULL, FALSE);
@@ -108,8 +136,22 @@ gpk_error_dialog_modal_with_time (GtkWin
gtk_label_set_label (GTK_LABEL (widget), title);
/* message */
+ if (prompt_yast) {
+ g_debug ("DEP_RES failed - will ask if they want to try yast");
+ full_message = g_strconcat (message, "\n\n", _("To try and manually resolve problems use the YaST \"Online Update\" module"), NULL);
+ button = gtk_button_new_with_label(_("Start YaST and install updates manually"));
+ g_signal_connect (button, "clicked", G_CALLBACK (gpk_error_dialog_yast_cb), NULL);
+ /* add to box */
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_error"));
+ widget = gtk_dialog_get_action_area (GTK_DIALOG(widget));
+ gtk_box_pack_start (GTK_BOX (widget), button, TRUE, TRUE, 0);
+ gtk_widget_show (button);
+ }
+ else
+ full_message = g_strdup (message);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_message"));
- gtk_label_set_markup (GTK_LABEL (widget), message);
+ gtk_label_set_markup (GTK_LABEL (widget), full_message);
+ g_free (full_message);
/* show text in the expander */
if (details == NULL || details[0] == '\0') {
@@ -153,7 +195,13 @@ out_build:
gboolean
gpk_error_dialog_modal (GtkWindow *window, const gchar *title, const gchar *message, const gchar *details)
{
- return gpk_error_dialog_modal_with_time (window, title, message, details, 0);
+ return gpk_error_dialog_modal_with_time (window, title, message, details, 0, FALSE);
+}
+
+gboolean
+gpk_error_dialog_modal_yast (GtkWindow *window, const gchar *title, const gchar *message, const gchar *details)
+{
+ return gpk_error_dialog_modal_with_time (window, title, message, details, 0, TRUE);
}
/**
Index: gnome-packagekit-2.91.4/src/gpk-error.h
===================================================================
--- gnome-packagekit-2.91.4.orig/src/gpk-error.h
+++ gnome-packagekit-2.91.4/src/gpk-error.h
@@ -37,7 +37,12 @@ gboolean gpk_error_dialog_modal_with_ti
const gchar *title,
const gchar *message,
const gchar *details,
- guint timestamp);
+ guint timestamp,
+ gboolean prompt_yast);
+gboolean gpk_error_dialog_modal_yast (GtkWindow *window,
+ const gchar *title,
+ const gchar *message,
+ const gchar *details);
G_END_DECLS
Index: gnome-packagekit-2.91.4/src/gpk-update-viewer.c
===================================================================
--- gnome-packagekit-2.91.4.orig/src/gpk-update-viewer.c
+++ gnome-packagekit-2.91.4/src/gpk-update-viewer.c
@@ -461,8 +461,12 @@ gpk_update_viewer_update_packages_cb (Pk
CA_PROP_EVENT_DESCRIPTION, _("Failed to update"), NULL);
window = GTK_WINDOW(gtk_builder_get_object (builder, "dialog_updates"));
- gpk_error_dialog_modal (window, gpk_error_enum_to_localised_text (pk_error_get_code (error_code)),
- gpk_error_enum_to_localised_message (pk_error_get_code (error_code)), pk_error_get_details (error_code));
+ if (pk_error_get_code (error_code) == PK_ERROR_ENUM_DEP_RESOLUTION_FAILED) {
+ gpk_error_dialog_modal_yast (window, gpk_error_enum_to_localised_text (pk_error_get_code (error_code)),
+ gpk_error_enum_to_localised_message (pk_error_get_code (error_code)), pk_error_get_details (error_code));
+ } else
+ gpk_error_dialog_modal (window, gpk_error_enum_to_localised_text (pk_error_get_code (error_code)),
+ gpk_error_enum_to_localised_message (pk_error_get_code (error_code)), pk_error_get_details (error_code));
/* re-enable the package list */
gpk_update_viewer_packages_set_sensitive (TRUE);
@@ -2108,8 +2112,12 @@ gpk_update_viewer_get_details_cb (PkClie
g_warning ("failed to get details: %s, %s", pk_error_enum_to_text (pk_error_get_code (error_code)), pk_error_get_details (error_code));
window = GTK_WINDOW(gtk_builder_get_object (builder, "dialog_updates"));
- gpk_error_dialog_modal (window, gpk_error_enum_to_localised_text (pk_error_get_code (error_code)),
- gpk_error_enum_to_localised_message (pk_error_get_code (error_code)), pk_error_get_details (error_code));
+ if (pk_error_get_code (error_code) == PK_ERROR_ENUM_DEP_RESOLUTION_FAILED) {
+ gpk_error_dialog_modal_yast (window, gpk_error_enum_to_localised_text (pk_error_get_code (error_code)),
+ gpk_error_enum_to_localised_message (pk_error_get_code (error_code)), pk_error_get_details (error_code));
+ } else
+ gpk_error_dialog_modal (window, gpk_error_enum_to_localised_text (pk_error_get_code (error_code)),
+ gpk_error_enum_to_localised_message (pk_error_get_code (error_code)), pk_error_get_details (error_code));
goto out;
}
@@ -3020,8 +3028,12 @@ gpk_update_viewer_get_distro_upgrades_cb
g_warning ("failed to get list of distro upgrades: %s, %s", pk_error_enum_to_text (pk_error_get_code (error_code)), pk_error_get_details (error_code));
window = GTK_WINDOW(gtk_builder_get_object (builder, "dialog_updates"));
- gpk_error_dialog_modal (window, gpk_error_enum_to_localised_text (pk_error_get_code (error_code)),
- gpk_error_enum_to_localised_message (pk_error_get_code (error_code)), pk_error_get_details (error_code));
+ if (pk_error_get_code (error_code) == PK_ERROR_ENUM_DEP_RESOLUTION_FAILED) {
+ gpk_error_dialog_modal_yast (window, gpk_error_enum_to_localised_text (pk_error_get_code (error_code)),
+ gpk_error_enum_to_localised_message (pk_error_get_code (error_code)), pk_error_get_details (error_code));
+ } else
+ gpk_error_dialog_modal (window, gpk_error_enum_to_localised_text (pk_error_get_code (error_code)),
+ gpk_error_enum_to_localised_message (pk_error_get_code (error_code)), pk_error_get_details (error_code));
goto out;
}