diff --git a/src/pk-application.c b/src/pk-application.c index 528ff77..672713d 100644 --- a/src/pk-application.c +++ b/src/pk-application.c @@ -249,32 +249,40 @@ pk_application_requires_finished_cb (PkClient *client, PkExitEnum exit, guint ru gchar *title; gchar *message; gchar *package_name; - GString *text; + GString *text = NULL; PkPackageItem *item; GtkWidget *main_window; GtkWidget *dialog; guint i; - + gboolean requires = FALSE; + /* see how many packages there are */ length = pk_client_package_buffer_get_size (client); + for (i = 0; i < length; i++) { + item = pk_client_package_buffer_get_item (client, i); + + /* process only installed packages */ + if (item->info == PK_INFO_ENUM_INSTALLED) { + if (requires == FALSE) { + text = g_string_new (_("The following packages have to be removed:\n\n")); + requires = TRUE; + } + + message = pk_package_id_pretty_oneline (item->package_id, item->summary); + g_string_append_printf (text, "%s\n", message); + g_free (message); + } + } + /* if there are no required packages, just do the remove */ - if (length == 0) { + if (requires == FALSE) { pk_debug ("no requires"); pk_application_remove_only (application, FALSE); g_object_unref (client); return; } - /* present this to the user */ - text = g_string_new (_("The following packages have to be removed:\n\n")); - for (i=0; ipackage_id, item->summary); - g_string_append_printf (text, "%s\n", message); - g_free (message); - } - /* remove last \n */ g_string_set_size (text, text->len - 1);