[gnome-settings-daemon] housekeeping: Add a real test application



commit afabab571fc2d1c00c0279686cc41f721e6f155a
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Nov 16 15:22:48 2010 +0000

    housekeeping: Add a real test application
    
    Rather than having to recompile some stuff by hand, with instructions
    that don't actually work...

 plugins/housekeeping/Makefile.am           |   29 +++++++++++++----
 plugins/housekeeping/gsd-disk-space-test.c |   47 ++++++++++++++++++++++++++++
 plugins/housekeeping/gsd-disk-space.c      |   23 -------------
 3 files changed, 69 insertions(+), 30 deletions(-)
---
diff --git a/plugins/housekeeping/Makefile.am b/plugins/housekeeping/Makefile.am
index 532c588..deed47c 100644
--- a/plugins/housekeeping/Makefile.am
+++ b/plugins/housekeeping/Makefile.am
@@ -1,12 +1,27 @@
-plugin_LTLIBRARIES = libhousekeeping.la
-
-libhousekeeping_la_SOURCES = 		\
-	gsd-ldsm-dialog.c	\
-	gsd-ldsm-dialog.h	\
-	gsd-ldsm-trash-empty.c	\
-	gsd-ldsm-trash-empty.h	\
+COMMON_FILES =				\
 	gsd-disk-space.c		\
 	gsd-disk-space.h		\
+	gsd-ldsm-trash-empty.c		\
+	gsd-ldsm-trash-empty.h		\
+	gsd-ldsm-dialog.c		\
+	gsd-ldsm-dialog.h
+
+noinst_PROGRAMS = gsd-disk-space-test
+
+gsd_disk_space_test_SOURCES =		\
+	gsd-disk-space-test.c		\
+	$(COMMON_FILES)
+gsd_disk_space_test_LDADD = $(SETTINGS_PLUGIN_LIBS) $(GIOUNIX_LIBS) $(LIBNOTIFY_LIBS)
+gsd_disk_space_test_CFLAGS =		\
+	$(SETTINGS_PLUGIN_CFLAGS)	\
+	$(GIOUNIX_CFLAGS)		\
+	$(LIBNOTIFY_CFLAGS)		\
+	$(AM_CFLAGS)
+
+plugin_LTLIBRARIES = libhousekeeping.la
+
+libhousekeeping_la_SOURCES =		\
+	$(COMMON_FILES)			\
 	gsd-housekeeping-manager.c	\
 	gsd-housekeeping-manager.h	\
 	gsd-housekeeping-plugin.c	\
diff --git a/plugins/housekeeping/gsd-disk-space-test.c b/plugins/housekeeping/gsd-disk-space-test.c
new file mode 100644
index 0000000..1cbc9e3
--- /dev/null
+++ b/plugins/housekeeping/gsd-disk-space-test.c
@@ -0,0 +1,47 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ * vim: set et sw=8 ts=8:
+ *
+ * Copyright (c) 2008, Novell, Inc.
+ *
+ * Authors: Vincent Untz <vuntz gnome org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include <gtk/gtk.h>
+#include "gsd-disk-space.h"
+
+int
+main (int    argc,
+      char **argv)
+{
+        GMainLoop *loop;
+
+        gtk_init (&argc, &argv);
+
+        loop = g_main_loop_new (NULL, FALSE);
+
+        gsd_ldsm_setup (TRUE);
+
+        g_main_loop_run (loop);
+
+        gsd_ldsm_clean ();
+        g_main_loop_unref (loop);
+
+        return 0;
+}
+
diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c
index d225cb8..392dcbd 100644
--- a/plugins/housekeeping/gsd-disk-space.c
+++ b/plugins/housekeeping/gsd-disk-space.c
@@ -21,8 +21,6 @@
  *
  */
 
-/* gcc -DHAVE_LIBNOTIFY -DTEST -Wall `pkg-config --cflags --libs gobject-2.0 gio-unix-2.0 glib-2.0 gtk+-2.0 libnotify` -o gsd-disk-space-test gsd-disk-space.c */
-
 #include "config.h"
 
 #include <sys/statvfs.h>
@@ -837,24 +835,3 @@ gsd_ldsm_clean (void)
         }
 }
 
-#ifdef TEST
-int
-main (int    argc,
-      char **argv)
-{
-        GMainLoop *loop;
-
-        gtk_init (&argc, &argv);
-
-        loop = g_main_loop_new (NULL, FALSE);
-
-        gsd_ldsm_setup (TRUE);
-
-        g_main_loop_run (loop);
-
-        gsd_ldsm_clean ();
-        g_main_loop_unref (loop);
-
-        return 0;
-}
-#endif /* TEST */



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