gnome-power-manager r3188 - in trunk: . src



Author: rhughes
Date: Tue Jan 27 15:50:58 2009
New Revision: 3188
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3188&view=rev

Log:
2009-01-27  Richard Hughes  <richard hughsie com>

* configure.ac:
* src/Makefile.am:
* src/egg-array-float.c: (egg_array_float_test):
* src/egg-array-float.h:
* src/egg-color.c: (egg_color_test):
* src/egg-color.h:
* src/egg-discrete.c: (egg_discrete_test):
* src/egg-discrete.h:
* src/egg-precision.c: (egg_precision_test):
* src/egg-precision.h:
* src/gpm-common.c: (gpm_common_test):
* src/gpm-common.h:
* src/gpm-idle.c: (gpm_idle_evaluate):
* src/gpm-inhibit.c: (gpm_inhibit_test_has_inhibit),
(gpm_inhibit_test):
* src/gpm-inhibit.h:
* src/gpm-phone.c: (gpm_phone_test):
* src/gpm-phone.h:
* src/gpm-self-test.c: (main):
Fix up the self checks and include the idletime code which had
bitrotted.


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/egg-array-float.c
   trunk/src/egg-array-float.h
   trunk/src/egg-color.c
   trunk/src/egg-color.h
   trunk/src/egg-discrete.c
   trunk/src/egg-discrete.h
   trunk/src/egg-precision.c
   trunk/src/egg-precision.h
   trunk/src/gpm-common.c
   trunk/src/gpm-common.h
   trunk/src/gpm-idle.c
   trunk/src/gpm-inhibit.c
   trunk/src/gpm-inhibit.h
   trunk/src/gpm-phone.c
   trunk/src/gpm-phone.h
   trunk/src/gpm-self-test.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Tue Jan 27 15:50:58 2009
@@ -44,7 +44,7 @@
 	WARNINGFLAGS="$WARNINGFLAGS -Wclobbered"
 	WARNINGFLAGS="$WARNINGFLAGS -Wempty-body"
 	WARNINGFLAGS="$WARNINGFLAGS -Wignored-qualifiers"
-	WARNINGFLAGS="$WARNINGFLAGS -Wsign-compare"
+#	WARNINGFLAGS="$WARNINGFLAGS -Wsign-compare"
 	WARNINGFLAGS="$WARNINGFLAGS -Wtype-limits"
 	WARNINGFLAGS="$WARNINGFLAGS -Wuninitialized"
 	WARNINGFLAGS="$WARNINGFLAGS -Waggregate-return"

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Tue Jan 27 15:50:58 2009
@@ -67,6 +67,8 @@
 	egg-obj-list.h					\
 	egg-array-float.c				\
 	egg-array-float.h				\
+	egg-idletime.h					\
+	egg-idletime.c					\
 	gpm-common.h					\
 	gpm-common.c					\
 	gpm-statistics.c				\
@@ -99,6 +101,8 @@
 	egg-dbus-proxy.c				\
 	egg-dbus-monitor.h				\
 	egg-dbus-monitor.c				\
+	egg-idletime.h					\
+	egg-idletime.c					\
 	gpm-dpms.h					\
 	gpm-dpms.c					\
 	gpm-idle.h					\
@@ -147,6 +151,8 @@
 	egg-discrete.c					\
 	egg-console-kit.h				\
 	egg-console-kit.c				\
+	egg-idletime.h					\
+	egg-idletime.c					\
 	gpm-dpms.h					\
 	gpm-dpms.c					\
 	gpm-notify.h					\
@@ -228,6 +234,7 @@
 	$(NULL)
 
 gnome_power_self_test_SOURCES =				\
+	gpm-self-test.c					\
 	egg-color.h					\
 	egg-color.c					\
 	egg-test.h					\
@@ -240,17 +247,20 @@
 	egg-dbus-proxy.c				\
 	egg-precision.h					\
 	egg-precision.c					\
+	egg-idletime.h					\
+	egg-idletime.c					\
 	egg-discrete.h					\
 	egg-discrete.c					\
 	egg-array-float.h				\
 	egg-array-float.c				\
+	egg-console-kit.h				\
+	egg-console-kit.c				\
 	gpm-ac-adapter.h				\
 	gpm-ac-adapter.c				\
 	gpm-prefs-server.h				\
 	gpm-prefs-server.c				\
 	gpm-control.h					\
 	gpm-control.c					\
-	gpm-self-test.c					\
 	gpm-networkmanager.h				\
 	gpm-networkmanager.c				\
 	gpm-dpms.h					\
@@ -277,13 +287,8 @@
 	gpm-common.c					\
 	gpm-inhibit.h					\
 	gpm-inhibit.c					\
-	$(NULL)
-
-gnome_power_self_test_SOURCES +=			\
 	gpm-devicekit.h					\
 	gpm-devicekit.c					\
-	egg-console-kit.h				\
-	egg-console-kit.c				\
 	$(NULL)
 
 gnome_power_self_test_LDADD =				\
@@ -298,7 +303,7 @@
 	$(GPM_EXTRA_LIBS)				\
 	$(NULL)
 
-gnome_power_self_test_CFLAGS = -DEGG_TEST $(AM_CFLAGS)
+gnome_power_self_test_CFLAGS = -DEGG_TEST $(AM_CFLAGS) $(WARNINGFLAGS)
 
 BUILT_SOURCES = 					\
 	org.freedesktop.PowerManagement.h		\

Modified: trunk/src/egg-array-float.c
==============================================================================
--- trunk/src/egg-array-float.c	(original)
+++ trunk/src/egg-array-float.c	Tue Jan 27 15:50:58 2009
@@ -72,7 +72,7 @@
  *
  * @array: input array
  **/
-inline gfloat
+gfloat
 egg_array_float_get (EggArrayFloat *array, guint i)
 {
 	if (i >= array->len)
@@ -85,7 +85,7 @@
  *
  * @array: input array
  **/
-inline void
+void
 egg_array_float_set (EggArrayFloat *array, guint i, gfloat value)
 {
 	g_array_index (array, gfloat, i) = value;
@@ -376,7 +376,7 @@
 #include "egg-test.h"
 
 void
-egg_array_float_test (EggTest *test)
+egg_array_float_test (gpointer data)
 {
 	EggArrayFloat *array;
 	EggArrayFloat *kernel;
@@ -384,6 +384,7 @@
 	gfloat value;
 	gfloat sigma;
 	guint size;
+	EggTest *test = (EggTest *) data;
 
 	if (egg_test_start (test, "EggArrayFloat") == FALSE)
 		return;

Modified: trunk/src/egg-array-float.h
==============================================================================
--- trunk/src/egg-array-float.h	(original)
+++ trunk/src/egg-array-float.h	Tue Jan 27 15:50:58 2009
@@ -41,13 +41,15 @@
 gboolean	 egg_array_float_print			(EggArrayFloat	*array);
 EggArrayFloat	*egg_array_float_convolve		(EggArrayFloat	*data,
 							 EggArrayFloat	*kernel);
-gfloat	 egg_array_float_get				(EggArrayFloat	*array,
+gfloat		 egg_array_float_get			(EggArrayFloat	*array,
 							 guint		 i);
-void	 egg_array_float_set				(EggArrayFloat	*array,
+void		 egg_array_float_set			(EggArrayFloat	*array,
 							 guint		 i,
 							 gfloat		 value);
-EggArrayFloat *
-egg_array_float_remove_outliers (EggArrayFloat *data, guint length, gfloat sigma);
+EggArrayFloat	*egg_array_float_remove_outliers	(EggArrayFloat *data, guint length, gfloat sigma);
+#ifdef EGG_TEST
+void		 egg_array_float_test			(gpointer	 data);
+#endif
 
 G_END_DECLS
 

Modified: trunk/src/egg-color.c
==============================================================================
--- trunk/src/egg-color.c	(original)
+++ trunk/src/egg-color.c	Tue Jan 27 15:50:58 2009
@@ -59,10 +59,11 @@
 #include "egg-test.h"
 
 void
-egg_color_test (EggTest *test)
+egg_color_test (gpointer data)
 {
 	guint8 r, g, b;
 	guint32 color;
+	EggTest *test = (EggTest *) data;
 
 	if (egg_test_start (test, "EggColor") == FALSE) {
 		return;

Modified: trunk/src/egg-color.h
==============================================================================
--- trunk/src/egg-color.h	(original)
+++ trunk/src/egg-color.h	Tue Jan 27 15:50:58 2009
@@ -50,6 +50,9 @@
 							 guint8		*red,
 							 guint8		*green,
 							 guint8		*blue);
+#ifdef EGG_TEST
+void		 egg_color_test				(gpointer	 data);
+#endif
 
 G_END_DECLS
 

Modified: trunk/src/egg-discrete.c
==============================================================================
--- trunk/src/egg-discrete.c	(original)
+++ trunk/src/egg-discrete.c	Tue Jan 27 15:50:58 2009
@@ -101,10 +101,11 @@
 #include "egg-test.h"
 
 void
-egg_discrete_test (EggTest *test)
+egg_discrete_test (gpointer data)
 {
 	guint value;
 	gfloat fvalue;
+	EggTest *test = (EggTest *) data;
 
 	if (!egg_test_start (test, "EggDiscrete"))
 		return;

Modified: trunk/src/egg-discrete.h
==============================================================================
--- trunk/src/egg-discrete.h	(original)
+++ trunk/src/egg-discrete.h	Tue Jan 27 15:50:58 2009
@@ -32,6 +32,9 @@
 							 guint		 levels);
 gfloat		 egg_discrete_to_fraction		(guint		 discrete,
 							 guint		 levels);
+#ifdef EGG_TEST
+void		 egg_discrete_test			(gpointer	 data);
+#endif
 
 G_END_DECLS
 

Modified: trunk/src/egg-precision.c
==============================================================================
--- trunk/src/egg-precision.c	(original)
+++ trunk/src/egg-precision.c	Tue Jan 27 15:50:58 2009
@@ -88,9 +88,10 @@
 #include "egg-test.h"
 
 void
-egg_precision_test (EggTest *test)
+egg_precision_test (gpointer data)
 {
 	guint value;
+	EggTest *test = (EggTest *) data;
 
 	if (!egg_test_start (test, "EggPrecision"))
 		return;

Modified: trunk/src/egg-precision.h
==============================================================================
--- trunk/src/egg-precision.h	(original)
+++ trunk/src/egg-precision.h	Tue Jan 27 15:50:58 2009
@@ -30,6 +30,9 @@
 							 gint		 smallest);
 gint		 egg_precision_round_down		(gfloat		 value,
 							 gint		 smallest);
+#ifdef EGG_TEST
+void		 egg_precision_test			(gpointer	 data);
+#endif
 
 G_END_DECLS
 

Modified: trunk/src/gpm-common.c
==============================================================================
--- trunk/src/gpm-common.c	(original)
+++ trunk/src/gpm-common.c	Tue Jan 27 15:50:58 2009
@@ -183,11 +183,11 @@
 #include "egg-test.h"
 
 void
-gpm_common_test (EggTest *test)
+gpm_common_test (gpointer data)
 {
-	if (egg_test_start (test, "GpmCommon") == FALSE) {
+	EggTest *test = (EggTest *) data;
+	if (egg_test_start (test, "GpmCommon") == FALSE)
 		return;
-	}
 
 	egg_test_end (test);
 }

Modified: trunk/src/gpm-common.h
==============================================================================
--- trunk/src/gpm-common.h	(original)
+++ trunk/src/gpm-common.h	Tue Jan 27 15:50:58 2009
@@ -186,10 +186,13 @@
 	GPM_ICON_POLICY_NEVER
 } GpmIconPolicy;
 
-gchar		*gpm_get_timestring		(guint		 time);
-GpmIconPolicy	 gpm_tray_icon_mode_from_string	(const gchar	*mode);
-const gchar	*gpm_tray_icon_mode_to_string	(GpmIconPolicy	 mode);
-void 		 gpm_help_display		(const gchar	*link_id);
+gchar		*gpm_get_timestring				(guint		 time);
+GpmIconPolicy	 gpm_tray_icon_mode_from_string			(const gchar	*mode);
+const gchar	*gpm_tray_icon_mode_to_string			(GpmIconPolicy	 mode);
+void 		 gpm_help_display				(const gchar	*link_id);
+#ifdef EGG_TEST
+void		 gpm_common_test				(gpointer	 data);
+#endif
 
 G_END_DECLS
 

Modified: trunk/src/gpm-idle.c
==============================================================================
--- trunk/src/gpm-idle.c	(original)
+++ trunk/src/gpm-idle.c	Tue Jan 27 15:50:58 2009
@@ -248,6 +248,7 @@
 
 	is_idle = gpm_session_get_idle (idle->priv->session);
 	is_inhibited = gpm_session_get_inhibited (idle->priv->session);
+	egg_debug ("is_idle=%i, is_inhibited=%i", is_idle, is_inhibited);
 
 	/* normal */
 	if (!is_idle || is_inhibited) {

Modified: trunk/src/gpm-inhibit.c
==============================================================================
--- trunk/src/gpm-inhibit.c	(original)
+++ trunk/src/gpm-inhibit.c	Tue Jan 27 15:50:58 2009
@@ -587,8 +587,7 @@
 }
 
 static gboolean
-has_inhibit (EggDbusProxy *gproxy,
-			      gboolean        *has_inhibit)
+gpm_inhibit_test_has_inhibit (EggDbusProxy *gproxy, gboolean *has_inhibit)
 {
 	GError  *error = NULL;
 	gboolean ret;
@@ -617,7 +616,7 @@
 }
 
 void
-gpm_inhibit_test (EggTest *test)
+gpm_inhibit_test (gpointer data)
 {
 	gboolean ret;
 	gboolean valid;
@@ -625,6 +624,7 @@
 	guint cookie2 = 0;
 	DBusGConnection *connection;
 	EggDbusProxy *gproxy;
+	EggTest *test = (EggTest *) data;
 
 	if (egg_test_start (test, "GpmInhibit") == FALSE) {
 		return;
@@ -642,7 +642,7 @@
 
 	/************************************************************/
 	egg_test_title (test, "make sure we are not inhibited");
-	ret = has_inhibit (gproxy, &valid);
+	ret = gpm_inhibit_test_has_inhibit (gproxy, &valid);
 	if (!ret) {
 		egg_test_failed (test, "Unable to test validity");
 	} else if (valid) {
@@ -676,7 +676,7 @@
 
 	/************************************************************/
 	egg_test_title (test, "make sure we are auto inhibited");
-	ret = has_inhibit (gproxy, &valid);
+	ret = gpm_inhibit_test_has_inhibit (gproxy, &valid);
 	if (!ret) {
 		egg_test_failed (test, "Unable to test validity");
 	} else if (valid) {
@@ -710,7 +710,7 @@
 
 	/************************************************************/
 	egg_test_title (test, "make sure we are still inhibited");
-	ret = has_inhibit (gproxy, &valid);
+	ret = gpm_inhibit_test_has_inhibit (gproxy, &valid);
 	if (!ret) {
 		egg_test_failed (test, "Unable to test validity");
 	} else if (valid) {

Modified: trunk/src/gpm-inhibit.h
==============================================================================
--- trunk/src/gpm-inhibit.h	(original)
+++ trunk/src/gpm-inhibit.h	Tue Jan 27 15:50:58 2009
@@ -75,7 +75,9 @@
 gboolean	 gpm_inhibit_get_requests		(GpmInhibit	*inhibit,
 							 gchar		***requests,
 							 GError		**error);
-
+#ifdef EGG_TEST
+void		 gpm_inhibit_test			(gpointer	 data);
+#endif
 
 G_END_DECLS
 

Modified: trunk/src/gpm-phone.c
==============================================================================
--- trunk/src/gpm-phone.c	(original)
+++ trunk/src/gpm-phone.c	Tue Jan 27 15:50:58 2009
@@ -414,11 +414,12 @@
 }
 
 void
-gpm_phone_test (EggTest *test)
+gpm_phone_test (gpointer data)
 {
 	GpmPhone *phone;
 	guint value;
 	gboolean ret;
+	EggTest *test = (EggTest *) data;
 
 	if (egg_test_start (test, "GpmPhone") == FALSE) {
 		return;

Modified: trunk/src/gpm-phone.h
==============================================================================
--- trunk/src/gpm-phone.h	(original)
+++ trunk/src/gpm-phone.h	Tue Jan 27 15:50:58 2009
@@ -56,17 +56,20 @@
 							 guint		 idx);
 } GpmPhoneClass;
 
-GType		 gpm_phone_get_type		(void);
-GpmPhone	*gpm_phone_new			(void);
+GType		 gpm_phone_get_type			(void);
+GpmPhone	*gpm_phone_new				(void);
 
-gboolean	 gpm_phone_get_present		(GpmPhone	*phone,
-						 guint		 idx);
-guint		 gpm_phone_get_percentage	(GpmPhone	*phone,
-						 guint		 idx);
-gboolean	 gpm_phone_get_on_ac		(GpmPhone	*phone,
-						 guint		 idx);
-guint		 gpm_phone_get_num_batteries	(GpmPhone	*phone);
-gboolean	 gpm_phone_coldplug		(GpmPhone	*phone);
+gboolean	 gpm_phone_get_present			(GpmPhone	*phone,
+							 guint		 idx);
+guint		 gpm_phone_get_percentage		(GpmPhone	*phone,
+							 guint		 idx);
+gboolean	 gpm_phone_get_on_ac			(GpmPhone	*phone,
+							 guint		 idx);
+guint		 gpm_phone_get_num_batteries		(GpmPhone	*phone);
+gboolean	 gpm_phone_coldplug			(GpmPhone	*phone);
+#ifdef EGG_TEST
+void		 gpm_phone_test				(gpointer	 data);
+#endif
 
 G_END_DECLS
 

Modified: trunk/src/gpm-self-test.c
==============================================================================
--- trunk/src/gpm-self-test.c	(original)
+++ trunk/src/gpm-self-test.c	Tue Jan 27 15:50:58 2009
@@ -32,6 +32,7 @@
 void egg_discrete_test (EggTest *test);
 void egg_color_test (EggTest *test);
 void egg_array_float_test (EggTest *test);
+void egg_idletime_test (EggTest *test);
 
 void gpm_common_test (EggTest *test);
 void gpm_cell_unit_test (EggTest *test);
@@ -45,7 +46,6 @@
 void gpm_hal_manager_test (EggTest *test);
 void gpm_device_test (EggTest *test);
 void gpm_device_teststore (EggTest *test);
-void gpm_idletime_test (EggTest *test);
 
 int
 main (int argc, char **argv)
@@ -64,6 +64,7 @@
 	egg_discrete_test (test);
 	egg_color_test (test);
 	egg_array_float_test (test);
+	egg_idletime_test (test);
 
 	gpm_common_test (test);
 	gpm_inhibit_test (test);
@@ -76,7 +77,6 @@
 	gpm_hal_manager_test (test);
 	gpm_device_test (test);
 	gpm_device_teststore (test);
-	gpm_idletime_test (test);
 #endif
 
 	return (egg_test_finish (test));



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