Updated copyrights to 2010.

Reimplement locale stuff in hz (adding different controls for C and C++
locales), also take the recent locale-related changes in gtkmm into account.
Cleanups in snprintf-related code, portable_snprintf().
Added doxygen-style comments to some hz headers.
Better console redirection handling for win32.
Blacklisted linux device mapper devices (annoying in LVM setups).
Added beesu support and generally improved gsmartcontrol-root script (this is
needed for Fedora 14 which doesn't have any old supported su mechanisms).
Added "menu" dependency for deb packages.
Added kdev4 project.
This commit is contained in:
Alexander Shaduri
2010-12-26 20:35:24 +00:00
parent 28551a9666
commit 33b59d5723
195 changed files with 1221 additions and 630 deletions
+1 -1
View File
@@ -13,4 +13,4 @@ install-sh
*.glade.cpp
*.ui.cpp
*.txt.cpp
gsmartcontrol.spec
.kdev4
+199 -127
View File
@@ -19,6 +19,17 @@ A treeview (also iconview, combobox) from glade comes
with existing model, which should be unset.
Bugs / patches:
Patch pangomm for Pango::strip_markup().
+ gtkmm bug: No Gtk::AboutDialog::set_logo(NULL);
+ Gtk::Main m(argc, argv, false);
If gtk_get_option_group() and g_option_context_parse() were used before,
this generates a warning:
(gsmartcontrol:28241): Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
--------------------------------------------------------
@@ -27,24 +38,26 @@ TODO:
+Clear the test message area when starting a new test.
+Support launching from read-only media (win32 zip version) (seems like this was a windows problem).
Add debian/ubuntu's su-to-root support to gsmartcontrol-root.
Testing: If ETA time has elapsed, but it's still only at 10% completion,
ETA 0 is displayed. Fix.
Testing:
If ETA time has elapsed, but it's still only at 10% completion,
ETA 0 is displayed. Fix.
If smartctl -t ... returns an error, testing=true should not be set.
Detect running tests on launch (maybe ask the user too? some tests
may be stuck due to bad firmware).
Allow quitting when test is running (ask first).
Testing: If smartctl -t ... returns an error, testing=true should not be set.
Testing: Detect running tests on launch (maybe ask the user too? some tests
may be stuck due to bad firmware).
Testing: Allow quitting when test is running (ask first).
Add ability to configure default save filename (in config-file only):
Add ability to configure default save filename (in config-file only?):
"{serial}-{model}-{date}.txt", with the default being "{model}-{date}.txt".
Add string_replace_linear(), where multiple strings are replaced into the
original string (as opposed to previous result).
+Re-check long double printing - win32 libc doesn't support it, a cast
to double is needed.
The underlying problem is that in msvc, long double is the same size
as double, so printf() has mingw-incompatible presentation of long double.
Add support for launching with consolehelper (from usermode package).
Fedora uses this by default.
@@ -54,16 +67,172 @@ Add support for launching with consolehelper (from usermode package).
but I think we can check it with "which".
http://fedoranews.org/contributors/matt_hansen/nautilus/
Highlight soft-warning-having devices too (configurable?).
Add "Show output" button to the devices with "No further info available...".
If the detection executes "smartctl -i", don't execute it again afterwards.
When adding device, have an option to specify "-d" type and other parameters.
This is needed to support multi-disk devices.
Maybe make "-d" a dropdown?
Not sure, "-l aaa /tmp" doesn't list all types. Also raid...
Add "Show output" button to the devices with "No further info available...".
Add support for multiple drives behind devices.
Add support for specifying these drives on gsmartcontrol command-line,
each one with optional smartctl parameters.
Use :: as delimiter, as in device::-d_string::other_options.
Show in UI as device (-d_string).
Rework drive properties UI:
add properties for each multi-drive.
smartctl options
use 48-bit or not or auto.
Enable/disable/dont_touch SMART on startup for this drive.
Enable/disable/dont_touch AODC on startup for this drive.
Add --init-smart-only option to only apply the SMART/AODC enabling status
from the drive properties.
Add also --no-init-smart to avoid doing that on GUI startup.
Notifications:
Tied to (drive::subdrive, notif_key, exact_value(optional)).
If exact_value isn't specified when ignoring, notify on every value change.
Ignore options:
Per-drive: Ignore all notifications for this key, ignore only this value.
Don't generate multiple notifications for the same drive/key combo.
Clearing in preferences: Clear all ignored, clear ignored for this drive, clear individual.
Soft-warnings require "-a" by default, tricky for scsi (maybe try -a, then -i?).
Monitor:
Needs root access, so not gonna happen until the dbus/udisks stuff
is finalized.
Same program, add --tray option to start in tray only.
Option to enable the tray icon.
Option to continue running in the tray on window close.
Use freedesktop notifications when notifications are generated
and we're running in tray only.
Don't generate the same notification at a single run time if it was
ignored (untouched) by the user; Change the tray icon and
show them in the main window instead.
Periodically re-run smartctl to refresh the notifications.
Periodically see if drives were added / removed (possibly use OS callbacks
instead of polling?)
Fix inability to detect types in some error logs.
Options->Prefs->Drives
Add a hint about "pd0" for Windows version.
If a drive is not recognized, suggest using -d (sat, sat,12, ...)
Refer the user to
http://sourceforge.net/apps/trac/smartmontools/wiki/Supported_USB-Devices
RAID:
http://sourceforge.net/apps/trac/smartmontools/wiki/Supported_RAID-Controllers
Areca Linux:
Call as: smartctl -i -d areca,[1-24] /dev/sg0
Detection:
Check if /proc/scsi/sg/device_strs contains "Areca RAID controller".
If not, there's no Areca controller present.
Check /proc/scsi/sg/devices, the line # with type 3 is the sg* number.
The "host" field value is the N value in /sys, see below.
Check /sys/bus/scsi/devices/hostN/scsi_host/hostN/host_fw_hd_channels, set
its contents as the number of ports. If not present, use 24.
Probe each port for a valid drive: If the output contains "Device Read Identity Failed",
then there is no drive on that port (or Areca has an old firmware, nothing we can
do there).
Notification: If /sys/bus/scsi/devices/hostN/scsi_host/hostN/host_fw_version
is older than "V1.46 2009-01-06", notify the user (maybe its better to grep
the smartctl output for that on port 0?).
3ware Linux:
Call as: smartctl -i -d 3ware,[0-127] /dev/twa[0-15] (or twe[0-15])
Use twe* for [678]xxx series, and twa* for 9xxx series.
Note: twe* devices are limited to [0-15] ports (not sure about this).
Note: /dev/tw* devices may not exist, they are created by smartctl on the first run.
Note: for twe*, /dev/sda may also exist (to be used with -d 3ware,N), we should
somehow detect and ignore them.
Note: when specifying non-existent port, either a "Device Read Identity Failed"
error, or a "blank" info may be returned.
Detection:
Grep /proc/devices for "twa" or "twe" (e.g. "251 twa"). Use this for /dev/tw* part.
Grep /proc/scsi/scsi for AMCC (3ware, LSI too?), use number of matched lines N
for /dev/tw*[0, N-1].
For detecting the number of ports, use "tw_cli /c0 show all", 0 being the controller N.
If there's no tw_cli, we'll have to scan all 127 ports.
3ware FreeBSD:
Call as: smartctl -i -d 3ware,[0-127] /dev/twa0 (or twe0)
Detection: unknown.
3ware Windows (XP so far, maybe the same under the others):
For 3ware 9xxx only.
Call as: smartctl -i sd[a-z],N
N is port, a-z is logical drive (unit) provided by controller.
N is limited to [0, 31] in the code.
The sd[a-z] device actually exists as \\.\PhysicalDrive[0-N].
No idea how to check if it's 3ware.
Call as: smarctl -i tw_cli/cx/py
This runs tw_cli tool and parses the output; controller x, port y.
tw_cli is needed for 64-bit systems, as well as older controllers.
In tw_cli mode only limited information-gathering is supported.
tw_cli (part of 3DM2) is automatically added to system PATH,
no need to look for it.
3DM2 install can be detected by checking:
HKEY_USERS\.DEFAULT\Software\3ware\3DM2, InstallPath
Another option for detection (whether it's 3ware) would be getting
\\.\PhysicalDrive0 properties, like smartctl does.
Newer (post-5.39.1) smartctl supports --scan-open, which will give us:
/dev/sda,0 -d ata (opened)
/dev/sda,1 -d ata (opened)
-d 3ware is not needed under Windows. We should treat sda as pd0
and remove pd0 from PhysicalDrive-detected list.
Running smartctl on sda gives almost the same result as on sda,0.
LSI MegaRAID (SCSI/SAS), Linux:
Call as: smartctl -i -d megaraid,[0-?] /dev/sda
We should differentiate between ordinary sda and RAID one (not sure if sda is detected).
Detection: unknown.
HighPoint RocketRAID ((S)ATA) Linux:
Call as: smartctl -i -d hpt,[1-8]/[1-8] /dev/sda
Call as: smartctl -i -d hpt,[1-8]/[1-8]/[1-15] /dev/sda
Note: /dev/sda should be derived from this controller.
We should differentiate between ordinary sda and RAID one (not sure if sda is detected).
Smartctl docs specify smaller limits, but the code says these are the ones.
Detection: unknown.
HighPoint RocketRAID ((S)ATA) FreeBSD:
Call as: smartctl -i -d hpt,[1-8]/[1-8] /dev/hptrr
Call as: smartctl -i -d hpt,[1-8]/[1-8]/[1-15] /dev/hptrr
Note: /dev/hptrr should be derived from this controller.
Smartctl docs specify smaller limits, but the code says these are the ones.
Detection: unknown.
TODO: Analyze sent info.
CCISS (HP (Compaq) Smart Array Controller) Linux:
Call as: smartctl -a -d cciss,[0-127] /dev/cciss/c0d0
c0d0 is the controller (d0 seems to be a logical drive, doesn't matter?).
/dev/cciss/c0d0p1 is the first ordinary partition (used in mount, etc...).
The port limit had a brief regression in 5.39.x (limited to 15).
5.39 doesn't seem to work at all (prereleases work with P400 controller)?
Possibly a 64-bit-only issue?
To detect controller presence: cat /proc/devices, contains "cciss0"
for controller 0.
There is a cciss_vol_status utility but it doesn't report anything except "OK" status.
It may not return the "SMART Health Status: OK" line in smartctl -i for some reason?
(It returns it in -a though, and in some freebsd output I found).
If no /dev/cciss exists, you may need to run "cd /dev; ./MAKEDEV cciss".
Smartctl SVN has some /dev/sg* stuff, check it out.
CCISS (HP (Compaq) Smart Array Controller) FreeBSD:
Seems to be the same as Linux (uses the same driver?).
Detection: unknown.
Patch pangomm for Pango::strip_markup().
No Gtk::AboutDialog::set_logo(NULL);
libdebug:
@@ -74,124 +243,33 @@ libdebug:
use format_time() instead of ctime() and friends, with ISO formatting.
48-bit ATA command support:
'-l xerror' -> Extended Comprehensive Error log: An multi-sector and
LBA48 capable version of '-l error'. Output is similar, except more
entries can exists and the high bytes of the registers are also printed.
Some newer drives (Samsung) only write to this log.
If the detection executes "smartctl -i", don't execute it again afterwards.
RAID:
http://sourceforge.net/apps/trac/smartmontools/wiki/Supported_RAID-Controllers
Areca Linux:
Call as: smartctl -i -d areca,[1-24] /dev/sg0
Detection:
Check if /proc/scsi/sg/device_strs contains "Areca RAID controller".
If not, there's no Areca controller present.
Check /proc/scsi/sg/devices, the line # with type 3 is the sg* number.
The "host" field value is the N value in /sys, see below.
Check /sys/bus/scsi/devices/hostN/scsi_host/hostN/host_fw_hd_channels, set
its contents as the number of ports. If not present, use 24.
Probe each port for a valid drive: If the output contains "Device Read Identity Failed",
then there is no drive on that port (or Areca has an old firmware, nothing we can
do there).
Notification: If /sys/bus/scsi/devices/hostN/scsi_host/hostN/host_fw_version
is older than "V1.46 2009-01-06", notify the user (maybe its better to grep
the smartctl output for that on port 0?).
3ware Linux:
Call as: smartctl -i -d 3ware,[0-127] /dev/twa[0-15] (or twe[0-15])
Use twe* for [678]xxx series, and twa* for 9xxx series.
Note: twe* devices are limited to [0-15] ports (not sure about this).
Note: /dev/tw* devices may not exist, they are created by smartctl on the first run.
Note: for twe*, /dev/sda may also exist (to be used with -d 3ware,N), we should
somehow detect and ignore them.
Note: when specifying non-existent port, either a "Device Read Identity Failed"
error, or a "blank" info may be returned.
Detection:
Grep /proc/devices for "twa" or "twe" (e.g. "251 twa"). Use this for /dev/tw* part.
Grep /proc/scsi/scsi for AMCC (3ware, LSI too?), use number of matched lines N
for /dev/tw*[0, N-1].
3ware FreeBSD:
Call as: smartctl -i -d 3ware,[0-127] /dev/twa0 (or twe0)
3ware Windows:
For 9xxx only.
Call as: smartctl -i sd[a-z],N
N is port, a-z is logical drive (unit) provided by controller.
Call as: smarctl -i tw_cli/cx/py
This runs tw_cli tool and parses the output; controller x, port y.
tw_cli is needed for 64-bit systems, as well as older controllers.
In tw_cli mode only limited information-gathering is supported.
LSI MegaRAID (SCSI/SAS), Linux:
Call as: smartctl -i -d megaraid,[0-?] /dev/sda
HighPoint RocketRAID ((S)ATA) Linux:
Call as: smartctl -i -d hpt,[1-8]/[1-8] /dev/sda
Call as: smartctl -i -d hpt,[1-8]/[1-8]/[1-15] /dev/sda
Note: /dev/sda should be derived from this controller.
Smartctl docs specify smaller limits, but the code says these are the ones.
HighPoint RocketRAID ((S)ATA) FreeBSD:
Call as: smartctl -i -d hpt,[1-8]/[1-8] /dev/hptrr
Call as: smartctl -i -d hpt,[1-8]/[1-8]/[1-15] /dev/hptrr
Note: /dev/hptrr should be derived from this controller.
Smartctl docs specify smaller limits, but the code says these are the ones.
CCISS (HP (Compaq) Smart Array Controller) Linux:
Call as: smartctl -a -d cciss,[0-15] /dev/cciss/c0d0
c0d0 is the controller (d0 seems to be a logical
drive, but it doesn't seem to matter?).
An unofficial patch adds support for [0-127] ports.
CCISS (HP (Compaq) Smart Array Controller) FreeBSD:
Seems to be the same as Linux (uses the same driver?).
'-l xselftest' -> Extended Self Test Log: An multi-sector and LBA48
capable version of '-l selftest'. Output will be similar, except more
entries can exists and the LBA values can be somewhat longer.
"smartctl -l this_wont_exist" gives the list of supported logs - this
is needed to detect xerror / xselftest support in smartctl.
'-l sataphy' -> SATA Phy event counters: Non-SMART feature, useful to detect SATA cabling problems.
'-l xerror' -> Extended Comprehensive Error log: An multi-sector and
LBA48 capable version of '-l error'. Output is similar, except more
entries can exists and the high bytes of the registers are also printed.
Some newer drives (Samsung) only write to this log.
'-l scttemp' -> SCT Temperature history table. See below.
SCT Temperatures
-l scttemp prints temperature and history.
-t scttempint,N[,p] (N - count, p - preserve across reset or not).
This configures temperature logging interval (1 min by default) and clears the history.
-l scterc[,...] to get/set the SCT Error Recovery Control time limit (5.40 and newer).
'-l xselftest' -> Extended Self Test Log: An multi-sector and LBA48
capable version of '-l selftest'. Output will be similar, except more
entries can exists and the LBA values can be somewhat longer.
"smartctl -l this_wont_exist" gives the list of supported logs - this
is needed to detect xerror / xselftest support in smartctl.
Careful with GPL (xerror...) stuff until the jmicron situation clears up.
Add detection for Interix (i586-pc-interix3), maybe with debian?
Re-check long double printing - win32 libc doesn't support it, a cast
to double is needed.
The underlying problem is that in msvc, long double is the same size
as double, so printf() has mingw-incompatible presentation of long double.
Support USB flash disks in CVS smartctl versions:
Try smartctl -i /dev/sdc;
If it returns "Smartctl: please specify device type with the -d option.",
try "-d scsi", which should at least give us the name.
Maybe make it easier to specify "-d" (with a dropdown?)
Not sure, "-l aaa /tmp" doesn't list all types.
@@ -237,15 +315,9 @@ Maybe make it easier to specify "-d" (with a dropdown?)
+ smartctl exited with error - look it up in error map.
SCT Temperatures
-l scttemp prints temperature and history.
-t scttempint,N[,p] (N - count, p - preserve across reset or not).
This configures temperature logging interval (1 min by default) and clears the history.
+Tests:
Ability to detect a testing drive on boot, show its info with testing tab.
Run one-time Immediate Offline test (-t offline).
Offline tests only update Attributes, and if errors are found they will
appear in SMART error log. Self-test logs are unaffected.
+1 -1
View File
@@ -1,5 +1,5 @@
AC_INIT([GSmartControl],[0.8.5],[],[gsmartcontrol])
AC_INIT([GSmartControl],[0.8.6],[],[gsmartcontrol])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([config.h])
@@ -1,9 +1,9 @@
#!/bin/bash
############################################################################
# Copyright:
# (C) 2008 - 2009 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
# License: See LICENSE_whatever.txt file
# (C) 2008 - 2010 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
# (C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
# License: See LICENSE_unlicense.txt file
############################################################################
device="$1";
@@ -1,9 +1,9 @@
#!/bin/bash
############################################################################
# Copyright:
# (C) 2008 - 2009 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
# License: See LICENSE_whatever.txt file
# (C) 2008 - 2010 Alex Butcher <alex dot butcher 'at' assursys.co.uk>
# (C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
# License: See LICENSE_unlicense.txt file
############################################################################
if [ "$1" = "-V" ]; then
+35 -20
View File
@@ -1,11 +1,12 @@
#!/bin/bash
############################################################################
# Copyright:
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
# (C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
# License: See LICENSE_zlib.txt file
############################################################################
# Run gsmartcontrol with root, asking for root password first.
# export GSMARTCONTROL_SU to override a su command (e.g. "kdesu -c").
EXEC_BIN="@prefix@/bin/gsmartcontrol";
prog_name="gsmartcontrol"
@@ -44,8 +45,8 @@ fi
# They're basically the same, only the order is different.
# sux requires xterm to ask for the password.
# xdg-su is basically like this script, except worse :)
gnome_sus="gnomesu gksu kdesu xdg-su sux";
kde_sus="kdesu gnomesu gksu xdg-su sux";
gnome_sus="gnomesu gksu kdesu beesu xdg-su sux";
kde_sus="kdesu gnomesu gksu beesu xdg-su sux";
other_sus="$gnome_sus";
@@ -60,18 +61,20 @@ elif [ "$DESKTOP" = "other" ]; then
candidates="$other_sus";
fi
for subin in $candidates; do
which $subin &>/dev/null
if [ $? -eq 0 ]; then
found_su="$subin";
break;
fi
done
if [ "$GSMARTCONTROL_SU" = "" ]; then
for subin in $candidates; do
which $subin &>/dev/null
if [ $? -eq 0 ]; then
found_su="$subin";
break;
fi
done
if [ "$found_su" = "" ]; then
xmessage "Error launching ${prog_name}: No suitable su mechanism found.
Try installing kdesu, gnomesu, gksu or sux first.";
exit 1;
if [ "$found_su" = "" ]; then
xmessage "Error launching ${prog_name}: No suitable su mechanism found.
Try installing kdesu, gnomesu, gksu, beesu or sux first.";
exit 1;
fi
fi
@@ -82,7 +85,10 @@ fi
# Add these directories _before_ existing PATH, so that the user is not
# tricked into running it from some other path (we're running as root with
# the user's env after all).
export PATH="/usr/sbin:/usr/local/sbin:$PATH"
# Note that beesu won't show a GUI login box if /usr/sbin is before /usr/bin,
# so add it first as well.
EXTRA_PATHS="/usr/bin:/usr/sbin:/usr/local/sbin";
export PATH="$EXTRA_PATHS:$PATH"
# echo $found_su;
@@ -90,20 +96,29 @@ export PATH="/usr/sbin:/usr/local/sbin:$PATH"
# Examples:
# gnomesu -c 'gsmartcontrol --no-scan'
# kdesu -c 'gsmartcontrol --no-scan'
# beesu -P 'gsmartcontrol --no-scan'
# xterm -e sux -c 'gsmartcontrol --no-scan' # sux asks for password in a terminal
full_cmd=""
if [ "$found_su" = "sux" ]; then
full_cmd="xterm -e sux -c '$EXEC_BIN $@'"
full_cmd="";
if [ "$GSMARTCONTROL_SU" != "" ]; then
full_cmd="$GSMARTCONTROL_SU '$EXEC_BIN $@'";
elif [ "$found_su" = "sux" ]; then
full_cmd="xterm -e sux -c '$EXEC_BIN $@'";
elif [ "$found_su" = "gksu" ]; then
full_cmd="$found_su '$EXEC_BIN $@'"
full_cmd="$found_su '$EXEC_BIN $@'";
elif [ "$found_su" = "beesu" ]; then
full_cmd="$found_su -P '$EXEC_BIN $@'";
else # gnomesu, kdesu, xdg-su
full_cmd="$found_su -c '$EXEC_BIN $@'"
full_cmd="$found_su -c '$EXEC_BIN $@'";
fi
#echo $full_cmd
eval $full_cmd
+1 -1
View File
@@ -12,7 +12,7 @@ Standards-Version: 3.7.3
Package: gsmartcontrol
Architecture: any
#Depends: ${shlibs:Depends}, ${misc:Depends}, smartmontools
Depends: ${shlibs:Depends}, smartmontools
Depends: ${shlibs:Depends}, smartmontools, menu
Description: Hard disk drive health inspection tool
GSmartControl is a graphical user interface for smartctl (from smartmontools
package), which is a tool for querying and controlling SMART
+2 -2
View File
@@ -5,7 +5,7 @@ It was downloaded from <http://gsmartcontrol.berlios.de/>
Copyright:
Copyright (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
Copyright (C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License:
@@ -27,6 +27,6 @@ On Debian systems, the complete text of the GNU General
Public Licenses can be found in `/usr/share/common-licenses/GPL-2' and
`/usr/share/common-licenses/GPL-3'.
The Debian packaging is (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com> and
The Debian packaging is (C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com> and
is licensed under the GPLv2 and GPLv3, see above.
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/bash
############################################################################
# Copyright:
# (C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
# (C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
# License: See LICENSE_zlib.txt file
############################################################################
+3
View File
@@ -0,0 +1,3 @@
[Project]
Manager=KDevCustomBuildSystem
Name=gsmartcontrol
+9
View File
@@ -62,6 +62,12 @@ Requires: smartmontools, pcre, gtkmm24 >= 2.6.0, libglademm24 >= 2.4.0
BuildRequires: gcc-c++, pcre-devel, gtkmm24-devel >= 2.6.0, libglademm24-devel >= 2.4.0
%endif
# Fedora doesn't include gnomesu or anything similar except beesu (since 11), so force it.
# usermode-gtk is for consolehelper-gtk (optional for beesu, needed for GUI auth).
%if 0%{?fedora_version} >= 11
Requires: beesu, usermode-gtk
%endif
%endif
@@ -145,6 +151,9 @@ rm -rf %buildroot
%changelog
* Fri Dec 10 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
- Fixes for Fedora 14.
* Fri Nov 14 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
- Updated .spec file to incorporate changes from the official Mandriva package.
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
+11 -15
View File
@@ -1,11 +1,12 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
#include <clocale> // setlocale, localeconv
#include <clocale> // localeconv
#include "hz/locale_tools.h" // ScopedCLocale, locale_c_get().
#include "hz/cstdint.h" // uint64_t
#include "hz/string_algo.h" // string_*
#include "hz/string_num.h" // string_is_numeric, number_to_string
@@ -285,20 +286,15 @@ std::string SmartctlParser::parse_byte_size(const std::string& str, uint64_t& by
// if current locale is C, then probably we didn't change it at application
// startup, so set it now (temporarily). Otherwise, just use the current locale's
// thousands separator.
{
std::string old_locale = hz::locale_c_get();
hz::ScopedCLocale loc("", old_locale == "C"); // set system locale if the current one is C
std::string old_locale = std::setlocale(LC_ALL, NULL);
bool locale_is_c = (old_locale == "C");
if (locale_is_c) {
std::setlocale(LC_ALL, ""); // set system locale
}
struct lconv* lc = std::localeconv();
if (lc && lc->thousands_sep && *(lc->thousands_sep)) {
to_replace.push_back(lc->thousands_sep);
}
if (locale_is_c) {
std::setlocale(LC_ALL, "C"); // restore it
}
struct lconv* lc = std::localeconv();
if (lc && lc->thousands_sep && *(lc->thousands_sep)) {
to_replace.push_back(lc->thousands_sep);
}
} // the locale is restored here
#endif
to_replace.push_back("bytes");
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -225,6 +225,7 @@ namespace {
blacklist.push_back("/part[0-9]+$/"); // devfs had them
blacklist.push_back("/p[0-9]+$/"); // partitions are usually marked this way
blacklist.push_back("/md[0-9]*$/"); // linux software raid
blacklist.push_back("/dm-[0-9]*$/"); // linux device mapper
for (unsigned int i = 0; i < lines.size(); ++i) {
@@ -265,6 +266,7 @@ namespace {
// smartctl accepts various variants, the most straight being pdN,
// (or /dev/pdN, /dev/ being optional) where N comes from
// "\\.\PhysicalDriveN" (winnt only).
// http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
inline std::string detect_drives_win32(std::vector<std::string>& devices)
{
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+2 -2
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -47,7 +47,7 @@ GscAboutDialog::GscAboutDialog(BaseObjectType* gtkcobj, const app_ui_res_ref_t&
set_license(LicenseTextResData().get_string());
// spammers go away
set_copyright("Copyright (C) 2008 - 2009 Alexander Shaduri " "<ashaduri" "" "@" "" "" "gmail.com>");
set_copyright("Copyright (C) 2008 - 2010 Alexander Shaduri " "<ashaduri" "" "@" "" "" "gmail.com>");
std::string authors_str = AuthorsTextResData().get_string();
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -236,7 +236,7 @@ void GscExecutorLogWindow::on_window_save_all_button_clicked()
exss << "\n------------------------- LIBDEBUG LOG -------------------------\n\n\n";
exss << app_get_debug_buffer_str() << "\n\n\n";
exss << "\n\n\n------------------------- EXECTION LOG -------------------------\n\n\n";
exss << "\n\n\n------------------------- EXECUTION LOG -------------------------\n\n\n";
for (std::size_t i = 0; i < entries.size(); ++i) {
exss << "\n\n\n------------------------- EXECUTED COMMAND " << (i+1) << " -------------------------\n\n";
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+12 -12
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
@@ -308,22 +308,22 @@ void GscInfoWindow::fill_ui_with_info(bool scan, bool clear_ui, bool clear_tests
if (hide_tabs) {
bool smart_enabled = (drive->get_smart_status() == StorageDevice::status_enabled);
Gtk::Widget* note_label = 0;
Gtk::Widget* note_page_box = 0;
if ((note_label = lookup_widget("capabilities_tab_vbox")) != 0) {
if (smart_enabled) { note_label->show(); } else { note_label->hide(); }
if ((note_page_box = lookup_widget("capabilities_tab_vbox")) != 0) {
if (smart_enabled) { note_page_box->show(); } else { note_page_box->hide(); }
}
if ((note_label = lookup_widget("attributes_tab_vbox")) != 0) {
if (smart_enabled) { note_label->show(); } else { note_label->hide(); }
if ((note_page_box = lookup_widget("attributes_tab_vbox")) != 0) {
if (smart_enabled) { note_page_box->show(); } else { note_page_box->hide(); }
}
if ((note_label = lookup_widget("error_log_tab_vbox")) != 0) {
if (smart_enabled) { note_label->show(); } else { note_label->hide(); }
if ((note_page_box = lookup_widget("error_log_tab_vbox")) != 0) {
if (smart_enabled) { note_page_box->show(); } else { note_page_box->hide(); }
}
if ((note_label = lookup_widget("selftest_log_tab_vbox")) != 0) {
if (smart_enabled) { note_label->show(); } else { note_label->hide(); }
if ((note_page_box = lookup_widget("selftest_log_tab_vbox")) != 0) {
if (smart_enabled) { note_page_box->show(); } else { note_page_box->hide(); }
}
if ((note_label = lookup_widget("test_tab_vbox")) != 0) {
if (smart_enabled) { note_label->show(); } else { note_label->hide(); }
if ((note_page_box = lookup_widget("test_tab_vbox")) != 0) {
if (smart_enabled) { note_page_box->show(); } else { note_page_box->hide(); }
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+58 -54
View File
@@ -1,12 +1,10 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
#include <string>
#include <locale> // std::locale
#include <clocale> // std::setlocale
// #include <locale.h> // _configthreadlocale (win32)
#include <stdexcept> // std::runtime_error
#include <cstdio> // std::printf
@@ -29,6 +27,7 @@
#include "hz/data_file.h" // data_file_add_search_directory
#include "hz/fs_tools.h" // get_user_config_dir()
#include "hz/fs_path.h" // FsPath
#include "hz/locale_tools.h" // locale_c*
#include "hz/string_algo.h" // string_join()
#include "hz/win32_tools.h" // win32_get_registry_value_string()
@@ -194,7 +193,7 @@ struct CmdArgs {
arg_add_device(NULL)
{ }
gboolean arg_locale; // if false, disable locale
gboolean arg_locale; // if false, disable using system locale
gboolean arg_version; // if true, show version and exit
gboolean arg_scan; // if false, don't scan the system for drives on startup
gboolean arg_hide_tabs; // if true, hide additional info tabs when smart is disabled. false may help debugging.
@@ -208,7 +207,7 @@ inline bool parse_cmdline_args(CmdArgs& args, int& argc, char**& argv)
{
static const GOptionEntry arg_entries[] =
{
{ "no-locale", 'l', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &(args.arg_locale), "Disable locale", NULL },
{ "no-locale", 'l', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &(args.arg_locale), "Don't use system locale", NULL },
{ "version", 'V', 0, G_OPTION_ARG_NONE, &(args.arg_version), "Display version information", NULL },
{ "no-scan", '\0', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &(args.arg_scan), "Don't scan devices on startup", NULL },
{ "no-hide-tabs", '\0', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &(args.arg_hide_tabs), "Don't hide non-identity tabs when SMART is disabled. Useful for debugging.", NULL },
@@ -219,11 +218,16 @@ inline bool parse_cmdline_args(CmdArgs& args, int& argc, char**& argv)
GError* error = 0;
GOptionContext* context = g_option_context_new("- A GTK+ GUI for smartmontools");
// our options
g_option_context_add_main_entries(context, arg_entries, NULL);
g_option_context_add_group(context, gtk_get_option_group(false)); // gtk options
// gtk options
g_option_context_add_group(context, gtk_get_option_group(false));
// libdebug options; this will also automatically apply them
g_option_context_add_group(context, debug_get_option_group());
g_option_context_parse(context, &argc, &argv, &error);
g_option_context_free(context);
if (error)
@@ -241,7 +245,7 @@ inline void app_print_version_info()
std::string warningtext = std::string("\nWarning: GSmartControl");
warningtext += " comes with ABSOLUTELY NO WARRANTY.\n";
warningtext += "See LICENSE_gsmartcontrol.txt file for details.\n";
warningtext += "\nCopyright (C) 2008 - 2009 Alexander Shaduri <ashaduri" "" "@" "" "" "gmail.com>\n\n";
warningtext += "\nCopyright (C) 2008 - 2010 Alexander Shaduri <ashaduri" "" "@" "" "" "gmail.com>\n\n";
std::fprintf(stdout, "%s%s", versiontext.c_str(), warningtext.c_str());
}
@@ -250,44 +254,32 @@ inline void app_print_version_info()
bool app_init_and_loop(int& argc, char**& argv)
{
// glib needs locale initialized for command line args. It will be reset by Gtk::Main later.
// set C and C++ locales to system LANG.
try {
// This may throw on freebsd and osx with
// "locale::facet::_S_create_c_locale name not valid", so make it non-fatal.
std::locale::global(std::locale("")); // C++
}
catch (const std::runtime_error& e) {
// nothing. we can't print anything here, so just ignore it.
// newer gtkmm will print a warning if it cannot set a C++ locale,
// so it will be an indication.
}
std::setlocale(LC_ALL, ""); // C
// initialize GThread (for mutexes, etc... to work). Must be called before any other glib function.
// Glib::thread_init();
// parse command line args
// Glib needs the C locale set to system locale for command line args.
// We will reset it later if needed.
hz::locale_c_set(""); // set the current locale to system locale
// Parse command line args.
// Due to gtk_get_option_group()/g_option_context_parse() calls, this
// will also initialize GTK and set the C locale to system locale (as well
// as do some locale-specific gdk initialization).
CmdArgs args;
if (! parse_cmdline_args(args, argc, argv)) {
return true;
}
// Note: parsing gtk option context is initializes gtk, so
// gtk_disable_setlocale() won't work here.
// If locale setting is explicitly disabled, revert to the original classic C locale.
// Note that changing GTK locale after it's inited isn't really supported by GTK,
// but we have no other choice - glib needs system locale when parsing the
// arguments, and gtk is inited while the parsing is performed.
if (!args.arg_locale) {
// set classic locale. otherwise we're already in user locale.
try {
std::locale::global(std::locale::classic()); // C++
}
catch (const std::runtime_error& e) {
}
std::setlocale(LC_ALL, "C");
hz::locale_c_set("C");
} else {
// change the C++ locale to match the C one.
hz::locale_cpp_set(""); // this may fail on some systems
}
@@ -346,25 +338,8 @@ bool app_init_and_loop(int& argc, char**& argv)
app_init_config();
debug_out_info("app", "Current C locale: " << std::setlocale(LC_ALL, NULL) << "\n");
debug_out_info("app", "Current C++ locale: " << std::locale::locale().name() << "\n");
// Initialize GTK+
// Gtk::Main m(argc, argv, args.arg_locale);
Gtk::Main m(argc, argv);
#ifdef _WIN32
// Now that all program-specific locale setup has been performed,
// make sure the future locale changes affect only current thread.
// Not available in mingw, so disable for now.
// _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
// Redirect all GTK+/Glib and related messages to libdebug
// Redirect all GTK+/Glib and related messages to libdebug.
// Do this before GTK+ init, to capture its possible warnings as well.
static const char* const gtkdomains[] = {
// no atk or cairo, they don't log. libgnomevfs may be loaded by gtk file chooser.
"GLib", "GModule", "GLib-GObject", "GLib-GRegex", "GLib-GIO", "GThread",
@@ -377,6 +352,35 @@ bool app_init_and_loop(int& argc, char**& argv)
}
// Save the locale
std::locale final_loc_cpp = hz::locale_cpp_get<std::locale>();
// Initialize GTK+ (it's already initialized by command-line parser,
// so this doesn't do much).
// Newer gtkmm will try to set the C++ locale here.
// Note: passing false (as use_locale) as the third parameter here
// will generate a gtk_disable_setlocale() warning (due to gtk being
// already initialized), so manually save / restore the C++ locale
// (C locale won't be touched).
// Nothing is affected in gtkmm itself by C++ locale, so it's ok to do it.
Gtk::Main m(argc, argv);
// Restore the locale
hz::locale_cpp_set(final_loc_cpp);
debug_out_info("app", "Current C locale: " << hz::locale_c_get() << "\n");
debug_out_info("app", "Current C++ locale: " << hz::locale_cpp_get<std::string>() << "\n");
#ifdef _WIN32
// Now that all program-specific locale setup has been performed,
// make sure the future locale changes affect only current thread.
// Not available in mingw, so disable for now.
// _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
// This shows up in About dialog gtk.
Glib::set_application_name("GSmartControl"); // should be localized
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_gsmartcontrol.txt
***************************************************************************/
+1 -1
View File
@@ -9,7 +9,7 @@ noinst_HEADERS = any_convert.h any_type.h any_type_holder.h ascii.h \
instance_manager.h intrusive_ptr.h intrusive_scoped_lock.h launch_url.h local_algo.h \
locale_tools.h noncopyable.h optional_value.h portable_snprintf.h process_signal.h \
ptr_container.h res_data.h scoped_array.h scoped_ptr.h shared_ptr.h static_assert.h stream_cast.h \
string_algo.h string_format.h string_num.h string_sprintf.h string_wcmatch.h sync.h \
string_algo.h string_format.h string_num.h string_sprintf.h string_sprintf_macros.h string_wcmatch.h sync.h \
sync_lock_ptr.h sync_multilock.h sync_part_get_policy.h sync_policy_boost.h \
sync_policy_glib.h sync_policy_glibmm.h sync_policy_poco.h sync_policy_pthread.h \
sync_policy_win32.h system_specific.h tls.h tls_policy_boost.h tls_policy_glib.h \
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************
Copyright:
(C) 2000 - 2009 Kevlin Henney
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2000 - 2010 Kevlin Henney
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_boost_1_0.txt file
***************************************************************************/
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************
Copyright:
(C) 2000 - 2009 Kevlin Henney
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2000 - 2010 Kevlin Henney
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_boost_1_0.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
+1 -1
View File
@@ -2,7 +2,7 @@
Copyright:
(C) 1992, 1993 The Regents of the University of California
License: See LICENSE_bsd-ucb.txt file
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2009 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2004 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2004 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2003 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2003 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+4 -4
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2003 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2003 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
@@ -14,8 +14,8 @@
#include <ctime> // for time.h, std::strftime, std::time, std::localtime, ...
#include "cstdint.h"
#include "locale_tools.h" // ScopedLocale
#include "string_num.h" // number_to_string
#include "locale_tools.h" // hz::ScopedCLocale
#include "string_num.h" // hz::number_to_string
#include "i18n.h" // HZ_NC_, HZ_C_
@@ -199,7 +199,7 @@ inline std::string format_date(const std::string& format, const struct std::tm*
int iterations = 0;
// strftime is locale-dependent. unless use_locale is true, we switch to classic locale.
const ScopedLocale classic(!use_locale);
const ScopedCLocale classic(!use_locale);
do {
char* buf = new char[buf_size];
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_unlicense.txt
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2009 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************
Copyright:
(C) 2008 - 2009 Alexander Shaduri <ashaduri 'at' gmail.com>
(C) 2008 - 2010 Alexander Shaduri <ashaduri 'at' gmail.com>
License: See LICENSE_zlib.txt file
***************************************************************************/

Some files were not shown because too many files have changed in this diff Show More