put temperature conversion functions into a separate file.
authorJean-Philippe Orsini <jeanfi@gmail.com>
Fri, 22 Aug 2014 23:18:37 +0000 (01:18 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Fri, 22 Aug 2014 23:18:37 +0000 (01:18 +0200)
src/lib/Makefile.am
src/lib/Makefile.in
src/lib/psensor.c
src/lib/psensor.h
src/lib/temperature.c [new file with mode: 0644]
src/lib/temperature.h [new file with mode: 0644]
src/ui_sensorpref.c
src/ui_unity.c

index da1dbfb..c7052b4 100644 (file)
@@ -15,6 +15,7 @@ libpsensor_a_SOURCES = \
        ptime.h ptime.c\
        pio.h pio.c\
        slog.c slog.h\
+       temperature.c temperature.h\
        url.c url.h
 
 AM_CPPFLAGS = -Wall -Werror
index 818b594..044bfb7 100644 (file)
@@ -81,9 +81,9 @@ libpsensor_a_LIBADD =
 am__libpsensor_a_SOURCES_DIST = amd.h bool.h color.h color.c cpu.h \
        hdd.h hdd_hddtemp.c lmsensor.h lmsensor.c measure.h measure.c \
        nvidia.h plog.h plog.c pmutex.h pmutex.c psensor.h psensor.c \
-       ptime.h ptime.c pio.h pio.c slog.c slog.h url.c url.h \
-       hdd_atasmart.c nvidia.c amd.c cpu.c psensor_json.h \
-       psensor_json.c
+       ptime.h ptime.c pio.h pio.c slog.c slog.h temperature.c \
+       temperature.h url.c url.h hdd_atasmart.c nvidia.c amd.c cpu.c \
+       psensor_json.h psensor_json.c
 @ATASMART_TRUE@am__objects_1 = hdd_atasmart.$(OBJEXT)
 @NVIDIA_TRUE@am__objects_2 = nvidia.$(OBJEXT)
 @LIBATIADL_TRUE@am__objects_3 = amd.$(OBJEXT)
@@ -92,9 +92,9 @@ am__libpsensor_a_SOURCES_DIST = amd.h bool.h color.h color.c cpu.h \
 am_libpsensor_a_OBJECTS = color.$(OBJEXT) hdd_hddtemp.$(OBJEXT) \
        lmsensor.$(OBJEXT) measure.$(OBJEXT) plog.$(OBJEXT) \
        pmutex.$(OBJEXT) psensor.$(OBJEXT) ptime.$(OBJEXT) \
-       pio.$(OBJEXT) slog.$(OBJEXT) url.$(OBJEXT) $(am__objects_1) \
-       $(am__objects_2) $(am__objects_3) $(am__objects_4) \
-       $(am__objects_5)
+       pio.$(OBJEXT) slog.$(OBJEXT) temperature.$(OBJEXT) \
+       url.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
+       $(am__objects_3) $(am__objects_4) $(am__objects_5)
 libpsensor_a_OBJECTS = $(am_libpsensor_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -272,9 +272,9 @@ noinst_LIBRARIES = libpsensor.a
 libpsensor_a_SOURCES = amd.h bool.h color.h color.c cpu.h hdd.h \
        hdd_hddtemp.c lmsensor.h lmsensor.c measure.h measure.c \
        nvidia.h plog.h plog.c pmutex.h pmutex.c psensor.h psensor.c \
-       ptime.h ptime.c pio.h pio.c slog.c slog.h url.c url.h \
-       $(am__append_1) $(am__append_4) $(am__append_7) \
-       $(am__append_8) $(am__append_11)
+       ptime.h ptime.c pio.h pio.c slog.c slog.h temperature.c \
+       temperature.h url.c url.h $(am__append_1) $(am__append_4) \
+       $(am__append_7) $(am__append_8) $(am__append_11)
 AM_CPPFLAGS = -Wall -Werror $(am__append_3) $(am__append_6) \
        $(am__append_10) $(am__append_13)
 EXTRA_DIST = $(libpsensor_a_SOURCES) \
@@ -345,6 +345,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psensor_json.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptime.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slog.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/temperature.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url.Po@am__quote@
 
 .c.o:
index 348885a..9f063d0 100644 (file)
 #include <libintl.h>
 #define _(str) gettext(str)
 
-#include "hdd.h"
-#include "psensor.h"
-#include "lmsensor.h"
+#include <hdd.h>
+#include <psensor.h>
+#include <lmsensor.h>
+#include <temperature.h>
 
 #ifdef HAVE_GTOP
 #include "cpu.h"
@@ -209,16 +210,6 @@ int is_fan_type(unsigned int type)
        return type & SENSOR_TYPE_FAN;
 }
 
-double celsius_to_fahrenheit(double c)
-{
-       return c * (9.0/5.0) + 32;
-}
-
-double fahrenheit_to_celsius(double f)
-{
-       return (f - 32) * (5.0/9.0);
-}
-
 char *
 psensor_value_to_str(unsigned int type, double value, int use_celsius)
 {
index cb30cb9..b7d73b4 100644 (file)
@@ -205,9 +205,6 @@ void psensor_cleanup();
 
 double get_max_value(struct psensor **sensors, int type);
 
-double celsius_to_fahrenheit(double c);
-double fahrenheit_to_celsius(double c);
-
 char *psensor_current_value_to_str(const struct psensor *, unsigned int);
 
 void psensor_log_measures(struct psensor **sensors);
diff --git a/src/lib/temperature.c b/src/lib/temperature.c
new file mode 100644 (file)
index 0000000..3e74898
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2010-2014 jeanfi@gmail.com
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include <temperature.h>
+
+double celsius_to_fahrenheit(double c)
+{
+       return c * (9.0/5.0) + 32;
+}
+
+double fahrenheit_to_celsius(double f)
+{
+       return (f - 32) * (5.0/9.0);
+}
+
diff --git a/src/lib/temperature.h b/src/lib/temperature.h
new file mode 100644 (file)
index 0000000..b36c90e
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2010-2014 jeanfi@gmail.com
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef _PSENSOR_TEMPERATURE_H_
+#define _PSENSOR_TEMPERATURE_H_
+
+double celsius_to_fahrenheit(double c);
+double fahrenheit_to_celsius(double c);
+
+#endif
index 9e8447e..0fa57e0 100644 (file)
 
 #include <gtk/gtk.h>
 
-#include "cfg.h"
-#include "ui_pref.h"
-#include "ui_sensorlist.h"
-#include "ui_sensorpref.h"
-#include "ui_color.h"
+#include <cfg.h>
+#include <temperature.h>
+#include <ui_pref.h>
+#include <ui_sensorlist.h>
+#include <ui_sensorpref.h>
+#include <ui_color.h>
+
 
 #if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
 #include "ui_appindicator.h"
index 17ee29d..a8f8b20 100644 (file)
@@ -18,6 +18,7 @@
  */
 #include <unity.h>
 
+#include <temperature.h>
 #include <ui_unity.h>
 
 static int initialized;