[gnome-packagekit: 2/3] Automatically remove unused dependencies when removing packages



commit c4edc63e7af9d610f39b0ccedd6135b1ba510da7
Author: Jonathan Conder <j skurvy no-ip org>
Date:   Tue Mar 23 15:51:46 2010 +0000

    Automatically remove unused dependencies when removing packages
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 data/gnome-packagekit.schemas.in |   12 ++++++++++++
 src/gpk-application.c            |    7 +++++--
 src/gpk-common.h                 |    1 +
 3 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/data/gnome-packagekit.schemas.in b/data/gnome-packagekit.schemas.in
index 3c475bb..9205cef 100644
--- a/data/gnome-packagekit.schemas.in
+++ b/data/gnome-packagekit.schemas.in
@@ -62,6 +62,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/gnome-packagekit/enable_autoremove</key>
+      <applyto>/apps/gnome-packagekit/enable_autoremove</applyto>
+      <owner>gnome-packagekit</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Automatically remove unused dependencies</short>
+        <long>When removing a package, also remove those dependencies that are not required by other packages</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/gnome-packagekit/show_depends</key>
       <applyto>/apps/gnome-packagekit/show_depends</applyto>
       <owner>gnome-packagekit</owner>
diff --git a/src/gpk-application.c b/src/gpk-application.c
index 838ac6a..cb74820 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -2115,6 +2115,7 @@ static void
 gpk_application_button_apply_cb (GtkWidget *widget, GpkApplication *application)
 {
 	gchar **package_ids = NULL;
+	gboolean autoremove;
 
 	g_return_if_fail (GPK_IS_APPLICATION (application));
 
@@ -2132,8 +2133,10 @@ gpk_application_button_apply_cb (GtkWidget *widget, GpkApplication *application)
 
 	} else if (application->priv->action == PK_ACTION_REMOVE) {
 
-		/* install */
-		pk_task_remove_packages_async (application->priv->task, package_ids, TRUE, FALSE, application->priv->cancellable,
+		autoremove = gconf_client_get_bool (application->priv->gconf_client, GPK_CONF_ENABLE_AUTOREMOVE, NULL);
+
+		/* remove */
+		pk_task_remove_packages_async (application->priv->task, package_ids, TRUE, autoremove, application->priv->cancellable,
 					       (PkProgressCallback) gpk_application_progress_cb, application,
 					       (GAsyncReadyCallback) gpk_application_remove_packages_cb, application);
 
diff --git a/src/gpk-common.h b/src/gpk-common.h
index 58c0f1e..ff0b794 100644
--- a/src/gpk-common.h
+++ b/src/gpk-common.h
@@ -37,6 +37,7 @@ G_BEGIN_DECLS
 #define GPK_CONF_SHOW_COPY_CONFIRM		"/apps/gnome-packagekit/show_copy_confirm"
 #define GPK_CONF_DBUS_DEFAULT_INTERACTION	"/apps/gnome-packagekit/dbus_default_interaction"
 #define GPK_CONF_DBUS_ENFORCED_INTERACTION	"/apps/gnome-packagekit/dbus_enforced_interaction"
+#define GPK_CONF_ENABLE_AUTOREMOVE		"/apps/gnome-packagekit/enable_autoremove"
 #define GPK_CONF_ENABLE_FONT_HELPER		"/apps/gnome-packagekit/enable_font_helper"
 #define GPK_CONF_ENABLE_CODEC_HELPER		"/apps/gnome-packagekit/enable_codec_helper"
 #define GPK_CONF_ENABLE_MIME_TYPE_HELPER	"/apps/gnome-packagekit/enable_mime_type_helper"



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