summaryrefslogtreecommitdiffstats
path: root/x11/gnome-applets
diff options
context:
space:
mode:
authormarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2005-02-16 16:02:18 +0800
committermarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2005-02-16 16:02:18 +0800
commitcf0468b3ff867b11ac5c7f5cc5d81dcfbbdac49d (patch)
tree59fdba4aa7e671f5df1d800f9f252c76e0f9d479 /x11/gnome-applets
parentcd483fe16904324523c1aa520d6236e9642ca4e7 (diff)
downloadmarcuscom-ports-cf0468b3ff867b11ac5c7f5cc5d81dcfbbdac49d.tar.gz
marcuscom-ports-cf0468b3ff867b11ac5c7f5cc5d81dcfbbdac49d.tar.zst
marcuscom-ports-cf0468b3ff867b11ac5c7f5cc5d81dcfbbdac49d.zip
I'm told that battstat is now expecting remaining times to be in minutes.
Fix this so that ACPI and APM times are reported correctly. Reported by: sajd on #freebsd-gnome git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@3658 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'x11/gnome-applets')
-rw-r--r--x11/gnome-applets/Makefile2
-rw-r--r--x11/gnome-applets/files/patch-battstat-acpi163
2 files changed, 85 insertions, 80 deletions
diff --git a/x11/gnome-applets/Makefile b/x11/gnome-applets/Makefile
index acb099495..689c02020 100644
--- a/x11/gnome-applets/Makefile
+++ b/x11/gnome-applets/Makefile
@@ -7,7 +7,7 @@
PORTNAME= gnomeapplets2
PORTVERSION= 2.9.6
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= x11 gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/gnome-applets/2.9
diff --git a/x11/gnome-applets/files/patch-battstat-acpi b/x11/gnome-applets/files/patch-battstat-acpi
index e2b05a441..5d7ac15bd 100644
--- a/x11/gnome-applets/files/patch-battstat-acpi
+++ b/x11/gnome-applets/files/patch-battstat-acpi
@@ -46,9 +46,68 @@
+void acpi_freebsd_cleanup(struct acpi_info * acpiinfo);
+
+#endif /* __ACPI_FREEBSD_H__ */
---- battstat/acpi-freebsd.c.orig Tue Sep 28 16:55:52 2004
-+++ battstat/acpi-freebsd.c Tue Sep 28 17:00:32 2004
-@@ -0,0 +1,213 @@
+--- battstat/Makefile.in.orig Mon Jan 24 20:20:49 2005
++++ battstat/Makefile.in Mon Jan 24 20:22:02 2005
+@@ -55,9 +55,10 @@
+ PROGRAMS = $(libexec_PROGRAMS)
+ am_battstat_applet_2_OBJECTS = properties.$(OBJEXT) \
+ battstat_applet.$(OBJEXT) power-management.$(OBJEXT) \
+- acpi-linux.$(OBJEXT)
++ acpi-freebsd.$(OBJEXT) acpi-linux.$(OBJEXT)
+ battstat_applet_2_OBJECTS = $(am_battstat_applet_2_OBJECTS)
+ am__DEPENDENCIES_1 =
++ACPIINC = @ACPIINC@
+ @HAVE_LIBAPM_FALSE@@NEED_LIBAPM_TRUE@am__DEPENDENCIES_2 = \
+ @HAVE_LIBAPM_FALSE@@NEED_LIBAPM_TRUE@ apmlib/libapm.a
+ battstat_applet_2_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+@@ -66,6 +67,7 @@
+ depcomp = $(SHELL) $(top_srcdir)/depcomp
+ am__depfiles_maybe = depfiles
+ @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/acpi-linux.Po \
++@AMDEP_TRUE@ ./$(DEPDIR)/acpi-freebsd.Po \
+ @AMDEP_TRUE@ ./$(DEPDIR)/battstat_applet.Po \
+ @AMDEP_TRUE@ ./$(DEPDIR)/power-management.Po \
+ @AMDEP_TRUE@ ./$(DEPDIR)/properties.Po
+@@ -336,6 +338,7 @@
+ $(GNOME_APPLETS_CFLAGS) \
+ $(LIBGLADE_CFLAGS) \
+ $(APMINC) \
++ $(ACPIINC) \
+ -DG_LOG_DOMAIN=\"battstat_applet\"
+
+ battstat_applet_2_SOURCES = \
+@@ -345,7 +348,9 @@
+ battstat_applet.c \
+ power-management.c \
+ acpi-linux.c \
+- acpi-linux.h
++ acpi-linux.h \
++ acpi-freebsd.c \
++ acpi-freebsd.h
+
+ battstat_applet_2_LDADD = \
+ $(GNOME_APPLETS_LIBS) \
+@@ -439,6 +444,7 @@
+ -rm -f *.tab.c
+
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acpi-linux.Po@am__quote@
++@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acpi-freebsd.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/battstat_applet.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/power-management.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/properties.Po@am__quote@
+--- battstat/battstat_applet.c.orig Mon Jan 24 12:51:51 2005
++++ battstat/battstat_applet.c Mon Jan 24 20:20:50 2005
+@@ -953,6 +953,7 @@
+ "Seth Nickell <snickell@stanford.edu> (GNOME2 port)",
+ "Davyd Madeley <davyd@madeley.id.au>",
+ "Ryan Lortie <desrt@desrt.ca>",
++ "Joe Marcus Clarke <marcus@FreeBSD.org> (FreeBSD ACPI support)",
+ NULL
+ };
+
+--- battstat/acpi-freebsd.c.orig Wed Feb 16 02:48:57 2005
++++ battstat/acpi-freebsd.c Wed Feb 16 02:53:37 2005
+@@ -0,0 +1,207 @@
+/* battstat A GNOME battery meter for laptops.
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
+ *
@@ -66,7 +125,7 @@
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
-+ $Id: patch-battstat-acpi,v 1.11 2005-02-14 12:29:35 kwm Exp $
++ $Id: patch-battstat-acpi,v 1.12 2005-02-16 08:02:18 marcus Exp $
+ */
+
+/*
@@ -245,84 +304,19 @@
+ }
+ apminfo->ai_batt_life = life;
+ if (!charging) {
-+ apminfo->ai_batt_time = time * 60;
++ apminfo->ai_batt_time = time;
+ }
+ else if (charging && rate > 0) {
-+ apminfo->ai_batt_time = (int) ((acpiinfo->max_capacity-remain)/(float)rate * 60);
++ apminfo->ai_batt_time = (int) ((acpiinfo->max_capacity-remain)/(float)rate);
+ }
+ else
-+ /* This multiplication is a hack to make sure the -1 survives so the applet
-+ * can process it. Battstat wants the remaining time in minutes, but
-+ * ai_batt_time is in seconds. In order to make both ACPI and APM work
-+ * with the fewest amount of hacks, we will just assume everything is
-+ * in seconds.
-+ */
-+ apminfo->ai_batt_time = -1 * 60;
++ apminfo->ai_batt_time = -1;
+
+ return TRUE;
+}
+#endif
---- battstat/Makefile.in.orig Mon Jan 24 20:20:49 2005
-+++ battstat/Makefile.in Mon Jan 24 20:22:02 2005
-@@ -55,9 +55,10 @@
- PROGRAMS = $(libexec_PROGRAMS)
- am_battstat_applet_2_OBJECTS = properties.$(OBJEXT) \
- battstat_applet.$(OBJEXT) power-management.$(OBJEXT) \
-- acpi-linux.$(OBJEXT)
-+ acpi-freebsd.$(OBJEXT) acpi-linux.$(OBJEXT)
- battstat_applet_2_OBJECTS = $(am_battstat_applet_2_OBJECTS)
- am__DEPENDENCIES_1 =
-+ACPIINC = @ACPIINC@
- @HAVE_LIBAPM_FALSE@@NEED_LIBAPM_TRUE@am__DEPENDENCIES_2 = \
- @HAVE_LIBAPM_FALSE@@NEED_LIBAPM_TRUE@ apmlib/libapm.a
- battstat_applet_2_DEPENDENCIES = $(am__DEPENDENCIES_1) \
-@@ -66,6 +67,7 @@
- depcomp = $(SHELL) $(top_srcdir)/depcomp
- am__depfiles_maybe = depfiles
- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/acpi-linux.Po \
-+@AMDEP_TRUE@ ./$(DEPDIR)/acpi-freebsd.Po \
- @AMDEP_TRUE@ ./$(DEPDIR)/battstat_applet.Po \
- @AMDEP_TRUE@ ./$(DEPDIR)/power-management.Po \
- @AMDEP_TRUE@ ./$(DEPDIR)/properties.Po
-@@ -336,6 +338,7 @@
- $(GNOME_APPLETS_CFLAGS) \
- $(LIBGLADE_CFLAGS) \
- $(APMINC) \
-+ $(ACPIINC) \
- -DG_LOG_DOMAIN=\"battstat_applet\"
-
- battstat_applet_2_SOURCES = \
-@@ -345,7 +348,9 @@
- battstat_applet.c \
- power-management.c \
- acpi-linux.c \
-- acpi-linux.h
-+ acpi-linux.h \
-+ acpi-freebsd.c \
-+ acpi-freebsd.h
-
- battstat_applet_2_LDADD = \
- $(GNOME_APPLETS_LIBS) \
-@@ -439,6 +444,7 @@
- -rm -f *.tab.c
-
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acpi-linux.Po@am__quote@
-+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acpi-freebsd.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/battstat_applet.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/power-management.Po@am__quote@
- @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/properties.Po@am__quote@
---- battstat/battstat_applet.c.orig Mon Jan 24 12:51:51 2005
-+++ battstat/battstat_applet.c Mon Jan 24 20:20:50 2005
-@@ -953,6 +953,7 @@
- "Seth Nickell <snickell@stanford.edu> (GNOME2 port)",
- "Davyd Madeley <davyd@madeley.id.au>",
- "Ryan Lortie <desrt@desrt.ca>",
-+ "Joe Marcus Clarke <marcus@FreeBSD.org> (FreeBSD ACPI support)",
- NULL
- };
-
--- battstat/power-management.c.orig Thu Jan 13 23:06:40 2005
-+++ battstat/power-management.c Mon Feb 14 01:31:18 2005
++++ battstat/power-management.c Wed Feb 16 02:58:10 2005
@@ -76,6 +76,14 @@
#ifdef __FreeBSD__
@@ -338,7 +332,7 @@
#define APMDEVICE "/dev/apm"
-@@ -86,25 +94,38 @@
+@@ -86,32 +94,48 @@
FreeBSD. Each time this functions is called (once every second)
the APM device is opened, read from and then closed.
*/
@@ -373,12 +367,12 @@
- close(fd);
+ close(fd);
-+
-+ if(apminfo.ai_status == 0)
-+ return ERR_APM_E;
- if(apminfo.ai_status == 0)
- return ERR_APM_E;
++ if(apminfo.ai_status == 0)
++ return ERR_APM_E;
++
+ }
+
+ if (using_acpi) {
@@ -388,7 +382,18 @@
status->present = TRUE;
status->on_ac_power = apminfo.ai_acline ? 1 : 0;
-@@ -339,6 +360,13 @@
+ status->state = apminfo.ai_batt_stat;
+ status->percent = apminfo.ai_batt_life;
+ status->charging = (status->state == 3) ? TRUE : FALSE;
+- status->minutes = apminfo.ai_batt_time;
++ if (using_acpi)
++ status->minutes = apminfo.ai_batt_time;
++ else
++ status->minutes = (int) (apminfo.ai_batt_time/60.0);
+
+ return NULL;
+ }
+@@ -339,6 +363,13 @@
G_IO_IN | G_IO_ERR | G_IO_HUP,
acpi_callback, NULL);
}
@@ -402,7 +407,7 @@
#endif
pm_initialised = 1;
-@@ -360,6 +388,10 @@
+@@ -360,6 +391,10 @@
g_source_remove(acpiwatch);
acpiwatch = 0;
acpi_linux_cleanup(&acpiinfo);