hamster-applet r696 - trunk/hamster
- From: tbaugis svn gnome org
- To: svn-commits-list gnome org
- Subject: hamster-applet r696 - trunk/hamster
- Date: Wed, 4 Feb 2009 22:18:02 +0000 (UTC)
Author: tbaugis
Date: Wed Feb 4 22:18:01 2009
New Revision: 696
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=696&view=rev
Log:
avoid deleting activity if it is dropped in the same category it is located
fixes bug 566861
Modified:
trunk/hamster/db.py
trunk/hamster/preferences.py
trunk/hamster/storage.py
Modified: trunk/hamster/db.py
==============================================================================
--- trunk/hamster/db.py (original)
+++ trunk/hamster/db.py Wed Feb 4 22:18:01 2009
@@ -48,6 +48,9 @@
activity = self.fetchone("select name from activities where id = ?", (id, ))
existing_id = self.__get_activity_by_name(activity['name'], category_id)
+ if id == existing_id: # we are already there, go home
+ return False
+
if existing_id: #ooh, we have something here!
# first move all facts that belong to movable activity to the new one
update = """
@@ -72,6 +75,8 @@
"""
self.execute(statement, (category_id, max_order, id))
+
+ return True
def __add_category(self, name):
new_rec = self.fetchone("select max(id) +1, max(category_order) + 1 from categories")
Modified: trunk/hamster/preferences.py
==============================================================================
--- trunk/hamster/preferences.py (original)
+++ trunk/hamster/preferences.py Wed Feb 4 22:18:01 2009
@@ -270,12 +270,10 @@
if drop_info:
path, position = drop_info
-
iter = model.get_iter(path)
+ changed = storage.change_category(int(data), model[iter][0])
- storage.change_category(int(data), model[iter][0])
-
- context.finish(True, True, etime)
+ context.finish(changed, True, etime)
else:
context.finish(False, True, etime)
Modified: trunk/hamster/storage.py
==============================================================================
--- trunk/hamster/storage.py (original)
+++ trunk/hamster/storage.py Wed Feb 4 22:18:01 2009
@@ -81,8 +81,10 @@
self.dispatch('activity_updated', ())
def change_category(self, id, category_id):
- self.__change_category(id, category_id)
- self.dispatch('activity_updated', ())
+ changed = self.__change_category(id, category_id)
+ if changed:
+ self.dispatch('activity_updated', ())
+ return changed
def swap_activities(self, id1, id2):
res = self.__swap_activities(id1, id2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]