diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-10 17:44:16 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-02-10 17:44:16 +0100 |
commit | 07a19cb993cacaf3a1185f1268334a6f6d3e744f (patch) | |
tree | 053f608ca6e1736da5a852734b539f54cb742893 | |
parent | 981c01a3442a6a0a459ac313e29486b67aa1aac7 (diff) | |
parent | 1f045f4255da09068f5fbbdf89f178631211f2ee (diff) | |
download | ayatana-indicator-messages-07a19cb993cacaf3a1185f1268334a6f6d3e744f.tar.gz ayatana-indicator-messages-07a19cb993cacaf3a1185f1268334a6f6d3e744f.tar.bz2 ayatana-indicator-messages-07a19cb993cacaf3a1185f1268334a6f6d3e744f.zip |
Merge trunk
-rw-r--r-- | Makefile.am | 36 | ||||
-rw-r--r-- | configure.ac | 21 | ||||
-rw-r--r-- | m4/gcov.m4 | 83 | ||||
-rw-r--r-- | src/Makefile.am | 9 | ||||
-rw-r--r-- | src/indicator-messages.c | 4 | ||||
-rw-r--r-- | src/launcher-menu-item.c | 5 | ||||
-rw-r--r-- | src/messages-service.c | 16 |
7 files changed, 163 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am index d6f6168..e31937a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,3 +31,39 @@ dist-hook: else \ 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 diff --git a/configure.ac b/configure.ac index 67445d5..c445995 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-messages.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-messages, 0.5.0) +AM_INIT_AUTOMAKE(indicator-messages, 0.5.90) AM_MAINTAINER_MODE @@ -39,9 +39,9 @@ GTK_REQUIRED_VERSION=2.12 GTK3_REQUIRED_VERSION=3.0 GIO_UNIX_REQUIRED_VERSION=2.18 PANEL_REQUIRED_VERSION=2.0.0 -INDICATE_REQUIRED_VERSION=0.4.90 +INDICATE_REQUIRED_VERSION=0.6.90 INDICATOR_REQUIRED_VERSION=0.3.19 -DBUSMENUGTK_REQUIRED_VERSION=0.3.94 +DBUSMENUGTK_REQUIRED_VERSION=0.5.90 AC_ARG_WITH([gtk], [AS_HELP_STRING([--with-gtk], @@ -53,14 +53,14 @@ AS_IF([test "x$with_gtk" = x3], [PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK3_REQUIRED_VERSION gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION - indicate-0.6 >= $INDICATE_REQUIRED_VERSION + indicate-0.7 >= $INDICATE_REQUIRED_VERSION dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION) ], [test "x$with_gtk" = x2], [PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION indicator-0.4 >= $INDICATOR_REQUIRED_VERSION - indicate-0.6 >= $INDICATE_REQUIRED_VERSION + indicate-0.7 >= $INDICATE_REQUIRED_VERSION dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION) ], [AC_MSG_FAILURE([Value for --with-indicator-gtk was neither 2 nor 3])] @@ -91,6 +91,16 @@ AC_SUBST(STATUS_PROVIDER_EMESENE_CFLAGS) AC_SUBST(STATUS_PROVIDER_EMESENE_LIBS) ########################### +# gcov coverage reporting +########################### + +m4_include([m4/gcov.m4]) +AC_TDD_GCOV +AC_SUBST(COVERAGE_CFLAGS) +AC_SUBST(COVERAGE_CXXFLAGS) +AC_SUBST(COVERAGE_LDFLAGS) + +########################### # Check to see if we're local ########################### @@ -191,4 +201,5 @@ Messaging Indicator Configuration: Prefix: $prefix Indicator Dir: $INDICATORDIR + gcov: $use_gcov ]) diff --git a/m4/gcov.m4 b/m4/gcov.m4 new file mode 100644 index 0000000..1169573 --- /dev/null +++ b/m4/gcov.m4 @@ -0,0 +1,83 @@ +# Checks for existence of coverage tools: +# * gcov +# * lcov +# * genhtml +# * gcovr +# +# Sets ac_cv_check_gcov to yes if tooling is present +# 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, + AS_HELP_STRING([--enable-gcov], + [enable coverage testing with gcov]), + [use_gcov=$enableval], [use_gcov=no]) + + if test "x$use_gcov" = "xyes"; then + # we need gcc: + if test "$GCC" != "yes"; then + AC_MSG_ERROR([GCC is required for --enable-gcov]) + fi + + # Check if ccache is being used + AC_CHECK_PROG(SHTOOL, shtool, shtool) + case `$SHTOOL path $CC` in + *ccache*[)] gcc_ccache=yes;; + *[)] gcc_ccache=no;; + esac + + if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then + AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) + fi + + 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, [ + glib_cv_lcov_version=invalid + lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` + for lcov_check_version in $lcov_version_list; do + if test "$lcov_version" = "$lcov_check_version"; then + glib_cv_lcov_version="$lcov_check_version (ok)" + fi + done + ]) + else + lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" + AC_MSG_ERROR([$lcov_msg]) + fi + + case $glib_cv_lcov_version in + ""|invalid[)] + lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." + AC_MSG_ERROR([$lcov_msg]) + LCOV="exit 0;" + ;; + esac + + if test -z "$GENHTML"; then + 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 + + + # Remove all optimization flags from CFLAGS + changequote({,}) + CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` + changequote([,]) + + # Add the special gcc flags + COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage" + COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" + COVERAGE_LDFLAGS="-lgcov" + +fi +])]) # AC_TDD_GCOV + diff --git a/src/Makefile.am b/src/Makefile.am index 9da71ad..6617b49 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,6 +20,7 @@ libmessaging_la_SOURCES = \ dbus-data.h libmessaging_la_CFLAGS = \ $(APPLET_CFLAGS) \ + $(COVERAGE_CFLAGS) \ -Wall \ -Wl,-Bsymbolic-functions \ -Wl,-z,defs \ @@ -27,7 +28,9 @@ libmessaging_la_CFLAGS = \ -Werror \ -DG_LOG_DOMAIN=\"Indicator-Messages\" libmessaging_la_LIBADD = $(APPLET_LIBS) -lm -libmessaging_la_LDFLAGS = -module -avoid-version +libmessaging_la_LDFLAGS = \ + $(COVERAGE_LDFLAGS) \ + -module -avoid-version ###################################### # Building the messages service @@ -57,6 +60,7 @@ indicator_messages_service_SOURCES = \ indicator_messages_service_CFLAGS = \ $(APPLET_CFLAGS) \ + $(COVERAGE_CFLAGS) \ -Wall \ -Wl,-Bsymbolic-functions \ -Wl,-z,defs \ @@ -69,6 +73,9 @@ indicator_messages_service_LDADD = \ $(APPLET_LIBS) \ libindicator-messages-status-provider.la +indicator_messages_service_LDFLAGS = \ + $(COVERAGE_LDFLAGS) + gen-%.xml.h: %.xml @echo "Building $@ from $<" @echo "extern const char * _$(subst -,_,$(subst .,_,$(basename $(notdir $<))));" > $@ diff --git a/src/indicator-messages.c b/src/indicator-messages.c index f5f2fe0..197d55a 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -701,7 +701,11 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm gint font_size = gtk_widget_get_font_size (GTK_WIDGET (gmi)); gtk_widget_style_get(GTK_WIDGET(gmi), "toggle-spacing", &padding, NULL); +#if GTK_CHECK_VERSION(3, 0, 0) GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, padding); +#else + GtkWidget * hbox = gtk_hbox_new(FALSE, padding); +#endif /* Icon, probably someone's face or avatar on an IM */ mi_data->icon = gtk_image_new(); diff --git a/src/launcher-menu-item.c b/src/launcher-menu-item.c index e01806e..91cbbb8 100644 --- a/src/launcher-menu-item.c +++ b/src/launcher-menu-item.c @@ -211,7 +211,10 @@ launcher_menu_item_new (const gchar * desktop_file) dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_TYPE, APPLICATION_MENUITEM_TYPE); g_object_set_data(G_OBJECT(mi), NICK_DATA, (gpointer)nicks[i]); - dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i])); + gchar *name = indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i]); + dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, name); + g_free(name); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(nick_activate_cb), self); priv->shortcuts = g_list_append(priv->shortcuts, mi); diff --git a/src/messages-service.c b/src/messages-service.c index e8fe576..a21435c 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -104,10 +104,15 @@ serverList_equal (gconstpointer a, gconstpointer b) pa = (serverList_t *)a; pb = (serverList_t *)b; - const gchar * pas = INDICATE_LISTENER_SERVER_DBUS_NAME(pa->server); - const gchar * pbs = INDICATE_LISTENER_SERVER_DBUS_NAME(pb->server); - - return g_strcmp0(pas, pbs); + const gchar * pan = INDICATE_LISTENER_SERVER_DBUS_NAME(pa->server); + const gchar * pbn = INDICATE_LISTENER_SERVER_DBUS_NAME(pb->server); + const gchar * pap = indicate_listener_server_get_dbuspath(pa->server); + const gchar * pbp = indicate_listener_server_get_dbuspath(pb->server); + + if (g_strcmp0(pan, pbn) == 0) + return g_strcmp0(pap, pbp); + else + return 1; } static gint @@ -1296,6 +1301,7 @@ build_launcher (gpointer data) g_file_get_contents(path, &desktop, NULL, NULL); if (desktop == NULL) { + g_free(path); return FALSE; } @@ -1305,6 +1311,7 @@ build_launcher (gpointer data) build_launcher_core(trimdesktop); g_free(trimdesktop); + g_free(path); return FALSE; } @@ -1318,6 +1325,7 @@ build_launcher_keyfile (gpointer data) build_launcher_core(desktop); g_free(desktop); } + g_free(path); return FALSE; } |