avoid to store configuration in psensor struct
[psensor.git] / src / main.c
index e9ac03f..f817c14 100644 (file)
@@ -44,6 +44,7 @@
 #include "slog.h"
 #include "ui_pref.h"
 #include "ui_graph.h"
+#include <ui_notify.h>
 #include "ui_status.h"
 
 #ifdef HAVE_UNITY
 
 #include "ui_appindicator.h"
 
-#ifdef HAVE_LIBNOTIFY
-#include "ui_notify.h"
-#endif
-
 #ifdef HAVE_GTOP
 #include <pgtop2.h>
 #endif
 
 static const char *program_name;
 
-static void print_version()
+static void print_version(void)
 {
        printf("psensor %s\n", VERSION);
        printf(_("Copyright (C) %s jeanfi@gmail.com\n"
@@ -86,7 +83,7 @@ static void print_version()
               "2010-2014");
 }
 
-static void print_help()
+static void print_help(void)
 {
        printf(_("Usage: %s [OPTION]...\n"), program_name);
 
@@ -211,7 +208,7 @@ static void indicators_update(struct ui_psensor *ui)
                ui_status_update(ui, attention);
 }
 
-gboolean ui_refresh_thread(gpointer data)
+static gboolean ui_refresh_thread(gpointer data)
 {
        struct config *cfg;
        gboolean ret;
@@ -251,10 +248,8 @@ gboolean ui_refresh_thread(gpointer data)
 
 static void cb_alarm_raised(struct psensor *sensor, void *data)
 {
-#ifdef HAVE_LIBNOTIFY
        if (sensor->alarm_enabled)
                ui_notify(sensor, (struct ui_psensor *)data);
-#endif
 
        notify_cmd(sensor);
 }
@@ -347,13 +342,11 @@ static void associate_preferences(struct psensor **sensors)
                        s->name = n;
                }
 
-               s->appindicator_enabled = config_is_appindicator_enabled(s->id);
-
                sensor_cur++;
        }
 }
 
-static void log_init()
+static void log_init(void)
 {
        const char *dir;
        char *path;
@@ -372,12 +365,12 @@ static void log_init()
 }
 
 static struct option long_options[] = {
-       {"version", no_argument, 0, 'v'},
-       {"help", no_argument, 0, 'h'},
-       {"url", required_argument, 0, 'u'},
-       {"debug", required_argument, 0, 'd'},
-       {"new-instance", no_argument, 0, 'n'},
-       {0, 0, 0, 0}
+       {"version", no_argument, NULL, 'v'},
+       {"help", no_argument, NULL, 'h'},
+       {"url", required_argument, NULL, 'u'},
+       {"debug", required_argument, NULL, 'd'},
+       {"new-instance", no_argument, NULL, 'n'},
+       {NULL, 0, NULL, 0}
 };
 
 static gboolean initial_window_show(gpointer data)
@@ -402,7 +395,7 @@ static gboolean initial_window_show(gpointer data)
        return FALSE;
 }
 
-static void log_glib_info()
+static void log_glib_info(void)
 {
        log_debug("Compiled with GLib %d.%d.%d",
                  GLIB_MAJOR_VERSION,