tracker r3130 - in trunk: . src/tracker-applet



Author: mr
Date: Tue Mar 24 18:39:51 2009
New Revision: 3130
URL: http://svn.gnome.org/viewvc/tracker?rev=3130&view=rev

Log:
	* src/tracker-applet/tracker-applet-prefs.glade:
	* src/tracker-applet/tracker-applet.c: Removed all "merge" options
	since they no longer apply. Added more state information so the
	user isn't left wondering what is going on. Now we report states:
	watching, crawling, optimising and shutting down.


Modified:
   trunk/ChangeLog
   trunk/src/tracker-applet/tracker-applet-prefs.glade
   trunk/src/tracker-applet/tracker-applet.c

Modified: trunk/src/tracker-applet/tracker-applet-prefs.glade
==============================================================================
--- trunk/src/tracker-applet/tracker-applet-prefs.glade	(original)
+++ trunk/src/tracker-applet/tracker-applet-prefs.glade	Tue Mar 24 18:39:51 2009
@@ -1,231 +1,326 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.0 on Sun Mar  2 22:41:46 2008 -->
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
+
 <glade-interface>
-  <widget class="GtkWindow" id="wnd_prefs">
-    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-    <property name="title" translatable="yes">Applet Preferences</property>
-    <property name="resizable">False</property>
-    <property name="modal">True</property>
-    <property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-    <property name="skip_taskbar_hint">True</property>
-    <property name="skip_pager_hint">True</property>
-    <child>
-      <widget class="GtkVBox" id="vbox1">
-        <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="spacing">8</property>
-        <child>
-          <widget class="GtkVBox" id="vbox24">
-            <property name="visible">True</property>
-            <property name="border_width">12</property>
-            <property name="spacing">19</property>
-            <child>
-              <widget class="GtkFrame" id="fraThrottling2">
-                <property name="visible">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">GTK_SHADOW_NONE</property>
-                <child>
-                  <widget class="GtkAlignment" id="alignment8">
-                    <property name="visible">True</property>
-                    <property name="top_padding">6</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <widget class="GtkVBox" id="vbox25">
-                        <property name="visible">True</property>
-                        <property name="spacing">6</property>
-                        <child>
-                          <widget class="GtkCheckButton" id="chk_animate">
-                            <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="label" translatable="yes">Animate _icon when indexing</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="chk_animate_toggled_cb" object="icon"/>
-                          </widget>
-                        </child>
-                      </widget>
-                    </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="lblAnimation">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Animation&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkFrame" id="frame6">
-                <property name="visible">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">GTK_SHADOW_NONE</property>
-                <child>
-                  <widget class="GtkAlignment" id="alignment11">
-                    <property name="visible">True</property>
-                    <property name="top_padding">6</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <widget class="GtkVBox" id="vbox27">
-                        <property name="visible">True</property>
-                        <property name="spacing">6</property>
-                        <child>
-                          <widget class="GtkCheckButton" id="chk_show_icon">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">_Hide Icon (except when displaying messages to user)</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
-                            <signal name="toggled" handler="chk_show_icon_toggled_cb" object="icon"/>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label40">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Visibility&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="GtkFrame" id="frame4">
-                <property name="visible">True</property>
-                <property name="label_xalign">0</property>
-                <property name="shadow_type">GTK_SHADOW_NONE</property>
-                <child>
-                  <widget class="GtkAlignment" id="alignment10">
-                    <property name="visible">True</property>
-                    <property name="top_padding">6</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <widget class="GtkVBox" id="vbox26">
-                        <property name="visible">True</property>
-                        <property name="spacing">6</property>
-                        <child>
-                          <widget class="GtkRadioButton" id="opt_pause_off">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">_Off</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
-                            <signal name="group_changed" handler="opt_pause_off_group_changed_cb" object="icon"/>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="opt_pause_index">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">_Automatically pause all indexing when computer is in active use</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="active">True</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">opt_pause_off</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkRadioButton" id="opt_pause_merge">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">Automatically _pause if indexing may degrade performance of other applications in active use</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="active">True</property>
-                            <property name="draw_indicator">True</property>
-                            <property name="group">opt_pause_off</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="position">2</property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label39">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Smart Pausing&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                  </widget>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
-              </widget>
-              <packing>
-                <property name="expand">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="padding">6</property>
-          </packing>
-        </child>
-        <child>
-          <widget class="GtkHButtonBox" id="hbuttonbox1">
-            <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="border_width">4</property>
-            <property name="homogeneous">True</property>
-            <property name="layout_style">GTK_BUTTONBOX_END</property>
-            <child>
-              <widget class="GtkButton" id="btn_close">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">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="label">gtk-close</property>
-                <property name="use_stock">True</property>
-                <property name="response_id">1</property>
-                <signal name="clicked" handler="on_btn_close_clicked"/>
-              </widget>
-            </child>
-          </widget>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">6</property>
-          </packing>
-        </child>
-      </widget>
-    </child>
-  </widget>
+
+<widget class="GtkWindow" id="wnd_prefs">
+  <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+  <property name="title" translatable="yes">Applet Preferences</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
+  <property name="modal">True</property>
+  <property name="resizable">False</property>
+  <property name="destroy_with_parent">True</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">True</property>
+  <property name="skip_pager_hint">True</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="urgency_hint">False</property>
+
+  <child>
+    <widget class="GtkVBox" id="vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">8</property>
+
+      <child>
+	<widget class="GtkVBox" id="vbox24">
+	  <property name="border_width">12</property>
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">19</property>
+
+	  <child>
+	    <widget class="GtkFrame" id="fraThrottling2">
+	      <property name="visible">True</property>
+	      <property name="label_xalign">0</property>
+	      <property name="label_yalign">0.5</property>
+	      <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+	      <child>
+		<widget class="GtkAlignment" id="alignment8">
+		  <property name="visible">True</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xscale">1</property>
+		  <property name="yscale">1</property>
+		  <property name="top_padding">6</property>
+		  <property name="bottom_padding">0</property>
+		  <property name="left_padding">12</property>
+		  <property name="right_padding">0</property>
+
+		  <child>
+		    <widget class="GtkVBox" id="vbox25">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">6</property>
+
+		      <child>
+			<widget class="GtkCheckButton" id="chk_animate">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="label" translatable="yes">Animate _icon when indexing</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</property>
+			  <property name="focus_on_click">True</property>
+			  <property name="active">False</property>
+			  <property name="inconsistent">False</property>
+			  <property name="draw_indicator">True</property>
+			  <signal name="toggled" handler="chk_animate_toggled_cb" object="icon"/>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="lblAnimation">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">&lt;b&gt;Animation&lt;/b&gt;</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">True</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="type">label_item</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkFrame" id="frame6">
+	      <property name="visible">True</property>
+	      <property name="label_xalign">0</property>
+	      <property name="label_yalign">0.5</property>
+	      <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+	      <child>
+		<widget class="GtkAlignment" id="alignment11">
+		  <property name="visible">True</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xscale">1</property>
+		  <property name="yscale">1</property>
+		  <property name="top_padding">6</property>
+		  <property name="bottom_padding">0</property>
+		  <property name="left_padding">12</property>
+		  <property name="right_padding">0</property>
+
+		  <child>
+		    <widget class="GtkVBox" id="vbox27">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">6</property>
+
+		      <child>
+			<widget class="GtkCheckButton" id="chk_show_icon">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="label" translatable="yes">_Hide Icon (except when displaying messages to user)</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</property>
+			  <property name="focus_on_click">True</property>
+			  <property name="active">False</property>
+			  <property name="inconsistent">False</property>
+			  <property name="draw_indicator">True</property>
+			  <signal name="toggled" handler="chk_show_icon_toggled_cb" object="icon"/>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label40">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">&lt;b&gt;Visibility&lt;/b&gt;</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">True</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="type">label_item</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkFrame" id="frame4">
+	      <property name="visible">True</property>
+	      <property name="label_xalign">0</property>
+	      <property name="label_yalign">0.5</property>
+	      <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+	      <child>
+		<widget class="GtkAlignment" id="alignment10">
+		  <property name="visible">True</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xscale">1</property>
+		  <property name="yscale">1</property>
+		  <property name="top_padding">6</property>
+		  <property name="bottom_padding">0</property>
+		  <property name="left_padding">12</property>
+		  <property name="right_padding">0</property>
+
+		  <child>
+		    <widget class="GtkVBox" id="vbox26">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">6</property>
+
+		      <child>
+			<widget class="GtkRadioButton" id="opt_pause_off">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Off</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</property>
+			  <property name="focus_on_click">True</property>
+			  <property name="active">False</property>
+			  <property name="inconsistent">False</property>
+			  <property name="draw_indicator">True</property>
+			  <signal name="group_changed" handler="opt_pause_off_group_changed_cb" object="icon"/>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkRadioButton" id="opt_pause_index">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Automatically pause all indexing when computer is in active use</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</property>
+			  <property name="focus_on_click">True</property>
+			  <property name="active">True</property>
+			  <property name="inconsistent">False</property>
+			  <property name="draw_indicator">True</property>
+			  <property name="group">opt_pause_off</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label39">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">&lt;b&gt;Smart Pausing&lt;/b&gt;</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">True</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="type">label_item</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">6</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkHButtonBox" id="hbuttonbox1">
+	  <property name="border_width">4</property>
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <widget class="GtkButton" id="btn_close">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-close</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <signal name="clicked" handler="on_btn_close_clicked"/>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">False</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>

Modified: trunk/src/tracker-applet/tracker-applet.c
==============================================================================
--- trunk/src/tracker-applet/tracker-applet.c	(original)
+++ trunk/src/tracker-applet/tracker-applet.c	Tue Mar 24 18:39:51 2009
@@ -99,30 +99,32 @@
 } IndexIcon;
 
 typedef enum {
-	INDEX_INITIALIZING,
-	INDEX_IDLE,
-	INDEX_PAUSED,
-	INDEX_BUSY,
-	INDEX_MERGING
-} IndexStateEnum;
+	STATE_INITIALIZING,
+        STATE_WATCHING,
+        STATE_INDEXING,
+        STATE_PAUSED,
+        STATE_PENDING,
+        STATE_OPTIMIZING,
+        STATE_IDLE,
+        STATE_SHUTDOWN,
+} State;
 
 typedef enum {
-	PAUSE_NONE,
-	PAUSE_INTERNAL,
-	PAUSE_BATTERY
-} PauseStateEnum;
+	PAUSE_REASON_NONE,
+	PAUSE_REASON_IO,
+	PAUSE_REASON_BATTERY
+} PauseReason;
 
 typedef enum {
 	AUTO_PAUSE_NONE,
 	AUTO_PAUSE_INDEXING,
-	AUTO_PAUSE_MERGING
-} AutoPauseEnum;
+} AutoPause;
 
 typedef struct {
 	const gchar *name;
 	gchar *label;
 	GtkWidget *stat_label;
-} Stat_Info;
+} StatInfo;
 
 typedef struct _TrayIconPrivate {
 	GtkStatusIcon *icon;
@@ -131,10 +133,10 @@
 
 	/* Settings */
 	gboolean auto_hide;
-	gboolean disabled;
+	gboolean indexing_disabled;
 	gboolean show_animation;
 	gboolean reindex;
-	AutoPauseEnum auto_pause_setting;
+	AutoPause auto_pause_setting;
 
 	/* Auto pause vars */
 	gboolean auto_pause_timer_active;
@@ -144,8 +146,8 @@
 	gboolean auto_pause;
 
 	/* States */
-	IndexStateEnum index_state;
-	PauseStateEnum pause_state;
+	State state;
+	PauseReason pause_reason;
 	IndexIcon index_icon;
         gboolean initial_index;
 	gboolean animated;
@@ -179,7 +181,6 @@
 	GtkWidget *chk_show_icon;
 	GtkWidget *opt_pause_off;
 	GtkWidget *opt_pause_index;
-	GtkWidget *opt_pause_merge;
 	GtkWidget *btn_close;
 } TrayIconPrivate;
 
@@ -195,7 +196,7 @@
 	"tracker-applet-indexing2.png"
 };
 
-static Stat_Info stat_info[13] = {
+static StatInfo stat_info[13] = {
 	{ "Files", NULL, NULL },
 	{ "Folders", NULL, NULL },
 	{ "Documents", NULL, NULL },
@@ -275,36 +276,55 @@
 
 	hint = g_string_new (NULL);
 
-	switch (priv->index_state) {
-	case INDEX_INITIALIZING:
+	switch (priv->state) {
+	case STATE_INITIALIZING:
 		/* Translators: this will be a status hint like: 
                  * Tracker: Initializing 
                  */
 		index_status = _("Initializing");
 		break;
-	case INDEX_IDLE:
+	case STATE_WATCHING:
 		/* Translators: this will be a status hint like: 
-                 * Tracker: Idle 
+                 * Tracker: Adding File System Monitors
                  */
-		index_status = _("Idle");
+		index_status = _("Adding File System Monitors");
 		break;
-	case INDEX_PAUSED:
+	case STATE_INDEXING:
 		/* Translators: this will be a status hint like: 
-                 * Tracker: Idle 
+                 * Tracker: Indexing
+                 */
+		index_status = _("Indexing");
+		break;
+	case STATE_PAUSED:
+		/* Translators: this will be a status hint like: 
+                 * Tracker: Paused 
                  */
 		index_status = _("Paused");
 		break;
-	case INDEX_BUSY:
+	case STATE_PENDING:
 		/* Translators: this will be a status hint like: 
-                 * Tracker: Indexing 
+                 * Tracker: Crawling File System
+                 *  e.g. to crawl the file system for changes
                  */
-		index_status = _("Indexing");
+		index_status = _("Crawling File System");
+		break;
+	case STATE_IDLE:
+		/* Translators: this will be a status hint like: 
+                 * Tracker: Idle 
+                 */
+		index_status = _("Idle");
+		break;
+	case STATE_OPTIMIZING:
+		/* Translators: this will be a status hint like: 
+                 * Tracker: Optimizing Databases 
+                 */
+		index_status = _("Optimizing Databases");
 		break;
-	case INDEX_MERGING:
+	case STATE_SHUTDOWN:
 		/* Translators: this will be a status hint like: 
-                 * Tracker: Merging 
+                 * Tracker: Shutting Down
                  */
-		index_status = _("Merging");
+		index_status = _("Shutting Down");
 		break;
 	}
 
@@ -319,14 +339,14 @@
                  */
 		pause_status = _("by system");
 	} else {
-		switch (priv->pause_state) {
-		case PAUSE_INTERNAL:
+		switch (priv->pause_reason) {
+		case PAUSE_REASON_IO:
                         /* Translators: this will be a status hint like: 
                          * Tracker: Initializing/Idle/Indexing/Merging (paused by system)
                          */
 			pause_status = _("low disk space or heavy disk use");
 			break;
-		case PAUSE_BATTERY:
+		case PAUSE_REASON_BATTERY:
 			/* FIXME: We need to check if we are on the
 			 * battery first, this state purely means we
 			 * WILL pause on battery.
@@ -337,7 +357,7 @@
 			pause_status = _("low battery");
 			break;
 		default:
-		case PAUSE_NONE:
+		case PAUSE_REASON_NONE:
 			pause_status = NULL;
 			break;
 		}
@@ -355,7 +375,7 @@
 		g_string_printf (hint, _("Tracker: %s"), index_status);
 	}
 
-	if (priv->index_state == INDEX_BUSY) {
+	if (priv->state == STATE_INDEXING) {
 		gchar *str1;
 		gchar *str2;
 
@@ -385,16 +405,6 @@
 		g_free (str1);
 	}
 
-	if (priv->index_state == INDEX_MERGING) {
-		/* Translators: this will be a status hint like: 
-                 * Tracker: Merging\n
-                 *  %d/%d indexes being merged 
-                 */
-		g_string_append_printf (hint, _("\n%d/%d indexes being merged"),
-					priv->items_done,
-					priv->items_total);
-	}
-
 	tray_icon_set_tooltip (icon, hint->str);
 
 	g_string_free (hint, TRUE);
@@ -408,8 +418,8 @@
 	priv = TRAY_ICON_GET_PRIVATE (icon);
 
 	if (priv->user_pause ||
-	    priv->pause_state == PAUSE_BATTERY ||
-	    priv->disabled ||
+	    priv->pause_reason == PAUSE_REASON_BATTERY ||
+	    priv->indexing_disabled ||
 	    priv->indexer_stopped) {
 		return FALSE;
 	}
@@ -418,9 +428,7 @@
 	case AUTO_PAUSE_NONE:
 		return FALSE;
 	case AUTO_PAUSE_INDEXING:
-		return priv->index_state != INDEX_IDLE;
-	case AUTO_PAUSE_MERGING:
-		return priv->index_state == INDEX_MERGING;
+		return priv->state != STATE_IDLE;
 	}
 
 	return TRUE;
@@ -448,27 +456,26 @@
 	g_free (path);
 }
 
-static gboolean
+static void
 set_icon (TrayIconPrivate *priv)
 {
-	if (!priv->user_pause) {
-		if (priv->index_state == INDEX_INITIALIZING ||
-		    priv->index_state == INDEX_IDLE) {
-			priv->animated = FALSE;
-			priv->animated_timer_active = FALSE;
-
-			if (priv->index_icon != ICON_DEFAULT) {
-				priv->index_icon = ICON_DEFAULT;
-				set_tracker_icon (priv);
-			}
-
-			return FALSE;
-		}
+	if (!priv->user_pause && 
+            (priv->state == STATE_INITIALIZING ||
+             priv->state == STATE_IDLE)) {
+                priv->animated = FALSE;
+                priv->animated_timer_active = FALSE;
+                
+                if (priv->index_icon != ICON_DEFAULT) {
+                        priv->index_icon = ICON_DEFAULT;
+                        set_tracker_icon (priv);
+                }
+                
+                return;
 	}
 
 	if (priv->user_pause ||
 	    priv->auto_pause ||
-	    priv->pause_state != PAUSE_NONE) {
+	    priv->pause_reason != PAUSE_REASON_NONE) {
 		if (priv->index_icon != ICON_PAUSED) {
 			priv->index_icon = ICON_PAUSED;
 			set_tracker_icon (priv);
@@ -477,11 +484,11 @@
 		priv->animated = FALSE;
 		priv->animated_timer_active = FALSE;
 
-		return FALSE;
+		return;
 	}
 
-	if (priv->index_state != INDEX_INITIALIZING &&
-	    priv->index_state != INDEX_IDLE) {
+	if (priv->state != STATE_INITIALIZING &&
+	    priv->state != STATE_IDLE) {
 		if (priv->index_icon == ICON_INDEX2 || !priv->show_animation) {
 			priv->index_icon = ICON_DEFAULT;
 		} else if (priv->index_icon != ICON_INDEX1) {
@@ -491,11 +498,7 @@
 		}
 
 		set_tracker_icon (priv);
-
-		return TRUE;
 	}
-
-	return FALSE;
 }
 
 static gboolean
@@ -860,8 +863,8 @@
 }
 
 static inline void
-set_auto_pause_setting (TrayIcon      *icon,
-			AutoPauseEnum  auto_pause)
+set_auto_pause_setting (TrayIcon  *icon,
+			AutoPause  auto_pause)
 {
 	TrayIconPrivate *priv;
 
@@ -950,18 +953,6 @@
 
 		return;
 	}
-
-	if (g_str_equal (name, "opt_pause_merge")) {
-		priv->auto_pause_setting = AUTO_PAUSE_MERGING;
-
-		if (can_auto_pause (icon)) {
-			start_watching_events (icon);
-		} else {
-			stop_watching_events (icon);
-		}
-
-		return;
-	}
 }
 
 static void
@@ -992,7 +983,7 @@
 		gtk_status_icon_set_visible (priv->icon, FALSE);
 	} else {
 		priv->auto_hide = FALSE;
-		if (!priv->disabled) {
+		if (!priv->indexing_disabled) {
 			gtk_status_icon_set_visible (priv->icon, TRUE);
 		}
 	}
@@ -1030,8 +1021,6 @@
 	priv->opt_pause_off = glade_xml_get_widget (glade, "opt_pause_off");
 	priv->opt_pause_index =
 		glade_xml_get_widget (glade, "opt_pause_index");
-	priv->opt_pause_merge =
-		glade_xml_get_widget (glade, "opt_pause_merge");
 	priv->btn_close = glade_xml_get_widget (glade, "btn_close");
 
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->chk_animate),
@@ -1050,10 +1039,6 @@
 					      (priv->opt_pause_index), TRUE);
 		break;
 
-	case AUTO_PAUSE_MERGING:
-		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
-					      (priv->opt_pause_merge), TRUE);
-		break;
         default:
                 g_critical ("Unreachable state in auto pause.");
 	}
@@ -1070,10 +1055,6 @@
 			  "toggled",
 			  G_CALLBACK (opt_pause_off_group_changed_cb),
 			  main_icon);
-	g_signal_connect (GTK_TOGGLE_BUTTON (priv->opt_pause_merge),
-			  "toggled",
-			  G_CALLBACK (opt_pause_off_group_changed_cb),
-			  main_icon);
 	g_signal_connect (priv->btn_close, "clicked",
 			  G_CALLBACK (prefs_closed), main_icon);
 }
@@ -1569,8 +1550,8 @@
 
 	priv->indexer_stopped = FALSE;
 
-        priv->index_state = INDEX_IDLE;
-	priv->pause_state = PAUSE_NONE;
+        priv->state = STATE_IDLE;
+	priv->pause_reason = PAUSE_REASON_NONE;
 
 	priv->user_pause = FALSE;
 	priv->auto_pause = FALSE;
@@ -1617,7 +1598,6 @@
 		     TrayIcon	 *icon)
 {
 	TrayIconPrivate *priv;
-	gboolean paused;
 
 	if (!state) {
 		return;
@@ -1628,14 +1608,12 @@
 	priv->indexer_stopped = FALSE;
         priv->initial_index = initial_index;
 
-	paused = FALSE;
-
 	if (!is_indexing_enabled) {
-		priv->disabled = TRUE;
+		priv->indexing_disabled = TRUE;
 		gtk_status_icon_set_visible (priv->icon, FALSE);
 		return;
 	} else {
-		priv->disabled = FALSE;
+		priv->indexing_disabled = FALSE;
 		if (!priv->auto_hide) {
 			gtk_status_icon_set_visible (priv->icon, TRUE);
 		}
@@ -1681,47 +1659,59 @@
                 }
 	}
 
-	priv->animated = FALSE;
-	priv->pause_state = PAUSE_NONE;
-
 	/* Set pause states if applicable */
 	if (is_manual_paused) {
-		stop_watching_events (icon);
+                priv->pause_reason = PAUSE_REASON_NONE;
 
-		paused = TRUE;
+		stop_watching_events (icon);
 
 		if (!priv->auto_pause) {
 			priv->user_pause = TRUE;
 		}
 	} else if (is_battery_paused) {
-		paused = TRUE;
-		priv->pause_state = PAUSE_BATTERY;
+		priv->pause_reason = PAUSE_REASON_BATTERY;
 	} else if (is_io_paused) {
-		paused = TRUE;
-		priv->pause_state = PAUSE_INTERNAL;
-	}
+		priv->pause_reason = PAUSE_REASON_IO;
+	} else {
+                priv->pause_reason = PAUSE_REASON_NONE;
+        }
 
-	if (in_merge) {
-		priv->index_state = INDEX_MERGING;
+	if (g_ascii_strcasecmp (state, "Initializing") == 0) {
+		priv->state = STATE_INITIALIZING;
+		priv->animated = FALSE;
+	} else if (g_ascii_strcasecmp (state, "Watching") == 0) {
+		priv->state = STATE_WATCHING;
+		priv->animated = TRUE;
+	} else if (g_ascii_strcasecmp (state, "Indexing") == 0) {
+		priv->state = STATE_INDEXING;
 		priv->animated = TRUE;
-	} else if (g_ascii_strcasecmp (state, "Initializing") == 0) {
-		priv->index_state = INDEX_INITIALIZING;
-	} else if (g_ascii_strcasecmp (state, "Idle") == 0) {
-		priv->index_state = INDEX_IDLE;
 	} else if (g_ascii_strcasecmp (state, "Paused") == 0) {
-		priv->index_state = INDEX_PAUSED;
-	} else {
-		priv->index_state = INDEX_BUSY;
+		priv->state = STATE_PAUSED;
+		priv->animated = FALSE;
+	} else if (g_ascii_strcasecmp (state, "Pending") == 0) {
+		priv->state = STATE_PENDING;
+		priv->animated = TRUE;
+	} else if (g_ascii_strcasecmp (state, "Optimizing") == 0) {
+		priv->state = STATE_OPTIMIZING;
+		priv->animated = TRUE;
+	} else if (g_ascii_strcasecmp (state, "Idle") == 0) {
+		priv->state = STATE_IDLE;
+		priv->animated = FALSE;
+	} else if (g_ascii_strcasecmp (state, "Shutdown") == 0) {
+		priv->state = STATE_SHUTDOWN;
 		priv->animated = TRUE;
+        } else {
+                g_critical ("Unknown state '%s'", state);
 	}
 
 	set_icon (priv);
 
 	/* Should we animate? */
-	if (!paused && priv->animated && priv->show_animation) {
-		if (!priv->animated_timer_active) {
-			priv->animated_timer_active = TRUE;
-		}
+	if (priv->state != STATE_PAUSED && 
+            priv->show_animation && 
+            priv->animated && 
+            !priv->animated_timer_active) {
+                priv->animated_timer_active = TRUE;
 	}
 
 	set_status_hint (icon);
@@ -1770,9 +1760,9 @@
 
 	priv = TRAY_ICON_GET_PRIVATE (icon);
 
-	priv->index_state = INDEX_INITIALIZING;
-	priv->pause_state = PAUSE_NONE;
-	priv->auto_pause_setting = AUTO_PAUSE_MERGING;
+	priv->state = STATE_INITIALIZING;
+	priv->pause_reason = PAUSE_REASON_NONE;
+	priv->auto_pause_setting = AUTO_PAUSE_NONE;
 	priv->index_icon = ICON_DEFAULT;
 	priv->show_animation = TRUE;
 
@@ -2046,7 +2036,7 @@
 	msg = g_strdup_vprintf (message, args);
 	va_end (args);
 
-	if (priv->disabled) {
+	if (priv->indexing_disabled) {
 		return;
 	}
 
@@ -2148,7 +2138,7 @@
 
 		priv->show_animation = TRUE;
 		priv->auto_hide = FALSE;
-		priv->auto_pause_setting = AUTO_PAUSE_MERGING;
+		priv->auto_pause_setting = AUTO_PAUSE_NONE;
 
 		return FALSE;
 	}
@@ -2186,10 +2176,11 @@
 								   "SmartPause",
 								   NULL);
 	} else {
-		priv->auto_pause_setting = AUTO_PAUSE_MERGING;
+		priv->auto_pause_setting = AUTO_PAUSE_NONE;
 	}
 
 	switch (priv->auto_pause_setting) {
+        default:
 	case AUTO_PAUSE_NONE:
 		priv->auto_pause_setting = AUTO_PAUSE_NONE;
 		priv->auto_pause = FALSE;
@@ -2202,15 +2193,6 @@
 			stop_watching_events (icon);
 		}
 		break;
-	case AUTO_PAUSE_MERGING:
-		if (can_auto_pause (icon)) {
-			start_watching_events (icon);
-		} else {
-			stop_watching_events (icon);
-		}
-		break;
-        default:
-                g_critical ("Unreachable state in auto pause.");
 	}
 
 	return TRUE;



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