[hamster-applet] preference to integrate with TODO apps (evo, gtg)



commit 342c247f144485360e1675c18d99ea52a4a916c1
Author: Toms Bauģis <toms baugis gmail com>
Date:   Fri May 14 18:13:15 2010 +0100

    preference to integrate with TODO apps (evo, gtg)

 data/preferences.ui          |   66 +++++++++++++++++++++++++++++++++++-------
 src/hamster/configuration.py |   25 ++++++++-------
 src/hamster/preferences.py   |   19 ++++++++++++
 3 files changed, 87 insertions(+), 23 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index b640201..58ce9a8 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -23,7 +23,6 @@
     <child>
       <object class="GtkVBox" id="big_box">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
         <property name="spacing">8</property>
         <child>
           <object class="GtkNotebook" id="notebook1">
@@ -39,7 +38,6 @@
                 <child>
                   <object class="GtkVBox" id="vbox1">
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
                     <property name="spacing">20</property>
                     <child>
                       <object class="GtkFrame" id="frame3">
@@ -54,7 +52,6 @@
                             <child>
                               <object class="GtkVBox" id="vbox7">
                                 <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
                                 <property name="spacing">8</property>
                                 <child>
                                   <object class="GtkCheckButton" id="shutdown_track">
@@ -98,7 +95,6 @@
                                         <child>
                                           <object class="GtkVBox" id="vbox3">
                                             <property name="visible">True</property>
-                                            <property name="orientation">vertical</property>
                                             <child>
                                               <object class="GtkHScale" id="notify_interval">
                                                 <property name="visible">True</property>
@@ -207,6 +203,60 @@
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkFrame" id="frame4">
+                        <property name="visible">True</property>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">none</property>
+                        <child>
+                          <object class="GtkAlignment" id="alignment11">
+                            <property name="visible">True</property>
+                            <property name="top_padding">8</property>
+                            <property name="left_padding">12</property>
+                            <child>
+                              <object class="GtkHBox" id="hbox4">
+                                <property name="visible">True</property>
+                                <child>
+                                  <object class="GtkLabel" id="label12">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">Use following todo list:</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="padding">4</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkAlignment" id="todo_pick">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                        <child type="label">
+                          <object class="GtkLabel" id="label11">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Integration</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkFrame" id="frame1">
                         <property name="visible">True</property>
                         <property name="label_xalign">0</property>
@@ -240,7 +290,7 @@
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="position">1</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                   </object>
@@ -266,7 +316,6 @@
                 <child>
                   <object class="GtkVBox" id="vbox2">
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
                     <property name="spacing">15</property>
                     <child>
                       <object class="GtkFrame" id="frame2">
@@ -288,7 +337,6 @@
                                     <property name="width_request">150</property>
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="orientation">vertical</property>
                                     <property name="spacing">4</property>
                                     <child>
                                       <object class="GtkLabel" id="categories_label">
@@ -427,7 +475,6 @@
                                   <object class="GtkVBox" id="vbox5">
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="orientation">vertical</property>
                                     <property name="spacing">4</property>
                                     <child>
                                       <object class="GtkLabel" id="activities_label">
@@ -707,7 +754,6 @@
                 <child>
                   <object class="GtkVBox" id="vbox8">
                     <property name="visible">True</property>
-                    <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkFrame" id="workspace_frame">
                         <property name="visible">True</property>
@@ -722,7 +768,6 @@
                             <child>
                               <object class="GtkVBox" id="vbox6">
                                 <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
                                 <property name="spacing">8</property>
                                 <child>
                                   <object class="GtkCheckButton" id="workspace_tracking_memory">
@@ -741,7 +786,6 @@
                                 <child>
                                   <object class="GtkVBox" id="vbox9">
                                     <property name="visible">True</property>
-                                    <property name="orientation">vertical</property>
                                     <child>
                                       <object class="GtkCheckButton" id="workspace_tracking_name">
                                         <property name="label" translatable="yes">Start new activity when switching workspaces:</property>
diff --git a/src/hamster/configuration.py b/src/hamster/configuration.py
index 2f37701..e79a64b 100644
--- a/src/hamster/configuration.py
+++ b/src/hamster/configuration.py
@@ -162,18 +162,19 @@ class GConfStore(gobject.GObject, Singleton):
     GCONF_DIR = "/apps/hamster-applet/"
     VALID_KEY_TYPES = (bool, str, int, list, tuple)
     DEFAULTS = {
-        'enable_timeout'            :   False,          # Should hamster stop tracking on idle
-        'stop_on_shutdown'          :   False,          # Should hamster stop tracking on shutdown
-        'notify_on_idle'            :   False,          # Remind also if no activity is set
-        'notify_interval'           :   27,             # Remind of current activity every X minutes
-        'day_start_minutes'         :   5 * 60 + 30,    # At what time does the day start (5:30AM)
-        'keybinding'                :   "<Super>H",     # Key binding to summon hamster
-        'overview_window_box'       :   [],             # X, Y, W, H
-        'overview_window_maximized' :   False,          # Is overview window maximized
-        'workspace_tracking'        :   [],             # Should hamster switch activities on workspace change 0,1,2
-        'workspace_mapping'         :   [],             # Mapping between workspace numbers and activities
-        'standalone_window_box'       :   [],             # X, Y, W, H
-        'standalone_window_maximized' :   False,          # Is overview window maximized
+        'enable_timeout'              :   False,       # Should hamster stop tracking on idle
+        'stop_on_shutdown'            :   False,       # Should hamster stop tracking on shutdown
+        'notify_on_idle'              :   False,       # Remind also if no activity is set
+        'notify_interval'             :   27,          # Remind of current activity every X minutes
+        'day_start_minutes'           :   5 * 60 + 30, # At what time does the day start (5:30AM)
+        'keybinding'                  :   "<Super>H",  # Key binding to summon hamster
+        'overview_window_box'         :   [],          # X, Y, W, H
+        'overview_window_maximized'   :   False,       # Is overview window maximized
+        'workspace_tracking'          :   [],          # Should hamster switch activities on workspace change 0,1,2
+        'workspace_mapping'           :   [],          # Mapping between workspace numbers and activities
+        'standalone_window_box'       :   [],          # X, Y, W, H
+        'standalone_window_maximized' :   False,       # Is overview window maximized
+        'activities_source'           :   "",           # Source of TODO items ("", "evo", "gtg")
     }
 
     __gsignals__ = {
diff --git a/src/hamster/preferences.py b/src/hamster/preferences.py
index 6427afa..6d3bf55 100755
--- a/src/hamster/preferences.py
+++ b/src/hamster/preferences.py
@@ -108,6 +108,15 @@ class PreferencesEditor:
         self._gui = stuff.load_ui_file("preferences.ui")
         self.window = self.get_widget('preferences_window')
 
+        self.activities_sources = [("", _("None")),
+                                   ("evo", "Evolution"),
+                                   ("gtg", "Getting Things Gnome")]
+        self.todo_combo = gtk.combo_box_new_text()
+        for code, label in self.activities_sources:
+            self.todo_combo.append_text(label)
+        self.todo_combo.connect("changed", self.on_todo_combo_changed)
+        self.get_widget("todo_pick").add(self.todo_combo)
+
 
         # create and fill activity tree
         self.activity_tree = self.get_widget('activity_list')
@@ -233,6 +242,10 @@ class PreferencesEditor:
         self._gui.connect_signals(self)
         self.window.show_all()
 
+
+    def on_todo_combo_changed(self, combo):
+        conf.set("activities_source", self.activities_sources[combo.get_active()][0])
+
     def workspace_name_celldata(self, column, cell, model, iter, user_data=None):
         name = model.get_value(iter, 1).get_name()
         cell.set_property('text', str(name))
@@ -287,6 +300,12 @@ class PreferencesEditor:
         self.get_widget("workspace_list").set_sensitive(self.get_widget("workspace_tracking_name").get_active())
 
 
+        current_source = conf.get("activities_source")
+        for i, (code, label) in enumerate(self.activities_sources):
+            if code == current_source:
+                self.todo_combo.set_active(i)
+
+
     def on_autocomplete_tags_view_focus_out_event(self, view, event):
         buf = self.get_widget("autocomplete_tags")
         updated_tags = buf.get_text(buf.get_start_iter(), buf.get_end_iter(), 0) \



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