[Xfce4-commits] <xfce4-sensors-plugin:master> make it compile again with debug options with gcc4.7; correctly depend on SYSFC_ACPI and PROC_ACPI so that battery works e.g. with debian on leonovo t60p
Fabian
noreply at xfce.org
Sat May 12 11:44:01 CEST 2012
Updating branch refs/heads/master
to 41b2f84c70c2a7c38e07f11659ee93063a03e513 (commit)
from ee59208252e0661d0ee4276a968d4122cc6a8aa9 (commit)
commit 41b2f84c70c2a7c38e07f11659ee93063a03e513
Author: Fabian <timystery at arcor.de>
Date: Sat May 12 11:43:47 2012 +0200
make it compile again with debug options with gcc4.7; correctly depend on SYSFC_ACPI and PROC_ACPI so that battery works e.g. with debian on leonovo t60p
configure.in.in | 9 +++++----
lib/acpi.c | 3 ++-
lib/configuration.c | 3 +--
lib/cpu.c | 2 +-
lib/hddtemp.c | 31 +++++++++++++++++++------------
lib/lmsensors.c | 10 ++++++----
lib/sensors-interface-common.c | 2 ++
lib/sensors-interface.c | 5 ++++-
panel-plugin/sensors-plugin.c | 10 +++++-----
po/Makefile.in.in | 13 +++++++++----
src/actions.c | 11 +++++++++--
src/callbacks.c | 15 +++++++++------
src/interface.c | 12 +++++++++---
src/interface.h | 1 +
14 files changed, 82 insertions(+), 45 deletions(-)
diff --git a/configure.in.in b/configure.in.in
index 1955bbf..8a5bff1 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -196,10 +196,6 @@ if test x"$enable_procacpi" = x"auto"; then
])
fi
-if test x"$enable_procacpi" = x"yes"; then
- AC_DEFINE([HAVE_ACPI], [1], [Define to 1 if /proc/acpi is found])
-fi
-
dnl Check for interface for /sys/class/power_supply to be used
AC_ARG_ENABLE([sysfsacpi], [AC_HELP_STRING([--enable-sysfsacpi], [Use /sys/class/power_supply to read your battery value @<:@default=auto@:>@])],
[],
@@ -222,6 +218,11 @@ if test x"$enable_sysfsacpi" = x"yes"; then
enable_procacpi=yes
fi
+if test x"$enable_procacpi" = x"yes"; then
+ AC_DEFINE([HAVE_ACPI], [1], [Define to 1 if /proc/acpi is found])
+fi
+
+
dnl Check for nvidia blahblah to be used
AC_ARG_ENABLE([xnvctrl],
AC_HELP_STRING([--enable-xnvctrl],
diff --git a/lib/acpi.c b/lib/acpi.c
index 79e655c..979b395 100644
--- a/lib/acpi.c
+++ b/lib/acpi.c
@@ -635,8 +635,9 @@ get_acpi_info (void)
g_free (filename);
if (version!=NULL)
+ {
version = g_strchomp (version);
-
+ }
else // if (version==NULL)
{
filename = g_strdup_printf ("%s/%s_", ACPI_PATH, ACPI_INFO);
diff --git a/lib/configuration.c b/lib/configuration.c
index aa24581..065084f 100644
--- a/lib/configuration.c
+++ b/lib/configuration.c
@@ -191,7 +191,6 @@ void
sensors_read_general_config (XfceRc *rc, t_sensors *sensors)
{
const char *value;
- gint num_chips;
TRACE ("enters sensors_read_general_config");
@@ -241,7 +240,7 @@ sensors_read_general_config (XfceRc *rc, t_sensors *sensors)
sensors->preferred_width = xfce_rc_read_int_entry (rc, "Preferred_Width", 400);
sensors->preferred_height = xfce_rc_read_int_entry (rc, "Preferred_Height", 400);
- num_chips = xfce_rc_read_int_entry (rc, "Number_Chips", 0);
+ //num_chips = xfce_rc_read_int_entry (rc, "Number_Chips", 0);
/* or could use 1 or the always existent dummy entry */
}
diff --git a/lib/cpu.c b/lib/cpu.c
index 34b7fed..3199046 100644
--- a/lib/cpu.c
+++ b/lib/cpu.c
@@ -301,7 +301,7 @@ gtk_cpu_paint (GtkWidget *widget)
TRACE("enter gtk_cpu_paint\n");
- DBG ("Widget=0x%X, Window=0x%X\n", (unsigned int) widget, (unsigned int) widget->window);
+ //DBG ("Widget=0x%X, Window=0x%X\n", (unsigned int) widget, (unsigned int) widget->window);
if (GTK_CPU(widget)->gc==NULL)
{
diff --git a/lib/hddtemp.c b/lib/hddtemp.c
index 052f943..e957dcd 100644
--- a/lib/hddtemp.c
+++ b/lib/hddtemp.c
@@ -85,6 +85,9 @@ void notification_suppress_messages (NotifyNotification *n, gchar *action, gpoin
void quick_message_notify (gchar *message);
void quick_message (gchar *message);
+void quick_message_dialog (gchar *message);
+gboolean quick_message_with_checkbox (gchar *message, gchar *checkboxtext);
+
void read_disks_netcat (t_chip *chip);
void read_disks_linux26 (t_chip *chip);
int get_hddtemp_d_str (char *buffer, size_t bufsize);
@@ -140,7 +143,7 @@ void quick_message_dialog (gchar *message)
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
- message);
+ message, NULL);
/* dialog = gtk_dialog_new_with_buttons (_("Could not run \"hddtemp\""),
NULL, 0, // GTK DIALOG NO MODAL ;-)
@@ -172,7 +175,7 @@ gboolean quick_message_with_checkbox (gchar *message, gchar *checkboxtext) {
0, /* GTK_DIALOG_DESTROY_WITH_PARENT */
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
- message);
+ message, NULL);
gtk_window_set_title(GTK_WINDOW(dialog), _("Sensors Plugin"));
@@ -215,7 +218,7 @@ read_disks_netcat (t_chip *chip)
t_chipfeature *cf;
result = get_hddtemp_d_str(reply, REPLY_MAX_SIZE);
- DBG ("reply=%s\n", reply);
+ DBG ("reply=%s with result=%d\n", reply, (int) result);
tmp = str_split (reply, DOUBLE_DELIMITER);
do {
@@ -385,8 +388,11 @@ populate_detected_drives (t_chip *chip)
int
initialize_hddtemp (GPtrArray *chips, gboolean *suppressmessage)
{
- int generation, major, result, retval;
- struct utsname *p_uname;
+#ifndef HAVE_NETCAT
+ int generation, major, result;
+#endif
+ int retval;
+ //struct utsname *p_uname;
t_chip *chip;
g_assert (chips!=NULL);
@@ -404,7 +410,9 @@ initialize_hddtemp (GPtrArray *chips, gboolean *suppressmessage)
chip->name = g_strdup(_("Hard disks"));
chip->sensorId = g_strdup("Hard disks");
chip->type = HDD;
-
+#ifdef HAVE_NETCAT
+ read_disks_netcat (chip);
+#else
p_uname = (struct utsname *) malloc (sizeof(struct utsname));
result = uname (p_uname);
if (result!=0) {
@@ -418,16 +426,15 @@ initialize_hddtemp (GPtrArray *chips, gboolean *suppressmessage)
/* Note: This is actually supposed to be carried out by ifdef HAVE_LINUX
and major/minor number stuff from compile time*/
-#ifdef HAVE_NETCAT
- read_disks_netcat (chip);
-#else
+
if (strcmp(p_uname->sysname, "Linux")==0 && major>=5)
read_disks_linux26 (chip);
else
read_disks_fallback (chip); /* hopefully, that's a safe variant */
+
+ g_free(p_uname);
#endif
- g_free(p_uname);
remove_unmonitored_drives (chip, suppressmessage);
DBG ("numfeatures=%d\n", chip->num_features);
@@ -517,7 +524,7 @@ get_hddtemp_value (char* disk, gboolean *suppressmessage)
#ifdef HAVE_NETCAT
gchar *tmp, *tmp2, *tmp3;
char reply[REPLY_MAX_SIZE];
- size_t read_size;
+ //size_t read_size;
#endif
if (suppressmessage!=NULL)
@@ -536,7 +543,7 @@ get_hddtemp_value (char* disk, gboolean *suppressmessage)
error->message = g_strdup (_("No concrete error detected.\n"));
if (exit_status==0)
*/
- read_size = get_hddtemp_d_str(reply, REPLY_MAX_SIZE);
+ get_hddtemp_d_str(reply, REPLY_MAX_SIZE);
{
tmp3 = "-255";
diff --git a/lib/lmsensors.c b/lib/lmsensors.c
index de90a53..90ddc5a 100644
--- a/lib/lmsensors.c
+++ b/lib/lmsensors.c
@@ -348,13 +348,14 @@ t_chipfeature *find_chipfeature (const sensors_chip_name *name, t_chip *chip,
int initialize_libsensors (GPtrArray *chips)
{
- int sensorsInit, nr1, nr2, num_sensorchips; /* , numchips; */
+ int sensorsInit, nr1, num_sensorchips; /* , numchips; */
t_chip *chip;
t_chipfeature *chipfeature; /* , *furtherchipfeature; */
const sensors_chip_name *detected_chip;
#if SENSORS_API_VERSION < 0x400 /* libsensors3 */
FILE *file;
const sensors_feature_data *sfd;
+ int nr2;
TRACE("enters initialize_libsensors");
@@ -426,7 +427,6 @@ int initialize_libsensors (GPtrArray *chips)
chip = setup_chip (chips, detected_chip, num_sensorchips);
nr1 = 0;
- nr2 = 0;
/* iterate over chip features, i.e. id, cpu temp, mb temp... */
/* numchips = get_number_chip_features (detected_chip); */
sfd = sensors_get_features (detected_chip, &nr1);
@@ -450,13 +450,14 @@ int initialize_libsensors (GPtrArray *chips)
void
refresh_lmsensors (gpointer chip_feature, gpointer data)
{
- t_chipfeature *cf;
+ //t_chipfeature *cf;
TRACE ("leaves refresh_lmsensors");
g_assert(chip_feature!=NULL);
- cf = (t_chipfeature *) chip_feature;
+ //cf = (t_chipfeature *) chip_feature;
+ //refresh now?
TRACE ("leaves refresh_lmsensors");
}
@@ -476,3 +477,4 @@ free_lmsensors_chip (gpointer chip)
#endif
}
+
diff --git a/lib/sensors-interface-common.c b/lib/sensors-interface-common.c
index f3480d8..25701ad 100644
--- a/lib/sensors-interface-common.c
+++ b/lib/sensors-interface-common.c
@@ -54,6 +54,8 @@ sensors_new (XfcePanelPlugin *plugin, gchar *plugin_config_file)
/* read all sensors from libraries */
result = initialize_all (&(sensors->chips), &(sensors->suppressmessage));
+ if (result==0)
+ return NULL;
sensors->num_sensorchips = sensors->chips->len;
diff --git a/lib/sensors-interface.c b/lib/sensors-interface.c
index 3ae927c..22ea776 100644
--- a/lib/sensors-interface.c
+++ b/lib/sensors-interface.c
@@ -75,8 +75,9 @@ fill_gtkTreeStore (GtkTreeStore *model, t_chip *chip, t_tempscale scale, t_senso
#if defined(HAVE_LIBNOTIFY4) || defined(HAVE_LIBNOTIFY7)
NotifyNotification *nn;
GError *error = NULL;
+ gchar *icon;
#endif
- gchar *summary, *body, *icon;
+ gchar *summary, *body;
float minval, maxval;
@@ -84,7 +85,9 @@ fill_gtkTreeStore (GtkTreeStore *model, t_chip *chip, t_tempscale scale, t_senso
body = _("Seems like there was a problem reading a sensor "
"feature value.\nProper proceeding cannot be "
"guaranteed.");
+#if defined(HAVE_LIBNOTIFY4) || defined(HAVE_LIBNOTIFY7)
icon = "xfce-sensors";
+#endif
TRACE ("enters fill_gtkTreeStore");
diff --git a/panel-plugin/sensors-plugin.c b/panel-plugin/sensors-plugin.c
index 0d4cab5..618b82b 100644
--- a/panel-plugin/sensors-plugin.c
+++ b/panel-plugin/sensors-plugin.c
@@ -295,6 +295,7 @@ sensors_add_graphical_display (t_sensors *sensors)
gtk_label_set_markup (GTK_LABEL(sensors->panel_label_text), text);
g_free (text);
+ gtk_container_set_border_width (GTK_CONTAINER(sensors->widget_sensors), 0);
for (chipNum=0; chipNum < sensors->num_sensorchips; chipNum++) {
chip = (t_chip *) g_ptr_array_index(sensors->chips, chipNum);
g_assert (chip != NULL);
@@ -354,7 +355,6 @@ sensors_add_graphical_display (t_sensors *sensors)
panel->databox = databox;
sensors->panels[chipNum][feature] = (GtkWidget*) panel;
- gtk_container_set_border_width (GTK_CONTAINER(sensors->widget_sensors), 0);
gtk_box_pack_start (GTK_BOX (sensors->widget_sensors),
databox, FALSE, FALSE, INNER_BORDER);
}
@@ -392,6 +392,8 @@ sensors_add_tacho_display (t_sensors *sensors)
gtk_label_set_markup (GTK_LABEL(sensors->panel_label_text), text);
g_free (text);
+
+ gtk_container_set_border_width (GTK_CONTAINER(sensors->widget_sensors), 0);
for (chipNum=0; chipNum < sensors->num_sensorchips; chipNum++) {
chip = (t_chip *) g_ptr_array_index(sensors->chips, chipNum);
g_assert (chip != NULL);
@@ -437,8 +439,6 @@ sensors_add_tacho_display (t_sensors *sensors)
sensors->tachos[chipNum][feature] = (GtkWidget*) tacho;
DBG("8");
- gtk_container_set_border_width (GTK_CONTAINER(sensors->widget_sensors), 0);
- DBG("9");
gtk_box_pack_start (GTK_BOX (sensors->widget_sensors),
tacho, TRUE, TRUE, INNER_BORDER);
DBG("10");
@@ -771,7 +771,7 @@ static gboolean
sensors_create_tooltip (gpointer data)
{
t_sensors *sensors;
- GtkWidget *widget;
+ //GtkWidget *widget;
int i, index_feature, res;
double sensorFeature;
gboolean first, prependedChipName;
@@ -785,7 +785,7 @@ sensors_create_tooltip (gpointer data)
TRACE ("data!=NULL");
sensors = (t_sensors *) data;
- widget = sensors->eventbox;
+ //widget = sensors->eventbox;
myToolTipText = g_strdup (_("No sensors selected!"));
first = TRUE;
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
index 78ffdaa..0b4c992 100644
--- a/po/Makefile.in.in
+++ b/po/Makefile.in.in
@@ -50,8 +50,8 @@ XGETTEXT_ARGS = @XGETTEXT_ARGS@
XGETTEXT = @XGETTEXT@ $(XGETTEXT_ARGS)
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
-MSGMERGE = XGETTEXT_ARGS="$(XGETTEXT_ARGS)" INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
-GENPOT = XGETTEXT_ARGS="$(XGETTEXT_ARGS)" INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
+MSGMERGE = XGETTEXT_ARGS="$(XGETTEXT_ARGS)" INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
+GENPOT = XGETTEXT_ARGS="$(XGETTEXT_ARGS)" INTLTOOL_EXTRACT="$(INTLTOOL_EXTRACT)" XGETTEXT="$(XGETTEXT)" srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
ALL_LINGUAS = @ALL_LINGUAS@
@@ -74,15 +74,20 @@ CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$l
.SUFFIXES:
.SUFFIXES: .po .pox .gmo .mo .msg .cat
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+INTLTOOL_V_MSGFMT = $(INTLTOOL__v_MSGFMT_$(V))
+INTLTOOL__v_MSGFMT_= $(INTLTOOL__v_MSGFMT_$(AM_DEFAULT_VERBOSITY))
+INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@;
+
.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
.po.mo:
- $(MSGFMT) -o $@ $<
+ $(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $<
.po.gmo:
- file=`echo $* | sed 's,.*/,,'`.gmo \
+ $(INTLTOOL_V_MSGFMT)file=`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
diff --git a/src/actions.c b/src/actions.c
index 723b7a5..a72b9ad 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -37,6 +37,7 @@
/* Local includes */
#include "actions.h"
+#include "interface.h"
/* foward declaration */
gboolean
@@ -119,7 +120,7 @@ gtk_widget_unparent_ext (GtkWidget *widget, gpointer data)
void
refresh_tacho_view (t_sensors_dialog *sd)
{
- GtkTreeModel * model;
+ //GtkTreeModel * model;
int i, index_feature, row=0, col=0;
t_sensors *sensors;
t_chipfeature *chipfeature;
@@ -127,6 +128,7 @@ refresh_tacho_view (t_sensors_dialog *sd)
GtkWidget *table; //, *widget;
//GList *list;
gdouble d;
+ gchar *myToolTipText;
TRACE ("enters refresh_tacho_view");
@@ -134,7 +136,7 @@ refresh_tacho_view (t_sensors_dialog *sd)
sensors = sd->sensors;
- model = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->myTreeView));
+ //model = gtk_tree_view_get_model(GTK_TREE_VIEW(sd->myTreeView));
table = sensors->widget_sensors;
@@ -199,6 +201,11 @@ refresh_tacho_view (t_sensors_dialog *sd)
//gtk_cpu_paint(sensors->tachos [i][index_feature]);
//gtk_cpu_expose(sensors->tachos [i][index_feature], NULL);
+ /* #if GTK_VERSION < 2.11 */
+ myToolTipText = g_strdup(_("You can change a feature's properties such as name, colours, min/max value by double-clicking the entry, editing the content, and pressing \"Return\" or selecting a different field."));
+ gtk_tooltips_set_tip (tooltips, GTK_WIDGET(sensors->tachos [i][index_feature]),
+ myToolTipText, NULL);
+
if (col>=3) {
row++;
col = 0;
diff --git a/src/callbacks.c b/src/callbacks.c
index 8681f13..b59d68f 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -164,7 +164,7 @@ list_cell_toggle (GtkCellRendererToggle *cell, gchar *path_str,
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
- gboolean toggle_item, res;
+ gboolean toggle_item; //, res;
//GtkWidget *tacho;
TRACE ("enters list_cell_toggle");
@@ -214,7 +214,8 @@ list_cell_toggle (GtkCellRendererToggle *cell, gchar *path_str,
/* update tooltip and panel widget */
//sensors_show_panel ((gpointer) sd->sensors);
- res = refresh_view ((gpointer) sd);
+ //res =
+ refresh_view ((gpointer) sd);
TRACE ("leaves list_cell_toggle");//~
}
@@ -289,7 +290,7 @@ minimum_changed (GtkCellRendererText *cellrenderertext, gchar *path_str,
GtkTreeIter iter;
t_chip *chip;
t_chipfeature *chipfeature;
- int res;
+ //int res;
TRACE ("enters minimum_changed");
@@ -320,7 +321,8 @@ minimum_changed (GtkCellRendererText *cellrenderertext, gchar *path_str,
/* update panel */
if (sd->sensors->tachos [gtk_combo_box_active][atoi(path_str)]!=NULL)
- res = refresh_view ((gpointer) sd);
+ //res =
+ refresh_view ((gpointer) sd);
TRACE ("leaves minimum_changed");
}
@@ -336,7 +338,7 @@ maximum_changed (GtkCellRendererText *cellrenderertext, gchar *path_str,
GtkTreeIter iter;
t_chip *chip;
t_chipfeature *chipfeature;
- int res;
+ //int res;
TRACE ("enters maximum_changed");
@@ -367,7 +369,8 @@ maximum_changed (GtkCellRendererText *cellrenderertext, gchar *path_str,
/* update panel */
if (sd->sensors->tachos [gtk_combo_box_active][atoi(path_str)]!=NULL)
- res = refresh_view ((gpointer) sd);
+ //res =
+ refresh_view ((gpointer) sd);
TRACE ("leaves maximum_changed");
}
diff --git a/src/interface.c b/src/interface.c
index 0799848..492e399 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -61,7 +61,7 @@ void
add_notebook (GtkWidget *box, t_sensors_dialog *sd)
{
GtkWidget *nb, *child, *tab_label, *scr_win, *fontbutton;
- int res;
+ //int res;
nb = gtk_notebook_new();
gtk_widget_show (nb);
@@ -77,7 +77,8 @@ add_notebook (GtkWidget *box, t_sensors_dialog *sd)
tab_label = gtk_label_new_with_mnemonic(_("_Overview"));
gtk_widget_show (tab_label);
- res = gtk_notebook_append_page (GTK_NOTEBOOK(nb), child, tab_label);
+ //res =
+ gtk_notebook_append_page (GTK_NOTEBOOK(nb), child, tab_label);
child = gtk_vbox_new (FALSE, BORDER);
gtk_container_set_border_width (GTK_CONTAINER (child), BORDER);
@@ -97,7 +98,8 @@ add_notebook (GtkWidget *box, t_sensors_dialog *sd)
tab_label = gtk_label_new_with_mnemonic(_("_Tachometers"));
gtk_widget_show (tab_label);
- res = gtk_notebook_append_page (GTK_NOTEBOOK(nb), child, tab_label);
+ //res =
+ gtk_notebook_append_page (GTK_NOTEBOOK(nb), child, tab_label);
gtk_box_pack_start(GTK_BOX(box), nb, TRUE, TRUE, 0);
}
@@ -142,6 +144,10 @@ create_main_window (t_sensors_dialog *sd)
add_notebook (vbox, sd);
gtk_window_set_default_size (GTK_WINDOW(dlg), sd->sensors->preferred_width, sd->sensors->preferred_height);
+
+ if (!tooltips)
+ tooltips = gtk_tooltips_new();
+
g_signal_connect (G_OBJECT(dlg), "response", G_CALLBACK(on_main_window_response), sd); // also captures the dialog-destroy event and the closekeybinding-pressed event
//g_signal_connect (G_OBJECT(dlg), "destroy", G_CALLBACK(on_main_window_response), sd);
diff --git a/src/interface.h b/src/interface.h
index 8c62893..70d6c27 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -24,5 +24,6 @@
/* Package includes */
#include <sensors-interface-common.h>
+GtkTooltips *tooltips;
GtkWidget * create_main_window (t_sensors_dialog *sd);
More information about the Xfce4-commits
mailing list