From aec01584f15604fc49c7b0d4b111dade78f17216 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 21 Mar 2012 12:34:38 -0500 Subject: 1.93 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9f2b839..477709b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([indicator-power], - [1.92], + [1.93], [http://bugs.launchpad.net/indicator-power], [indicator-power], [http://launchpad.net/indicator-power]) -- cgit v1.2.3 From 3db9585813b8d58f3cbc54e33753e95378c74a93 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 27 Mar 2012 15:34:42 -0500 Subject: Added gcov coverage tooling. --- Makefile.am | 36 +----------------------------------- Makefile.am.coverage | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 3 +++ m4/gcov.m4 | 23 +++++++++++++---------- 4 files changed, 65 insertions(+), 45 deletions(-) create mode 100644 Makefile.am.coverage 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..2bc3f33 --- /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.gcovr + +clean-coverage-gcovr: clean-gcda + -rm -rf $(top_builddir)/coverage.gcovr + +endif # HAVE_GCOVR + +endif # HAVE_GCOV diff --git a/configure.ac b/configure.ac index d00a868..1d86f93 100644 --- a/configure.ac +++ b/configure.ac @@ -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 -- cgit v1.2.3 From 13e52ee45d8c3c13753698c3d73cc0f8a75dd902 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 27 Mar 2012 16:22:53 -0500 Subject: Pedantic name change for gcovr xml results. --- Makefile.am.coverage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am.coverage b/Makefile.am.coverage index 2bc3f33..fb97747 100644 --- a/Makefile.am.coverage +++ b/Makefile.am.coverage @@ -38,10 +38,10 @@ coverage-gcovr: clean-gcda generate-coverage-gcovr: @echo Generating coverage GCOVR report - $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.gcovr + $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml clean-coverage-gcovr: clean-gcda - -rm -rf $(top_builddir)/coverage.gcovr + -rm -rf $(top_builddir)/coverage.xml endif # HAVE_GCOVR -- cgit v1.2.3 From 8e0baaf0e28ba90a464f487a2278174765164396 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 9 Apr 2012 14:10:51 -0500 Subject: if possible, set the device menuitems' accessible names. --- src/indicator-power.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/indicator-power.c b/src/indicator-power.c index 6140c54..46adde7 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -561,6 +561,7 @@ menu_add_device (GtkMenu *menu, gchar *short_details = NULL; gchar *details = NULL; gchar *accessible_name = NULL; + AtkObject *atk_object; if (device == NULL) return; @@ -590,6 +591,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) + g_object_set (G_OBJECT(atk_object), "accessible-name", accessible_name, NULL); grid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (grid), 6); -- cgit v1.2.3 From 6305fe39d22fed20516756f53168c73b9383a4f3 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 9 Apr 2012 14:13:25 -0500 Subject: leak fix 1 of 3: don't leak object_path and device_icon if kind == UP_DEVICE_KIND_LINE_POWER --- src/indicator-power.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index 46adde7..4b3f85c 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -510,7 +510,7 @@ static GIcon* get_device_icon (UpDeviceKind kind, UpDeviceState state, guint64 time_sec, - gchar *device_icon) + const gchar *device_icon) { GIcon *gicon; @@ -553,8 +553,8 @@ menu_add_device (GtkMenu *menu, GtkWidget *details_label; GtkWidget *grid; GIcon *device_gicons; - gchar *device_icon = NULL; - gchar *object_path = NULL; + const gchar *device_icon = NULL; + const gchar *object_path = NULL; gdouble percentage; guint64 time; const gchar *device_name; @@ -567,7 +567,7 @@ menu_add_device (GtkMenu *menu, return; g_variant_get (device, - "(susdut)", + "(&su&sdut)", &object_path, &kind, &device_icon, @@ -611,8 +611,6 @@ menu_add_device (GtkMenu *menu, g_free (short_details); g_free (details); g_free (accessible_name); - g_free (device_icon); - g_free (object_path); } static gsize -- cgit v1.2.3 From 7a5b5a693c25cac5ca547d4e0f834c017cacf837 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 9 Apr 2012 14:14:20 -0500 Subject: leak fix 2 of 3: fix leaky fallback GIcon in get_device_icon() --- src/indicator-power.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index 4b3f85c..9a474bd 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; } -- cgit v1.2.3 From 45bc12d01cb4b692f55f6bb4cf4fd663e17d34fc Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 9 Apr 2012 14:16:07 -0500 Subject: leak fix 3 of 3: don't leak the GIcons returned by get_device_icon() --- src/indicator-power.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/indicator-power.c b/src/indicator-power.c index 9a474bd..19eff87 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -585,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); @@ -811,6 +812,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)); -- cgit v1.2.3 From a24e06c3bc23d2b929f1738f2cfe9b660b9bde04 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 9 Apr 2012 14:32:39 -0500 Subject: use atk_object_set_name(foo,bar)" instead of g_object_set(foo,"accessible-name",bar,NULL)" --- src/indicator-power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indicator-power.c b/src/indicator-power.c index 19eff87..5d37da3 100644 --- a/src/indicator-power.c +++ b/src/indicator-power.c @@ -595,7 +595,7 @@ menu_add_device (GtkMenu *menu, item = gtk_image_menu_item_new (); atk_object = gtk_widget_get_accessible(item); if (atk_object != NULL) - g_object_set (G_OBJECT(atk_object), "accessible-name", accessible_name, NULL); + atk_object_set_name (atk_object, accessible_name); grid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (grid), 6); -- cgit v1.2.3 From 3242c72d1491b07ee04753e047c72854a0b88d26 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 11 Apr 2012 10:02:18 -0500 Subject: 2.0 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8f5e102..fc287a2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([indicator-power], - [1.93], + [2.0], [http://bugs.launchpad.net/indicator-power], [indicator-power], [http://launchpad.net/indicator-power]) -- cgit v1.2.3