[gnome-packagekit] Ensure parent window is set modal when installing packages with deps using the DBus interface. Fixes



commit fa84f0045f4f30c2a957fec50a4f29e39bda32cf
Author: Richard Hughes <richard hughsie com>
Date:   Mon Feb 22 10:49:12 2010 +0000

    Ensure parent window is set modal when installing packages with deps using the DBus interface. Fixes rh#566741

 src/gpk-dbus-task.c |   11 +++++++++++
 src/gpk-task.c      |    6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/gpk-dbus-task.c b/src/gpk-dbus-task.c
index 68851f5..ad498f8 100644
--- a/src/gpk-dbus-task.c
+++ b/src/gpk-dbus-task.c
@@ -438,12 +438,17 @@ out:
 static void
 gpk_dbus_task_install_package_ids (GpkDbusTask *dtask)
 {
+	GtkWindow *window;
 	gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, GPK_MODAL_DIALOG_PACKAGE_PADDING);
 	/* TRANSLATORS: title: installing packages */
 	gpk_modal_dialog_set_title (dtask->priv->dialog, _("Installing packages"));
 	if (dtask->priv->show_progress)
 		gpk_modal_dialog_present (dtask->priv->dialog);
 
+	/* ensure parent is set */
+	window = gpk_modal_dialog_get_window (dtask->priv->dialog);
+	gpk_task_set_parent_window (GPK_TASK (dtask->priv->task), window);
+
 	/* install async */
 	pk_task_install_packages_async (dtask->priv->task, dtask->priv->package_ids, NULL,
 					(PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
@@ -2574,12 +2579,18 @@ gpk_dbus_task_install_printer_drivers (GpkDbusTask *dtask, gchar **device_ids, G
 static void
 gpk_dbus_task_remove_package_ids (GpkDbusTask *dtask)
 {
+	GtkWindow *window;
+
 	gpk_modal_dialog_setup (dtask->priv->dialog, GPK_MODAL_DIALOG_PAGE_PROGRESS, GPK_MODAL_DIALOG_PACKAGE_PADDING);
 	/* TRANSLATORS: title: removing packages */
 	gpk_modal_dialog_set_title (dtask->priv->dialog, _("Removing packages"));
 	if (dtask->priv->show_progress)
 		gpk_modal_dialog_present (dtask->priv->dialog);
 
+	/* ensure parent is set */
+	window = gpk_modal_dialog_get_window (dtask->priv->dialog);
+	gpk_task_set_parent_window (GPK_TASK (dtask->priv->task), window);
+
 	/* remove async */
 	pk_task_remove_packages_async (dtask->priv->task, dtask->priv->package_ids, TRUE, TRUE, NULL,
 					(PkProgressCallback) gpk_dbus_task_progress_cb, dtask,
diff --git a/src/gpk-task.c b/src/gpk-task.c
index 7d793b2..1fa7c66 100644
--- a/src/gpk-task.c
+++ b/src/gpk-task.c
@@ -354,7 +354,8 @@ gpk_task_media_change_question (PkTask *task, guint request, PkResults *results)
 	/* TRANSLATORS: dialog body, explains to the user that they need to insert a disk to continue. The first replacement is DVD, CD etc */
 	message = g_strdup_printf (_("Additional media is required. Please insert the %s labeled '%s' to continue."), name, media_text);
 
-	priv->current_window = GTK_WINDOW (gtk_message_dialog_new (priv->parent_window, GTK_DIALOG_DESTROY_WITH_PARENT,
+	priv->current_window = GTK_WINDOW (gtk_message_dialog_new (priv->parent_window,
+								   GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 								   /* TRANSLATORS: this is the window title when a new cd or dvd is required */
 								   GTK_MESSAGE_INFO, GTK_BUTTONS_CANCEL, _("A media change is required")));
 	gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG(priv->current_window), "%s", message);
@@ -506,7 +507,8 @@ gpk_task_simulate_question (PkTask *task, guint request, PkResults *results)
 		message = _("To process this transaction, additional software also has to be modified.");
 	}
 
-	priv->current_window = GTK_WINDOW (gtk_message_dialog_new (priv->parent_window, GTK_DIALOG_DESTROY_WITH_PARENT,
+	priv->current_window = GTK_WINDOW (gtk_message_dialog_new (priv->parent_window,
+								   GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 								   GTK_MESSAGE_INFO, GTK_BUTTONS_CANCEL, "%s", title));
 	gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (priv->current_window), "%s", message);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]