aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid <dbphillipsnz@gmail.com>2014-03-28 23:41:51 +1300
committerDavid <dbphillipsnz@gmail.com>2014-03-28 23:43:20 +1300
commitdf3ee03d3814ba51e0d09f90f419a5f9650e2105 (patch)
tree9782fd3789ec84ae65a0a934609c65d8cc562fb8 /src
parent78b703a761cd24dc13ec2d7ef19274db764a1b3f (diff)
downloadparamano-df3ee03d3814ba51e0d09f90f419a5f9650e2105.tar.xz
A night full of rewriting and tidying
Diffstat (limited to 'src')
-rw-r--r--src/Makefile27
-rw-r--r--src/bat_tray.c126
-rw-r--r--src/bat_tray/bat_tray.c193
-rw-r--r--src/bat_tray/bat_tray.h40
-rw-r--r--src/bat_tray/getbat.c (renamed from src/bat_tray.h)33
-rw-r--r--src/bat_tray/getbat.h26
-rw-r--r--src/common.c86
-rw-r--r--src/common.h28
-rw-r--r--src/config.h.in61
-rw-r--r--src/config_file.c15
-rw-r--r--src/config_file.h17
-rw-r--r--src/defaults.c75
-rw-r--r--src/defaults.h32
-rw-r--r--src/freq_tray/getcore.c (renamed from src/getcore.c)15
-rw-r--r--src/freq_tray/getcore.h (renamed from src/getcore.h)15
-rw-r--r--src/freq_tray/getfreq.c (renamed from src/getfreq.c)15
-rw-r--r--src/freq_tray/getfreq.h (renamed from src/getfreq.h)15
-rw-r--r--src/freq_tray/getgov.c (renamed from src/getgov.c)15
-rw-r--r--src/freq_tray/getgov.h (renamed from src/getgov.h)15
-rw-r--r--src/getbat.c199
-rw-r--r--src/getbat.h37
-rw-r--r--src/tray.c76
-rw-r--r--src/tray.h15
-rw-r--r--src/trayfreq.c69
-rw-r--r--src/trayfreq_set/trayfreq_set.c (renamed from src/trayfreq_set.c)21
-rw-r--r--src/trayfreq_set/trayfreq_set_interface.c (renamed from src/trayfreq_set_interface.c)25
-rw-r--r--src/trayfreq_set/trayfreq_set_interface.h (renamed from src/trayfreq_set_interface.h)15
-rw-r--r--src/utilities.c37
-rw-r--r--src/utilities.h30
-rw-r--r--src/widget_manager.c15
-rw-r--r--src/widget_manager.h15
31 files changed, 629 insertions, 774 deletions
diff --git a/src/Makefile b/src/Makefile
index 8dd15a9..284321f 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,5 +1,4 @@
CC = gcc
-DEFS = -DHAVE_CONFIG_H
GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
GLIB_LIBS = -lglib-2.0
@@ -10,12 +9,20 @@ GTK_CFLAGS = -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pa
#GTK_LIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype
GTK_LIBS = -lgtk-x11-2.0 -lgobject-2.0
-PACKAGE_VERSION = 0.2
-VERSION = 0.2
-
-
-trayfreq_SOURCES = getcore.c getcore.h getfreq.c getfreq.h getgov.c getgov.h tray.c tray.h trayfreq.c utilities.c utilities.h widget_manager.c widget_manager.h trayfreq_set_interface.c trayfreq_set_interface.h config_file.c config_file.h defaults.c defaults.h getbat.c getbat.h bat_tray.c bat_tray.h
-#trayfreq_SOURCES = getcore.c getcore.h getfreq.c getfreq.h getgov.c getgov.h tray.c tray.h trayfreq.c utilities.c utilities.h widget_manager.c widget_manager.h config_file.c config_file.h defaults.c defaults.h getbat.c getbat.h bat_tray.c bat_tray.h
+#PACKAGE_VERSION = 0.3
+#VERSION = 0.3
+
+trayfreq_SOURCES = freq_tray/getcore.c \
+ freq_tray/getfreq.c \
+ freq_tray/getgov.c \
+ tray.c \
+ trayfreq.c \
+ widget_manager.c \
+ trayfreq_set/trayfreq_set_interface.c \
+ config_file.c \
+ defaults.c \
+ bat_tray/bat_tray.c \
+ common.c
trayfreq_CFLAGS = $(GTK_CFLAGS) $(GLIB_CFLAGS) -Wall
@@ -24,7 +31,9 @@ trayfreq_LDFLAGS = $(GTK_LIBS) $(GLIB_LIBS) -lm
trayfreq_set_CFLAGS = $(GTK_CFLAGS) $(GLIB_CFLAGS) -Wall
trayfreq_set_LDFLAGS = $(GTK_LIBS) $(GLIB_LIBS) -lm
-trayfreq_set_SOURCES = trayfreq_set.c getfreq.c getcore.c
+trayfreq_set_SOURCES = trayfreq_set/trayfreq_set.c \
+ freq_tray/getfreq.c \
+ freq_tray/getcore.c
all: trayfreq trayfreq-set
@@ -36,4 +45,4 @@ trayfreq:
$(CC) -o trayfreq $(trayfreq_SOURCES) $(trayfreq_CFLAGS) $(trayfreq_LDFLAGS)
clean:
- rm trayfreq trayfreq-set
+ rm -f trayfreq trayfreq-set
diff --git a/src/bat_tray.c b/src/bat_tray.c
deleted file mode 100644
index c4b7d61..0000000
--- a/src/bat_tray.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/************************************************************************
- * This file is part of trayfreq. *
- * *
- * trayfreq 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 3 of the License, or *
- * (at your option) any later version. *
- * *
- * trayfreq 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 trayfreq. If not, see <http://www.gnu.org/licenses/>. *
- ************************************************************************/
-
-#include "bat_tray.h"
-#include "getbat.h"
-#include "utilities.h"
-
-#include <gtk/gtk.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-static GtkStatusIcon* tray;
-#define TOOLTIP_TEXT_SIZE 500
-gchar tooltip_text[TOOLTIP_TEXT_SIZE];
-
-void bat_tray_set_tooltip(const gchar* msg)
-{
- memset(tooltip_text, '\0', TOOLTIP_TEXT_SIZE);
- memmove(tooltip_text, msg, strlen(msg));
-}
-
-static gboolean update_tooltip(GtkStatusIcon* status_icon,gint x,gint y,gboolean keyboard_mode,GtkTooltip* tooltip,gpointer data)
-{
- gchar msg[500];
- memset(msg, '\0', 500);
-
- //printf("dis: %i, char: %i, full: %i\n", gb_discharging(), gb_charging(), gb_charged());
-
- if(gb_discharging())
- {
- //gchar time[50];
- //memset(time, '\0', 50);
- sprintf(msg, "Discharging (%i%% left)", gb_percent());
- } else if(gb_charging()) {
- //gchar time[50];
- //memset(time, '\0', 50);
- sprintf(msg, "Charging (%i%%)", gb_percent());
- } else if(gb_charged()) {
- sprintf(msg, "Fully Charged\nAC Plugged In");
- } else {
- sprintf(msg, "Unknown Status");
- }
-
- bat_tray_set_tooltip(msg);
- gtk_tooltip_set_text(tooltip, tooltip_text);
-
- return TRUE;
-}
-
-void bat_tray_update_icon_percent()
-{
- gchar* file;
- int percent = gb_percent();
- int adjusted_percent;
- gchar adjusted_percent_string[4];
- memset(adjusted_percent_string, '\0', 4);
-
- if(percent > 90)
- adjusted_percent=100;
- else if(percent > 70)
- adjusted_percent=80;
- else if(percent > 50)
- adjusted_percent=60;
- else if(percent > 30)
- adjusted_percent=40;
- else if(percent > 10)
- adjusted_percent=20;
- else
- adjusted_percent=0;
-
- sprintf(adjusted_percent_string, "%i", adjusted_percent);
-
- if(gb_discharging())
- {
- file = g_strconcat(util_get_prefix(), "/share/trayfreq/traybat-", adjusted_percent_string, ".png", NULL);
- } else if(gb_charging())
- {
- file = g_strconcat(util_get_prefix(), "/share/trayfreq/traybat-", adjusted_percent_string, "-charging.png", NULL);
- } else {
- file = g_strconcat(util_get_prefix(), "/share/trayfreq/traybat-charged.png", NULL);
- }
-
- gtk_status_icon_set_from_file(tray, file);
-}
-
-static gboolean update_icon(gpointer user_data)
-{
- bat_tray_update_icon_percent();
- return TRUE;
-}
-
-void bat_tray_init()
-{
- tray = gtk_status_icon_new();
- gchar* icon_file = g_strconcat(util_get_prefix(), "/share/trayfreq/traybat-charged.png", NULL);
- gtk_status_icon_set_from_file(tray, icon_file);
- gtk_status_icon_set_has_tooltip (tray, TRUE);
- g_signal_connect(G_OBJECT(tray), "query-tooltip", GTK_SIGNAL_FUNC(update_tooltip), NULL);
- gtk_timeout_add(5000, update_icon, NULL);
-}
-
-
-void bat_tray_show()
-{
- gtk_status_icon_set_visible(tray, TRUE);
-}
-
-void bat_tray_hide()
-{
- gtk_status_icon_set_visible(tray, FALSE);
-} \ No newline at end of file
diff --git a/src/bat_tray/bat_tray.c b/src/bat_tray/bat_tray.c
new file mode 100644
index 0000000..0cfb415
--- /dev/null
+++ b/src/bat_tray/bat_tray.c
@@ -0,0 +1,193 @@
+/************************************************************************
+ * This file is part of trayfreq-archlinux. *
+ * *
+ * trayfreq-archlinux 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 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * trayfreq-archlinux 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 trayfreq-archlinux. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ ************************************************************************/
+
+#include "bat_tray.h"
+#include "getbat.h"
+#include "../common.h"
+
+#include <gtk/gtk.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static GtkStatusIcon* tray;
+
+
+int _BAT_NUM;
+char CHARGE_VALUE_PATH[512];
+char CHARGE_STATE_PATH[512];
+
+/***********************************************************************
+ * Return the battery level percentage
+ **********************************************************************/
+//#define get_bat_percent() get_int_value_from_file(CHARGE_VALUE_PATH);
+int get_bat_percent(){return get_int_value_from_file(CHARGE_VALUE_PATH); }
+
+
+#define TOOLTIP_TEXT_SIZE 128
+gchar tooltip_text[TOOLTIP_TEXT_SIZE];
+
+
+/***********************************************************************
+ * Updates the battery tray tooltip text
+ **********************************************************************/
+static gboolean update_tooltip(GtkStatusIcon* status_icon,gint x,gint y,gboolean keyboard_mode,GtkTooltip* tooltip,gpointer data)
+{
+ gchar msg[TOOLTIP_TEXT_SIZE];
+
+ switch(get_battery_state())
+ {
+ case STATE_DISCHARGING:
+ sprintf(msg, "Discharging (%i%% left)", get_bat_percent());
+ break;
+
+ case STATE_CHARGING:
+ break;
+ sprintf(msg, "Charging (%i%%)", get_bat_percent());
+ case STATE_CHARGED:
+ sprintf(msg, "Fully charged");
+ break;
+
+ default:
+ sprintf(msg, "Warning: Unknown status");
+ break;
+ }
+
+ gtk_tooltip_set_text(tooltip, msg);
+
+ return TRUE;
+}
+
+
+/***********************************************************************
+ * Updates the battery tray icon based upon battery percent
+ **********************************************************************/
+static gboolean update_icon(gpointer user_data)
+{
+ gchar* icon_file;
+ unsigned int percent = get_bat_percent();
+ unsigned int adjusted_percent;
+ gchar adjusted_percent_string[4];
+
+ if(percent > 90)
+ adjusted_percent=100;
+ else if(percent > 70)
+ adjusted_percent=80;
+ else if(percent > 50)
+ adjusted_percent=60;
+ else if(percent > 30)
+ adjusted_percent=40;
+ else if(percent > 10)
+ adjusted_percent=20;
+ else
+ adjusted_percent=0;
+
+ sprintf(adjusted_percent_string, "%i", adjusted_percent);
+
+ switch ( get_battery_state() )
+ {
+ case STATE_DISCHARGING:
+ icon_file = g_strconcat("/usr/share/trayfreq/traybat-", adjusted_percent_string, ".png", NULL);
+ break;
+ case STATE_CHARGING:
+ icon_file = g_strconcat("/usr/share/trayfreq/traybat-", adjusted_percent_string, "-charging.png", NULL);
+ break;
+
+ default:
+ icon_file = g_strconcat("/usr/share/trayfreq/traybat-charged.png", NULL);
+ break;
+ }
+ gtk_status_icon_set_from_file(tray, icon_file);
+ return TRUE;
+}
+
+
+
+
+void bat_tray_init()
+{
+ // Get the battery number, store it for later
+ _BAT_NUM = get_bat_num();
+
+ // Set up battery info filenames/paths
+ sprintf(CHARGE_VALUE_PATH, "/sys/class/power_supply/BAT%i/capacity", _BAT_NUM);
+ sprintf(CHARGE_STATE_PATH, "/sys/class/power_supply/BAT%i/status", _BAT_NUM);
+ // NOT USED : sprintf(CURRENT_PATH, "/sys/class/power_supply/BAT%i/charge_now", _BAT_NUM);
+
+
+ tray = gtk_status_icon_new();
+ gchar* icon_file = g_strconcat("/usr/share/trayfreq/traybat-charged.png", NULL);
+ gtk_status_icon_set_from_file(tray, icon_file);
+ gtk_status_icon_set_has_tooltip (tray, TRUE);
+ g_signal_connect(G_OBJECT(tray), "query-tooltip", GTK_SIGNAL_FUNC(update_tooltip), NULL);
+ gtk_timeout_add(5000, update_icon, NULL);
+}
+
+
+void bat_tray_show()
+{
+ gtk_status_icon_set_visible(tray, TRUE);
+}
+
+void bat_tray_hide()
+{
+ gtk_status_icon_set_visible(tray, FALSE);
+}
+
+
+/***********************************************************************
+ * Return the battery state
+ **********************************************************************/
+int get_battery_state()
+{
+ if (file_has_line(CHARGE_STATE_PATH, "Discharging"))
+ return STATE_DISCHARGING;
+
+ if (file_has_line(CHARGE_STATE_PATH, "Full"))
+ return STATE_CHARGED;
+
+ if (file_has_line(CHARGE_STATE_PATH, "Charging"))
+ return STATE_CHARGING;
+
+ return STATE_UNKNOWN;
+}
+
+/***********************************************************************
+ * Get the number of the first (who has more than one?) battery
+ * Returns -1 if no battery present
+ **********************************************************************/
+int get_bat_num()
+{
+ FILE* fd;
+ gchar file[40];
+ unsigned int i;
+ for(i = 0; i < 3; i++)
+ {
+ sprintf(file, "/sys/class/power_supply/BAT%i/present", i);
+
+ if( (fd = fopen(file, "r")) )
+ {
+ if (fgetc(fd) == '1')
+ {
+ fclose(fd);
+ return i;
+ }
+ }
+ }
+ return -1;
+}
diff --git a/src/bat_tray/bat_tray.h b/src/bat_tray/bat_tray.h
new file mode 100644
index 0000000..c20a833
--- /dev/null
+++ b/src/bat_tray/bat_tray.h
@@ -0,0 +1,40 @@
+/************************************************************************
+ * This file is part of trayfreq-archlinux. *
+ * *
+ * trayfreq-archlinux 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 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * trayfreq-archlinux 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 trayfreq-archlinux. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ ************************************************************************/
+
+#ifndef BAT_TRAY_H
+#define BAT_TRAY_H 1
+
+#include <glib.h>
+
+
+// already defined in bat_tray.c : #define gb_percent get_int_value_from_file(CHARGE_VALUE_PATH);
+
+#define STATE_CHARGING 0
+#define STATE_DISCHARGING 1
+#define STATE_CHARGED 2
+#define STATE_FULL STATE_CHARGED
+#define STATE_UNKNOWN 3
+
+void bat_tray_init();
+void bat_tray_show();
+void bat_tray_hide();
+
+int get_battery_state();
+int get_bat_num();
+
+#endif /* ifndef BAT_TRAY_H */ \ No newline at end of file
diff --git a/src/bat_tray.h b/src/bat_tray/getbat.c
index a4a57c1..72408e7 100644
--- a/src/bat_tray.h
+++ b/src/bat_tray/getbat.c
@@ -1,29 +1,30 @@
/************************************************************************
- * This file is part of trayfreq. *
+ * This file is part of trayfreq-archlinux. *
* *
- * trayfreq 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 3 of the License, or *
- * (at your option) any later version. *
+ * trayfreq-archlinux 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 3 of the *
+ * License, or (at your option) any later version. *
* *
- * trayfreq is distributed in the hope that it will be useful, *
+ * trayfreq-archlinux 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 trayfreq. If not, see <http://www.gnu.org/licenses/>. *
+ * along with trayfreq-archlinux. If not, see *
+ * <http://www.gnu.org/licenses/>. *
************************************************************************/
+/*
+#include "getbat.h"
-#ifndef BAT_TRAY_H
-#define BAT_TRAY_H 1
-
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <glib.h>
-void bat_tray_set_tooltip(const gchar* msg);
-void bat_tray_update_icon_percent();
-void bat_tray_init();
-void bat_tray_show();
-void bat_tray_hide();
-#endif \ No newline at end of file
+
+
+//gchar CURRENT_PATH[512];
+*/ \ No newline at end of file
diff --git a/src/bat_tray/getbat.h b/src/bat_tray/getbat.h
new file mode 100644
index 0000000..81c3c0f
--- /dev/null
+++ b/src/bat_tray/getbat.h
@@ -0,0 +1,26 @@
+/************************************************************************
+ * This file is part of trayfreq-archlinux. *
+ * *
+ * trayfreq-archlinux 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 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * trayfreq-archlinux 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 trayfreq-archlinux. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ ************************************************************************/
+
+#ifndef GETBAT_H
+#define GETBAT_H 1
+
+#include <glib.h>
+
+
+
+#endif \ No newline at end of file
diff --git a/src/common.c b/src/common.c
new file mode 100644
index 0000000..ae858a9
--- /dev/null
+++ b/src/common.c
@@ -0,0 +1,86 @@
+/************************************************************************
+ * This file is part of trayfreq-archlinux. *
+ * *
+ * trayfreq-archlinux 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 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * trayfreq-archlinux 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 trayfreq-archlinux. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ ************************************************************************/
+
+#include "common.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+
+#define TRUE true
+#define FALSE false
+
+/***********************************************************************
+ * Gets integer value from file
+ **********************************************************************/
+int get_int_value_from_file(const char* filename)
+{
+ FILE* fd;
+ char buffer[512];
+ int value;
+
+ if(!(fd = fopen(filename, "r")))
+ return -1;
+
+ if (fgets(buffer, 100, fd))
+ value = get_int(buffer);
+
+ fclose(fd);
+ return value;
+}
+
+
+/***********************************************************************
+ * Return true/false if a file has specified line or not
+ **********************************************************************/
+bool file_has_line(const char *filename, const char *line)
+{
+ FILE* fd;
+ char buffer[512];
+
+ if (!(fd = fopen(filename, "r")))
+ return FALSE;
+
+ while (fgets(buffer, sizeof(buffer), fd) != NULL)
+ {
+ if(strstr(buffer, line) != NULL)
+ {
+ fclose(fd);
+ return TRUE;
+ }
+ }
+ fclose(fd);
+ return FALSE;
+}
+
+
+/***********************************************************************
+ * Fetches first number from a string
+ **********************************************************************/
+int get_int(const char* string)
+{
+ char numbers[] = "1234567890";
+ char* first_num;
+
+ first_num = strpbrk(string, numbers);
+ if(first_num)
+ return atoi(first_num);
+
+ return 1;
+}
diff --git a/src/common.h b/src/common.h
new file mode 100644
index 0000000..bf59513
--- /dev/null
+++ b/src/common.h
@@ -0,0 +1,28 @@
+/************************************************************************
+ * This file is part of trayfreq-archlinux. *
+ * *
+ * trayfreq-archlinux 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 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * trayfreq-archlinux 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 trayfreq-archlinux. If not, see *
+ * <http://www.gnu.org/licenses/>. *
+ ************************************************************************/
+
+#ifndef COMMON_H
+#define COMMON_H 1
+
+#include <stdbool.h>
+
+int get_int_value_from_file(const char* filename);
+bool file_has_line(const char *filename, const char *line);
+int get_int(const char* string);
+
+#endif \ No newline at end of file
diff --git a/src/config.h.in b/src/config.h.in
deleted file mode 100644
index c75a3f5..0000000
--- a/src/config.h.in
+++ /dev/null
@@ -1,61 +0,0 @@
-/* src/config.h.in. Generated from configure.ac by autoheader. */
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* "" */
-#undef PREFIX
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
diff --git a/src/config_file.c b/src/config_file.c
index 73ac321..5bfbe65 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1,18 +1,19 @@
/************************************************************************
- * This file is part of trayfreq. *
+ * This file is part of trayfreq-archlinux. *
* *
- * trayfreq 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 3 of the License, or *
- * (at your option) any later version. *
+ * trayfreq-archlinux 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 3 of the *
+ * License, or (at your option) any later version. *
* *
- * trayfreq is distributed in the hope that it will be useful, *
+ * trayfreq-archlinux 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 trayfreq. If not, see <http://www.gnu.org/licenses/>. *
+ * along with trayfreq-archlinux. If not, see *
+ * <http://www.gnu.org/licenses/>. *
************************************************************************/
#include "config_file.h"
diff --git a/src/config_file.h b/src/config_file.h
index d478e64..cb491d4 100644
--- a/src/config_file.h
+++ b/src/config_file.h
@@ -1,18 +1,19 @@
/************************************************************************
- * This file is part of trayfreq. *
+ * This file is part of trayfreq-archlinux. *
* *
- * trayfreq 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 3 of the License, or *
- * (at your option) any later version. *
+ * trayfreq-archlinux 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 3 of the *
+ * License, or (at your option) any later version. *
* *
- * trayfreq is distributed in the hope that it will be useful, *
+ * trayfreq-archlinux 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 trayfreq. If not, see <http://www.gnu.org/licenses/>. *
+ * along with trayfreq-archlinux. If not, see *
+ * <http://www.gnu.org/licenses/>. *
************************************************************************/
#ifndef CONFIG_FILE_H
@@ -30,4 +31,4 @@ gboolean config_open(struct config_fil