File gnome-packagekit-BNC383261.patch of Package gnome-packagekit

Index: gnome-packagekit-2.27.92/src/gpk-check-update.c
===================================================================
--- gnome-packagekit-2.27.92.orig/src/gpk-check-update.c
+++ gnome-packagekit-2.27.92/src/gpk-check-update.c
@@ -1264,8 +1264,14 @@ gpk_check_update_error_code_cb (PkClient
 	}
 
 	/* not modal as we are a status icon */
-	gpk_error_dialog (gpk_error_enum_to_localised_text (code),
-			  gpk_error_enum_to_localised_message (code), details);
+	if (code == PK_ERROR_ENUM_DEP_RESOLUTION_FAILED) {
+		egg_debug ("DEP_RES failed - will ask if they want to try yast");
+		gpk_error_dialog_modal_with_time (NULL, gpk_error_enum_to_localised_text (code),
+				  gpk_error_enum_to_localised_message (code), details, 0, TRUE);
+	}
+	else
+		gpk_error_dialog (gpk_error_enum_to_localised_text (code),
+				gpk_error_enum_to_localised_message (code), details);
 out:
 	return;
 }
Index: gnome-packagekit-2.27.92/src/gpk-dbus-task.c
===================================================================
--- gnome-packagekit-2.27.92.orig/src/gpk-dbus-task.c
+++ gnome-packagekit-2.27.92/src/gpk-dbus-task.c
@@ -443,7 +443,7 @@ gpk_dbus_task_error_msg (GpkDbusTask *ta
 
 	/* hide the main window */
 	window = gpk_modal_dialog_get_window (task->priv->dialog);
-	gpk_error_dialog_modal_with_time (window, title, message, details, task->priv->timestamp);
+	gpk_error_dialog_modal_with_time (window, title, message, details, task->priv->timestamp, FALSE);
 }
 
 /**
Index: gnome-packagekit-2.27.92/src/gpk-error.c
===================================================================
--- gnome-packagekit-2.27.92.orig/src/gpk-error.c
+++ gnome-packagekit-2.27.92/src/gpk-error.c
@@ -34,6 +34,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, &error))
+		egg_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)
+		egg_debug ("Failure launching yast2 online_update");
+	return FALSE;
+}
+
+static void
+gpk_error_dialog_yast_cb (GtkButton *button, gpointer data)
+{
+	egg_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:
  **/
@@ -62,13 +88,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);
 
@@ -111,8 +139,22 @@ gpk_error_dialog_modal_with_time (GtkWin
 	gtk_label_set_label (GTK_LABEL (widget), title);
 
 	/* message */
+	if (prompt_yast) {
+		egg_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 (egg_strzero (details)) {
@@ -156,7 +198,7 @@ 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);
 }
 
 /**
Index: gnome-packagekit-2.27.92/src/gpk-error.h
===================================================================
--- gnome-packagekit-2.27.92.orig/src/gpk-error.h
+++ gnome-packagekit-2.27.92/src/gpk-error.h
@@ -37,7 +37,8 @@ gboolean	 gpk_error_dialog_modal_with_ti
 							 const gchar	*title,
 							 const gchar	*message,
 							 const gchar	*details,
-							 guint		 timestamp);
+							 guint		 timestamp,
+							 gboolean prompt_yast);
 
 G_END_DECLS
 
Index: gnome-packagekit-2.27.92/src/gpk-update-viewer.c
===================================================================
--- gnome-packagekit-2.27.92.orig/src/gpk-update-viewer.c
+++ gnome-packagekit-2.27.92/src/gpk-update-viewer.c
@@ -2159,7 +2159,13 @@ gpk_update_viewer_error_code_cb (PkClien
 	}
 
 	window = GTK_WINDOW (gtk_builder_get_object (builder, "dialog_updates"));
-	gpk_error_dialog_modal (window, gpk_error_enum_to_localised_text (code),
+	if (code == PK_ERROR_ENUM_DEP_RESOLUTION_FAILED) {
+		egg_debug ("DEP_RES failed - will ask if they want to try yast");
+		gpk_error_dialog_modal_with_time (window, gpk_error_enum_to_localised_text (code),
+				  gpk_error_enum_to_localised_message (code), details, 0, TRUE);
+	}
+	else
+		gpk_error_dialog_modal (window, gpk_error_enum_to_localised_text (code),
 				gpk_error_enum_to_localised_message (code), details);
 }
 
openSUSE Build Service is sponsored by