From 1788ec9ce2c0d99c6b5d85150d67db76fed02d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 8 Nov 2011 23:42:40 +0100 Subject: Export the indicator name hint Using the PACKAGE config.h variable. --- src/indicator-messages.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 1b96464..d13de56 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -20,6 +20,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "config.h" + #include #include #include @@ -93,6 +95,7 @@ static void indicator_messages_middle_click (IndicatorObject * io, IndicatorObjectEntry * entry, guint time, gpointer data); static const gchar * get_accessible_desc (IndicatorObject * io); +static const gchar * get_name_hint (IndicatorObject * io); static void connection_change (IndicatorServiceManager * sm, gboolean connected, gpointer user_data); @@ -134,6 +137,7 @@ indicator_messages_class_init (IndicatorMessagesClass *klass) io_class->get_image = get_icon; io_class->get_menu = get_menu; io_class->get_accessible_desc = get_accessible_desc; + io_class->get_name_hint = get_name_hint; io_class->secondary_activate = indicator_messages_middle_click; if (bus_node_info == NULL) { @@ -796,6 +800,13 @@ get_accessible_desc (IndicatorObject * io) return accessible_desc; } +/* Returns the name hint of the indicator */ +static const gchar * +get_name_hint (IndicatorObject *io) +{ + return PACKAGE; +} + /* Hide the notifications on middle-click over the indicator-messages */ static void indicator_messages_middle_click (IndicatorObject * io, IndicatorObjectEntry * entry, -- cgit v1.2.3 From 6467734c50eb71e59bbacfa2baf5b9ccfa3e1c2b Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Thu, 1 Dec 2011 11:54:16 -0500 Subject: serverList_equal: We have to compare IndicateListenerServers by DBus path instead of just name. This fixes issues where one client (DBus name) will create two or more indicate servers. --- src/messages-service.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/messages-service.c b/src/messages-service.c index e8fe576..44e922e 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 -- cgit v1.2.3 From 4f5f1e3ea9317f37e55028631f493f4a709cd8a5 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 6 Dec 2011 18:51:58 -0600 Subject: Added coverage reporting via gcov config and targets. --- Makefile.am | 36 +++++++++++++++++++++++++ configure.ac | 11 ++++++++ m4/gcov.m4 | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 9 ++++++- 4 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 m4/gcov.m4 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..46f36ab 100644 --- a/configure.ac +++ b/configure.ac @@ -90,6 +90,16 @@ PKG_CHECK_MODULES(STATUS_PROVIDER_EMESENE, dbus-glib-1) 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 c631436..33473db 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) -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 $<))));" > $@ -- cgit v1.2.3 From 6de22d3836fd5e193433c5ed28136c101ddc48e4 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Mon, 23 Jan 2012 13:58:33 -0600 Subject: Fix for gtk_hbox_new, werror on deprecated. --- src/indicator-messages.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index d13de56..82fcfaf 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -695,7 +695,7 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm gint font_size = RIGHT_LABEL_FONT_SIZE; gtk_widget_style_get(GTK_WIDGET(gmi), "toggle-spacing", &padding, NULL); - GtkWidget * hbox = gtk_hbox_new(FALSE, padding); + GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, padding); /* Icon, probably someone's face or avatar on an IM */ mi_data->icon = gtk_image_new(); -- cgit v1.2.3 From 79faa63206faf6d3a00d6527e006936a05be933f Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Mon, 23 Jan 2012 15:06:35 -0600 Subject: Added macro to gtk_hbox_new fix per charles' advice. --- src/indicator-messages.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 82fcfaf..950dccf 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -695,7 +695,11 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm gint font_size = RIGHT_LABEL_FONT_SIZE; 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(); -- cgit v1.2.3 From fa3ed93da2ae4c79fed88fb005e8564076e41c8d Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Mon, 23 Jan 2012 15:16:17 -0600 Subject: Added macro to gtk_hbox_new fix per charles' advice (and fixed tabination). --- src/indicator-messages.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 82fcfaf..5a96cb9 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -695,7 +695,11 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm gint font_size = RIGHT_LABEL_FONT_SIZE; 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(); -- cgit v1.2.3 From 98e11cbd436cbca2b826a73222aee180fadcf980 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 31 Jan 2012 21:24:52 -0600 Subject: Updating deb to dbusmenu-gtk 0.5.90 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 67445d5..52debd7 100644 --- a/configure.ac +++ b/configure.ac @@ -41,7 +41,7 @@ GIO_UNIX_REQUIRED_VERSION=2.18 PANEL_REQUIRED_VERSION=2.0.0 INDICATE_REQUIRED_VERSION=0.4.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], -- cgit v1.2.3 From cb9291c80d32b4463dd1dc47d3a912ac4166f06d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 31 Jan 2012 21:25:17 -0600 Subject: Fixing dbusmenu-gtk include paths --- src/indicator-messages.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/indicator-messages.c b/src/indicator-messages.c index 5a96cb9..c75b49c 100644 --- a/src/indicator-messages.c +++ b/src/indicator-messages.c @@ -28,13 +28,8 @@ with this program. If not, see . #include #include -#if GTK_CHECK_VERSION(3, 0, 0) -#include -#include -#else #include #include -#endif #include #include -- cgit v1.2.3 From 817be57dddbcc9e9b8935bb65e95b91dd6ca03f0 Mon Sep 17 00:00:00 2001 From: Daniel d'Andrada Date: Wed, 8 Feb 2012 18:42:36 -0200 Subject: Fix memory leak: Free path string. The path was being created in build_launchers (line 1427) but never freed. --- src/messages-service.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/messages-service.c b/src/messages-service.c index 44e922e..a21435c 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -1301,6 +1301,7 @@ build_launcher (gpointer data) g_file_get_contents(path, &desktop, NULL, NULL); if (desktop == NULL) { + g_free(path); return FALSE; } @@ -1310,6 +1311,7 @@ build_launcher (gpointer data) build_launcher_core(trimdesktop); g_free(trimdesktop); + g_free(path); return FALSE; } @@ -1323,6 +1325,7 @@ build_launcher_keyfile (gpointer data) build_launcher_core(desktop); g_free(desktop); } + g_free(path); return FALSE; } -- cgit v1.2.3 From 484c86d10f4295fd13248bafdf0862bc51c51b5b Mon Sep 17 00:00:00 2001 From: Daniel d'Andrada Date: Thu, 9 Feb 2012 15:09:50 -0200 Subject: Plug leak in launcher_menu_item_new Memory returned by indicator_desktop_shortcuts_nick_get_name has to be freed. --- src/launcher-menu-item.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3 From 587d814045f4b833cb42c574ad0f6a433a9ec41b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Feb 2012 22:20:19 -0600 Subject: Adjust configure to use indicate-0.7 --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 52debd7..d6e7847 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ 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.5.90 @@ -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])] -- cgit v1.2.3 From 1f045f4255da09068f5fbbdf89f178631211f2ee Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Feb 2012 22:31:57 -0600 Subject: 0.5.90 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8b6f966..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 -- cgit v1.2.3