[Goodies-commits] r4934 - in xfce4-sensors-plugin/trunk: . panel-plugin
Fabian Nowak
timystery at xfce.org
Fri Jun 13 22:51:59 CEST 2008
Author: timystery
Date: 2008-06-13 20:51:59 +0000 (Fri, 13 Jun 2008)
New Revision: 4934
Modified:
xfce4-sensors-plugin/trunk/ChangeLog
xfce4-sensors-plugin/trunk/TODO
xfce4-sensors-plugin/trunk/configure.in.in
xfce4-sensors-plugin/trunk/panel-plugin/configuration.c
xfce4-sensors-plugin/trunk/panel-plugin/hddtemp.c
xfce4-sensors-plugin/trunk/panel-plugin/middlelayer.c
xfce4-sensors-plugin/trunk/panel-plugin/sensors.c
xfce4-sensors-plugin/trunk/panel-plugin/sensors.h
Log:
- fixed some requests and known bugs/problems
- ACPI should be working again
Modified: xfce4-sensors-plugin/trunk/ChangeLog
===================================================================
--- xfce4-sensors-plugin/trunk/ChangeLog 2008-06-13 03:13:29 UTC (rev 4933)
+++ xfce4-sensors-plugin/trunk/ChangeLog 2008-06-13 20:51:59 UTC (rev 4934)
@@ -1,5 +1,21 @@
+2008-06-13 timystery
+ * added ability to not display units in text view
+ * add default command via g_strdup instead of constant value
+ * did NOT replace check for hddtemp!=0 and /dev/fd* by ==0; would be very very wrong
+ * refresh ACPI values properly?
+ * added option to have smaller spacings between columns in textual display mode
+
+2008-03-04 timystery
+ * began adding checkbox to not display the units in text view
+
+2008-02-29 timystery
+ * removed some minor mem leaks
+ * changed error handling with hddtemp stuff
+ * changed my mind to start the netcat/nc stuff for 0.11.0 (0.10.99.5 and later)
+
2007-12-14 timystery
* added support for libsensors4
+
2007-12-11 timystery
* removed remainders of playing around with g_spawn*
* removed some debug statements
Modified: xfce4-sensors-plugin/trunk/TODO
===================================================================
--- xfce4-sensors-plugin/trunk/TODO 2008-06-13 03:13:29 UTC (rev 4933)
+++ xfce4-sensors-plugin/trunk/TODO 2008-06-13 20:51:59 UTC (rev 4934)
@@ -7,9 +7,7 @@
Known bugs or user requests
---------------------------
-- add default command via g_strdup instead of constant value
-- add ability to decrease space between columns i ntext view
-- add ability to not display units in text view
+- add ability to decrease space between columns in text view
- better support for hddtemp via nc/netcat
- better checks for sudo/hddtemp/access rights via g_access or g_stat or similar
-- check return code for /dev/fd0 in line 295 of hddtemp.c
+
Modified: xfce4-sensors-plugin/trunk/configure.in.in
===================================================================
--- xfce4-sensors-plugin/trunk/configure.in.in 2008-06-13 03:13:29 UTC (rev 4933)
+++ xfce4-sensors-plugin/trunk/configure.in.in 2008-06-13 20:51:59 UTC (rev 4934)
@@ -6,7 +6,7 @@
dnl 2007 Benedikt Meurer <benny at xfce.org>, Fabian Nowak <timystery at arcor.de>
dnl
-m4_define([plugin_version],[0.10.99.4])
+m4_define([plugin_version],[0.10.99.5])
AC_INIT([xfce4-sensors-plugin], [plugin_version], [timystery at arcor.de])
AC_PREREQ([2.50])
Modified: xfce4-sensors-plugin/trunk/panel-plugin/configuration.c
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/configuration.c 2008-06-13 03:13:29 UTC (rev 4933)
+++ xfce4-sensors-plugin/trunk/panel-plugin/configuration.c 2008-06-13 20:51:59 UTC (rev 4934)
@@ -98,6 +98,10 @@
xfce_rc_write_bool_entry (rc, "Exec_Command", sensors->exec_command);
+ xfce_rc_write_bool_entry (rc, "Show_Units", sensors->show_units);
+
+ xfce_rc_write_bool_entry(rc, "Small_Spacings", sensors->show_smallspacings);
+
xfce_rc_write_entry (rc, "Command_Name", sensors->command_name);
xfce_rc_write_int_entry (rc, "Number_Chips", sensors->num_sensorchips);
@@ -192,6 +196,10 @@
sensors->exec_command = xfce_rc_read_bool_entry (rc, "Exec_Command", TRUE);
+ sensors->show_units= xfce_rc_read_bool_entry (rc, "Show_Units", TRUE);
+
+ sensors->show_smallspacings= xfce_rc_read_bool_entry (rc, "Small_Spacings", FALSE);
+
if ((value = xfce_rc_read_entry (rc, "Command_Name", NULL)) && *value) {
sensors->command_name = g_strdup (value);
}
Modified: xfce4-sensors-plugin/trunk/panel-plugin/hddtemp.c
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/hddtemp.c 2008-06-13 03:13:29 UTC (rev 4933)
+++ xfce4-sensors-plugin/trunk/panel-plugin/hddtemp.c 2008-06-13 20:51:59 UTC (rev 4934)
@@ -123,6 +123,7 @@
if ( strncmp (dirname, "ram", 3)!=0 &&
strncmp (dirname, "loop", 4)!=0 &&
strncmp (dirname, "md", 2)!=0 &&
+ strncmp (dirname, "fd", 2)!=0 &&
strncmp (dirname, "dm-", 3)!=0 ) {
/* TODO: look, if /dev/dirname exists? */
chipfeature = g_new0 (t_chipfeature, 1);
@@ -295,10 +296,10 @@
DBG ("Exit code %d on %s with stdout of %s.\n", exit_status, disk, standard_output);
/* filter those with no sensors out */
- if (exit_status!=0 && strncmp(disk, "/dev/fd", 6)==0) { /* is returned for floppy disks */
+ if (exit_status==0 && strncmp(disk, "/dev/fd", 6)==0) { /* is returned for floppy disks */
value = 0.0;
}
- else if ((exit_status==256 || strlen(standard_error)>0)
+ else if ((exit_status==256 || strlen(standard_error)>0)
&& access (PATH_HDDTEMP, X_OK)==0) /* || strlen(standard_error)>0) */
{
/* note that this check does only work for some versions of hddtmep. */
@@ -321,7 +322,7 @@
quick_message (msg_text);
value = ZERO_KELVIN;
} */
-
+
else if (error && (!result || exit_status!=0))
{
/* DBG ("error %s\n", error->message); */
Modified: xfce4-sensors-plugin/trunk/panel-plugin/middlelayer.c
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/middlelayer.c 2008-06-13 03:13:29 UTC (rev 4933)
+++ xfce4-sensors-plugin/trunk/panel-plugin/middlelayer.c 2008-06-13 20:51:59 UTC (rev 4934)
@@ -185,8 +185,7 @@
g_assert (number<chip->num_features);
feature = (t_chipfeature *) g_ptr_array_index (chip->chip_features, number);
g_assert (feature!=NULL);
- /* *value = get_acpi_zone_value (feature->name); */
- /* refresh_acpi ((gpointer) feature); */
+ refresh_acpi ((gpointer) feature, NULL);
*value = feature->raw_value;
return 0; /* HERE I AM, I WANNA BE FIXED */
#else
Modified: xfce4-sensors-plugin/trunk/panel-plugin/sensors.c
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/sensors.c 2008-06-13 03:13:29 UTC (rev 4933)
+++ xfce4-sensors-plugin/trunk/panel-plugin/sensors.c 2008-06-13 20:51:59 UTC (rev 4934)
@@ -129,13 +129,13 @@
if (chipfeature->show == TRUE) {
panel = (t_barpanel*) sensors->panels[chipNum][feature];
-
- if (sensors->show_labels == TRUE)
+
+ if (sensors->show_labels == TRUE)
gtk_widget_destroy (panel->label);
gtk_widget_destroy (panel->progressbar);
gtk_widget_destroy (panel->databox);
-
+
g_free (panel);
}
}
@@ -402,7 +402,7 @@
else
numCols = itemsToDisplay;
- TRACE ("leaves determine_number_of_cols");
+ TRACE ("leaves determine_number_of_cols width cols=%d", numCols);
return numCols;
}
@@ -414,7 +414,7 @@
gint currentColumn, chipNum, feature;
t_chip *chip;
t_chipfeature *chipfeature;
- gchar *myLabelText;
+ gchar *myLabelText, *tmpstring;
TRACE ("enters sensors_set_text_panel_label");
@@ -435,15 +435,30 @@
g_assert (chipfeature != NULL);
if (chipfeature->show == TRUE) {
- myLabelText = g_strconcat (myLabelText,
+ if (sensors->show_units) {
+ tmpstring = g_strconcat (myLabelText,
"<span foreground=\"",
chipfeature->color, "\" size=\"",
sensors->font_size, "\">",
chipfeature->formatted_value,
"</span>", NULL);
+ }
+ else {
+ tmpstring = g_strdup_printf("%s<span foreground=\"%s\" size=\"%s\">%.1f</span>", myLabelText,
+ chipfeature->color, sensors->font_size,
+ chipfeature->raw_value);
+ myLabelText = g_strconcat (myLabelText, tmpstring, NULL);
+ }
+ g_free (myLabelText);
+
+ myLabelText = tmpstring;
+
if (currentColumn < numCols-1) {
- myLabelText = g_strconcat (myLabelText, " \t", NULL);
+ if (sensors->show_smallspacings)
+ myLabelText = g_strconcat (myLabelText, " ", NULL);
+ else
+ myLabelText = g_strconcat (myLabelText, " \t", NULL);
currentColumn++;
}
else if (itemsToDisplay > 1) { /* do NOT add \n if last item */
@@ -458,7 +473,10 @@
g_assert (itemsToDisplay==0);
gtk_label_set_markup (GTK_LABEL(sensors->panel_label_data), myLabelText);
- g_free(myLabelText);
+ /* if (sensors->show_units) */
+ g_free(myLabelText);
+ /* else: with sprintf, we cannot free the string. how bad. */
+
gtk_misc_set_alignment(GTK_MISC(sensors->panel_label_data), 0.0, 0.5);
gtk_widget_show (sensors->panel_label_data);
@@ -494,7 +512,7 @@
}
}
- TRACE ("leaves count_number_checked_sensor_features");
+ TRACE ("leaves count_number_checked_sensor_features with %d", itemsToDisplay);
return itemsToDisplay;
}
@@ -628,6 +646,8 @@
&sensorFeature);
if ( res!=0 ) {
+ /* FIXME: either print nothing, or undertake appropriate action,
+ * or pop up a message box. */
g_printf ( _("Xfce Hardware Sensors Plugin:\n"
"Seems like there was a problem reading a sensor feature "
"value.\nProper proceeding cannot be guaranteed.\n") );
@@ -837,9 +857,14 @@
/* double-click improvement */
sensors->exec_command = TRUE;
- sensors->command_name = "xsensors";
+ sensors->command_name = g_strdup("xsensors");
sensors->doubleclick_id = 0;
+ /* show units */
+ sensors->show_units = TRUE;
+
+ sensors->show_smallspacings = FALSE;
+
TRACE ("leaves sensors_init_default_values");
}
@@ -1012,11 +1037,15 @@
gtk_widget_hide(sd->labels_Box);
gtk_widget_hide(sd->coloredBars_Box);
gtk_widget_show(sd->font_Box);
+ gtk_widget_show (sd->unit_checkbox);
+ gtk_widget_show (sd->smallspacing_checkbox);
}
else {
gtk_widget_show(sd->labels_Box);
gtk_widget_show(sd->coloredBars_Box);
gtk_widget_hide(sd->font_Box);
+ gtk_widget_hide (sd->unit_checkbox);
+ gtk_widget_hide (sd->smallspacing_checkbox);
}
sd->sensors->display_values_graphically = gtk_toggle_button_get_active
@@ -1183,6 +1212,36 @@
TRACE ("leaves adjustment_value_changed ");
}
+
+static void
+draw_units_changed (GtkWidget *widget, t_sensors_dialog* sd)
+{
+ TRACE ("enters draw_units_changed");
+
+ sd->sensors->show_units = ! sd->sensors->show_units;
+ /* (gboolean) gtk_toggle_button_get_mode ( GTK_TOGGLE_BUTTON (widget) ); */
+
+ sensors_show_text_display (sd->sensors);
+
+ TRACE ("leaves draw_units_changed");
+}
+
+
+static void
+draw_smallspacings_changed (GtkWidget *widget, t_sensors_dialog* sd)
+{
+ TRACE ("enters draw_smallspacings_changed");
+
+ sd->sensors->show_smallspacings = ! sd->sensors->show_smallspacings;
+ /* (gboolean) gtk_toggle_button_get_mode ( GTK_TOGGLE_BUTTON (widget) ); */
+
+ sensors_show_text_display (sd->sensors);
+
+ TRACE ("leaves draw_smallspacings_changed");
+}
+
+
+
/* double-click improvement */
static void
execCommand_toggled (GtkWidget *widget, t_sensors_dialog* sd)
@@ -1368,9 +1427,9 @@
TRACE ("enters list_cell_text_edited");
if (sd->sensors->display_values_graphically == TRUE) {
- DBG("removing graphical panel");
+ DBG("removing graphical panel");
sensors_remove_graphical_panel(sd->sensors);
- DBG("done removing grap. panel");
+ DBG("done removing grap. panel");
}
gtk_combo_box_active =
gtk_combo_box_get_active(GTK_COMBO_BOX (sd->myComboBox));
@@ -1852,6 +1911,44 @@
static void
+add_units_box (GtkWidget * vbox, t_sensors_dialog * sd)
+{
+ TRACE ("enters add_units_box");
+
+ sd->unit_checkbox = gtk_check_button_new_with_mnemonic(_("Show _Units"));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sd->unit_checkbox), sd->sensors->show_units);
+
+ gtk_widget_show (sd->unit_checkbox);
+
+ gtk_box_pack_start (GTK_BOX (vbox), sd->unit_checkbox, FALSE, TRUE, 0);
+
+ g_signal_connect (G_OBJECT (sd->unit_checkbox), "toggled",
+ G_CALLBACK (draw_units_changed), sd );
+
+ TRACE ("leaves add_units_box");
+}
+
+static void
+add_smallspacings_box (GtkWidget * vbox, t_sensors_dialog * sd)
+{
+ TRACE ("enters add_smallspacings_box");
+
+ sd->smallspacing_checkbox = gtk_check_button_new_with_mnemonic(_("Small S_pacing"));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sd->smallspacing_checkbox), sd->sensors->show_smallspacings);
+
+ gtk_widget_show (sd->smallspacing_checkbox);
+
+ gtk_box_pack_start (GTK_BOX (vbox), sd->smallspacing_checkbox, FALSE, TRUE, 0);
+
+ g_signal_connect (G_OBJECT (sd->smallspacing_checkbox), "toggled",
+ G_CALLBACK (draw_smallspacings_changed), sd );
+
+ TRACE ("leaves add_smallspacings_box");
+}
+
+
+
+static void
add_update_time_box (GtkWidget * vbox, t_sensors_dialog * sd)
{
GtkWidget *spinner, *myLabel, *myBox;
@@ -1949,10 +2046,11 @@
add_title_box (_vbox, sd);
add_ui_style_box (_vbox, sd);
-
add_labels_box (_vbox, sd);
add_colored_bars_box (_vbox, sd);
add_font_size_box (_vbox, sd);
+ add_units_box (_vbox, sd);
+ add_smallspacings_box(_vbox, sd);
TRACE ("leaves add_view_frame");
}
@@ -2024,10 +2122,8 @@
g_free(sd->sensors->command_name);
sd->sensors->command_name =
g_strdup ( gtk_entry_get_text(GTK_ENTRY(sd->myCommandName_Entry)) );
-
sensors_write_config (sd->sensors->plugin, sd->sensors);
}
-
gtk_widget_destroy (sd->dialog);
xfce_panel_plugin_unblock_menu (sd->sensors->plugin);
Modified: xfce4-sensors-plugin/trunk/panel-plugin/sensors.h
===================================================================
--- xfce4-sensors-plugin/trunk/panel-plugin/sensors.h 2008-06-13 03:13:29 UTC (rev 4933)
+++ xfce4-sensors-plugin/trunk/panel-plugin/sensors.h 2008-06-13 20:51:59 UTC (rev 4934)
@@ -108,6 +108,12 @@
/* show labels in panel (GUI mode only) */
gboolean show_labels;
+ /* show units in textual view */
+ gboolean show_units;
+
+ /* show small spacings only in textual view */
+ gboolean show_smallspacings;
+
/* show colored bars (GUI mode only) */
gboolean show_colored_bars;
@@ -205,6 +211,8 @@
GtkWidget *myTreeView;
GtkTreeStore *myListStore[10]; /* replace by GPtrArray as well */
GtkWidget *font_Box; /* used to disable font size option when using graphical view */
+ GtkWidget *unit_checkbox;
+ GtkWidget *smallspacing_checkbox;
GtkWidget *labels_Box; /* used to enable 'show labels' option when using graphical view */
GtkWidget *coloredBars_Box;
GtkWidget *temperature_radio_group;
More information about the Goodies-commits
mailing list