From 1909911197ba656586951d995d95d20e7096903d Mon Sep 17 00:00:00 2001
From: guinux <nuxgui@gmail.com>
Date: Fri, 1 Feb 2013 14:50:15 +0100
Subject: [PATCH] late fixes

---
 pamac/manager.py     | 50 ++++++++++++++++++++++++--------------------
 pamac/transaction.py |  7 +++++--
 2 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/pamac/manager.py b/pamac/manager.py
index 5c23cb80..0aa9f5c0 100755
--- a/pamac/manager.py
+++ b/pamac/manager.py
@@ -439,34 +439,38 @@ class Handler:
 							transaction.Release()
 							choose_provides()
 							transaction.check_conflicts()
-					if transaction.init_transaction(noconflicts = True):
-						for pkgname in transaction.to_add:
-							transaction.Add(pkgname)
-						for pkgname in transaction.to_remove:
-							transaction.Remove(pkgname)
-						error = transaction.Prepare()
-						if error:
-							handle_error(error)
-						else:
-							transaction.get_to_remove()
-							transaction.get_to_add()
-							transaction.Release()
-						if len(transaction.to_add) + len(transaction.to_remove) != 0:
-							set_transaction_sum()
-							ConfDialog.show_all()
-						else:
-							transaction.WarningDialog.format_secondary_text('Nothing to do due to packages conflicts')
-							response = transaction.WarningDialog.run()
-							if response:
-								transaction.WarningDialog.hide()
-							transaction.t_lock = False
+					if set(transaction_dict.keys()).intersection(transaction.to_add):
+						if transaction.init_transaction(noconflicts = True):
+							for pkgname in transaction.to_add:
+								transaction.Add(pkgname)
+							for pkgname in transaction.to_remove:
+								transaction.Remove(pkgname)
+							error = transaction.Prepare()
+							if error:
+								handle_error(error)
+							else:
+								transaction.get_to_remove()
+								transaction.get_to_add()
+								transaction.Release()
+							if len(transaction.to_add) + len(transaction.to_remove) != 0:
+								set_transaction_sum()
+								ConfDialog.show_all()
+							else:
+								transaction.WarningDialog.format_secondary_text('Nothing to do due to packages conflicts')
+								response = transaction.WarningDialog.run()
+								if response:
+									transaction.WarningDialog.hide()
+								transaction.t_lock = False
+					else:
+						transaction.t_lock = False
 
 	def on_EraseButton_clicked(self, *arg):
 		global transaction_type
 		global transaction_dict
 		transaction_dict.clear()
-		transaction_type = None
-		refresh_packages_list()
+		if transaction_type:
+			transaction_type = None
+			refresh_packages_list()
 
 	def on_RefreshButton_clicked(self, *arg):
 		transaction.do_refresh()
diff --git a/pamac/transaction.py b/pamac/transaction.py
index be1b43f1..94069707 100755
--- a/pamac/transaction.py
+++ b/pamac/transaction.py
@@ -112,8 +112,10 @@ def check_conflicts():
 						warning = warning+'\n'
 					warning = warning+name+' will be replaced by '+target.name
 		for name in target.conflicts:
-			if common.format_pkg_name(name) in to_add:
-				to_add.remove(common.format_pkg_name(name))
+			#if common.format_pkg_name(name) in to_add:
+			if name in to_add:
+				#to_add.remove(common.format_pkg_name(name))
+				to_add.remove(name)
 				to_add.remove(target.name)
 				if warning:
 					warning = warning+'\n'
@@ -184,6 +186,7 @@ def handle_error(error):
 def handle_reply(reply):
 	global t_lock
 	t_lock = False
+	Release()
 	ProgressWindow.hide()
 
 def get_updates():
-- 
GitLab