tracker r3117 - in trunk: . src/tracker-applet src/trackerd



Author: mr
Date: Mon Mar 23 13:58:45 2009
New Revision: 3117
URL: http://svn.gnome.org/viewvc/tracker?rev=3117&view=rev

Log:
	* src/trackerd/tracker-status.c: Make sure we change the
	throttling when the battery is in use or not. Changed battery
	charge debugging to show even when it is charging, not just
	discharging.


Modified:
   trunk/ChangeLog
   trunk/src/tracker-applet/tracker-applet.c
   trunk/src/trackerd/tracker-status.c

Modified: trunk/src/tracker-applet/tracker-applet.c
==============================================================================
--- trunk/src/tracker-applet/tracker-applet.c	(original)
+++ trunk/src/tracker-applet/tracker-applet.c	Mon Mar 23 13:58:45 2009
@@ -69,7 +69,7 @@
 
 #define TRACKER_TYPE_G_STRV_ARRAY  (dbus_g_type_get_collection ("GPtrArray", G_TYPE_STRV))
 
-#define DISABLE_DEBUG
+#undef DISABLE_DEBUG
 
 #ifdef G_HAVE_ISO_VARARGS
 #  ifdef DISABLE_DEBUG
@@ -225,6 +225,8 @@
 
 #ifndef DISABLE_DEBUG
 
+#include <glib/gprintf.h>
+
 static void
 debug_impl (const gchar *msg, ...)
 {

Modified: trunk/src/trackerd/tracker-status.c
==============================================================================
--- trunk/src/trackerd/tracker-status.c	(original)
+++ trunk/src/trackerd/tracker-status.c	Mon Mar 23 13:58:45 2009
@@ -341,7 +341,7 @@
 #ifdef HAVE_HAL
 
 static void
-set_up_throttle (void)
+set_up_throttle (gboolean debugging)
 {
 	TrackerStatusPrivate *private;
 	gint                  throttle;
@@ -356,30 +356,44 @@
 	throttle = tracker_config_get_throttle (private->config);
 
 	if (tracker_hal_get_battery_in_use (private->hal)) {
-		g_message ("We are running on battery");
+		if (debugging) {
+			g_message ("We are running on battery");
+		}
 
 		if (throttle == THROTTLE_DEFAULT) {
 			tracker_config_set_throttle (private->config,
 						     THROTTLE_DEFAULT_ON_BATTERY);
-			g_message ("Setting throttle from %d to %d",
-				   throttle,
-				   THROTTLE_DEFAULT_ON_BATTERY);
+
+			if (debugging) {
+				g_message ("Setting throttle from %d to %d",
+					   throttle,
+					   THROTTLE_DEFAULT_ON_BATTERY);
+			}
 		} else {
-			g_message ("Not setting throttle, it is currently set to %d",
-				   throttle);
+			if (debugging) {
+				g_message ("Not setting throttle, it is currently set to %d",
+					   throttle);
+			}
 		}
 	} else {
-		g_message ("We are not running on battery");
+		if (debugging) {
+			g_message ("We are not running on battery");
+		}
 
 		if (throttle == THROTTLE_DEFAULT_ON_BATTERY) {
 			tracker_config_set_throttle (private->config,
 						     THROTTLE_DEFAULT);
-			g_message ("Setting throttle from %d to %d",
-				   throttle,
-				   THROTTLE_DEFAULT);
+
+			if (debugging) {
+				g_message ("Setting throttle from %d to %d",
+					   throttle,
+					   THROTTLE_DEFAULT);
+			}
 		} else {
-			g_message ("Not setting throttle, it is currently set to %d",
-				   throttle);
+			if (debugging) {
+				g_message ("Not setting throttle, it is currently set to %d",
+					   throttle);
+			}
 		}
 	}
 }
@@ -389,7 +403,7 @@
 		   GParamSpec *arg1,
 		   gpointer user_data)
 {
-	set_up_throttle ();
+	set_up_throttle (TRUE);
 }
 
 static void
@@ -407,11 +421,11 @@
 	percentage = tracker_hal_get_battery_percentage (private->hal);
 	battery_in_use = tracker_hal_get_battery_in_use (private->hal);
 
+	g_message ("Battery percentage is now %.0f%%",
+		   percentage * 100);
+
 	/* FIXME: This could be a configuration option */
 	if (battery_in_use) {
-		g_message ("Battery percentage is now %.0f%%",
-			   percentage * 100);
-		
 		if (percentage <= 0.05) {
 			/* Running on low batteries, stop indexing for now */
 			tracker_status_set_is_paused_for_batt (TRUE);
@@ -422,7 +436,7 @@
 		tracker_status_set_is_paused_for_batt (FALSE);
 	}
 
-	set_up_throttle ();
+	set_up_throttle (FALSE);
 }
 
 #endif /* HAVE_HAL */
@@ -470,6 +484,9 @@
 	g_signal_connect (private->hal, "notify::battery-percentage",
 			  G_CALLBACK (battery_percentage_cb),
 			  NULL);
+	g_signal_connect (private->hal, "notify::battery-in-use",
+			  G_CALLBACK (battery_in_use_cb),
+			  NULL);
 #endif
 
 	private->is_readonly = FALSE;



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