Mon Jan 3 14:39:48 2005 Michael Jennings (mej)
Spec file fixes and cleanups. Re-indented E-Power.c. Started a new ChangeLog using mezz format since I'm the only one who messes with this any more. ---------------------------------------------------------------------- SVN revision: 12702
This commit is contained in:
parent
9e37cb5eb5
commit
f4550e1e6d
File diff suppressed because it is too large
Load Diff
47
epplets.spec
47
epplets.spec
|
@ -1,16 +1,22 @@
|
|||
%define use_gnome 0
|
||||
%define use_gnome %{?_with_gnome}0
|
||||
|
||||
Summary: Enlightenment Epplets
|
||||
Name: enlightenment-epplets
|
||||
Version: 0.8
|
||||
Release: 0.2
|
||||
Release: 0.%(date '+%Y%m%d')
|
||||
License: BSD
|
||||
Group: User Interface/X
|
||||
URL: http://www.enlightenment.org/
|
||||
Source0: http://prdownloads.sourceforge.net/enlightenment/%{name}-%{version}.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
Packager: %{?_packager:%{_packager}}%{!?_packager:%{_vendor}}
|
||||
Vendor: %{?_vendorinfo:%{_vendorinfo}}%{!?_vendorinfo:%{_vendor}}
|
||||
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
|
||||
#BuildSuggests: freeglut-devel xorg-x11-devel
|
||||
BuildRequires: imlib2-devel XFree86-devel
|
||||
Requires: enlightenment >= 0.16.0
|
||||
Provides: epplets = %{version}
|
||||
Obsoletes: epplets
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
|
||||
%description
|
||||
Epplets are small, handy Enlightenment applets, similar to "dockapps"
|
||||
|
@ -26,25 +32,22 @@ slideshow, a URL grabber, a panel-like toolbar, and more.
|
|||
CFLAGS="$RPM_OPT_FLAGS"
|
||||
export CFLAGS
|
||||
|
||||
%{configure} --prefix=%{_prefix} --bindir=%{_bindir} --datadir=%{_datadir} \
|
||||
%if %{use_gnome}
|
||||
%{configure} --prefix=%{_prefix} --bindir=%{_bindir} --datadir=%{_datadir} --enable-fsstd --disable-autorespawn
|
||||
%else
|
||||
%{configure} --prefix=%{_prefix} --bindir=%{_bindir} --datadir=%{_datadir} --enable-fsstd
|
||||
--disable-autorespawn \
|
||||
%endif
|
||||
|
||||
make
|
||||
--enable-fsstd %{?acflags}
|
||||
%{__make} %{?_smp_mflags} %{?mflags}
|
||||
|
||||
%install
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
%{__make} install DESTDIR=$RPM_BUILD_ROOT %{?mflags_install}
|
||||
|
||||
%post
|
||||
%ifos Linux
|
||||
/sbin/ldconfig
|
||||
%ifos linux
|
||||
%post -p /sbin/ldconfig
|
||||
%endif
|
||||
|
||||
%postun
|
||||
%ifos Linux
|
||||
/sbin/ldconfig
|
||||
%ifos linux
|
||||
%postun -p /sbin/ldconfig
|
||||
%endif
|
||||
|
||||
%clean
|
||||
|
@ -53,20 +56,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%files
|
||||
%defattr(-, root, root)
|
||||
%doc ChangeLog
|
||||
%{_prefix}/include/*
|
||||
%{_prefix}/lib/*
|
||||
%{_includedir}/*
|
||||
%{_libdir}/*
|
||||
%{_bindir}/*
|
||||
%{_datadir}/enlightenment/epplet_icons/*
|
||||
%{_datadir}/enlightenment/epplet_data/*
|
||||
|
||||
%changelog
|
||||
|
||||
* Mon May 24 2004 Stuart Children <stuart@terminus.co.uk> - 0.8-0.2
|
||||
- Renamed from epplets to enlightenment-epplets.
|
||||
|
||||
* Mon May 10 2004 Stuart Children <stuart@terminus.co.uk> - 0.8-0.1
|
||||
- Tidy ups.
|
||||
- Fix download url.
|
||||
- Use License rather than Copyright.
|
||||
- Remove Packager to avoid people creating mis-attributed packages.
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
int prev_bat_val = 110;
|
||||
int bat_val = 0;
|
||||
int time_val = 0;
|
||||
int prev_up[16] =
|
||||
{0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int prev_up[16] = { 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
int prev_count = 0;
|
||||
Epplet_gadget b_close, b_suspend, b_sleep, b_help, image, label;
|
||||
|
||||
|
@ -31,6 +31,7 @@ static void
|
|||
cb_timer(void *data)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if ((stat("/proc/apm", &st) > -1) && S_ISREG(st.st_mode))
|
||||
cb_timer_apm(data);
|
||||
else if ((stat("/proc/acpi", &st) > -1) && S_ISDIR(st.st_mode))
|
||||
|
@ -41,8 +42,8 @@ static void
|
|||
cb_timer_acpi(void *data)
|
||||
{
|
||||
/* We don't have any data from the remaining percentage, and time directly,
|
||||
so we have to calculate and measure them.
|
||||
(Measure the time and calculate the percentage.)
|
||||
* so we have to calculate and measure them.
|
||||
* (Measure the time and calculate the percentage.)
|
||||
*/
|
||||
static int prev_bat_drain = 1;
|
||||
|
||||
|
@ -125,16 +126,23 @@ cb_timer_acpi(void *data)
|
|||
sscanf(line, "%*[^:]: %250s", charging_state);
|
||||
getline(&line, &lsize, f);
|
||||
sscanf(line, "%*[^:]: %250s %*s", buf);
|
||||
if (!strcmp(buf, "unknown")) rate_unknown = 1;
|
||||
else sscanf(line, "%*[^:]: %i %*s", &rate);
|
||||
if (!strcmp(buf, "unknown"))
|
||||
rate_unknown = 1;
|
||||
else
|
||||
sscanf(line, "%*[^:]: %i %*s", &rate);
|
||||
getline(&line, &lsize, f);
|
||||
sscanf(line, "%*[^:]: %250s %*s", buf);
|
||||
if (!strcmp(buf, "unknown")) level_unknown = 1;
|
||||
else sscanf(line, "%*[^:]: %i %*s", &level);
|
||||
if (!strcmp(buf, "unknown"))
|
||||
level_unknown = 1;
|
||||
else
|
||||
sscanf(line, "%*[^:]: %i %*s", &level);
|
||||
fclose(f);
|
||||
if (!strcmp(present, "yes")) battery++;
|
||||
if (!strcmp(charging_state, "discharging")) discharging++;
|
||||
if (!strcmp(charging_state, "charging")) charging++;
|
||||
if (!strcmp(present, "yes"))
|
||||
battery++;
|
||||
if (!strcmp(charging_state, "discharging"))
|
||||
discharging++;
|
||||
if (!strcmp(charging_state, "charging"))
|
||||
charging++;
|
||||
bat_drain += rate;
|
||||
bat_level += level;
|
||||
}
|
||||
|
@ -142,8 +150,10 @@ cb_timer_acpi(void *data)
|
|||
closedir(dirp);
|
||||
}
|
||||
|
||||
if (prev_bat_drain < 1) prev_bat_drain = 1;
|
||||
if (bat_drain < 1) bat_drain = prev_bat_drain;
|
||||
if (prev_bat_drain < 1)
|
||||
prev_bat_drain = 1;
|
||||
if (bat_drain < 1)
|
||||
bat_drain = prev_bat_drain;
|
||||
prev_bat_drain = bat_drain;
|
||||
|
||||
if (bat_filled > 0)
|
||||
|
@ -167,35 +177,25 @@ cb_timer_acpi(void *data)
|
|||
{
|
||||
if (level_unknown)
|
||||
snprintf(current_status, sizeof(current_status),
|
||||
"Level ???\n"
|
||||
"Bad Driver");
|
||||
"Level ???\n" "Bad Driver");
|
||||
else if (rate_unknown)
|
||||
snprintf(current_status, sizeof(current_status),
|
||||
"%i%% PWR\n"
|
||||
"Time ???",
|
||||
bat_val);
|
||||
"%i%% PWR\n" "Time ???", bat_val);
|
||||
else
|
||||
snprintf(current_status, sizeof(current_status),
|
||||
"%i%% PWR\n"
|
||||
"%02i:%02i",
|
||||
bat_val, hours, minutes);
|
||||
"%i%% PWR\n" "%02i:%02i", bat_val, hours, minutes);
|
||||
}
|
||||
else if (discharging)
|
||||
{
|
||||
if (level_unknown)
|
||||
snprintf(current_status, sizeof(current_status),
|
||||
"Level ???\n"
|
||||
"Bad Driver");
|
||||
"Level ???\n" "Bad Driver");
|
||||
else if (rate_unknown)
|
||||
snprintf(current_status, sizeof(current_status),
|
||||
"%i%%\n"
|
||||
"Time ???",
|
||||
bat_val);
|
||||
"%i%%\n" "Time ???", bat_val);
|
||||
else
|
||||
snprintf(current_status, sizeof(current_status),
|
||||
"%i%%\n"
|
||||
"%02i:%02i",
|
||||
bat_val, hours, minutes);
|
||||
"%i%%\n" "%02i:%02i", bat_val, hours, minutes);
|
||||
}
|
||||
else if (!battery)
|
||||
snprintf(current_status, sizeof(current_status), "No Bat");
|
||||
|
@ -229,7 +229,8 @@ cb_timer_apm(void *data)
|
|||
char *s_ptr;
|
||||
|
||||
fgets(s, 255, f);
|
||||
sscanf(s, "%*s %*s %x %x %x %x %s %s %s", &apm_flags, &ac_stat, &bat_stat, &bat_flags, s1, s2, s3);
|
||||
sscanf(s, "%*s %*s %x %x %x %x %s %s %s", &apm_flags, &ac_stat,
|
||||
&bat_stat, &bat_flags, s1, s2, s3);
|
||||
s1[strlen(s1) - 1] = 0;
|
||||
bat_val = atoi(s1);
|
||||
if (!strcmp(s3, "sec"))
|
||||
|
@ -252,8 +253,7 @@ cb_timer_apm(void *data)
|
|||
|
||||
s_ptr = s;
|
||||
|
||||
if( bat_flags != 0xff
|
||||
&& bat_flags & 0x80 )
|
||||
if (bat_flags != 0xff && bat_flags & 0x80)
|
||||
{
|
||||
s_ptr += sprintf(s_ptr, "no battery");
|
||||
}
|
||||
|
@ -280,7 +280,6 @@ cb_timer_apm(void *data)
|
|||
}
|
||||
s_ptr += sprintf(s_ptr, "\n");
|
||||
|
||||
|
||||
if (ac_stat == 1)
|
||||
{
|
||||
s_ptr += sprintf(s_ptr, "AC on-line");
|
||||
|
@ -375,11 +374,9 @@ main(int argc, char **argv)
|
|||
atexit(Epplet_cleanup);
|
||||
Epplet_timer(cb_timer, NULL, 30.0, "TIMER");
|
||||
b_close = Epplet_create_button(NULL, NULL,
|
||||
2, 2, 0, 0, "CLOSE", 0, NULL,
|
||||
cb_close, NULL);
|
||||
2, 2, 0, 0, "CLOSE", 0, NULL, cb_close, NULL);
|
||||
b_help = Epplet_create_button(NULL, NULL,
|
||||
34, 2, 0, 0, "HELP", 0, NULL,
|
||||
cb_help, NULL);
|
||||
34, 2, 0, 0, "HELP", 0, NULL, cb_help, NULL);
|
||||
b_suspend = Epplet_create_button(NULL, NULL,
|
||||
2, 34, 0, 0, "PAUSE", 0, NULL,
|
||||
cb_suspend, NULL);
|
||||
|
@ -391,8 +388,7 @@ main(int argc, char **argv)
|
|||
(2, 2, 44, 24,
|
||||
EROOT "/epplet_data/E-Power/E-Power-Bat-100.png"));
|
||||
Epplet_gadget_show(label =
|
||||
Epplet_create_label
|
||||
(2, 28, "APM, ACPI\nmissing", 1));
|
||||
Epplet_create_label(2, 28, "APM, ACPI\nmissing", 1));
|
||||
Epplet_register_focus_in_handler(cb_in, NULL);
|
||||
Epplet_register_focus_out_handler(cb_out, NULL);
|
||||
cb_timer(NULL);
|
||||
|
|
Loading…
Reference in New Issue