diff options
-rw-r--r-- | ChangeLog | 25 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | Makefile.in | 6 | ||||
-rwxr-xr-x | configure | 114 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/indicator-power.c | 31 |
6 files changed, 160 insertions, 24 deletions
@@ -1,5 +1,30 @@ # Generated by Makefile. Do not edit. +2011-07-19 Javier Jardón <javier.jardon@codethink.co.uk> + + 0.4 release + +2011-07-18 Javier Jardón <javier.jardon@codethink.co.uk> + + Do not draw a separator between the configuration options in the menu + +2011-07-18 Javier Jardón <javier.jardon@codethink.co.uk> + + Use the new D-Bus interface if gnome-settings-daemon is new enough + + Prepare the indicator-power about the changes upstream, where the code from + gnome-power-manager is being moved to gnome-settings-daemon + +2011-07-15 Javier Jardón <javier.jardon@codethink.co.uk> + + Always select a device, doesnt matter Its charging/discharging or not + + Fixes https://bugs.launchpad.net/ubuntu/+source/indicator-power/+bug/810872 + +2011-07-15 Javier Jardón <javier.jardon@codethink.co.uk> + + Makefile.am: Pass upower _FLAGS and _LIBS + 2011-07-14 Javier Jardón <javier.jardon@codethink.co.uk> Do not show the device name in the menu title diff --git a/Makefile.am b/Makefile.am index f74df4e..932775f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,10 +11,12 @@ powerlib_LTLIBRARIES = libpower.la libpower_la_SOURCES = \ src/indicator-power.c libpower_la_CFLAGS = \ + $(UPOWER_CFLAGS) \ $(INDICATOR_CFLAGS) \ -Wall -Werror \ -DG_LOG_DOMAIN=\"Indicator-Power\" libpower_la_LIBADD = \ + $(UPOWER_LIBS) \ $(INDICATOR_LIBS) libpower_la_LDFLAGS = \ -module \ diff --git a/Makefile.in b/Makefile.in index 1e89c14..f0e5199 100644 --- a/Makefile.in +++ b/Makefile.in @@ -83,7 +83,7 @@ am__base_list = \ am__installdirs = "$(DESTDIR)$(powerlibdir)" LTLIBRARIES = $(powerlib_LTLIBRARIES) am__DEPENDENCIES_1 = -libpower_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +libpower_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am__dirstamp = $(am__leading_dot)dirstamp am_libpower_la_OBJECTS = src/libpower_la-indicator-power.lo libpower_la_OBJECTS = $(am_libpower_la_OBJECTS) @@ -204,6 +204,8 @@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +GSD_CFLAGS = @GSD_CFLAGS@ +GSD_LIBS = @GSD_LIBS@ INDICATORDIR = @INDICATORDIR@ INDICATORICONSDIR = @INDICATORICONSDIR@ INDICATOR_CFLAGS = @INDICATOR_CFLAGS@ @@ -332,11 +334,13 @@ libpower_la_SOURCES = \ src/indicator-power.c libpower_la_CFLAGS = \ + $(UPOWER_CFLAGS) \ $(INDICATOR_CFLAGS) \ -Wall -Werror \ -DG_LOG_DOMAIN=\"Indicator-Power\" libpower_la_LIBADD = \ + $(UPOWER_LIBS) \ $(INDICATOR_LIBS) libpower_la_LDFLAGS = \ @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for indicator-power 0.3. +# Generated by GNU Autoconf 2.68 for indicator-power 0.4. # # Report bugs to <http://bugs.launchpad.net/indicator-power>. # @@ -570,8 +570,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-power' PACKAGE_TARNAME='indicator-power' -PACKAGE_VERSION='0.3' -PACKAGE_STRING='indicator-power 0.3' +PACKAGE_VERSION='0.4' +PACKAGE_STRING='indicator-power 0.4' PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-power' PACKAGE_URL='http://launchpad.net/indicator-power' @@ -662,6 +662,10 @@ INTLTOOL_UPDATE USE_NLS INDICATORICONSDIR INDICATORDIR +HAVE_GSD_FALSE +HAVE_GSD_TRUE +GSD_LIBS +GSD_CFLAGS INDICATOR_LIBS INDICATOR_CFLAGS UPOWER_LIBS @@ -815,7 +819,9 @@ PKG_CONFIG_LIBDIR UPOWER_CFLAGS UPOWER_LIBS INDICATOR_CFLAGS -INDICATOR_LIBS' +INDICATOR_LIBS +GSD_CFLAGS +GSD_LIBS' # Initialize some variables set by options. @@ -1358,7 +1364,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures indicator-power 0.3 to adapt to many kinds of systems. +\`configure' configures indicator-power 0.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1428,7 +1434,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-power 0.3:";; + short | recursive ) echo "Configuration of indicator-power 0.4:";; esac cat <<\_ACEOF @@ -1487,6 +1493,8 @@ Some influential environment variables: C compiler flags for INDICATOR, overriding pkg-config INDICATOR_LIBS linker flags for INDICATOR, overriding pkg-config + GSD_CFLAGS C compiler flags for GSD, overriding pkg-config + GSD_LIBS linker flags for GSD, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1555,7 +1563,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-power configure 0.3 +indicator-power configure 0.4 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1833,7 +1841,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by indicator-power $as_me 0.3, which was +It was created by indicator-power $as_me 0.4, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2657,7 +2665,7 @@ fi # Define the identity of the package. PACKAGE='indicator-power' - VERSION='0.3' + VERSION='0.4' cat >>confdefs.h <<_ACEOF @@ -11397,6 +11405,7 @@ CC="$lt_save_CC" GTK_REQUIRED_VERSION=3.0 INDICATOR_REQUIRED_VERSION=0.3.90 UPOWER_REQUIRED_VERSION=0.9.5 +GSD_REQUIRED_VERSION=3.1.4 @@ -11728,6 +11737,85 @@ $as_echo "yes" >&6; } fi +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GSD" >&5 +$as_echo_n "checking for GSD... " >&6; } + +if test -n "$GSD_CFLAGS"; then + pkg_cv_GSD_CFLAGS="$GSD_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnome-settings-daemon>= \$GSD_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnome-settings-daemon>= $GSD_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GSD_CFLAGS=`$PKG_CONFIG --cflags "gnome-settings-daemon>= $GSD_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GSD_LIBS"; then + pkg_cv_GSD_LIBS="$GSD_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnome-settings-daemon>= \$GSD_REQUIRED_VERSION\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gnome-settings-daemon>= $GSD_REQUIRED_VERSION") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GSD_LIBS=`$PKG_CONFIG --libs "gnome-settings-daemon>= $GSD_REQUIRED_VERSION" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GSD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gnome-settings-daemon>= $GSD_REQUIRED_VERSION" 2>&1` + else + GSD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gnome-settings-daemon>= $GSD_REQUIRED_VERSION" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GSD_PKG_ERRORS" >&5 + + have_gsd=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_gsd=no +else + GSD_CFLAGS=$pkg_cv_GSD_CFLAGS + GSD_LIBS=$pkg_cv_GSD_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_gsd=yes +fi + if test x$have_gsd = xyes; then + HAVE_GSD_TRUE= + HAVE_GSD_FALSE='#' +else + HAVE_GSD_TRUE='#' + HAVE_GSD_FALSE= +fi + + ########################### # Check to see if we're local ########################### @@ -14356,6 +14444,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_GSD_TRUE}" && test -z "${HAVE_GSD_FALSE}"; then + as_fn_error $? "conditional \"HAVE_GSD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi ac_config_commands="$ac_config_commands po/stamp-it" @@ -14769,7 +14861,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by indicator-power $as_me 0.3, which was +This file was extended by indicator-power $as_me 0.4, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14836,7 +14928,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -indicator-power config.status 0.3 +indicator-power config.status 0.4 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 99780b6..84d23c2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([indicator-power], - [0.3], + [0.4], [http://bugs.launchpad.net/indicator-power], [indicator-power], [http://launchpad.net/indicator-power]) @@ -32,12 +32,16 @@ LT_INIT GTK_REQUIRED_VERSION=3.0 INDICATOR_REQUIRED_VERSION=0.3.90 UPOWER_REQUIRED_VERSION=0.9.5 +GSD_REQUIRED_VERSION=3.1.4 PKG_CHECK_MODULES([UPOWER],[upower-glib >= UPOWER_REQUIRED_VERSION]) PKG_CHECK_MODULES([INDICATOR],[ gtk+-3.0 >= $GTK_REQUIRED_VERSION indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION ]) +PKG_CHECK_MODULES([GSD],[gnome-settings-daemon>= $GSD_REQUIRED_VERSION], + [have_gsd=yes],[have_gsd=no]) +AM_CONDITIONAL([HAVE_GSD],[test x$have_gsd = xyes]) ########################### # Check to see if we're local diff --git a/src/indicator-power.c b/src/indicator-power.c index a81b791..5649473 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -38,6 +38,18 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define DEFAULT_ICON "gpm-battery-missing" +#if HAVE_GSD +#define DBUS_SERVICE "org.gnome.SettingsDaemon" +#define DBUS_PATH "/org/gnome/SettingsDaemon" +#define POWER_DBUS_PATH DBUS_PATH "/Power" +#define POWER_DBUS_INTERFACE "org.gnome.SettingsDaemon.Power" +#else +#define DBUS_SERVICE "org.gnome.PowerManager" +#define DBUS_PATH "/org/gnome/PowerManager" +#define POWER_DBUS_PATH DBUS_PATH +#define POWER_DBUS_INTERFACE "org.gnome.PowerManager" +#endif + #define INDICATOR_POWER_TYPE (indicator_power_get_type ()) #define INDICATOR_POWER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_POWER_TYPE, IndicatorPower)) #define INDICATOR_POWER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_POWER_TYPE, IndicatorPowerClass)) @@ -440,15 +452,11 @@ build_menu (IndicatorPower *self) } /* options */ - item = gtk_check_menu_item_new_with_label (_("Show Time Remaining")); + item = gtk_check_menu_item_new_with_label (_("Show Time in Menu Bar")); g_signal_connect (G_OBJECT (item), "toggled", G_CALLBACK (option_toggled_cb), self); gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); - /* separator */ - item = gtk_separator_menu_item_new (); - gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item); - /* preferences */ item = gtk_image_menu_item_new_with_mnemonic (_("Power Settings ...")); image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU); @@ -498,9 +506,6 @@ get_primary_device (GVariant *devices) g_debug ("%s: got data from object %s", G_STRFUNC, object_path); - if (primary_device == NULL && kind == UP_DEVICE_KIND_BATTERY) - primary_device = device; - if (state == UP_DEVICE_STATE_DISCHARGING) { discharging = TRUE; @@ -519,6 +524,10 @@ get_primary_device (GVariant *devices) primary_device_charging = device; } } + else + { + primary_device = device; + } } if (discharging) @@ -704,9 +713,9 @@ indicator_power_init (IndicatorPower *self) g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, - "org.gnome.PowerManager", - "/org/gnome/PowerManager", - "org.gnome.PowerManager", + DBUS_SERVICE, + POWER_DBUS_PATH, + POWER_DBUS_INTERFACE, priv->proxy_cancel, service_proxy_cb, self); |