display notification when alert is enabled and not when graph is draw
[psensor.git] / src / main.c
index 559400b..61b920d 100644 (file)
@@ -87,7 +87,7 @@ static void print_help()
 {
        printf(_("Usage: %s [OPTION]...\n"), program_name);
 
-       puts(_("psensor is a GTK application for monitoring hardware sensors, "
+       puts(_("Psensor is a GTK+ application for monitoring hardware sensors, "
               "including temperatures and fan speeds."));
 
        puts("");
@@ -241,7 +241,7 @@ gboolean ui_refresh_thread(gpointer data)
 static void cb_alarm_raised(struct psensor *sensor, void *data)
 {
 #ifdef HAVE_LIBNOTIFY
-       if (sensor->enabled)
+       if (sensor->alarm_enabled)
                ui_notify(sensor, (struct ui_psensor *)data);
 #endif
 }
@@ -296,7 +296,7 @@ associate_cb_alarm_raised(struct psensor **sensors, struct ui_psensor *ui)
                s->alarm_low_thresold
                        = config_get_sensor_alarm_low_thresold(s->id);
 
-               if (is_temp_type(s->type)) {
+               if (is_temp_type(s->type) || is_fan_type(s->type)) {
                        s->alarm_enabled
                            = config_get_sensor_alarm_enabled(s->id);
                } else {
@@ -436,8 +436,6 @@ static void cleanup(struct ui_psensor *ui)
        config_cleanup();
 
        log_debug("Cleanup done, closing log");
-
-       log_close();
 }
 
 /*
@@ -456,8 +454,8 @@ static struct psensor **create_sensors_list(const char *url,
                rsensor_init();
                sensors = get_remote_sensors(url, 600);
 #else
-               fprintf(stderr,
-                       _("ERROR: Not compiled with remote sensor support.\n"));
+               log_err(_("Psensor has not been compiled"
+                         " with remote sensor support."));
                exit(EXIT_FAILURE);
 #endif
        } else {
@@ -544,7 +542,7 @@ int main(int argc, char **argv)
 
        if (!new_instance && g_application_get_is_remote(app)) {
                g_application_activate(app);
-               log_warn(_("Psensor instance already exists"));
+               log_warn(_("A Psensor instance already exists."));
                exit(EXIT_SUCCESS);
        }
 
@@ -619,7 +617,9 @@ int main(int argc, char **argv)
 
        g_object_ref(app);
        cleanup(&ui);
+
        log_debug("Quitting...");
+       log_close();
 
        return 0;
 }