/*
- Copyright (C) 2010-2011 wpitchoune@gmail.com
+ Copyright (C) 2010-2011 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
#include <gtk/gtk.h>
-#include <sensors/sensors.h>
-#include <sensors/error.h>
-
#include "config.h"
#include "cfg.h"
-#include "hdd.h"
#include "psensor.h"
#include "graph.h"
#include "ui.h"
#include "nvidia.h"
#endif
+#ifdef HAVE_LIBATIADL
+#include "amd.h"
+#endif
+
#ifdef HAVE_REMOTE_SUPPORT
#include "rsensor.h"
#endif
void print_version()
{
printf("psensor %s\n", VERSION);
- printf(_("Copyright (C) %s wpitchoune@gmail.com\n\
+ printf(_("Copyright (C) %s jeanfi@gmail.com\n\
License GPLv2: GNU GPL version 2 or later \
<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>\n\
This is free software: you are free to change and redistribute it.\n\
struct config *cfg = ui->config;
while (1) {
- /*gdk_threads_enter();*/
g_mutex_lock(ui->sensors_mutex);
if (!sensors)
#ifdef HAVE_NVIDIA
nvidia_psensor_list_update(sensors);
#endif
-
- /*gdk_threads_leave();*/
+#ifdef HAVE_LIBATIADL
+ amd_psensor_list_update(sensors);
+#endif
g_mutex_unlock(ui->sensors_mutex);
sleep(cfg->sensor_update_interval);
cfg = ui->config;
g_mutex_lock(ui->sensors_mutex);
- /*gdk_threads_enter();*/
graph_update(ui->sensors, ui->w_graph, ui->config);
- ui_sensorlist_update(ui->ui_sensorlist);
+ ui_sensorlist_update(ui);
#if defined(HAVE_APPINDICATOR) || defined(HAVE_APPINDICATOR_029)
ui_appindicator_update(ui);
#endif
#ifdef HAVE_UNITY
- ui_unity_launcher_entry_update(ui->sensors);
+ ui_unity_launcher_entry_update(ui->sensors,
+ !cfg->unity_launcher_count_disabled);
#endif
if (ui->graph_update_interval != cfg->graph_update_interval) {
}
g_mutex_unlock(ui->sensors_mutex);
- /*gdk_threads_leave();*/
if (ret == FALSE)
g_timeout_add(1000 * ui->graph_update_interval,
struct ui_psensor ui;
GError *error;
GThread *thread;
- int err, optc;
+ int optc;
char *url = NULL;
int cmdok = 1;
ui.config = config_load();
- err = lmsensor_init();
- if (!err) {
- fprintf(stderr, _("ERROR: lmsensor init failure: %s\n"),
- sensors_strerror(err));
- exit(EXIT_FAILURE);
- }
+ psensor_init();
if (url) {
#ifdef HAVE_REMOTE_SUPPORT
exit(EXIT_FAILURE);
#endif
} else {
-#ifdef HAVE_NVIDIA
- struct psensor **tmp;
-
- tmp = get_all_sensors(600);
- ui.sensors = nvidia_psensor_list_add(tmp, 600);
-
- if (tmp != ui.sensors)
- free(tmp);
-#else
ui.sensors = get_all_sensors(600);
+#ifdef HAVE_NVIDIA
+ ui.sensors = nvidia_psensor_list_add(ui.sensors, 600);
+#endif
+#ifdef HAVE_LIBATIADL
+ ui.sensors = amd_psensor_list_add(ui.sensors, 600);
#endif
}
associate_cb_alarm_raised(ui.sensors, &ui);
/* main window */
- ui.main_window = ui_window_create(&ui);
- ui.main_box = NULL;
+ ui_window_create(&ui);
+ ui.sensor_box = NULL;
/* drawing box */
ui.w_graph = ui_graph_create(&ui);
/* sensor list */
- ui.ui_sensorlist = ui_sensorlist_create(ui.sensors);
-
- ui_main_box_create(&ui);
+ ui_sensorlist_create(&ui);
- gtk_widget_show_all(ui.main_window);
+ ui_window_update(&ui);
thread = g_thread_create((GThreadFunc) update_psensor_measures,
&ui, TRUE, &error);
/* main loop */
gtk_main();
- sensors_cleanup();
+ psensor_cleanup();
psensor_list_free(ui.sensors);
- /* gdk_threads_leave(); */
-
+#ifdef HAVE_NVIDIA
+ nvidia_cleanup();
+#endif
+#ifdef HAVE_LIBATIADL
+ amd_cleanup();
+#endif
return 0;
}