aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-04-15 09:20:51 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-04-15 09:20:51 -0500
commit3e9263995e880ac53322ed8229ca0b47dc5a7064 (patch)
tree1b31369ce8a9f60e665f2cd8933afda08412dde8
parentfd5fac8de3af29f2d7a3ccd985092f9e14361026 (diff)
parent3242c72d1491b07ee04753e047c72854a0b88d26 (diff)
downloadayatana-indicator-power-3e9263995e880ac53322ed8229ca0b47dc5a7064.tar.gz
ayatana-indicator-power-3e9263995e880ac53322ed8229ca0b47dc5a7064.tar.bz2
ayatana-indicator-power-3e9263995e880ac53322ed8229ca0b47dc5a7064.zip
sync with lp:indicator-power
-rw-r--r--Makefile.am36
-rw-r--r--Makefile.am.coverage48
-rw-r--r--configure.ac5
-rw-r--r--m4/gcov.m423
-rw-r--r--src/indicator-power.c13
5 files changed, 76 insertions, 49 deletions
diff --git a/Makefile.am b/Makefile.am
index 0ef4362..25cbee5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,38 +61,4 @@ dist-hook:
echo Failed to generate AUTHORS: not a branch >&2; \
fi
-
-# Coverage targets
-
-.PHONY: clean-gcda
-clean-gcda:
- @echo Removing old coverage results
- -find -name '*.gcda' -print | xargs -r rm
-
-.PHONY: coverage-html generate-coverage-html clean-coverage-html
-coverage-html: clean-gcda
- -$(MAKE) $(AM_MAKEFLAGS) -k check
- $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
-
-generate-coverage-html:
- @echo Collecting coverage data
- $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
- LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
-
-clean-coverage-html: clean-gcda
- -$(LCOV) --directory $(top_builddir) -z
- -rm -rf coverage.info coveragereport
-
-.PHONY: coverage-xml generate-coverage-xml clean-coverage-xml
-coverage-xml: clean-gcda
- -$(MAKE) $(AM_MAKEFLAGS) -k check
- $(MAKE) $(AM_MAKEFLAGS) generate-coverage-xml
-
-generate-coverage-xml:
- @echo Generating coverage XML report
- $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml
-
-clean-coverage-xml: clean-gcda
- -rm -rf $(top_builddir)/coverage.xml
-
-clean-local: clean-coverage-html clean-coverage-xml
+include $(top_srcdir)/Makefile.am.coverage
diff --git a/Makefile.am.coverage b/Makefile.am.coverage
new file mode 100644
index 0000000..fb97747
--- /dev/null
+++ b/Makefile.am.coverage
@@ -0,0 +1,48 @@
+
+# Coverage targets
+
+.PHONY: clean-gcno clean-gcda \
+ coverage-html generate-coverage-html clean-coverage-html \
+ coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr
+
+clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr
+
+if HAVE_GCOV
+
+clean-gcno:
+ @echo Removing old coverage instrumentation
+ -find -name '*.gcno' -print | xargs -r rm
+
+clean-gcda:
+ @echo Removing old coverage results
+ -find -name '*.gcda' -print | xargs -r rm
+
+coverage-html: clean-gcda
+ -$(MAKE) $(AM_MAKEFLAGS) -k check
+ $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html
+
+generate-coverage-html:
+ @echo Collecting coverage data
+ $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool
+ LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
+
+clean-coverage-html: clean-gcda
+ -$(LCOV) --directory $(top_builddir) -z
+ -rm -rf coverage.info coveragereport
+
+if HAVE_GCOVR
+
+coverage-gcovr: clean-gcda
+ -$(MAKE) $(AM_MAKEFLAGS) -k check
+ $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr
+
+generate-coverage-gcovr:
+ @echo Generating coverage GCOVR report
+ $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml
+
+clean-coverage-gcovr: clean-gcda
+ -rm -rf $(top_builddir)/coverage.xml
+
+endif # HAVE_GCOVR
+
+endif # HAVE_GCOV
diff --git a/configure.ac b/configure.ac
index 9f2b839..fc287a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([indicator-power],
- [1.92],
+ [2.0],
[http://bugs.launchpad.net/indicator-power],
[indicator-power],
[http://launchpad.net/indicator-power])
@@ -53,6 +53,9 @@ GLIB_GSETTINGS
m4_include([m4/gcov.m4])
AC_TDD_GCOV
+AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes])
+AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes])
+AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes])
AC_SUBST(COVERAGE_CFLAGS)
AC_SUBST(COVERAGE_CXXFLAGS)
AC_SUBST(COVERAGE_LDFLAGS)
diff --git a/m4/gcov.m4 b/m4/gcov.m4
index 1169573..3163584 100644
--- a/m4/gcov.m4
+++ b/m4/gcov.m4
@@ -5,11 +5,10 @@
# * gcovr
#
# Sets ac_cv_check_gcov to yes if tooling is present
-# and reports the executables to the variables LCOV, GCOVR and GENHTML.
+# and reports the executables to the variables LCOV, GCOVR and GENHTML.
AC_DEFUN([AC_TDD_GCOV],
-[AC_CACHE_CHECK([whether code coverage tools are available], ac_cv_check_gcov,
[
-AC_ARG_ENABLE(gcov,
+ AC_ARG_ENABLE(gcov,
AS_HELP_STRING([--enable-gcov],
[enable coverage testing with gcov]),
[use_gcov=$enableval], [use_gcov=no])
@@ -34,7 +33,6 @@ AC_ARG_ENABLE(gcov,
lcov_version_list="1.6 1.7 1.8 1.9"
AC_CHECK_PROG(LCOV, lcov, lcov)
AC_CHECK_PROG(GENHTML, genhtml, genhtml)
- AC_CHECK_PROG(GCOVR, gcovr, gcovr)
if test "$LCOV"; then
AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [
@@ -63,10 +61,8 @@ AC_ARG_ENABLE(gcov,
AC_MSG_ERROR([Could not find genhtml from the lcov package])
fi
- if test -z "$GCOVR"; then
- AC_MSG_ERROR([Could not find gcovr; easy_install (or pip) gcovr])
- fi
-
+ ac_cv_check_gcov=yes
+ ac_cv_check_lcov=yes
# Remove all optimization flags from CFLAGS
changequote({,})
@@ -78,6 +74,13 @@ AC_ARG_ENABLE(gcov,
COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage"
COVERAGE_LDFLAGS="-lgcov"
-fi
-])]) # AC_TDD_GCOV
+ # Check availability of gcovr
+ AC_CHECK_PROG(GCOVR, gcovr, gcovr)
+ if test -z "$GCOVR"; then
+ ac_cv_check_gcovr=no
+ else
+ ac_cv_check_gcovr=yes
+ fi
+fi
+]) # AC_TDD_GCOV
diff --git a/src/indicator-power.c b/src/indicator-power.c
index ea831e5..cf16fbf 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -512,9 +512,7 @@ get_device_icon (UpDeviceKind kind,
guint64 time_sec,
const gchar *device_icon)
{
- GIcon *gicon;
-
- gicon = g_icon_new_for_string (device_icon, NULL);
+ GIcon *gicon = NULL;
if (kind == UP_DEVICE_KIND_BATTERY &&
(state == UP_DEVICE_STATE_FULLY_CHARGED ||
@@ -538,6 +536,9 @@ get_device_icon (UpDeviceKind kind,
}
}
+ if (gicon == NULL)
+ gicon = g_icon_new_for_string (device_icon, NULL);
+
return gicon;
}
@@ -561,6 +562,7 @@ menu_add_device (GtkMenu *menu,
gchar *short_details = NULL;
gchar *details = NULL;
gchar *accessible_name = NULL;
+ AtkObject *atk_object;
if (device == NULL)
return;
@@ -583,6 +585,7 @@ menu_add_device (GtkMenu *menu,
device_gicons = get_device_icon (kind, state, time, device_icon);
icon = gtk_image_new_from_gicon (device_gicons,
GTK_ICON_SIZE_SMALL_TOOLBAR);
+ g_clear_object (&device_gicons);
device_name = device_kind_to_localised_string (kind);
@@ -590,6 +593,9 @@ menu_add_device (GtkMenu *menu,
/* Create menu item */
item = gtk_image_menu_item_new ();
+ atk_object = gtk_widget_get_accessible(item);
+ if (atk_object != NULL)
+ atk_object_set_name (atk_object, accessible_name);
grid = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
@@ -802,6 +808,7 @@ put_primary_device (IndicatorPower *self,
gtk_image_set_from_gicon (self->status_image,
device_gicons,
GTK_ICON_SIZE_LARGE_TOOLBAR);
+ g_clear_object (&device_gicons);
gtk_widget_show (GTK_WIDGET (self->status_image));