[gnome-applets/wip/muktupavels/battstat: 3/3] battstat: make upower-glib required dependency



commit 8f47ffb8417c5b368222ef6f2cd9afb634278f18
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Mar 24 19:28:10 2020 +0200

    battstat: make upower-glib required dependency
    
    And remove all fallback code.

 Makefile.am                     |   6 +-
 battstat/Makefile.am            |   2 -
 battstat/src/Makefile.am        |  26 --
 battstat/src/acpi-freebsd.c     | 235 ------------------
 battstat/src/acpi-freebsd.h     |  90 -------
 battstat/src/acpi-linux.c       | 438 ---------------------------------
 battstat/src/acpi-linux.h       |  38 ---
 battstat/src/apmlib/Makefile.am |  38 ---
 battstat/src/apmlib/apm.h       |  76 ------
 battstat/src/apmlib/apmlib.c    | 464 -----------------------------------
 battstat/src/battstat-upower.c  |   4 -
 battstat/src/battstat.h         |   6 -
 battstat/src/battstat_applet.c  |  10 +-
 battstat/src/power-management.c | 526 ----------------------------------------
 configure.ac                    |  81 +------
 help/Makefile.am                |   7 +-
 16 files changed, 9 insertions(+), 2038 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 96313e93c..667fef83a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,5 @@
 NULL =
 
-if BUILD_BATTSTAT_APPLET
-battstat_SUBDIR = battstat
-endif
-
 if APPLET_ACCESSX
 accessx_status_SUBDIR = accessx-status
 endif
@@ -18,6 +14,7 @@ endif
 
 always_built_SUBDIRS =  \
        charpick        \
+       battstat \
        brightness      \
        command         \
        drivemount      \
@@ -41,7 +38,6 @@ SUBDIRS = \
        po                      \
        $(always_built_SUBDIRS) \
        $(vfs_SUBDIRS)          \
-       $(battstat_SUBDIR)      \
        $(accessx_status_SUBDIR)\
        $(cpufreq_SUBDIR) \
        $(tracker_search_bar_SUBDIR) \
diff --git a/battstat/Makefile.am b/battstat/Makefile.am
index fe8c6e569..ba9987851 100644
--- a/battstat/Makefile.am
+++ b/battstat/Makefile.am
@@ -3,8 +3,6 @@ NULL =
 builderdir = $(pkgdatadir)/builder
 builder_DATA = battstat_applet.ui
 
-ACPIINC= @ACPIINC@
-
 SUBDIRS = sounds src
 
 gsettings_schemas_in_in = \
diff --git a/battstat/src/Makefile.am b/battstat/src/Makefile.am
index eccb82900..131929fd9 100644
--- a/battstat/src/Makefile.am
+++ b/battstat/src/Makefile.am
@@ -1,25 +1,7 @@
 NULL =
 
-SUBDIRS = apmlib
-
 uidir = $(pkgdatadir)/ui
 
-if NEED_LIBAPM
-if HAVE_LIBAPM
-APMLIB = -lapm
-APMDIR =
-APMINC =
-else
-APMLIB = apmlib/libapm.la
-APMDIR = apmlib
-APMINC = -I$(srcdir)/apmlib/
-endif
-else
-APMLIB =
-APMDIR =
-APMINC =
-endif
-
 battery_status_applet_libdir = $(pkglibdir)
 battery_status_applet_lib_LTLIBRARIES = libbattery-status-applet.la
 
@@ -35,8 +17,6 @@ libbattery_status_applet_la_CFLAGS = \
        $(GNOME_APPLETS_CFLAGS) \
        $(LIBNOTIFY_CFLAGS) \
        $(UPOWER_CFLAGS) \
-       $(APMINC) \
-       $(ACPIINC) \
        $(WARN_CFLAGS) \
        $(AM_CFLAGS) \
        $(NULL)
@@ -46,11 +26,6 @@ libbattery_status_applet_la_SOURCES = \
        pixmaps.h \
        properties.c \
        battstat_applet.c \
-       power-management.c \
-       acpi-linux.c \
-       acpi-linux.h \
-       acpi-freebsd.c \
-       acpi-freebsd.h \
        battstat-upower.c \
        battstat-upower.h \
        $(NULL)
@@ -66,7 +41,6 @@ libbattery_status_applet_la_LIBADD = \
        $(LIBNOTIFY_LIBS) \
        $(UPOWER_LIBS) \
        $(LIBM) \
-       $(APMLIB) \
        $(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/battstat/src/battstat-upower.c b/battstat/src/battstat-upower.c
index c645b065f..faf14f9cb 100644
--- a/battstat/src/battstat-upower.c
+++ b/battstat/src/battstat-upower.c
@@ -22,8 +22,6 @@
 
 #include <config.h>
 
-#ifdef HAVE_UPOWER
-
 #include <upower.h>
 #include <math.h>
 
@@ -303,5 +301,3 @@ battstat_upower_get_battery_info( BatteryStatus *status )
   
   g_ptr_array_unref( devices );
 }
-
-#endif /* HAVE_UPOWER */
diff --git a/battstat/src/battstat.h b/battstat/src/battstat.h
index ddd8059db..bc13b7931 100644
--- a/battstat/src/battstat.h
+++ b/battstat/src/battstat.h
@@ -169,10 +169,4 @@ void prop_cb (GSimpleAction *, GVariant *, gpointer);
 void reconfigure_layout( ProgressData *battstat );
 void battstat_show_help( ProgressData *battstat, const char *section );
 
-/* power-management.c */
-const char *power_management_getinfo( BatteryStatus *status );
-const char *power_management_initialise (void (*callback) (void));
-void power_management_cleanup( void );
-int power_management_using_upower( void );
-
 #endif /* _battstat_h_ */
diff --git a/battstat/src/battstat_applet.c b/battstat/src/battstat_applet.c
index 379cca001..447e2b324 100644
--- a/battstat/src/battstat_applet.c
+++ b/battstat/src/battstat_applet.c
@@ -272,7 +272,7 @@ static_global_initialisation (ProgressData *battstat)
     return NULL;
 
   initialise_global_pixmaps();
-  err = power_management_initialise (status_change_callback);
+  err = battstat_upower_initialise (status_change_callback);
 
   return err;
 }
@@ -288,7 +288,7 @@ static_global_teardown (ProgressData *battstat)
 
   /* instances == 0 */
 
-  power_management_cleanup();
+  battstat_upower_cleanup();
 }
 
 /* Pop up an error dialog on the same screen as 'applet' saying 'msg'.
@@ -950,7 +950,7 @@ check_for_updates( gpointer data )
 
   if (DEBUG) g_print("check_for_updates()\n");
 
-  if( (err = power_management_getinfo( &info )) )
+  if( (err = battstat_upower_get_battery_info( &info )) )
     battstat_error_dialog( battstat->applet, err );
 
   if (!event_driven)
@@ -1181,9 +1181,7 @@ about_cb (GSimpleAction *action,
 
   char *comments = g_strdup_printf ("%s\n\n%s",
                  _("This utility shows the status of your laptop battery."),
-                 power_management_using_upower () ?
-                       /* true */ _("upower backend enabled.") :
-                       /* false */ _("Legacy (non-HAL) backend enabled.")
+                 _("upower backend enabled.")
                  );
 
   gtk_show_about_dialog( NULL,
diff --git a/configure.ac b/configure.ac
index 4867f5565..8bf4c3069 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,22 +143,8 @@ PKG_CHECK_MODULES([CPUFREQ_SELECTOR], [
   polkit-gobject-1 >= $POLKIT_REQUIRED
 ])
 
-dnl -- check for libupower-glib (optional) --------------------------------------------
-UPOWER_CFLAGS=
-UPOWER_LIBS=
-AC_ARG_WITH(upower,[  --without-upower           build without upower support])
-
-if test "x$with_upower" != xno; then
-       PKG_CHECK_MODULES(UPOWER, upower-glib >= $UPOWER_REQUIRED,
-                 HAVE_UPOWER="yes",
-                 HAVE_UPOWER="no")
-
-       if test "x$HAVE_UPOWER" = "xyes"; then
-               AC_DEFINE(HAVE_UPOWER, 1, [UPOWER available])
-       fi
-else
-       AC_MSG_WARN(["upower support disabled"])
-fi
+dnl -- check for libupower-glib (required) --------------------------------------------
+PKG_CHECK_MODULES(UPOWER, upower-glib >= $UPOWER_REQUIRED)
 
 dnl -- check for wirelesstools (optional) -------------------------------------
 
@@ -216,64 +202,6 @@ AM_GLIB_GNU_GETTEXT
 
 YELP_HELP_INIT
 
-dnl ***************************************************************************
-dnl *** battstat specific checks                                            ***
-dnl ***************************************************************************
-
-dnl --disable-battstat=(yes|no)
-AC_ARG_ENABLE(battstat,
-             [  --disable-battstat=[@<:@no/yes@:>@]
-                          don't build battery monitor applet [@<:@default: no@:>@]],,
-             disable_battstat=no)
-
-HAVE_LIBAPM=no
-NEED_LIBAPM=no
-ACPIINC=
-build_battstat_applet=no
-
-if test x$disable_battstat = xno; then
-   build_battstat_applet=yes
-   AC_CHECK_HEADERS([err.h sys/sysctl.h])
-   case "${host}" in
-       powerpc-*-linux*)
-           NEED_LIBAPM=yes
-           AC_CHECK_LIB(apm,apm_read,[HAVE_LIBAPM=yes],[HAVE_LIBAPM=no])
-          ;;
-       # list of supported OS cores that use libapm
-       *-*-linux*)
-          NEED_LIBAPM=yes
-          AC_CHECK_LIB(apm,apm_read,[HAVE_LIBAPM=yes],[HAVE_LIBAPM=no])
-          ;;
-       # list of supported OS cores that do not use libapm
-       i386-*-freebsd*|*-*-netbsd*|*-*-openbsd*|*-*kfreebsd*-gnu)
-          if [ -n "${OS_SYS}" ]; then
-              ACPIINC="-I${OS_SYS}"
-          else
-              ACPIINC="-I/usr/src/sys"
-          fi
-
-          savecppflags=$CPPFLAGS
-          CPPFLAGS="$CPPFLAGS $ACPIINC"
-          AC_CHECK_HEADER(dev/acpica/acpiio.h, have_acpiio=true, have_acpiio=false)
-          if test $have_acpiio = true; then
-            AC_DEFINE(HAVE_ACPIIO, 1, [Define if acpiio.h exists on the system])
-          fi
-
-          ;;
-       *)
-          echo "warning: ${host} is not supported by battstat_applet, not building" >&2
-          build_battstat_applet=no
-          ;;
-    esac
-fi
-
-AC_SUBST(HAVE_LIBAPM)
-AC_SUBST(NEED_LIBAPM)
-AC_SUBST(ACPIINC)
-AM_CONDITIONAL(HAVE_LIBAPM, test "x$HAVE_LIBAPM" = "xyes")
-AM_CONDITIONAL(NEED_LIBAPM, test "x$NEED_LIBAPM" = "xyes")
-AM_CONDITIONAL(BUILD_BATTSTAT_APPLET, test x$build_battstat_applet = xyes)
-
 dnl ***************************************************************************
 dnl *** keyboard accessibility status applet check                          ***
 dnl ***************************************************************************
@@ -429,7 +357,6 @@ AC_CONFIG_FILES([
   battstat/Makefile
   battstat/sounds/Makefile
   battstat/src/Makefile
-  battstat/src/apmlib/Makefile
 
   brightness/Makefile
   brightness/src/Makefile
@@ -521,7 +448,7 @@ echo "    modulesdir ....................: ${GNOME_PANEL_MODULES_DIR}"
 echo ""
 echo "  Applets"
 echo "    accessx-status ................: $HAVE_XKB"
-echo "    batstat .......................: $build_battstat_applet"
+echo "    batstat .......................: always"
 echo "    brightness ....................: always"
 echo "    charpick ......................: always"
 echo "    command .......................: always"
@@ -547,5 +474,3 @@ echo ""
 echo "  cpufreq"
 echo "    building selector .............: $enable_selector"
 echo ""
-echo "  Using UPOWER ....................: $HAVE_UPOWER"
-echo ""
diff --git a/help/Makefile.am b/help/Makefile.am
index 9099b5ecf..832208fd6 100644
--- a/help/Makefile.am
+++ b/help/Makefile.am
@@ -1,6 +1,7 @@
 NULL =
 
 SUBDIRS = \
+       battstat \
        charpick \
        drivemount \
        geyes \
@@ -18,12 +19,6 @@ SUBDIRS += \
        $(NULL)
 endif
 
-if BUILD_BATTSTAT_APPLET
-SUBDIRS += \
-       battstat \
-       $(NULL)
-endif
-
 if BUILD_CPUFREQ_APPLET
 SUBDIRS += \
        cpufreq \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]