[hamster-applet] now it is possible to clean out the tags autocomplete list



commit 05f38b54b97d372b5550ceb9d4c99d3bde51b05a
Author: Toms Bauģis <toms baugis gmail com>
Date:   Tue Dec 1 01:32:07 2009 +0000

    now it is possible to clean out the tags autocomplete list

 data/preferences.ui    | 1018 +++++++++++++++++++++++++++---------------------
 hamster/preferences.py |   17 +-
 hamster/storage.py     |    5 +-
 3 files changed, 586 insertions(+), 454 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index 1eaa5ed..2465e52 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <interface>
-  <!-- interface-requires gtk+ 2.12 -->
-  <!-- interface-naming-policy toplevel-contextual -->
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
   <object class="GtkAdjustment" id="adjustment1">
     <property name="value">5</property>
     <property name="lower">5</property>
@@ -13,423 +13,621 @@
     <property name="border_width">12</property>
     <property name="title" translatable="yes">Time Tracker Preferences</property>
     <property name="window_position">center</property>
-    <property name="default_width">550</property>
-    <property name="default_height">550</property>
+    <property name="default_width">450</property>
+    <property name="default_height">450</property>
     <property name="destroy_with_parent">True</property>
     <property name="icon_name">hamster-applet</property>
     <signal name="destroy" handler="on_preferences_window_destroy"/>
     <signal name="key_press_event" handler="on_preferences_window_key_press"/>
     <signal name="delete_event" handler="on_close"/>
     <child>
-      <object class="GtkVBox" id="vbox1">
+      <object class="GtkVBox" id="big_box">
         <property name="visible">True</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">12</property>
+        <property name="spacing">8</property>
         <child>
-          <object class="GtkFrame" id="frame2">
-            <property name="height_request">200</property>
+          <object class="GtkNotebook" id="notebook1">
             <property name="visible">True</property>
-            <property name="label_xalign">0</property>
-            <property name="shadow_type">none</property>
+            <property name="can_focus">True</property>
             <child>
-              <object class="GtkAlignment" id="alignment3">
+              <object class="GtkAlignment" id="alignment2">
                 <property name="visible">True</property>
-                <property name="top_padding">6</property>
-                <property name="left_padding">12</property>
+                <property name="top_padding">12</property>
+                <property name="bottom_padding">8</property>
+                <property name="left_padding">4</property>
+                <property name="right_padding">4</property>
                 <child>
-                  <object class="GtkHPaned" id="hpaned1">
+                  <object class="GtkVBox" id="vbox1">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">20</property>
                     <child>
-                      <object class="GtkVBox" id="vbox3">
-                        <property name="width_request">150</property>
+                      <object class="GtkFrame" id="frame3">
                         <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">
-                            <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="xalign">0</property>
-                            <property name="label" translatable="yes">_Categories</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">category_list</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkScrolledWindow" id="scrolledwindow2">
-                            <property name="visible">True</property>
-                            <property name="can_focus">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="hscrollbar_policy">automatic</property>
-                            <property name="vscrollbar_policy">automatic</property>
-                            <property name="shadow_type">in</property>
-                            <child>
-                              <object class="GtkTreeView" id="category_list">
-                                <property name="visible">True</property>
-                                <property name="can_focus">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="headers_visible">False</property>
-                                <property name="enable_search">False</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="category_list-atkobject">
-                                    <property name="AtkObject::accessible-name" translatable="yes">Category list</property>
-                                  </object>
-                                </child>
-                                <signal name="button_press_event" handler="on_category_list_button_pressed"/>
-                                <signal name="drag_motion" handler="on_category_list_drag_motion"/>
-                                <signal name="key_press_event" handler="on_category_list_key_pressed"/>
-                                <signal name="button_release_event" handler="on_category_list_button_released"/>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">none</property>
                         <child>
-                          <object class="GtkHBox" id="hbox3">
+                          <object class="GtkAlignment" id="alignment4">
                             <property name="visible">True</property>
-                            <property name="spacing">4</property>
+                            <property name="top_padding">6</property>
+                            <property name="left_padding">12</property>
                             <child>
-                              <object class="GtkButton" id="category_add">
+                              <object class="GtkVBox" id="vbox7">
                                 <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="category_add-atkobject">
-                                    <property name="AtkObject::accessible-name" translatable="yes">Add category</property>
-                                  </object>
-                                </child>
-                                <signal name="clicked" handler="on_category_add_clicked"/>
+                                <property name="orientation">vertical</property>
+                                <property name="spacing">8</property>
                                 <child>
-                                  <object class="GtkImage" id="image1">
+                                  <object class="GtkCheckButton" id="shutdown_track">
+                                    <property name="label" translatable="yes">Stop tracking on shutdown</property>
                                     <property name="visible">True</property>
-                                    <property name="icon_name">list-add</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkButton" id="category_remove">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="category_remove-atkobject">
-                                    <property name="AtkObject::accessible-name" translatable="yes">Remove category</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>
+                                    <signal name="toggled" handler="on_shutdown_track_toggled"/>
                                   </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
                                 </child>
-                                <signal name="clicked" handler="on_category_remove_clicked"/>
                                 <child>
-                                  <object class="GtkImage" id="image2">
+                                  <object class="GtkCheckButton" id="idle_track">
+                                    <property name="label" translatable="yes">Stop tracking when computer becomes idle</property>
                                     <property name="visible">True</property>
-                                    <property name="icon_name">list-remove</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>
+                                    <signal name="toggled" handler="on_idle_track_toggled"/>
                                   </object>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
                                 </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkButton" id="category_edit">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="category_edit-atkobject">
-                                    <property name="AtkObject::accessible-name" translatable="yes">Edit category</property>
+                                <child>
+                                  <object class="GtkFrame" id="notification_preference_frame">
+                                    <property name="visible">True</property>
+                                    <property name="no_show_all">True</property>
+                                    <property name="label_xalign">0</property>
+                                    <property name="shadow_type">none</property>
+                                    <child>
+                                      <object class="GtkAlignment" id="alignment3">
+                                        <property name="visible">True</property>
+                                        <property name="left_padding">12</property>
+                                        <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>
+                                                <property name="can_focus">True</property>
+                                                <property name="adjustment">adjustment1</property>
+                                                <property name="show_fill_level">True</property>
+                                                <property name="restrict_to_fill_level">False</property>
+                                                <property name="digits">0</property>
+                                                <property name="value_pos">bottom</property>
+                                                <signal name="value_changed" handler="on_notify_interval_value_changed"/>
+                                                <signal name="format_value" handler="on_notify_interval_format_value"/>
+                                              </object>
+                                              <packing>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkAlignment" id="alignment1">
+                                                <property name="visible">True</property>
+                                                <property name="top_padding">8</property>
+                                                <property name="left_padding">4</property>
+                                                <child>
+                                                  <object class="GtkCheckButton" id="notify_on_idle">
+                                                    <property name="label" translatable="yes">Also remind when no activity is set</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>
+                                                    <signal name="toggled" handler="on_notify_on_idle_toggled"/>
+                                                  </object>
+                                                </child>
+                                              </object>
+                                              <packing>
+                                                <property name="position">1</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                        </child>
+                                      </object>
+                                    </child>
+                                    <child type="label">
+                                      <object class="GtkLabel" id="label1">
+                                        <property name="visible">True</property>
+                                        <property name="label" translatable="yes">Remind of current activity every:</property>
+                                        <property name="use_markup">True</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                    </child>
                                   </object>
+                                  <packing>
+                                    <property name="padding">8</property>
+                                    <property name="position">2</property>
+                                  </packing>
                                 </child>
-                                <signal name="clicked" handler="on_category_edit_clicked"/>
                                 <child>
-                                  <object class="GtkImage" id="image3">
+                                  <object class="GtkHBox" id="hbox1">
                                     <property name="visible">True</property>
-                                    <property name="icon_name">gtk-edit</property>
+                                    <child>
+                                      <object class="GtkLabel" id="label4">
+                                        <property name="visible">True</property>
+                                        <property name="label" translatable="yes">New day starts at</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="day_start_placeholder">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <placeholder/>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </object>
+                                  <packing>
+                                    <property name="position">3</property>
+                                  </packing>
                                 </child>
                               </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <placeholder/>
                             </child>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="position">2</property>
-                          </packing>
+                        </child>
+                        <child type="label">
+                          <object class="GtkLabel" id="label3">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Tracking</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
                         </child>
                       </object>
                       <packing>
-                        <property name="resize">False</property>
-                        <property name="shrink">True</property>
+                        <property name="expand">False</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkVBox" id="vbox4">
+                      <object class="GtkFrame" id="frame1">
                         <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>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">none</property>
                         <child>
-                          <object class="GtkLabel" id="activities_label">
+                          <object class="GtkAlignment" id="alignment6">
                             <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="xalign">0</property>
-                            <property name="label" translatable="yes">_Activities</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">activity_list</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkAlignment" id="alignment8">
-                            <property name="visible">True</property>
+                            <property name="xscale">0.10000000149011612</property>
+                            <property name="top_padding">8</property>
+                            <property name="left_padding">12</property>
                             <child>
-                              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                              <object class="GtkEntry" id="keybinding">
                                 <property name="visible">True</property>
                                 <property name="can_focus">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="hscrollbar_policy">automatic</property>
-                                <property name="vscrollbar_policy">automatic</property>
-                                <property name="shadow_type">in</property>
-                                <child>
-                                  <object class="GtkTreeView" id="activity_list">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">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="headers_visible">False</property>
-                                    <property name="rules_hint">True</property>
-                                    <property name="enable_search">False</property>
-                                    <property name="enable_tree_lines">True</property>
-                                    <child internal-child="accessible">
-                                      <object class="AtkObject" id="activity_list-atkobject">
-                                        <property name="AtkObject::accessible-name" translatable="yes">Activity list</property>
-                                      </object>
-                                    </child>
-                                    <signal name="button_press_event" handler="on_activity_list_button_pressed"/>
-                                    <signal name="drag_motion" handler="on_activity_list_drag_motion"/>
-                                    <signal name="key_press_event" handler="on_activity_list_key_pressed"/>
-                                    <signal name="button_release_event" handler="on_activity_list_button_released"/>
-                                  </object>
-                                </child>
+                                <property name="invisible_char">&#x2022;</property>
+                                <signal name="changed" handler="on_keybinding_changed"/>
                               </object>
                             </child>
                           </object>
-                          <packing>
-                            <property name="position">1</property>
-                          </packing>
                         </child>
-                        <child>
-                          <object class="GtkHBox" id="hbox2">
+                        <child type="label">
+                          <object class="GtkLabel" id="label7">
                             <property name="visible">True</property>
-                            <property name="spacing">4</property>
-                            <child>
-                              <object class="GtkButton" id="activity_add">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="activity_add-atkobject">
-                                    <property name="AtkObject::accessible-name" translatable="yes">Add activity</property>
-                                  </object>
-                                </child>
-                                <signal name="clicked" handler="on_activity_add_clicked"/>
-                                <child>
-                                  <object class="GtkImage" id="image4">
-                                    <property name="visible">True</property>
-                                    <property name="icon_name">list-add</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkButton" id="activity_remove">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="activity_remove-atkobject">
-                                    <property name="AtkObject::accessible-name" translatable="yes">Remove activity</property>
-                                  </object>
-                                </child>
-                                <signal name="clicked" handler="on_activity_remove_clicked"/>
-                                <child>
-                                  <object class="GtkImage" id="image5">
-                                    <property name="visible">True</property>
-                                    <property name="icon_name">list-remove</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkButton" id="activity_edit">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="activity_edit-atkobject">
-                                    <property name="AtkObject::accessible-name" translatable="yes">Edit activity</property>
-                                  </object>
-                                </child>
-                                <signal name="clicked" handler="on_activity_edit_clicked"/>
-                                <child>
-                                  <object class="GtkImage" id="image6">
-                                    <property name="visible">True</property>
-                                    <property name="icon_name">gtk-edit</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkButton" id="activity_up">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="activity_up-atkobject">
-                                    <property name="AtkObject::accessible-name" translatable="yes">Move activity up</property>
-                                  </object>
-                                </child>
-                                <signal name="clicked" handler="on_activity_up_clicked"/>
-                                <child>
-                                  <object class="GtkImage" id="image7">
-                                    <property name="visible">True</property>
-                                    <property name="icon_name">up</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">3</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkButton" id="activity_down">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">True</property>
-                                <child internal-child="accessible">
-                                  <object class="AtkObject" id="activity_down-atkobject">
-                                    <property name="AtkObject::accessible-name" translatable="yes">Move activity down</property>
-                                  </object>
-                                </child>
-                                <signal name="clicked" handler="on_activity_down_clicked"/>
-                                <child>
-                                  <object class="GtkImage" id="image8">
-                                    <property name="visible">True</property>
-                                    <property name="icon_name">down</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="position">4</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
+                            <property name="label" translatable="yes">Global Hotkey</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="position">2</property>
-                          </packing>
                         </child>
                       </object>
                       <packing>
-                        <property name="resize">True</property>
-                        <property name="shrink">True</property>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                 </child>
               </object>
             </child>
-            <child type="label">
+            <child type="tab">
               <object class="GtkLabel" id="label2">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">&lt;b&gt;Activities&lt;/b&gt;</property>
-                <property name="use_markup">True</property>
+                <property name="label" translatable="yes">General</property>
               </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
             </child>
-          </object>
-          <packing>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkFrame" id="frame3">
-            <property name="visible">True</property>
-            <property name="label_xalign">0</property>
-            <property name="shadow_type">none</property>
             <child>
-              <object class="GtkAlignment" id="alignment4">
+              <object class="GtkAlignment" id="alignment5">
                 <property name="visible">True</property>
-                <property name="top_padding">6</property>
-                <property name="left_padding">12</property>
+                <property name="top_padding">12</property>
+                <property name="bottom_padding">8</property>
+                <property name="left_padding">4</property>
+                <property name="right_padding">4</property>
                 <child>
-                  <object class="GtkVBox" id="vbox7">
+                  <object class="GtkVBox" id="vbox2">
                     <property name="visible">True</property>
                     <property name="orientation">vertical</property>
+                    <property name="spacing">15</property>
                     <child>
-                      <object class="GtkHBox" id="hbox1">
+                      <object class="GtkFrame" id="frame2">
+                        <property name="height_request">200</property>
                         <property name="visible">True</property>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">none</property>
                         <child>
-                          <object class="GtkLabel" id="label4">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">New day starts at</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="day_start_placeholder">
+                          <object class="GtkAlignment" id="alignment7">
                             <property name="visible">True</property>
+                            <property name="top_padding">6</property>
+                            <property name="left_padding">12</property>
                             <child>
-                              <placeholder/>
+                              <object class="GtkHPaned" id="hpaned1">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <child>
+                                  <object class="GtkVBox" id="vbox4">
+                                    <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">
+                                        <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="xalign">0</property>
+                                        <property name="label" translatable="yes">_Categories</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="mnemonic_widget">category_list</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkScrolledWindow" id="scrolledwindow2">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">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="hscrollbar_policy">automatic</property>
+                                        <property name="vscrollbar_policy">automatic</property>
+                                        <property name="shadow_type">in</property>
+                                        <child>
+                                          <object class="GtkTreeView" id="category_list">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">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="headers_visible">False</property>
+                                            <property name="enable_search">False</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="category_list-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">Category list</property>
+                                              </object>
+                                            </child>
+                                            <signal name="button_press_event" handler="on_category_list_button_pressed"/>
+                                            <signal name="drag_motion" handler="on_category_list_drag_motion"/>
+                                            <signal name="key_press_event" handler="on_category_list_key_pressed"/>
+                                            <signal name="button_release_event" handler="on_category_list_button_released"/>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkHBox" id="hbox3">
+                                        <property name="visible">True</property>
+                                        <property name="spacing">4</property>
+                                        <child>
+                                          <object class="GtkButton" id="category_add">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="category_add-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">Add category</property>
+                                              </object>
+                                            </child>
+                                            <signal name="clicked" handler="on_category_add_clicked"/>
+                                            <child>
+                                              <object class="GtkImage" id="image1">
+                                                <property name="visible">True</property>
+                                                <property name="icon_name">list-add</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="category_remove">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="category_remove-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">Remove category</property>
+                                              </object>
+                                            </child>
+                                            <signal name="clicked" handler="on_category_remove_clicked"/>
+                                            <child>
+                                              <object class="GtkImage" id="image2">
+                                                <property name="visible">True</property>
+                                                <property name="icon_name">list-remove</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="category_edit">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="category_edit-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">Edit category</property>
+                                              </object>
+                                            </child>
+                                            <signal name="clicked" handler="on_category_edit_clicked"/>
+                                            <child>
+                                              <object class="GtkImage" id="image3">
+                                                <property name="visible">True</property>
+                                                <property name="icon_name">gtk-edit</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">2</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <placeholder/>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="resize">False</property>
+                                    <property name="shrink">True</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <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">
+                                        <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="xalign">0</property>
+                                        <property name="label" translatable="yes">_Activities</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="mnemonic_widget">activity_list</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkAlignment" id="alignment8">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <object class="GtkScrolledWindow" id="scrolledwindow1">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">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="hscrollbar_policy">automatic</property>
+                                            <property name="vscrollbar_policy">automatic</property>
+                                            <property name="shadow_type">in</property>
+                                            <child>
+                                              <object class="GtkTreeView" id="activity_list">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">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="headers_visible">False</property>
+                                                <property name="rules_hint">True</property>
+                                                <property name="enable_search">False</property>
+                                                <property name="enable_tree_lines">True</property>
+                                                <child internal-child="accessible">
+                                                  <object class="AtkObject" id="activity_list-atkobject">
+                                                    <property name="AtkObject::accessible-name" translatable="yes">Activity list</property>
+                                                  </object>
+                                                </child>
+                                                <signal name="button_press_event" handler="on_activity_list_button_pressed"/>
+                                                <signal name="drag_motion" handler="on_activity_list_drag_motion"/>
+                                                <signal name="key_press_event" handler="on_activity_list_key_pressed"/>
+                                                <signal name="button_release_event" handler="on_activity_list_button_released"/>
+                                              </object>
+                                            </child>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkHBox" id="hbox2">
+                                        <property name="visible">True</property>
+                                        <property name="spacing">4</property>
+                                        <child>
+                                          <object class="GtkButton" id="activity_add">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="activity_add-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">Add activity</property>
+                                              </object>
+                                            </child>
+                                            <signal name="clicked" handler="on_activity_add_clicked"/>
+                                            <child>
+                                              <object class="GtkImage" id="image4">
+                                                <property name="visible">True</property>
+                                                <property name="icon_name">list-add</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="activity_remove">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="activity_remove-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">Remove activity</property>
+                                              </object>
+                                            </child>
+                                            <signal name="clicked" handler="on_activity_remove_clicked"/>
+                                            <child>
+                                              <object class="GtkImage" id="image5">
+                                                <property name="visible">True</property>
+                                                <property name="icon_name">list-remove</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="activity_edit">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="activity_edit-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">Edit activity</property>
+                                              </object>
+                                            </child>
+                                            <signal name="clicked" handler="on_activity_edit_clicked"/>
+                                            <child>
+                                              <object class="GtkImage" id="image6">
+                                                <property name="visible">True</property>
+                                                <property name="icon_name">gtk-edit</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">2</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="activity_up">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="activity_up-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">Move activity up</property>
+                                              </object>
+                                            </child>
+                                            <signal name="clicked" handler="on_activity_up_clicked"/>
+                                            <child>
+                                              <object class="GtkImage" id="image7">
+                                                <property name="visible">True</property>
+                                                <property name="icon_name">up</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">3</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkButton" id="activity_down">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="receives_default">True</property>
+                                            <child internal-child="accessible">
+                                              <object class="AtkObject" id="activity_down-atkobject">
+                                                <property name="AtkObject::accessible-name" translatable="yes">Move activity down</property>
+                                              </object>
+                                            </child>
+                                            <signal name="clicked" handler="on_activity_down_clicked"/>
+                                            <child>
+                                              <object class="GtkImage" id="image8">
+                                                <property name="visible">True</property>
+                                                <property name="icon_name">down</property>
+                                              </object>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="position">4</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <placeholder/>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                  <packing>
+                                    <property name="resize">True</property>
+                                    <property name="shrink">True</property>
+                                  </packing>
+                                </child>
+                              </object>
                             </child>
                           </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="position">1</property>
-                          </packing>
                         </child>
-                        <child>
-                          <placeholder/>
+                        <child type="label">
+                          <object class="GtkLabel" id="label6">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Activities</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
                         </child>
                       </object>
                       <packing>
@@ -437,154 +635,71 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="shutdown_track">
-                        <property name="label" translatable="yes">Stop tracking on shutdown</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>
-                        <signal name="toggled" handler="on_shutdown_track_toggled"/>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkCheckButton" id="idle_track">
-                        <property name="label" translatable="yes">Stop tracking when computer becomes idle</property>
+                      <object class="GtkFrame" id="tags_frame">
                         <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>
-                        <signal name="toggled" handler="on_idle_track_toggled"/>
-                      </object>
-                      <packing>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkFrame" id="notification_preference_frame">
-                        <property name="visible">True</property>
-                        <property name="no_show_all">True</property>
                         <property name="label_xalign">0</property>
                         <property name="shadow_type">none</property>
                         <child>
-                          <object class="GtkAlignment" id="alignment1">
+                          <object class="GtkAlignment" id="alignment9">
                             <property name="visible">True</property>
+                            <property name="top_padding">8</property>
                             <property name="left_padding">12</property>
                             <child>
-                              <object class="GtkVBox" id="vbox2">
+                              <object class="GtkScrolledWindow" id="scrolledwindow3">
                                 <property name="visible">True</property>
-                                <property name="orientation">vertical</property>
+                                <property name="can_focus">True</property>
+                                <property name="hscrollbar_policy">automatic</property>
+                                <property name="vscrollbar_policy">automatic</property>
+                                <property name="shadow_type">in</property>
                                 <child>
-                                  <object class="GtkHScale" id="notify_interval">
+                                  <object class="GtkTextView" id="autocomplete_tags_view">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
-                                    <property name="adjustment">adjustment1</property>
-                                    <property name="show_fill_level">True</property>
-                                    <property name="restrict_to_fill_level">False</property>
-                                    <property name="digits">0</property>
-                                    <property name="value_pos">bottom</property>
-                                    <signal name="value_changed" handler="on_notify_interval_value_changed"/>
-                                    <signal name="format_value" handler="on_notify_interval_format_value"/>
-                                  </object>
-                                  <packing>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkAlignment" id="alignment2">
-                                    <property name="visible">True</property>
-                                    <property name="top_padding">8</property>
-                                    <property name="left_padding">4</property>
-                                    <child>
-                                      <object class="GtkCheckButton" id="notify_on_idle">
-                                        <property name="label" translatable="yes">Also remind when no activity is set</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>
-                                        <signal name="toggled" handler="on_notify_on_idle_toggled"/>
-                                      </object>
-                                    </child>
+                                    <property name="wrap_mode">word-char</property>
+                                    <property name="buffer">autocomplete_tags</property>
+                                    <property name="accepts_tab">False</property>
+                                    <signal name="focus_out_event" handler="on_autocomplete_tags_view_focus_out_event"/>
                                   </object>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                               </object>
                             </child>
                           </object>
                         </child>
                         <child type="label">
-                          <object class="GtkLabel" id="label1">
+                          <object class="GtkLabel" id="label5">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Remind of current activity every:</property>
+                            <property name="label" translatable="yes">Tags that should appear in autocomplete</property>
                             <property name="use_markup">True</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">notify_interval</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
                           </object>
                         </child>
                       </object>
                       <packing>
-                        <property name="padding">8</property>
-                        <property name="position">3</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                   </object>
                 </child>
               </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
             </child>
-            <child type="label">
-              <object class="GtkLabel" id="label3">
-                <property name="visible">True</property>
-                <property name="label" translatable="yes">&lt;b&gt;Tracking&lt;/b&gt;</property>
-                <property name="use_markup">True</property>
-              </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>
-            <property name="shadow_type">none</property>
-            <child>
-              <object class="GtkAlignment" id="alignment6">
-                <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="xscale">0.10000000149011612</property>
-                <property name="top_padding">8</property>
-                <property name="left_padding">12</property>
-                <child>
-                  <object class="GtkEntry" id="keybinding">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="invisible_char">&#x25CF;</property>
-                    <signal name="changed" handler="on_keybinding_changed"/>
-                  </object>
-                </child>
-              </object>
-            </child>
-            <child type="label">
-              <object class="GtkLabel" id="label7">
+            <child type="tab">
+              <object class="GtkLabel" id="label8">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">&lt;b&gt;Global Hotkey&lt;/b&gt;</property>
-                <property name="use_markup">True</property>
+                <property name="label" translatable="yes">Categories and Tags</property>
               </object>
+              <packing>
+                <property name="position">1</property>
+                <property name="tab_fill">False</property>
+              </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">False</property>
-            <property name="position">2</property>
+            <property name="position">0</property>
           </packing>
         </child>
         <child>
@@ -609,10 +724,11 @@
           </object>
           <packing>
             <property name="expand">False</property>
-            <property name="position">3</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
     </child>
   </object>
+  <object class="GtkTextBuffer" id="autocomplete_tags"/>
 </interface>
diff --git a/hamster/preferences.py b/hamster/preferences.py
index 89b3e6a..1b2673c 100755
--- a/hamster/preferences.py
+++ b/hamster/preferences.py
@@ -149,8 +149,6 @@ class PreferencesEditor:
 
         self.load_config()
 
-        self._gui.connect_signals(self)
-
         # Allow enable drag and drop of rows including row move
         self.activity_tree.enable_model_drag_source( gtk.gdk.BUTTON1_MASK,
                                                 self.TARGETS,
@@ -182,6 +180,7 @@ class PreferencesEditor:
         except:
             self.get_widget("notification_preference_frame").hide()
 
+        self._gui.connect_signals(self)
 
     def load_config(self):
         self.get_widget("shutdown_track").set_active(self.config.get_stop_on_shutdown())
@@ -191,8 +190,22 @@ class PreferencesEditor:
         self.get_widget("notify_on_idle").set_active(self.config.get_notify_on_idle())
 
         self.day_start.set_time(self.config.get_day_start())
+        
+        self.tags = [tag["name"] for tag in runtime.storage.get_tags(autocomplete=True)]
+        self.get_widget("autocomplete_tags").set_text(", ".join(self.tags))
+            
 
+    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) \
+                          .decode("utf-8")
 
+        if updated_tags == self.tags:
+            return
+        
+        runtime.storage.update_autocomplete_tags(updated_tags)
+        
+        
     def drag_data_get_data(self, treeview, context, selection, target_id,
                            etime):
         treeselection = treeview.get_selection()
diff --git a/hamster/storage.py b/hamster/storage.py
index e9db2ac..a05b442 100644
--- a/hamster/storage.py
+++ b/hamster/storage.py
@@ -41,7 +41,10 @@ class Storage(object):
             self.dispatch('new_tags_added', ())
         return tags
 
-
+    def update_autocomplete_tags(self, tags):
+        changes = self.__update_autocomplete_tags(tags)
+        if changes:
+            self.dispatch('new_tags_added', ())
 
     def get_fact(self, id):
         return self.__get_fact(id)



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