← Back to team overview

gtg team mailing list archive

[Merge] lp:~pcabido/gtg/geolocalized-tasks into lp:gtg

 

Paulo Cabido has proposed merging lp:~pcabido/gtg/geolocalized-tasks into lp:gtg.

Requested reviews:
    Paulo Cabido (pcabido)


-- 
https://code.launchpad.net/~pcabido/gtg/geolocalized-tasks/+merge/10211
Your team Gtg developers is subscribed to branch lp:gtg.
=== modified file 'CHANGELOG'
--- CHANGELOG	2009-07-30 14:30:27 +0000
+++ CHANGELOG	2009-08-11 12:18:20 +0000
@@ -1,5 +1,8 @@
-	* Fixed #406851, incorrect behaviour marking a dismissed task as done by Patrick Coleman
-	* Added accelerators to the task editor by Patrick Coleman
+    * Added filtering capabilities by Paulo Cabido
+      - Filter callbacks were added to the task browser
+      - Filters were also added to the requester 
+    * Fixed #406851, incorrect behaviour marking a dismissed task as done by Patrick Coleman
+    * Added accelerators to the task editor by Patrick Coleman
     * Add plugin engine by Paulo Cabido
     * When GTG is already running, use DBUS to raise existing instance rather than failing silently
     * Refactorization and PEP8ification work by Jonathan Lange

=== modified file 'GTG/core/plugins/api.py'
--- GTG/core/plugins/api.py	2009-08-01 00:35:25 +0000
+++ GTG/core/plugins/api.py	2009-08-11 17:59:33 +0000
@@ -19,8 +19,9 @@
 import gtk
 
 class PluginAPI:
-    def __init__(self, window, config, wTree, requester, taskview, workview_task_filter, \
-                 tagpopup, tagview, task=None, textview=None):
+    def __init__(self, window, config, wTree, requester, taskview,\
+                 filter_cbs, tagpopup, tagview, task=None,\
+                 textview=None):
         # private vars       
         self.__window = window
         self.config = config
@@ -28,11 +29,12 @@
         self.__requester = requester
         
         self.taskview = taskview
-        self.__workview_task_filter = workview_task_filter
         
         self.__tagpopup = tagpopup
         self.tagview = tagview
         
+        self.__filter_cbs = filter_cbs
+        
         if task:
             self.task = task
                  
@@ -98,6 +100,10 @@
     # passes the requester to the plugin
     def get_requester(self):
         return self.__requester
+    
+    # connects a function to a requester signal
+    def requester_connect(self, action, func):
+        self.__requester.connect(action, func)
             
     # changes the tasks TreeStore
     def change_task_tree_store(self, treestore):
@@ -121,13 +127,19 @@
     def get_task_title(self):
         return self.task.get_title() 
     
-    # adds a tag, updated the text buffer, inserting the tag at the end of
-    # the task
+    # inserts a tag in the textview
     # this method only works for the onTaskOpened method
-    def add_tag(self, tag):
+    def insert_tag(self, tag):
+        itera = self.textview.get_insert()
+        if itera.starts_line() :
+            self.textview.insert_text("@" + tag,itera)
+        else :
+            self.textview.insert_text(" @" + tag,itera)
+        self.textview.grab_focus()
+    
+    # adds a tag to a task
+    def add_tag(self, tag):    
         self.task.add_tag("@" + tag)
-        #self.textview.insert_text("@" + tag)
-        self.textview.insert_tag("@" + tag)
         
     # adds a attribute to a tag
     # this method only works for the onTaskOpened method
@@ -167,7 +179,7 @@
         selected = self.tagview.get_selection()
         model, iter = selected.get_selected()
         tag = model.get_value(iter, 0)
-        return tag
+        return self.__requester.get_tag(tag)
     
     # returns the task view in the main window (task browser)
     def get_taskview(self):
@@ -186,7 +198,28 @@
     def get_config(self):
         return self.config
     
-    # add's a tid to the workview filter
-    def add_task_to_workview_filter(self, tid):
-        self.__workview_task_filter.append(tid)
-        
+    # add's a tid to the filter
+    def add_task_to_filter(self, tid):
+        self.__requester.add_task_to_filter(tid)
+    
+    # removes a tid from the filter
+    def remove_task_from_filter(self, tid):
+        self.__requester.remove_task_from_filter(tid)
+        
+    # adds a tag (tag name) to the filter
+    def add_tag_to_filter(self, tag):
+        self.__requester.add_tag_to_filter(tag)
+        
+    # removes a tag (tag name) from the filter
+    def remove_tag_from_filter(self, tag):
+        self.__requester.remove_tag_from_filter(tag)
+    
+    # register a callback with the filter callbacks    
+    def register_filter_cb(self, func):
+        if func not in self.__filter_cbs:
+            self.__filter_cbs.append(func)
+    
+    # unregister a callback from the filter callbacks
+    def unregister_filter_cb(self, func):
+        if func in self.__filter_cbs:
+            self.__filter_cbs.remove(func)

=== modified file 'GTG/core/plugins/engine.py'
--- GTG/core/plugins/engine.py	2009-08-06 21:58:24 +0000
+++ GTG/core/plugins/engine.py	2009-08-10 01:39:40 +0000
@@ -69,6 +69,7 @@
                 		missing.append(str(e).split(" ")[3])
                 	error = True
                 except Exception, e:
+                	print e
                 	error = True
                 
                 # check DBus dependencies

=== modified file 'GTG/core/requester.py'
--- GTG/core/requester.py	2009-08-05 12:34:03 +0000
+++ GTG/core/requester.py	2009-08-10 00:44:54 +0000
@@ -38,6 +38,12 @@
     def __init__(self, datastore):
         """Construct a L{Requester}."""
         self.ds = datastore
+        
+        #filter
+        self.filter = {}
+        self.filter["tasks"] = []
+        self.filter["tags"] = []
+        
         gobject.GObject.__init__(self)
 
     ############# Signals #########################   
@@ -152,6 +158,30 @@
             if task:
                 l_tasks.append(tid)
         return l_tasks
+    
+    ############# Filters #########################
+    def set_filter(self, filter):
+        self.filter = filter
+        
+    def get_filter(self):
+        return self.filter
+        
+    def add_task_to_filter(self, tid):
+        if tid not in self.filter["tasks"]:
+            self.filter["tasks"].append(tid)
+        
+    def remove_task_from_filter(self, tid):
+        if tid in self.filter["tasks"]:
+            self.filter["tasks"].remove(tid)
+            
+    def add_tag_to_filter(self, tag):
+        if tag not in self.filter["tags"]:
+            self.filter["tags"].append(tag)
+        
+    def remove_tag_from_filter(self, tag):
+        if tid in self.filter["tags"]:
+            self.filter["tags"].remove(tag)
+    ############# Filters #########################
 
     def get_active_tasks_list(self, tags=None, notag_only=False,
                               started_only=True, is_root=False,
@@ -179,15 +209,37 @@
             temp_tasks = self.get_active_tasks_list(
                 tags=tags, notag_only=notag_only, started_only=True,
                 is_root=False, workable=False)
+            
+            #remove from temp_tasks the filtered out tasks
+            #for tid in temp_tasks:
+            #    if tid in self.filter["tasks"]:
+            #        temp_tasks.remove(tid)
+            #    else:
+            #        for filter_tag in self.get_task(tid).get_tags():
+            #            if filter_tag.get_attribute("name") in self.filter["tags"]:
+            #                print self.get_task(tid).get_title()
+            #                temp_tasks.remove(tid)
+            #                break
+            
             # Now we verify that the tasks are workable and don't have a
             # nonwork_tag.
             for tid in temp_tasks:
+                filtered_tag = False
                 t = self.get_task(tid)
-                if t and t.is_workable():
-                    if len(nonwork_tag) == 0:
-                        l_tasks.append(tid)
-                    elif not t.has_tags(nonwork_tag):
-                        l_tasks.append(tid)
+                if t and t.is_workable() and (tid not in self.filter["tasks"]):
+                    for filter_tag in t.get_tags():
+                        if filter_tag.get_attribute("name") in self.filter["tags"]:
+                            #print t.get_title()
+                            temp_tasks.remove(tid)
+                            filtered_tag = True
+                            
+                    if not filtered_tag:
+                        if len(nonwork_tag) == 0:
+                            #print t.get_title()
+                            l_tasks.append(tid)
+                        elif not t.has_tags(nonwork_tag):
+                            #print t.get_title()
+                            l_tasks.append(tid)
             return l_tasks
         else:
             active = ["Active"]

=== modified file 'GTG/plugins/geolocalized-tasks.gtg-plugin'
--- GTG/plugins/geolocalized-tasks.gtg-plugin	2009-08-05 22:33:44 +0000
+++ GTG/plugins/geolocalized-tasks.gtg-plugin	2009-08-15 17:58:22 +0000
@@ -1,8 +1,8 @@
 [GTG Plugin]
 Module=geolocalized_tasks
 Name=Geolocalized Tasks
-Description=This plugin adds geolocalized tasks to GTG!.\nWARNING: This plugin is still heavy development.
+Description=This plugin adds geolocalized tasks to GTG!.\nWARNING: This plugin is still under heavy development.
 Authors=Paulo Cabido <paulo.cabido@xxxxxxxxx>
-Version=0.1
+Version=0.1.1
 Dependencies=configobj,Geoclue,clutter,cluttergtk,champlain,champlaingtk 
 Enabled=False

=== modified file 'GTG/plugins/geolocalized_tasks/geolocalized.glade'
--- GTG/plugins/geolocalized_tasks/geolocalized.glade	2009-08-05 09:46:56 +0000
+++ GTG/plugins/geolocalized_tasks/geolocalized.glade	2009-08-15 17:58:22 +0000
@@ -1,790 +1,517 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
-
+<?xml version="1.0"?>
 <glade-interface>
-
-<widget class="GtkDialog" id="SetTaskLocation">
-  <property name="visible">True</property>
-  <property name="title" translatable="yes">Set the task's location</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-  <property name="has_separator">True</property>
-
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox2">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">0</property>
-
-      <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="dialog-action_area2">
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-
-	  <child>
-	    <widget class="GtkButton" id="cancelbutton2">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-cancel</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">-6</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="okbutton2">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-ok</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">-5</property>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">True</property>
-	  <property name="pack_type">GTK_PACK_END</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkVBox" id="vbox_map">
-	  <property name="width_request">400</property>
-	  <property name="visible">True</property>
-	  <property name="homogeneous">False</property>
-	  <property name="spacing">0</property>
-
-	  <child>
-	    <widget class="GtkToolbar" id="toolbar2">
-	      <property name="visible">True</property>
-	      <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
-	      <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
-	      <property name="tooltips">True</property>
-	      <property name="show_arrow">True</property>
-
-	      <child>
-		<widget class="GtkToolButton" id="btn_zoom_in">
-		  <property name="visible">True</property>
-		  <property name="stock_id">gtk-zoom-in</property>
-		  <property name="visible_horizontal">True</property>
-		  <property name="visible_vertical">True</property>
-		  <property name="is_important">False</property>
-		</widget>
-		<packing>
-		  <property name="expand">False</property>
-		  <property name="homogeneous">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkToolButton" id="btn_zoom_out">
-		  <property name="visible">True</property>
-		  <property name="stock_id">gtk-zoom-out</property>
-		  <property name="visible_horizontal">True</property>
-		  <property name="visible_vertical">True</property>
-		  <property name="is_important">False</property>
-		</widget>
-		<packing>
-		  <property name="expand">False</property>
-		  <property name="homogeneous">True</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkVBox" id="vbox_map">
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">0</property>
-
-	      <child>
-		<placeholder/>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkVBox" id="vbox_opt">
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">0</property>
-
-	      <child>
-		<widget class="GtkTable" id="tabela_set_task">
-		  <property name="visible">True</property>
-		  <property name="n_rows">2</property>
-		  <property name="n_columns">2</property>
-		  <property name="homogeneous">False</property>
-		  <property name="row_spacing">0</property>
-		  <property name="column_spacing">0</property>
-
-		  <child>
-		    <widget class="GtkRadioButton" id="radiobutton1">
-		      <property name="width_request">198</property>
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="label" translatable="yes">Associate with new tag</property>
-		      <property name="use_underline">True</property>
-		      <property name="relief">GTK_RELIEF_NORMAL</property>
-		      <property name="focus_on_click">True</property>
-		      <property name="active">False</property>
-		      <property name="inconsistent">False</property>
-		      <property name="draw_indicator">True</property>
-		    </widget>
-		    <packing>
-		      <property name="left_attach">0</property>
-		      <property name="right_attach">1</property>
-		      <property name="top_attach">0</property>
-		      <property name="bottom_attach">1</property>
-		      <property name="x_options">fill</property>
-		      <property name="y_options"></property>
-		    </packing>
-		  </child>
-
-		  <child>
-		    <widget class="GtkRadioButton" id="radiobutton2">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="label" translatable="yes">Associate with existing tag</property>
-		      <property name="use_underline">True</property>
-		      <property name="relief">GTK_RELIEF_NORMAL</property>
-		      <property name="focus_on_click">True</property>
-		      <property name="active">False</property>
-		      <property name="inconsistent">False</property>
-		      <property name="draw_indicator">True</property>
-		      <property name="group">radiobutton1</property>
-		    </widget>
-		    <packing>
-		      <property name="left_attach">0</property>
-		      <property name="right_attach">1</property>
-		      <property name="top_attach">1</property>
-		      <property name="bottom_attach">2</property>
-		      <property name="x_options">fill</property>
-		      <property name="y_options"></property>
-		    </packing>
-		  </child>
-
-		  <child>
-		    <widget class="GtkEntry" id="txt_new_tag">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="editable">True</property>
-		      <property name="visibility">True</property>
-		      <property name="max_length">0</property>
-		      <property name="text" translatable="yes"></property>
-		      <property name="has_frame">True</property>
-		      <property name="invisible_char">●</property>
-		      <property name="activates_default">False</property>
-		    </widget>
-		    <packing>
-		      <property name="left_attach">1</property>
-		      <property name="right_attach">2</property>
-		      <property name="top_attach">0</property>
-		      <property name="bottom_attach">1</property>
-		      <property name="y_options"></property>
-		    </packing>
-		  </child>
-
-		  <child>
-		    <widget class="GtkComboBoxEntry" id="cmb_existing_tag">
-		      <property name="visible">True</property>
-		      <property name="add_tearoffs">False</property>
-		      <property name="has_frame">True</property>
-		      <property name="focus_on_click">True</property>
-		    </widget>
-		    <packing>
-		      <property name="left_attach">1</property>
-		      <property name="right_attach">2</property>
-		      <property name="top_attach">1</property>
-		      <property name="bottom_attach">2</property>
-		      <property name="x_options">fill</property>
-		      <property name="y_options"></property>
-		    </packing>
-		  </child>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">2</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
-<widget class="GtkDialog" id="TagLocation">
-  <property name="visible">True</property>
-  <property name="title" translatable="yes"></property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-  <property name="has_separator">True</property>
-
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox3">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">0</property>
-
-      <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="dialog-action_area3">
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-
-	  <child>
-	    <widget class="GtkButton" id="cancelbutton3">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-cancel</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">-6</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="okbutton3">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-ok</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">-5</property>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">True</property>
-	  <property name="pack_type">GTK_PACK_END</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkVBox" id="vbox3">
-	  <property name="visible">True</property>
-	  <property name="homogeneous">False</property>
-	  <property name="spacing">0</property>
-
-	  <child>
-	    <widget class="GtkToolbar" id="toolbar3">
-	      <property name="visible">True</property>
-	      <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
-	      <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
-	      <property name="tooltips">True</property>
-	      <property name="show_arrow">True</property>
-
-	      <child>
-		<widget class="GtkToolButton" id="btn_zoom_in">
-		  <property name="visible">True</property>
-		  <property name="stock_id">gtk-zoom-in</property>
-		  <property name="visible_horizontal">True</property>
-		  <property name="visible_vertical">True</property>
-		  <property name="is_important">False</property>
-		</widget>
-		<packing>
-		  <property name="expand">False</property>
-		  <property name="homogeneous">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkToolButton" id="btn_zoom_out">
-		  <property name="visible">True</property>
-		  <property name="stock_id">gtk-zoom-out</property>
-		  <property name="visible_horizontal">True</property>
-		  <property name="visible_vertical">True</property>
-		  <property name="is_important">False</property>
-		</widget>
-		<packing>
-		  <property name="expand">False</property>
-		  <property name="homogeneous">True</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkVBox" id="vbox_map">
-	      <property name="width_request">400</property>
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">0</property>
-
-	      <child>
-		<placeholder/>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
-<widget class="GtkDialog" id="Preferences">
-  <property name="width_request">350</property>
-  <property name="visible">True</property>
-  <property name="title" translatable="yes">Geolocalized-tasks Preferences</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-  <property name="has_separator">True</property>
-
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox4">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">0</property>
-
-      <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="dialog-action_area4">
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-
-	  <child>
-	    <widget class="GtkButton" id="cancelbutton4">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-cancel</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">-6</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="okbutton4">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-ok</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">-5</property>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">True</property>
-	  <property name="pack_type">GTK_PACK_END</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkVBox" id="vbox4">
-	  <property name="visible">True</property>
-	  <property name="homogeneous">False</property>
-	  <property name="spacing">0</property>
-
-	  <child>
-	    <widget class="GtkFrame" id="frame3">
-	      <property name="border_width">3</property>
-	      <property name="visible">True</property>
-	      <property name="label_xalign">0</property>
-	      <property name="label_yalign">0.5</property>
-	      <property name="shadow_type">GTK_SHADOW_NONE</property>
-
-	      <child>
-		<widget class="GtkAlignment" id="alignment3">
-		  <property name="visible">True</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xscale">1</property>
-		  <property name="yscale">1</property>
-		  <property name="top_padding">0</property>
-		  <property name="bottom_padding">0</property>
-		  <property name="left_padding">12</property>
-		  <property name="right_padding">0</property>
-
-		  <child>
-		    <widget class="GtkHBox" id="hbox4">
-		      <property name="visible">True</property>
-		      <property name="homogeneous">False</property>
-		      <property name="spacing">0</property>
-
-		      <child>
-			<widget class="GtkComboBoxEntry" id="cmb_accuracy">
-			  <property name="visible">True</property>
-			  <property name="items" translatable="yes">Country
-Region
-Locality
-Postalcode
-Street
-Detailed</property>
-			  <property name="add_tearoffs">False</property>
-			  <property name="has_frame">True</property>
-			  <property name="focus_on_click">True</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-
-	      <child>
-		<widget class="GtkLabel" id="label5">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Accuracy&lt;/b&gt;</property>
-		  <property name="use_underline">False</property>
-		  <property name="use_markup">True</property>
-		  <property name="justify">GTK_JUSTIFY_LEFT</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		  <property name="width_chars">-1</property>
-		  <property name="single_line_mode">False</property>
-		  <property name="angle">0</property>
-		</widget>
-		<packing>
-		  <property name="type">label_item</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkFrame" id="frame4">
-	      <property name="border_width">3</property>
-	      <property name="visible">True</property>
-	      <property name="label_xalign">0</property>
-	      <property name="label_yalign">0.5</property>
-	      <property name="shadow_type">GTK_SHADOW_NONE</property>
-
-	      <child>
-		<widget class="GtkAlignment" id="alignment4">
-		  <property name="visible">True</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xscale">1</property>
-		  <property name="yscale">1</property>
-		  <property name="top_padding">0</property>
-		  <property name="bottom_padding">0</property>
-		  <property name="left_padding">12</property>
-		  <property name="right_padding">0</property>
-
-		  <child>
-		    <widget class="GtkHBox" id="hbox5">
-		      <property name="visible">True</property>
-		      <property name="homogeneous">False</property>
-		      <property name="spacing">0</property>
-
-		      <child>
-			<widget class="GtkVBox" id="vbox5">
-			  <property name="visible">True</property>
-			  <property name="homogeneous">False</property>
-			  <property name="spacing">0</property>
-
-			  <child>
-			    <widget class="GtkCheckButton" id="check_network">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="label" translatable="yes">Use network</property>
-			      <property name="use_underline">True</property>
-			      <property name="relief">GTK_RELIEF_NORMAL</property>
-			      <property name="focus_on_click">True</property>
-			      <property name="active">False</property>
-			      <property name="inconsistent">False</property>
-			      <property name="draw_indicator">True</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkCheckButton" id="check_cellphone">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="label" translatable="yes">Use cellphone (if available)</property>
-			      <property name="use_underline">True</property>
-			      <property name="relief">GTK_RELIEF_NORMAL</property>
-			      <property name="focus_on_click">True</property>
-			      <property name="active">False</property>
-			      <property name="inconsistent">False</property>
-			      <property name="draw_indicator">True</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkCheckButton" id="check_gps">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="label" translatable="yes">Use gps (if available)</property>
-			      <property name="use_underline">True</property>
-			      <property name="relief">GTK_RELIEF_NORMAL</property>
-			      <property name="focus_on_click">True</property>
-			      <property name="active">False</property>
-			      <property name="inconsistent">False</property>
-			      <property name="draw_indicator">True</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">True</property>
-			  <property name="fill">True</property>
-			</packing>
-		      </child>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-
-	      <child>
-		<widget class="GtkLabel" id="label6">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Location Determination Method&lt;/b&gt;</property>
-		  <property name="use_underline">False</property>
-		  <property name="use_markup">True</property>
-		  <property name="justify">GTK_JUSTIFY_LEFT</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		  <property name="width_chars">-1</property>
-		  <property name="single_line_mode">False</property>
-		  <property name="angle">0</property>
-		</widget>
-		<packing>
-		  <property name="type">label_item</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkFrame" id="frame5">
-	      <property name="border_width">3</property>
-	      <property name="visible">True</property>
-	      <property name="label_xalign">0</property>
-	      <property name="label_yalign">0.5</property>
-	      <property name="shadow_type">GTK_SHADOW_NONE</property>
-
-	      <child>
-		<widget class="GtkAlignment" id="alignment5">
-		  <property name="visible">True</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xscale">1</property>
-		  <property name="yscale">1</property>
-		  <property name="top_padding">0</property>
-		  <property name="bottom_padding">0</property>
-		  <property name="left_padding">12</property>
-		  <property name="right_padding">0</property>
-
-		  <child>
-		    <widget class="GtkHBox" id="hbox3">
-		      <property name="visible">True</property>
-		      <property name="homogeneous">False</property>
-		      <property name="spacing">0</property>
-
-		      <child>
-			<widget class="GtkSpinButton" id="spin_proximityfactor">
-			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="climb_rate">1</property>
-			  <property name="digits">1</property>
-			  <property name="numeric">False</property>
-			  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-			  <property name="snap_to_ticks">False</property>
-			  <property name="wrap">False</property>
-			  <property name="adjustment">5 1 100 0.10000000149 10 10</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
-
-		      <child>
-			<widget class="GtkLabel" id="label8">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">km</property>
-			  <property name="use_underline">False</property>
-			  <property name="use_markup">False</property>
-			  <property name="justify">GTK_JUSTIFY_LEFT</property>
-			  <property name="wrap">False</property>
-			  <property name="selectable">False</property>
-			  <property name="xalign">0.5</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">4</property>
-			  <property name="ypad">0</property>
-			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			  <property name="width_chars">-1</property>
-			  <property name="single_line_mode">False</property>
-			  <property name="angle">0</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
-		    </widget>
-		  </child>
-		</widget>
-	      </child>
-
-	      <child>
-		<widget class="GtkLabel" id="label7">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Proximity Factor&lt;/b&gt;</property>
-		  <property name="use_underline">False</property>
-		  <property name="use_markup">True</property>
-		  <property name="justify">GTK_JUSTIFY_LEFT</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		  <property name="width_chars">-1</property>
-		  <property name="single_line_mode">False</property>
-		  <property name="angle">0</property>
-		</widget>
-		<packing>
-		  <property name="type">label_item</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
+  <!-- interface-requires gtk+ 2.16 -->
+  <!-- interface-naming-policy toplevel-contextual -->
+  <widget class="GtkDialog" id="SetTaskLocation">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Set the task's location</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox2">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkVBox" id="vbox">
+            <property name="width_request">400</property>
+            <property name="visible">True</property>
+            <child>
+              <widget class="GtkToolbar" id="toolbar2">
+                <property name="visible">True</property>
+                <property name="toolbar_style">both</property>
+                <child>
+                  <widget class="GtkToolButton" id="btn_zoom_in">
+                    <property name="visible">True</property>
+                    <property name="stock_id">gtk-zoom-in</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkToolButton" id="btn_zoom_out">
+                    <property name="visible">True</property>
+                    <property name="stock_id">gtk-zoom-out</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkVBox" id="vbox_map">
+                <property name="visible">True</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkVBox" id="vbox_opt">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkTable" id="tabela_set_task">
+                    <property name="visible">True</property>
+                    <property name="n_rows">2</property>
+                    <property name="n_columns">2</property>
+                    <child>
+                      <widget class="GtkRadioButton" id="radiobutton1">
+                        <property name="label" translatable="yes">Associate with new tag</property>
+                        <property name="width_request">198</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </widget>
+                      <packing>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkRadioButton" id="radiobutton2">
+                        <property name="label" translatable="yes">Associate with existing tag</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">radiobutton1</property>
+                      </widget>
+                      <packing>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkEntry" id="txt_new_tag">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="invisible_char">&#x25CF;</property>
+                      </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkComboBoxEntry" id="cmb_existing_tag">
+                        <property name="visible">True</property>
+                      </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="padding">2</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog_action_area_btn">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <widget class="GtkButton" id="btn_cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="response_id">-6</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="btn_ok">
+                <property name="label">gtk-ok</property>
+                <property name="response_id">-5</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="btn_close">
+                <property name="label" translatable="yes">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkDialog" id="TagLocation">
+    <property name="visible">True</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox3">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkVBox" id="vbox3">
+            <property name="visible">True</property>
+            <child>
+              <widget class="GtkToolbar" id="toolbar3">
+                <property name="visible">True</property>
+                <property name="toolbar_style">both</property>
+                <child>
+                  <widget class="GtkToolButton" id="btn_zoom_in">
+                    <property name="visible">True</property>
+                    <property name="stock_id">gtk-zoom-in</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkToolButton" id="btn_zoom_out">
+                    <property name="visible">True</property>
+                    <property name="stock_id">gtk-zoom-out</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkVBox" id="vbox_map">
+                <property name="width_request">400</property>
+                <property name="visible">True</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area3">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <widget class="GtkButton" id="cancelbutton3">
+                <property name="label">gtk-cancel</property>
+                <property name="response_id">-6</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="okbutton3">
+                <property name="label">gtk-ok</property>
+                <property name="response_id">-5</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkDialog" id="Preferences">
+    <property name="width_request">350</property>
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Geolocalized-tasks Preferences</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox4">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkVBox" id="vbox4">
+            <property name="visible">True</property>
+            <child>
+              <widget class="GtkFrame" id="frame4">
+                <property name="visible">True</property>
+                <property name="border_width">3</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment4">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox5">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkVBox" id="vbox5">
+                            <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <widget class="GtkCheckButton" id="check_network">
+                                <property name="label" translatable="yes">Use network</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckButton" id="check_cellphone">
+                                <property name="label" translatable="yes">Use cellphone</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckButton" id="check_gps">
+                                <property name="label" translatable="yes">Use gps</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label6">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Location Determination Method&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </widget>
+                  <packing>
+                    <property name="type">label_item</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkFrame" id="frame5">
+                <property name="visible">True</property>
+                <property name="border_width">3</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment5">
+                    <property name="visible">True</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox3">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkSpinButton" id="spin_proximityfactor">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="invisible_char">&#x25CF;</property>
+                            <property name="adjustment">5 1 100 0.10000000149 10 10</property>
+                            <property name="climb_rate">1</property>
+                            <property name="digits">1</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label8">
+                            <property name="visible">True</property>
+                            <property name="xpad">4</property>
+                            <property name="label" translatable="yes">&lt;small&gt;Distance in kilometers from 
+the current location.&lt;/small&gt;</property>
+                            <property name="use_markup">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label7">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Proximity Factor&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </widget>
+                  <packing>
+                    <property name="type">label_item</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area4">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <widget class="GtkButton" id="cancelbutton4">
+                <property name="label">gtk-cancel</property>
+                <property name="response_id">-6</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="okbutton4">
+                <property name="label">gtk-ok</property>
+                <property name="response_id">-5</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>

=== modified file 'GTG/plugins/geolocalized_tasks/geolocalized_tasks.py'
--- GTG/plugins/geolocalized_tasks/geolocalized_tasks.py	2009-08-05 22:33:44 +0000
+++ GTG/plugins/geolocalized_tasks/geolocalized_tasks.py	2009-08-15 21:33:29 +0000
@@ -34,11 +34,17 @@
 from GTG.core.plugins.engine import PluginEngine
 
 class geolocalizedTasks:
+    PLUGIN_NAME = 'Geolocalized Tasks'
+    PLUGIN_AUTHORS = 'Paulo Cabido <paulo.cabido@xxxxxxxxx>'
+    PLUGIN_VERSION = '0.1'
+    PLUGIN_DESCRIPTION = 'This plugin adds geolocalized tasks to GTG!.\n \
+                          WARNING: This plugin is still heavy development.'
+                          
+    PLUGIN_ENABLED = True
     
     def __init__(self):
         self.geoclue = Geoclue.DiscoverLocation()
-        self.geoclue.init()
-        self.location = self.geoclue.get_location_info()
+        self.geoclue.connect(self.location_changed)
         
         self.plugin_path = os.path.dirname(os.path.abspath(__file__))
         self.glade_file = os.path.join(self.plugin_path, "geolocalized.glade")
@@ -49,16 +55,10 @@
         # toolbar button for the new Location view
         # create the pixbuf with the icon and it's size.
         # 24,24 is the TaskEditor's toolbar icon size
-        image_geolocalization_path = os.path.join(self.plugin_path, "icons/hicolor/24x24/geolocalization.png")
-        pixbuf_geolocalization = gtk.gdk.pixbuf_new_from_file_at_size(image_geolocalization_path, 24, 24)
-        
-        image_assign_location_path = os.path.join(self.plugin_path, "icons/hicolor/16x16/assign-location.png")
-        pixbug_assign_location = gtk.gdk.pixbuf_new_from_file_at_size(image_assign_location_path, 16, 16)
-        
-        # create the image and associate the pixbuf
-        self.icon_geolocalization = gtk.Image()
-        self.icon_geolocalization.set_from_pixbuf(pixbuf_geolocalization)
-        self.icon_geolocalization.show()
+        image_assign_location_path = os.path.join(self.plugin_path,\
+                                                  "icons/hicolor/16x16/assign-location.png")
+        pixbug_assign_location = gtk.gdk.pixbuf_new_from_file_at_size(image_assign_location_path,\
+                                                                      16, 16)
         
         image_assign_location = gtk.Image()
         image_assign_location.set_from_pixbuf(pixbug_assign_location)
@@ -69,21 +69,28 @@
         self.context_item.set_image(image_assign_location)
         # TODO: add a short cut to the menu
         
-        # toolbar button for the location_view
-        self.btn_location_view = gtk.ToggleToolButton()
-        self.btn_location_view.set_icon_widget(self.icon_geolocalization)
-        self.btn_location_view.set_label("Location View")
-        
         self.PROXIMITY_FACTOR = 5  # 5 km
-        self.LOCATION_ACCURACY = 3 # Locality
-        self.LOCATION_DETERMINATION_METHOD = ["network", "gps", "cellphone"]
-        #for provider in self.geoclue.get_available_providers():
-        #    if provider['position'] and (provider['provider'] != "Example Provider" and provider['provider'] != "Plazes"):
-        #        self.LOCATION_DETERMINATION_METHOD.append(provider["provider"])
-            
+        #self.LOCATION_ACCURACY = 3 # Locality
+        self.LOCATION_DETERMINATION_METHOD = [] # "network", "gps", "cellphone"
         
+        for provider in self.geoclue.get_available_providers():
+            if provider['name'].lower() == "hostip":
+                if self.geoclue.provider_status(provider['object']) == "available" or\
+                self.geoclue.provider_status(provider['object']) == "acquiring":
+                    self.LOCATION_DETERMINATION_METHOD.append("network")
+            elif provider['name'].lower() == "gpsd" or provider['name'].lower() == "gypsy":
+                if self.geoclue.provider_status(provider['object']) == "available" or\
+                self.geoclue.provider_status(provider['object']) == "acquiring":
+                    self.LOCATION_DETERMINATION_METHOD.append("gps")
+            elif provider['name'].lower() == "gsmloc":
+                if self.geoclue.provider_status(provider['object']) == "available" or\
+                self.geoclue.provider_status(provider['object']) == "acquiring":
+                    self.LOCATION_DETERMINATION_METHOD.append("cellphone")
+                    
     
     def activate(self, plugin_api):
+        self.plugin_api = plugin_api
+        
         self.menu_item.connect('activate', self.on_geolocalized_preferences, plugin_api)
         plugin_api.add_menu_item(self.menu_item)
         
@@ -95,15 +102,74 @@
         if self.config.has_key("geolocalized-tasks"):
             if self.config["geolocalized-tasks"].has_key("proximity_factor"):
                 self.PROXIMITY_FACTOR = self.config["geolocalized-tasks"]["proximity_factor"]
-            
-            if self.config["geolocalized-tasks"].has_key("accuracy"):
-                self.LOCATION_ACCURACY = self.config["geolocalized-tasks"]["accuracy"]
         
             if self.config["geolocalized-tasks"].has_key("location_determination_method"):
-                self.LOCATION_DETERMINATION_METHOD = self.config["geolocalized-tasks"]["location_determination_method"]
-                
-        # filter the tasks location for the workview
-        self.filter_workview_by_location(plugin_api)
+                self.LOCATION_DETERMINATION_METHOD =\
+                self.config["geolocalized-tasks"]["location_determination_method"]
+              
+        providers = self.geoclue.get_available_providers()
+        provider_name_list = []
+        
+        for provider in providers:
+            provider_name_list.append(provider['name'].lower())  
+            
+        # verify the location determination method
+        for method in self.LOCATION_DETERMINATION_METHOD:
+            if method == "network":
+                if "hostip" in provider_name_list:
+                    for provider in providers:
+                        if provider['name'].lower() == "hostip":
+                            if self.geoclue.provider_status(provider['object']) == "error" or\
+                            self.geoclue.provider_status(provider['object']) == "unavailable":
+                                if "network" in self.LOCATION_DETERMINATION_METHOD:
+                                    self.LOCATION_DETERMINATION_METHOD.remove("network")
+                                    break
+                else:
+                    self.LOCATION_DETERMINATION_METHOD.remove("network")
+            elif method == "gps":
+                if "gpsd" in provider_name_list or "gypsy" in provider_name_list:
+                    for provider in providers:
+                        if provider['name'].lower() == "gpsd" or provider['name'].lower() == "gypsy":
+                            if self.geoclue.provider_status(provider['object']) == "error" or\
+                            self.geoclue.provider_status(provider['object']) == "unavailable":
+                                if "gps" in self.LOCATION_DETERMINATION_METHOD:
+                                    self.LOCATION_DETERMINATION_METHOD.remove("gps")
+                                    break
+                else:
+                    self.LOCATION_DETERMINATION_METHOD.remove("gps")
+            elif method == "cellphone":
+                if "gsmloc" in provider_name_list:
+                    for provider in providers:
+                        if provider['name'].lower() == "gsmloc":
+                            if self.geoclue.provider_status(provider['object']) == "error" or\
+                            self.geoclue.provider_status(provider['object']) == "unavailable":
+                                if "cellphone" in self.LOCATION_DETERMINATION_METHOD:
+                                    self.LOCATION_DETERMINATION_METHOD.remove("cellphone")
+                                    break
+                else:
+                    self.LOCATION_DETERMINATION_METHOD.remove("cellphone")
+        
+        try:            
+            if len(self.LOCATION_DETERMINATION_METHOD) == 1 and\
+            "network" in self.LOCATION_DETERMINATION_METHOD:
+                self.geoclue.init()
+            elif len(self.LOCATION_DETERMINATION_METHOD) == 1 and\
+            "cellphone" in self.LOCATION_DETERMINATION_METHOD:
+                self.geoclue.init(resource=(1 << 1))
+            elif len(self.LOCATION_DETERMINATION_METHOD) == 1 and\
+            "gps" in self.LOCATION_DETERMINATION_METHOD:
+                self.geoclue.init(resource=(1 << 2))
+            else:
+                self.geoclue.init(resource=((1 << 10) - 1))
+        except Exception, e:
+            self.geoclue.init(resource=0)
+            
+        
+        self.location = self.geoclue.get_location_info()
+        self.location_filter = []
+        
+        # registers the filter callback method
+        plugin_api.register_filter_cb(self.task_location_filter)
     
     def deactivate(self, plugin_api):
         plugin_api.remove_menu_item(self.menu_item)
@@ -112,10 +178,35 @@
         
         self.config["geolocalized-tasks"] = {}
         self.config["geolocalized-tasks"]["proximity_factor"] = self.PROXIMITY_FACTOR
-        self.config["geolocalized-tasks"]["accuracy"] = self.LOCATION_ACCURACY
-        self.config["geolocalized-tasks"]["location_determination_method"] = self.LOCATION_DETERMINATION_METHOD
+        self.config["geolocalized-tasks"]["location_determination_method"] =\
+        self.LOCATION_DETERMINATION_METHOD
+        
+        # remove the filters
+        for tid in self.location_filter:
+            plugin_api.remove_task_from_filter(tid)
+        
+        # unregister the filter callback
+        plugin_api.unregister_filter_cb(self.task_location_filter)
+        
+        
     
     def onTaskOpened(self, plugin_api):
+        image_geolocalization_path = os.path.join(self.plugin_path,\
+                                                  "icons/hicolor/24x24/geolocalization.png")
+        pixbuf_geolocalization = gtk.gdk.pixbuf_new_from_file_at_size(image_geolocalization_path,
+                                                                      24,
+                                                                      24)
+        
+        # create the image and associate the pixbuf
+        self.icon_geolocalization = gtk.Image()
+        self.icon_geolocalization.set_from_pixbuf(pixbuf_geolocalization)
+        self.icon_geolocalization.show()
+        
+        # toolbar button for the location_view
+        self.btn_location_view = gtk.ToggleToolButton()
+        self.btn_location_view.set_icon_widget(self.icon_geolocalization)
+        self.btn_location_view.set_label("Location View")
+        
         plugin_api.add_task_toolbar_item(gtk.SeparatorToolItem())
         
         btn_set_location = gtk.ToolButton()
@@ -124,34 +215,70 @@
         btn_set_location.connect('clicked', self.set_task_location, plugin_api)
         plugin_api.add_task_toolbar_item(btn_set_location)
     
-    # the task location filter
-    def filter_workview_by_location(self, plugin_api):
-        # TODO: if the location has a delay in being calculated it may not exist at
-        # this point
-        if self.location.has_key("latitude") and self.location.has_key("longitude"):
-            tasks = plugin_api.get_all_tasks()
-                
-            tasks_with_location = []
-            tasks_without_location = []
-            
-            for tid in tasks:
-                task = plugin_api.get_task(tid)
+    def location_changed(self):
+        # TODO: This should refresh the task ang tag list
+        # update the location
+        self.location = self.geoclue.get_location_info()
+        # reset the filters
+        self.location_filter = []
+        
+    # filters by location only one task
+    def task_location_filter(self, tid):
+        has_location = False
+        task = self.plugin_api.get_task(tid)
+        if task.get_status() == "Active":
+            if task.is_workable():
                 tags = task.get_tags()
+                
+                #check if it has the location set
                 for tag in tags:
                     if "location" in tag.get_all_attributes():
-                        tasks_with_location.append(task)
-                    else:
-                        tasks_without_location.append(task)
+                        has_location = True
                 
-            for task in tasks_with_location:
-                if task.is_workable():
-                    tags = task.get_tags()
+                if has_location:
+                    # do the actual filter
                     for tag in tags:
-                        if tag.get_attribute("location"):
-                            position = eval(tag.get_attribute("location"))
-                            if not self.geoclue.compare_position(position[0], position[1], float(self.PROXIMITY_FACTOR)):
-                                plugin_api.add_task_to_workview_filter(task.get_id())
-                                
+                            if tag.get_attribute("location"):
+                                position = eval(tag.get_attribute("location"))
+                                if not self.geoclue.compare_position(position[0],
+                                                                     position[1],
+                                                                     float(self.PROXIMITY_FACTOR)
+                                                                     ):
+                                    self.plugin_api.add_task_to_filter(tid)
+                                    if tid not in self.location_filter:
+                                        self.location_filter.append(tid)
+                                    return False
+        return True
+                
+    
+    # the task location filter (for all tasks)
+    # DEPRECATED
+    #def filter_workview_by_location(self):
+    #    if self.location.has_key("latitude") and self.location.has_key("longitude"):
+    #        # TODO: if the location has a delay in being calculated it may not exist at
+    #        # this point
+    #        tasks = self.plugin_api.get_all_tasks()
+    #        
+    #        tasks_with_location = []
+    #        tasks_without_location = []
+    #        
+    #        for tid in tasks:
+    #            task = self.plugin_api.get_task(tid)
+    #            tags = task.get_tags()
+    #            for tag in tags:
+    #                if "location" in tag.get_all_attributes():
+    #                    tasks_with_location.append(task)
+    #                else:
+    #                    tasks_without_location.append(task)
+    #            
+    #        for task in tasks_with_location:
+    #            if task.is_workable():
+    #                tags = task.get_tags()
+    #                for tag in tags:
+    #                    if tag.get_attribute("location"):
+    #                        position = eval(tag.get_attribute("location"))
+    #                        if not self.geoclue.compare_position(position[0], position[1], float(self.PROXIMITY_FACTOR)):
+    #                            self.plugin_api.add_task_to_filter(task.get_id())
                                 
     #=== GEOLOCALIZED PREFERENCES===================================================    
     def on_geolocalized_preferences(self, widget, plugin_api):
@@ -160,27 +287,92 @@
         dialog.connect("response", self.preferences_close)
         plugin_api.set_parent_window(dialog)
         
-        cmb_accuracy = wTree.get_widget("cmb_accuracy")
-        for i in range(len(cmb_accuracy.get_model())):
-            if str(self.accuracy_to_value(cmb_accuracy.get_model()[i][0])) == str(self.LOCATION_ACCURACY):
-                cmb_accuracy.set_active(i)
-        cmb_accuracy.connect("changed", self.cmb_accuracy_changed)
-        self.tmp_location_accuracy = self.LOCATION_ACCURACY
-        
         check_network = wTree.get_widget("check_network")
         check_cellphone = wTree.get_widget("check_cellphone")
         check_gps = wTree.get_widget("check_gps")
         
-        if "network" in self.LOCATION_DETERMINATION_METHOD:
-            check_network.set_active(True)
-            
-        if "cellphone" in self.LOCATION_DETERMINATION_METHOD:
-            check_cellphone.set_active(True)
-            
-        if "gps" in self.LOCATION_DETERMINATION_METHOD:
-            check_gps.set_active(True)
-        
-        
+        providers = self.geoclue.get_available_providers() 
+        provider_name_list = []
+        
+        for provider in providers:
+            provider_name_list.append(provider['name'].lower())  
+        
+        if "hostip" not in provider_name_list:
+            check_network.set_active(False)
+            check_network.set_sensitive(False)
+        else:
+            if "network" in self.LOCATION_DETERMINATION_METHOD:
+                for provider in providers:
+                    if provider['name'].lower() == "hostip":
+                        if self.geoclue.provider_status(provider['object']) == "available" or\
+                        self.geoclue.provider_status(provider['object']) == "acquiring":
+                            check_network.set_active(True)
+                            break
+                        else:
+                            check_network.set_active(False)
+                            check_network.set_sensitive(False)
+                            break
+            else:
+                for provider in providers:
+                    if provider['name'].lower() == "hostip":
+                        if self.geoclue.provider_status(provider['object']) == "error" or\
+                        self.geoclue.provider_status(provider['object']) == "unavailable":
+                            check_network.set_active(False)
+                            check_network.set_sensitive(False)
+                            break
+                
+        if "gsmloc" not in provider_name_list:
+            check_cellphone.set_active(False)
+            check_cellphone.set_sensitive(False)
+        else:
+            if "cellphone" in self.LOCATION_DETERMINATION_METHOD:
+                for provider in providers:
+                    if provider['name'].lower() == "gsmloc":
+                        if self.geoclue.provider_status(provider['object']) == "available" or\
+                        self.geoclue.provider_status(provider['object']) == "acquiring":
+                            check_cellphone.set_active(True)
+                            break
+                        else:
+                            check_cellphone.set_active(False)
+                            check_cellphone.set_sensitive(False)
+                            break
+            else:
+                for provider in providers:
+                    if provider['name'].lower() == "gsmloc":
+                        if self.geoclue.provider_status(provider['object']) == "error" or\
+                        self.geoclue.provider_status(provider['object']) == "unavailable":
+                            check_cellphone.set_active(False)
+                            check_cellphone.set_sensitive(False)
+                            break
+        
+        # TODO: separate gypsy from gpsd
+        if "gpsd" not in provider_name_list:
+            if "gypsy" not in provider_name_list:
+                check_gps.set_active(False)
+                check_gps.set_sensitive(False)
+        else:
+            if "gps" in self.LOCATION_DETERMINATION_METHOD:
+                for provider in providers:
+                    if provider['name'].lower() == "gpsd" or\
+                    provider['name'].lower() == "gypsy":
+                        if self.geoclue.provider_status(provider['object']) == "available" or\
+                        self.geoclue.provider_status(provider['object']) == "acquiring":
+                            check_gps.set_active(True)
+                            break
+                        else:
+                            check_gps.set_active(False)
+                            check_gps.set_sensitive(False)
+                            break
+            else:
+                for provider in providers:
+                    if provider['name'].lower() == "gpsd" or\
+                    provider['name'].lower() == "gypsy":
+                        if self.geoclue.provider_status(provider['object']) == "error" or\
+                        self.geoclue.provider_status(provider['object']) == "unavailable":
+                            check_gps.set_active(False)
+                            check_gps.set_sensitive(False)
+                            break
+                        
         spin_proximityfactor = wTree.get_widget("spin_proximityfactor")
         spin_proximityfactor.set_value(float(self.PROXIMITY_FACTOR))
         spin_proximityfactor.connect("changed", self.spin_proximityfactor_changed)
@@ -188,53 +380,11 @@
         
         dialog.show_all()
         
-    # converts the accuracy to a value
-    def accuracy_to_value(self, accuracy):
-        if not accuracy:
-            return 0
-        elif accuracy.lower() == "Country".lower():
-            return 1
-        elif accuracy.lower() == "Region".lower():
-            return 2
-        elif accuracy.lower() == "Locality".lower():
-            return 3
-        elif accuracy.lower() == "Postalcode".lower():
-            return 4
-        elif accuracy.lower() == "Street".lower():
-            return 5
-        elif accuracy.lower() == "Detailed".lower():
-            return 6
-        return 0 
-    
-    # converts the value of a accuracy to the accuracy
-    def value_to_accuracy(self, value):
-        if not value:
-            return None
-        elif value == 1:
-            return "Country"
-        elif value == 2:
-            return "Region"
-        elif value == 3:
-            return "Locality"
-        elif value == 4:
-            return "Postalcode"
-        elif value == 5:
-            return "Street"
-        elif value == 6:
-            return "Detailed"
-        return None
-        
-    def cmb_accuracy_changed(self, comboboxentry):
-        index = comboboxentry.get_active()
-        model = comboboxentry.get_model()
-        self.tmp_location_accuracy = self.accuracy_to_value(model[index][0])
-        
     def spin_proximityfactor_changed(self, spinbutton):
         self.tmp_proximityfactor = spinbutton.get_value()
         
     def preferences_close(self, dialog, response=None):
-        if response == gtk.RESPONSE_OK:
-            self.LOCATION_ACCURACY = self.tmp_location_accuracy 
+        if response == gtk.RESPONSE_OK: 
             self.PROXIMITY_FACTOR = float(self.tmp_proximityfactor) 
             dialog.destroy()
         else:
@@ -244,22 +394,25 @@
     
     #=== SET TASK LOCATION =========================================================
     def set_task_location(self, widget, plugin_api, location=None):
-        location = self.geoclue.get_location_info()
-        self.plugin_api = plugin_api
-        
         wTree = gtk.glade.XML(self.glade_file, "SetTaskLocation")
         dialog = wTree.get_widget("SetTaskLocation")
-        self.plugin_api.set_parent_window(dialog)
+        plugin_api.set_parent_window(dialog)
         
         btn_zoom_in = wTree.get_widget("btn_zoom_in")
         btn_zoom_out = wTree.get_widget("btn_zoom_out")
         
+        dialog_action_area_btn = wTree.get_widget("dialog_action_area_btn")
+        btn_ok = wTree.get_widget("btn_ok")
+        btn_cancel = wTree.get_widget("btn_cancel")
+        btn_close = wTree.get_widget("btn_close")
+        
         self.radiobutton1 = wTree.get_widget("radiobutton1")
         self.radiobutton2 = wTree.get_widget("radiobutton2")
         self.txt_new_tag = wTree.get_widget("txt_new_tag")
         self.cmb_existing_tag = wTree.get_widget("cmb_existing_tag")
         
         tabela = wTree.get_widget("tabela_set_task")
+        
         vbox_map = wTree.get_widget("vbox_map")
         vbox_opt = wTree.get_widget("vbox_opt")
         
@@ -306,11 +459,18 @@
                             # Possibility, use a color from another tag
                             pass
                         
-                        self.marker_list.append(layer.add_marker(plugin_api.get_task_title(), tag['location'][0], tag['location'][1], color))
+                        self.marker_list.append(layer.add_marker(plugin_api.get_task_title(),
+                                                                 tag['location'][0],
+                                                                 tag['location'][1],
+                                                                 color)
+                                                                 )
         else:
             try:
-                if location['longitude'] and location['latitude']:
-                    self.marker_list.append(layer.add_marker(plugin_api.get_task_title(), location['latitude'], location['longitude']))
+                if self.location['longitude'] and self.location['latitude']:
+                    self.marker_list.append(layer.add_marker(plugin_api.get_task_title(),
+                                                             self.location['latitude'],
+                                                             self.location['longitude'])
+                                                             )
             except:
                 self.marker_list.append(layer.add_marker(plugin_api.get_task_title(), None, None))
         
@@ -322,13 +482,15 @@
         if not task_has_location:
             # method that will change the marker's position
             champlain_view.set_reactive(True)
-            champlain_view.connect("button-release-event", self.champlain_change_marker, champlain_view)
+            champlain_view.connect("button-release-event",\
+                                   self.champlain_change_marker,\
+                                   champlain_view)
         
         layer.show_all()
         
         if task_has_location:
             champlain_view.set_property("zoom-level", 9)
-        elif location:
+        elif self.location:
             champlain_view.set_property("zoom-level", 5)
         else:
             champlain_view.set_property("zoom-level", 1)
@@ -343,7 +505,15 @@
         # connect the toolbar buttons for zoom
         btn_zoom_in.connect("clicked", self.zoom_in, champlain_view)
         btn_zoom_out.connect("clicked", self.zoom_out, champlain_view)
-        dialog.connect("response", self.set_task_location_close)
+        
+        if task_has_location:
+            dialog_action_area_btn.remove(btn_ok)
+            dialog_action_area_btn.remove(btn_cancel)
+            dialog.connect("response", self.task_location_close)
+        else:
+            dialog_action_area_btn.remove(btn_close)
+            # show a close button or the ok/cancel
+            dialog.connect("response", self.set_task_location_close, plugin_api)
         
         #if there is no location set, we want to set it
         if not task_has_location:
@@ -376,12 +546,15 @@
             champlain_view.center_on(marker_position[0], marker_position[1])
         else:
             try:
-                if location['longitude'] and location['latitude']:
-                    champlain_view.center_on(location['latitude'], location['longitude'])
+                if self.location['longitude'] and self.location['latitude']:
+                    champlain_view.center_on(self.location['latitude'], self.location['longitude'])
             except:
                 pass
     
-    def set_task_location_close(self, dialog, response=None):
+    def task_location_close(self, dialog, response=None):
+        dialog.destroy()
+    
+    def set_task_location_close(self, dialog, response=None, plugin_api=None):
         if response == gtk.RESPONSE_OK:
             # ok
             # tries to get the radiobuttons value, witch may not exist
@@ -393,29 +566,30 @@
                        
                         # because users sometimes make mistakes, I'll check if the tag exists
                         tmp_tag = ""
-                        for tag in self.plugin_api.get_tags():
+                        for tag in plugin_api.get_tags():
                             t = "@" + self.txt_new_tag.get_text().replace("@", "")
                             if tag.get_attribute("name") == t:
                                 tmp_tag = t
                         if tmp_tag:
-                            self.plugin_api.add_tag_attribute(self.txt_new_tag.get_text().replace("@", ""), 
+                            plugin_api.add_tag_attribute(self.txt_new_tag.get_text().replace("@", ""), 
                                                               "location",  
                                                               marker_position)
                         else:
-                            self.plugin_api.add_tag(self.txt_new_tag.get_text().replace("@", ""))
-                            self.plugin_api.add_tag_attribute("@" + self.txt_new_tag.get_text().replace("@", ""), 
+                            plugin_api.insert_tag(self.txt_new_tag.get_text().replace("@", ""))
+                            plugin_api.add_tag_attribute("@" + self.txt_new_tag.get_text().replace("@", ""), 
                                                               "location",  
                                                               marker_position)
                         dialog.destroy()
                     else:
-                        self.errorDialog(dialog, "Error: No tag defined", "The tag has to be defined so that the location can be associated with it.")
+                        # does nothing, no tag set.
+                        pass
                 else:
                     # radiobutton2
                     marker_position = (self.marker_list[0].get_property('latitude'), self.marker_list[0].get_property('longitude'))
                     index = self.cmb_existing_tag.get_active()
                     model = self.cmb_existing_tag.get_model()
-                    self.plugin_api.add_tag_attribute(model[index][0], "location", marker_position)
-            dialog.destroy()
+                    plugin_api.add_tag_attribute(model[index][0], "location", marker_position)
+                    dialog.destroy()
         else:
             # cancel
             dialog.destroy()
@@ -430,19 +604,16 @@
     #=== SET TASK LOCATION =========================================================
         
     #=== TAG VIEW CONTEXT MENU =====================================================
-    def on_contextmenu_tag_location(self, widget, plugin_api):
-        location = self.geoclue.get_location_info()
-        self.plugin_api_context = plugin_api
-        
+    def on_contextmenu_tag_location(self, widget, plugin_api):      
         wTree = gtk.glade.XML(self.glade_file, "TagLocation")
         dialog = wTree.get_widget("TagLocation")
-        self.plugin_api_context.set_parent_window(dialog)
+        plugin_api.set_parent_window(dialog)
         
         btn_zoom_in = wTree.get_widget("btn_zoom_in")
         btn_zoom_out = wTree.get_widget("btn_zoom_out")
         vbox_map = wTree.get_widget("vbox_map")
         
-        tag = self.plugin_api_context.get_tagpopup_tag()
+        tag = plugin_api.get_tagpopup_tag()
         dialog.set_title(tag.get_attribute("name") + "'s Location")
         
         # get the tag's location
@@ -467,8 +638,8 @@
             marker_tag = layer.add_marker(tag.get_attribute("name"), tag_location[0], tag_location[1], tag_color)
         else:
             try:
-                if location['longitude'] and location['latitude']:
-                    marker_tag = layer.add_marker(tag.get_attribute("name"), location['latitude'], location['longitude'], tag_color)
+                if self.location['longitude'] and self.location['latitude']:
+                    marker_tag = layer.add_marker(tag.get_attribute("name"), self.location['latitude'], self.location['longitude'], tag_color)
             except:
                 marker_tag = layer.add_marker(tag.get_attribute("name"), None, None)
         
@@ -484,7 +655,7 @@
         
         if tag_location:
             champlain_view.set_property("zoom-level", 9)
-        elif location:
+        elif self.location:
             champlain_view.set_property("zoom-level", 5)
         else:
             champlain_view.set_property("zoom-level", 1)      
@@ -508,8 +679,8 @@
             champlain_view.center_on(marker_position[0], marker_position[1])
         else:
             try:
-                if location['longitude'] and location['latitude']:
-                    champlain_view.center_on(location['latitude'], location['longitude'])
+                if self.location['longitude'] and self.location['latitude']:
+                    champlain_view.center_on(self.location['latitude'], self.location['longitude'])
             except:
                 pass
     
@@ -547,19 +718,4 @@
         r, g, b = colorstring[:2], colorstring[2:4], colorstring[4:]
         r, g, b = [int(n, 16) for n in (r, g, b)]
         return clutter.Color(r, g, b)
-    
-    # error dialog
-    def errorDialog(self, parent, header, msg):
-         """
-         Show an error message.
-         """
-
-         dialog = gtk.MessageDialog(parent,
-                               flags=gtk.DIALOG_MODAL,
-                               type=gtk.MESSAGE_ERROR,
-                               buttons=gtk.BUTTONS_CLOSE)
-         dialog.set_title("")
-         dialog.set_markup("<big><b>%s</b></big>\n\n%s" % (header, msg))
-         dialog.realize()
-         dialog.run()
-         dialog.destroy()
\ No newline at end of file
+    
\ No newline at end of file

=== modified file 'GTG/taskbrowser/browser.py'
--- GTG/taskbrowser/browser.py	2009-08-11 11:15:14 +0000
+++ GTG/taskbrowser/browser.py	2009-08-11 12:19:20 +0000
@@ -142,8 +142,8 @@
         self.priv["ctasklist"]["sort_order"]  = gtk.SORT_ASCENDING
         self.priv['selected_rows']            = None
         self.priv['workview']                 = False
-        #self.priv['noteview']                 = False
-        self.priv['workview_task_filter']     = []
+        #self.priv['noteview']                = False
+        self.priv['filter_cbs']               = []
 
     def _init_icon_theme(self):
         icon_dirs = [GTG.DATA_DIR, os.path.join(GTG.DATA_DIR, "icons")]
@@ -437,8 +437,8 @@
         self.plugins = self.pengine.LoadPlugins()
         
         # initializes the plugin api class
-        self.plugin_api = PluginAPI(self.window, self.config, self.wTree, self.req, \
-                                    self.task_tv, self.priv['workview_task_filter'], \
+        self.plugin_api = PluginAPI(self.window, self.config, self.wTree,\
+                                    self.req, self.task_tv, self.priv['filter_cbs'],\
                                     self.tagpopup, self.tags_tv, None, None)
         
         if self.plugins:
@@ -737,15 +737,19 @@
         """
 
         tag_list, notag_only = self.get_selected_tags()
-        
-        if task in self.priv['workview_task_filter']:
-            return False
 
         if not task.has_tags(tag_list=tag_list, notag_only=notag_only):
             return False
 
         if self.priv['workview']:
             res = True
+            
+            # filter tasks view callbacks
+            for cb in self.priv['filter_cbs']:
+                res = cb(task.get_id())
+                if res == False:
+                    return False
+            
             for t in task.get_tags():
                 if t.get_attribute("nonworkview"):
                     res = res and (not eval(t.get_attribute("nonworkview")))
@@ -867,6 +871,14 @@
 ### SIGNAL CALLBACKS ##########################################################
 # Typically, reaction to user input & interactions with the GUI
 #
+    def register_filter_callback(self, cb):
+        if cb not in self.priv['filter_cbs']:
+            self.priv['filter_cbs'].append(cb)
+        
+    def unregister_filter_callback(self, cb):
+        if cb in self.priv['filter_cbs']:
+            self.priv['filter_cbs'].remove(cb)
+        
     def on_move(self, widget, data):
         xpos, ypos = self.window.get_position()
         self.priv["window_xpos"] = xpos

=== modified file 'GTG/taskeditor/editor.py'
--- GTG/taskeditor/editor.py	2009-08-11 11:12:44 +0000
+++ GTG/taskeditor/editor.py	2009-08-11 12:19:20 +0000
@@ -158,7 +158,8 @@
         # plugins
         self.plugins = plugins
         self.pengine = PluginEngine(PLUGIN_DIR)
-        self.te_plugin_api = PluginAPI(self.window, None, self.wTree, self.req, None, None, None, None, task, self.textview)
+        self.te_plugin_api = PluginAPI(self.window, None, self.wTree, self.req, 
+                                       None, None, None, None, task, self.textview)
         self.pengine.onTaskLoad(self.plugins, self.te_plugin_api)
         
         #Putting the refresh callback at the end make the start a lot faster


References